:root {
    --bg: #0e1116;
    --bg-elevated: #141820;
    --bg-panel: #171c25;
    --bg-soft: #1c222d;
    --bg-hover: #222937;
    --primary: #e62264;
    --primary-soft: rgba(230, 34, 100, 0.14);
    --primary-deep: #b0154a;
    --text: #f2f4f8;
    --text-soft: #c3cad6;
    --muted: #8b95a7;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.12);
    --success: #2fbf71;
    --warning: #e62264;
    --danger: #ff5c7a;
    --info: #4ea1ff;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
    --sidebar-w: 272px;
    --topbar-h: 68px;
    --font: "Outfit", "Segoe UI", sans-serif;
    --display: "Syne", "Outfit", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.02em; margin: 0; }
p { margin: 0; }

.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.15rem 0.55rem 1rem 0.9rem;
    background: #12161d;
    border-right: 1px solid var(--border);
    overflow: hidden;
    z-index: 40;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-height: 0;
    overflow-y: scroll;
    overflow-x: hidden;
    padding-right: 0.35rem;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: rgba(230, 34, 100, 0.65) rgba(255, 255, 255, 0.06);
}

.sidebar nav::-webkit-scrollbar {
    width: 8px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(230, 34, 100, 0.7);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: rgba(230, 34, 100, 0.9);
    background-clip: padding-box;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.55rem 0.65rem 1rem;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-family: var(--display);
    font-weight: 800;
    font-size: 1.05rem;
    color: white;
    background: var(--primary);
}

.brand-copy { display: flex; flex-direction: column; gap: 0.1rem; }
.brand {
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
}
.brand-sub {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-section {
    margin-top: 0.55rem;
    padding: 0 0.55rem 0.25rem;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--text-soft);
    padding: 0.68rem 0.8rem;
    border-radius: 11px;
    border: 1px solid transparent;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.sidebar nav a .nav-ico {
    width: 1.55rem;
    height: 1.55rem;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar nav a:hover {
    background: var(--bg-hover);
    color: var(--text);
    transform: translateX(2px);
}

.sidebar nav a.active {
    background: var(--primary-soft);
    border-color: rgba(230, 34, 100, 0.28);
    color: #fff;
}

.sidebar nav a.active .nav-ico {
    background: var(--primary);
    color: #fff;
}

.sidebar-foot {
    margin-top: auto;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    background: var(--primary);
}

.user-meta { min-width: 0; }
.user-meta strong {
    display: block;
    font-size: 0.86rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-meta span {
    display: block;
    font-size: 0.72rem;
    color: var(--muted);
}

.logout-form button,
.btn-ghost {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--muted);
    padding: 0.65rem 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    transition: 0.18s ease;
}
.logout-form button:hover,
.btn-ghost:hover {
    color: var(--text);
    border-color: rgba(230, 34, 100, 0.45);
    background: var(--primary-soft);
}

/* ── Main column ── */
.main-column {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ── Top navbar ── */
.top-navbar,
.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    padding: 0 1.35rem;
    backdrop-filter: blur(18px);
    background: rgba(14, 17, 22, 0.82);
    border-bottom: 1px solid var(--border);
}

.top-navbar-inner {
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.top-navbar-left,
.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.top-navbar-left { flex: 1; }
.top-navbar-right { flex-shrink: 0; }

.top-navbar-title {
    min-width: 0;
}

.page-kicker {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
}

.page-title {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.nav-icon-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border);
}

#sidebar-toggle-btn {
    display: inline-grid;
    font-size: 1.15rem;
    line-height: 1;
}

.nav-search {
    position: relative;
    display: none;
    align-items: center;
}

.nav-search i {
    position: absolute;
    left: 0.85rem;
    color: var(--muted);
    font-size: 0.85rem;
    pointer-events: none;
}

.nav-search input {
    width: min(22rem, 36vw);
    height: 40px;
    padding: 0 1rem 0 2.4rem;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    outline: none;
}

.nav-search input:focus {
    border: 1px solid rgba(230, 34, 100, 0.55);
}

.nav-search input::placeholder { color: var(--muted); }

.nav-lang {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
}

.nav-bell { position: relative; }

.nav-dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px rgba(14, 17, 22, 0.9);
}

.nav-dropdown-wrap { position: relative; }

.nav-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 0.55rem);
    width: 20rem;
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    box-shadow: var(--shadow);
    overflow: hidden;
    z-index: 70;
}

.nav-dropdown.profile { width: 15.5rem; }

.nav-dropdown.hidden,
.hidden { display: none !important; }

.nav-dropdown-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
}

.nav-dropdown-head h3 {
    font-size: 0.88rem;
    font-weight: 700;
}

.nav-dropdown-head .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: #ff7aa4;
    font-size: 0.72rem;
    font-weight: 700;
}

.nav-dropdown-head.profile-head {
    justify-content: flex-start;
}

.nav-drop-name {
    font-size: 0.88rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-drop-email {
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-dropdown-body {
    max-height: 22rem;
    overflow: auto;
}

.nav-dropdown-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    color: inherit;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.nav-dropdown-item:hover { background: rgba(255, 255, 255, 0.04); }

.nav-dropdown-item strong {
    display: block;
    font-size: 0.86rem;
}

.nav-dropdown-item small {
    display: block;
    margin-top: 0.2rem;
    color: var(--muted);
    font-size: 0.75rem;
}

.nav-item-ico {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    font-size: 0.8rem;
}

.nav-item-ico.danger { background: rgba(255, 92, 122, 0.16); color: #ff7a92; }
.nav-item-ico.warn { background: rgba(230, 34, 100, 0.16); color: #ff7aa4; }
.nav-item-ico.primary { background: rgba(78, 161, 255, 0.16); color: #7cbcff; }

.nav-dropdown-menu {
    padding: 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nav-dropdown-menu a,
.nav-logout {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    border: 0;
    background: transparent;
    color: var(--text-soft);
    font-size: 0.86rem;
    cursor: pointer;
    text-align: left;
}

.nav-dropdown-menu a:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-logout { color: #ff7a92; }
.nav-logout:hover { background: rgba(255, 92, 122, 0.1); }

.nav-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.2rem 0.35rem 0.2rem 0.2rem;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-profile-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border);
}

.nav-profile-meta {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    text-align: left;
}

.nav-profile-meta strong {
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.2;
}

.nav-profile-meta small {
    font-size: 0.72rem;
    color: var(--muted);
    max-width: 10rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-chevron {
    font-size: 0.65rem;
    color: var(--muted);
}

.admin-avatar {
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    overflow: hidden;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.admin-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-avatar-sm { font-size: 0.78rem; }
.admin-avatar-md { font-size: 0.95rem; }

body.theme-light {
    --bg: #f4f6f9;
    --bg-elevated: #ffffff;
    --bg-panel: #ffffff;
    --bg-soft: #eef1f6;
    --bg-hover: #e7ebf2;
    --text: #151a22;
    --text-soft: #3d4656;
    --muted: #6b7587;
    --border: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.12);
    --shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
    background: var(--bg);
}

body.theme-light .top-navbar,
body.theme-light .sidebar {
    background: rgba(255, 255, 255, 0.9);
}

body.theme-light .nav-search input {
    background: #eef1f6;
    color: var(--text);
}

@media (min-width: 768px) {
    .nav-search { display: inline-flex; }
    .nav-profile-meta { display: flex; }
}

.content {
    flex: 1;
    padding: 1.4rem 1.5rem 2.2rem;
    animation: riseIn 0.35s ease both;
}

@keyframes riseIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.flash {
    background: var(--primary-soft);
    border: 1px solid rgba(230, 34, 100, 0.35);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}
.flash.error {
    border-color: rgba(255, 92, 122, 0.45);
    background: rgba(255, 92, 122, 0.12);
}

/* ── Dashboard ── */
.dash-hero {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

.hero-panel,
.panel,
.stat,
.quick-card,
.table-shell,
.form-card,
.login-card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
        var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.hero-panel {
    position: relative;
    overflow: hidden;
    padding: 1.45rem 1.5rem;
    min-height: 190px;
}

.hero-panel::before {
    display: none;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #ff9fbf;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 0.7rem;
}

.hero-panel h1 {
    font-size: clamp(1.55rem, 2.4vw, 2.1rem);
    max-width: 16ch;
    line-height: 1.1;
    margin-bottom: 0.55rem;
}

.hero-panel p {
    max-width: 46ch;
    color: var(--text-soft);
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.15rem;
}

.side-metrics {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 1rem;
}

.metric-tile {
    padding: 1.1rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.8rem;
}

.metric-tile.accent {
    background: var(--primary-soft);
    border-color: rgba(230, 34, 100, 0.28);
}

.metric-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-value {
    font-family: var(--display);
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.metric-foot {
    font-size: 0.78rem;
    color: var(--text-soft);
}

.section-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.35rem 0 0.85rem;
}

.section-head h2 {
    font-size: 1.05rem;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.stat {
    padding: 1.05rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 118px;
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.stat:hover {
    transform: translateY(-2px);
    border-color: rgba(230, 34, 100, 0.28);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.stat-label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.stat-ico {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: #ff8fb4;
    font-size: 0.9rem;
}

.stat strong {
    font-family: var(--display);
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.quick-card {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1.05rem;
    color: var(--text);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.quick-card:hover {
    border-color: rgba(230, 34, 100, 0.35);
    background: var(--primary-soft);
    color: #fff;
}

.quick-card span {
    color: var(--muted);
    font-size: 0.78rem;
}

.quick-card strong {
    font-family: var(--display);
    font-size: 1rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-header h1 {
    font-size: 1.55rem;
}

.table-shell {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%),
        var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-shell table {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

th, td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--muted);
    font-weight: 650;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

tbody tr:last-child td { border-bottom: none; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: #ff9fbf;
    border: 1px solid rgba(230, 34, 100, 0.25);
    font-size: 0.75rem;
    font-weight: 650;
}

.btn-primary,
.form-card button,
.search-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 11px;
    padding: 0.72rem 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-primary:hover,
.form-card button:hover,
.search-form button:hover {
    background: var(--primary-deep);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.72rem 1.05rem;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-weight: 650;
}

.btn-secondary:hover {
    border-color: rgba(230, 34, 100, 0.4);
    background: var(--primary-soft);
    color: #fff;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: var(--bg);
}

.login-card {
    width: min(420px, 92vw);
    padding: 2rem 1.7rem;
    animation: riseIn 0.4s ease both;
}

.brand-large {
    font-family: var(--display);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.login-card label,
.stack-form label,
.form-card label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.95rem;
    color: var(--muted);
    font-size: 0.86rem;
}

input, textarea, select {
    background: #10151c;
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary);
}

.checkbox {
    flex-direction: row !important;
    align-items: center;
    gap: 0.55rem !important;
}

.search-form { display: flex; gap: 0.5rem; }
.actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

.link-danger {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.setting-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: start;
}

.form-card {
    padding: 1.25rem;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1200px) {
    .stat-grid,
    .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dash-hero { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(86vw, 300px);
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        z-index: 60;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 50;
    }
    .setting-row { grid-template-columns: 1fr; }
    .content { padding: 1.1rem; }
    .top-navbar-title .page-kicker { display: none; }
}

@media (max-width: 640px) {
    .stat-grid,
    .quick-grid { grid-template-columns: 1fr; }
    .top-navbar,
    .topbar { padding: 0 0.9rem; }
    .nav-lang { display: none; }
    .top-navbar-title { display: none; }
}

/* ── Advanced dashboard ── */
.dash-wrap { display: flex; flex-direction: column; gap: 1.25rem; }

.dash-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.dash-page-head h1 {
    font-size: clamp(1.6rem, 2.4vw, 2rem);
    margin-bottom: 0.25rem;
}
.dash-date-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-panel);
    color: var(--muted);
    font-size: 0.85rem;
}
.dash-date-pill i { color: var(--primary); }

.dash-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 1.15rem;
    align-items: start;
}

.dash-main { display: flex; flex-direction: column; gap: 1.15rem; min-width: 0; }
.dash-side { display: flex; flex-direction: column; gap: 1.15rem; }

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}

.kpi-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.05rem 1.1rem;
    box-shadow: var(--shadow);
    transition: border-color 0.18s ease, transform 0.18s ease;
}
.kpi-card:hover {
    border-color: rgba(230, 34, 100, 0.35);
    transform: translateY(-2px);
}
.kpi-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
}
.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1rem;
}
.kpi-icon.pink { background: #e62264; }
.kpi-icon.blue { background: #3b82f6; }
.kpi-icon.teal { background: #14b8a6; }
.kpi-icon.rose { background: #fb7185; }
.kpi-icon.slate { background: #64748b; }
.kpi-icon.amber { background: #f97316; }
.kpi-icon.green { background: #22c55e; }
.kpi-icon.cyan { background: #06b6d4; }

.kpi-chip {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(47, 191, 113, 0.12);
    color: #2fbf71;
    border: 1px solid rgba(47, 191, 113, 0.25);
}
.kpi-chip.live {
    background: rgba(78, 161, 255, 0.12);
    color: #4ea1ff;
    border-color: rgba(78, 161, 255, 0.28);
}
.kpi-chip.warn {
    background: var(--primary-soft);
    color: #ff8fb4;
    border-color: rgba(230, 34, 100, 0.3);
}
.kpi-value {
    font-family: var(--display);
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.15rem;
}
.kpi-label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.glass-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 42%),
        rgba(23, 28, 37, 0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 1.15rem 1.2rem;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.panel-head h3 {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.panel-head h3 i { color: var(--primary); }

.earn-mini-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 1rem;
}
.earn-mini {
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.earn-mini span {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}
.earn-mini strong {
    font-family: var(--display);
    font-size: 1rem;
}
.earn-mini.pink { border-color: rgba(230, 34, 100, 0.35); background: rgba(230, 34, 100, 0.1); }
.earn-mini.blue { border-color: rgba(78, 161, 255, 0.3); background: rgba(78, 161, 255, 0.08); }
.earn-mini.teal { border-color: rgba(20, 184, 166, 0.3); background: rgba(20, 184, 166, 0.08); }
.earn-mini.green { border-color: rgba(47, 191, 113, 0.3); background: rgba(47, 191, 113, 0.08); }
.earn-mini.slate { border-color: rgba(148, 163, 184, 0.3); background: rgba(148, 163, 184, 0.08); }

.chart-box { position: relative; min-height: 320px; }
.chart-box.sm { min-height: 230px; }
.chart-box.md { min-height: 280px; }

.chart-legend { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.75rem; }
.chart-legend-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
}
.chart-legend-row .left {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--text-soft);
}
.chart-legend-row .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.chart-legend-row strong { font-size: 0.82rem; }

.tables-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.15rem;
}
.table-panel { padding: 0; overflow: hidden; }
.table-panel .panel-head {
    margin: 0;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.table-panel table {
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
}
.table-panel th { background: rgba(255, 255, 255, 0.02); }

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
}
.qa-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 1.2rem 1.15rem;
    border-radius: 18px;
    color: #fff !important;
    border: 1px solid transparent;
    box-shadow: var(--shadow);
    transition: background 0.15s ease;
}
.qa-card:hover { filter: none; }
.qa-card i.main { font-size: 1.45rem; opacity: 0.95; }
.qa-card strong {
    font-family: var(--display);
    font-size: 1.8rem;
    font-weight: 800;
}
.qa-card span { font-size: 0.85rem; opacity: 0.92; font-weight: 600; }
.qa-card.pink { background: #e62264; }
.qa-card.blue { background: #2563eb; }
.qa-card.teal { background: #0d9488; }
.qa-card.slate { background: #475569; }

@media (max-width: 1200px) {
    .dash-layout { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .earn-mini-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tables-grid,
    .quick-actions { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
    .kpi-grid,
    .earn-mini-grid,
    .tables-grid,
    .quick-actions { grid-template-columns: 1fr; }
}

