:root {
    --bg: #0b0712;
    --bg-dark: #050309;

    --sidebar: #100a1a;
    --sidebar-border: #3a2855;

    --panel: #171020;
    --panel-soft: #20162d;
    --panel-hover: #2b1d3e;

    --border: #5b4278;
    --border-soft: #342444;

    --text: #fffdf7;
    --muted: #c9c1d3;
    --muted-soft: #968ca2;

    --blue: #d4af37;
    --blue-soft: rgba(212, 175, 55, 0.16);

    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.14);

    --red: #ef4444;
    --red-soft: rgba(212, 175, 55, 0.16);

    --yellow: #f59e0b;
    --yellow-soft: rgba(245, 158, 11, 0.14);

    --purple: #7c3aed;
    --purple-soft: rgba(124, 58, 237, 0.16);

    --cyan: #a78bfa;
    --cyan-soft: rgba(167, 139, 250, 0.16);

    --rav-login-bg: #07040d;
    --rav-login-panel: #100a1a;
    --rav-login-panel-soft: #1b1127;

    --rav-login-red: #d4af37;
    --rav-login-red-dark: #6f4bb8;
    --rav-login-red-soft: rgba(212, 175, 55, 0.18);
    --rav-login-red-glow: rgba(212, 175, 55, 0.45);

    --rav-login-border: rgba(212, 175, 55, 0.45);

    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, Arial, sans-serif;
    background:
        radial-gradient(circle at top left, rgba(212, 175, 55, 0.12), transparent 35%),
        radial-gradient(circle at bottom right, rgba(111, 75, 184, 0.08), transparent 35%),
        var(--bg-dark);
    color: var(--text);
}

a {
    color: #f7e7a6;
    text-decoration: none;
}

a:hover {
    color: white;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;

    width: 260px;
    height: 100vh;

    background: linear-gradient(180deg, #100a1a, #0b0712);
    border-right: 1px solid var(--sidebar-border);

    padding: 20px 16px;

    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 28px;
    padding: 0 8px;
}

.brand-avatar {
    width: 42px;
    height: 42px;

    border-radius: 12px;
    overflow: hidden;

    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.16);

    flex-shrink: 0;
}

.brand-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: 0.3px;
}

.brand span {
    color: var(--muted);
    font-size: 13px;
}

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

.nav-section {
    margin: 18px 10px 8px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 12px;

    color: #ded7e7;

    padding: 12px 13px;
    border-radius: 10px;

    border: 1px solid transparent;

    transition: 0.16s ease;
}

.nav a i {
    width: 18px;
    text-align: center;
    color: #c9c1d3;
}

.nav a:hover {
    background: rgba(212, 175, 55, 0.10);
    border-color: rgba(212, 175, 55, 0.24);
    color: white;
}

.nav a:hover i {
    color: var(--blue);
}

.nav a.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.24), rgba(212, 175, 55, 0.10));
    border-color: rgba(212, 175, 55, 0.35);
    color: #fffaf0;
}

.nav a.active i {
    color: var(--blue);
}

.main {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
}

.topbar {
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 28px;

    background: rgba(8, 3, 3, 0.86);
    backdrop-filter: blur(14px);

    border-bottom: 1px solid var(--border-soft);

    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.topbar h1 {
    margin: 0;
    font-size: 20px;
}

.icon-button {
    width: 36px;
    height: 36px;

    border: none;
    border-radius: 9px;

    background: transparent;
    color: var(--muted);

    cursor: pointer;
}

.icon-button:hover {
    background: var(--panel-soft);
    color: white;
}

.top-status {
    display: flex;
    align-items: center;
    gap: 7px;

    font-size: 14px;
    font-weight: 700;
}

.top-status i {
    font-size: 9px;
}

.top-status.online {
    color: var(--green);
}

.top-status.offline {
    color: var(--red);
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 9px;

    color: white;
    font-weight: 700;
    font-size: 14px;
}

.admin-user img {
    width: 32px;
    height: 32px;

    border-radius: 50%;
    object-fit: cover;
}

.content {
    padding: 24px 28px 40px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(180px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(180deg, rgba(16, 10, 26, 0.96), rgba(9, 3, 3, 0.97));

    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    padding: 22px;

    display: flex;
    align-items: center;
    gap: 18px;

    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.16);

    transition: 0.16s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.42);
    box-shadow: 0 18px 35px rgba(0,0,0,.18), 0 0 20px rgba(220,38,38,.08);
}

.stat-icon {
    width: 56px;
    height: 56px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 14px;

    font-size: 28px;
}

.stat-icon.blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.stat-icon.green {
    background: var(--green-soft);
    color: var(--green);
}

.stat-icon.yellow {
    background: var(--yellow-soft);
    color: var(--yellow);
}

.stat-icon.red {
    background: var(--red-soft);
    color: var(--red);
}

.stat-icon.purple {
    background: var(--purple-soft);
    color: var(--purple);
}

.stat-icon.cyan {
    background: var(--cyan-soft);
    color: var(--cyan);
}

.stat-card span {
    color: var(--muted);
    font-size: 14px;
}

.stat-card strong {
    display: block;
    margin-top: 6px;

    font-size: 28px;
    line-height: 1;
}

.stat-card p {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(420px, 1.25fr) minmax(360px, 1fr) minmax(300px, 0.85fr);
    gap: 18px;
    margin-bottom: 18px;
}

.bottom-grid {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) 220px;
    gap: 18px;
}

.panel {
    background: linear-gradient(180deg, rgba(16, 10, 26, 0.96), rgba(9, 3, 3, 0.97));

    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    padding: 18px;

    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.16);
}

.panel.large {
    min-height: 0;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 18px;
}

.panel-header h2 {
    margin: 0;
    font-size: 18px;
}

.panel-header a {
    padding: 7px 11px;

    border-radius: 8px;

    background: rgba(148, 163, 184, 0.10);

    color: #f4d1d1;

    font-size: 13px;
}

.audit-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;

    margin-bottom: 18px;
}

.audit-top span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.audit-top strong {
    display: block;
    margin-top: 6px;
    font-size: 18px;
}

.audit-progress {
    height: 12px;

    background: #0c0404;

    border-radius: 999px;
    overflow: hidden;

    margin: 18px 0;
}

.audit-progress div {
    height: 100%;

    background: linear-gradient(90deg, #6f4bb8, #d4af37);
    border-radius: 999px;
}

.audit-boxes {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.audit-boxes div {
    padding: 16px;

    border-radius: 12px;

    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.055);

    text-align: center;
}

.audit-boxes span {
    color: var(--muted);
    font-size: 12px;
}

.audit-boxes strong {
    display: block;
    margin-top: 7px;
    font-size: 22px;
}

.panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;

    margin-top: 18px;
}

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    padding: 12px;

    border-radius: 9px;

    font-size: 14px;
    font-weight: 700;
}

.button.primary {
    background: linear-gradient(135deg, #d4af37, #7c3aed);
    color: white;
}

.button.secondary {
    background: rgba(148, 163, 184, 0.13);
    color: #f1dddd;
}

.button.full {
    margin-top: 14px;
    width: 100%;
}

.ticket-list {
    display: flex;
    flex-direction: column;
}

.ticket-row {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 12px;

    padding: 12px 0;

    border-bottom: 1px solid var(--border-soft);
}

.ticket-row:last-child {
    border-bottom: none;
}

.ticket-id {
    padding: 5px 9px;

    border-radius: 8px;

    background: rgba(212, 175, 55, 0.16);
    color: #e7c65f;

    font-size: 13px;
    font-weight: 800;
}

.ticket-row strong {
    display: block;
}

.ticket-row p,
.ticket-row small {
    color: var(--muted);
    margin: 3px 0 0;
    font-size: 13px;
}

.system-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 14px 0;

    border-bottom: 1px solid var(--border-soft);
}

.system-row:last-child {
    border-bottom: none;
}

.system-row span {
    color: var(--muted);

    display: flex;
    gap: 9px;
    align-items: center;
}

.green-text {
    color: var(--green);
}

.red-text {
    color: var(--red);
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
}

.mini-table th {
    color: var(--muted);
    text-align: left;
    font-size: 13px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}

.mini-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 14px;
}

.quick-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quick-actions h2 {
    margin: 0 0 8px;
    font-size: 17px;
}

.quick {
    display: flex;
    align-items: center;
    gap: 9px;

    padding: 12px;

    border-radius: 9px;

    color: white;
    font-weight: 700;
    font-size: 14px;
}

.quick.green {
    background: linear-gradient(135deg, #14532d, #15803d);
}

.quick.blue {
    background: linear-gradient(135deg, #6f4bb8, #7c3aed);
}

.quick.purple {
    background: linear-gradient(135deg, #6f4bb8, #a78bfa);
}

.quick.red {
    background: linear-gradient(135deg, #6f4bb8, #d4af37);
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 14px;
}

.search-input {
    width: 320px;

    padding: 11px 13px;

    background: #0c0404;
    color: var(--text);

    border: 1px solid var(--border);
    border-radius: 10px;

    outline: none;
}

.search-input:focus {
    border-color: var(--blue);
}

.table-count {
    color: var(--muted);
    font-size: 13px;
}

.table-card {
    background: linear-gradient(180deg, rgba(16, 10, 26, 0.96), rgba(9, 3, 3, 0.97));

    border: 1px solid var(--border-soft);
    border-radius: var(--radius);

    padding: 18px;

    overflow-x: auto;

    box-shadow: 0 18px 35px rgba(0, 0, 0, 0.16);
}

.spaced {
    margin-top: 24px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    color: var(--muted);
    text-align: left;
    padding: 13px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    background: transparent;
    cursor: pointer;
}

td {
    padding: 13px;
    border-bottom: 1px solid var(--border-soft);
    color: #e6d4d4;
}

tr:hover td {
    background: rgba(212, 175, 55, 0.055);
}

.copyable {
    cursor: pointer;
    color: #e7c65f;
}

.copyable:hover {
    text-decoration: underline;
}

.badge {
    display: inline-block;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
}

.badge.green {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
}

.badge.red {
    background: rgba(212, 175, 55, 0.18);
    color: #e7c65f;
}

.badge.yellow {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

.badge.blue {
    background: rgba(212, 175, 55, 0.18);
    color: #e7c65f;
}

.empty-state {
    color: var(--muted);
    margin: 0;
}

.login-page {
    min-height: 100vh;

    background:
        linear-gradient(
            rgba(3, 3, 3, 0.08),
            rgba(3, 3, 3, 0.24)
        ),
        url("/static/img/login_bg.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    overflow: hidden;
}

.login-bg-overlay {
    position: fixed;
    inset: 0;

    background:
        radial-gradient(
            circle at center,
            rgba(0, 0, 0, 0.00) 0%,
            rgba(0, 0, 0, 0.16) 62%,
            rgba(0, 0, 0, 0.54) 100%
        );

    pointer-events: none;
}

.login-container {
    position: relative;
    z-index: 2;

    min-height: 100vh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;
}

.rav-login-panel {
    width: 540px;

    padding: 36px 50px 32px;

    border-radius: 28px;

    background:
        linear-gradient(
            180deg,
            rgba(16, 10, 26, 0.92),
            rgba(5, 3, 3, 0.97)
        );

    border: 2px solid var(--rav-login-border);

    box-shadow:
        0 0 0 1px rgba(212, 175, 55, 0.16),
        0 0 34px rgba(212, 175, 55, 0.30),
        0 32px 90px rgba(0, 0, 0, 0.75),
        inset 0 0 48px rgba(212, 175, 55, 0.08);

    backdrop-filter: blur(18px);

    text-align: center;
}

.rav-login-emblem {
    width: 124px;
    height: 124px;

    margin: 0 auto 20px;

    border-radius: 50%;

    padding: 4px;

    background:
        radial-gradient(
            circle,
            rgba(212, 175, 55, 0.45),
            rgba(111, 75, 184, 0.12)
        );

    box-shadow:
        0 0 32px rgba(212, 175, 55, 0.46),
        0 0 70px rgba(111, 75, 184, 0.20);
}

.rav-login-emblem img {
    width: 100%;
    height: 100%;

    border-radius: 50%;

    object-fit: cover;

    display: block;
}

.rav-login-panel h1 {
    margin: 0;

    font-size: 42px;
    line-height: 1;

    letter-spacing: 1px;

    color: #f5f7fb;

    text-shadow:
        0 2px 0 rgba(0, 0, 0, 0.65),
        0 0 18px rgba(255, 255, 255, 0.16);
}

.rav-login-panel h1 span {
    color: var(--rav-login-red);

    text-shadow:
        0 0 18px rgba(212, 175, 55, 0.78);
}

.rav-login-panel p {
    margin: 16px 0 34px;

    color: #b6a1a1;

    font-size: 18px;
}

.rav-input-wrap {
    width: 100%;

    display: flex;
    align-items: center;
    gap: 14px;

    padding: 0 16px;

    border-radius: 12px;

    border: 1px solid rgba(212, 175, 55, 0.22);

    background: rgba(8, 6, 6, 0.78);

    box-shadow:
        inset 0 0 18px rgba(0, 0, 0, 0.38);

    margin-bottom: 24px;
}

.rav-input-wrap i {
    color: #b6a1a1;
    font-size: 18px;
}

.rav-input-wrap input {
    flex: 1;

    height: 58px;

    border: none;
    outline: none;

    background: transparent;
    color: white;

    font-size: 16px;
}

.rav-input-wrap input::placeholder {
    color: #8f7777;
}

.rav-input-wrap:focus-within {
    border-color: rgba(212, 175, 55, 0.74);

    box-shadow:
        0 0 18px rgba(212, 175, 55, 0.24),
        inset 0 0 18px rgba(0, 0, 0, 0.38);
}

.rav-login-panel button {
    width: 100%;

    height: 62px;

    border: none;
    border-radius: 12px;

    background:
        linear-gradient(
            135deg,
            #6f4bb8,
            #d4af37 45%,
            #7c3aed
        );

    color: white;

    font-size: 19px;
    font-weight: 800;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    cursor: pointer;

    box-shadow:
        0 0 26px rgba(212, 175, 55, 0.40),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);

    transition: 0.16s ease;
}

.rav-login-panel button:hover {
    filter: brightness(1.12);

    transform: translateY(-1px);

    box-shadow:
        0 0 36px rgba(212, 175, 55, 0.58),
        inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.rav-login-slogan {
    margin-top: 34px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;

    color: #b6a1a1;

    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;

    white-space: nowrap;
}

.rav-login-slogan strong {
    white-space: nowrap;
}

.rav-login-slogan em {
    color: #ef4444;

    font-style: normal;

    text-shadow:
        0 0 14px rgba(212, 175, 55, 0.88);
}

.rav-login-slogan .line {
    width: 58px;
    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(212, 175, 55, 0.78),
            transparent
        );
}

.rav-login-diamond {
    margin-top: 18px;

    color: #ef4444;

    font-size: 22px;

    text-shadow:
        0 0 18px rgba(212, 175, 55, 0.92);
}

.password-toggle {
    cursor: pointer;
    transition: 0.16s ease;
}

.password-toggle:hover {
    color: #ef4444;
}

@media (max-width: 700px) {
    .rav-login-panel {
        width: calc(100% - 32px);
        padding: 30px 24px;
    }

    .rav-login-panel h1 {
        font-size: 34px;
    }

    .rav-login-slogan {
        font-size: 14px;
        gap: 8px;
    }

    .rav-login-slogan .line {
        width: 32px;
    }
}


/* Eldra gold and violet theme override */
/* Append this to the END of style.css */

:root {
    --bg: #141012;
    --bg-dark: #0e0a0c;

    --sidebar: #181214;
    --sidebar-border: #342124;

    --panel: #1b1426;
    --panel-soft: #2a1d21;
    --panel-hover: #332328;

    --border: #463036;
    --border-soft: #38272c;

    --text: #f5f5f5;
    --muted: #b4a8ac;
    --muted-soft: #85767a;

    --blue: #ef4444;
    --blue-soft: rgba(239,68,68,.12);

    --green: #22c55e;
    --green-soft: rgba(34,197,94,.14);

    --red: #ef4444;
    --red-soft: rgba(239,68,68,.14);

    --yellow: #f59e0b;
    --yellow-soft: rgba(245,158,11,.14);

    --purple: #d4af37;
    --purple-soft: rgba(220,38,38,.14);

    --cyan: #fb7185;
    --cyan-soft: rgba(251,113,133,.12);
}

body {
    background:
        radial-gradient(circle at top left,
            rgba(239,68,68,.12),
            transparent 40%),

        radial-gradient(circle at bottom right,
            rgba(127,29,29,.10),
            transparent 40%),

        var(--bg-dark);
}

.stat-card,
.panel,
.table-card {
    background:
        linear-gradient(
            180deg,
            rgba(33,24,27,.96),
            rgba(24,16,18,.96)
        );
}

.nav a.active {
    background: linear-gradient(
        135deg,
        rgba(220,38,38,.22),
        rgba(220,38,38,.08)
    );
    border-color: rgba(220,38,38,.35);
}

.ticket-id {
    background: rgba(220,38,38,.16);
    color: #f3d675;
}

.form-panel {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 12px;
}

.form-panel input {
    padding: 12px;
    border-radius: 10px;

    background: var(--panel-soft);
    color: var(--text);

    border: 1px solid var(--border);
}

.form-panel button {
    border: none;
    border-radius: 10px;

    padding: 12px 18px;

    cursor: pointer;

    background: var(--red);
    color: white;
}

.delete-button {
    border: none;
    border-radius: 8px;

    padding: 8px 12px;

    cursor: pointer;

    background: rgba(239,68,68,.15);
    color: #ff8b8b;
}


/* Ticket Management V2 */

.ticket-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-button {
    border: 1px solid var(--border);
    border-radius: 999px;

    padding: 8px 13px;

    background: var(--panel-soft);
    color: var(--text);

    font-weight: 800;
    cursor: pointer;
}

.filter-button.active,
.filter-button:hover {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.ticket-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-button {
    border: none;
    border-radius: 8px;

    padding: 8px 12px;

    color: white;
    font-weight: 800;

    cursor: pointer;
}

.action-button.claim {
    background: #2563eb;
}

.action-button.close {
    background: #d4af37;
}

.action-button:hover {
    filter: brightness(1.15);
}


/* Ticket transcripts */

.action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 8px 12px;

    border-radius: 8px;

    background: rgba(212, 175, 55, 0.16);
    color: #f3d675;

    font-weight: 800;
}

.action-link:hover {
    background: rgba(212, 175, 55, 0.28);
    color: white;
}

.muted-text {
    color: var(--muted);
}

.ticket-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;

    margin-bottom: 18px;
}

.ticket-detail-grid div,
.ticket-reason {
    padding: 14px;

    border-radius: 12px;
    border: 1px solid var(--border-soft);

    background: rgba(255, 255, 255, 0.035);
}

.ticket-detail-grid span,
.ticket-reason span {
    display: block;

    margin-bottom: 6px;

    color: var(--muted);
    font-size: 13px;
}

.ticket-detail-grid strong {
    color: var(--text);
}

.ticket-reason p {
    margin: 0;

    color: var(--text);
}

.transcript-box {
    max-height: 650px;

    overflow: auto;

    padding: 18px;

    border-radius: 12px;
    border: 1px solid var(--border);

    background: rgba(0, 0, 0, 0.28);
    color: #e5e7eb;

    white-space: pre-wrap;
    word-break: break-word;

    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
}


/* Reaction Roles CRUD */

.reaction-role-form {
    display: grid;
    grid-template-columns: 1.5fr 0.8fr 1.5fr auto;
    gap: 12px;
}

.reaction-role-form input,
.reaction-role-inline-form input {
    min-width: 0;

    padding: 12px 14px;

    border-radius: 10px;
    border: 1px solid var(--border);

    background: var(--panel-soft);
    color: var(--text);
}

.reaction-role-form button,
.action-button.save {
    border: none;
    border-radius: 10px;

    padding: 12px 18px;

    background: var(--red);
    color: white;

    font-weight: 800;
    cursor: pointer;
}

.form-help {
    margin: 12px 0 0;

    color: var(--muted);
    font-size: 13px;
}

.rr-edit-box {
    display: inline-block;

    margin-right: 8px;
}

.rr-edit-box summary {
    display: inline-flex;
    align-items: center;

    padding: 8px 12px;

    border-radius: 8px;

    background: rgba(212, 175, 55, 0.14);
    color: #f3d675;

    font-weight: 800;
    cursor: pointer;
}

.reaction-role-inline-form {
    display: grid;
    grid-template-columns: 1.5fr 0.8fr 1.5fr auto;
    gap: 8px;

    margin-top: 10px;
    padding: 10px;

    border-radius: 10px;
    border: 1px solid var(--border-soft);

    background: rgba(0, 0, 0, 0.18);
}

.inline-delete-form {
    display: inline-block;
}

@media (max-width: 900px) {
    .reaction-role-form,
    .reaction-role-inline-form {
        grid-template-columns: 1fr;
    }
}

/* =========================
   Sidebar Collapse
   ========================= */

.app-layout.sidebar-collapsed .sidebar {
    width: 76px;
}

.app-layout.sidebar-collapsed .brand h2,
.app-layout.sidebar-collapsed .brand span,
.app-layout.sidebar-collapsed .nav span,
.app-layout.sidebar-collapsed .nav-section {
    display: none;
}

.app-layout.sidebar-collapsed .main {
    margin-left: 76px;
    width: calc(100% - 76px);
}

.app-layout.sidebar-collapsed .nav a {
    justify-content: center;
}

.app-layout.sidebar-collapsed .brand {
    justify-content: center;
}

/* =========================
   Safe viewport layout
   Does NOT break table columns
   ========================= */

html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

.app-layout {
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
}

.sidebar {
    height: 100vh;
    overflow-y: auto;
}

.main {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.topbar {
    height: 64px;
}

.content {
    height: calc(100vh - 64px);
    overflow: hidden;
    padding: 16px 20px;
}

/* =========================
   Compact global sizing
   ========================= */

.stat-grid {
    gap: 12px;
    margin-bottom: 12px;
}

.stat-card {
    min-height: 76px;
    padding: 12px 16px;
    gap: 12px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 21px;
}

.stat-card span {
    font-size: 12px;
}

.stat-card strong {
    margin-top: 4px;
    font-size: 20px;
}

.stat-card p {
    margin-top: 5px;
    font-size: 12px;
}

.panel {
    padding: 14px;
}

.panel-header {
    margin-bottom: 12px;
}

.panel-header h2 {
    font-size: 16px;
}

/* =========================
   Dashboard one-screen layout
   ========================= */

.dashboard-layout {
    grid-template-columns: minmax(360px, 1.2fr) minmax(340px, 1fr) minmax(280px, 0.85fr);
    gap: 12px;
    margin-bottom: 12px;
    height: 33vh;
    min-height: 245px;
}

.bottom-grid {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr) 200px;
    gap: 12px;
    height: 27vh;
    min-height: 190px;
}

.dashboard-layout .panel,
.bottom-grid .panel {
    overflow: hidden;
}

.audit-top {
    margin-bottom: 10px;
    gap: 12px;
}

.audit-top strong {
    font-size: 16px;
}

.audit-progress {
    height: 9px;
    margin: 10px 0;
}

.audit-boxes {
    gap: 8px;
}

.audit-boxes div {
    padding: 10px;
}

.audit-boxes strong {
    font-size: 18px;
}

.panel-actions {
    gap: 10px;
    margin-top: 12px;
}

.button {
    padding: 10px;
    font-size: 13px;
}

.ticket-list {
    max-height: calc(33vh - 72px);
    overflow-y: auto;
    padding-right: 6px;
}

.ticket-row {
    padding: 8px 0;
}

.ticket-row p,
.ticket-row small {
    font-size: 12px;
}

.system-row {
    padding: 10px 0;
}

.quick-actions {
    gap: 8px;
}

.quick {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 12px;
}

.mini-table th,
.mini-table td {
    padding: 7px 0;
    font-size: 12px;
}

.bottom-grid .panel {
    display: flex;
    flex-direction: column;
}

.bottom-grid .mini-table {
    display: block;
    overflow-y: auto;
    max-height: calc(27vh - 78px);
}

/* =========================
   Normal pages: internal panel scroll
   Keeps tables normal, no display:block on tr/tbody
   ========================= */

/* Admin logs and settings can use wider tables without column collapse */
table {
    table-layout: auto;
}

/* Scrollbar polish */
.sidebar::-webkit-scrollbar,
.content > .panel.spaced:last-child::-webkit-scrollbar,
.content > .table-card:last-child::-webkit-scrollbar,
.ticket-list::-webkit-scrollbar,
.bottom-grid .mini-table::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.sidebar::-webkit-scrollbar-thumb,
.content > .panel.spaced:last-child::-webkit-scrollbar-thumb,
.content > .table-card:last-child::-webkit-scrollbar-thumb,
.ticket-list::-webkit-scrollbar-thumb,
.bottom-grid .mini-table::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.28);
    border-radius: 999px;
}

.sidebar::-webkit-scrollbar-track,
.content > .panel.spaced:last-child::-webkit-scrollbar-track,
.content > .table-card:last-child::-webkit-scrollbar-track,
.ticket-list::-webkit-scrollbar-track,
.bottom-grid .mini-table::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.18);
}

/* =========================
   Small height screens
   ========================= */

@media (max-height: 950px) {
    .content {
        padding: 12px 16px;
    }

    .stat-grid {
        gap: 10px;
        margin-bottom: 10px;
    }

    .stat-card {
        min-height: 64px;
        padding: 9px 12px;
    }

    .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 17px;
    }

    .stat-card strong {
        font-size: 17px;
    }

    .stat-card p {
        display: none;
    }

    .dashboard-layout {
        height: 34vh;
        min-height: 220px;
        gap: 10px;
        margin-bottom: 10px;
    }

    .bottom-grid {
        height: 27vh;
        min-height: 170px;
        gap: 10px;
    }

    .panel {
        padding: 11px;
    }

    .panel-header {
        margin-bottom: 8px;
    }

    .audit-boxes div {
        padding: 7px;
    }

    .audit-boxes span {
        font-size: 10px;
    }

    .audit-boxes strong {
        font-size: 15px;
    }

    .button {
        padding: 8px;
    }

    .ticket-row {
        padding: 6px 0;
    }

    .ticket-row p,
    .ticket-row small {
        font-size: 11px;
    }

    .system-row {
        padding: 8px 0;
    }

    .quick {
        min-height: 32px;
        padding: 7px 9px;
        font-size: 11px;
    }
}

/* =========================
   Normal-width monitor tuning
   ========================= */

@media (max-width: 1500px) {
    .stat-grid {
        grid-template-columns: repeat(5, minmax(120px, 1fr));
    }

    .dashboard-layout {
        grid-template-columns: 1.15fr 1fr 0.9fr;
    }

    .bottom-grid {
        grid-template-columns: 1fr 1fr 180px;
    }
}

/* =========================
   Small screens fallback
   ========================= */

@media (max-width: 1100px) {
    body {
        overflow: auto;
    }

    .app-layout,
    .main,
    .content {
        height: auto;
        overflow: visible;
    }

    .sidebar {
        position: fixed;
    }

    .stat-grid,
    .dashboard-layout,
    .bottom-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
}


/* =========================
   Final page height behavior
   ========================= */

/*
   Dashboard is fixed-height.
   Other pages keep natural panel height, so cards don't stretch into huge empty blocks.
*/

.content {
    height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Dashboard only: keep everything inside one viewport */
body:has(.dashboard-layout) .content {
    overflow: hidden;
}

body:has(.dashboard-layout) .dashboard-layout {
    height: 33vh;
    min-height: 245px;
}

body:has(.dashboard-layout) .bottom-grid {
    height: 30vh;
    min-height: 210px;
}

body:has(.dashboard-layout) .bottom-grid .panel {
    overflow: hidden;
}

body:has(.dashboard-layout) .bottom-grid .mini-table {
    display: block;
    overflow-y: auto;
    max-height: calc(24vh - 72px);
}

body:has(.dashboard-layout) .ticket-list {
    max-height: calc(33vh - 78px);
    overflow-y: auto;
    padding-right: 6px;
}

/* Normal pages: don't stretch panels */
body:not(:has(.dashboard-layout)) .panel,
body:not(:has(.dashboard-layout)) .table-card {
    height: auto;
}

/* Long table pages: scroll inside the last table panel only when needed */
body:not(:has(.dashboard-layout)) .content > .panel.spaced:last-child,
body:not(:has(.dashboard-layout)) .content > .table-card:last-child {
    max-height: calc(100vh - 220px);
    overflow: auto;
}

/* Pages with an add form before the table */
body:not(:has(.dashboard-layout)) .content > .panel.spaced:nth-of-type(3) {
    max-height: calc(100vh - 310px);
    overflow: auto;
}

/* Settings page should not stretch the system overview panel */
body:has(.system-overview-page) .content > .panel.spaced:last-child,
body:has(.settings-page) .content > .panel.spaced:last-child {
    max-height: none;
    overflow: visible;
}

/* Fallback for current Settings template without page class */
body:not(:has(.dashboard-layout)) .content > .stat-grid + .panel.spaced:last-child {
    max-height: none;
    overflow: visible;
}

/* Keep table columns normal */
body:not(:has(.dashboard-layout)) table {
    width: 100%;
    table-layout: auto;
}

body:not(:has(.dashboard-layout)) th,
body:not(:has(.dashboard-layout)) td {
    white-space: nowrap;
}

/* Compact the simple pages */
body:not(:has(.dashboard-layout)) .stat-grid {
    margin-bottom: 14px;
}

body:not(:has(.dashboard-layout)) .spaced {
    margin-top: 14px;
}

/* Admin logs, audit, tickets can scroll if they grow */
body:not(:has(.dashboard-layout)) .content > .panel.spaced:last-child table {
    min-width: max-content;
}

/* Small-height monitor tuning */
@media (max-height: 950px) {
    body:has(.dashboard-layout) .dashboard-layout {
        height: 34vh;
        min-height: 220px;
    }

    body:has(.dashboard-layout) .bottom-grid {
        height: 23vh;
        min-height: 150px;
    }

    body:has(.dashboard-layout) .bottom-grid .mini-table {
        max-height: calc(23vh - 68px);
    }

    body:not(:has(.dashboard-layout)) .content > .panel.spaced:last-child,
    body:not(:has(.dashboard-layout)) .content > .table-card:last-child {
        max-height: calc(100vh - 190px);
    }

    body:not(:has(.dashboard-layout)) .content > .panel.spaced:nth-of-type(3) {
        max-height: calc(100vh - 280px);
    }

    body:not(:has(.dashboard-layout)) .content > .stat-grid + .panel.spaced:last-child {
        max-height: none;
    }
}

/* Mobile / narrow fallback */
@media (max-width: 1100px) {
    body {
        overflow: auto;
    }

    .app-layout,
    .main,
    .content {
        height: auto;
        overflow: visible;
    }

    body:has(.dashboard-layout) .dashboard-layout,
    body:has(.dashboard-layout) .bottom-grid {
        height: auto;
        min-height: 0;
    }

    body:not(:has(.dashboard-layout)) .content > .panel.spaced:last-child,
    body:not(:has(.dashboard-layout)) .content > .table-card:last-child,
    body:not(:has(.dashboard-layout)) .content > .panel.spaced:nth-of-type(3) {
        max-height: none;
    }
}

/* Fix dashboard recent list tables */
.bottom-grid .mini-table {
    width: 100%;
    display: table;
    table-layout: fixed;
}

.bottom-grid .mini-table thead,
.bottom-grid .mini-table tbody {
    display: table-header-group;
}

.bottom-grid .mini-table tbody {
    display: table-row-group;
}

.bottom-grid .mini-table tr {
    display: table-row;
}

.bottom-grid .mini-table th,
.bottom-grid .mini-table td {
    display: table-cell;
    white-space: normal;
    word-break: break-word;
}

.bottom-grid .mini-table th:nth-child(1),
.bottom-grid .mini-table td:nth-child(1) {
    width: 22%;
}

.bottom-grid .mini-table th:nth-child(2),
.bottom-grid .mini-table td:nth-child(2) {
    width: 28%;
}

.bottom-grid .mini-table th:nth-child(3),
.bottom-grid .mini-table td:nth-child(3) {
    width: 50%;
}

/* Final fix for dashboard mini tables */
.bottom-grid .mini-table {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
}

.bottom-grid .mini-table thead {
    display: table-header-group !important;
}

.bottom-grid .mini-table tbody {
    display: table-row-group !important;
}

.bottom-grid .mini-table tr {
    display: table-row !important;
}

.bottom-grid .mini-table th,
.bottom-grid .mini-table td {
    display: table-cell !important;
    white-space: normal !important;
    word-break: break-word;
}

.bottom-grid .mini-table th:nth-child(1),
.bottom-grid .mini-table td:nth-child(1) {
    width: 22%;
}

.bottom-grid .mini-table th:nth-child(2),
.bottom-grid .mini-table td:nth-child(2) {
    width: 28%;
}

.bottom-grid .mini-table th:nth-child(3),
.bottom-grid .mini-table td:nth-child(3) {
    width: 50%;
}

/* Discord OAuth Login */

.discord-login-button {
    width: 100%;
    height: 58px;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    margin-bottom: 16px;

    border-radius: 12px;

    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;

    font-size: 18px;
    font-weight: 900;

    box-shadow:
        0 0 26px rgba(124, 58, 237, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.discord-login-button:hover {
    color: white;
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;

    margin: 0 0 16px;

    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(212, 175, 55, 0.28);
}




/* Audit page fixed-height layout */

.content:has(.audit-page) {
    height: calc(100vh - 70px);
    overflow: hidden;
    padding-bottom: 24px;
}

.audit-page {
    height: 100%;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.audit-page .stat-grid {
    flex: 0 0 auto;
    margin-bottom: 10px;
}

.audit-page .panel {
    flex: 1 1 auto;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
    margin-top: 10px;
}

.audit-page .panel-header {
    flex: 0 0 auto;
}

.audit-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;

    overflow-y: auto;
    overflow-x: auto;
}

.audit-scroll table {
    margin: 0;
}

.audit-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;

    background: rgba(16, 10, 26, 0.98);
}


/* =========================================================
   ELDRA HELPER V2 — responsive layout and overflow fixes
   ========================================================= */

html,
body {
    max-width: 100%;
}

* {
    min-width: 0;
}

.main,
.content,
.panel,
.table-card,
.stat-card,
.dashboard-layout,
.bottom-grid,
.form-panel,
.ticket-row,
.system-row {
    min-width: 0;
}

.content {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Long text safety */
td,
th,
.panel,
.table-card,
.ticket-row,
.system-row,
.dashboard-action-row,
.transcript-box,
.ticket-reason {
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Tables on normal pages scroll inside cards instead of breaking page width */
.table-card,
body:not(:has(.dashboard-layout)) .content > .panel.spaced {
    max-width: 100%;
    overflow: auto;
}

body:not(:has(.dashboard-layout)) table {
    width: 100%;
    table-layout: auto;
}

body:not(:has(.dashboard-layout)) th,
body:not(:has(.dashboard-layout)) td {
    vertical-align: top;
}

body:not(:has(.dashboard-layout)) td:nth-child(2),
body:not(:has(.dashboard-layout)) td:nth-child(4),
body:not(:has(.dashboard-layout)) td:nth-child(5) {
    white-space: normal;
    max-width: 760px;
}

/* Forms */
.form-panel,
.reaction-role-form,
.reaction-role-inline-form {
    max-width: 100%;
}

.form-panel input,
.reaction-role-form input,
.reaction-role-inline-form input,
.search-input {
    min-width: 0;
}

/* Dashboard should be scroll-safe, not forced into broken tiny panels */
body:has(.dashboard-layout) .content {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body:has(.dashboard-layout) .dashboard-layout,
body:has(.dashboard-layout) .bottom-grid {
    height: auto !important;
    min-height: 0 !important;
}

.dashboard-layout,
.bottom-grid {
    align-items: stretch;
}

.dashboard-layout .panel,
.bottom-grid .panel {
    overflow: hidden;
}

.bottom-grid .panel {
    display: flex;
    flex-direction: column;
}

.bottom-grid .mini-table {
    display: table !important;
    width: 100% !important;
    table-layout: fixed !important;
    flex: 1 1 auto;
}

.bottom-grid .mini-table thead {
    display: table-header-group !important;
}

.bottom-grid .mini-table tbody {
    display: table-row-group !important;
}

.bottom-grid .mini-table tr {
    display: table-row !important;
}

.bottom-grid .mini-table th,
.bottom-grid .mini-table td {
    display: table-cell !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.bottom-grid .button.full {
    flex: 0 0 auto;
}

/* Bot actions + Last Action Status */
.quick-actions {
    min-width: 0 !important;
}

.quick-actions form {
    margin: 0;
}

.quick-actions .quick {
    width: 100%;
    border: none;
}

.dashboard-action-status {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-soft);
    max-height: none !important;
    overflow: visible !important;
}

.dashboard-action-status-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--muted);
}

.dashboard-action-status-title a {
    flex-shrink: 0;
}

.dashboard-action-row {
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.035);
}

.dashboard-action-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.dashboard-action-main strong {
    font-size: 12px;
    line-height: 1.25;
}

.dashboard-action-row small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 6px;
}

.dashboard-action-row p {
    margin: 0;
    font-size: 12px;
    line-height: 1.35;
    white-space: normal;
}

/* Audit page scroll area */
.audit-scroll {
    max-width: 100%;
    overflow: auto;
}

.audit-scroll table {
    min-width: 760px;
}

.transcript-box {
    max-width: 100%;
}

/* Wide screens */
@media (min-width: 1700px) {
    .content {
        padding-left: 34px;
        padding-right: 34px;
    }

    .stat-grid {
        grid-template-columns: repeat(5, minmax(180px, 1fr));
    }

    .dashboard-layout {
        grid-template-columns: minmax(460px, 1.25fr) minmax(400px, 1fr) minmax(340px, 0.85fr);
    }

    .bottom-grid {
        grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr) minmax(260px, 0.55fr);
    }
}

/* 1080p / laptop */
@media (max-width: 1500px) {
    .content {
        padding: 14px 16px 28px;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 12px;
    }

    .dashboard-layout {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        gap: 12px;
    }

    .dashboard-layout .system-panel {
        grid-column: 1 / -1;
    }

    .bottom-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 12px;
    }

    .bottom-grid .quick-actions {
        grid-column: 1 / -1;
    }
}

/* Small monitor / tablet */
@media (max-width: 1100px) {
    body {
        overflow: auto;
    }

    .app-layout,
    .main,
    .content {
        height: auto !important;
        overflow: visible !important;
    }

    .content {
        overflow-x: hidden !important;
    }

    .stat-grid,
    .dashboard-layout,
    .bottom-grid,
    .audit-top,
    .audit-boxes {
        grid-template-columns: 1fr !important;
        height: auto !important;
        min-height: 0 !important;
    }

    .dashboard-layout .system-panel,
    .bottom-grid .quick-actions {
        grid-column: auto;
    }

    .dashboard-layout .panel,
    .bottom-grid .panel {
        overflow: visible;
    }

    .form-panel,
    .reaction-role-form,
    .reaction-role-inline-form {
        grid-template-columns: 1fr !important;
    }

    .form-panel button,
    .reaction-role-form button,
    .reaction-role-inline-form button {
        width: 100%;
    }

    .table-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .search-input {
        width: 100%;
    }

    .ticket-row {
        grid-template-columns: 64px 1fr;
    }

    .ticket-row small {
        grid-column: 2;
    }
}

/* Narrow screens */
@media (max-width: 700px) {
    .sidebar {
        width: 76px;
        padding: 16px 10px;
    }

    .brand h2,
    .brand span,
    .nav span,
    .nav-section {
        display: none;
    }

    .brand,
    .nav a {
        justify-content: center;
    }

    .main {
        margin-left: 76px;
        width: calc(100% - 76px);
    }

    .topbar {
        padding: 0 12px;
        gap: 10px;
    }

    .topbar h1 {
        font-size: 16px;
    }

    .top-status,
    .admin-user span {
        display: none;
    }

    .content {
        padding: 12px;
    }

    .panel,
    .table-card {
        padding: 12px;
    }

    .stat-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 14px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .panel-header a {
        width: 100%;
        text-align: center;
    }

    .panel-actions {
        grid-template-columns: 1fr;
    }

    .mini-table,
    .table-card table,
    body:not(:has(.dashboard-layout)) .content > .panel.spaced table {
        min-width: 680px;
    }

    .bottom-grid .panel {
        overflow-x: auto;
    }

    .quick {
        justify-content: center;
    }

    .login-page {
        overflow-y: auto;
    }
}

/* Very narrow */
@media (max-width: 420px) {
    .main {
        margin-left: 68px;
        width: calc(100% - 68px);
    }

    .sidebar {
        width: 68px;
        padding-left: 8px;
        padding-right: 8px;
    }

    .brand-avatar {
        width: 38px;
        height: 38px;
    }

    .nav a {
        padding: 10px;
    }

    .content {
        padding: 10px;
    }
}


/* =========================================================
   ELDRA HELPER V2 — styled scrollbars
   ========================================================= */

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.50) rgba(0, 0, 0, 0.18);
}

*::-webkit-scrollbar {
    width: 9px;
    height: 9px;
}

*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.72), rgba(111, 75, 184, 0.72));
    border-radius: 999px;
    border: 2px solid rgba(12, 4, 4, 0.9);
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(235, 203, 103, 0.9), rgba(167, 139, 250, 0.9));
}

*::-webkit-scrollbar-corner {
    background: rgba(0, 0, 0, 0.18);
}

/* =========================================================
   ELDRA HELPER V2 — Admin Logs inner scroll fix
   ========================================================= */

/* Logs page: only Recent Actions scrolls. Sidebar/topbar/stat card stay fixed. */
.content:has(.logs-page) {
    height: calc(100vh - 64px) !important;
    overflow: hidden !important;
}

.logs-page {
    height: 100%;
    min-height: 0;

    display: flex;
    flex-direction: column;

    overflow: hidden;
}

.logs-page > .stat-grid {
    flex: 0 0 auto;
    margin-bottom: 14px;
}

.logs-table-panel {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;

    overflow: auto !important;
}

.logs-table-panel table {
    min-width: 980px;
    margin: 0;
}

.logs-table-panel thead th {
    position: sticky;
    top: 0;
    z-index: 5;

    background: rgba(27, 20, 38, 0.98);
    backdrop-filter: blur(10px);
}

.logs-table-panel td {
    vertical-align: top;
}

.logs-table-panel td:nth-child(4) {
    max-width: 780px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* Small screens: page can scroll, table still scrolls horizontally inside panel */
@media (max-width: 1100px) {
    .content:has(.logs-page) {
        height: auto !important;
        overflow: visible !important;
    }

    .logs-page {
        height: auto;
        overflow: visible;
    }

    .logs-table-panel {
        max-height: none !important;
        overflow: auto !important;
    }
}


/* =========================================================
   ELDRA HELPER V2 - Toast notifications
   ========================================================= */

#toast-container {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;

    display: flex;
    flex-direction: column;
    gap: 10px;

    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.toast {
    pointer-events: auto;

    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: flex-start;
    gap: 10px;

    padding: 13px 14px;

    border-radius: 14px;
    border: 1px solid var(--border-soft);

    background:
        linear-gradient(
            180deg,
            rgba(27, 20, 38, 0.98),
            rgba(18, 11, 13, 0.98)
        );

    box-shadow:
        0 18px 38px rgba(0, 0, 0, 0.42),
        0 0 22px rgba(212, 175, 55, 0.10);

    color: var(--text);

    animation: toastIn 0.22s ease-out;
}

.toast.closing {
    animation: toastOut 0.18s ease-in forwards;
}

.toast-icon {
    margin-top: 1px;
    color: #e7c65f;
}

.toast.success {
    border-color: rgba(34, 197, 94, 0.35);
}

.toast.success .toast-icon {
    color: var(--green);
}

.toast.error {
    border-color: rgba(212, 175, 55, 0.42);
}

.toast.error .toast-icon {
    color: var(--red);
}

.toast.info {
    border-color: rgba(245, 158, 11, 0.35);
}

.toast.info .toast-icon {
    color: var(--yellow);
}

.toast-message {
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;

    overflow-wrap: anywhere;
    word-break: break-word;
}

.toast-close {
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    font-size: 16px;
    line-height: 1;
}

.toast-close:hover {
    color: white;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
}

@media (max-width: 700px) {
    #toast-container {
        left: 84px;
        right: 12px;
        bottom: 12px;
        width: auto;
    }
}



/* =========================================================
   ELDRA HELPER V2 - UI animations pack
   Lightweight CSS-only polish
   ========================================================= */

:root {
    --rav-anim-fast: 140ms;
    --rav-anim-normal: 220ms;
    --rav-glow-red: rgba(212, 175, 55, 0.18);
    --rav-glow-red-strong: rgba(212, 175, 55, 0.34);
}

.content > .stat-grid,
.content > .dashboard-layout,
.content > .bottom-grid,
.content > .panel,
.content > .table-card,
.logs-page,
.audit-page {
    animation: ravFadeUp 220ms ease-out both;
}

.content > .stat-grid:nth-child(2) {
    animation-delay: 45ms;
}

.dashboard-layout,
.bottom-grid,
.content > .panel.spaced,
.content > .table-card.spaced {
    animation-delay: 70ms;
}

.stat-card,
.panel,
.table-card,
.ticket-row,
.system-row,
.quick,
.button,
.action-button,
.action-link,
.filter-button,
.delete-button {
    transition:
        transform var(--rav-anim-normal) ease,
        border-color var(--rav-anim-normal) ease,
        box-shadow var(--rav-anim-normal) ease,
        background var(--rav-anim-normal) ease,
        filter var(--rav-anim-fast) ease;
}

.stat-card:hover,
.panel:hover,
.table-card:hover {
    border-color: rgba(212, 175, 55, 0.32);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.24),
        0 0 24px var(--rav-glow-red);
}

.stat-card:hover {
    transform: translateY(-3px);
}

.button:hover,
.quick:hover,
.action-button:hover,
.action-link:hover,
.filter-button:hover,
.delete-button:hover {
    transform: translateY(-1px);
    filter: brightness(1.10);
}

.button:active,
.quick:active,
.action-button:active,
.action-link:active,
.filter-button:active,
.delete-button:active {
    transform: translateY(0) scale(0.99);
}

.topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(212, 175, 55, 0.15),
            rgba(212, 175, 55, 0.75),
            rgba(212, 175, 55, 0.15),
            transparent
        );

    background-size: 220% 100%;
    animation: ravTopGlow 4.5s linear infinite;
}

.nav a {
    position: relative;
    overflow: hidden;
}

.nav a::before {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(212, 175, 55, 0.08),
            transparent
        );

    transform: translateX(-100%);
    transition: opacity 180ms ease;
}

.nav a:hover::before,
.nav a.active::before {
    opacity: 1;
    animation: ravNavSweep 900ms ease;
}

.live-updated,
[data-discord-stat].live-updated,
[data-live-stat].live-updated,
[data-live-audit].live-updated {
    animation: ravValuePulse 420ms ease-out;
}

.toast {
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;

    height: 3px;
    width: 100%;

    background:
        linear-gradient(
            90deg,
            rgba(212, 175, 55, 0.90),
            rgba(235, 203, 103, 0.95)
        );

    transform-origin: left center;
    animation: toastProgress var(--toast-duration, 4200ms) linear forwards;
}

.toast.success::after {
    background:
        linear-gradient(
            90deg,
            rgba(34, 197, 94, 0.92),
            rgba(74, 222, 128, 0.95)
        );
}

.toast.error::after {
    background:
        linear-gradient(
            90deg,
            rgba(212, 175, 55, 0.92),
            rgba(235, 203, 103, 0.95)
        );
}

.toast.info::after {
    background:
        linear-gradient(
            90deg,
            rgba(245, 158, 11, 0.92),
            rgba(251, 191, 36, 0.95)
        );
}

details,
.rr-edit-box,
.transcript-box {
    transition:
        border-color var(--rav-anim-normal) ease,
        box-shadow var(--rav-anim-normal) ease,
        background var(--rav-anim-normal) ease;
}

details[open],
.rr-edit-box[open] {
    animation: ravScaleIn 160ms ease-out both;
}

.skeleton,
.loading-skeleton {
    position: relative;
    overflow: hidden;

    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
}

.skeleton::after,
.loading-skeleton::after {
    content: "";
    position: absolute;
    inset: 0;

    transform: translateX(-100%);

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.10),
            transparent
        );

    animation: ravSkeleton 1.2s infinite;
}

@keyframes ravFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ravScaleIn {
    from {
        opacity: 0.85;
        transform: scale(0.985);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes ravTopGlow {
    from {
        background-position: 220% 0;
    }

    to {
        background-position: -220% 0;
    }
}

@keyframes ravNavSweep {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(100%);
    }
}

@keyframes ravValuePulse {
    0% {
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
        transform: scale(1);
    }

    40% {
        color: #fff;
        text-shadow: 0 0 16px rgba(212, 175, 55, 0.62);
        transform: scale(1.035);
    }

    100% {
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
        transform: scale(1);
    }
}

@keyframes toastProgress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

@keyframes ravSkeleton {
    100% {
        transform: translateX(100%);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
        scroll-behavior: auto !important;
    }
}



/* =========================================================
   ELDRA HELPER V2 - 1080p layout + sidebar animation + audit polish
   ========================================================= */

:root {
    --rav-sidebar-width: 250px;
    --rav-sidebar-collapsed-width: 82px;
    --rav-content-max: 1560px;
}

.main {
    margin-left: var(--rav-sidebar-width) !important;
    width: calc(100% - var(--rav-sidebar-width)) !important;
    transition:
        margin-left 220ms ease,
        width 220ms ease;
}

.content {
    max-width: var(--rav-content-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: clamp(18px, 1.45vw, 30px);
    padding-right: clamp(18px, 1.45vw, 30px);
}

.sidebar {
    width: var(--rav-sidebar-width) !important;
    transition:
        width 220ms ease,
        transform 220ms ease,
        box-shadow 220ms ease;
    will-change: width, transform;
}

.sidebar .brand h2,
.sidebar .brand span,
.sidebar .nav span,
.sidebar .nav-section,
.sidebar .admin-user span {
    transition:
        opacity 160ms ease,
        transform 190ms ease,
        max-width 220ms ease;
}

body.sidebar-collapsed .sidebar {
    width: var(--rav-sidebar-collapsed-width) !important;
}

body.sidebar-collapsed .main {
    margin-left: var(--rav-sidebar-collapsed-width) !important;
    width: calc(100% - var(--rav-sidebar-collapsed-width)) !important;
}

body.sidebar-collapsed .sidebar .brand {
    justify-content: center;
}

body.sidebar-collapsed .sidebar .brand h2,
body.sidebar-collapsed .sidebar .brand span,
body.sidebar-collapsed .sidebar .nav span,
body.sidebar-collapsed .sidebar .nav-section,
body.sidebar-collapsed .sidebar .admin-user span {
    opacity: 0;
    transform: translateX(-8px);
    max-width: 0;
    overflow: hidden;
    pointer-events: none;
}

body.sidebar-collapsed .sidebar .nav a {
    justify-content: center;
}

body.sidebar-collapsed .sidebar .nav a i {
    margin-right: 0;
}

body.sidebar-collapsed .sidebar .brand-avatar {
    margin-right: 0;
}

.menu-toggle,
.sidebar-toggle,
.topbar .fa-bars,
.topbar button:has(.fa-bars) {
    transition:
        transform 200ms ease,
        background 200ms ease,
        box-shadow 200ms ease;
}

.menu-toggle:hover,
.sidebar-toggle:hover,
.topbar button:has(.fa-bars):hover {
    transform: scale(1.04);
    box-shadow: 0 0 18px rgba(212, 175, 55, 0.16);
}

body.sidebar-collapsed .menu-toggle,
body.sidebar-collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

@media (min-width: 1200px) and (max-width: 1920px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
        gap: 14px;
    }

    .dashboard-layout {
        grid-template-columns: minmax(420px, 1.2fr) minmax(380px, 1fr) minmax(300px, 0.75fr);
        gap: 14px;
    }

    .bottom-grid {
        grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr) minmax(230px, 0.45fr);
        gap: 14px;
    }
}

.content > .table-card,
.content > .panel.spaced {
    border-radius: 16px;
}

.content > .table-card table,
.content > .panel.spaced table {
    font-size: clamp(13px, 0.82vw, 15px);
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-color: rgba(212, 175, 55, 0.22);
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;

    background:
        radial-gradient(circle at 12% 18%, rgba(212, 175, 55, 0.13), transparent 28%),
        radial-gradient(circle at 90% 12%, rgba(212, 175, 55, 0.10), transparent 24%),
        linear-gradient(120deg, transparent, rgba(212, 175, 55, 0.055), transparent);

    opacity: 0.88;
    animation: ravAuditPanelGlow 5.5s ease-in-out infinite;
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child::after {
    content: "";
    position: absolute;
    left: -35%;
    top: 0;
    height: 2px;
    width: 35%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(235, 203, 103, 0.95),
            transparent
        );

    box-shadow: 0 0 18px rgba(212, 175, 55, 0.75);
    animation: ravAuditScan 3.4s linear infinite;
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.38);
    box-shadow:
        0 20px 55px rgba(0, 0, 0, 0.34),
        0 0 30px rgba(212, 175, 55, 0.14);
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child [class*="progress"],
body:has(.dashboard-layout) .dashboard-layout > .panel:first-child [class*="bar"] {
    position: relative;
    overflow: hidden;
}

body:has(.dashboard-layout) .dashboard-layout > .panel:first-child [class*="progress"]::after,
body:has(.dashboard-layout) .dashboard-layout > .panel:first-child [class*="bar"]::after {
    content: "";
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.22),
            transparent
        );

    transform: translateX(-100%);
    animation: ravAuditBarSweep 2.8s ease-in-out infinite;
}

.badge.green,
.live-badge,
.status-live,
body:has(.dashboard-layout) .dashboard-layout > .panel:first-child .badge {
    animation: ravLiveBreath 2.2s ease-in-out infinite;
}

tbody tr {
    transition:
        background 150ms ease,
        box-shadow 150ms ease;
}

tbody tr:hover {
    background: rgba(212, 175, 55, 0.045);
}

@media (max-width: 900px) {
    :root {
        --rav-sidebar-width: 76px;
        --rav-sidebar-collapsed-width: 76px;
    }

    .content {
        max-width: none;
        padding-left: 12px;
        padding-right: 12px;
    }

    body.sidebar-collapsed .sidebar .brand h2,
    body.sidebar-collapsed .sidebar .brand span,
    body.sidebar-collapsed .sidebar .nav span,
    body.sidebar-collapsed .sidebar .nav-section,
    body.sidebar-collapsed .sidebar .admin-user span {
        display: none;
    }
}

@keyframes ravAuditPanelGlow {
    0%, 100% {
        opacity: 0.72;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.015);
    }
}

@keyframes ravAuditScan {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(390%);
    }
}

@keyframes ravAuditBarSweep {
    0% {
        transform: translateX(-110%);
    }

    48%, 100% {
        transform: translateX(110%);
    }
}

@keyframes ravLiveBreath {
    0%, 100% {
        box-shadow: 0 0 0 rgba(34, 197, 94, 0);
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 18px rgba(34, 197, 94, 0.32);
        filter: brightness(1.12);
    }
}


/* =========================================================
   ELDRA HELPER V2 - Current scroll/status/audit safety fixes
   ========================================================= */

html,
body,
.app-layout {
    height: 100%;
    overflow: hidden;
}

.main {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
}

.content {
    height: calc(100vh - 72px);
    min-height: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body:has(.dashboard-layout) .content {
    overflow-y: auto !important;
}

.content:has(.logs-page) {
    overflow: hidden !important;
}

.logs-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.logs-page > .stat-grid {
    flex: 0 0 auto;
}

.logs-table-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto !important;
}

.audit-scroll,
.table-card,
.content > .panel.spaced {
    max-width: 100%;
    overflow: auto !important;
}

.audit-scroll table,
.table-card table,
.content > .panel.spaced table {
    min-width: 760px;
}

.logs-table-panel thead th,
.audit-scroll thead th,
.table-card thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(27, 20, 38, 0.98);
    backdrop-filter: blur(10px);
}

.audit-progress {
    position: relative;
    overflow: hidden;
}

.audit-progress::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-110%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.23),
        transparent
    );
    animation: ravAuditBarSweepFixed 2.8s ease-in-out infinite;
}

.audit-boxes > div {
    transition:
        transform 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease,
        background 180ms ease;
}

.audit-boxes > div:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.34);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.12);
}

.dashboard-layout > .panel.large {
    position: relative;
    overflow: hidden;
}

.dashboard-layout > .panel.large::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 12% 18%, rgba(212, 175, 55, 0.12), transparent 28%),
        radial-gradient(circle at 90% 12%, rgba(212, 175, 55, 0.08), transparent 24%);
    opacity: 0.72;
    animation: ravAuditPanelGlowFixed 5.5s ease-in-out infinite;
}

.dashboard-layout > .panel.large > * {
    position: relative;
    z-index: 1;
}

.badge.green[data-bot-status] {
    animation: ravLiveBreathFixed 2.2s ease-in-out infinite;
}

@media (min-width: 1200px) and (max-width: 1920px) {
    .content {
        max-width: 1560px;
        margin-left: auto;
        margin-right: auto;
        padding-left: clamp(18px, 1.4vw, 28px);
        padding-right: clamp(18px, 1.4vw, 28px);
    }

    .dashboard-layout {
        grid-template-columns: minmax(420px, 1.2fr) minmax(360px, 1fr) minmax(300px, 0.75fr);
        gap: 14px;
    }

    .bottom-grid {
        grid-template-columns: minmax(420px, 1fr) minmax(420px, 1fr) minmax(240px, 0.5fr);
        gap: 14px;
    }
}

@media (max-width: 1100px) {
    html,
    body,
    .app-layout,
    .main,
    .content {
        height: auto !important;
        overflow: visible !important;
    }

    .content {
        max-width: none;
    }

    .logs-page {
        height: auto;
        overflow: visible;
    }

    .logs-table-panel {
        max-height: none !important;
        overflow: auto !important;
    }
}

@keyframes ravAuditBarSweepFixed {
    0% { transform: translateX(-110%); }
    48%, 100% { transform: translateX(110%); }
}

@keyframes ravAuditPanelGlowFixed {
    0%, 100% { opacity: 0.62; }
    50% { opacity: 1; }
}

@keyframes ravLiveBreathFixed {
    0%, 100% {
        box-shadow: 0 0 0 rgba(34, 197, 94, 0);
        filter: brightness(1);
    }

    50% {
        box-shadow: 0 0 18px rgba(34, 197, 94, 0.32);
        filter: brightness(1.12);
    }
}

/* =========================================================
   ELDRA HELPER V2 - final inner table scroll fix
   Cards stay fixed, only table/cache/log block scrolls
   ========================================================= */

html,
body,
.app-layout {
    height: 100%;
    overflow: hidden !important;
}

.main {
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

.content {
    height: calc(100vh - 72px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#live-page-content {
    height: 100%;
    min-height: 0;
}

#live-page-content:has(.audit-page),
#live-page-content:has(.logs-page),
#live-page-content:has(.list-page) {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.audit-page,
.logs-page,
.list-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden !important;
}

.audit-page > .stat-grid,
.logs-page > .stat-grid,
.list-page > .stat-grid,
.list-page > .panel.spaced:not(:last-child) {
    flex: 0 0 auto;
}

.audit-page > .panel.spaced,
.logs-table-panel,
.list-page > .panel.spaced:last-child {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow: hidden !important;

    display: flex;
    flex-direction: column;
}

.audit-page > .panel.spaced > .panel-header,
.logs-table-panel > .panel-header,
.list-page > .panel.spaced:last-child > .panel-header {
    flex: 0 0 auto;
}

.audit-scroll,
.table-scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;

    overflow: auto !important;
    overscroll-behavior: contain;
}

.audit-scroll table,
.table-scroll table {
    min-width: 760px;
    width: 100%;
    margin: 0;
}

.audit-scroll thead th,
.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 5;

    background: rgba(27, 20, 38, 0.98);
    backdrop-filter: blur(10px);
}

.logs-page .table-scroll table {
    min-width: 980px;
}

.list-page-tickets .table-scroll table {
    min-width: 1120px;
}

#live-page-content:has(.dashboard-layout) {
    overflow: auto !important;
}

@media (max-width: 1100px) {
    html,
    body,
    .app-layout,
    .main,
    .content,
    #live-page-content,
    .audit-page,
    .logs-page,
    .list-page {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .audit-page > .panel.spaced,
    .logs-table-panel,
    .list-page > .panel.spaced:last-child {
        overflow: auto !important;
    }

    .audit-scroll,
    .table-scroll {
        max-height: none !important;
        overflow: auto !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - dynamic list block heights
   Whitelist / Blacklist / Tickets panels only grow to content
   and table scroll appears only when content exceeds viewport.
   ========================================================= */

/* Keep the page container fixed, but do not force the records panel to fill all free space */
.list-page {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow: hidden !important;
}

/* Top cards/forms stay natural height */
.list-page > .stat-grid,
.list-page > .panel.spaced:not(:last-child) {
    flex: 0 0 auto !important;
}

/* Records panel becomes content-sized instead of huge empty block */
.list-page > .panel.spaced:last-child {
    flex: 0 1 auto !important;
    min-height: 0 !important;
    height: auto !important;

    display: flex;
    flex-direction: column;

    overflow: hidden !important;
}

/* Header/action area stays fixed inside records panel */
.list-page > .panel.spaced:last-child > .panel-header,
.list-page > .panel.spaced:last-child > .table-toolbar,
.list-page > .panel.spaced:last-child > .panel-actions {
    flex: 0 0 auto !important;
}

/* Table area is content-sized until it reaches viewport limit */
.list-page .table-scroll {
    flex: 0 1 auto !important;
    min-height: 0 !important;
    height: auto !important;

    overflow: auto !important;
    overscroll-behavior: contain;
}

/* Page-specific maximums: enough room for stats/forms above, without forcing empty height */
.list-page-whitelist .table-scroll,
.list-page-blacklist .table-scroll {
    max-height: clamp(220px, calc(100vh - 390px), 620px) !important;
}

.list-page-tickets .table-scroll {
    max-height: clamp(240px, calc(100vh - 360px), 660px) !important;
}

/* If there are only a few rows, table block stays small */
.list-page .table-scroll table {
    margin: 0;
}

/* Do not apply the old flex-fill behaviour to list pages */
#live-page-content:has(.list-page) {
    overflow: hidden !important;
}

/* Small screens can use natural page scrolling */
@media (max-width: 1100px) {
    .list-page,
    #live-page-content:has(.list-page) {
        height: auto !important;
        overflow: visible !important;
    }

    .list-page > .panel.spaced:last-child {
        max-height: none !important;
        overflow: auto !important;
    }

    .list-page .table-scroll {
        max-height: none !important;
        overflow: auto !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - card hover clipping + dashboard panel animation
   ========================================================= */

/* Fix: top/stat cards were sliding under the animated topbar line on hover */
.content {
    padding-top: 24px !important;
}

.topbar {
    z-index: 50;
}

.content > .stat-grid,
.stat-grid {
    position: relative;
    z-index: 1;
    padding-top: 4px;
}

/* Make hover lift safer: cards lift down visually via glow, not into topbar */
.stat-card:hover {
    transform: translateY(-1px) !important;
}

/* General dashboard panels get the same animated treatment as Guild Audit Status */
body:has(.dashboard-layout) .dashboard-layout > .panel,
body:has(.dashboard-layout) .bottom-grid > .panel,
body:has(.dashboard-layout) .stat-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-color: rgba(212, 175, 55, 0.18);
}

body:has(.dashboard-layout) .dashboard-layout > .panel::before,
body:has(.dashboard-layout) .bottom-grid > .panel::before,
body:has(.dashboard-layout) .stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;

    background:
        radial-gradient(circle at 12% 18%, rgba(212, 175, 55, 0.10), transparent 28%),
        radial-gradient(circle at 90% 12%, rgba(212, 175, 55, 0.075), transparent 24%),
        linear-gradient(120deg, transparent, rgba(212, 175, 55, 0.045), transparent);

    opacity: 0.70;
    animation: ravDashboardPanelGlow 6s ease-in-out infinite;
}

body:has(.dashboard-layout) .dashboard-layout > .panel::after,
body:has(.dashboard-layout) .bottom-grid > .panel::after,
body:has(.dashboard-layout) .stat-card::after {
    content: "";
    position: absolute;
    left: -35%;
    top: 0;
    height: 2px;
    width: 35%;
    pointer-events: none;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(235, 203, 103, 0.90),
            transparent
        );

    box-shadow: 0 0 16px rgba(212, 175, 55, 0.65);
    animation: ravDashboardPanelScan 4.2s linear infinite;
}

/* Different timing so all blocks don't scan at exactly the same moment */
body:has(.dashboard-layout) .dashboard-layout > .panel:nth-child(2)::after,
body:has(.dashboard-layout) .bottom-grid > .panel:nth-child(2)::after,
body:has(.dashboard-layout) .stat-card:nth-child(2)::after {
    animation-delay: 0.65s;
}

body:has(.dashboard-layout) .dashboard-layout > .panel:nth-child(3)::after,
body:has(.dashboard-layout) .bottom-grid > .panel:nth-child(3)::after,
body:has(.dashboard-layout) .stat-card:nth-child(3)::after {
    animation-delay: 1.25s;
}

body:has(.dashboard-layout) .stat-card:nth-child(4)::after {
    animation-delay: 1.85s;
}

body:has(.dashboard-layout) .stat-card:nth-child(5)::after {
    animation-delay: 2.35s;
}

/* Keep content above pseudo layers */
body:has(.dashboard-layout) .dashboard-layout > .panel > *,
body:has(.dashboard-layout) .bottom-grid > .panel > *,
body:has(.dashboard-layout) .stat-card > * {
    position: relative;
    z-index: 1;
}

/* Hover polish for all dashboard blocks */
body:has(.dashboard-layout) .dashboard-layout > .panel:hover,
body:has(.dashboard-layout) .bottom-grid > .panel:hover,
body:has(.dashboard-layout) .stat-card:hover {
    border-color: rgba(212, 175, 55, 0.36);
    box-shadow:
        0 20px 55px rgba(0, 0, 0, 0.32),
        0 0 30px rgba(212, 175, 55, 0.13);
}

/* Smaller scan on compact cards */
body:has(.dashboard-layout) .stat-card::after {
    height: 1px;
    animation-duration: 4.8s;
}

/* Prevent duplicated/overbright animation on Guild Audit if previous patch already targets it */
body:has(.dashboard-layout) .dashboard-layout > .panel.large::before {
    opacity: 0.68;
}

body:has(.dashboard-layout) .dashboard-layout > .panel.large::after {
    opacity: 0.92;
}

/* Topbar animated line stays above content, but doesn't visually eat cards */
.topbar::after {
    z-index: 3;
}

@keyframes ravDashboardPanelGlow {
    0%, 100% {
        opacity: 0.58;
        transform: scale(1);
    }

    50% {
        opacity: 0.95;
        transform: scale(1.012);
    }
}

@keyframes ravDashboardPanelScan {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(390%);
    }
}

@media (max-width: 1100px) {
    .content {
        padding-top: 14px !important;
    }

    body:has(.dashboard-layout) .dashboard-layout > .panel::after,
    body:has(.dashboard-layout) .bottom-grid > .panel::after,
    body:has(.dashboard-layout) .stat-card::after {
        animation-duration: 6s;
    }
}

/* =========================================================
   ELDRA HELPER V2 - mobile view support
   ========================================================= */

/* Better tap targets */
button,
.button,
.icon-button,
.nav a,
.admin-user,
input,
select,
textarea {
    touch-action: manipulation;
}

/* Tablet and phone layout */
@media (max-width: 900px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        min-height: 100%;
        overflow-x: hidden !important;
        overflow-y: auto !important;
    }

    .app-layout {
        min-height: 100vh;
        height: auto !important;
        overflow: visible !important;
        display: block !important;
    }

    .sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;

        width: min(82vw, 310px) !important;
        height: 100vh !important;

        transform: translateX(-105%);
        transition:
            transform 220ms ease,
            box-shadow 220ms ease;

        z-index: 1000;
        overflow-y: auto !important;
        overflow-x: hidden !important;

        box-shadow: none;
    }

    body.mobile-sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow:
            24px 0 60px rgba(0, 0, 0, 0.52),
            0 0 34px rgba(212, 175, 55, 0.13);
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 999;

        background: rgba(0, 0, 0, 0.52);
        backdrop-filter: blur(4px);

        opacity: 0;
        pointer-events: none;

        transition: opacity 200ms ease;
    }

    body.mobile-sidebar-open .mobile-sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* On mobile sidebar should show text again */
    .sidebar .brand h2,
    .sidebar .brand span,
    .sidebar .nav span,
    .sidebar .nav-section,
    .sidebar .admin-user span {
        display: initial !important;
        opacity: 1 !important;
        max-width: none !important;
        transform: none !important;
    }

    .sidebar .brand {
        justify-content: flex-start !important;
    }

    .sidebar .nav a {
        justify-content: flex-start !important;
    }

    .sidebar .nav a i {
        width: 22px;
        margin-right: 10px;
        text-align: center;
    }

    .main,
    body.sidebar-collapsed .main {
        margin-left: 0 !important;
        width: 100% !important;
        min-height: 100vh !important;
        height: auto !important;
        overflow: visible !important;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 800;

        height: auto;
        min-height: 60px;
        padding: 10px 12px;

        gap: 10px;
    }

    .topbar-left {
        min-width: 0;
        gap: 10px;
    }

    .topbar h1 {
        font-size: 16px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 44vw;
    }

    .topbar .icon-button {
        display: inline-flex !important;
        flex: 0 0 42px;
        width: 42px;
        height: 42px;
        align-items: center;
        justify-content: center;
    }

    .topbar-right {
        gap: 8px;
        min-width: 0;
    }

    .top-status {
        padding: 7px 9px;
        font-size: 12px;
        white-space: nowrap;
    }

    .admin-user {
        padding: 6px;
    }

    .admin-user span {
        display: none;
    }

    .admin-user img {
        width: 30px;
        height: 30px;
    }

    .content,
    body:has(.dashboard-layout) .content {
        height: auto !important;
        min-height: calc(100vh - 60px);
        max-width: none !important;

        overflow: visible !important;

        padding: 12px !important;
        margin: 0 !important;
    }

    #live-page-content,
    #live-page-content:has(.dashboard-layout),
    #live-page-content:has(.audit-page),
    #live-page-content:has(.logs-page),
    #live-page-content:has(.list-page) {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    .stat-grid,
    .dashboard-layout,
    .bottom-grid,
    .audit-top,
    .audit-boxes {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        height: auto !important;
    }

    .panel,
    .table-card,
    .stat-card {
        padding: 14px !important;
        border-radius: 14px;
    }

    .panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .panel-header h2 {
        font-size: 16px;
    }

    .panel-header a,
    .panel-header .button,
    .panel-actions .button,
    .button.full {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .panel-actions {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    /* Tables scroll horizontally inside their block on mobile */
    .table-scroll,
    .audit-scroll,
    .logs-table-panel,
    .table-card,
    .content > .panel.spaced {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    .table-scroll table,
    .audit-scroll table,
    .logs-table-panel table,
    .table-card table {
        min-width: 760px;
    }

    .logs-page .table-scroll table,
    .logs-table-panel table {
        min-width: 980px;
    }

    .list-page-tickets .table-scroll table {
        min-width: 1120px;
    }

    /* Forms become single-column and finger-friendly */
    .form-panel,
    .reaction-role-form,
    .reaction-role-inline-form,
    form {
        max-width: 100%;
    }

    .form-panel,
    .reaction-role-form,
    .reaction-role-inline-form {
        grid-template-columns: 1fr !important;
    }

    input,
    select,
    textarea {
        width: 100%;
        min-height: 42px;
        font-size: 16px; /* prevents iOS zoom */
    }

    textarea {
        min-height: 90px;
    }

    .quick-actions,
    .panel.quick-actions {
        width: 100%;
    }

    .quick-actions form,
    .quick-actions .quick {
        width: 100%;
    }

    /* Toasts should not hide behind browser controls */
    #toast-container {
        left: 12px !important;
        right: 12px !important;
        bottom: 12px !important;
        width: auto !important;
    }

    /* Reduce heavy glow on mobile GPU */
    body:has(.dashboard-layout) .dashboard-layout > .panel::after,
    body:has(.dashboard-layout) .bottom-grid > .panel::after,
    body:has(.dashboard-layout) .stat-card::after {
        animation-duration: 7s !important;
    }
}

/* Very small phones */
@media (max-width: 420px) {
    .topbar h1 {
        max-width: 38vw;
        font-size: 15px;
    }

    .top-status {
        max-width: 92px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .content {
        padding: 10px !important;
    }

    .panel,
    .table-card,
    .stat-card {
        padding: 12px !important;
    }

    .sidebar {
        width: min(88vw, 300px) !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - ticket filter active state + audit freshness hint
   ========================================================= */

.ticket-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ticket-filter-buttons .filter-button {
    cursor: pointer;
    user-select: none;
}

.ticket-filter-buttons .filter-button.active {
    border-color: rgba(212, 175, 55, 0.52);
    box-shadow:
        0 0 18px rgba(212, 175, 55, 0.16),
        inset 0 0 0 1px rgba(212, 175, 55, 0.08);
    filter: brightness(1.13);
}

[data-live-audit].live-updated {
    animation: ravAuditValueFresh 460ms ease-out;
}

@keyframes ravAuditValueFresh {
    0% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }

    45% {
        transform: scale(1.04);
        text-shadow: 0 0 16px rgba(212, 175, 55, 0.62);
    }

    100% {
        transform: scale(1);
        text-shadow: 0 0 0 rgba(212, 175, 55, 0);
    }
}


/* =========================================================
   ELDRA HELPER V2 - final dashboard top cards + actions fix
   ========================================================= */

/* Dashboard should use available width instead of sitting as a tiny centered island */
body:has(.dashboard-layout) .content {
    max-width: none !important;
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;

    padding-top: 22px !important;
    padding-left: clamp(18px, 1.2vw, 28px) !important;
    padding-right: clamp(18px, 1.2vw, 28px) !important;

    overflow-x: hidden !important;
}

/* Top cards: always fill the dashboard row cleanly */
body:has(.dashboard-layout) .stat-grid {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(5, minmax(190px, 1fr)) !important;
    gap: 14px !important;
    align-items: stretch !important;

    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 14px !important;

    padding-top: 0 !important;
}

body:has(.dashboard-layout) .stat-card {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 78px !important;
    padding: 12px 16px !important;
}

body:has(.dashboard-layout) .stat-card > div:last-child {
    min-width: 0;
}

body:has(.dashboard-layout) .stat-card p,
body:has(.dashboard-layout) .stat-card span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 1920px and normal desktop */
@media (max-width: 1600px) {
    body:has(.dashboard-layout) .stat-grid {
        grid-template-columns: repeat(5, minmax(150px, 1fr)) !important;
    }

    body:has(.dashboard-layout) .stat-card {
        padding: 10px 12px !important;
        gap: 10px !important;
    }

    body:has(.dashboard-layout) .stat-card p {
        font-size: 11px !important;
    }
}

/* Below desktop width, allow wrapping instead of squeezing */
@media (max-width: 1250px) {
    body:has(.dashboard-layout) .stat-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
    }
}

/* Phones */
@media (max-width: 700px) {
    body:has(.dashboard-layout) .stat-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Bot action buttons: visual feedback */
.quick-actions form {
    width: 100%;
}

.quick-actions .quick {
    position: relative;
    overflow: hidden;
}

.quick-actions .quick:active {
    transform: scale(0.985);
}

.quick-actions .quick.is-submitting {
    opacity: 0.78;
    pointer-events: none;
}

.quick-actions .quick.is-submitting::after {
    content: "";
    position: absolute;
    inset: 0;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255, 255, 255, 0.16),
            transparent
        );

    transform: translateX(-100%);
    animation: ravActionSubmitting 900ms linear infinite;
}

@keyframes ravActionSubmitting {
    to {
        transform: translateX(100%);
    }
}

/* =========================================================
   ELDRA HELPER V2 - final stat cards + responsive dashboard fix
   Fixes compact top cards and low-resolution layout.
   ========================================================= */

/* Do not force Dashboard into a single-screen compressed layout */
body:has(.dashboard-layout) .dashboard-layout,
body:has(.dashboard-layout) .bottom-grid {
    height: auto !important;
    min-height: 0 !important;
}

/* Do not squeeze content on normal/lower desktop resolutions */
@media (max-width: 1920px) {
    .content {
        max-width: none !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* Top stat cards should look like proper cards, not compact mini widgets */
.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)) !important;
    gap: 18px !important;
    align-items: stretch;
}

.stat-card {
    min-height: 96px !important;
    padding: 20px 22px !important;

    display: flex !important;
    align-items: center !important;
    gap: 18px !important;

    border-radius: var(--radius) !important;
}

.stat-icon {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;

    border-radius: 14px !important;
    font-size: 26px !important;
}

.stat-card span {
    display: block !important;
    color: var(--muted) !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
}

.stat-card strong {
    display: block !important;
    margin-top: 6px !important;

    font-size: 28px !important;
    line-height: 1 !important;
    font-weight: 800 !important;
}

.stat-card p {
    display: block !important;
    margin: 8px 0 0 !important;

    color: var(--muted) !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
}

/* Hover should glow, not move under the topbar animated line */
.stat-card:hover {
    transform: none !important;
    border-color: rgba(212, 175, 55, 0.42) !important;
    box-shadow:
        0 18px 35px rgba(0, 0, 0, 0.22),
        0 0 22px rgba(212, 175, 55, 0.11) !important;
}

/* Dashboard panels remain responsive instead of being forced into tiny blocks */
.dashboard-layout {
    grid-template-columns:
        minmax(420px, 1.25fr)
        minmax(360px, 1fr)
        minmax(300px, 0.85fr) !important;

    gap: 18px !important;
    margin-bottom: 18px !important;
}

.bottom-grid {
    grid-template-columns:
        minmax(360px, 1fr)
        minmax(360px, 1fr)
        minmax(220px, 0.55fr) !important;

    gap: 18px !important;
}

/* Medium desktops / laptops */
@media (max-width: 1500px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
        gap: 14px !important;
    }

    .stat-card {
        min-height: 90px !important;
        padding: 18px !important;
        gap: 14px !important;
    }

    .stat-icon {
        width: 50px !important;
        height: 50px !important;
        min-width: 50px !important;
        font-size: 23px !important;
    }

    .stat-card strong {
        font-size: 25px !important;
    }

    .dashboard-layout,
    .bottom-grid {
        grid-template-columns: 1fr !important;
        height: auto !important;
    }

    .dashboard-layout > .panel,
    .bottom-grid > .panel {
        min-height: 0 !important;
    }
}

/* Tablets / phones */
@media (max-width: 900px) {
    .stat-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .stat-card {
        min-height: 86px !important;
        padding: 16px !important;
    }

    .stat-icon {
        width: 48px !important;
        height: 48px !important;
        min-width: 48px !important;
        font-size: 22px !important;
    }

    .stat-card strong {
        font-size: 24px !important;
    }

    .stat-card p {
        display: block !important;
        font-size: 12px !important;
    }

    .dashboard-layout,
    .bottom-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

/* Very small screens */
@media (max-width: 420px) {
    .stat-card {
        padding: 14px !important;
        gap: 12px !important;
    }

    .stat-icon {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: 20px !important;
    }

    .stat-card strong {
        font-size: 22px !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - counters, audit search, mobile menu cleanup
   ========================================================= */

/* Hide old legacy toast if a stale div is still cached somewhere */
#toast.toast {
    display: none !important;
}

/* Card counters: force consistent readable style after compact overrides */
.stat-grid .stat-card {
    min-height: 98px !important;
    padding: 20px 22px !important;
    gap: 18px !important;
}

.stat-grid .stat-card .stat-icon {
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    font-size: 26px !important;
}

.stat-grid .stat-card span {
    font-size: 14px !important;
    line-height: 1.2 !important;
    color: var(--muted) !important;
}

.stat-grid .stat-card strong {
    font-size: 30px !important;
    line-height: 1 !important;
    font-weight: 800 !important;
    letter-spacing: -0.02em;
    color: #fff !important;
}

.stat-grid .stat-card p {
    display: block !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
    color: var(--muted) !important;
}

/* Audit search toolbar */
.audit-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;

    margin-bottom: 12px;
}

.audit-toolbar .search-input {
    flex: 1 1 auto;
    min-width: 220px;
}

.audit-toolbar .table-count {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.audit-scroll th,
.table-scroll th,
.table-card th,
.logs-table-panel th {
    cursor: pointer;
    user-select: none;
}

.audit-scroll th:hover,
.table-scroll th:hover,
.table-card th:hover,
.logs-table-panel th:hover {
    color: white;
}

/* Mobile menu: remove half-open state caused by desktop collapsed rules */
@media (max-width: 900px) {
    body.sidebar-collapsed .sidebar,
    .app-layout.sidebar-collapsed .sidebar {
        width: min(82vw, 310px) !important;
        transform: translateX(-105%) !important;
    }

    body.mobile-sidebar-open.sidebar-collapsed .sidebar,
    body.mobile-sidebar-open .app-layout.sidebar-collapsed .sidebar,
    body.mobile-sidebar-open .sidebar {
        width: min(82vw, 310px) !important;
        transform: translateX(0) !important;
    }

    body.sidebar-collapsed .main,
    .app-layout.sidebar-collapsed .main,
    body.mobile-sidebar-open .main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body.sidebar-collapsed .sidebar .brand h2,
    body.sidebar-collapsed .sidebar .brand span,
    body.sidebar-collapsed .sidebar .nav span,
    body.sidebar-collapsed .sidebar .nav-section,
    body.sidebar-collapsed .sidebar .admin-user span,
    .app-layout.sidebar-collapsed .sidebar .brand h2,
    .app-layout.sidebar-collapsed .sidebar .brand span,
    .app-layout.sidebar-collapsed .sidebar .nav span,
    .app-layout.sidebar-collapsed .sidebar .nav-section,
    .app-layout.sidebar-collapsed .sidebar .admin-user span {
        display: initial !important;
        opacity: 1 !important;
        max-width: none !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    .stat-grid .stat-card {
        min-height: 90px !important;
        padding: 16px !important;
    }

    .stat-grid .stat-card strong {
        font-size: 26px !important;
    }

    .audit-toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .audit-toolbar .search-input {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 420px) {
    .stat-grid .stat-card strong {
        font-size: 24px !important;
    }

    body.sidebar-collapsed .sidebar,
    .app-layout.sidebar-collapsed .sidebar,
    body.mobile-sidebar-open.sidebar-collapsed .sidebar,
    body.mobile-sidebar-open .app-layout.sidebar-collapsed .sidebar,
    body.mobile-sidebar-open .sidebar {
        width: min(88vw, 300px) !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - desktop sidebar animation + audit sort/search v3
   Does not touch mobile sidebar behaviour.
   ========================================================= */

/* Desktop-only sidebar collapse animation */
@media (min-width: 901px) {
    .app-layout .sidebar {
        width: 260px !important;
        transform: translate3d(0, 0, 0) !important;

        transition:
            width 230ms ease,
            padding 230ms ease,
            box-shadow 230ms ease !important;

        will-change: width;
    }

    .app-layout .main {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;

        transition:
            margin-left 230ms ease,
            width 230ms ease !important;
    }

    .app-layout.sidebar-collapsed .sidebar {
        width: 78px !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .app-layout.sidebar-collapsed .main {
        margin-left: 78px !important;
        width: calc(100% - 78px) !important;
    }

    .app-layout.sidebar-collapsed .brand {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .brand h2,
    .app-layout.sidebar-collapsed .brand span,
    .app-layout.sidebar-collapsed .nav span,
    .app-layout.sidebar-collapsed .nav-section {
        opacity: 0 !important;
        max-width: 0 !important;
        transform: translateX(-8px) !important;
        overflow: hidden !important;
        pointer-events: none !important;

        transition:
            opacity 150ms ease,
            max-width 220ms ease,
            transform 180ms ease !important;
    }

    .app-layout .brand h2,
    .app-layout .brand span,
    .app-layout .nav span,
    .app-layout .nav-section {
        opacity: 1;
        max-width: 220px;
        transform: translateX(0);

        transition:
            opacity 170ms ease,
            max-width 230ms ease,
            transform 190ms ease !important;
    }

    .app-layout.sidebar-collapsed .nav a {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .nav a i {
        margin-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .brand-avatar {
        margin-right: 0 !important;
    }
}

/* Audit sort/search styling */
th.sort-asc,
th.sort-desc {
    color: #fff !important;
}

.audit-toolbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.audit-search-input {
    flex: 1 1 auto;
    min-width: 220px;
}

.audit-search-count {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.audit-scroll tr[hidden],
.table-scroll tr[hidden],
.table-card tr[hidden] {
    display: none !important;
}

.audit-scroll th,
.table-scroll th,
.table-card th,
.logs-table-panel th {
    cursor: pointer;
    user-select: none;
}

.audit-scroll th:hover,
.table-scroll th:hover,
.table-card th:hover,
.logs-table-panel th:hover {
    color: white;
}

/* =========================================================
   ELDRA HELPER V2 - clean desktop sidebar animation
   Fixes jitter caused by mixed body/app-layout collapsed states.
   Does not change mobile menu.
   ========================================================= */

@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar,
    body.sidebar-collapsed .main,
    body.sidebar-collapsed .brand h2,
    body.sidebar-collapsed .brand span,
    body.sidebar-collapsed .nav span,
    body.sidebar-collapsed .nav-section {
        all: revert-layer;
    }

    .app-layout {
        --rav-desktop-sidebar-open: 260px;
        --rav-desktop-sidebar-closed: 76px;
    }

    .app-layout .sidebar {
        width: var(--rav-desktop-sidebar-open) !important;
        transform: none !important;

        transition:
            width 240ms cubic-bezier(.2, .8, .2, 1),
            padding 240ms cubic-bezier(.2, .8, .2, 1),
            box-shadow 240ms ease !important;

        will-change: width;
        overflow-x: hidden !important;
    }

    .app-layout .main {
        margin-left: var(--rav-desktop-sidebar-open) !important;
        width: calc(100% - var(--rav-desktop-sidebar-open)) !important;

        transition:
            margin-left 240ms cubic-bezier(.2, .8, .2, 1),
            width 240ms cubic-bezier(.2, .8, .2, 1) !important;
    }

    .app-layout .brand h2,
    .app-layout .brand span,
    .app-layout .nav span,
    .app-layout .nav-section {
        display: block !important;
        opacity: 1 !important;
        max-width: 190px !important;
        transform: translateX(0) !important;
        overflow: hidden !important;
        white-space: nowrap !important;

        transition:
            opacity 140ms ease 80ms,
            max-width 220ms cubic-bezier(.2, .8, .2, 1),
            transform 180ms ease 60ms !important;
    }

    .app-layout .nav a {
        transition:
            background 160ms ease,
            border-color 160ms ease,
            color 160ms ease,
            padding 240ms cubic-bezier(.2, .8, .2, 1),
            justify-content 240ms ease !important;
    }

    .app-layout.sidebar-collapsed .sidebar {
        width: var(--rav-desktop-sidebar-closed) !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .app-layout.sidebar-collapsed .main {
        margin-left: var(--rav-desktop-sidebar-closed) !important;
        width: calc(100% - var(--rav-desktop-sidebar-closed)) !important;
    }

    .app-layout.sidebar-collapsed .brand {
        justify-content: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .brand h2,
    .app-layout.sidebar-collapsed .brand span,
    .app-layout.sidebar-collapsed .nav span,
    .app-layout.sidebar-collapsed .nav-section {
        display: block !important;
        opacity: 0 !important;
        max-width: 0 !important;
        transform: translateX(-8px) !important;
        pointer-events: none !important;

        transition:
            opacity 90ms ease,
            max-width 200ms cubic-bezier(.2, .8, .2, 1),
            transform 140ms ease !important;
    }

    .app-layout.sidebar-collapsed .nav a {
        justify-content: center !important;
        gap: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .nav a i {
        margin: 0 !important;
    }

    .app-layout.sidebar-collapsed .brand-avatar {
        margin: 0 !important;
    }

    .app-layout.sidebar-collapsed .topbar .icon-button i {
        transform: rotate(180deg);
        transition: transform 200ms ease;
    }
}

/* =========================================================
   ELDRA HELPER V2 - desktop responsive layout 1024x768 to 3440 wide
   Final desktop override. Does not affect mobile under 900px.
   ========================================================= */

@media (min-width: 901px) {
    html,
    body,
    .app-layout {
        height: 100%;
        overflow: hidden !important;
    }

    .main {
        height: 100vh !important;
        min-height: 0 !important;
        overflow: hidden !important;
    }

    .topbar {
        height: clamp(58px, 4.2vw, 70px) !important;
        min-height: 58px !important;
        padding-left: clamp(16px, 1.3vw, 30px) !important;
        padding-right: clamp(16px, 1.3vw, 30px) !important;
    }

    .content {
        height: calc(100vh - clamp(58px, 4.2vw, 70px)) !important;
        min-height: 0 !important;

        width: 100% !important;
        max-width: none !important;

        margin: 0 !important;
        padding:
            clamp(14px, 1.15vw, 28px)
            clamp(14px, 1.25vw, 34px)
            clamp(18px, 1.4vw, 40px) !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    #live-page-content {
        width: 100%;
        max-width: none !important;
        min-height: 0;
    }

    /* Sidebar sizing by desktop width */
    .app-layout {
        --rav-desktop-sidebar-open: 250px;
        --rav-desktop-sidebar-closed: 76px;
    }

    .app-layout .sidebar {
        width: var(--rav-desktop-sidebar-open) !important;
    }

    .app-layout .main {
        margin-left: var(--rav-desktop-sidebar-open) !important;
        width: calc(100% - var(--rav-desktop-sidebar-open)) !important;
    }

    .app-layout.sidebar-collapsed .sidebar {
        width: var(--rav-desktop-sidebar-closed) !important;
    }

    .app-layout.sidebar-collapsed .main {
        margin-left: var(--rav-desktop-sidebar-closed) !important;
        width: calc(100% - var(--rav-desktop-sidebar-closed)) !important;
    }

    /* Cards keep the same visual style at all desktop widths */
    .stat-grid {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(clamp(210px, 13.5vw, 290px), 1fr)) !important;
        gap: clamp(12px, 0.95vw, 20px) !important;
        margin-bottom: clamp(14px, 1vw, 22px) !important;
        align-items: stretch !important;
    }

    .stat-card {
        min-height: clamp(88px, 6vw, 112px) !important;
        padding: clamp(16px, 1.05vw, 22px) !important;
        gap: clamp(12px, 0.85vw, 18px) !important;

        display: flex !important;
        align-items: center !important;
    }

    .stat-icon {
        width: clamp(46px, 3.2vw, 58px) !important;
        height: clamp(46px, 3.2vw, 58px) !important;
        min-width: clamp(46px, 3.2vw, 58px) !important;
        font-size: clamp(21px, 1.55vw, 28px) !important;
    }

    .stat-card span {
        font-size: clamp(12px, 0.72vw, 14px) !important;
        line-height: 1.2 !important;
    }

    .stat-card strong {
        font-size: clamp(24px, 1.65vw, 32px) !important;
        line-height: 1 !important;
        font-weight: 800 !important;
        letter-spacing: -0.02em;
    }

    .stat-card p {
        display: block !important;
        font-size: clamp(11px, 0.68vw, 13px) !important;
        line-height: 1.25 !important;
    }

    .stat-card:hover {
        transform: none !important;
    }

    /* Dashboard default: desktop grids adapt instead of fixed heights */
    .dashboard-layout,
    .bottom-grid {
        height: auto !important;
        min-height: 0 !important;
        gap: clamp(12px, 0.95vw, 20px) !important;
    }

    .dashboard-layout {
        display: grid !important;
        grid-template-columns:
            minmax(420px, 1.28fr)
            minmax(360px, 1fr)
            minmax(280px, 0.72fr) !important;
        margin-bottom: clamp(12px, 0.95vw, 20px) !important;
    }

    .bottom-grid {
        display: grid !important;
        grid-template-columns:
            minmax(360px, 1fr)
            minmax(360px, 1fr)
            minmax(220px, 0.46fr) !important;
    }

    .panel {
        padding: clamp(14px, 0.95vw, 20px) !important;
    }

    .panel-header {
        margin-bottom: clamp(12px, 0.95vw, 18px) !important;
    }

    .panel-header h2 {
        font-size: clamp(15px, 0.92vw, 18px) !important;
    }

    .audit-boxes {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: clamp(8px, 0.65vw, 12px) !important;
    }

    .audit-boxes div {
        padding: clamp(10px, 0.82vw, 16px) !important;
    }

    .audit-boxes strong {
        font-size: clamp(18px, 1.18vw, 24px) !important;
    }

    .button,
    .quick,
    .action-link,
    .filter-button {
        font-size: clamp(12px, 0.72vw, 14px) !important;
    }

    .ticket-row,
    .system-row {
        gap: clamp(8px, 0.65vw, 12px) !important;
    }

    /* Table pages: cards fixed, table blocks scroll inside */
    #live-page-content:has(.audit-page),
    #live-page-content:has(.logs-page),
    #live-page-content:has(.list-page) {
        height: 100% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    .audit-page,
    .logs-page,
    .list-page {
        height: 100% !important;
        min-height: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        gap: clamp(12px, 0.95vw, 18px) !important;
        overflow: hidden !important;
    }

    .audit-page > .stat-grid,
    .logs-page > .stat-grid,
    .list-page > .stat-grid,
    .list-page > .panel.spaced:not(:last-child) {
        flex: 0 0 auto !important;
    }

    .audit-page > .panel.spaced,
    .logs-table-panel,
    .list-page > .panel.spaced:last-child {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .audit-scroll,
    .table-scroll {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: auto !important;
        overscroll-behavior: contain;
    }

    .audit-scroll table,
    .table-scroll table {
        width: 100%;
        min-width: 760px;
    }

    .logs-page .table-scroll table,
    .logs-table-panel table {
        min-width: 980px;
    }

    .list-page-tickets .table-scroll table {
        min-width: 1120px;
    }
}

/* 1024x768 and small desktop/laptop */
@media (min-width: 901px) and (max-width: 1199px) {
    .app-layout {
        --rav-desktop-sidebar-open: 220px;
        --rav-desktop-sidebar-closed: 70px;
    }

    .sidebar {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .brand {
        gap: 10px !important;
        margin-bottom: 20px !important;
    }

    .brand h2 {
        font-size: 16px !important;
    }

    .nav a {
        padding: 10px 11px !important;
        gap: 10px !important;
    }

    .nav-section {
        margin-top: 12px !important;
    }

    .dashboard-layout,
    .bottom-grid {
        grid-template-columns: 1fr !important;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

/* 1200-1599: common laptop / 1080p with browser sidebars */
@media (min-width: 1200px) and (max-width: 1599px) {
    .app-layout {
        --rav-desktop-sidebar-open: 240px;
        --rav-desktop-sidebar-closed: 74px;
    }

    .dashboard-layout {
        grid-template-columns: minmax(420px, 1.15fr) minmax(340px, 1fr) !important;
    }

    .dashboard-layout > .panel:nth-child(3) {
        grid-column: 1 / -1;
    }

    .bottom-grid {
        grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) !important;
    }

    .bottom-grid > .panel:nth-child(3) {
        grid-column: 1 / -1;
    }
}

/* 1600-2199: normal large desktop */
@media (min-width: 1600px) and (max-width: 2199px) {
    .app-layout {
        --rav-desktop-sidebar-open: 250px;
        --rav-desktop-sidebar-closed: 76px;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(235px, 1fr)) !important;
    }
}

/* 2200-3440+: ultrawide, use the width instead of tiny centered layout */
@media (min-width: 2200px) {
    .app-layout {
        --rav-desktop-sidebar-open: 260px;
        --rav-desktop-sidebar-closed: 78px;
    }

    .content {
        padding-left: clamp(26px, 1.3vw, 46px) !important;
        padding-right: clamp(26px, 1.3vw, 46px) !important;
    }

    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)) !important;
    }

    .dashboard-layout {
        grid-template-columns:
            minmax(620px, 1.35fr)
            minmax(470px, 1fr)
            minmax(360px, 0.72fr) !important;
    }

    .bottom-grid {
        grid-template-columns:
            minmax(520px, 1fr)
            minmax(520px, 1fr)
            minmax(300px, 0.42fr) !important;
    }
}

/* =========================================================
   ELDRA HELPER V2 - final sidebar collapsed text fix
   Prevents cropped letters after refresh on desktop.
   ========================================================= */

@media (min-width: 901px) {
    body.sidebar-collapsed .sidebar {
        width: var(--rav-desktop-sidebar-open, 260px) !important;
    }

    body.sidebar-collapsed .main {
        margin-left: var(--rav-desktop-sidebar-open, 260px) !important;
        width: calc(100% - var(--rav-desktop-sidebar-open, 260px)) !important;
    }

    .app-layout.sidebar-collapsed .brand > div:not(.brand-avatar),
    .app-layout.sidebar-collapsed .nav a span,
    .app-layout.sidebar-collapsed .nav-section {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        pointer-events: none !important;
    }

    .app-layout.sidebar-collapsed .brand {
        justify-content: center !important;
        gap: 0 !important;
    }

    .app-layout.sidebar-collapsed .nav {
        align-items: center !important;
    }

    .app-layout.sidebar-collapsed .nav a {
        width: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;

        justify-content: center !important;
        gap: 0 !important;

        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .app-layout.sidebar-collapsed .nav a i {
        width: auto !important;
        min-width: 18px !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .app-layout.sidebar-collapsed .brand-avatar {
        margin: 0 !important;
    }

    .app-layout:not(.sidebar-collapsed) .brand > div:not(.brand-avatar),
    .app-layout:not(.sidebar-collapsed) .nav a span,
    .app-layout:not(.sidebar-collapsed) .nav-section {
        visibility: visible !important;
        opacity: 1 !important;
    }
}



/* Roster page */
.roster-toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 16px;
}

.roster-panel-header {
    gap: 16px;
    align-items: flex-start;
}

.roster-panel-header form,
.roster-dashboard-panel form {
    margin: 0;
}

.roster-scroll {
    min-height: 0;
}

.muted-text {
    color: var(--muted);
    margin: 8px 0 0;
}

.roster-page .filter-button.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.10));
    border-color: rgba(212, 175, 55, 0.55);
    color: #fff;
}

/* AQW roster login */
.roster-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.roster-login-panel {
    max-width: 760px;
}

.roster-login-form {
    display: grid;
    gap: 16px;
}

.roster-login-form label {
    display: grid;
    gap: 8px;
}

.roster-login-form input[type="text"],
.roster-login-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
    outline: none;
}

.checkbox-row {
    display: flex !important;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 10px !important;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
}

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

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.alert.error {
    background: rgba(237, 66, 69, 0.12);
    border-color: rgba(237, 66, 69, 0.35);
}

.alert.success {
    background: rgba(87, 242, 135, 0.12);
    border-color: rgba(87, 242, 135, 0.35);
}

.hint-box {
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted, #b8b8b8);
}

.hint-box code {
    color: #ffd56b;
}


/* =========================================================
   RAV UI Polish - safe card animations
   - Adds the same dashboard-style hover to cards across pages.
   - Does not change table-scroll / audit-scroll sizing or overflow.
   ========================================================= */

.stat-card,
.panel,
.table-card {
    position: relative;
    overflow: hidden;
    isolation: isolate;

    transition:
        transform .18s ease,
        border-color .18s ease,
        box-shadow .18s ease,
        background .18s ease;
}

.stat-card::before,
.panel::before,
.table-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;

    background:
        radial-gradient(circle at 18% 0%,
            rgba(212, 175, 55, .16),
            transparent 34%),
        linear-gradient(135deg,
            rgba(255, 255, 255, .035),
            transparent 42%);

    opacity: 0;
    transition: opacity .18s ease;
}

.stat-card:hover,
.panel:hover,
.table-card:hover {
    border-color: rgba(212, 175, 55, .42);
    box-shadow:
        0 18px 38px rgba(0, 0, 0, .24),
        0 0 22px rgba(212, 175, 55, .10);
}

.stat-card:hover::before,
.panel:hover::before,
.table-card:hover::before {
    opacity: 1;
}

/* Use movement only for compact cards.
   Scroll-heavy records panels keep their scroll position stable. */
.stat-card:hover,
.panel:not(.logs-table-panel):not(:has(.table-scroll)):not(:has(.audit-scroll)):hover,
.table-card:not(:has(.table-scroll)):not(:has(.audit-scroll)):hover {
    transform: translateY(-2px);
}

/* Keep internal scroll panels stable: glow yes, movement no. */
.panel:has(.table-scroll):hover,
.panel:has(.audit-scroll):hover,
.logs-table-panel:hover {
    transform: none;
}

/* Respect accessibility / low-motion systems. */
@media (prefers-reduced-motion: reduce) {
    .stat-card,
    .panel,
    .table-card,
    .stat-card::before,
    .panel::before,
    .table-card::before {
        transition: none !important;
    }

    .stat-card:hover,
    .panel:hover,
    .table-card:hover {
        transform: none !important;
    }
}


/* =========================================================
   Dashboard compact AQW Roster Status card
   ========================================================= */

.roster-dashboard-compact {
    padding: 14px 16px;
}

.roster-dashboard-compact .panel-header {
    margin-bottom: 12px;
    gap: 12px;
}

.roster-dashboard-compact .panel-header h2 {
    font-size: 17px;
}

.roster-status-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.roster-status-mini {
    min-width: 0;
    padding: 11px 12px;

    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 12px;

    background: rgba(255, 255, 255, .035);
}

.roster-status-mini span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}

.roster-status-mini strong {
    display: block;
    margin-top: 6px;

    color: var(--text);
    font-size: 16px;
    line-height: 1.15;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-dashboard-compact .panel-actions {
    margin-top: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.roster-dashboard-compact .button {
    min-height: 40px;
    padding: 10px 12px;
}

@media (max-width: 900px) {
    .roster-status-mini-grid {
        grid-template-columns: 1fr;
    }

    .roster-dashboard-compact .panel-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 950px) {
    .roster-dashboard-compact {
        padding: 11px;
    }

    .roster-status-mini {
        padding: 8px 10px;
    }

    .roster-status-mini strong {
        font-size: 14px;
    }

    .roster-dashboard-compact .button {
        min-height: 34px;
        padding: 8px 10px;
    }
}

/* =========================================================
   RAV UI Final polish - responsive animation + compact dashboard
   Scope: visual only. Does not resize audit/logs/table scroll containers.
   ========================================================= */

:root {
    --rav-card-anim-border: rgba(212, 175, 55, .42);
    --rav-card-anim-glow: rgba(212, 175, 55, .16);
}

/* Uniform card animation across normal pages. Scroll-heavy panels get glow only. */
.stat-card,
.panel,
.table-card,
.logs-table-panel {
    will-change: transform, box-shadow, border-color;
}

.stat-card::after,
.panel::after,
.table-card::after {
    content: "";
    position: absolute;
    left: -42%;
    top: 0;
    width: 42%;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(248,113,113,.78), transparent);
    box-shadow: 0 0 14px rgba(239,68,68,.42);
    opacity: .0;
    transform: translateX(0);
    transition: opacity .18s ease;
}

.stat-card:hover::after,
.panel:hover::after,
.table-card:hover::after {
    opacity: .95;
    animation: ravCardSweep 1.9s ease-out 1;
}

@keyframes ravCardSweep {
    from { transform: translateX(0); }
    to { transform: translateX(340%); }
}

/* Do not move scroll/table panels: audit, roster, tickets, logs, lists keep stable scroll. */
.panel:has(.table-scroll):hover,
.panel:has(.audit-scroll):hover,
.logs-table-panel:hover,
.table-card:has(.table-scroll):hover,
.table-card:has(.audit-scroll):hover {
    transform: none !important;
}

/* Unified pill/button style: roster filters, tickets filters, add buttons, refresh buttons. */
.filter-button,
.filter-style-button,
.roster-refresh-button,
.ticket-filter-buttons .filter-button,
.form-panel button[type="submit"]:not(.delete-button):not(.action-button),
.reaction-role-form button[type="submit"]:not(.delete-button):not(.action-button) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 9px 15px;
    border-radius: 999px;
    border: 1px solid rgba(212, 175, 55, .34);
    background: linear-gradient(135deg, rgba(220,38,38,.20), rgba(80,20,20,.22));
    color: #fff8df;
    font-weight: 800;
    letter-spacing: .15px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease;
}

.filter-button:hover,
.filter-button.active,
.filter-style-button:hover,
.roster-refresh-button:hover,
.ticket-filter-buttons .filter-button:hover,
.ticket-filter-buttons .filter-button.active,
.form-panel button[type="submit"]:not(.delete-button):not(.action-button):hover,
.reaction-role-form button[type="submit"]:not(.delete-button):not(.action-button):hover {
    transform: translateY(-1px);
    border-color: rgba(235, 203, 103, .72);
    background: linear-gradient(135deg, rgba(239,68,68,.34), rgba(127,29,29,.30));
    box-shadow: 0 0 20px rgba(239,68,68,.16), inset 0 1px 0 rgba(255,255,255,.07);
    color: #fff;
}

/* Dashboard compact fit. Keeps desktop dashboard in the viewport without page down-scroll where practical. */
body:has(.dashboard-layout) .content {
    padding: clamp(10px, 1.1vw, 18px) !important;
    overflow: hidden;
}

body:has(.dashboard-layout) #live-page-content {
    height: calc(100vh - 70px - clamp(20px, 2.2vw, 36px));
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr) minmax(118px, .68fr);
    gap: clamp(8px, .85vw, 13px);
    overflow: hidden;
}

body:has(.dashboard-layout) .stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(112px, 1fr));
    gap: clamp(7px, .75vw, 10px);
    margin: 0 !important;
    padding: 0 !important;
}

body:has(.dashboard-layout) .stat-card {
    min-height: 0;
    height: clamp(62px, 7.2vh, 84px);
    padding: clamp(8px, .75vw, 12px);
    gap: clamp(7px, .7vw, 10px);
}

body:has(.dashboard-layout) .stat-card .stat-icon {
    width: clamp(32px, 3.1vw, 42px);
    height: clamp(32px, 3.1vw, 42px);
    border-radius: 11px;
    flex: 0 0 auto;
}

body:has(.dashboard-layout) .stat-card span {
    font-size: clamp(10px, .72vw, 12px);
}

body:has(.dashboard-layout) .stat-card strong {
    font-size: clamp(16px, 1.6vw, 24px);
    line-height: 1;
}

body:has(.dashboard-layout) .stat-card p {
    margin-top: 3px;
    font-size: clamp(9px, .68vw, 11px);
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-roster-mini-card {
    min-height: 0 !important;
    padding: clamp(9px, .8vw, 12px) clamp(11px, 1vw, 14px) !important;
    display: grid;
    grid-template-columns: minmax(170px, .75fr) minmax(0, 2.3fr);
    align-items: center;
    gap: clamp(10px, 1vw, 16px);
}

.dashboard-roster-mini-card .roster-mini-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.dashboard-roster-mini-card h2 {
    margin: 0;
    font-size: clamp(14px, 1vw, 17px);
    white-space: nowrap;
}

.roster-mini-inline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    align-items: center;
    gap: clamp(8px, .8vw, 12px);
    min-width: 0;
}

.roster-mini-inline > div {
    min-width: 0;
    padding: 7px 10px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 11px;
    background: rgba(255,255,255,.035);
}

.roster-mini-inline span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.1;
}

.roster-mini-inline strong {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: clamp(12px, .9vw, 14px);
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roster-mini-inline form {
    margin: 0;
}

.dashboard-roster-mini-card .roster-refresh-button {
    min-height: 34px;
    padding: 8px 13px;
    white-space: nowrap;
}

body:has(.dashboard-layout) .dashboard-layout {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(220px, .78fr) minmax(220px, .78fr);
    gap: clamp(8px, .85vw, 13px);
    overflow: hidden;
}

body:has(.dashboard-layout) .bottom-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(8px, .85vw, 13px);
    overflow: hidden;
}

body:has(.dashboard-layout) .dashboard-layout > .panel,
body:has(.dashboard-layout) .bottom-grid > .panel {
    min-height: 0;
    height: 100%;
    padding: clamp(11px, .95vw, 16px);
    overflow: hidden;
}

body:has(.dashboard-layout) .panel-header {
    margin-bottom: clamp(8px, .75vw, 12px);
}

body:has(.dashboard-layout) .panel-header h2 {
    font-size: clamp(14px, 1vw, 17px);
}

body:has(.dashboard-layout) .audit-top,
body:has(.dashboard-layout) .audit-boxes {
    gap: 8px;
}

body:has(.dashboard-layout) .audit-boxes > div,
body:has(.dashboard-layout) .audit-top > div,
body:has(.dashboard-layout) .system-row,
body:has(.dashboard-layout) .ticket-row,
body:has(.dashboard-layout) .action-log-row {
    padding: clamp(7px, .65vw, 10px);
}

body:has(.dashboard-layout) .ticket-list,
body:has(.dashboard-layout) .dashboard-action-list,
body:has(.dashboard-layout) .bottom-grid .mini-table {
    max-height: 100%;
    overflow: auto;
}

body:has(.dashboard-layout) .button.full,
body:has(.dashboard-layout) .panel-actions .button {
    min-height: 34px;
    padding: 8px 12px;
}

@media (max-height: 820px) and (min-width: 901px) {
    body:has(.dashboard-layout) #live-page-content {
        grid-template-rows: auto auto auto minmax(0, 1fr) minmax(96px, .55fr);
        gap: 7px;
    }

    body:has(.dashboard-layout) .stat-card p,
    body:has(.dashboard-layout) .bottom-grid .panel-header a {
        display: none;
    }

    body:has(.dashboard-layout) .stat-card {
        height: 58px;
    }

    body:has(.dashboard-layout) .dashboard-layout > .panel,
    body:has(.dashboard-layout) .bottom-grid > .panel {
        padding: 9px;
    }

    body:has(.dashboard-layout) .audit-progress {
        margin: 8px 0;
    }
}

@media (max-width: 1180px) and (min-width: 901px) {
    body:has(.dashboard-layout) .stat-grid {
        grid-template-columns: repeat(5, minmax(96px, 1fr));
    }

    .dashboard-roster-mini-card {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    body:has(.dashboard-layout) .dashboard-layout {
        grid-template-columns: minmax(0, 1.05fr) minmax(210px, .95fr);
    }

    body:has(.dashboard-layout) .dashboard-layout > .panel:nth-child(3) {
        display: none;
    }
}

/* Mobile/tablet: keep natural page scroll and avoid cramped forced dashboard. */
@media (max-width: 900px) {
    body:has(.dashboard-layout) .content {
        overflow: visible !important;
    }

    body:has(.dashboard-layout) #live-page-content {
        height: auto !important;
        display: block !important;
        overflow: visible !important;
    }

    body:has(.dashboard-layout) .stat-grid,
    body:has(.dashboard-layout) .dashboard-layout,
    body:has(.dashboard-layout) .bottom-grid,
    .dashboard-roster-mini-card,
    .roster-mini-inline {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    body:has(.dashboard-layout) .stat-card {
        height: auto !important;
        min-height: 74px;
    }

    body:has(.dashboard-layout) .dashboard-layout > .panel,
    body:has(.dashboard-layout) .bottom-grid > .panel {
        height: auto !important;
        overflow: visible !important;
    }

    .filter-button,
    .filter-style-button,
    .roster-refresh-button,
    .form-panel button[type="submit"]:not(.delete-button):not(.action-button) {
        width: 100%;
    }
}



/* =========================================================
   RAV UI Focus Polish v2
   - Global card edge animation like Dashboard Guild Audit Status
   - Sharper cards with stronger object separation
   - More compact dashboard blocks
   - Scroll containers keep their own overflow/height behavior
   ========================================================= */

:root {
    --radius: 8px;
    --rav-object-radius: 8px;
    --rav-object-shadow:
        0 10px 24px rgba(0, 0, 0, .34),
        0 1px 0 rgba(255, 255, 255, .035) inset;
    --rav-object-shadow-hover:
        0 14px 34px rgba(0, 0, 0, .42),
        0 0 24px rgba(212, 175, 55, .14),
        0 1px 0 rgba(255, 255, 255, .05) inset;
    --rav-object-border: rgba(255, 255, 255, .08);
    --rav-object-border-focus: rgba(235, 203, 103, .38);
}

/* Sharper, clearer cards everywhere */
.stat-card,
.panel,
.table-card,
.logs-table-panel,
.form-panel,
.hint-box,
.alert,
.roster-status-mini,
.roster-mini-inline > div,
.audit-boxes > div,
.audit-top > div,
.system-row,
.ticket-row,
.action-log-row,
.quick,
.button,
.filter-button,
.action-button,
.action-link,
.delete-button {
    border-radius: var(--rav-object-radius) !important;
}

.stat-card,
.panel,
.table-card,
.logs-table-panel {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: var(--rav-object-border) !important;
    box-shadow: var(--rav-object-shadow) !important;
}

/* Always-on edge scan for all major blocks, not only Dashboard */
.stat-card::after,
.panel::after,
.table-card::after,
.logs-table-panel::after {
    content: "";
    position: absolute;
    top: 0;
    left: -42%;
    width: 42%;
    height: 1px;
    pointer-events: none;
    z-index: 2;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(235, 203, 103, .26),
            rgba(235, 203, 103, .78),
            rgba(235, 203, 103, .26),
            transparent
        );

    box-shadow:
        0 0 10px rgba(212, 175, 55, .35),
        0 0 22px rgba(212, 175, 55, .18);

    opacity: .72;
    animation: ravGlobalEdgeScan 5.6s linear infinite;
}

/* Different rhythm so pages don't pulse in sync */
.stat-card:nth-child(2n)::after,
.panel:nth-child(2n)::after,
.table-card:nth-child(2n)::after {
    animation-delay: .65s;
}

.stat-card:nth-child(3n)::after,
.panel:nth-child(3n)::after,
.table-card:nth-child(3n)::after {
    animation-delay: 1.25s;
}

@keyframes ravGlobalEdgeScan {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(340%);
    }
}

.stat-card:hover,
.panel:hover,
.table-card:hover,
.logs-table-panel:hover {
    border-color: var(--rav-object-border-focus) !important;
    box-shadow: var(--rav-object-shadow-hover) !important;
}

.stat-card:hover::after,
.panel:hover::after,
.table-card:hover::after,
.logs-table-panel:hover::after {
    opacity: 1;
    height: 2px;
}

/* Keep scroll-heavy objects stable: no lift, only light/glow */
.panel:has(.table-scroll):hover,
.panel:has(.audit-scroll):hover,
.table-card:has(.table-scroll):hover,
.table-card:has(.audit-scroll):hover,
.logs-table-panel:hover {
    transform: none !important;
}

/* Animated status badges, including Dashboard Live */
.badge {
    border-radius: 999px !important;
    box-shadow: 0 0 0 1px rgba(255,255,255,.05) inset;
}

.badge.green,
.badge[data-online-label="Live"] {
    position: relative;
    box-shadow:
        0 0 0 1px rgba(34, 197, 94, .28) inset,
        0 0 18px rgba(34, 197, 94, .12);
    animation: ravStatusLivePulse 2.6s ease-in-out infinite;
}

.badge.green::after,
.badge[data-online-label="Live"]::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid rgba(34, 197, 94, .22);
    opacity: .75;
    animation: ravStatusRing 2.6s ease-in-out infinite;
}

@keyframes ravStatusLivePulse {
    0%, 100% {
        filter: brightness(1);
        box-shadow:
            0 0 0 1px rgba(34, 197, 94, .26) inset,
            0 0 14px rgba(34, 197, 94, .10);
    }
    50% {
        filter: brightness(1.12);
        box-shadow:
            0 0 0 1px rgba(34, 197, 94, .42) inset,
            0 0 22px rgba(34, 197, 94, .20);
    }
}

@keyframes ravStatusRing {
    0%, 100% {
        transform: scale(1);
        opacity: .34;
    }
    50% {
        transform: scale(1.08);
        opacity: .82;
    }
}

/* Dashboard: compact, cleaner visual density */
body:has(.dashboard-layout) .content {
    padding: clamp(8px, .85vw, 14px) !important;
}

body:has(.dashboard-layout) #live-page-content {
    gap: clamp(6px, .65vw, 10px) !important;
    grid-template-rows: auto auto auto minmax(0, 1fr) minmax(90px, .52fr) !important;
}

/* Compact top stat blocks */
body:has(.dashboard-layout) .stat-grid {
    gap: clamp(6px, .62vw, 9px) !important;
    margin-bottom: 0 !important;
}

body:has(.dashboard-layout) .stat-card {
    height: clamp(50px, 5.9vh, 68px) !important;
    min-height: 0 !important;
    padding: clamp(7px, .62vw, 10px) clamp(8px, .78vw, 12px) !important;
    gap: clamp(6px, .62vw, 9px) !important;
}

body:has(.dashboard-layout) .stat-card .stat-icon {
    width: clamp(28px, 2.55vw, 36px) !important;
    height: clamp(28px, 2.55vw, 36px) !important;
    min-width: clamp(28px, 2.55vw, 36px) !important;
    font-size: clamp(14px, 1.25vw, 19px) !important;
    border-radius: 7px !important;
}

body:has(.dashboard-layout) .stat-card span {
    font-size: clamp(9px, .65vw, 11px) !important;
}

body:has(.dashboard-layout) .stat-card strong {
    margin-top: 2px !important;
    font-size: clamp(14px, 1.35vw, 21px) !important;
}

body:has(.dashboard-layout) .stat-card p {
    margin-top: 2px !important;
    font-size: clamp(8px, .58vw, 10px) !important;
}

/* AQW Roster Status becomes a slim dashboard strip */
.dashboard-roster-mini-card,
.roster-dashboard-compact {
    min-height: 0 !important;
    padding: clamp(7px, .62vw, 10px) clamp(9px, .8vw, 12px) !important;
}

.dashboard-roster-mini-card {
    grid-template-columns: minmax(150px, .55fr) minmax(0, 2.5fr) !important;
    gap: clamp(8px, .8vw, 12px) !important;
}

.dashboard-roster-mini-card h2,
.roster-mini-title-row h2 {
    font-size: clamp(13px, .9vw, 15px) !important;
}

.roster-mini-inline {
    gap: clamp(6px, .6vw, 9px) !important;
}

.roster-mini-inline > div {
    padding: 5px 8px !important;
    border-radius: 7px !important;
}

.roster-mini-inline span {
    font-size: clamp(9px, .6vw, 10px) !important;
}

.roster-mini-inline strong {
    margin-top: 2px !important;
    font-size: clamp(11px, .75vw, 13px) !important;
}

.dashboard-roster-mini-card .roster-refresh-button {
    min-height: 30px !important;
    padding: 6px 10px !important;
    border-radius: 999px !important;
    font-size: clamp(11px, .72vw, 13px) !important;
}

/* Dashboard panels: smaller padding without touching internal scroll behavior */
body:has(.dashboard-layout) .dashboard-layout,
body:has(.dashboard-layout) .bottom-grid {
    gap: clamp(6px, .65vw, 10px) !important;
}

body:has(.dashboard-layout) .dashboard-layout > .panel,
body:has(.dashboard-layout) .bottom-grid > .panel {
    padding: clamp(8px, .72vw, 12px) !important;
}

body:has(.dashboard-layout) .panel-header {
    margin-bottom: clamp(6px, .55vw, 9px) !important;
}

body:has(.dashboard-layout) .panel-header h2 {
    font-size: clamp(13px, .88vw, 15px) !important;
}

body:has(.dashboard-layout) .audit-top,
body:has(.dashboard-layout) .audit-boxes {
    gap: 6px !important;
    margin-bottom: 8px !important;
}

body:has(.dashboard-layout) .audit-top > div,
body:has(.dashboard-layout) .audit-boxes > div {
    padding: clamp(6px, .52vw, 8px) !important;
    border-radius: 7px !important;
}

body:has(.dashboard-layout) .audit-top span,
body:has(.dashboard-layout) .audit-boxes span {
    font-size: clamp(9px, .6vw, 11px) !important;
}

body:has(.dashboard-layout) .audit-top strong,
body:has(.dashboard-layout) .audit-boxes strong {
    margin-top: 3px !important;
    font-size: clamp(13px, 1vw, 18px) !important;
}

body:has(.dashboard-layout) .audit-progress {
    height: 8px !important;
    margin: clamp(6px, .55vw, 9px) 0 !important;
    border-radius: 999px !important;
}

body:has(.dashboard-layout) .ticket-row,
body:has(.dashboard-layout) .system-row,
body:has(.dashboard-layout) .action-log-row {
    padding: clamp(5px, .48vw, 8px) !important;
}

/* More compact only on short desktop screens */
@media (max-height: 820px) and (min-width: 901px) {
    body:has(.dashboard-layout) #live-page-content {
        grid-template-rows: auto auto auto minmax(0, 1fr) minmax(78px, .42fr) !important;
        gap: 5px !important;
    }

    body:has(.dashboard-layout) .stat-card {
        height: 46px !important;
    }

    body:has(.dashboard-layout) .stat-card p,
    body:has(.dashboard-layout) .roster-mini-inline span {
        display: none !important;
    }

    body:has(.dashboard-layout) .dashboard-layout > .panel,
    body:has(.dashboard-layout) .bottom-grid > .panel {
        padding: 7px !important;
    }

    .dashboard-roster-mini-card {
        padding: 6px 8px !important;
    }
}

/* Mobile: keep natural scroll and reduce animation intensity */
@media (max-width: 900px) {
    .stat-card::after,
    .panel::after,
    .table-card::after,
    .logs-table-panel::after {
        animation-duration: 7.5s;
        opacity: .45;
    }

    .stat-card,
    .panel,
    .table-card,
    .logs-table-panel {
        box-shadow:
            0 8px 20px rgba(0, 0, 0, .28),
            0 1px 0 rgba(255, 255, 255, .03) inset !important;
    }

    body:has(.dashboard-layout) .stat-card {
        height: auto !important;
        min-height: 66px !important;
    }

    .dashboard-roster-mini-card {
        grid-template-columns: 1fr !important;
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .stat-card::after,
    .panel::after,
    .table-card::after,
    .logs-table-panel::after,
    .badge.green,
    .badge[data-online-label="Live"],
    .badge.green::after,
    .badge[data-online-label="Live"]::after {
        animation: none !important;
    }
}


/* =========================================================
   RAV HELPER 2026 Glass Quality Patch
   - disables expensive layout animations on heavy table pages
   - adds global glass/particle background on every page
   - keeps audit/roster/ticket/log scroll containers stable
   ========================================================= */

:root {
    --bg: #040406;
    --bg-dark: #020204;

    --panel: rgba(18, 10, 12, 0.56);
    --panel-soft: rgba(28, 14, 17, 0.52);
    --panel-hover: rgba(42, 18, 22, 0.62);

    --border: rgba(255, 110, 120, 0.18);
    --border-soft: rgba(255, 255, 255, 0.075);

    --rav-glass-bg: rgba(18, 10, 14, 0.54);
    --rav-glass-bg-strong: rgba(22, 11, 15, 0.68);
    --rav-glass-border: rgba(255, 255, 255, 0.10);
    --rav-glass-border-red: rgba(235, 203, 103, 0.24);
    --rav-glass-shadow:
        0 18px 42px rgba(0, 0, 0, 0.38),
        inset 0 1px 0 rgba(255, 255, 255, 0.055);
    --rav-glass-shadow-soft:
        0 10px 28px rgba(0, 0, 0, 0.30),
        inset 0 1px 0 rgba(255, 255, 255, 0.045);
    --rav-glass-radius: 10px;
}

/* Global animated background for all pages */
body {
    background:
        radial-gradient(circle at 18% 12%, rgba(212, 175, 55, 0.16), transparent 30%),
        radial-gradient(circle at 82% 4%, rgba(125, 29, 42, 0.20), transparent 28%),
        radial-gradient(circle at 78% 86%, rgba(212, 175, 55, 0.10), transparent 36%),
        linear-gradient(135deg, #030305 0%, #090306 48%, #030305 100%) !important;
}

.rav-ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -10;
    pointer-events: none;
    overflow: hidden;
    background:
        linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.016) 1px, transparent 1px);
    background-size: 58px 58px;
    animation: ravGridDrift 28s linear infinite;
}

.rav-ambient-bg::before {
    content: "";
    position: absolute;
    inset: -20%;
    background:
        conic-gradient(from 160deg at 50% 50%,
            transparent,
            rgba(212, 175, 55, 0.07),
            transparent,
            rgba(255, 255, 255, 0.025),
            transparent);
    filter: blur(18px);
    opacity: 0.58;
    animation: ravAuroraSpin 26s linear infinite;
}

.rav-ambient-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 120%, rgba(212, 175, 55, 0.09), transparent 40%),
        linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.38));
    opacity: 0.9;
}

.rav-bg-orb {
    position: absolute;
    width: min(42vw, 640px);
    height: min(42vw, 640px);
    border-radius: 999px;
    filter: blur(54px);
    opacity: 0.26;
    mix-blend-mode: screen;
}

.rav-bg-orb-one {
    left: -12%;
    top: 4%;
    background: rgba(212, 175, 55, 0.48);
    animation: ravOrbFloatOne 18s ease-in-out infinite alternate;
}

.rav-bg-orb-two {
    right: -14%;
    top: 18%;
    background: rgba(124, 58, 237, 0.48);
    animation: ravOrbFloatTwo 22s ease-in-out infinite alternate;
}

.rav-bg-orb-three {
    left: 36%;
    bottom: -24%;
    background: rgba(255, 255, 255, 0.11);
    animation: ravOrbFloatThree 24s ease-in-out infinite alternate;
}

.rav-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.rav-particles span {
    position: absolute;
    bottom: -12vh;
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255, 160, 165, 0.9);
    box-shadow:
        0 0 8px rgba(212, 175, 55, 0.9),
        0 0 18px rgba(212, 175, 55, 0.35);
    opacity: 0.0;
    animation: ravParticleRise 16s linear infinite;
}

.rav-particles span:nth-child(1)  { left: 4%;  animation-delay: -1s;  animation-duration: 17s; }
.rav-particles span:nth-child(2)  { left: 9%;  animation-delay: -8s;  animation-duration: 22s; }
.rav-particles span:nth-child(3)  { left: 14%; animation-delay: -3s;  animation-duration: 18s; }
.rav-particles span:nth-child(4)  { left: 19%; animation-delay: -11s; animation-duration: 25s; }
.rav-particles span:nth-child(5)  { left: 24%; animation-delay: -6s;  animation-duration: 20s; }
.rav-particles span:nth-child(6)  { left: 31%; animation-delay: -14s; animation-duration: 26s; }
.rav-particles span:nth-child(7)  { left: 36%; animation-delay: -4s;  animation-duration: 19s; }
.rav-particles span:nth-child(8)  { left: 42%; animation-delay: -10s; animation-duration: 24s; }
.rav-particles span:nth-child(9)  { left: 47%; animation-delay: -2s;  animation-duration: 16s; }
.rav-particles span:nth-child(10) { left: 53%; animation-delay: -12s; animation-duration: 23s; }
.rav-particles span:nth-child(11) { left: 58%; animation-delay: -7s;  animation-duration: 19s; }
.rav-particles span:nth-child(12) { left: 63%; animation-delay: -15s; animation-duration: 27s; }
.rav-particles span:nth-child(13) { left: 68%; animation-delay: -5s;  animation-duration: 21s; }
.rav-particles span:nth-child(14) { left: 73%; animation-delay: -13s; animation-duration: 25s; }
.rav-particles span:nth-child(15) { left: 78%; animation-delay: -9s;  animation-duration: 20s; }
.rav-particles span:nth-child(16) { left: 83%; animation-delay: -16s; animation-duration: 28s; }
.rav-particles span:nth-child(17) { left: 88%; animation-delay: -6s;  animation-duration: 18s; }
.rav-particles span:nth-child(18) { left: 93%; animation-delay: -17s; animation-duration: 24s; }
.rav-particles span:nth-child(19) { left: 97%; animation-delay: -3s;  animation-duration: 22s; }
.rav-particles span:nth-child(20) { left: 12%; animation-delay: -18s; animation-duration: 29s; }
.rav-particles span:nth-child(21) { left: 28%; animation-delay: -20s; animation-duration: 31s; }
.rav-particles span:nth-child(22) { left: 44%; animation-delay: -19s; animation-duration: 30s; }
.rav-particles span:nth-child(23) { left: 66%; animation-delay: -21s; animation-duration: 32s; }
.rav-particles span:nth-child(24) { left: 86%; animation-delay: -22s; animation-duration: 31s; }

@keyframes ravGridDrift {
    to { background-position: 58px 58px; }
}

@keyframes ravAuroraSpin {
    to { transform: rotate(360deg); }
}

@keyframes ravOrbFloatOne {
    to { transform: translate3d(9vw, 6vh, 0) scale(1.08); }
}

@keyframes ravOrbFloatTwo {
    to { transform: translate3d(-8vw, 10vh, 0) scale(1.04); }
}

@keyframes ravOrbFloatThree {
    to { transform: translate3d(5vw, -9vh, 0) scale(1.12); }
}

@keyframes ravParticleRise {
    0% {
        transform: translate3d(0, 0, 0) scale(0.7);
        opacity: 0;
    }
    8% {
        opacity: 0.45;
    }
    72% {
        opacity: 0.28;
    }
    100% {
        transform: translate3d(28px, -118vh, 0) scale(1.25);
        opacity: 0;
    }
}

/* Glass theme surfaces */
.sidebar,
.topbar,
.stat-card,
.panel,
.table-card,
.logs-table-panel,
.form-panel,
.hint-box,
.alert,
.roster-mini-inline > div,
.audit-boxes > div,
.audit-top > div,
.system-row,
.ticket-row,
.action-log-row,
.quick {
    background: var(--rav-glass-bg) !important;
    border-color: var(--rav-glass-border) !important;
    box-shadow: var(--rav-glass-shadow-soft) !important;
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.sidebar,
.topbar {
    background: rgba(8, 4, 7, 0.70) !important;
}

.stat-card,
.panel,
.table-card,
.logs-table-panel {
    border-radius: var(--rav-glass-radius) !important;
}

/* Modern focus glow without moving large scroll panels */
.stat-card:hover,
.panel:hover,
.table-card:hover,
.logs-table-panel:hover {
    border-color: var(--rav-glass-border-red) !important;
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.40),
        0 0 28px rgba(212, 175, 55, 0.13),
        inset 0 1px 0 rgba(255, 255, 255, 0.065) !important;
}

/* The animated scan remains, but is GPU-light and does not reflow tables. */
.stat-card::after,
.panel::after,
.table-card::after,
.logs-table-panel::after {
    will-change: transform, opacity;
    transform: translate3d(0,0,0);
}

/* Prevent sidebar toggle lag on table-heavy pages.
   Animating width/margin forces layout recalculation for 300-700 table rows.
   The state now switches instantly; hover/glass transitions remain smooth. */
.sidebar,
.main {
    transition: none !important;
    will-change: auto !important;
}

.sidebar .brand h2,
.sidebar .brand span,
.sidebar .nav span,
.sidebar .nav-section,
.sidebar .admin-user span {
    transition: opacity 110ms ease, transform 110ms ease !important;
}

/* Keep table pages stable and readable */
#live-page-content:has(.audit-page),
#live-page-content:has(.roster-page),
#live-page-content:has(.logs-page),
#live-page-content:has(.list-page) {
    overflow: hidden !important;
}

.audit-scroll,
.roster-scroll,
.table-scroll,
.logs-table-panel {
    background: rgba(7, 5, 8, 0.36) !important;
    border-color: rgba(255, 255, 255, 0.075) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.audit-scroll thead th,
.roster-scroll thead th,
.table-scroll thead th,
.logs-table-panel thead th {
    background: rgba(18, 10, 14, 0.92) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

/* Buttons: glass, modern, consistent */
.button,
.filter-button,
.filter-style-button,
.roster-refresh-button,
.action-button,
.action-link,
.form-panel button[type="submit"]:not(.delete-button):not(.action-button),
.reaction-role-form button[type="submit"]:not(.delete-button):not(.action-button) {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025)),
        linear-gradient(135deg, rgba(212, 175, 55, 0.22), rgba(80, 20, 24, 0.18)) !important;
    border: 1px solid rgba(235, 203, 103, 0.28) !important;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.26),
        inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.button:hover,
.filter-button:hover,
.filter-button.active,
.filter-style-button:hover,
.filter-style-button.active,
.roster-refresh-button:hover,
.action-button:hover,
.action-link:hover {
    transform: translateY(-1px);
    border-color: rgba(235, 203, 103, 0.50) !important;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.34),
        0 0 24px rgba(212, 175, 55, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

/* Roster filters need to survive because the DOM is no longer auto-replaced. */
.roster-toolbar,
.ticket-filter-buttons,
.panel-actions {
    position: relative;
    z-index: 4;
}

/* Mobile: keep animations lighter and preserve existing natural scroll */
@media (max-width: 900px) {
    .rav-ambient-bg {
        animation-duration: 42s;
    }

    .rav-ambient-bg::before {
        opacity: 0.34;
        animation-duration: 40s;
    }

    .rav-particles span {
        opacity: 0.0;
        animation-duration: 26s;
    }

    .stat-card,
    .panel,
    .table-card,
    .logs-table-panel,
    .form-panel,
    .hint-box {
        backdrop-filter: blur(12px) saturate(115%);
        -webkit-backdrop-filter: blur(12px) saturate(115%);
    }

    .sidebar,
    .main {
        transition: none !important;
    }
}

/* Accessibility / low power */
@media (prefers-reduced-motion: reduce) {
    .rav-ambient-bg,
    .rav-ambient-bg::before,
    .rav-bg-orb,
    .rav-particles span {
        animation: none !important;
    }
}


/* ==========================================================
   ELDRA HELPER — GOLD / WHITE / VIOLET THEME
   Compatibility layer: existing class names and animations are
   intentionally preserved to avoid regressions.
   ========================================================== */
:root {
    --bg: #0b0712;
    --bg-dark: #050309;
    --sidebar: #100a1a;
    --sidebar-border: rgba(124, 58, 237, 0.32);
    --panel: rgba(23, 16, 32, 0.90);
    --panel-soft: rgba(32, 22, 45, 0.88);
    --panel-hover: rgba(43, 29, 62, 0.92);
    --border: rgba(212, 175, 55, 0.30);
    --border-soft: rgba(167, 139, 250, 0.20);
    --text: #fffdf7;
    --muted: #c9c1d3;
    --muted-soft: #968ca2;
    --blue: #d4af37;
    --blue-soft: rgba(212, 175, 55, 0.16);
    --yellow: #f1cf62;
    --yellow-soft: rgba(241, 207, 98, 0.15);
    --purple: #8b5cf6;
    --purple-soft: rgba(139, 92, 246, 0.17);
    --cyan: #c4b5fd;
    --cyan-soft: rgba(196, 181, 253, 0.16);
    --rav-login-bg: #07040d;
    --rav-login-panel: #100a1a;
    --rav-login-panel-soft: #1b1127;
    --rav-login-red: #d4af37;
    --rav-login-red-dark: #6f4bb8;
    --rav-login-red-soft: rgba(212, 175, 55, 0.18);
    --rav-login-red-glow: rgba(212, 175, 55, 0.42);
    --rav-login-border: rgba(212, 175, 55, 0.48);
    --rav-glow-red: rgba(212, 175, 55, 0.18);
    --rav-glow-red-strong: rgba(139, 92, 246, 0.34);
    --rav-card-anim-border: rgba(212, 175, 55, 0.42);
    --rav-card-anim-glow: rgba(139, 92, 246, 0.18);
    --rav-object-border-focus: rgba(212, 175, 55, 0.42);
}

body {
    background:
        radial-gradient(circle at 10% 0%, rgba(212, 175, 55, 0.13), transparent 34%),
        radial-gradient(circle at 92% 10%, rgba(124, 58, 237, 0.14), transparent 31%),
        radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.035), transparent 38%),
        var(--bg-dark);
}

.sidebar {
    background: linear-gradient(180deg, rgba(16, 10, 26, 0.98), rgba(7, 4, 13, 0.98));
    border-right-color: rgba(212, 175, 55, 0.24);
}

.topbar {
    background: rgba(8, 5, 14, 0.84);
    border-bottom-color: rgba(167, 139, 250, 0.18);
}

.brand-avatar {
    border-color: rgba(212, 175, 55, 0.48);
    box-shadow: 0 0 22px rgba(212, 175, 55, 0.18), 0 0 34px rgba(124, 58, 237, 0.10);
}

.brand h2,
.rav-login-panel h1 span,
.rav-login-slogan em,
a,
.panel-header > a {
    color: #f1cf62;
}

a:hover,
.panel-header > a:hover {
    color: #ffffff;
}

.nav a:hover,
.nav a.active {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.16), rgba(124, 58, 237, 0.13));
    border-color: rgba(212, 175, 55, 0.32);
}

.nav a:hover i,
.nav a.active i {
    color: #f1cf62;
}

.button.primary,
button.primary,
.discord-login-button,
.rav-login-panel button {
    background: linear-gradient(135deg, #d4af37, #8b5cf6);
    color: #fffdf7;
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 28px rgba(124, 58, 237, 0.18), 0 0 20px rgba(212, 175, 55, 0.15);
}

.button.primary:hover,
button.primary:hover,
.discord-login-button:hover,
.rav-login-panel button:hover {
    background: linear-gradient(135deg, #e4c657, #9d75f7);
    box-shadow: 0 14px 34px rgba(124, 58, 237, 0.25), 0 0 24px rgba(212, 175, 55, 0.22);
}

/* Keep status meanings clear while the main interface uses Eldra colors. */
.badge.red,
.status-red,
.toast.error,
.button.danger,
button.danger {
    color: #ffd8d8;
    border-color: rgba(239, 68, 68, 0.42);
}

.badge.green,
.status-green,
.toast.success {
    color: #c9f7d5;
    border-color: rgba(34, 197, 94, 0.38);
}

::selection {
    background: rgba(212, 175, 55, 0.30);
    color: #ffffff;
}


/* ===== Eldra login layout/background hotfix ===== */
html,
body.login-page {
    width: 100%;
    min-height: 100%;
}

.login-page {
    min-height: 100vh;

    background-image:
        linear-gradient(
            rgba(8,8,12,.18),
            rgba(8,8,12,.42)
        ),
        url("/static/img/login_bg.png?v=2");

    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;

    overflow: hidden;
}

body.login-page .login-bg-overlay {
    z-index: 0;
    background:
        radial-gradient(circle at 50% 42%, rgba(212, 175, 55, 0.04) 0%, rgba(14, 9, 24, 0.16) 48%, rgba(4, 3, 8, 0.70) 100%);
}

body.login-page .login-container {
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    padding: 24px;
}

body.login-page .rav-login-panel {
    box-sizing: border-box;
    width: min(540px, calc(100vw - 48px));
    max-width: 540px;
    margin: auto;
}

body.login-page .rav-login-panel p {
    color: #d4ceda;
}

body.login-page .rav-login-slogan {
    width: 100%;
    margin-top: 28px;
    gap: 12px;
    white-space: normal;
}

body.login-page .rav-login-slogan strong {
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 7px;
    white-space: normal;
    line-height: 1.45;
}

body.login-page .rav-login-slogan strong span,
body.login-page .rav-login-slogan strong em {
    white-space: nowrap;
}

body.login-page .rav-login-slogan em,
body.login-page .rav-login-diamond,
body.login-page .password-toggle:hover {
    color: #e6c65a;
}

body.login-page .rav-login-slogan em,
body.login-page .rav-login-diamond {
    text-shadow: 0 0 16px rgba(212, 175, 55, 0.86);
}

@media (max-width: 700px) {
    body.login-page {
        background-attachment: scroll;
        overflow-y: auto;
    }

    body.login-page .login-container {
        align-items: flex-start;
        padding: 18px 14px;
    }

    body.login-page .rav-login-panel {
        width: 100%;
        padding: 28px 22px 24px;
        border-radius: 22px;
    }

    body.login-page .rav-login-emblem {
        width: 104px;
        height: 104px;
        margin-bottom: 16px;
    }

    body.login-page .rav-login-slogan .line {
        display: none;
    }
}

@media (max-height: 820px) and (min-width: 701px) {
    body.login-page {
        overflow-y: auto;
    }

    body.login-page .login-container {
        align-items: flex-start;
        padding-top: 24px;
        padding-bottom: 24px;
    }

    body.login-page .rav-login-panel {
        padding-top: 28px;
        padding-bottom: 24px;
    }

    body.login-page .rav-login-emblem {
        width: 96px;
        height: 96px;
        margin-bottom: 14px;
    }

    body.login-page .rav-login-panel p {
        margin-bottom: 22px;
    }

    body.login-page .rav-input-wrap {
        margin-bottom: 16px;
    }
}

/* Final login background override */
body.login-page {
    min-height: 100vh !important;

    background-image:
        linear-gradient(
            rgba(8, 8, 12, 0.12),
            rgba(8, 8, 12, 0.36)
        ),
        url("/static/img/login_bg.png?v=eldra-login-bg-4") !important;

    background-position: center center !important;
    background-repeat: no-repeat !important;
    background-size: cover !important;
    background-attachment: fixed !important;

    overflow: hidden !important;
}


/* Message Sender */
.message-sender-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.message-sender-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.message-sender-form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
}

.message-sender-form label > span {
    color: var(--text-muted, #aeb7c7);
    font-size: 0.9rem;
}

.message-sender-message textarea {
    width: 100%;
    resize: vertical;
    min-height: 180px;
}

.message-sender-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

#message-counter {
    color: var(--text-muted, #aeb7c7);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .message-sender-grid {
        grid-template-columns: 1fr;
    }
}


/* ============================================================
   Message Sender
   ============================================================ */

.message-sender-shell {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    padding: 28px;
    border: 1px solid rgba(194, 164, 255, 0.16);
    border-radius: 20px;
    background:
        radial-gradient(circle at 16% 0%, rgba(128, 84, 190, 0.20), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(84, 50, 145, 0.18), transparent 42%),
        linear-gradient(145deg, rgba(24, 19, 35, 0.96), rgba(13, 11, 21, 0.98));
    box-shadow:
        0 22px 55px rgba(0, 0, 0, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.message-sender-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.74), transparent);
}

.message-sender-form {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 22px;
}

.message-sender-form label {
    display: block;
    margin-bottom: 9px;
    color: rgba(247, 242, 255, 0.92);
    font-size: 0.88rem;
    font-weight: 750;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.message-sender-select,
.message-sender-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(191, 154, 255, 0.20);
    border-radius: 14px;
    background-color: #171221;
    color: #f8f4ff;
    font: inherit;
    outline: none;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.025),
        0 10px 28px rgba(0, 0, 0, 0.18);
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease,
        transform 0.2s ease;
}

.message-sender-select {
    min-height: 58px;
    padding: 0 52px 0 18px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 650;
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #cdb5ff 50%),
        linear-gradient(135deg, #cdb5ff 50%, transparent 50%),
        linear-gradient(to right, rgba(197, 164, 255, 0.12), rgba(197, 164, 255, 0.12));
    background-position:
        calc(100% - 23px) 25px,
        calc(100% - 17px) 25px,
        calc(100% - 47px) 50%;
    background-size:
        6px 6px,
        6px 6px,
        1px 28px;
    background-repeat: no-repeat;
}

.message-sender-select--server {
    background-color: #1a1426;
}

.message-sender-select--channel {
    background-color: #15111f;
}

.message-sender-textarea {
    min-height: 300px;
    padding: 18px 20px;
    resize: vertical;
    line-height: 1.62;
    font-size: 1rem;
    background:
        linear-gradient(180deg, rgba(30, 23, 43, 0.98), rgba(18, 14, 27, 0.99));
}

.message-sender-select:hover,
.message-sender-textarea:hover {
    border-color: rgba(207, 178, 255, 0.36);
    background-color: #1d1729;
}

.message-sender-select:focus,
.message-sender-textarea:focus {
    border-color: #b78cff;
    box-shadow:
        0 0 0 3px rgba(183, 140, 255, 0.14),
        0 14px 38px rgba(75, 39, 126, 0.22);
}

.message-sender-select:focus {
    transform: translateY(-1px);
}

.message-sender-select option,
.message-sender-select optgroup {
    background: #171221;
    color: #f7f1ff;
}

.message-sender-select option:checked {
    background: #6e4ba0;
    color: #ffffff;
}

.message-sender-textarea::placeholder {
    color: rgba(230, 218, 245, 0.38);
}

/* Decorative particles — CSS only, no JavaScript overhead. */
.message-sender-particles {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.message-sender-particles span {
    position: absolute;
    bottom: -24px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(205, 177, 255, 0.72);
    box-shadow:
        0 0 8px rgba(196, 157, 255, 0.75),
        0 0 20px rgba(129, 75, 210, 0.42);
    opacity: 0;
    animation: message-particle-rise 12s linear infinite;
}

.message-sender-particles span:nth-child(1)  { left: 6%;  animation-delay: -2s;  animation-duration: 13s; }
.message-sender-particles span:nth-child(2)  { left: 14%; animation-delay: -8s;  animation-duration: 16s; width: 3px; height: 3px; }
.message-sender-particles span:nth-child(3)  { left: 24%; animation-delay: -5s;  animation-duration: 11s; }
.message-sender-particles span:nth-child(4)  { left: 33%; animation-delay: -10s; animation-duration: 18s; width: 4px; height: 4px; }
.message-sender-particles span:nth-child(5)  { left: 43%; animation-delay: -1s;  animation-duration: 14s; width: 3px; height: 3px; }
.message-sender-particles span:nth-child(6)  { left: 51%; animation-delay: -7s;  animation-duration: 12s; }
.message-sender-particles span:nth-child(7)  { left: 61%; animation-delay: -4s;  animation-duration: 17s; width: 4px; height: 4px; }
.message-sender-particles span:nth-child(8)  { left: 70%; animation-delay: -11s; animation-duration: 15s; width: 3px; height: 3px; }
.message-sender-particles span:nth-child(9)  { left: 78%; animation-delay: -6s;  animation-duration: 13s; }
.message-sender-particles span:nth-child(10) { left: 86%; animation-delay: -3s;  animation-duration: 18s; width: 4px; height: 4px; }
.message-sender-particles span:nth-child(11) { left: 92%; animation-delay: -9s;  animation-duration: 14s; width: 3px; height: 3px; }
.message-sender-particles span:nth-child(12) { left: 97%; animation-delay: -5s;  animation-duration: 19s; }

@keyframes message-particle-rise {
    0% {
        transform: translate3d(0, 0, 0) scale(0.65);
        opacity: 0;
    }
    12% {
        opacity: 0.62;
    }
    72% {
        opacity: 0.36;
    }
    100% {
        transform: translate3d(18px, -620px, 0) scale(1.12);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .message-sender-particles span {
        animation: none;
        opacity: 0.16;
    }

    .message-sender-select,
    .message-sender-textarea {
        transition: none;
    }
}

@media (max-width: 720px) {
    .message-sender-shell {
        padding: 19px;
        border-radius: 16px;
    }

    .message-sender-select {
        min-height: 54px;
    }

    .message-sender-textarea {
        min-height: 240px;
    }
}


/* ============================================================
   Message Sender — exact current element IDs
   Scoped fix: does not affect any other page or form.
   ============================================================ */

.message-sender-shell #message-server,
.message-sender-shell #message-channel,
.message-sender-shell #message-content {
    width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid rgba(191, 154, 255, 0.32) !important;
    border-radius: 14px !important;
    background-color: #171221 !important;
    color: #f8f4ff !important;
    -webkit-text-fill-color: #f8f4ff !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    outline: none !important;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.035),
        0 10px 28px rgba(0, 0, 0, 0.20) !important;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease !important;
}

.message-sender-shell #message-server,
.message-sender-shell #message-channel {
    min-height: 58px !important;
    height: 58px !important;
    padding: 0 52px 0 18px !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    color-scheme: dark !important;
    background-image:
        linear-gradient(45deg, transparent 50%, #cdb5ff 50%),
        linear-gradient(135deg, #cdb5ff 50%, transparent 50%),
        linear-gradient(to right, rgba(197, 164, 255, 0.14), rgba(197, 164, 255, 0.14)) !important;
    background-position:
        calc(100% - 23px) 25px,
        calc(100% - 17px) 25px,
        calc(100% - 47px) 50% !important;
    background-size:
        6px 6px,
        6px 6px,
        1px 28px !important;
    background-repeat: no-repeat !important;
}

.message-sender-shell #message-server {
    background-color: #1b1428 !important;
}

.message-sender-shell #message-channel {
    background-color: #15101f !important;
}

.message-sender-shell #message-channel:disabled {
    background-color: #110d18 !important;
    color: rgba(248, 244, 255, 0.42) !important;
    -webkit-text-fill-color: rgba(248, 244, 255, 0.42) !important;
    cursor: not-allowed !important;
    opacity: 1 !important;
}

.message-sender-shell #message-content {
    min-height: 300px !important;
    padding: 18px 20px !important;
    resize: vertical !important;
    line-height: 1.62 !important;
    background:
        linear-gradient(180deg, #20182e 0%, #15101f 100%) !important;
    caret-color: #d8c2ff !important;
}

.message-sender-shell #message-server:hover,
.message-sender-shell #message-channel:hover:not(:disabled),
.message-sender-shell #message-content:hover {
    border-color: rgba(211, 184, 255, 0.52) !important;
}

.message-sender-shell #message-server:focus,
.message-sender-shell #message-channel:focus,
.message-sender-shell #message-content:focus {
    border-color: #b78cff !important;
    background-color: #1d162a !important;
    box-shadow:
        0 0 0 3px rgba(183, 140, 255, 0.16),
        0 14px 38px rgba(75, 39, 126, 0.24) !important;
}

.message-sender-shell #message-server option,
.message-sender-shell #message-channel option,
.message-sender-shell #message-server optgroup,
.message-sender-shell #message-channel optgroup {
    background-color: #171221 !important;
    color: #f8f4ff !important;
}

.message-sender-shell #message-content::placeholder {
    color: rgba(230, 218, 245, 0.40) !important;
    -webkit-text-fill-color: rgba(230, 218, 245, 0.40) !important;
}

@media (max-width: 720px) {
    .message-sender-shell #message-server,
    .message-sender-shell #message-channel {
        min-height: 54px !important;
        height: 54px !important;
    }

    .message-sender-shell #message-content {
        min-height: 240px !important;
    }
}


/* ============================================================
   Message Sender — replies and emoji picker
   ============================================================ */

.message-sender-reply input {
    width: 100%;
    min-height: 54px;
    box-sizing: border-box;
    padding: 0 17px;
    border: 1px solid rgba(191, 154, 255, 0.28);
    border-radius: 13px;
    background: #171221;
    color: #f8f4ff;
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.message-sender-reply input:focus {
    border-color: #b78cff;
    box-shadow: 0 0 0 3px rgba(183, 140, 255, 0.15);
}

.message-sender-reply input::placeholder {
    color: rgba(230, 218, 245, 0.38);
}

.message-sender-hint,
.message-sender-emoji-header small {
    display: block;
    margin-top: 7px;
    color: rgba(230, 218, 245, 0.52);
    font-size: 0.82rem;
}

.message-sender-emoji-block {
    padding: 16px;
    border: 1px solid rgba(191, 154, 255, 0.18);
    border-radius: 15px;
    background: rgba(19, 14, 29, 0.78);
}

.message-sender-emoji-header {
    margin-bottom: 12px;
}

.message-sender-emoji-header > span {
    color: rgba(247, 242, 255, 0.92);
    font-size: 0.88rem;
    font-weight: 750;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.message-sender-emoji-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 13px;
}

.message-emoji-tab {
    padding: 8px 13px;
    border: 1px solid rgba(191, 154, 255, 0.22);
    border-radius: 10px;
    background: #171221;
    color: rgba(245, 238, 255, 0.75);
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
}

.message-emoji-tab:hover,
.message-emoji-tab.active {
    border-color: rgba(205, 176, 255, 0.52);
    background: rgba(103, 68, 153, 0.38);
    color: #ffffff;
}

.message-sender-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
    gap: 7px;
    max-height: 190px;
    overflow-y: auto;
    padding: 2px;
}

.message-emoji-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 5px;
    border: 1px solid rgba(191, 154, 255, 0.14);
    border-radius: 10px;
    background: rgba(34, 25, 48, 0.82);
    color: #ffffff;
    cursor: pointer;
    font-size: 1.35rem;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.message-emoji-button:hover {
    transform: translateY(-1px);
    border-color: rgba(207, 178, 255, 0.48);
    background: rgba(92, 57, 139, 0.42);
}

.message-custom-emoji-button img {
    display: block;
    width: 29px;
    height: 29px;
    object-fit: contain;
}

.message-sender-emoji-empty {
    grid-column: 1 / -1;
    padding: 12px;
    color: rgba(230, 218, 245, 0.48);
    font-size: 0.86rem;
    text-align: center;
}

@media (max-width: 720px) {
    .message-sender-emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(39px, 1fr));
    }

    .message-emoji-button {
        min-width: 39px;
        height: 39px;
    }
}


.message-sender-emoji-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 13px;
}

.message-sender-emoji-search-wrap > i {
    position: absolute;
    left: 14px;
    z-index: 1;
    color: rgba(221, 202, 247, 0.48);
    pointer-events: none;
}

#message-emoji-search {
    width: 100%;
    min-height: 44px;
    box-sizing: border-box;
    padding: 0 43px 0 40px;
    border: 1px solid rgba(191, 154, 255, 0.20);
    border-radius: 11px;
    background: #171221;
    color: #f8f4ff;
    font: inherit;
    font-size: 0.92rem;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#message-emoji-search:focus {
    border-color: #b78cff;
    box-shadow: 0 0 0 3px rgba(183, 140, 255, 0.14);
}

#message-emoji-search::placeholder {
    color: rgba(230, 218, 245, 0.38);
}

#message-emoji-search::-webkit-search-cancel-button {
    display: none;
}

.message-emoji-search-clear {
    position: absolute;
    right: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: rgba(230, 218, 245, 0.48);
    cursor: pointer;
}

.message-emoji-search-clear:hover {
    background: rgba(183, 140, 255, 0.12);
    color: #ffffff;
}


.message-sender-emoji-grid[hidden] {
    display: none !important;
}

.message-emoji-category {
    grid-column: 1 / -1;
    margin: 8px 0 2px;
    padding: 6px 4px 4px;
    border-bottom: 1px solid rgba(191, 154, 255, 0.13);
    color: rgba(230, 218, 245, 0.64);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
