/* ============================================================
   Aditya PlyMart — GST Billing & Accounting
   macOS-inspired design system
   ============================================================ */

:root {
    --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
        "Helvetica Neue", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;

    --bg: #ECECEE;
    --bg-grad-1: #eef1f6;
    --bg-grad-2: #e4e7ee;

    --panel: rgba(255, 255, 255, 0.72);
    --panel-solid: #ffffff;
    --panel-2: #f7f7fa;

    --sidebar-bg: rgba(9, 45, 34, 0.86);
    --sidebar-text: rgba(255, 255, 255, 0.72);
    --sidebar-text-strong: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.10);
    --sidebar-active: rgba(255, 255, 255, 0.16);

    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #98989d;

    --accent: #15795a;
    --accent-hover: #0f5e45;
    --accent-soft: rgba(21, 121, 90, 0.12);

    --gold: #C8943B;
    --green: #28a745;
    --green-soft: rgba(40, 167, 69, 0.13);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.13);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.15);
    --purple: #bf5af2;
    --teal: #30b0c7;

    --border: rgba(0, 0, 0, 0.09);
    --border-strong: rgba(0, 0, 0, 0.14);

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

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);

    --sidebar-w: 256px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    color: var(--text);
    background: linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 14px;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 { letter-spacing: -0.02em; color: var(--text); margin: 0; font-weight: 600; }

::selection { background: var(--accent-soft); }

/* ---------- Scrollbars (mac style) ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.22); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.34); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-head {
    padding: 16px 18px 12px;
    display: flex;
    align-items: center;
    gap: 11px;
}
.traffic { display: flex; gap: 8px; padding: 2px 0 14px 2px; }
.traffic i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.traffic .r { background: #ff5f57; }
.traffic .y { background: #febc2e; }
.traffic .g { background: #28c840; }

.brand-logo {
    width: 42px; height: 42px; border-radius: 50%;
    object-fit: cover; display: block;
    box-shadow: 0 4px 12px rgba(200,148,59,0.4);
    flex-shrink: 0;
}
.brand-text b { display: block; color: var(--sidebar-text-strong); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.brand-text span { font-size: 11.5px; color: rgba(255,255,255,0.5); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 6px 12px 20px;
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); }

.nav-section { margin-top: 16px; }
.nav-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
    color: rgba(255,255,255,0.38); padding: 0 12px 6px; font-weight: 600;
}
.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px; border-radius: 8px;
    color: var(--sidebar-text); font-size: 13.5px; font-weight: 450;
    margin-bottom: 1px; cursor: pointer;
    transition: background .12s ease, color .12s ease;
    position: relative;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.92; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-strong); font-weight: 550; }
.nav-item.active::before {
    content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; background: var(--gold); border-radius: 0 3px 3px 0;
}
.nav-item .badge-count {
    margin-left: auto; background: var(--accent); color: #fff; font-size: 10.5px;
    padding: 1px 7px; border-radius: 9px; font-weight: 600;
}

.sidebar-foot {
    padding: 12px; border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px;
    cursor: pointer; transition: background .12s;
}
.sidebar-user:hover { background: var(--sidebar-hover); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(145deg, #1a8a64, #0f5e45);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}
.sidebar-user .u-name { color: var(--sidebar-text-strong); font-size: 13px; font-weight: 550; }
.sidebar-user .u-role { color: rgba(255,255,255,0.5); font-size: 11px; }

/* ---------- Main ---------- */
.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--panel);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    border-bottom: 1px solid var(--border);
    padding: 0 26px;
    height: 60px;
    display: flex; align-items: center; gap: 16px;
}
.topbar h1 { font-size: 19px; font-weight: 650; }
.topbar .crumb { color: var(--text-tertiary); font-size: 12.5px; margin-top: 1px; }
.topbar-spacer { flex: 1; }
.menu-toggle { display: none; }

.search {
    position: relative; width: 250px;
}
.search input {
    width: 100%; height: 34px; padding: 0 12px 0 32px;
    border: 1px solid var(--border); border-radius: 9px;
    background: rgba(0,0,0,0.04); font-size: 13px; color: var(--text);
    outline: none; transition: .15s; font-family: inherit;
}
.search input:focus { background: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--text-tertiary); }

.content { padding: 26px; flex: 1; }
.content-narrow { max-width: 1180px; margin: 0 auto; }

/* ============================================================
   COMPONENTS
   ============================================================ */
.card {
    background: var(--panel-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
    padding: 15px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 12px;
}
.card-head h3 { font-size: 15px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-secondary); }

.page-head {
    display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head .ph-title h2 { font-size: 24px; font-weight: 680; letter-spacing: -0.03em; }
.page-head .ph-title p { color: var(--text-secondary); font-size: 13.5px; margin: 3px 0 0; }
.page-head .ph-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 36px; padding: 0 16px;
    border-radius: 9px; border: 1px solid transparent;
    font-size: 13.5px; font-weight: 550; font-family: inherit;
    cursor: pointer; transition: .14s; white-space: nowrap; text-decoration: none;
    background: var(--panel-2); color: var(--text); line-height: 1;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: #ececf0; color: var(--text); }
.btn-primary {
    background: linear-gradient(180deg, #1a8a64, var(--accent));
    color: #fff; border-color: rgba(0,0,0,0.06);
    box-shadow: 0 1px 2px rgba(21,121,90,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}
.btn-primary:hover { background: linear-gradient(180deg, #15795a, var(--accent-hover)); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border-strong); }
.btn-ghost:hover { background: rgba(0,0,0,0.04); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-success { background: linear-gradient(180deg, #34c759, #28a745); color:#fff; }
.btn-success:hover { color: #fff; opacity: .92; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 34px; padding: 0; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Badges / chips ---------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
    background: var(--panel-2); color: var(--text-secondary); white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-soft); color: #1f8b3a; }
.badge-red { background: var(--red-soft); color: #d9342b; }
.badge-orange { background: var(--orange-soft); color: #c77700; }
.badge-blue { background: var(--accent-soft); color: var(--accent-hover); }
.badge-gray { background: rgba(0,0,0,0.06); color: var(--text-secondary); }
.badge-purple { background: rgba(191,90,242,0.14); color: #9a3fd0; }

/* ---------- KPI cards ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 22px; }
.kpi {
    background: var(--panel-solid); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.kpi .kpi-ico {
    width: 40px; height: 40px; border-radius: 11px; display:flex; align-items:center; justify-content:center;
    margin-bottom: 14px;
}
.kpi .kpi-ico svg { width: 21px; height: 21px; }
.kpi-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 2px; }
.kpi-trend { font-size: 12px; margin-top: 7px; display: inline-flex; align-items: center; gap: 4px; font-weight: 550; }
.trend-up { color: #1f8b3a; }
.trend-down { color: #d9342b; }
.ico-blue { background: var(--accent-soft); color: var(--accent); }
.ico-green { background: var(--green-soft); color: #1f8b3a; }
.ico-orange { background: var(--orange-soft); color: #c77700; }
.ico-purple { background: rgba(191,90,242,0.14); color: #9a3fd0; }
.ico-red { background: var(--red-soft); color: #d9342b; }
.ico-teal { background: rgba(48,176,199,0.15); color: #1f8294; }

/* ---------- Grid helpers ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2-1 { grid-template-columns: 2fr 1fr; }
.cols-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 980px) { .grid-2, .grid-3, .cols-2-1, .cols-1-2 { grid-template-columns: 1fr; } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
    text-align: left; padding: 11px 16px; font-size: 11.5px; font-weight: 600;
    color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 1px solid var(--border); background: var(--panel-2); white-space: nowrap;
}
table.tbl tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: rgba(21,121,90,0.045); }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
table.tbl .strong { font-weight: 600; color: var(--text); }
.t-link { font-weight: 600; color: var(--text); }
.t-link:hover { color: var(--accent); }
.t-sub { font-size: 11.5px; color: var(--text-tertiary); }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
    width: 30px; height: 30px; border-radius: 8px; border: none; background: transparent;
    color: var(--text-secondary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: .12s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px; }
@media (max-width: 760px) { .form-grid, .form-grid-3 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field.span-3 { grid-column: 1 / -1; }
@media (max-width: 760px){ .field.span-2 { grid-column: span 1; } }
label.lbl { font-size: 12.5px; font-weight: 550; color: var(--text); }
label.lbl .req { color: var(--red); }
.hint { font-size: 11.5px; color: var(--text-tertiary); }

.input, select.input, textarea.input {
    width: 100%; height: 38px; padding: 0 12px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: inherit; color: var(--text);
    background: #fff; outline: none; transition: .14s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6e73' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; cursor: pointer;
}
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-tertiary); }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.err { color: var(--red); font-size: 11.5px; }
.input-group { display: flex; }
.input-prefix {
    display: flex; align-items: center; padding: 0 11px; background: var(--panel-2);
    border: 1px solid var(--border-strong); border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--text-secondary); font-size: 13px;
}
.input-group .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- Toggle switch ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 25px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d1d1d6; border-radius: 25px; transition: .2s; cursor: pointer; }
.switch .slider:before { content:''; position: absolute; height: 21px; width: 21px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider:before { transform: translateX(17px); }
.switch-row { display: flex; align-items: center; gap: 10px; }

/* ---------- Segmented control ---------- */
.segmented { display: inline-flex; background: rgba(0,0,0,0.06); border-radius: 9px; padding: 2px; gap: 2px; }
.segmented a, .segmented button {
    padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--text-secondary);
    border: none; background: transparent; cursor: pointer; font-family: inherit; transition: .12s;
}
.segmented a.active, .segmented button.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Flash / alerts ---------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 18px;
    display: flex; align-items: center; gap: 10px; border: 1px solid transparent;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-success { background: var(--green-soft); color: #1f7a35; border-color: rgba(40,167,69,0.25); }
.alert-error { background: var(--red-soft); color: #c62d24; border-color: rgba(255,69,58,0.25); }
.alert-info { background: var(--accent-soft); color: var(--accent-hover); border-color: rgba(21,121,90,0.25); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-secondary); }
.empty svg { width: 46px; height: 46px; color: var(--text-tertiary); margin-bottom: 12px; }
.empty h4 { font-size: 16px; margin-bottom: 5px; }
.empty p { font-size: 13px; margin: 0 0 16px; }

/* ---------- Misc ---------- */
.muted { color: var(--text-secondary); }
.tiny { font-size: 11.5px; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-sm { gap: 6px; }
.mt { margin-top: 16px; } .mt-lg { margin-top: 26px; } .mb { margin-bottom: 16px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .toolbar-spacer { flex: 1; }
.list-thumb { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; background: var(--panel-2); display:flex;align-items:center;justify-content:center;color:var(--text-tertiary); font-weight:600; }

.def-list { display: grid; grid-template-columns: auto 1fr; gap: 9px 18px; font-size: 13.5px; }
.def-list dt { color: var(--text-secondary); }
.def-list dd { margin: 0; font-weight: 550; text-align: right; }

.totals { width: 320px; margin-left: auto; }
.totals .trow { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; }
.totals .trow.grand { border-top: 2px solid var(--border-strong); margin-top: 6px; padding-top: 12px; font-size: 17px; font-weight: 700; }

/* ---------- Dropdown menu ---------- */
.dropdown { position: relative; }
.menu {
    position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
    background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 100;
}
.menu a, .menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 8px;
    font-size: 13.5px; color: var(--text); background: transparent; border: none; cursor: pointer;
    font-family: inherit; text-align: left; text-decoration: none;
}
.menu a svg, .menu button svg { width: 16px; height: 16px; color: var(--text-secondary); }
.menu a:hover, .menu button:hover { background: var(--accent-soft); color: var(--accent-hover); }
.menu a:hover svg, .menu button:hover svg { color: var(--accent-hover); }
.menu .sep { height: 1px; background: var(--border); margin: 5px 0; }
.menu button.danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.pg-info { font-size: 12.5px; color: var(--text-secondary); }
.pg-links { display: flex; gap: 4px; }
.pg-btn {
    min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 550;
    color: var(--text); background: var(--panel-solid); cursor: pointer; transition: .12s;
}
.pg-btn:hover { background: var(--panel-2); color: var(--text); }
.pg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pg-btn.disabled { color: var(--text-tertiary); cursor: default; opacity: .5; }
.pg-btn.dots { border: none; background: transparent; }

/* ---------- Dialog (modal) ---------- */
dialog.mac-dialog {
    border: none; border-radius: var(--radius-lg); padding: 26px; width: 92%; max-width: 440px;
    box-shadow: var(--shadow-lg); color: var(--text);
}
dialog.mac-dialog::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(3px); }
dialog.mac-dialog h3 { font-size: 17px; }

/* ---------- Progress bar ---------- */
.progress { height: 7px; background: rgba(0,0,0,0.07); border-radius: 6px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 6px; background: var(--accent); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 30px;
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(21,121,90,0.18), transparent 60%),
        radial-gradient(900px 500px at 0% 110%, rgba(200,148,59,0.20), transparent 55%),
        linear-gradient(160deg, #f3f6f4, #e6ece9);
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--panel);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.auth-card .traffic { padding: 16px 20px 0; }
.auth-body { padding: 14px 38px 38px; }
.auth-logo {
    width: 84px; height: 84px; border-radius: 50%; margin: 6px auto 18px;
    object-fit: cover; display: block;
    box-shadow: 0 10px 26px rgba(200,148,59,0.45);
}
.auth-body h1 { font-size: 23px; text-align: center; font-weight: 680; }
.auth-body .sub { text-align: center; color: var(--text-secondary); font-size: 13.5px; margin: 6px 0 26px; }
.auth-body .field { margin-bottom: 16px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-secondary); margin-top: 20px; }
.auth-meta { text-align: center; margin-top: 22px; color: var(--text-tertiary); font-size: 11.5px; }
.checkbox-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; font-size: 13px; }
.checkbox-row label { display: flex; align-items: center; gap: 7px; color: var(--text-secondary); cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.demo-note {
    display: block; width: 100%; margin-top: 20px; padding: 11px 14px; background: rgba(21,121,90,0.07);
    border: 1px solid rgba(21,121,90,0.18); border-radius: 10px; font-size: 12px; color: var(--accent-hover);
    text-align: center; cursor: pointer; font-family: inherit; transition: .14s;
}
.demo-note:hover { background: rgba(21,121,90,0.13); border-color: rgba(21,121,90,0.35); }
.demo-note .demo-hint { display: block; margin-top: 4px; font-size: 10.5px; color: var(--text-tertiary); font-weight: 500; }

/* ============================================================
   SITE LOCK SCREEN
   ============================================================ */
.lock-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px;
    background:
        radial-gradient(1200px 700px at 50% -20%, rgba(21,121,90,0.30), transparent 60%),
        radial-gradient(900px 500px at 50% 120%, rgba(200,148,59,0.22), transparent 55%),
        linear-gradient(160deg, #07271d, #0c3a2b);
}
.lock-pop {
    width: 100%; max-width: 380px; text-align: center;
    background: rgba(255,255,255,0.10);
    -webkit-backdrop-filter: saturate(180%) blur(34px);
    backdrop-filter: saturate(180%) blur(34px);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 24px; padding: 38px 34px 30px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    animation: lockpop .35s cubic-bezier(.2,.8,.3,1);
}
@keyframes lockpop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.lock-badge {
    width: 66px; height: 66px; border-radius: 50%; margin: 0 auto 18px;
    background: linear-gradient(145deg, #1a8a64, #0f5e45);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 12px 30px rgba(21,121,90,0.5);
}
.lock-badge svg { width: 30px; height: 30px; color: #fff; }
.lock-pop h1 { color: #fff; font-size: 21px; font-weight: 650; }
.lock-pop .sub { color: rgba(255,255,255,0.6); font-size: 13.5px; margin: 8px 0 24px; }
.lock-pop .input { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); color: #fff; }
.lock-pop .input::placeholder { color: rgba(255,255,255,0.45); }
.lock-pop .input:focus { background: rgba(255,255,255,0.18); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(21,121,90,0.35); }
.lock-pop .auth-meta { color: rgba(255,255,255,0.4); }

/* ============================================================
   ERROR PAGES
   ============================================================ */
.error-card {
    width: 100%; max-width: 460px;
    background: var(--panel);
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 22px; box-shadow: var(--shadow-lg); overflow: hidden; text-align: center;
}
.error-stage { text-align: center; padding: 20px 0; max-width: 720px; margin: 0 auto; }
.error-code {
    font-size: 86px; font-weight: 800; letter-spacing: -0.04em; line-height: 1;
    background: linear-gradient(145deg, var(--accent), var(--gold));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}
.error-stage h2 { font-size: 24px; font-weight: 680; }
.error-stage h1 { font-weight: 680; }
.error-stage p { color: var(--text-secondary); font-size: 14px; margin: 8px auto 0; max-width: 460px; }
.error-links {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px auto 0; max-width: 640px;
}
.error-link {
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 10px;
    background: var(--panel-solid); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 12.5px; font-weight: 550; transition: .14s; box-shadow: var(--shadow-sm);
}
.error-link svg { width: 22px; height: 22px; color: var(--accent); }
.error-link:hover { color: var(--text); border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
@media (max-width: 680px) { .error-links { grid-template-columns: repeat(2, 1fr); } .error-code { font-size: 64px; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.backdrop { display: none; }
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 45; }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .search { width: 180px; }
}
@media (max-width: 640px) {
    .content { padding: 18px 16px; }
    .topbar { padding: 0 16px; }
    .topbar h1 { font-size: 17px; }
    .search { display: none; }
    .page-head .ph-title h2 { font-size: 20px; }
    .totals { width: 100%; }
    .kpi-value { font-size: 23px; }
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .no-print, .backdrop { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .print-area { box-shadow: none !important; border: none !important; }
}

/* ============================================================
   SETTINGS PANEL (top-right)
   ============================================================ */
.settings-menu { min-width: 252px; padding: 8px; }
.settings-title { font-weight: 600; font-size: 13.5px; padding: 5px 8px 9px; color: var(--text); }
.settings-group { padding: 6px 8px 10px; }
.settings-label {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-tertiary); font-weight: 600; margin-bottom: 9px;
    display: flex; align-items: center; justify-content: space-between;
}
.settings-val { color: var(--accent); font-weight: 700; letter-spacing: 0; text-transform: none; font-size: 12px; }
.settings-seg { display: flex; width: 100%; }
.settings-seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; }
.settings-seg svg { width: 15px; height: 15px; }
.font-stepper { display: flex; align-items: center; gap: 8px; }
.font-stepper button {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: .12s;
}
.font-stepper button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.font-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.font-stepper button svg { width: 15px; height: 15px; }
.font-preview { flex: 1; text-align: center; font-weight: 600; color: var(--text); line-height: 1; }
.font-stepper .font-default {
    width: auto; padding: 0 11px; height: 32px; font-size: 12px; font-weight: 550;
    font-family: inherit; color: var(--text-secondary);
}
.settings-reset {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px;
    background: transparent; border: none; color: var(--red); font-size: 13.5px; font-weight: 500;
    cursor: pointer; font-family: inherit; text-align: left; transition: .12s;
}
.settings-reset:hover { background: var(--red-soft); }
.settings-reset svg { width: 16px; height: 16px; }

/* ============================================================
   DARK THEME
   ============================================================ */
body.theme-dark {
    --bg: #0d1411;
    --bg-grad-1: #0c1310;
    --bg-grad-2: #0f1814;

    --panel: rgba(22, 30, 26, 0.72);
    --panel-solid: #151d19;
    --panel-2: #1b2521;

    --text: #e8edea;
    --text-secondary: #a3b2ab;
    --text-tertiary: #75857d;

    --sidebar-bg: rgba(6, 30, 23, 0.92);

    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.16);

    --accent-soft: rgba(21, 121, 90, 0.22);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.5);
}
/* ============================================================
   LOGO THEMES — deep green / black backgrounds with golden text
   ============================================================ */
body.theme-royal {
    --bg: #04211a;
    --bg-grad-1: #04211a;
    --bg-grad-2: #062a20;

    --panel: rgba(8, 42, 32, 0.74);
    --panel-solid: #07291f;
    --panel-2: #0c3727;

    --text: #f1dd9a;
    --text-secondary: #cbac5e;
    --text-tertiary: #9c8949;

    --sidebar-bg: rgba(3, 22, 16, 0.94);

    --border: rgba(230, 196, 99, 0.16);
    --border-strong: rgba(230, 196, 99, 0.26);

    --accent: #e6c463;
    --accent-hover: #f1dd9a;
    --accent-soft: rgba(230, 196, 99, 0.16);
    --gold: #e6c463;
}
body.theme-emerald {
    --bg: #052b22;
    --bg-grad-1: #05291f;
    --bg-grad-2: #073a2c;

    --panel: rgba(9, 52, 40, 0.74);
    --panel-solid: #08372a;
    --panel-2: #0e4534;

    --text: #f3e0a0;
    --text-secondary: #cdb676;
    --text-tertiary: #9ba07a;

    --sidebar-bg: rgba(4, 32, 25, 0.94);

    --border: rgba(240, 210, 122, 0.16);
    --border-strong: rgba(240, 210, 122, 0.26);

    --accent: #f0d27a;
    --accent-hover: #f7e6ad;
    --accent-soft: rgba(240, 210, 122, 0.16);
    --gold: #f0d27a;
}
body.theme-midnight {
    --bg: #0c0d0a;
    --bg-grad-1: #0b0c09;
    --bg-grad-2: #121310;

    --panel: rgba(22, 22, 18, 0.74);
    --panel-solid: #161611;
    --panel-2: #1e1e18;

    --text: #ecd690;
    --text-secondary: #bda85e;
    --text-tertiary: #8a7c48;

    --sidebar-bg: rgba(8, 8, 6, 0.95);

    --border: rgba(230, 196, 99, 0.14);
    --border-strong: rgba(230, 196, 99, 0.22);

    --accent: #e6c463;
    --accent-hover: #f1dd9a;
    --accent-soft: rgba(230, 196, 99, 0.15);
    --gold: #e6c463;
}
/* shared dark-shadow treatment for every non-light theme */
body.dark-surface {
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 1px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.5);
}
/* shared overrides for spots that hard-code light colors */
body.dark-surface .search input { background: rgba(255, 255, 255, 0.06); }
body.dark-surface .search input:focus { background: var(--panel-2); }
body.dark-surface .input,
body.dark-surface select.input,
body.dark-surface textarea.input { background: var(--panel-solid); }
body.dark-surface .btn:hover { background: rgba(255, 255, 255, 0.08); }
body.dark-surface .segmented { background: rgba(255, 255, 255, 0.07); }
body.dark-surface .segmented a.active,
body.dark-surface .segmented button.active { background: var(--panel-2); color: var(--text); }
body.dark-surface .switch .slider { background: rgba(255, 255, 255, 0.2); }
body.dark-surface .pg-btn:hover { background: var(--panel-2); }

/* gold themes: primary buttons & links use gold with dark text for contrast */
body.gold-theme .btn-primary {
    background: linear-gradient(180deg, var(--gold), #b8862c);
    color: #20180a;
    box-shadow: 0 1px 2px rgba(200, 148, 59, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
body.gold-theme .btn-primary:hover { filter: brightness(1.07); color: #20180a; }
body.gold-theme .btn-primary svg { color: #20180a; }

/* ============================================================
   THEME PICKER (inside settings panel)
   ============================================================ */
.theme-grid { display: flex; flex-direction: column; gap: 3px; }
.theme-opt {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: 9px;
    border: 1px solid transparent; background: transparent; cursor: pointer; font-family: inherit;
    font-size: 13px; color: var(--text); text-align: left; transition: .12s;
}
.theme-opt:hover { background: var(--panel-2); }
.theme-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.theme-swatch {
    width: 32px; height: 23px; border-radius: 6px; flex-shrink: 0; border: 1px solid var(--border-strong);
    display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; line-height: 1;
}
.theme-opt .t-name { flex: 1; font-weight: 550; }
.theme-opt .t-tag { font-size: 10.5px; color: var(--text-tertiary); font-weight: 500; margin-left: 2px; }
.theme-opt .t-check { width: 16px; height: 16px; color: var(--accent); opacity: 0; flex-shrink: 0; }
.theme-opt.active .t-check { opacity: 1; }
