:root {
    color-scheme: dark;
    --bg: #07090c;
    --bg-soft: #0b0f14;
    --panel: #11161d;
    --panel-2: #151c25;
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.12);
    --text: #e9eef5;
    --muted: #8d9aa9;
    --dim: #5f6d7c;
    --accent: #00d4ff;
    --accent-soft: rgba(0, 212, 255, 0.12);
    --ok: #57f287;
    --warn: #f5b34a;
    --danger: #ff5d6c;
    --radius: 16px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background:
        radial-gradient(1100px 620px at 12% -10%, rgba(0, 212, 255, 0.09) 0%, transparent 60%),
        radial-gradient(900px 520px at 95% 0%, rgba(88, 101, 242, 0.07) 0%, transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
img { display: block; }
h1, h2, h3, p { margin: 0; }

::selection { background: rgba(0, 212, 255, 0.25); }

/* ---------------------------------------------------------------- login */

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-card {
    width: min(430px, 100%);
    padding: 38px 34px 32px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(22, 29, 38, 0.94), rgba(13, 17, 23, 0.96));
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 212, 255, 0.65), transparent);
}

.login-mark {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.22), rgba(0, 212, 255, 0.04));
    border: 1px solid rgba(0, 212, 255, 0.3);
    margin-bottom: 22px;
}

.login-mark svg { width: 28px; height: 28px; }

.login-logo {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    object-fit: cover;
    display: block;
    margin-bottom: 22px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: #0b1015;
    box-shadow: 0 10px 26px rgba(0, 212, 255, 0.14);
}

.login h1 {
    font-size: 23px;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.login p { color: var(--muted); font-size: 14px; line-height: 1.6; }

.login code.inline-code {
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    color: var(--text);
    font-family: "Consolas", ui-monospace, "SFMono-Regular", monospace;
    font-size: 12.5px;
}

.login .btn { margin-top: 26px; width: 100%; justify-content: center; padding: 13px 18px; }

.code-form { margin-top: 22px; display: grid; gap: 10px; }

.code-label {
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--dim);
    font-weight: 700;
}

.code-input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(5, 8, 11, 0.6);
    color: var(--text);
    font-family: "Consolas", ui-monospace, "SFMono-Regular", monospace;
    font-size: 20px;
    letter-spacing: 0.32em;
    text-align: center;
    text-transform: uppercase;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.code-input::placeholder {
    color: var(--dim);
    letter-spacing: 0.06em;
    font-size: 13px;
}

.code-input:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.code-form .btn { margin-top: 6px; width: 100%; justify-content: center; padding: 12px 18px; }

.code-error {
    color: var(--danger);
    font-size: 13px;
    line-height: 1.45;
}

.code-error[hidden] { display: none; }

.login-oauth { margin-top: 26px; display: grid; gap: 10px; justify-items: stretch; }
.login-oauth[hidden] { display: none; }
.login-oauth .btn { margin-top: 0; width: 100%; justify-content: center; padding: 13px 18px; }
.login-hint { color: var(--dim); font-size: 12px; line-height: 1.55; text-align: center; }
.login .login-error { margin-top: 16px; }
.code-form[hidden] { display: none; }
.code-toggle {
    display: block;
    margin: 18px auto 0;
    padding: 0;
    background: none;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.code-toggle:hover { color: var(--text); }
.code-toggle[hidden] { display: none; }

.login-note {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 12.5px;
    line-height: 1.55;
}

/* ---------------------------------------------------------------- shell */

.shell {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
}

.side {
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 16px 18px;
    border-right: 1px solid var(--line);
    background: rgba(9, 12, 16, 0.72);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 6px; }

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.22), rgba(0, 212, 255, 0.03));
    border: 1px solid rgba(0, 212, 255, 0.28);
}

.brand-mark svg { width: 18px; height: 18px; }

.brand-avatar {
    width: 100%;
    height: 100%;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.brand-text strong { display: block; font-size: 15px; letter-spacing: -0.01em; }
.brand-text span { display: block; font-size: 11px; color: var(--dim); letter-spacing: 0.09em; text-transform: uppercase; }

.guild-switch {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.guild-switch:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }

.guild-avatar {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    object-fit: cover;
    background: linear-gradient(145deg, #16414d, #0d1a21);
    flex: none;
}

.guild-avatar.fallback {
    display: grid;
    place-items: center;
    font-weight: 700;
    color: var(--accent);
    font-size: 13px;
}

.guild-switch .g-name { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 148px; }
.guild-switch .g-role { display: block; font-size: 11.5px; color: var(--dim); }
.guild-switch .chev { margin-left: auto; color: var(--dim); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    background: none;
    text-align: left;
    transition: color 0.15s ease, background 0.15s ease;
}

.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }

.nav-item.active {
    color: var(--text);
    background: linear-gradient(90deg, rgba(0, 212, 255, 0.13), rgba(0, 212, 255, 0.03));
    border-color: rgba(0, 212, 255, 0.16);
}

.nav-icon { width: 17px; height: 17px; object-fit: contain; opacity: 0.85; filter: grayscale(0.25); }
.nav-item.active .nav-icon { opacity: 1; filter: none; }

.side-foot {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 0;
    border-top: 1px solid var(--line);
}

.me-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #1a2530; }
.me-text { min-width: 0; }
.me-text strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.me-text span { display: block; font-size: 11px; color: var(--dim); }
.logout {
    margin-left: auto;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--dim);
    border: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.logout:hover { color: var(--danger); border-color: rgba(255, 93, 108, 0.3); }
.logout svg { width: 15px; height: 15px; }

.main { min-width: 0; padding: 26px 30px 60px; }

.top {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
}

.eyebrow {
    display: block;
    font-size: 10.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--dim);
    margin-bottom: 5px;
}

.top h1 { font-size: 25px; letter-spacing: -0.025em; line-height: 1.15; }

.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.24);
    background: rgba(0, 212, 255, 0.07);
    color: #9fe9fb;
    font-size: 12px;
    font-weight: 600;
}

.role-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

/* ---------------------------------------------------------------- buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 15px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.035);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    white-space: nowrap;
}

.btn:hover { background: rgba(255, 255, 255, 0.075); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn.primary {
    background: linear-gradient(135deg, #00d4ff, #00a6d6);
    border-color: transparent;
    color: #041219;
    box-shadow: 0 8px 26px rgba(0, 212, 255, 0.2);
}
.btn.primary:hover { box-shadow: 0 10px 30px rgba(0, 212, 255, 0.3); background: linear-gradient(135deg, #29dcff, #00b4e6); }

.btn.ghost { background: none; }
.btn.danger { color: #ff9aa3; border-color: rgba(255, 93, 108, 0.3); background: rgba(255, 93, 108, 0.06); }
.btn.danger:hover { background: rgba(255, 93, 108, 0.12); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 8px 10px; }

/* ---------------------------------------------------------------- cards & grids */

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(21, 28, 37, 0.85), rgba(15, 20, 27, 0.92));
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.card-pad { padding: 20px 22px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line);
}

.card-title { display: flex; align-items: center; gap: 10px; font-size: 14.5px; font-weight: 650; }
.card-title img { width: 18px; height: 18px; object-fit: contain; }
.card-note { color: var(--dim); font-size: 12px; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-head h2 { font-size: 20px; letter-spacing: -0.02em; margin-bottom: 6px; }
.page-head p { color: var(--muted); font-size: 13.5px; max-width: 640px; }
.head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat { padding: 16px 17px; display: flex; align-items: center; gap: 13px; }

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.14);
    flex: none;
}
.stat-icon img { width: 19px; height: 19px; object-fit: contain; }

.stat-value { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 11.5px; color: var(--dim); letter-spacing: 0.04em; text-transform: uppercase; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

.server-card { display: flex; gap: 16px; align-items: center; padding: 20px; }
.server-avatar { width: 58px; height: 58px; border-radius: 15px; object-fit: cover; background: #132028; flex: none; }
.server-avatar.fallback { display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--accent); }
.server-name { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.server-sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin: 0; }
.kv div { min-width: 0; }
.kv dt { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.kv dd { margin: 0; font-size: 13.5px; color: var(--text); overflow-wrap: anywhere; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.025);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.chip.on { color: #b9f7c9; border-color: rgba(87, 242, 135, 0.25); background: rgba(87, 242, 135, 0.06); }
.chip.on::before { background: var(--ok); box-shadow: 0 0 9px rgba(87, 242, 135, 0.8); }
.chip.off { color: var(--muted); }
.chip.off::before { background: #46525f; }
.chip.warn { color: #ffd9a3; border-color: rgba(245, 179, 74, 0.3); background: rgba(245, 179, 74, 0.07); }
.chip.warn::before { background: var(--warn); }

.module-list { display: flex; flex-direction: column; }
.module-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
}
.module-row:last-child { border-bottom: 0; }
.module-row img { width: 17px; height: 17px; object-fit: contain; opacity: 0.85; }
.module-row .m-name { font-size: 13.5px; font-weight: 600; }
.module-row .m-value { margin-left: auto; color: var(--muted); font-size: 12.5px; text-align: right; }

.readonly-note {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 16px;
    padding: 12px 15px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    color: var(--dim);
    font-size: 12.5px;
    line-height: 1.55;
}
.readonly-note img { width: 15px; height: 15px; margin-top: 1px; opacity: 0.7; flex: none; }
.readonly-note code { color: #a9d9e6; background: rgba(0, 212, 255, 0.07); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; }

.notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 17px;
    border-radius: 12px;
    border: 1px solid rgba(245, 179, 74, 0.26);
    background: rgba(245, 179, 74, 0.06);
    color: #ffd9a3;
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 16px;
}
.notice img { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice strong { color: #ffe9c7; }
.notice a { color: #ffd9a3; text-decoration: underline; }
.notice code { background: rgba(0, 0, 0, 0.28); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------------------------------------------------------------- tickets */

.ticket-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.desk-list { display: flex; flex-direction: column; }
.desk-list-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.desk-list-head span { font-size: 12px; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; }

.desk {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 13px 18px;
    background: none;
    border: 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease;
}
.desk:last-child { border-bottom: 0; }
.desk:hover { background: rgba(255, 255, 255, 0.025); }
.desk.selected { background: linear-gradient(90deg, rgba(0, 212, 255, 0.09), transparent); box-shadow: inset 2px 0 0 var(--accent); }

.desk-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.desk-name { font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-slug { font-size: 11.5px; color: var(--dim); }
.desk-badges { margin-left: auto; display: flex; gap: 5px; flex: none; }

.badge {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.03);
    white-space: nowrap;
}
.badge.active { color: #9fe9fb; border-color: rgba(0, 212, 255, 0.3); background: rgba(0, 212, 255, 0.08); }
.badge.posted { color: #b9f7c9; border-color: rgba(87, 242, 135, 0.25); background: rgba(87, 242, 135, 0.07); }
.badge.locked { color: #ffd9a3; border-color: rgba(245, 179, 74, 0.3); background: rgba(245, 179, 74, 0.07); }

.new-desk { padding: 13px 18px; border-top: 1px solid var(--line); }
.new-desk input {
    width: 100%;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid var(--line-strong);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font-size: 13px;
    outline: none;
}
.new-desk input:focus { border-color: rgba(0, 212, 255, 0.5); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1); }
.new-desk .actions { display: flex; gap: 8px; margin-top: 9px; }

.editor { padding: 20px 22px; }
.editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.editor-head h3 { font-size: 16px; letter-spacing: -0.01em; }
.editor-head p { color: var(--dim); font-size: 12px; margin-top: 3px; }

.field { margin-bottom: 14px; }
.field label { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.field label .counter { color: var(--dim); letter-spacing: 0; text-transform: none; font-size: 11px; }
.field input, .field textarea, .field select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 9px;
    border: 1px solid var(--line-strong);
    background: rgba(4, 7, 10, 0.45);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field textarea { resize: vertical; min-height: 92px; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}
.field input::placeholder, .field textarea::placeholder { color: #47535f; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #66757f 50%), linear-gradient(135deg, #66757f 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field .hint { margin-top: 5px; color: var(--dim); font-size: 11.5px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.section-label {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 22px 0 11px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
    font-size: 11.5px;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--dim);
}
.section-label img { width: 15px; height: 15px; opacity: 0.75; }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.actions .spacer { flex: 1; }

.publish-row {
    display: flex;
    gap: 9px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.18);
}
.publish-row select { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line-strong); background: rgba(4, 7, 10, 0.45); color: var(--text); font-size: 12.5px; }

/* ---------------------------------------------------------------- preview */

.preview-card { margin-top: 16px; }
.preview-inner { padding: 16px 18px 20px; }

.preview-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); width: fit-content; margin-bottom: 14px; }
.preview-tab {
    padding: 6px 13px;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.preview-tab.active { background: rgba(0, 212, 255, 0.12); color: #b7edf9; }

.mini-embed {
    max-width: 560px;
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    background: #22262d;
    padding: 13px 16px 14px;
    position: relative;
    overflow: hidden;
}
.mini-author { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; color: #f2f4f5; margin-bottom: 7px; }
.mini-dot { width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, #00d4ff, #5865f2); flex: none; }
.mini-title { font-size: 15.5px; font-weight: 700; color: #fff; margin-bottom: 8px; padding-right: 64px; }
.mini-thumb { position: absolute; top: 12px; right: 14px; width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: #141a21; }
.mini-desc { font-size: 12.8px; color: #d3d8dd; overflow-wrap: anywhere; line-height: 1.55; }
.mini-desc code { background: rgba(0, 0, 0, 0.35); padding: 1px 4px; border-radius: 3px; font-size: 11.5px; }
.mini-quote { border-left: 3px solid #4e545c; padding-left: 10px; margin: 3px 0; }
.mini-banner { width: 100%; max-height: 150px; object-fit: cover; border-radius: 5px; margin-top: 10px; background: #12171d; }
.mini-imgfail { margin-top: 10px; padding: 10px 12px; border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: 6px; font-size: 11.5px; color: #939ea8; background: rgba(255, 255, 255, 0.02); }
.mini-footer { margin-top: 11px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.06); font-size: 10.5px; color: #8b949e; }
.mini-empty { color: #6d7883; font-style: italic; }

.mini-buttons { display: flex; gap: 8px; margin-top: 12px; }
.mini-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #f2f4f5;
    background: #4e5058;
}
.mini-btn img { width: 14px; height: 14px; }
.mini-btn.success { background: #248046; }
.mini-btn.primary { background: #5865f2; }
.mini-btn.danger { background: #da373c; }
.mini-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; }
.mini-link { color: #00a8fc; text-decoration: none; }
.mini-link:hover { text-decoration: underline; }
.mini-mention { background: rgba(88, 101, 242, 0.3); color: #dee0fc; border-radius: 3px; padding: 0 2px; font-weight: 500; }
.mini-content { font-size: 13px; color: #d3d8dd; line-height: 1.6; overflow-wrap: anywhere; margin-bottom: 12px; }

/* ---------------------------------------------------------------- send */

.send-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 16px; align-items: start; }
.send-grid .preview-card { position: sticky; top: 16px; }

.field-tools { display: flex; align-items: center; gap: 10px; margin-top: 7px; flex-wrap: wrap; }
.field-hint { font-size: 11.5px; color: var(--dim); }

.emoji-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: rgba(0, 212, 255, 0.06);
    color: #9fe9fb;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}
.emoji-trigger img { width: 14px; height: 14px; }
.emoji-trigger:hover { border-color: rgba(0, 212, 255, 0.4); background: rgba(0, 212, 255, 0.1); }

/* ---------------------------------------------------------------- emoji picker */

.emoji-pop {
    position: fixed;
    z-index: 80;
    width: 336px;
    max-height: 372px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: #11161c;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}
.emoji-pop-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
}
.emoji-close { border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.emoji-close:hover { color: var(--text); }
.emoji-search {
    margin: 10px 12px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: rgba(4, 7, 10, 0.5);
    color: var(--text);
    font-size: 12.5px;
    outline: none;
}
.emoji-search:focus { border-color: rgba(0, 212, 255, 0.5); }
.emoji-grid { overflow-y: auto; padding: 0 10px 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: max-content; align-content: start; gap: 6px; }
.emoji-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 0;
    padding: 8px 3px 6px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: none;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.2;
    cursor: pointer;
}
.emoji-item:hover { background: rgba(0, 212, 255, 0.08); border-color: rgba(0, 212, 255, 0.25); color: #b7edf9; }
.emoji-item img { flex: 0 0 auto; width: 32px; height: 32px; object-fit: contain; }
.emoji-item span { flex: 0 0 auto; width: 100%; text-align: center; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emoji-grid .empty { grid-column: 1 / -1; padding: 18px 8px; }

/* ---------------------------------------------------------------- rich editor */

.rich-field { display: block; }
.rich-editor {
    min-height: 92px;
    max-height: 340px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-bottom: 0;
    border-radius: 9px 9px 0 0;
    background: rgba(4, 7, 10, 0.45);
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    outline: none;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.rich-editor:focus { border-color: rgba(0, 212, 255, 0.5); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1); }
.rich-editor:empty::before { content: attr(data-placeholder); color: #47535f; pointer-events: none; }
.rich-editor[contenteditable="false"] { opacity: 0.55; }
.rich-emoji { width: 22px; height: 22px; object-fit: contain; vertical-align: -5px; margin: 0 1px; }
.rich-tools {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid var(--line-strong);
    border-top: 1px solid var(--line);
    border-radius: 0 0 9px 9px;
    background: rgba(0, 0, 0, 0.22);
}
.rich-tools .emoji-trigger { margin-left: auto; }
.md-btn {
    width: 27px;
    height: 25px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    color: var(--muted);
    font-size: 12.5px;
    cursor: pointer;
    padding: 0;
}
.md-btn:hover { background: rgba(0, 212, 255, 0.08); border-color: rgba(0, 212, 255, 0.25); color: #b7edf9; }
.md-b { font-weight: 700; }
.md-i { font-style: italic; }
.md-u { text-decoration: underline; }
.md-s { text-decoration: line-through; }

/* ---------------------------------------------------------------- open tickets */

.table { display: flex; flex-direction: column; }
.table-row {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--line);
}
.table-row:last-child { border-bottom: 0; }
.table-row:hover { background: rgba(255, 255, 255, 0.02); }
.t-main { min-width: 0; }
.t-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.t-sub { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.t-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }
.t-link { font-size: 12px; font-weight: 600; color: #9fe9fb; }
.t-link:hover { text-decoration: underline; }

.mod-result { display: inline-flex; align-items: flex-start; gap: 10px; }
.mod-result-text { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--text); }
.mod-result-text .t-sub { margin-top: 0; }

.empty { padding: 28px 20px; text-align: center; color: var(--dim); font-size: 13px; }

/* ---------------------------------------------------------------- logs */

.log-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: 0; }
.log-row img { width: 18px; height: 18px; object-fit: contain; opacity: 0.85; flex: none; }
.log-label { width: 190px; font-size: 13.5px; font-weight: 600; }
.log-row select {
    flex: 1;
    min-width: 0;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: rgba(4, 7, 10, 0.45);
    color: var(--text);
    font-size: 12.5px;
}
.log-status { width: 58px; text-align: right; font-size: 11px; color: var(--dim); flex: none; }

/* ---------------------------------------------------------------- prefix */

.prefix-card { max-width: 620px; }
.prefix-big {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px;
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: rgba(0, 0, 0, 0.3);
}
.prefix-big input {
    flex: 1;
    min-width: 0;
    padding: 13px 14px;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.02em;
    outline: none;
}
.prefix-swatch {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(0, 212, 255, 0.16), rgba(0, 212, 255, 0.03));
    border: 1px solid rgba(0, 212, 255, 0.22);
    color: var(--accent);
    font-weight: 800;
    font-size: 18px;
}
.example {
    margin-top: 16px;
    padding: 13px 16px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--muted);
    font-size: 13px;
}
.example code { color: #b7edf9; font-size: 13px; }

/* ---------------------------------------------------------------- servers picker */

.servers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 13px; }

.server-tile {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(21, 28, 37, 0.8), rgba(15, 20, 27, 0.9));
    cursor: pointer;
    text-align: left;
    color: var(--text);
    transition: border-color 0.15s ease, transform 0.12s ease;
}
.server-tile:hover { border-color: rgba(0, 212, 255, 0.35); transform: translateY(-1px); }
.server-tile img, .server-tile .fallback { width: 40px; height: 40px; border-radius: 11px; object-fit: cover; flex: none; background: #132028; }
.server-tile .fallback { display: grid; place-items: center; color: var(--accent); font-weight: 700; }
.server-tile .s-name { display: block; font-size: 13.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-tile .s-sub { display: block; font-size: 11.5px; color: var(--dim); }

/* ---------------------------------------------------------------- toasts & modal */

.toasts {
    position: fixed;
    right: 22px;
    bottom: 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    z-index: 60;
    pointer-events: none;
}

.toast {
    padding: 11px 16px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(18, 24, 31, 0.96);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
    font-size: 13px;
    color: var(--text);
    animation: toast-in 0.18s ease;
    pointer-events: auto;
    max-width: 340px;
}
.toast.ok { border-color: rgba(87, 242, 135, 0.3); }
.toast.err { border-color: rgba(255, 93, 108, 0.35); color: #ffc3c9; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 7, 0.7);
    backdrop-filter: blur(6px);
    display: grid;
    place-items: center;
    z-index: 70;
    padding: 22px;
}
.modal {
    width: min(390px, 100%);
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: #121820;
    box-shadow: var(--shadow);
}
.modal h3 { font-size: 16px; margin-bottom: 8px; }
.modal p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 20px; }

/* ---------------------------------------------------------------- skeleton & states */

.skeleton { padding: 40px; display: grid; gap: 12px; }
.skeleton div { height: 18px; border-radius: 7px; background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04)); background-size: 220% 100%; animation: shimmer 1.3s linear infinite; }
.skeleton div:nth-child(2) { width: 70%; }
.skeleton div:nth-child(3) { width: 45%; }

@keyframes shimmer {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

.error-card { max-width: 520px; margin: 40px auto; padding: 28px; text-align: center; }
.error-card h2 { font-size: 18px; margin-bottom: 8px; }
.error-card p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* ---------------------------------------------------------------- module boards */

.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.muted-line { color: var(--muted); font-size: 13px; line-height: 1.6; }

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 12px;
}
.toggle-text strong { display: block; font-size: 13.5px; font-weight: 600; }
.toggle-text span { display: block; color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.toggle-grid .toggle-row { margin-bottom: 0; }

.switch { position: relative; display: inline-flex; flex: none; width: 40px; height: 22px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 2; }
.switch .knob {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #26313d;
    border: 1px solid var(--line-strong);
    transition: background 0.16s ease, border-color 0.16s ease;
}
.switch .knob::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #8d9aa9;
    transition: transform 0.16s ease, background 0.16s ease;
}
.switch input:checked + .knob { background: rgba(0, 212, 255, 0.24); border-color: rgba(0, 212, 255, 0.45); }
.switch input:checked + .knob::after { transform: translateX(18px); background: var(--accent); }
.switch input:focus-visible + .knob { box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2); }

.role-pick {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 168px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(4, 7, 10, 0.35);
}
.role-opt { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; }
.role-opt:hover { background: rgba(255, 255, 255, 0.035); }
.role-opt input { accent-color: var(--accent); margin: 0; }
.role-opt.blocked { opacity: 0.45; cursor: not-allowed; }
.role-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.role-name { font-size: 12.8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-tag { margin-left: auto; font-size: 10px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; flex: none; }

.rule { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: rgba(255, 255, 255, 0.015); }
.rule:last-of-type { margin-bottom: 0; }
.rule-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.rule-title { display: flex; align-items: center; gap: 10px; }
.rule-title img { width: 17px; height: 17px; object-fit: contain; opacity: 0.9; }
.rule-title strong { display: block; font-size: 13.5px; }
.rule-title .t-sub { display: block; font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.rule-grid { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 12px; padding: 12px 14px 0; }
.rule-grid + .field { padding-top: 12px; }
.rule > .field { padding: 12px 14px 0; }
.rule > .field:last-child { padding-bottom: 14px; }

.auto-rows { display: flex; flex-direction: column; gap: 8px; }
.auto-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.auto-row.react { grid-template-columns: 1fr 1fr auto; align-items: center; }
.auto-row textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.auto-row .btn { white-space: nowrap; }
.auto-row input, .auto-row textarea, .rr-row input, .rr-row select, .inline-form input, .inline-form select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background: rgba(4, 7, 10, 0.45);
    color: var(--text);
    font-size: 12.5px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auto-row input::placeholder, .auto-row textarea::placeholder, .rr-row input::placeholder, .inline-form input::placeholder { color: #47535f; }
.auto-row input:focus, .auto-row textarea:focus, .rr-row input:focus, .rr-row select:focus,
.inline-form input:focus, .inline-form select:focus {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.rr-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rr-row input[name="messageId"] { flex: 1 1 160px; }
.rr-row select[name="channelId"] { flex: 1 1 140px; }
.rr-row input[name="emoji"] { flex: 0 1 110px; }
.rr-row select[name="roleId"] { flex: 1 1 140px; }
.rr-row .btn { flex: none; }

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1 1 180px; width: auto; }
.inline-form select { flex: 1 1 160px; width: auto; }
.inline-note { font-size: 12px; color: var(--muted); flex: none; }

.now-playing { display: flex; align-items: center; gap: 12px; }
.np-thumb { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: #101820; flex: none; }
.np-thumb.fallback { display: grid; place-items: center; }
.np-thumb.fallback img { width: 20px; height: 20px; opacity: 0.7; }
.np-main { min-width: 0; }
.np-title { font-size: 13.5px; font-weight: 650; overflow-wrap: anywhere; }
.np-main .t-sub { margin-top: 2px; }
.m-command { margin-left: auto; font-size: 11.5px; color: #a9d9e6; background: rgba(0, 212, 255, 0.07); padding: 2px 7px; border-radius: 5px; flex: none; }

.wl-list { display: flex; flex-direction: column; margin-top: 12px; }
.wl-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); }
.wl-row:last-child { border-bottom: 0; }
.wl-row .badge { flex: none; }
.wl-main { min-width: 0; display: flex; flex-direction: column; }
.wl-id { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; font-weight: 650; letter-spacing: 0.02em; }
.wl-actions { margin-left: auto; display: flex; gap: 7px; flex: none; }
.wl-editor { border: 1px solid rgba(0, 212, 255, 0.22); border-radius: 12px; padding: 14px; margin: 6px 0 12px; background: rgba(0, 212, 255, 0.03); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.perm { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); }
.perm.inverse { border-style: dashed; }
.perm-text { min-width: 0; }
.perm-text strong { display: block; font-size: 12.3px; font-weight: 600; }
.perm-text span { display: block; font-size: 10.8px; color: var(--dim); margin-top: 1px; }

/* ---------------------------------------------------------------- console */

.mini-rich { font-size: 12.8px; color: #d3d8dd; line-height: 1.55; overflow-wrap: anywhere; }
.mini-rich code { background: rgba(0, 0, 0, 0.35); padding: 1px 4px; border-radius: 3px; font-size: 11.5px; }

.console-view { display: flex; flex-direction: column; gap: 18px; }
.console-view .page-head { margin-bottom: 0; }

.console-panel { padding: 0; overflow: hidden; }
.console-tools { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.console-search {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--line-strong);
    background: rgba(4, 7, 10, 0.55);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.console-search:focus-within { border-color: rgba(0, 212, 255, 0.45); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.08); }
.console-search-glyph { position: relative; width: 11px; height: 11px; flex: none; margin-right: 3px; border: 1.7px solid #5b6b77; border-radius: 50%; }
.console-search-glyph::after { content: ""; position: absolute; width: 6px; height: 1.7px; right: -4px; bottom: -2px; border-radius: 2px; background: #5b6b77; transform: rotate(45deg); }
.console-search:focus-within .console-search-glyph { border-color: var(--accent); }
.console-search:focus-within .console-search-glyph::after { background: var(--accent); }
.console-tools input {
    flex: 1;
    min-width: 0;
    padding: 10px 0;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 13px;
    outline: none;
}
.console-tools input::placeholder { color: #47535f; }
.console-tools input::-webkit-search-cancel-button { -webkit-appearance: none; }
.console-key {
    flex: none;
    padding: 1px 6px 2px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--dim);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 10.5px;
    line-height: 1.4;
}
.console-tools .card-note { flex: none; font-variant-numeric: tabular-nums; }

.console-body { display: grid; grid-template-columns: 216px minmax(0, 1fr); align-items: stretch; }

.console-cats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px;
    border-right: 1px solid var(--line);
    background: rgba(4, 7, 10, 0.25);
    max-height: 560px;
    overflow-y: auto;
}
.console-cat {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 550;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.console-cat-icon { width: 16px; height: 16px; object-fit: contain; flex: none; opacity: 0.7; }
.console-cat-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-cat-count { flex: none; font-size: 10.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.console-cat:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.console-cat.active { color: #d7f6ff; background: rgba(0, 212, 255, 0.08); border-color: rgba(0, 212, 255, 0.22); box-shadow: inset 2px 0 0 var(--accent); }
.console-cat.active .console-cat-icon { opacity: 1; }
.console-cat.active .console-cat-count { color: #7fd8ef; }

.console-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-content: start; max-height: 560px; overflow-y: auto; }
.console-row {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}
.console-row:hover { background: rgba(255, 255, 255, 0.025); }
.console-row:focus-visible { outline: 2px solid rgba(0, 212, 255, 0.5); outline-offset: -2px; }
.console-row.active { background: rgba(0, 212, 255, 0.07); box-shadow: inset 2px 0 0 var(--accent); }
.console-icon { width: 26px; height: 26px; object-fit: contain; flex: none; }
.console-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.console-name { font-family: ui-monospace, Consolas, monospace; font-size: 12.6px; font-weight: 650; letter-spacing: 0; }
.console-prefix { color: #5f93a5; margin-right: 1px; }
.console-sub { font-size: 11.2px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.console-tags { display: flex; gap: 5px; flex: none; }
.console-tags .chip { font-size: 9.5px; padding: 2px 7px; gap: 0; }
.console-tags .chip::before { display: none; }

.console-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 54px 20px; text-align: center; }
.console-empty img { width: 34px; height: 34px; object-fit: contain; opacity: 0.5; margin-bottom: 4px; }
.console-empty strong { font-size: 13.5px; }
.console-empty span { max-width: 340px; font-size: 12px; color: var(--dim); line-height: 1.5; }
.console-empty .btn { margin-top: 8px; }

.console-cmd { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.console-cmd code {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #c4cfd6;
    font-family: ui-monospace, Consolas, monospace;
    font-size: 12.4px;
    white-space: nowrap;
    overflow-x: auto;
}
.console-cmd-prefix { color: var(--accent); font-weight: 700; }
.console-copy { flex: none; }
.console-desc { font-size: 13px; color: var(--muted); line-height: 1.55; margin-bottom: 8px; }
.console-flags { margin-bottom: 14px; }
.console-flags .chip::before { display: none; }

.console-insert { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 8px; }
.console-insert-label { font-size: 10px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--dim); margin-right: 2px; }
.console-insert select {
    flex: 1 1 150px;
    width: auto;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--line-strong);
    background-color: rgba(4, 7, 10, 0.45);
    color: var(--muted);
    font-size: 12px;
}
.console-insert select:focus { border-color: rgba(0, 212, 255, 0.5); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1); }
.console-insert .btn { flex: none; }
.console-run-bar { margin-top: 4px; }

.console-result {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line-strong);
    background: rgba(255, 255, 255, 0.02);
}
.console-result.ok { border-color: rgba(87, 242, 135, 0.24); background: rgba(87, 242, 135, 0.03); }
.console-result.pending { border-color: rgba(245, 179, 74, 0.28); background: rgba(245, 179, 74, 0.04); }
.console-result.running { border-color: rgba(0, 212, 255, 0.28); background: rgba(0, 212, 255, 0.03); }
.console-result.err { border-color: rgba(255, 90, 95, 0.3); background: rgba(255, 90, 95, 0.04); }
.console-result-head { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 10px; }
.console-result-head strong { font-size: 13px; }
.console-result-meta { display: flex; gap: 6px; margin-left: auto; }
.console-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--dim); }
.console-result.ok .console-dot { background: var(--ok); box-shadow: 0 0 8px rgba(87, 242, 135, 0.7); }
.console-result.pending .console-dot,
.console-result.running .console-dot { background: var(--warn); box-shadow: 0 0 8px rgba(245, 179, 74, 0.7); animation: console-pulse 1.4s ease-in-out infinite; }
.console-result.err .console-dot { background: #ff5a5f; box-shadow: 0 0 8px rgba(255, 90, 95, 0.6); }
.console-chip {
    padding: 2px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--muted);
    font-family: ui-monospace, Consolas, monospace;
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.console-skeleton { display: flex; flex-direction: column; gap: 8px; }
.console-skeleton span {
    height: 11px;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
    background-size: 200% 100%;
    animation: console-shimmer 1.4s linear infinite;
}
.console-skeleton span:nth-child(2) { width: 84%; }
.console-skeleton span:nth-child(3) { width: 62%; }
@keyframes console-pulse { 50% { opacity: 0.35; } }
@keyframes console-shimmer { to { background-position: -200% 0; } }
.console-note { font-size: 12px; color: #e8c78d; line-height: 1.5; margin-bottom: 10px; }
.console-error { font-size: 12.5px; color: #ff9b9e; line-height: 1.55; margin-bottom: 10px; overflow-wrap: anywhere; }
.console-replies { display: flex; flex-direction: column; gap: 10px; max-height: 520px; overflow-y: auto; }
.console-reply { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: rgba(5, 8, 11, 0.5); }
.console-reply .mini-rich + .console-embed { margin-top: 10px; }
.console-reply-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.console-reply-foot:empty { display: none; }

.console-embed { border-left: 3px solid var(--embed, var(--accent)); border-radius: 6px; padding: 10px 12px; background: rgba(255, 255, 255, 0.02); margin-top: 8px; }
.console-embed-author { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: #f2f4f5; margin-bottom: 5px; }
.console-embed-author::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--embed, var(--accent)); }
.console-embed-title { font-size: 13.5px; font-weight: 650; margin-bottom: 5px; }
.console-embed-footer { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 10.8px; color: var(--dim); }
.console-fields { display: grid; gap: 8px; margin-top: 8px; }
.console-fields > div > span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }

/* ---------------------------------------------------------------- premium */

.prem-hero { overflow: hidden; position: relative; }
.prem-hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); opacity: 0.75; }
.prem-hero.off::before { background: var(--warn); opacity: 0.6; }
.prem-head { display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 14px; }
.prem-mark {
    width: 46px;
    height: 46px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 13px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: radial-gradient(circle at 30% 25%, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.04));
    box-shadow: 0 0 24px rgba(0, 212, 255, 0.14);
}
.prem-hero.off .prem-mark { border-color: rgba(245, 179, 74, 0.3); background: radial-gradient(circle at 30% 25%, rgba(245, 179, 74, 0.16), rgba(245, 179, 74, 0.03)); box-shadow: none; }
.prem-mark img { width: 24px; height: 24px; }
.prem-heading { flex: 1; min-width: 0; }
.prem-heading h3 { margin: 2px 0 4px; font-size: 19px; letter-spacing: -0.01em; }
.prem-heading p { margin: 0; font-size: 12.8px; color: var(--muted); line-height: 1.55; }
.prem-head > .badge { margin-top: 6px; flex: none; }
.prem-boards { display: grid; gap: 8px; padding: 0 20px 6px; }
.prem-board {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.015);
}
.prem-board.frozen { opacity: 0.72; }
.prem-board-icon { width: 20px; height: 20px; object-fit: contain; flex: none; }
.prem-board-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prem-board-body strong { font-size: 13px; font-weight: 650; }
.prem-board-body span { font-size: 11.5px; color: var(--dim); overflow-wrap: anywhere; }
.prem-board .chip, .prem-board .btn { flex: none; }
.prem-hero .readonly-note { margin: 12px 20px 18px; }
.prem-spent { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.prem-spent .chip::before { display: none; }
.prem-steps { margin: 14px 0 16px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 12.8px; line-height: 1.55; }
.prem-steps li::marker { color: var(--accent); font-weight: 700; }

@media (max-width: 860px) {
    .nav { flex: none; overflow: visible; }
    .toggle-grid, .perm-grid, .rule-grid { grid-template-columns: 1fr; }
    .auto-row, .auto-row.react { grid-template-columns: 1fr; }
    .wl-row { flex-wrap: wrap; }
    .wl-actions { margin-left: 0; width: 100%; }
}

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1080px) {
    .ticket-grid { grid-template-columns: 240px minmax(0, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    .send-grid { grid-template-columns: 1fr; }
    .send-grid .preview-card { position: static; }
    .console-body { grid-template-columns: 1fr; }
    .console-cats {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        max-height: none;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }
    .console-cats::-webkit-scrollbar { display: none; }
    .console-cat { width: auto; flex: none; scroll-snap-align: start; }
    .console-list { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .side {
        position: sticky;
        top: 0;
        z-index: 30;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        overflow-x: auto;
    }
    .brand-text, .side-foot .me-text, .guild-switch .chev { display: none; }
    .guild-switch { width: auto; padding: 6px; }
    .guild-switch .g-name { max-width: 120px; }
    .nav { flex-direction: row; }
    .nav-item span { display: none; }
    .nav-item { padding: 9px; }
    .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
    .main { padding: 20px 16px 50px; }
    .ticket-grid { grid-template-columns: 1fr; }
    .top { flex-direction: column; align-items: flex-start; }
    .field-row { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; }
    .log-label { width: 120px; }
}

/* ---------------------------------------------------------------- phone */

@media (max-width: 640px) {
    .side {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 40;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        height: auto;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid var(--line-strong);
        background: rgba(8, 11, 15, 0.96);
        box-shadow: 0 -16px 38px rgba(0, 0, 0, 0.5);
        overflow: visible;
    }
    .brand { display: none; }
    .guild-switch { width: 38px; padding: 0; border: 0; background: none; flex: none; }
    .guild-switch .guild-avatar { width: 36px; height: 36px; }
    .guild-switch > span { display: none; }
    .nav {
        flex: 1;
        min-width: 0;
        flex-direction: row;
        gap: 2px;
        overflow-x: auto;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    .nav::-webkit-scrollbar { display: none; }
    .nav-item {
        flex-direction: column;
        gap: 3px;
        min-width: 56px;
        padding: 6px 8px 5px;
        border-radius: 9px;
        text-align: center;
        scroll-snap-align: center;
    }
    .nav-item span { display: block; font-size: 9.5px; letter-spacing: 0.02em; }
    .nav-icon { width: 18px; height: 18px; }
    .side-foot { margin: 0; padding: 0; border: 0; flex: none; }
    .me-avatar, .me-text { display: none; }
    .logout { width: 38px; height: 38px; margin-left: 0; }

    .main { padding: 16px 12px calc(92px + env(safe-area-inset-bottom)); }
    .top { margin-bottom: 15px; gap: 8px; }
    .top h1 { font-size: 20px; }
    .top-actions { width: 100%; justify-content: space-between; }
    .page-head { flex-direction: column; gap: 12px; margin-bottom: 16px; }
    .page-head h2 { font-size: 18px; }
    .page-head p { font-size: 12.8px; }
    .head-actions { width: 100%; }
    .card-pad { padding: 14px; }
    .card-head { padding: 13px 14px; }
    .stats { grid-template-columns: 1fr 1fr; gap: 9px; }
    .stat { padding: 12px; gap: 10px; }
    .stat-icon { width: 32px; height: 32px; border-radius: 9px; }
    .stat-value { font-size: 17px; }
    .stat-label { font-size: 9.5px; }
    .grid-2, .field-row { grid-template-columns: 1fr; gap: 10px; }
    .kv { grid-template-columns: 1fr 1fr; gap: 12px 14px; }

    .field input, .field textarea, .field select,
    .console-tools input, .emoji-search, .log-row select,
    .new-desk input, .code-input, .rich-editor,
    .auto-row input, .auto-row textarea, .rr-row input, .rr-row select,
    .inline-form input, .inline-form select { font-size: 16px; }
    .field-tools { flex-direction: column; align-items: flex-start; }
    .field-tools select { width: 100%; }

    .actions { flex-wrap: wrap; }
    .actions .btn:not(.small) { flex: 1 1 100%; justify-content: center; }

    .table-row { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
    .t-right { margin-left: 0; width: 100%; justify-content: space-between; flex-wrap: wrap; }
    .log-row { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
    .log-label { width: 100%; }
    .log-row select { flex: 1 1 100%; width: 100%; }
    .log-status { width: auto; }

    .console-tools { gap: 8px; padding: 10px 12px; }
    .console-key { display: none; }
    .console-insert select { flex: 1 1 100%; }
    .console-cats { padding: 9px 12px; }
    .console-list { max-height: none; }
    .console-row { padding: 10px 12px; }
    .console-cmd code { white-space: normal; overflow-wrap: anywhere; }
    .console-result { padding: 12px; }
    .console-reply { padding: 10px; }
    .console-replies { max-height: none; }

    .prem-head { flex-wrap: wrap; padding: 15px 14px 10px; }
    .prem-head > .badge { margin-top: 0; }
    .prem-heading h3 { font-size: 17px; }
    .prem-boards { padding: 0 14px 4px; }
    .prem-board { flex-wrap: wrap; }
    .prem-board .btn { flex: 1 1 100%; justify-content: center; }
    .prem-hero .readonly-note { margin: 12px 14px 16px; }

    .toasts { left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }

    .emoji-pop { width: calc(100vw - 24px); max-height: min(372px, 60vh); }
    .mini-thumb { width: 44px; height: 44px; }
    .prefix-big input { font-size: 20px; padding: 11px 10px; }
    .prefix-swatch { width: 40px; height: 40px; font-size: 16px; }
    .modal-backdrop { padding: 14px; }
    .modal { padding: 20px; }
    .modal-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
    .login { padding: 16px 12px; }
    .login-card { padding: 26px 20px 24px; border-radius: 18px; }
    .login h1 { font-size: 20px; }
    .nav-item { min-width: 52px; padding: 6px 6px 5px; }
    .nav-item span { font-size: 9px; }
    .stat { gap: 8px; padding: 10px; }
    .stat-icon { width: 28px; height: 28px; }
    .stat-value { font-size: 16px; }
    .stat-label { font-size: 9px; }
}
