:root {
    color-scheme: light;
    --bg: #eef5f8;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-solid: #ffffff;
    --brand: #123b66;
    --brand-2: #0e7490;
    --brand-soft: #7cc4c7;
    --ink: #162334;
    --text: #243244;
    --muted: #6f7d8d;
    --line: rgba(18, 59, 102, 0.12);
    --success: #067647;
    --success-bg: #ecfdf3;
    --danger: #b42318;
    --danger-bg: #fef3f2;
    --shadow: 0 24px 70px rgba(18, 59, 102, 0.13);
    --shadow-soft: 0 12px 34px rgba(18, 59, 102, 0.09);
    --body-bg:
        radial-gradient(circle at 20% 12%, rgba(124, 196, 199, 0.35), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(18, 59, 102, 0.16), transparent 26%),
        linear-gradient(135deg, #eef5f8 0%, #f8fbfd 52%, #e8f3f5 100%);
    --sidebar-bg:
        radial-gradient(circle at 30% 8%, rgba(124, 196, 199, 0.42), transparent 34%),
        linear-gradient(180deg, #092744 0%, #123b66 48%, #0e5668 100%);
    --input-bg: rgba(255, 255, 255, 0.82);
    --row-bg: rgba(255, 255, 255, 0.68);
    --table-head-bg: #f8fbfd;
    --soft-action-bg: #eef8f8;
    --soft-action-hover: #dff3f4;
    --success-border: #abefc6;
    --danger-hover: #fee4e2;
}

html[data-theme="dark"],
html[data-theme="system"].system-dark {
    color-scheme: dark;
    --bg: #10283a;
    --panel: rgba(245, 249, 251, 0.08);
    --panel-solid: #17364a;
    --brand: #a6e0e4;
    --brand-2: #7cc4c7;
    --brand-soft: #9be4e6;
    --ink: #f7fbfd;
    --text: #e3edf2;
    --muted: #b4c6d0;
    --line: rgba(226, 240, 246, 0.16);
    --success: #9ee6b9;
    --success-bg: rgba(30, 93, 66, 0.38);
    --danger: #ffb1aa;
    --danger-bg: rgba(125, 45, 42, 0.34);
    --shadow: 0 24px 70px rgba(4, 18, 28, 0.30);
    --shadow-soft: 0 12px 34px rgba(4, 18, 28, 0.22);
    --body-bg:
        radial-gradient(circle at 20% 12%, rgba(124, 196, 199, 0.20), transparent 28%),
        radial-gradient(circle at 88% 8%, rgba(255, 255, 255, 0.08), transparent 26%),
        linear-gradient(135deg, #10283a 0%, #123b52 52%, #0e2c3d 100%);
    --sidebar-bg:
        radial-gradient(circle at 30% 8%, rgba(124, 196, 199, 0.34), transparent 34%),
        linear-gradient(180deg, #08243f 0%, #123b66 48%, #0e5668 100%);
    --input-bg: rgba(245, 249, 251, 0.10);
    --row-bg: rgba(245, 249, 251, 0.07);
    --table-head-bg: #15384d;
    --soft-action-bg: rgba(124, 196, 199, 0.14);
    --soft-action-hover: rgba(124, 196, 199, 0.22);
    --success-border: rgba(158, 230, 185, 0.34);
    --danger-hover: rgba(125, 45, 42, 0.48);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans", sans-serif;
    color: var(--text);
    background: var(--body-bg);
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 246px 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px 14px;
    color: #ffffff;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 8px 8px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 13px;
    color: #092744;
    background: linear-gradient(135deg, #ffffff 0%, var(--brand-soft) 100%);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
    font-size: 13px;
    font-weight: 950;
    letter-spacing: 0.02em;
}

.sidebar-brand strong,
.sidebar-brand span {
    display: block;
}

.sidebar-brand strong {
    color: #ffffff;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 900;
}

.sidebar-brand span {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar nav {
    display: grid;
    gap: 5px;
}

.sidebar a {
    position: relative;
    display: grid;
    grid-template-columns: 34px 1fr;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    min-height: 42px;
    padding: 5px 10px 5px 5px;
    border-radius: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    transition: 0.18s ease;
}

.sidebar a i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: rgba(255, 255, 255, 0.72);
    background: rgba(255, 255, 255, 0.08);
    font-size: 18px;
    transition: 0.18s ease;
}

.sidebar a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar a.active,
.sidebar a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transform: translateX(2px);
    box-shadow: inset 2px 0 0 var(--brand-soft);
}

.sidebar a.active i,
.sidebar a:hover i {
    color: #092744;
    background: var(--brand-soft);
}

.sidebar a.logout-link {
    margin-top: 10px;
    color: rgba(255, 255, 255, 0.66);
}

.sidebar a.logout-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.10);
}

.sidebar a.logout-link i {
    color: rgba(255, 255, 255, 0.62);
    background: rgba(255, 255, 255, 0.06);
}

.main {
    padding: 38px;
}

.dashboard-theme-bar {
    margin-top: auto;
    margin-left: 5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    width: max-content;
    max-width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.10);
    box-shadow: none;
    backdrop-filter: blur(14px);
}

.dashboard-theme-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.74);
    background: transparent;
    cursor: pointer;
    transition: 0.18s ease;
}

.dashboard-theme-btn:hover,
.dashboard-theme-btn.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.16);
}

.dashboard-theme-btn i {
    font-size: 18px;
    line-height: 1;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 22px;
    align-items: center;
    margin-bottom: 30px;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--brand-2);
    font-weight: 900;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 12px;
}

h1 {
    margin: 0;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.05em;
}

.profile {
    min-width: 250px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 16px 18px;
    text-align: right;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.profile strong {
    color: var(--ink);
}

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

.cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 26px;
}

.card,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    min-height: 132px;
}

.card::after {
    content: "";
    position: absolute;
    right: -38px;
    top: -42px;
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(124, 196, 199, 0.35), rgba(18, 59, 102, 0.10));
}

.card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card strong {
    position: relative;
    z-index: 1;
    font-size: 34px;
    color: var(--brand);
    letter-spacing: -0.04em;
}

.panel {
    padding: 26px;
    margin-bottom: 26px;
}

.panel-head h2 {
    margin: 0 0 7px;
    color: var(--ink);
    font-size: 22px;
    letter-spacing: -0.03em;
}

.panel-head p {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.5;
}

.split {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.panel-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    background: var(--soft-action-bg);
    border: 1px solid rgba(14, 116, 144, 0.16);
    border-radius: 999px;
    padding: 10px 15px;
    text-decoration: none;
    font-weight: 900;
    font-size: 13px;
    white-space: nowrap;
    transition: 0.18s ease;
}

.panel-link:hover {
    background: var(--soft-action-hover);
    transform: translateY(-1px);
}

.list {
    display: grid;
    gap: 12px;
}

.row {
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    background: var(--row-bg);
    transition: 0.18s ease;
}

.row:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(18, 59, 102, 0.08);
}

.row strong {
    color: var(--ink);
}

.row small {
    color: var(--muted);
}

.empty {
    color: var(--muted);
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: var(--row-bg);
}

.token-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin-bottom: 18px;
}

.token-form input,
.filter-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 13px 15px;
    font-size: 14px;
    color: var(--text);
    background: var(--input-bg);
    outline: none;
    transition: 0.18s ease;
}

.token-form input:focus,
.filter-form input:focus {
    border-color: rgba(14, 116, 144, 0.45);
    box-shadow: 0 0 0 5px rgba(124, 196, 199, 0.18);
}

.token-form button,
.new-token button,
.filter-form button {
    border: 0;
    border-radius: 15px;
    padding: 13px 17px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #ffffff;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 14px 28px rgba(18, 59, 102, 0.18);
    transition: 0.18s ease;
}

.token-form button:hover,
.new-token button:hover,
.filter-form button:hover {
    transform: translateY(-1px);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: right;
}

button.danger {
    border: 0;
    border-radius: 12px;
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 900;
    padding: 10px 13px;
    cursor: pointer;
}

button.danger:hover {
    background: var(--danger-hover);
}

.new-token-box {
    margin-bottom: 18px;
}

.new-token {
    border: 1px solid var(--success-border);
    background: var(--success-bg);
    color: var(--success);
    border-radius: 20px;
    padding: 18px;
}

.new-token textarea {
    width: 100%;
    min-height: 96px;
    margin: 12px 0;
    border: 1px solid var(--success-border);
    border-radius: 14px;
    padding: 12px;
    font-family: monospace;
    resize: vertical;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--row-bg);
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.report-table th,
.report-table td {
    padding: 15px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    font-size: 14px;
}

.report-table th {
    position: sticky;
    top: 0;
    color: var(--brand);
    background: var(--table-head-bg);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.055em;
    z-index: 1;
}

.report-table td {
    color: var(--text);
}

.report-table tbody tr {
    transition: 0.14s ease;
}

.report-table tbody tr:hover {
    background: rgba(124, 196, 199, 0.10);
}

.report-table tbody tr:last-child td {
    border-bottom: 0;
}

.filter-form {
    display: grid;
    grid-template-columns: 1fr 180px auto auto;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-form button[type="button"] {
    background: var(--soft-action-bg);
    color: var(--brand);
    border: 1px solid var(--line);
    box-shadow: none;
}

@media (max-width: 1100px) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

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

    .sidebar {
        position: sticky;
        z-index: 20;
        height: auto;
        padding: 10px 12px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .sidebar-brand {
        margin-bottom: 8px;
        padding: 0 2px 8px;
    }

    .sidebar nav {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: none;
    }

    .sidebar a {
        flex: 0 0 auto;
        grid-template-columns: 30px max-content;
        min-height: 38px;
        padding-right: 12px;
        white-space: nowrap;
    }

    .sidebar a i {
        width: 30px;
        height: 30px;
        font-size: 17px;
    }

    .dashboard-theme-bar {
        position: absolute;
        top: 10px;
        right: 12px;
        margin: 0;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile {
        text-align: left;
        width: 100%;
    }
}

@media (max-width: 760px) {
    .filter-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .main {
        padding: 18px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .row {
        flex-direction: column;
    }

    .token-form {
        grid-template-columns: 1fr;
    }

    .row-actions {
        width: 100%;
        justify-content: space-between;
        text-align: left;
    }

    .split {
        align-items: flex-start;
        flex-direction: column;
    }

    .sidebar {
        padding: 9px 10px;
    }

    .sidebar-brand strong {
        font-size: 15px;
    }

    .sidebar-brand span {
        font-size: 10px;
    }

    .sidebar a {
        grid-template-columns: 28px max-content;
        min-height: 36px;
        padding: 4px 10px 4px 4px;
        font-size: 13px;
    }

    .sidebar a i {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    .dashboard-theme-btn {
        width: 30px;
        height: 30px;
    }
}
.plan-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding: 28px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 90% 20%, rgba(124, 196, 199, 0.35), transparent 32%),
        linear-gradient(135deg, #0d2f52, #123b66 52%, #0e5668);
    color: #ffffff;
    box-shadow: var(--shadow);
}

.plan-hero h2 {
    margin: 0 0 8px;
    font-size: clamp(30px, 4vw, 46px);
    letter-spacing: -0.05em;
}

.plan-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
}

.plan-hero .eyebrow {
    color: var(--brand-soft);
}

.upgrade-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 13px 18px;
    color: #0d2f52;
    background: #ffffff;
    text-decoration: none;
    font-weight: 900;
    white-space: nowrap;
}

.credit-panel {
    display: grid;
    gap: 14px;
    margin-bottom: 26px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(14px);
}

.credit-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 18px;
    align-items: center;
}

.credit-row strong {
    display: block;
    color: var(--ink);
    margin-bottom: 4px;
}

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

.progress {
    height: 13px;
    border-radius: 999px;
    background: var(--soft-action-bg);
    overflow: hidden;
}

.progress div {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-soft), var(--brand-2));
    transition: width 0.4s ease;
}

@media (max-width: 760px) {
    .plan-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .credit-row {
        grid-template-columns: 1fr;
    }
}
.current-badge {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 2;
    border-radius: 999px;
    padding: 7px 11px;
    font-size: 11px;
    font-weight: 900;
    color: #067647;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
}

.current-plan {
    border-color: #abefc6;
}

.plan-credit-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 20px;
}

.plan-credit-box div {
    padding: 14px;
    border-radius: 16px;
    background: var(--soft-action-bg);
    border: 1px solid var(--line);
}

.plan-credit-box strong {
    display: block;
    color: var(--brand);
    font-size: 22px;
    letter-spacing: -0.04em;
}

.plan-credit-box span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.plans-hero.compact {
    padding: 24px 28px;
}

.plans-hero.compact h2 {
    font-size: clamp(24px, 3vw, 34px);
}

.plan-compare-table {
    min-width: 1180px;
}

.plan-compare-table td:first-child,
.plan-compare-table th:first-child {
    position: sticky;
    left: 0;
    background: var(--table-head-bg);
    z-index: 2;
}

.plan-compare-table tbody td:first-child {
    background: var(--panel-solid);
}

.current-plan-row {
    background: var(--success-bg);
}

.current-plan-row td:first-child {
    background: var(--success-bg) !important;
}

.plan-mini-badge {
    display: inline-flex;
    margin-top: 6px;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    font-weight: 900;
    color: var(--brand);
    background: var(--soft-action-bg);
    border: 1px solid var(--line);
}

.plan-status.current {
    display: inline-flex;
    border-radius: 999px;
    padding: 8px 11px;
    font-size: 12px;
    font-weight: 900;
    color: #067647;
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    white-space: nowrap;
}

.table-action {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 999px;
    padding: 9px 12px;
    background: var(--brand);
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    text-decoration: none;
    white-space: nowrap;
}

/* Mobile responsiveness hardening */
@media (max-width: 640px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .shell {
        display: block;
        width: 100%;
        max-width: 100vw;
        min-width: 0;
    }

    .sidebar {
        position: sticky;
        top: 0;
        z-index: 50;
        width: 100%;
        max-width: 100vw;
        height: auto;
        overflow: hidden;
        padding: 8px 10px 9px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    }

    .sidebar-brand {
        min-width: 0;
        margin-bottom: 7px;
        padding: 0 112px 7px 0;
    }

    .sidebar-mark {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 11px;
    }

    .sidebar nav {
        display: flex;
        gap: 7px;
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 2px 0 4px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar a {
        flex: 0 0 auto;
        grid-template-columns: 28px max-content;
        min-height: 36px;
        max-width: 180px;
        padding: 4px 10px 4px 4px;
        border-radius: 11px;
        font-size: 13px;
    }

    .sidebar a i {
        width: 28px;
        height: 28px;
        border-radius: 9px;
        font-size: 16px;
    }

    .dashboard-theme-bar {
        position: absolute;
        top: 8px;
        right: 10px;
        transform: scale(0.92);
        transform-origin: top right;
    }

    .main {
        width: 100%;
        max-width: 100vw;
        min-width: 0;
        padding: 14px 12px 20px;
    }

    .topbar {
        gap: 12px;
        margin-bottom: 16px;
    }

    .topbar h1,
    h1 {
        font-size: 28px;
        line-height: 1.08;
        letter-spacing: 0;
    }

    .panel {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        padding: 16px;
        margin-bottom: 16px;
        border-radius: 16px;
    }

    .panel-head h2 {
        font-size: 20px;
        letter-spacing: 0;
    }

    .panel-head p {
        margin-bottom: 14px;
        font-size: 13px;
    }

    .split {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .panel-link {
        width: 100%;
        border-radius: 10px;
    }

    .row,
    .row-actions,
    .token-form,
    .filter-form,
    .oauth-form,
    .oauth-create-row {
        min-width: 0;
    }

    .table-wrap {
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Collapsible dashboard menu for small devices */
.sidebar-menu-toggle {
    display: none;
}

@media (max-width: 640px) {
    .sidebar {
        position: sticky;
        top: 0;
        z-index: 80;
        overflow: visible;
        padding: 8px 10px;
    }

    .sidebar-brand {
        margin-bottom: 0;
        padding: 0 96px 0 0;
        border-bottom: 0;
    }

    .sidebar-menu-toggle {
        position: absolute;
        top: 10px;
        right: 10px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        min-height: 34px;
        border: 1px solid rgba(255, 255, 255, 0.16);
        border-radius: 999px;
        padding: 6px 10px;
        color: #ffffff;
        background: rgba(255, 255, 255, 0.12);
        font: inherit;
        font-size: 13px;
        font-weight: 900;
        cursor: pointer;
    }

    .sidebar-menu-toggle i {
        font-size: 18px;
    }

    .dashboard-theme-bar {
        display: none;
    }

    .sidebar nav {
        display: none;
        margin-top: 10px;
        padding: 10px;
        max-height: calc(100vh - 76px);
        overflow-y: auto;
        overflow-x: hidden;
        border: 1px solid rgba(255, 255, 255, 0.14);
        border-radius: 14px;
        background: rgba(5, 26, 46, 0.34);
        box-shadow: 0 18px 36px rgba(0, 0, 0, 0.20);
        -webkit-overflow-scrolling: touch;
    }

    .sidebar.menu-open nav {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .sidebar nav a,
    .sidebar a {
        width: 100%;
        max-width: none;
        grid-template-columns: 32px 1fr;
        min-height: 40px;
        padding: 5px 10px 5px 5px;
        white-space: normal;
    }

    .sidebar a span {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .sidebar a i {
        width: 32px;
        height: 32px;
    }
}

/* Clickable dashboard logo */
.sidebar-brand {
    text-decoration: none;
    color: inherit;
}

.sidebar-logo {
    display: block;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    padding: 5px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

.sidebar-brand:hover .sidebar-logo {
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .sidebar-logo {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
        border-radius: 10px;
        padding: 4px;
    }
}

/* Visible dashboard wordmark logo */
.sidebar-brand {
    gap: 0;
    min-height: 54px;
}

.sidebar-brand > div {
    display: none;
}

.sidebar-logo {
    width: min(170px, 100%);
    height: 42px;
    flex: 0 1 170px;
    object-fit: contain;
    object-position: left center;
    border-radius: 10px;
    background: #ffffff;
    padding: 5px 9px;
}

@media (max-width: 640px) {
    .sidebar-brand {
        min-height: 42px;
        padding-right: 104px;
    }

    .sidebar-logo {
        width: min(140px, calc(100vw - 140px));
        height: 34px;
        flex-basis: min(140px, calc(100vw - 140px));
        padding: 4px 7px;
    }
}

/* Dashboard brand lockup: keep logo readable and text visible */
.sidebar > .sidebar-brand {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-height: 56px;
    grid-template-columns: none !important;
    margin-bottom: 16px;
    padding: 8px 8px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    color: inherit;
    text-decoration: none;
}

.sidebar > .sidebar-brand > div {
    display: block;
    min-width: 0;
}

.sidebar > .sidebar-brand .sidebar-logo {
    display: block;
    width: 112px;
    height: 36px;
    flex: 0 0 112px;
    object-fit: contain;
    object-position: left center;
    border-radius: 9px;
    background: #ffffff;
    padding: 4px 7px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.16);
}

.sidebar > .sidebar-brand strong,
.sidebar > .sidebar-brand span {
    display: block;
}

@media (max-width: 640px) {
    .sidebar > .sidebar-brand {
        gap: 8px;
        min-height: 42px;
        margin-bottom: 0;
        padding: 0 100px 0 0;
        border-bottom: 0;
    }

    .sidebar > .sidebar-brand .sidebar-logo {
        width: 94px;
        height: 30px;
        flex-basis: 94px;
        border-radius: 8px;
        padding: 3px 6px;
    }

    .sidebar > .sidebar-brand strong {
        font-size: 14px;
    }

    .sidebar > .sidebar-brand span {
        font-size: 9px;
        letter-spacing: 0.04em;
    }
}

@media (max-width: 380px) {
    .sidebar > .sidebar-brand {
        gap: 7px;
        padding-right: 92px;
    }

    .sidebar > .sidebar-brand .sidebar-logo {
        width: 82px;
        height: 28px;
        flex-basis: 82px;
    }

    .sidebar > .sidebar-brand strong {
        font-size: 13px;
    }

    .sidebar > .sidebar-brand span {
        font-size: 8px;
    }
}

/* Small-device dashboard simplification */
@media (max-width: 640px) {
    .topbar {
        align-items: stretch;
        gap: 10px;
    }

    .topbar > div:first-child {
        min-width: 0;
    }

    .topbar .eyebrow {
        display: none;
    }

    .profile {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
        border-radius: 14px;
        text-align: left;
        box-shadow: none;
    }

    .profile #userEmail,
    .profile span:not(#userRole) {
        display: none;
    }

    .profile strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .profile span {
        margin-top: 2px;
        font-size: 12px;
    }

    .plan-hero {
        gap: 12px;
        padding: 16px;
        border-radius: 16px;
    }

    .plan-hero .eyebrow,
    .plan-hero p:not(.eyebrow) {
        display: none;
    }

    .upgrade-btn {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .cards {
        gap: 10px;
        margin-bottom: 16px;
    }

    .card {
        min-height: auto;
        padding: 14px;
        border-radius: 16px;
    }

    .card::after {
        display: none;
    }

    .card span {
        margin-bottom: 8px;
        font-size: 11px;
        letter-spacing: 0.02em;
    }

    .card strong {
        font-size: 26px;
        letter-spacing: 0;
    }

    .filter-form {
        gap: 10px;
    }

    .filter-form input,
    .filter-form button {
        min-height: 42px;
    }

    .table-wrap {
        border-radius: 14px;
    }

    .report-table {
        min-width: 680px;
    }

    .report-table th,
    .report-table td {
        padding: 10px 12px;
        white-space: nowrap;
    }
}

/* White transparent dashboard logo */
.sidebar > .sidebar-brand .sidebar-logo {
    width: 118px;
    height: auto;
    max-height: 38px;
    flex: 0 0 118px;
    object-fit: contain;
    object-position: left center;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

@media (max-width: 640px) {
    .sidebar > .sidebar-brand .sidebar-logo {
        width: 96px;
        max-height: 32px;
        flex-basis: 96px;
        border-radius: 0;
        background: transparent;
        padding: 0;
        box-shadow: none;
    }
}

@media (max-width: 380px) {
    .sidebar > .sidebar-brand .sidebar-logo {
        width: 86px;
        max-height: 30px;
        flex-basis: 86px;
    }
}

/* Sidebar logo-only brand */
.sidebar > .sidebar-brand {
    justify-content: flex-start;
}

.sidebar > .sidebar-brand > div {
    display: none !important;
}

.sidebar > .sidebar-brand .sidebar-logo {
    width: min(184px, 100%);
    max-height: 42px;
    flex: 0 1 184px;
}

@media (max-width: 640px) {
    .sidebar > .sidebar-brand .sidebar-logo {
        width: 150px;
        max-height: 34px;
        flex-basis: 150px;
    }
}

@media (max-width: 380px) {
    .sidebar > .sidebar-brand .sidebar-logo {
        width: 128px;
        max-height: 31px;
        flex-basis: 128px;
    }
}
