/* Kingdom RP */
:root {
    color-scheme: dark;
    --bg: #18181b;
    --bg-2: #252528;
    --bg-3: #303034;
    --border: #3a3a40;
    --text: #e9edf4;
    --text-dim: #a6afbf;
    --red: #b54e5c;
    --red-2: #f28b98;
    --gold: #aaa5ff;
    --gold-2: #d4d1ff;
    --shadow: 0 4px 16px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 1fr;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); text-decoration: underline; }

/* ─── Sidebar ─── */
aside {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

aside .logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

aside .logo img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    padding: 2px;
}

aside .logo .brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

aside .logo .brand b {
    font-size: 15px;
    color: var(--gold);
    letter-spacing: 0.5px;
}

aside .logo .brand small {
    color: var(--text-dim);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

aside .section {
    padding: 12px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1.2px;
    font-weight: 700;
}

aside nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text);
    font-size: 14px;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

aside nav a:hover {
    background: var(--bg-3);
    color: var(--gold-2);
    text-decoration: none;
    border-left-color: var(--red);
}

aside nav a.active {
    background: linear-gradient(90deg, rgba(192,57,43,0.15) 0%, transparent 100%);
    color: var(--gold-2);
    border-left-color: var(--gold);
}

aside nav a .icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

/* ─── User box ─── */
aside .user-box {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

aside .user-box .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-3);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--gold);
    color: var(--gold);
    font-weight: 700;
}

aside .user-box .who {
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.3;
    min-width: 0;
}

aside .user-box .who b {
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

aside .user-box .who small {
    color: var(--gold);
    font-size: 11px;
}

aside .user-box a.logout {
    color: var(--red-2);
    font-size: 18px;
    padding: 4px;
}

aside .user-box a.logout:hover { color: #ff5c5c; }

/* ─── Main ─── */
main {
    padding: 32px 40px;
    max-width: 1400px;
    width: 100%;
}

h1 {
    font-size: 28px;
    margin-bottom: 6px;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.3px;
}

h1 + .subtitle {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

h2 {
    font-size: 18px;
    margin: 28px 0 12px;
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 0.3px;
}

h3 {
    font-size: 15px;
    margin: 18px 0 8px;
    color: var(--text);
    font-weight: 600;
}

p { margin: 8px 0; }

pre, code {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
}

pre {
    background: var(--bg-3);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    color: var(--text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    border-left: 3px solid var(--red);
}

.muted { color: var(--text-dim); font-size: 13px; }

/* ─── Карточки с иконками ─── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kcard {
    background: linear-gradient(145deg, var(--bg-2) 0%, var(--bg-3) 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
    cursor: pointer;
}

.kcard:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.kcard .kicon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(192, 57, 43, 0.15);
    border: 1px solid rgba(192, 57, 43, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.kcard .kinfo {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.kcard .ktitle {
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.kcard .kvalue {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    line-height: 1.1;
}

.kcard .ksub {
    color: var(--gold);
    font-size: 12px;
    margin-top: 2px;
}

/* ─── Формы ─── */
.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-2);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    max-width: 700px;
    border: 1px solid var(--border);
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.form input,
.form textarea,
.form select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.form input:focus,
.form textarea:focus,
.form select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 165, 74, 0.15);
}

.form textarea {
    resize: vertical;
    min-height: 80px;
}

.inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
    margin-bottom: 8px;
}

/* ─── Кнопки ─── */
.btn {
    background: linear-gradient(135deg, var(--red) 0%, #962d22 100%);
    color: #fff;
    border: 1px solid var(--red-2);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.15s;
    text-decoration: none;
    display: inline-block;
    letter-spacing: 0.3px;
}

.btn:hover {
    background: linear-gradient(135deg, var(--red-2) 0%, var(--red) 100%);
    box-shadow: 0 0 16px rgba(231, 76, 60, 0.4);
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, #a37a2a 100%);
    border-color: var(--gold-2);
    color: #1a1a1d;
}

.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-2) 0%, var(--gold) 100%);
    box-shadow: 0 0 16px rgba(240, 198, 116, 0.4);
}

.btn-success { background: linear-gradient(135deg, #27ae60 0%, #1e8449 100%); border-color: #2ecc71; }
.btn-success:hover { box-shadow: 0 0 16px rgba(46, 204, 113, 0.4); }

.btn-danger { background: linear-gradient(135deg, #c0392b 0%, #7b241c 100%); }
.btn-danger:hover { box-shadow: 0 0 16px rgba(192, 57, 43, 0.5); }

.btn-small { padding: 5px 12px; font-size: 12px; }

/* ─── Таблицы ─── */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-2);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

th {
    background: var(--bg);
    color: var(--gold);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: rgba(212, 165, 74, 0.04); }

/* ─── Flash ─── */
.flash {
    padding: 12px 18px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    border-left: 4px solid;
}

.flash-ok {
    background: rgba(46, 204, 113, 0.1);
    color: #a3e5a8;
    border-left-color: #2ecc71;
}

.flash-error {
    background: rgba(231, 76, 60, 0.1);
    color: #f5a3a4;
    border-left-color: var(--red-2);
}

/* ─── Login ─── */
.login-body {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: radial-gradient(circle at center, #1a1a1d 0%, #0d0d10 100%);
    grid-template-columns: 1fr !important;
}

.login-card {
    background: var(--bg-2);
    padding: 48px 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 420px;
    width: 100%;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6), 0 0 0 1px rgba(212,165,74,0.1);
}

.login-logo {
    width: 96px;
    height: 96px;
    margin-bottom: 20px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    padding: 3px;
}

.login-card h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--gold);
    letter-spacing: 1px;
}

.login-card p {
    color: var(--text-dim);
    margin-bottom: 28px;
    font-size: 14px;
}

.login-card small {
    display: block;
    margin-top: 24px;
    color: var(--text-dim);
    font-size: 12px;
}

.btn-discord {
    background: linear-gradient(135deg, #5865f2 0%, #4752c4 100%);
    border-color: #7289da;
    display: inline-block;
    width: 100%;
    padding: 14px;
    font-size: 15px;
    margin-top: 8px;
    text-align: center;
}

.btn-discord:hover {
    background: linear-gradient(135deg, #7289da 0%, #5865f2 100%);
    box-shadow: 0 0 20px rgba(88, 101, 242, 0.5);
}

/* ─── Логи ─── */
.log-files {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.log-file {
    background: var(--bg-2);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--text);
    font-size: 13px;
    transition: all 0.15s;
}

.log-file:hover {
    border-color: var(--gold);
    text-decoration: none;
}

.log-file.active {
    background: linear-gradient(135deg, var(--red) 0%, #962d22 100%);
    border-color: var(--red-2);
    color: #fff;
}

.log-view {
    background: var(--bg);
    padding: 16px;
    border-radius: 8px;
    max-height: 600px;
    overflow-y: auto;
    color: #b9bbbe;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: Consolas, Monaco, monospace;
    border: 1px solid var(--border);
}

/* ─── Итоги ─── */
.totals {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.tot {
    background: var(--bg-2);
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid var(--border);
    border-top: 3px solid var(--red);
    transition: all 0.15s;
}

.tot:hover { border-top-color: var(--gold); transform: translateY(-2px); }

.tot b {
    display: block;
    font-size: 26px;
    color: var(--gold);
    margin-bottom: 4px;
    font-weight: 700;
}

.tot span {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* ─── Footer ─── */
footer {
    background: var(--bg);
    color: var(--text-dim);
    text-align: center;
    padding: 20px;
    font-size: 12px;
    margin-top: auto;
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
}

/* ─── Level badges ─── */
.lvl-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.lvl-0 { background: #333; color: #999; }
.lvl-1 { background: #2c3e50; color: #85c1e9; }
.lvl-2 { background: #1e5631; color: #7dcea0; }
.lvl-3 { background: #7d6608; color: #f7dc6f; }
.lvl-4 { background: #7b241c; color: #f5b7b1; }
.lvl-5 { background: #6c3483; color: #d7bde2; }
.lvl-10 { background: linear-gradient(135deg, #c0392b, #d4a54a); color: #fff; }
/* ─── Inline формы в таблицах ─── */
.inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}

.input-mini {
    width: 70px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.input-mini:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 165, 74, 0.15);
}
/* ─── Просмотр тикета (чат) ─── */
.chat-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    max-height: 700px;
    overflow-y: auto;
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 10px;
    border-left: 3px solid;
    max-width: 75%;
}

.chat-from-user {
    background: rgba(52, 152, 219, 0.08);
    border-left-color: #3498db;
    align-self: flex-start;
}

.chat-from-support {
    background: rgba(192, 57, 43, 0.08);
    border-left-color: var(--red);
    align-self: flex-end;
}

.chat-head {
    display: flex;
    gap: 10px;
    align-items: baseline;
    margin-bottom: 6px;
    font-size: 13px;
}

.chat-head b { color: var(--gold); }
.chat-head .muted { font-size: 11px; }

.chat-body {
    color: var(--text);
    font-size: 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-attach {
    margin-top: 6px;
    font-size: 12px;
}

.chat-attach a { color: var(--gold); }
/* ─── Управление ботами ─── */
.bot-card {
    flex-wrap: wrap;
    cursor: default;
}

.bot-card:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}

.bot-actions {
    display: flex;
    gap: 6px;
    margin-left: auto;
    flex-wrap: wrap;
}

.bot-actions form {
    display: inline-block;
}

.status-running {
    color: #2ecc71;
    font-size: 15px;
    font-weight: 600;
}

.status-stopped {
    color: #e74c3c;
    font-size: 15px;
    font-weight: 600;
}

.bot-card .kvalue {
    font-size: 16px;
}
/* ─── Фильтры автомода ─── */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.filter-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color 0.15s;
}

.filter-card.active {
    border-left: 4px solid var(--red);
}

.filter-card > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.filter-card b {
    color: var(--text);
    font-size: 14px;
}

.filter-card small {
    font-size: 11px;
    color: var(--text-dim);
}

/* ─── Пороги варнов ─── */
.card form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 16px;
    color: var(--text-dim);
    font-size: 13px;
}

.input-mini {
    width: 60px;
}
/* ─── Правая колонка ─── */
body {
    grid-template-columns: 260px 1fr 220px;
    grid-template-rows: 1fr;
}

.right-side {
    background: var(--bg-2);
    border-left: 1px solid var(--border);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

.right-side nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 20px;
    color: var(--text-dim);
    font-size: 13px;
    transition: all 0.15s;
}

.right-side nav a:hover {
    background: var(--bg-3);
    color: var(--gold-2);
    text-decoration: none;
}

.right-side .section {
    padding: 12px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 1.2px;
    font-weight: 700;
}

.right-side .right-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    text-align: center;
}

/* ─── Карточки ботов ─── */
.bots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.bot-card {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: border-color 0.15s;
}

.bot-card:hover { border-color: var(--gold); }

.bot-head {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-head .bot-icon {
    width: 42px;
    height: 42px;
    background: rgba(192, 57, 43, 0.15);
    border: 1px solid rgba(192, 57, 43, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.bot-head > div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bot-head b { color: var(--text); font-size: 14px; }
.bot-head small { color: var(--text-dim); font-size: 11px; }

.bot-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.bot-status small { font-size: 11px; }

.bot-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.card-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ─── Список логов ─── */
.logs-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
}

.log-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 16px;
    align-items: center;
}

.log-label {
    color: var(--text-dim);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.log-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-input input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
}

.log-input input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 165, 74, 0.15);
}

.btn-block {
    display: block;
    width: 100%;
    max-width: 720px;
    padding: 14px;
    font-size: 15px;
}

.actions-row {
    margin-bottom: 20px;
}

/* ─── Автомод — секции ─── */
.filter-section {
    margin-bottom: 24px;
}

.filter-section h3 {
    color: var(--gold);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.inline-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    align-items: end;
}

.inline-3 label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--text-dim);
    font-size: 13px;
}

.input-mini {
    width: 80px;
    padding: 8px 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

/* ─── Уровни 2.5 ─── */
.lvl-2_5 { background: #16a085; color: #fff; }
/* ─── Модалка ─── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    min-width: 380px;
    max-width: 500px;
}

.modal h2 {
    color: var(--gold);
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 20px;
}

.modal label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
    color: var(--text-dim);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal input,
.modal select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    text-transform: none;
    letter-spacing: normal;
}

.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: var(--gold);
}
/* ─── Пустое состояние ─── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.empty-state h1 {
    color: var(--gold);
    font-size: 32px;
    margin-bottom: 12px;
}

.empty-state .muted {
    font-size: 15px;
    max-width: 400px;
    line-height: 1.6;
}

/* Staff workspace */
body.panel-layout { grid-template-columns: 224px minmax(0, 1fr); }
.panel-layout main { max-width: 1480px; min-width: 0; padding: 30px clamp(16px, 4vw, 48px) 52px; }
.panel-sidebar { background: #13161c; padding: 22px 12px 0; }
.panel-sidebar .logo { padding: 0 8px 22px; }
.panel-sidebar .logo .brand b { color: var(--text); letter-spacing: 0; }
.panel-sidebar .logo .brand small { margin-top: 3px; letter-spacing: .06em; }
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-3);
    color: var(--gold);
    font-size: 13px;
    font-weight: 750;
}
.panel-sidebar .primary-nav { display: grid; gap: 4px; margin-bottom: 20px; }
.panel-sidebar .primary-nav a { border: 1px solid transparent; border-radius: 7px; padding: 10px 12px; color: var(--text-dim); }
.panel-sidebar .primary-nav a:hover { background: var(--bg-2); color: var(--text); }
.panel-sidebar .primary-nav a.active { background: var(--bg-3); color: var(--text); border-color: var(--border); }
.panel-sidebar .user-box { padding: 14px 6px; }
.panel-sidebar .user-box .avatar { width: 29px; height: 29px; flex-shrink: 0; border: 1px solid var(--border); }
.panel-sidebar .user-box .who small { color: var(--text-dim); }
.panel-sidebar .user-profile-link { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; color: inherit; }
.panel-sidebar .user-profile-link:hover .who b { color: var(--accent); }
.text-button { background: none; color: var(--text-dim); font: inherit; padding: 6px; border: 0; cursor: pointer; }
.text-button:hover { color: var(--text); }
.panel-tabs { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 24px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.panel-tabs a { padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--text-dim); }
.panel-tabs a:hover, .panel-tabs a.active { background: var(--bg-3); color: var(--text); text-decoration: none; }
.eyebrow { margin-bottom: 9px; font-size: 12px; font-weight: 600; color: var(--text-dim); }
h1 { font-size: clamp(25px, 4vw, 35px); letter-spacing: -.025em; line-height: 1.15; }
h2 { color: var(--text); letter-spacing: -.01em; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 12px; margin-bottom: 24px; }
.summary-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 13px;
}
a.summary-card:hover { border-color: var(--gold); color: var(--text); text-decoration: none; }
.summary-card strong { font-size: 26px; color: var(--text); }
.summary-card h2 { margin: 0; }
.summary-card strong.connection-state { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.state-dot { background: #8c98ad; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.state-dot.online { background: #63d6a9; }
.panel-section { margin-top: 24px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; }
.section-heading a { font-size: 13px; }
.panel-note { margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 7px; background: var(--bg-2); color: var(--text-dim); font-size: 14px; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filter-chip, .pill {
    display: inline-block;
    padding: 5px 9px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-2);
    color: var(--text-dim);
    font-size: 12px;
}
.filter-chip.selected { background: #24304a; border-color: #435986; color: var(--gold-2); }
.filter-chip span { margin-left: 3px; }
.pill.waiting { color: #f0cd97; border-color: #685135; background: #2c241c; }
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.table-scroll table { border: 0; border-radius: 0; margin: 0; }
.data-table th { color: var(--text-dim); background: #1b1f28; font-weight: 650; text-transform: none; font-size: 12px; letter-spacing: 0; }
.data-table th, .data-table td { padding: 11px 13px; }
tr:hover td { background: #20242e; }
.nowrap { white-space: nowrap; }
.cell-detail { display: block; margin-top: 3px; color: var(--text-dim); font-size: 11px; }
.mobile-label { display: none; }
.search-row { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.search-row label { display: grid; flex: 0 1 320px; gap: 5px; color: var(--text-dim); font-size: 13px; }
.search-row input { min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-2); color: var(--text); font: inherit; }
.case-detail { max-width: 760px; padding: 18px; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }
.case-detail h2 { margin-top: 0; }
.case-detail dl { display: grid; grid-template-columns: minmax(90px, 145px) minmax(0, 1fr); gap: 12px; }
.case-detail dt { color: var(--text-dim); }
.case-detail dd { overflow-wrap: anywhere; white-space: pre-wrap; }
.btn, .btn-gold, .btn-success, .btn-discord { background: var(--bg-3); border-color: #414b5e; color: var(--text); border-radius: 6px; box-shadow: none; letter-spacing: 0; }
.btn:hover, .btn-gold:hover, .btn-success:hover, .btn-discord:hover { background: #2b3446; border-color: #657392; color: #fff; box-shadow: none; transform: none; }
.btn-danger { background: #321d24; border-color: #683844; color: #ffd1d8; }
.btn-danger:hover { background: #482630; border-color: #986171; }
.kcard, .bot-card, .login-card { background: var(--bg-2); border-color: var(--border); box-shadow: none; }
.kcard:hover { box-shadow: none; transform: none; }
.login-card .brand-mark { width: 48px; height: 48px; margin-bottom: 12px; }
@media (max-width: 760px) {
    body.panel-layout { display: block; }
    .panel-sidebar { position: static; min-height: 0; max-height: none; padding: 12px 14px 0; border-right: 0; border-bottom: 1px solid var(--border); }
    .panel-sidebar .logo { padding: 0 0 10px; margin-bottom: 8px; }
    .panel-sidebar .primary-nav { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
    .panel-sidebar .primary-nav a { padding: 7px 9px; }
    .panel-sidebar .user-box { padding: 8px 0; }
    .panel-layout main { padding: 18px 14px 36px; }
    .panel-layout main > table { display: block; overflow-x: auto; }
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card { padding: 12px; }
    .ticket-table, .ticket-table tbody { display: block; }
    .ticket-table thead { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
    .ticket-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px 12px; padding: 13px; }
    .ticket-table tr + tr { border-top: 1px solid var(--border); }
    .ticket-table td { padding: 0; border: 0; overflow-wrap: anywhere; white-space: normal; }
    .ticket-table tr:hover td { background: transparent; }
    .ticket-table td[colspan], .ticket-action { grid-column: 1 / -1; }
    .mobile-label { display: block; margin-bottom: 3px; color: var(--text-dim); font-size: 11px; }
}
@media (max-width: 340px) {
    .summary-grid { grid-template-columns: 1fr; }
}

.candidate-card { max-width: 600px; text-align: left; margin: 16px auto; }
.candidate-card .form { margin: 16px 0; }
.candidate-card .btn { margin-top: 6px; }
.candidate-card .panel-note { margin-top: 14px; }

/* Staff directory, role editor and profiles */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.staff-panel { background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; margin: 0 0 16px; padding: 18px; }
.staff-panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.staff-panel-heading h1, .staff-panel h2 { margin: 0; }
.staff-subtitle { color: var(--text-dim); margin: 8px 0 22px; }
.staff-summary .summary-card { border-radius: 11px; }
.staff-summary .summary-card strong { font-size: 28px; }
.staff-search { margin: 0; align-items: center; }
.staff-search input[type=search] { width: min(250px, 65vw); }
.staff-filters { margin: 12px 0; }
.staff-table { border: 0; border-radius: 7px; }
.staff-table td { padding-block: 13px; }
.staff-person { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.staff-person-text { display: grid; gap: 4px; }
.staff-name { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.staff-avatar { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.staff-avatar-fallback { position: relative; display: grid; place-items: center; overflow: hidden; background: #293653; color: var(--gold-2); font-weight: 700; }
.staff-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.staff-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.staff-badges .pill { padding: 3px 7px; }
.staff-badges .level-tag { background: #26344e; color: var(--gold-2); }
.staff-role-chip { color: color-mix(in srgb, var(--role-color) 70%, white); border-color: color-mix(in srgb, var(--role-color) 35%, var(--border)); background: color-mix(in srgb, var(--role-color) 14%, var(--bg-2)); }
.staff-profile-grid { display: grid; align-items: start; grid-template-columns: minmax(205px, 275px) minmax(0, 1fr); gap: 16px; }
.staff-profile-card { display: grid; justify-items: center; text-align: center; gap: 10px; position: static; min-height: 0; background: linear-gradient(155deg, #25263b, var(--bg-2) 65%); }
.staff-profile-card .staff-avatar { width: 76px; height: 76px; font-size: 26px; }
.staff-profile-card .staff-badges { justify-content: center; }
.staff-profile-links { width: 100%; display: grid; gap: 7px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.staff-profile-links a { border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; font-size: 13px; }
.staff-detail { margin-bottom: 14px; }
.staff-detail dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0 0; }
.staff-detail dt { color: var(--text-dim); font-size: 12px; margin-bottom: 5px; }
.staff-detail dd { margin: 0; overflow-wrap: anywhere; }
.staff-detail .form { margin-top: 14px; }
.access-matrix { margin-top: 16px; }
.access-matrix table { min-width: 850px; }
.access-matrix tbody th { min-width: 175px; text-align: left; }
.access-matrix small { display: block; color: var(--text-dim); margin-top: 4px; font-weight: 400; }
.access-matrix :is(th, td):nth-child(n+3) { text-align: center; white-space: nowrap; }
.access-threshold { display: flex; flex-wrap: wrap; gap: 5px; min-width: 70px; }
.access-threshold select {
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: #1b1f28;
    color: inherit;
}
.access-granted { color: #76d6a1; }
.access-conditional { color: #efbf7e; }
.channel-access-form fieldset {
    display: grid;
    gap: 9px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.channel-access-form label:has(input) { display: flex; align-items: center; gap: 7px; }
.channel-access-form label input { width: auto; }
.channel-role-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    gap: 6px;
    max-height: 215px;
    overflow: auto;
}
.channel-role-choices label { flex-wrap: wrap; overflow-wrap: anywhere; }
.channel-confirm { margin-top: 14px; }
.panel-sidebar { background: #202024; }
.staff-panel, .panel-section, .summary-card {
    background: linear-gradient(145deg, #29292e, #242428);
    box-shadow: 0 5px 18px rgba(0, 0, 0, .14);
}
.btn, .filter-chip, .primary-nav a, .staff-table tr {
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}
.btn:hover { box-shadow: 0 4px 14px rgba(128, 115, 255, .18); }
.role-dialog {
    width: min(720px, calc(100vw - 28px));
    max-height: min(85vh, 850px);
    margin: auto;
    padding: 0;
    border: 1px solid #4c4965;
    border-radius: 14px;
    background: #26262b;
    color: var(--text);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.role-dialog::backdrop { background: rgba(9, 9, 13, .72); }
.role-dialog[open] { animation: role-dialog-in .16s ease-out; }
@keyframes role-dialog-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.role-permission-form { display: grid; gap: 16px; padding: 22px; }
.role-dialog-header, .role-dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.role-dialog-header h2 { margin: 3px 0 0; }
.role-permission-search { width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 7px; padding: 10px; }
.role-permission-list { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.role-permission-list label { display: flex; gap: 8px; align-items: flex-start; }
.role-permission-list label[hidden] { display: none; }
.role-permission-list small { color: var(--text-dim); }
.role-dialog-actions { justify-content: flex-start; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.staff-warning {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid;
    border-radius: 7px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.staff-warning--clear { color: #8ad5ad; background: #203a2e; border-color: #315d43; }
.staff-warning--active { color: #f3cb78; background: #433522; border-color: #70542b; }
.staff-warning--full { color: #f29196; background: #482629; border-color: #783b42; }
.staff-profile-card > .staff-warning { margin-top: 14px; }
.panel-section { padding: 18px; }
.section-heading { gap: 12px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; }
.panel-section > .search-row { margin-top: 12px; }
.panel-section > .data-table, .panel-section > .table-scroll { margin-top: 12px; }
.data-table tbody tr.staff-banner-row {
    background-image: linear-gradient(90deg, rgba(22, 23, 29, .94), rgba(22, 23, 29, .76)), var(--staff-banner-image);
    background-position: center;
    background-size: cover;
}
.data-table tbody tr.staff-banner-row > td { background: transparent; }
.data-table tbody tr.staff-banner-row:hover > td { background: rgba(101, 111, 143, .12); }
.discord-level-tag { position: relative; overflow: hidden; isolation: isolate; }
.staff-badges .discord-level-tag {
    border-color: color-mix(in srgb, var(--role-color, #a9bfff) 48%, var(--border));
    background: color-mix(in srgb, var(--role-color, #a9bfff) 19%, var(--bg-2));
    color: color-mix(in srgb, var(--role-color, #a9bfff) 84%, white);
}
.discord-level-tag::after {
    content: ""; position: absolute; z-index: 1; inset: -40% auto -40% -55%; width: 42%;
    transform: skewX(-20deg); background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent);
    animation: role-sheen 5.5s ease-in-out infinite;
}
@keyframes role-sheen { 0%, 68% { left: -55%; } 100% { left: 125%; } }
.profile-settings-button {
    position: absolute !important; z-index: 3 !important; top: 12px; right: 12px;
    display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
    border: 1px solid rgba(230,232,244,.2); border-radius: 9px; color: var(--text);
    background: rgba(19,20,27,.72); cursor: pointer; transition: background .18s ease, transform .18s ease;
}
.profile-settings-button:hover { background: rgba(77,75,111,.85); transform: rotate(18deg); }
.profile-settings-dialog { width: min(420px, calc(100vw - 28px)); }
.profile-background-form { display: grid; gap: 18px; padding: 20px; }
.profile-background-form .role-dialog-header { align-items: flex-start; }
.profile-background-form .role-dialog-header h2 { font-size: 20px; }
.ember-toggle { display: flex; align-items: center; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,.025); }
.ember-toggle input { width: 18px; height: 18px; accent-color: #e78b50; }
.profile-background-form .role-dialog-actions { flex-wrap: wrap; }
.staff-profile-card .profile-settings-dialog { position: fixed; inset: 0; margin: auto; }
@media (max-width: 760px) {
    .panel-section { padding: 14px; }
    .staff-banner-row { background-position: center; }
}
@media (prefers-reduced-motion: reduce) {
    .discord-level-tag::after { animation: none; }
}
.channel-access-form { max-width: 820px; }
.channel-access-form .channel-rule { gap: 12px; }
.channel-access-form .channel-rule-choice {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.channel-rule-choice:has(input:checked) { border-color: var(--gold); background: #343248; }
.channel-rule-choice span { display: grid; gap: 3px; }
.channel-rule-choice small { color: var(--text-dim); font-weight: 400; }
.channel-access-form .channel-rule-choice input { margin-top: 3px; padding: 0; accent-color: #aaa5ff; }
.channel-rule:not(:has(input[value="roles"]:checked)) .channel-role-choices,
.channel-rule:not(:has(input[value="level"]:checked)) .channel-level-select { display: none; }

.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 16px 0 28px; }
.pagination a { color: var(--gold); text-decoration: none; }
.channel-role-choices { padding: 4px 2px; }
.channel-access-form .channel-role-choices label {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 8px;
    border-radius: 6px;
    background: var(--bg-3);
    color: var(--text);
    text-transform: none;
    letter-spacing: 0;
}
.channel-role-choices small { width: 100%; padding-left: 22px; font-weight: 400; }
.staff-history { margin-top: 10px; border: 1px solid var(--border); border-radius: 7px; padding: 10px 12px; background: var(--bg); overflow-wrap: anywhere; }
.staff-history strong { margin-right: 12px; }
.staff-history p { margin-bottom: 0; font-size: 13px; }
.staff-role-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; padding: 13px 0; align-items: start; }
.staff-role-row + .staff-role-row { border-top: 1px solid var(--border); }
.staff-role-row h3 { margin: 0 0 6px; overflow-wrap: anywhere; }
.staff-role-row h3 .pill { margin-left: 4px; font-weight: 400; }
.staff-role-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 8px; color: color-mix(in srgb, var(--role-color) 70%, white); background: color-mix(in srgb, var(--role-color) 16%, var(--bg-2)); }
.profile-access-roles { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; width: 100%; }
.profile-secondary-roles { display: grid; gap: 7px; width: 100%; margin-top: 3px; }
.profile-secondary-roles h3 { margin: 0; color: var(--text-dim); font-size: 11px; font-weight: 600; letter-spacing: .02em; text-align: left; }
.profile-secondary-roles .profile-access-roles { justify-content: flex-start; gap: 5px; }
.profile-secondary-roles .discord-role-chip { min-height: 24px; gap: 5px; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.profile-secondary-roles .discord-role-dot { width: 8px; height: 8px; flex-basis: 8px; }
.profile-secondary-roles .access-role-add { width: 24px; height: 24px; font-size: 18px; }
.access-role-add { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-3); color: var(--text); font-size: 23px; line-height: 1; cursor: pointer; }
.profile-access-roles .access-role-add { width: 27px; height: 27px; border-radius: 7px; }
.access-role-add:hover { border-color: #7c78a6; background: #343248; }
.discord-role-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 4px 8px; border-radius: 6px; color: color-mix(in srgb, var(--role-color) 80%, white); background: color-mix(in srgb, var(--role-color) 13%, var(--bg-2)); font-size: 13px; font-weight: 600; }
.discord-role-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--role-color); }
.discord-role-chip form { display: inline-flex; margin-left: 1px; }
.discord-role-chip form button { display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: inherit; font-size: 17px; line-height: 1; cursor: pointer; opacity: .7; }
.discord-role-chip form button:hover { background: rgba(0, 0, 0, .2); opacity: 1; }
.access-role-picker-content { display: grid; gap: 16px; padding: 20px; }
.access-role-options { display: grid; gap: 7px; max-height: 55vh; overflow-y: auto; }
.access-role-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.staff-role-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.staff-form-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.staff-form-pair input[type=color] { min-height: 36px; }
.staff-permissions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 9px; border: 1px solid var(--border); border-radius: 7px; padding: 10px; }
.staff-permissions legend { padding: 0 4px; color: var(--text-dim); font-size: 13px; }
.staff-permissions label { display: flex; flex-direction: row; gap: 7px; align-items: center; }
.staff-permissions input[type=checkbox] { width: auto; margin: 0; accent-color: #a9bfff; }
.btn-primary { background: #344777; border-color: #667eb8; color: #f0f4ff; }

/* Consistent spacing, readable controls and responsive panel shell. */
.panel-layout { grid-template-columns: 236px minmax(0, 1fr); }
.panel-layout main { max-width: 1600px; margin-inline: auto; padding: 34px clamp(20px, 4vw, 56px) 56px; }
.panel-sidebar { padding-inline: 12px; }
.panel-sidebar .logo { padding-inline: 10px; }
.panel-sidebar .primary-nav { gap: 5px; }
.panel-sidebar .primary-nav a { min-height: 42px; padding: 10px 12px; }
.panel-sidebar .user-box {
    gap: 9px;
    margin: auto 2px 10px;
    padding: 12px 8px;
    border: 1px solid rgba(169, 165, 255, .14);
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(91, 84, 150, .2), rgba(36, 36, 42, .82));
}
.panel-sidebar .user-box .avatar { position: relative; overflow: hidden; width: 36px; height: 36px; }
.panel-sidebar .user-box .avatar img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.panel-sidebar .user-box .avatar span { position: relative; z-index: 1; }
.panel-sidebar .user-box .avatar:has(img:not([hidden])) span { opacity: 0; }
.panel-sidebar .text-button { padding: 7px 8px; border-radius: 7px; font-size: 12px; }
.panel-layout main > h1 { margin-bottom: 7px; }
.panel-tabs { gap: 6px; margin-bottom: 26px; padding-bottom: 10px; }
.summary-grid { gap: 14px; margin-bottom: 26px; }
.summary-card, .staff-panel, .panel-section { border-radius: 12px; }
.summary-card { min-height: 104px; justify-content: space-between; padding: 18px 20px; }
.staff-panel { padding: 20px; }
.staff-detail { margin-bottom: 16px; }
.staff-detail dl { gap: 18px 24px; }
.data-table th, .data-table td { padding: 13px 15px; }
.filter-row { gap: 9px; margin-bottom: 16px; }
.filter-chip, .pill { border-radius: 8px; }
.search-row { gap: 10px; margin-bottom: 16px; }
.panel-layout :is(input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea) {
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: #1e1e23;
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}
.panel-layout :is(input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea):focus {
    border-color: #7771c7;
    box-shadow: 0 0 0 3px rgba(128, 115, 255, .12);
    outline: 0;
}
.panel-layout :is(.btn, .filter-chip, .panel-tabs a, .staff-profile-links a) {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease,
        box-shadow .18s ease, transform .18s ease;
}
.panel-layout .btn:hover, .panel-layout .staff-profile-links a:hover { transform: translateY(-1px); }
.panel-layout .staff-table tbody tr { transition: background-color .18s ease; }

.staff-profile-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 22px;
    border-radius: 14px;
    background: linear-gradient(145deg, #292938, #242428 68%);
}
.staff-profile-card > :not(.profile-bg-layer):not(dialog) { position: relative; z-index: 1; }
.profile-bg-layer { position: absolute; z-index: 0; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; }
.staff-profile-card.profile-bg-ember { background: linear-gradient(155deg, #291b1a, #211e21 64%, #202027); }
.ticket-topic-editor { display: grid; gap: 12px; margin: 12px 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; }
.ticket-topic-editor legend { padding: 0 8px; color: var(--muted); }
.topic-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.form-grid { display: grid; grid-template-columns: minmax(120px, .25fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 600px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.ember-canvas, .ember-scrim { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ember-canvas { opacity: 0; transition: opacity .45s ease; }
.profile-bg-ember .ember-canvas { opacity: .9; }
.ember-scrim { background: transparent; }
.profile-bg-ember .ember-scrim { background: linear-gradient(180deg, rgba(18,17,21,.12), rgba(18,17,21,.28) 44%, rgba(18,17,21,.68)); }
@media (max-width: 980px) {
    .panel-layout { grid-template-columns: 210px minmax(0, 1fr); }
    .panel-layout main { padding-inline: 24px; }
}
@media (max-width: 760px) {
    .panel-layout { display: block; }
    .panel-sidebar .user-box { margin: 5px 0 10px; }
    .panel-layout main { padding: 20px 16px 38px; }
    .summary-grid { gap: 10px; }
    .staff-panel { padding: 15px; }
}
@media (max-width: 420px) {
    .panel-layout main { padding-inline: 12px; }
    .summary-card { min-height: 88px; padding: 12px; }
    .staff-detail dl { grid-template-columns: minmax(0, 1fr); gap: 13px; }
}
@media (max-width: 800px) {
    .staff-profile-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .staff-panel { padding: 13px; }
    .staff-role-row { grid-template-columns: 30px minmax(0, 1fr); }
    .staff-role-icon { width: 30px; height: 30px; }
    .staff-role-actions { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) {
    .panel-layout *, .panel-layout *::before, .panel-layout *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Group the administration pages without adding another level to the sidebar. */
.panel-tabs:has(.panel-tab-group) {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
    align-items: start;
    gap: 10px;
}
.panel-tab-group {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-2);
}
.panel-tab-group-title {
    margin: 0 0 7px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.4;
    text-transform: uppercase;
}
.panel-tab-group-links { display: grid; gap: 3px; }
.panel-tab-group-links a { min-width: 0; padding: 7px 8px; overflow-wrap: anywhere; }
@media (max-width: 420px) {
    .panel-tabs:has(.panel-tab-group) { grid-template-columns: minmax(0, 1fr); }
}
