/* ==========================================================
   GDMV ADMIN PANEL  –  UI Stylesheet
   Mobile-first, app jaisa layout + desktop sidebar dashboard
   ========================================================== */

:root {
    --navy:        #1a3668;
    --navy-dk:     #0e2247;
    --navy-lt:     #2a52a8;
    --gold:        #c8860c;
    --gold-lt:     #e8a020;
    --green:       #0d6b52;
    --green-lt:    #12a97f;
    --red:         #c0392b;

    --bg:          #f1f4fa;
    --surface:     #ffffff;
    --surface-2:   #f7f9fd;
    --border:      #e2e8f4;
    --text:        #17243c;
    --text-lt:     #64748b;
    --text-x:      #94a3b8;

    --primary:     var(--navy);
    --accent:      var(--gold);

    --sidebar-w:   264px;
    --sidebar-mini:76px;
    --topbar-h:    64px;
    --bottomnav-h: 62px;

    --radius:      14px;
    --radius-sm:   10px;
    --radius-lg:   20px;

    --shadow-xs:   0 1px 2px rgba(16,32,64,.06);
    --shadow-sm:   0 2px 10px rgba(16,32,64,.06);
    --shadow:      0 6px 24px rgba(16,32,64,.09);
    --shadow-lg:   0 18px 48px rgba(16,32,64,.16);

    --font:        'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --t:           .22s cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
    --bg:        #0d1420;
    --surface:   #151f30;
    --surface-2: #1b2740;
    --border:    #26344e;
    --text:      #e8eefb;
    --text-lt:   #9fb0cc;
    --text-x:    #6d7f9c;
    --navy:      #2a52a8;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 2px 10px rgba(0,0,0,.35);
    --shadow:    0 6px 24px rgba(0,0,0,.4);
    --shadow-lg: 0 18px 48px rgba(0,0,0,.55);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: .9rem;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { text-decoration: none; }
:focus-visible { outline: 2px solid var(--navy-lt); outline-offset: 2px; }

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120,140,175,.4); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================
   LOGIN
   ========================================================== */
.auth-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    background: radial-gradient(1200px 600px at 10% -10%, #23478f 0%, var(--navy-dk) 55%, #08152c 100%);
}
@media (min-width: 992px) { .auth-wrap { grid-template-columns: 1.05fr .95fr; } }

.auth-hero {
    display: none;
    padding: 56px 60px;
    color: #fff;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    justify-content: center;
}
@media (min-width: 992px) { .auth-hero { display: flex; } }
.auth-hero::after {
    content: '';
    position: absolute;
    width: 520px; height: 520px;
    right: -180px; bottom: -200px;
    background: radial-gradient(circle, rgba(232,160,32,.28), transparent 62%);
}
.auth-hero-logo {
    width: 84px; height: 84px; border-radius: 22px;
    background: #fff; padding: 8px; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; justify-content: center; margin-bottom: 26px;
}
.auth-hero-logo img { width: 100%; height: 100%; object-fit: contain; }
.auth-hero h1 { font-size: 2rem; font-weight: 800; line-height: 1.25; margin: 0 0 14px; }
.auth-hero p { color: rgba(255,255,255,.76); max-width: 460px; line-height: 1.8; margin: 0 0 30px; }
.auth-features { display: grid; gap: 12px; position: relative; z-index: 2; }
.auth-feature {
    display: flex; align-items: center; gap: 12px;
    font-size: .875rem; color: rgba(255,255,255,.9);
}
.auth-feature i {
    width: 36px; height: 36px; flex: none; border-radius: 11px;
    background: rgba(255,255,255,.12); display: grid; place-items: center;
    color: var(--gold-lt); font-size: 1rem;
}

.auth-panel {
    display: flex; align-items: center; justify-content: center;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    background: var(--surface);
}
@media (max-width: 991.98px) { .auth-panel { background: transparent; } }

.auth-card {
    width: 100%; max-width: 410px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 34px 30px;
    box-shadow: var(--shadow-lg);
}
@media (min-width: 992px) { .auth-card { box-shadow: none; padding: 0; } }
.auth-mobile-logo {
    width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px;
    background: #fff; padding: 7px; box-shadow: var(--shadow);
    display: grid; place-items: center;
}
.auth-mobile-logo img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 992px) { .auth-mobile-logo { display: none; } }
.auth-card h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 6px; color: var(--text); }
.auth-card .auth-sub { color: var(--text-lt); font-size: .875rem; margin-bottom: 26px; }

/* ==========================================================
   LAYOUT
   ========================================================== */
.admin-body { min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--navy-dk), #122a56 60%, #0b1c3b);
    color: #fff;
    display: flex; flex-direction: column;
    z-index: 1045;
    transition: transform var(--t), width var(--t);
    box-shadow: 4px 0 28px rgba(6,18,40,.22);
}
.sidebar-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px; min-height: var(--topbar-h);
    border-bottom: 1px solid rgba(255,255,255,.09);
}
.sidebar-logo {
    width: 42px; height: 42px; flex: none; border-radius: 12px;
    background: #fff; padding: 5px; display: grid; place-items: center;
}
.sidebar-logo img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-brand { min-width: 0; }
.sidebar-brand strong { display: block; font-size: .92rem; font-weight: 700; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-brand span { font-size: .7rem; color: rgba(255,255,255,.6); }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 14px 12px 20px;
    scrollbar-width: thin;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); }

.nav-label {
    font-size: .66rem; letter-spacing: 1.4px; text-transform: uppercase;
    color: rgba(255,255,255,.4); font-weight: 600;
    padding: 16px 12px 8px; white-space: nowrap;
}
.nav-item-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; margin-bottom: 2px;
    border-radius: 11px; color: rgba(255,255,255,.78);
    font-size: .855rem; font-weight: 500;
    transition: var(--t); position: relative; white-space: nowrap;
}
.nav-item-link i:first-child { font-size: 1.05rem; width: 22px; text-align: center; flex: none; }
.nav-item-link:hover { background: rgba(255,255,255,.09); color: #fff; }
.nav-item-link.active {
    background: linear-gradient(90deg, rgba(232,160,32,.22), rgba(232,160,32,.05));
    color: #fff; font-weight: 600;
    box-shadow: inset 3px 0 0 var(--gold-lt);
}
.nav-item-link .nav-badge {
    margin-left: auto; background: var(--gold); color: #1a1200;
    font-size: .66rem; font-weight: 700; padding: 2px 7px; border-radius: 20px;
}
.sidebar-foot {
    padding: 12px; border-top: 1px solid rgba(255,255,255,.09);
    display: flex; align-items: center; gap: 10px;
}
.sidebar-user-avatar {
    width: 38px; height: 38px; flex: none; border-radius: 12px; overflow: hidden;
    background: linear-gradient(135deg, var(--gold), var(--gold-lt));
    display: grid; place-items: center; color: #241800; font-weight: 700; font-size: .9rem;
}
.sidebar-user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-info strong { display: block; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info span { font-size: .68rem; color: rgba(255,255,255,.55); text-transform: capitalize; }

/* Collapsed (icon rail) – desktop only */
@media (min-width: 992px) {
    .app.sidebar-mini .sidebar { width: var(--sidebar-mini); }
    .app.sidebar-mini .sidebar-brand,
    .app.sidebar-mini .nav-label,
    .app.sidebar-mini .nav-item-link span,
    .app.sidebar-mini .nav-item-link .nav-badge,
    .app.sidebar-mini .sidebar-user-info,
    .app.sidebar-mini .sidebar-foot .btn { display: none; }
    .app.sidebar-mini .nav-item-link { justify-content: center; padding: 12px; }
    .app.sidebar-mini .sidebar-head { justify-content: center; padding: 18px 8px; }
    .app.sidebar-mini .main { margin-left: var(--sidebar-mini); }
    .app.sidebar-mini .topbar { left: var(--sidebar-mini); }
}

.main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin var(--t);
}

.topbar {
    position: fixed; top: 0; right: 0; left: var(--sidebar-w);
    height: var(--topbar-h);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 10px;
    padding: 0 16px; z-index: 1030;
    transition: left var(--t);
}
.topbar-title { min-width: 0; }
.topbar-title h1 {
    font-size: 1.02rem; font-weight: 700; margin: 0; line-height: 1.2;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-title p { margin: 0; font-size: .72rem; color: var(--text-lt); }

.icon-btn {
    width: 40px; height: 40px; flex: none;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: 12px; color: var(--text-lt);
    display: grid; place-items: center; font-size: 1.05rem;
    transition: var(--t); position: relative; cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--navy); border-color: var(--navy-lt); }
.icon-btn .dot {
    position: absolute; top: 7px; right: 8px;
    min-width: 16px; height: 16px; padding: 0 4px;
    background: var(--red); color: #fff; border-radius: 20px;
    font-size: .6rem; font-weight: 700; display: grid; place-items: center;
    border: 2px solid var(--surface);
}

.content {
    flex: 1;
    padding: calc(var(--topbar-h) + 20px) 20px 28px;
}

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: 290px; }
    .app.sidebar-open .sidebar { transform: none; }
    .main { margin-left: 0; }
    .topbar { left: 0; padding: 0 12px; }
    .content {
        padding: calc(var(--topbar-h) + 14px) 14px calc(var(--bottomnav-h) + 28px + env(safe-area-inset-bottom));
    }
    .sidebar-backdrop {
        position: fixed; inset: 0; background: rgba(8,18,38,.55);
        backdrop-filter: blur(2px); z-index: 1040; opacity: 0; visibility: hidden;
        transition: var(--t);
    }
    .app.sidebar-open .sidebar-backdrop { opacity: 1; visibility: visible; }
}

/* Mobile bottom navigation – app feel */
.bottom-nav { display: none; }
@media (max-width: 991.98px) {
    .bottom-nav {
        position: fixed; bottom: 0; left: 0; right: 0;
        height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        background: color-mix(in srgb, var(--surface) 92%, transparent);
        backdrop-filter: saturate(180%) blur(16px);
        border-top: 1px solid var(--border);
        display: flex; align-items: stretch; z-index: 1035;
        box-shadow: 0 -6px 24px rgba(16,32,64,.08);
    }
    .bottom-nav a {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; color: var(--text-x); font-size: .64rem; font-weight: 600;
        transition: var(--t); position: relative;
    }
    .bottom-nav a i { font-size: 1.22rem; }
    .bottom-nav a.active { color: var(--navy); }
    [data-theme="dark"] .bottom-nav a.active { color: var(--gold-lt); }
    .bottom-nav a.active::before {
        content: ''; position: absolute; top: 0; width: 34px; height: 3px;
        border-radius: 0 0 4px 4px; background: var(--gold);
    }
    .bottom-nav .bn-fab {
        flex: none; width: 62px;
    }
    .bottom-nav .bn-fab span.fab {
        width: 50px; height: 50px; border-radius: 17px; margin-top: -22px;
        background: linear-gradient(135deg, var(--navy-lt), var(--navy));
        color: #fff; display: grid; place-items: center; font-size: 1.4rem;
        box-shadow: 0 8px 20px rgba(26,54,104,.38);
    }
}

/* ==========================================================
   COMPONENTS
   ========================================================== */
.card-x {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}
.card-x-head {
    padding: 16px 18px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.card-x-head h2, .card-x-head h3 { font-size: .98rem; font-weight: 700; margin: 0; }
.card-x-body { padding: 18px; }

.page-head {
    display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.page-head .ph-icon {
    width: 46px; height: 46px; border-radius: 14px; flex: none;
    background: linear-gradient(135deg, var(--navy), var(--navy-lt));
    color: #fff; display: grid; place-items: center; font-size: 1.25rem;
    box-shadow: 0 8px 20px rgba(26,54,104,.26);
}
.page-head h1 { font-size: 1.28rem; font-weight: 800; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--text-lt); font-size: .8rem; }

/* Stat tiles */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (max-width: 575.98px) { .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; } }
.stat-tile {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px;
    box-shadow: var(--shadow-xs); transition: var(--t);
    display: flex; flex-direction: column; gap: 10px; min-width: 0;
}
.stat-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-tile .st-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-tile .st-icon {
    width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
    font-size: 1.12rem;
}
.stat-tile .st-value { font-size: 1.65rem; font-weight: 800; line-height: 1; }
.stat-tile .st-label { font-size: .74rem; color: var(--text-lt); font-weight: 500; }
@media (max-width: 575.98px) {
    .stat-tile { padding: 13px; }
    .stat-tile .st-value { font-size: 1.35rem; }
}

.soft-blue   { background: rgba(42,82,168,.12);  color: #2a52a8; }
.soft-green  { background: rgba(13,107,82,.12);  color: #0d6b52; }
.soft-gold   { background: rgba(200,134,12,.14); color: #a86f06; }
.soft-red    { background: rgba(192,57,43,.12);  color: #c0392b; }
.soft-purple { background: rgba(108,63,182,.12); color: #6c3fb6; }
.soft-cyan   { background: rgba(0,131,143,.12);  color: #00838f; }

/* Quick action tiles */
.quick-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
@media (max-width: 575.98px) { .quick-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; } }
.quick-tile {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 15px 12px; text-align: center; color: var(--text);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: var(--t); box-shadow: var(--shadow-xs);
}
.quick-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--navy); border-color: var(--navy-lt); }
.quick-tile i { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; font-size: 1.2rem; }
.quick-tile span { font-size: .74rem; font-weight: 600; line-height: 1.3; }

/* Table */
.table-x-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-x { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .84rem; }
.table-x thead th {
    background: var(--surface-2); color: var(--text-lt);
    font-size: .68rem; text-transform: uppercase; letter-spacing: .8px; font-weight: 700;
    padding: 11px 14px; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2;
}
.table-x tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table-x tbody tr:last-child td { border-bottom: 0; }
.table-x tbody tr { transition: background .15s; }
.table-x tbody tr:hover { background: var(--surface-2); }
.table-x .cell-title { font-weight: 600; color: var(--text); }
.table-x .cell-muted { color: var(--text-lt); font-size: .78rem; }
.thumb {
    width: 46px; height: 46px; border-radius: 11px; object-fit: cover;
    background: var(--surface-2); border: 1px solid var(--border);
}
.thumb-empty {
    width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center;
    background: var(--surface-2); border: 1px dashed var(--border); color: var(--text-x); font-size: 1.05rem;
}
.drag-handle { cursor: grab; color: var(--text-x); font-size: 1.05rem; }
.drag-handle:active { cursor: grabbing; }
tr.dragging { opacity: .45; }

/* Mobile: table -> cards */
@media (max-width: 767.98px) {
    .table-x.responsive-cards thead { display: none; }
    .table-x.responsive-cards, .table-x.responsive-cards tbody, .table-x.responsive-cards tr, .table-x.responsive-cards td { display: block; width: 100%; }
    .table-x.responsive-cards tr {
        background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); margin-bottom: 11px; padding: 6px 4px;
        box-shadow: var(--shadow-xs);
    }
    .table-x.responsive-cards td {
        border: 0; padding: 7px 13px; display: flex; align-items: center;
        justify-content: space-between; gap: 14px; text-align: right;
    }
    .table-x.responsive-cards td::before {
        content: attr(data-label); font-size: .68rem; text-transform: uppercase;
        letter-spacing: .6px; color: var(--text-x); font-weight: 700;
        text-align: left; flex: none;
    }
    .table-x.responsive-cards td[data-label=""]::before { display: none; }
    .table-x.responsive-cards td.cell-main {
        border-bottom: 1px solid var(--border); padding-bottom: 11px; margin-bottom: 4px;
    }
}

/* Badges & switches */
.badge-x {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 20px;
    font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.badge-on  { background: rgba(13,107,82,.13);  color: #0d6b52; }
.badge-off { background: rgba(148,163,184,.18); color: #64748b; }

.switch-x { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch-x input { opacity: 0; width: 0; height: 0; }
.switch-x span {
    position: absolute; cursor: pointer; inset: 0; border-radius: 24px;
    background: #cbd5e1; transition: var(--t);
}
.switch-x span::before {
    content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: var(--t); box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch-x input:checked + span { background: var(--green); }
.switch-x input:checked + span::before { transform: translateX(18px); }

/* Buttons */
.btn-x {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: 11px; border: 1px solid transparent;
    font-size: .82rem; font-weight: 600; cursor: pointer; transition: var(--t);
    line-height: 1.3; white-space: nowrap;
}
.btn-primary-x { background: linear-gradient(135deg, var(--navy), var(--navy-lt)); color: #fff; box-shadow: 0 6px 16px rgba(26,54,104,.26); }
.btn-primary-x:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(26,54,104,.34); }
.btn-gold-x { background: linear-gradient(135deg, var(--gold), var(--gold-lt)); color: #241800; }
.btn-gold-x:hover { color: #241800; transform: translateY(-1px); }
.btn-light-x { background: var(--surface); border-color: var(--border); color: var(--text-lt); }
.btn-light-x:hover { background: var(--surface-2); color: var(--navy); border-color: var(--navy-lt); }
.btn-danger-x { background: rgba(192,57,43,.1); color: var(--red); border-color: rgba(192,57,43,.2); }
.btn-danger-x:hover { background: var(--red); color: #fff; }
.btn-sm-x { padding: 6px 11px; font-size: .76rem; border-radius: 9px; }
.btn-block-x { width: 100%; }
.btn-icon-x { width: 34px; height: 34px; padding: 0; border-radius: 10px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.fg-12 { grid-column: span 12; } .fg-6 { grid-column: span 6; }
.fg-4  { grid-column: span 4; }  .fg-3 { grid-column: span 3; } .fg-8 { grid-column: span 8; }
@media (max-width: 767.98px) { .fg-6, .fg-4, .fg-3, .fg-8 { grid-column: span 12; } }

.field label.fl {
    display: block; font-size: .76rem; font-weight: 600; color: var(--text-lt);
    margin-bottom: 6px; letter-spacing: .2px;
}
.field label.fl .req { color: var(--red); }
.input-x, .select-x, textarea.input-x {
    width: 100%; padding: 11px 13px; font-size: .86rem; font-family: var(--font);
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    transition: var(--t); appearance: none;
}
.input-x:focus, .select-x:focus {
    outline: none; border-color: var(--navy-lt);
    box-shadow: 0 0 0 3.5px rgba(42,82,168,.13);
}
.select-x {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
    padding-right: 34px;
}
textarea.input-x { min-height: 110px; resize: vertical; line-height: 1.7; }
.field .fhelp { font-size: .72rem; color: var(--text-x); margin-top: 5px; }
.field .ferror { font-size: .72rem; color: var(--red); margin-top: 5px; font-weight: 500; }
.input-x.is-invalid { border-color: var(--red); }

.check-row {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 13px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--surface-2);
}
.check-row .cr-text { font-size: .82rem; font-weight: 500; }
.check-row .cr-help { font-size: .71rem; color: var(--text-x); }

/* File / image upload */
.upload-box {
    border: 1.5px dashed var(--border); border-radius: var(--radius);
    padding: 16px; background: var(--surface-2);
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    transition: var(--t);
}
.upload-box:hover { border-color: var(--navy-lt); }
.upload-preview {
    width: 84px; height: 84px; border-radius: 13px; flex: none;
    background: var(--surface); border: 1px solid var(--border);
    display: grid; place-items: center; overflow: hidden; color: var(--text-x); font-size: 1.5rem;
}
.upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.upload-meta { flex: 1; min-width: 160px; }

/* Sticky form actions on mobile */
.form-actions {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    padding: 16px 18px; border-top: 1px solid var(--border);
    background: var(--surface); border-radius: 0 0 var(--radius) var(--radius);
}
@media (max-width: 767.98px) {
    .form-actions {
        position: sticky; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
        z-index: 20; box-shadow: 0 -6px 18px rgba(16,32,64,.1);
        border-radius: var(--radius);
    }
    .form-actions .btn-x { flex: 1; }
}

/* Toolbar / search */
.toolbar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
    margin-bottom: 16px;
}
.search-x { position: relative; flex: 1; min-width: 180px; }
.search-x i {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--text-x); font-size: .95rem;
}
.search-x input { padding-left: 38px; }

/* Empty state */
.empty-x { text-align: center; padding: 46px 20px; }
.empty-x i {
    width: 74px; height: 74px; margin: 0 auto 16px; border-radius: 24px;
    background: var(--surface-2); color: var(--text-x);
    display: grid; place-items: center; font-size: 2rem;
}
.empty-x h4 { font-size: 1rem; font-weight: 700; margin: 0 0 6px; }
.empty-x p { color: var(--text-lt); font-size: .82rem; margin: 0 0 18px; }

/* Pagination */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; padding: 14px; }
.pager a, .pager span {
    min-width: 36px; height: 36px; padding: 0 10px; border-radius: 10px;
    display: grid; place-items: center; font-size: .8rem; font-weight: 600;
    border: 1px solid var(--border); color: var(--text-lt); background: var(--surface);
    transition: var(--t);
}
.pager a:hover { border-color: var(--navy-lt); color: var(--navy); }
.pager .current { background: var(--navy); border-color: var(--navy); color: #fff; }
.pager .disabled { opacity: .45; pointer-events: none; }

/* Tabs */
.tabs-x { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.tabs-x::-webkit-scrollbar { display: none; }
.tabs-x a {
    padding: 9px 16px; border-radius: 11px; font-size: .82rem; font-weight: 600;
    color: var(--text-lt); background: var(--surface); border: 1px solid var(--border);
    white-space: nowrap; transition: var(--t); display: inline-flex; align-items: center; gap: 7px;
}
.tabs-x a:hover { color: var(--navy); border-color: var(--navy-lt); }
.tabs-x a.active { background: linear-gradient(135deg, var(--navy), var(--navy-lt)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(26,54,104,.24); }

/* Toast */
.toast-wrap {
    position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px;
    z-index: 1080; display: flex; flex-direction: column; gap: 10px;
    max-width: min(360px, calc(100vw - 32px));
}
@media (max-width: 767.98px) { .toast-wrap { left: 12px; right: 12px; max-width: none; } }
.toast-x {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 4px solid var(--navy); border-radius: 12px;
    padding: 13px 15px; box-shadow: var(--shadow-lg);
    display: flex; align-items: flex-start; gap: 11px;
    font-size: .84rem; animation: toastIn .3s ease;
}
.toast-x.success { border-left-color: var(--green); }
.toast-x.danger  { border-left-color: var(--red); }
.toast-x.warning { border-left-color: var(--gold); }
.toast-x i { font-size: 1.1rem; line-height: 1.3; }
.toast-x.success i { color: var(--green); }
.toast-x.danger i  { color: var(--red); }
.toast-x.warning i { color: var(--gold); }
.toast-x.info i    { color: var(--navy-lt); }
.toast-x .tclose { margin-left: auto; background: none; border: 0; color: var(--text-x); cursor: pointer; font-size: 1rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-x {
    position: fixed; inset: 0; z-index: 1090;
    background: rgba(10,20,40,.55); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-x.open { display: flex; }
.modal-x-card {
    background: var(--surface); border-radius: var(--radius-lg);
    width: 100%; max-width: 400px; padding: 26px;
    box-shadow: var(--shadow-lg); text-align: center;
    animation: modalIn .25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-x-card .mi {
    width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 20px;
    display: grid; place-items: center; font-size: 1.7rem;
    background: rgba(192,57,43,.1); color: var(--red);
}
.modal-x-card h3 { font-size: 1.08rem; font-weight: 700; margin: 0 0 8px; }
.modal-x-card p { color: var(--text-lt); font-size: .84rem; margin: 0 0 22px; }

/* Dropdown */
.dropdown-x { position: relative; }
.dropdown-x-menu {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 210px; padding: 7px; z-index: 1050;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: var(--t);
}
.dropdown-x.open .dropdown-x-menu { opacity: 1; visibility: visible; transform: none; }
.dropdown-x-menu a, .dropdown-x-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: 9px; font-size: .82rem; color: var(--text);
    background: none; border: 0; cursor: pointer; text-align: left; transition: var(--t);
}
.dropdown-x-menu a:hover, .dropdown-x-menu button:hover { background: var(--surface-2); color: var(--navy); }
.dropdown-x-divider { height: 1px; background: var(--border); margin: 6px 0; }

/* Icon picker */
.icon-picker-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
    gap: 8px; max-height: 260px; overflow-y: auto; padding: 4px;
}
.icon-pick {
    aspect-ratio: 1; border: 1px solid var(--border); border-radius: 11px;
    display: grid; place-items: center; font-size: 1.15rem; cursor: pointer;
    background: var(--surface); color: var(--text-lt); transition: var(--t);
}
.icon-pick:hover, .icon-pick.selected { border-color: var(--navy-lt); color: var(--navy); background: rgba(42,82,168,.08); }

/* Misc */
.divider-x { height: 1px; background: var(--border); margin: 18px 0; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
    border-radius: 20px; font-size: .72rem; font-weight: 600;
    background: var(--surface-2); color: var(--text-lt); border: 1px solid var(--border);
}
.list-tight > * + * { margin-top: 11px; }
.text-lt { color: var(--text-lt); }
.text-x  { color: var(--text-x); }
.fw-7 { font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }

.activity-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.activity-row:last-child { border-bottom: 0; }
.activity-dot {
    width: 32px; height: 32px; flex: none; border-radius: 10px;
    display: grid; place-items: center; font-size: .9rem;
}

.mini-bar { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 10px; }
.mini-bar .mb-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mini-bar .mb-fill {
    width: 100%; border-radius: 7px 7px 3px 3px; min-height: 4px;
    background: linear-gradient(180deg, var(--navy-lt), var(--navy));
    transition: height .5s ease;
}
.mini-bar .mb-lbl { font-size: .66rem; color: var(--text-x); font-weight: 600; }

/* Print / a11y */
@media print { .sidebar, .topbar, .bottom-nav, .form-actions { display: none !important; } .main { margin: 0; } .content { padding: 0; } }
