:root {
    --brand: #1e4d82;
    --brand-light: #e6f1fb;
    --success-bg: #E1F5EE; --success-text: #0F6E56;
    --warning-bg: #FAEEDA; --warning-text: #854F0B;
    --danger-bg:  #FCEBEB; --danger-text:  #A32D2D;
    --info-bg:    #E6F1FB; --info-text:    #185FA5;
    --purple-bg:  #EEEDFE; --purple-text:  #534AB7;
    --gray-bg:    #f5f5f5; --gray-text:    #5f5e5a;
    --border: #e0e0e0;
    --text:   #1a1a1a;
    --muted:  #6b7280;
    --bg:     #f3f4f6;
    --white:  #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; color: var(--text); background: var(--bg); }
a { text-decoration: none; color: inherit; }

/* ── Navbar ── */
.navbar { background: var(--brand); padding: 0 20px; display: flex; align-items: center; gap: 4px; height: 50px; position: sticky; top: 0; z-index: 1000; }
.navbar-brand { color: #fff; font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 8px; margin-right: 16px; white-space: nowrap; }
.navbar-brand i { font-size: 20px; }
.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-link { display: flex; align-items: center; gap: 5px; padding: 0 12px; height: 50px; color: rgba(255,255,255,0.85); font-size: 14px; cursor: pointer; white-space: nowrap; position: relative; }
.nav-link > i:first-child { font-size: 17px; }
.nav-link .ti-chevron-down { font-size: 12px; opacity: 0.7; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.has-dropdown { position: relative; }
.dropdown { display: none; position: absolute; top: 50px; left: 0; background: var(--white); border: 0.5px solid var(--border); border-radius: 0 0 6px 6px; min-width: 200px; z-index: 200; padding: 4px 0; box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.has-dropdown:hover .dropdown { display: block; }
.dd-item { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 14px; color: var(--text); cursor: pointer; white-space: nowrap; }
.dd-item i { font-size: 16px; color: var(--brand); }
.dd-item:hover { background: var(--bg); }
.dd-divider { height: 0.5px; background: var(--border); margin: 4px 0; }
.navbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.navbar-right i { font-size: 20px; color: rgba(255,255,255,0.8); cursor: pointer; }
.nav-avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 500; color: #fff; cursor: pointer; }

/* ── Page layout ── */
.content { padding: 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 500; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.head-btns { display: flex; gap: 8px; }

/* ── Cards ── */
.card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 0.5px solid var(--border); }
.card-title { font-size: 15px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.card-title i { font-size: 17px; color: var(--brand); }
.card-action { font-size: 13px; color: var(--brand); cursor: pointer; }
.card-body { padding: 18px; }

/* ── Metric cards ── */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.metric-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.metric-label i { font-size: 16px; }
.metric-value { font-size: 26px; font-weight: 500; }
.metric-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.metric-sub.up   { color: var(--success-text); }
.metric-sub.down { color: var(--danger-text); }
.metric-sub.warn { color: var(--warning-text); }

/* ── Grid layouts ── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }

/* ── Badges ── */
.badge { font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 500; white-space: nowrap; display: inline-block; }
.badge.success { background: var(--success-bg); color: var(--success-text); }
.badge.pending  { background: var(--warning-bg); color: var(--warning-text); }
.badge.danger   { background: var(--danger-bg);  color: var(--danger-text); }
.badge.info     { background: var(--info-bg);     color: var(--info-text); }
.badge.draft    { background: var(--gray-bg);     color: var(--gray-text); }
.badge.purple   { background: var(--purple-bg);   color: var(--purple-text); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; border-radius: 6px; font-size: 14px; cursor: pointer; font-weight: 500; border: none; }
.btn i { font-size: 16px; }
.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #163d6a; }
.btn-outline  { background: var(--white); color: var(--brand); border: 0.5px solid var(--brand); }
.btn-outline:hover { background: var(--brand-light); }
.btn-danger   { background: var(--danger-bg); color: var(--danger-text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

/* ── Forms ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-field input, .form-field select, .form-field textarea { height: 38px; padding: 0 12px; border: 0.5px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--white); color: var(--text); width: 100%; }
.form-field textarea { height: 90px; padding: 10px 12px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,77,130,0.1); }
.form-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 0.5px solid var(--border); }

/* ── Tables ── */
.table-card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--bg); }
th { padding: 12px 16px; text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); border-bottom: 0.5px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9fafb; }
td.amt { font-weight: 500; text-align: right; }

/* ── Action buttons ── */
.actions { display: flex; align-items: center; gap: 10px; }
.act-btn { font-size: 13px; color: var(--brand); cursor: pointer; background: none; border: none; display: flex; align-items: center; gap: 3px; padding: 0; }
.act-btn i { font-size: 15px; }
.act-btn.danger { color: var(--danger-text); }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 0.5px solid var(--border); }
.page-info { font-size: 13px; color: var(--muted); }
.page-btns { display: flex; gap: 4px; }
.pg-btn { height: 32px; min-width: 32px; padding: 0 10px; border: 0.5px solid var(--border); border-radius: 4px; font-size: 13px; cursor: pointer; background: var(--white); color: var(--text); display: flex; align-items: center; justify-content: center; }
.pg-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pg-btn:hover:not(.active) { background: var(--bg); }

/* ── Filters ── */
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-input  { height: 36px; padding: 0 12px; border: 0.5px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--white); color: var(--text); min-width: 200px; }
.filter-select { height: 36px; padding: 0 12px; border: 0.5px solid var(--border); border-radius: 6px; font-size: 14px; background: var(--white); color: var(--text); }
.filter-btn    { height: 36px; padding: 0 16px; background: var(--brand); color: #fff; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 0.5px solid var(--border); margin-bottom: 18px; }
.tab { padding: 10px 20px; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }
.tab:hover:not(.active) { color: var(--text); }

/* ── Toggle ── */
.toggle { width: 40px; height: 22px; border-radius: 20px; background: #ccc; position: relative; cursor: pointer; flex-shrink: 0; transition: background 0.2s; }
.toggle.on { background: var(--brand); }
.toggle::after { content: ''; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left 0.15s; }
.toggle.on::after { left: 21px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 0.5px solid var(--border); }
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-desc  { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Settings layout ── */
.settings-layout { display: flex; gap: 18px; align-items: flex-start; }
.settings-sidebar { width: 220px; flex-shrink: 0; }
.settings-nav { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.sn-section { font-size: 11px; color: var(--muted); padding: 10px 16px 4px; text-transform: uppercase; letter-spacing: 0.08em; background: var(--bg); border-bottom: 0.5px solid var(--border); border-top: 0.5px solid var(--border); }
.sn-item { display: flex; align-items: center; gap: 8px; padding: 11px 16px; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 0.5px solid var(--border); }
.sn-item:last-child { border-bottom: none; }
.sn-item i { font-size: 16px; }
.sn-item:hover { background: var(--bg); color: var(--text); }
.sn-item.active { color: var(--brand); background: var(--brand-light); font-weight: 500; }
.settings-main { flex: 1; min-width: 0; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-danger   { background: var(--danger-bg);  color: var(--danger-text); }
.alert i { font-size: 18px; }

/* ── Auth ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.auth-card { background: var(--white); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 420px; }
.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo i { font-size: 44px; color: var(--brand); }
.auth-logo h1 { font-size: 20px; font-weight: 500; margin-top: 10px; }
.auth-logo p { font-size: 14px; color: var(--muted); margin-top: 4px; }

/* ── Responsive ── */
@media (max-width: 900px) {
    .metrics { grid-template-columns: 1fr 1fr; }
    .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
}
