:root {
  --ink: #17243c;
  --muted: #718096;
  --line: #dfe6f1;
  --soft-line: #edf1f6;
  --canvas: #f3f6fb;
  --surface: #ffffff;
  --navy: #102a49;
  --navy-2: #173b65;
  --green: #13816a;
  --green-soft: #e7f6f1;
  --orange: #bd5c3d;
  --orange-soft: #fff0ea;
  --blue-soft: #eaf1f8;
  --shadow: 0 12px 34px rgba(26, 48, 81, 0.08);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; font-size: 16px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 13% 5%, rgba(91, 194, 175, 0.18), transparent 28rem),
    linear-gradient(132deg, #0d2644 0%, #102f52 48%, #174e67 100%);
  color: white;
  padding: 28px clamp(22px, 5vw, 72px) 42px;
}

.login-brand, .sidebar-brand { display: flex; align-items: center; gap: 12px; }
.login-brand strong, .sidebar-brand strong { display: block; font-size: 18px; letter-spacing: -0.02em; }
.login-brand span { display: block; margin-top: 1px; color: #a9bbce; font-size: 13px; }
.brand-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 15px; background: #69cfbc; color: #0f304e; font-weight: 800; box-shadow: inset 0 0 0 1px rgba(255,255,255,.3); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; }

.login-layout { width: min(1160px, 100%); margin: clamp(54px, 10vh, 105px) auto 0; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); gap: clamp(50px, 8vw, 110px); align-items: center; }
.eyebrow { display: inline-flex; padding: 6px 10px; border: 1px solid rgba(121, 217, 199, .38); border-radius: 999px; color: #8de1d1; font-size: 12px; font-weight: 700; letter-spacing: .12em; }
.login-copy h1 { max-width: 650px; margin: 22px 0 18px; font-size: clamp(42px, 6vw, 72px); line-height: 1.02; letter-spacing: -.06em; }
.login-copy > p { max-width: 620px; margin: 0; color: #c4d2e0; font-size: 18px; line-height: 1.75; }
.permission-list { margin-top: 42px; display: grid; gap: 16px; }
.permission-list > div { display: flex; align-items: center; gap: 15px; }
.permission-list span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.08); color: #7fd7c7; font-size: 12px; font-weight: 800; }
.permission-list p { margin: 0; color: #b9c8d7; }
.permission-list strong { color: white; }

.login-card { background: white; color: var(--ink); border: 1px solid rgba(255,255,255,.5); border-radius: 24px; padding: 28px; box-shadow: 0 28px 80px rgba(0, 14, 34, .35); }
.login-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.login-card h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.login-card-head p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.demo-pill { padding: 5px 8px; border-radius: 8px; background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.demo-accounts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 24px 0 20px; }
.demo-account { padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: #f9fbfd; color: #465571; text-align: left; font-size: 13px; font-weight: 650; transition: .15s ease; }
.demo-account:hover, .demo-account.active { border-color: #5da99b; background: #edf9f6; color: #126c5b; transform: translateY(-1px); }

.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #42516a; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #d6deea; border-radius: 10px; background: white; color: var(--ink); padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: #4a9d8d; box-shadow: 0 0 0 3px rgba(74,157,141,.13); }
.form-error { min-height: 19px; margin: -4px 0 0; color: #b84c39; font-size: 13px; }
.login-footer { display: flex; justify-content: center; gap: 5px; margin-top: 20px; color: var(--muted); font-size: 13px; }
.text-button { border: 0; background: transparent; padding: 0; color: #176c83; font-weight: 700; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; font-weight: 700; font-size: 14px; transition: .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button-primary { background: var(--navy-2); color: white; box-shadow: 0 5px 14px rgba(23,59,101,.16); }
.button-primary:hover { background: #0e3157; }
.button-secondary { background: white; color: #34445f; border-color: var(--line); }
.button-danger { background: var(--orange-soft); color: #a9472f; border-color: #f6d5c9; }
.button-success { background: var(--green-soft); color: #116b59; border-color: #c8eadf; }
.button-small { padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.button-large { min-height: 46px; }
.icon-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: #617089; }
.icon-button:hover { background: #eef3f8; color: var(--navy-2); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); background: var(--canvas); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--navy); color: white; padding: 22px 14px; }
.sidebar-brand { padding: 0 10px 24px; }
.main-nav { display: grid; gap: 5px; margin-top: 10px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 11px; background: transparent; color: #b7c8d9; padding: 11px 13px; text-align: left; font-size: 14px; font-weight: 650; }
.nav-button:hover { background: rgba(255,255,255,.07); color: white; }
.nav-button.active { background: rgba(255,255,255,.12); color: white; box-shadow: inset 3px 0 #6fd3c0; }
.nav-icon { width: 23px; color: #77cfbf; font-size: 15px; text-align: center; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 999px; background: #d96c4c; color: white; font-size: 11px; text-align: center; }
.sidebar-foot { margin-top: auto; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 13px; background: rgba(255,255,255,.05); }
.sidebar-foot span, .sidebar-foot small { display: block; }
.sidebar-foot span { font-size: 13px; font-weight: 700; }
.sidebar-foot small { margin-top: 2px; color: #91a8bf; font-size: 11px; }

.app-main { min-width: 0; }
.topbar { min-height: 76px; display: flex; align-items: center; gap: 16px; padding: 13px clamp(18px, 3vw, 34px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.account-chip { display: flex; align-items: center; gap: 10px; border-left: 1px solid var(--line); padding-left: 14px; }
.account-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--blue-soft); color: var(--navy-2); font-weight: 800; }
.account-chip strong, .account-chip span { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip strong { font-size: 13px; }
.account-chip span { margin-top: 1px; color: var(--muted); font-size: 11px; }
.content { max-width: 1510px; margin: 0 auto; padding: 25px clamp(18px, 3vw, 34px) 50px; outline: none; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.page-heading h2 { margin: 0; font-size: clamp(24px, 2.5vw, 32px); letter-spacing: -.045em; }
.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 9px; }
.filter-select { width: auto; min-width: 130px; padding: 8px 11px; font-size: 13px; }
.page-heading-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.overview-range-toolbar { display: flex; justify-content: flex-end; margin-bottom: 13px; }
.date-range-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.date-range-filter label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 750; }
.date-range-filter input { width: 138px; min-height: 34px; padding: 6px 8px; font-size: 12px; color-scheme: dark; }
.date-dmy-input { font-variant-numeric: tabular-nums; letter-spacing: .025em; }
.date-input-shell { position: relative; display: block; width: 138px; }
.date-entry-shell { width: 100%; }
.date-input-shell .date-dmy-input { width: 100%; padding-right: 34px; }
.date-picker-icon { position: absolute; z-index: 1; right: 10px; top: 50%; color: var(--muted); font-size: 13px; line-height: 1; transform: translateY(-50%); pointer-events: none; }
.native-date-picker { position: absolute; z-index: 2; right: 0; top: 0; width: 34px !important; height: 100%; min-height: 0 !important; margin: 0; padding: 0 !important; border: 0; opacity: 0; cursor: pointer; }
.date-input-shell:focus-within .date-picker-icon { color: var(--gold); }
.date-range-arrow { color: var(--muted); font-size: 12px; }
.range-error-panel { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border: 1px solid rgba(241,111,104,.38); border-radius: var(--radius); background: var(--orange-soft); color: var(--orange); }
.range-error-panel strong, .range-error-panel span { display: block; }
.range-error-panel span { color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.metric-card { padding: 18px; }
.metric-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 8px; font-size: clamp(25px, 2.4vw, 32px); font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.metric-note { margin-top: 5px; color: #8b98aa; font-size: 12px; }
.metric-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--blue-soft); color: var(--navy-2); font-weight: 800; }
.metric-card.green .metric-icon { background: var(--green-soft); color: var(--green); }
.metric-card.orange .metric-icon { background: var(--orange-soft); color: var(--orange); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .7fr); gap: 15px; margin-top: 15px; }
.panel { overflow: hidden; }
.panel-pad { padding: 19px; }
.panel-head { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--soft-line); }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.status-pill, .role-pill { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 8px; background: #eef3f8; color: #52637e; font-size: 11px; font-weight: 750; }
.status-pill.active, .status-pill.paid { background: var(--green-soft); color: var(--green); }
.status-pill.pending, .status-pill.unpaid { background: #fff4df; color: #986316; }
.status-pill.rejected, .status-pill.suspended { background: var(--orange-soft); color: var(--orange); }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 11px 12px; background: #f8fafc; color: #66758d; font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; text-align: left; white-space: nowrap; }
td { padding: 12px; border-top: 1px solid var(--soft-line); white-space: nowrap; }
tbody tr:hover { background: #fbfcfe; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.positive { color: var(--green); font-weight: 750; }
.negative { color: var(--orange); }
.cash-metrics { margin-bottom: 15px; }
.cash-balance { color: var(--ink); font-weight: 800; }
.cash-opening-row td { background: rgba(230, 170, 75, .06); }
.cash-source { display: inline-flex; margin-right: 8px; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 750; }
.cash-source.ledger { border-color: rgba(98,197,139,.25); background: var(--green-soft); color: var(--green); }
.cash-source.manual { border-color: rgba(230,170,75,.28); background: var(--gold-soft); color: var(--gold); }
.receipt-status-button { border: 1px solid transparent; cursor: pointer; }
.receipt-status-button:hover { filter: brightness(1.15); transform: translateY(-1px); }
.receipt-status-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cash-pending-amount { color: var(--muted); }
.cash-preview strong { font-size: 14px; }
.cell-main { font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; color: #8b98aa; font-size: 11px; }

.bar-chart { height: 220px; display: flex; align-items: end; justify-content: space-between; gap: 14px; padding: 18px 8px 4px; }
.bar-item { height: 100%; flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 7px; }
.bar-value { color: #43546f; font-size: 11px; font-weight: 750; }
.bar { width: min(42px, 80%); min-height: 8px; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, #68cbb7 0%, #1d7185 100%); box-shadow: 0 6px 18px rgba(28,113,133,.18); }
.bar-label { color: #7c8aa2; font-size: 11px; }

.summary-list { display: grid; gap: 11px; margin-top: 16px; }
.summary-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 11px 12px; border: 1px solid var(--soft-line); border-radius: 11px; }
.summary-row strong { font-size: 13px; }
.summary-row span { color: var(--muted); font-size: 12px; }
.summary-row b { font-variant-numeric: tabular-nums; }

.section-stack { display: grid; gap: 15px; }
.commission-sections { margin-top: 15px; }
.commission-summary-table .rank-number { margin-left: 2px; }
.commission-name-button { width: 100%; min-width: 150px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 9px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--ink); font-size: 14px; font-weight: 750; text-align: left; }
.commission-name-button span { color: var(--muted); font-size: 12px; font-weight: 650; opacity: .72; transition: color .16s ease, transform .16s ease, opacity .16s ease; }
.commission-name-button:hover { border-color: rgba(230,170,75,.32); background: var(--gold-soft); color: var(--gold-bright); }
.commission-name-button:hover span { color: var(--gold-bright); opacity: 1; transform: translateX(2px); }
.commission-name-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.gunner-name-button { display: inline; border: 0; background: transparent; color: var(--ink); padding: 0; font-weight: 750; text-align: left; }
.gunner-name-button:hover { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }
.gunner-name-button:focus-visible { border-radius: 3px; outline: 2px solid var(--gold); outline-offset: 3px; }
.ranking-name-button { font-size: 12px; }
.ranking-name-button::after { content: " →"; color: var(--muted); font-size: 10px; opacity: 0; transition: opacity .16s ease; }
.ranking-name-button:hover::after, .ranking-name-button:focus-visible::after { opacity: 1; }
.summary-name-button { display: block; font-size: 13px; }
.commission-unpaid { color: var(--gold-bright); }
.commission-total { min-width: 150px; display: grid; justify-items: end; gap: 7px; }
.commission-total strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.commission-total > span { width: 100%; height: 4px; overflow: hidden; border-radius: 999px; background: var(--soft-line); }
.commission-total i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c4862e, var(--gold-bright)); }
.pending-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pending-card { border: 1px solid #f0dcc1; border-radius: 14px; padding: 15px; background: #fffaf1; }
.pending-card h4 { margin: 0; }
.pending-card p { margin: 4px 0 14px; color: var(--muted); font-size: 12px; }
.action-row { display: flex; flex-wrap: wrap; gap: 7px; }

.rate-input { width: 90px; padding: 7px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.fixed-agent { display: inline-flex; align-items: center; gap: 7px; min-width: 116px; font-weight: 700; white-space: nowrap; }
.fixed-agent small { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 700; }
.notice { border: 1px solid #cce6df; border-radius: 13px; background: #edf9f6; color: #246b5e; padding: 12px 14px; font-size: 13px; line-height: 1.55; }
.empty-state { padding: 45px 20px; text-align: center; color: var(--muted); }

.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(7,22,40,.58); backdrop-filter: blur(5px); }
.modal { width: min(540px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; background: white; border-radius: 20px; box-shadow: 0 28px 90px rgba(0,15,36,.35); }
.modal.modal-wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--soft-line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 20px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.calculation-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; border-radius: 12px; background: #f5f8fb; }
.calculation-box span { display: block; color: var(--muted); font-size: 11px; }
.calculation-box strong { display: block; margin-top: 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.calculation-box .calculation-note { grid-column: 1 / -1; margin: 3px 0 0; padding-top: 9px; border-top: 1px solid var(--soft-line); color: var(--gold-bright); font-size: 12px; line-height: 1.55; }
.assignment-section { margin: 22px 0 15px; }
.assignment-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.assignment-title h3 { margin: 0; font-size: 16px; }
.assignment-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.employee-section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.employee-section-actions > span { color: var(--green); font-size: 12px; font-weight: 750; white-space: nowrap; }
.employee-entry-list { display: grid; gap: 10px; }
.employee-entry-card { border: 1px solid var(--line); border-radius: 13px; padding: 13px; background: #fafbfd; }
.employee-entry-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.employee-entry-head strong { color: var(--ink); font-size: 14px; }
.employee-fields-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.employee-fields-grid .employee-name-field { grid-column: 1 / -1; }
.employee-fields-grid input { padding: 8px 9px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 150; max-width: min(390px, calc(100vw - 44px)); border-radius: 12px; background: #132d4b; color: white; padding: 12px 15px; box-shadow: 0 16px 45px rgba(0,20,45,.3); font-size: 13px; }
.toast.error { background: #9f402f; }
.mobile-only { display: none; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .pending-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; margin-top: 52px; }
  .login-copy h1 { font-size: 46px; }
  .permission-list { display: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 60; width: 236px; transform: translateX(-102%); transition: transform .2s ease; box-shadow: 16px 0 40px rgba(0,20,44,.2); }
  .sidebar.open { transform: translateX(0); }
  .mobile-only { display: grid; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 620px) {
  .login-page { padding: 22px 18px 32px; }
  .login-copy h1 { font-size: 38px; }
  .login-copy > p { font-size: 16px; }
  .login-card { padding: 21px; }
  .demo-accounts, .metric-grid, .pending-grid, .form-grid { grid-template-columns: 1fr; }
  .topbar { min-height: 68px; }
  .topbar > div:nth-child(2) { display: none; }
  .account-chip > div:nth-child(2) { display: none; }
  .owner-admin-only { padding: 8px 10px; font-size: 12px; }
  .content { padding-inline: 14px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading-actions, .overview-range-toolbar, .date-range-filter { width: 100%; }
  .date-range-filter label { flex: 1 1 130px; }
  .date-range-filter .date-input-shell { width: 100%; }
  .date-range-filter input { width: 100%; }
  .date-range-arrow { display: none; }
  .date-range-filter .button { flex: 1 1 100%; }
  .range-error-panel { align-items: flex-start; flex-direction: column; }
  .calculation-box { grid-template-columns: 1fr; }
}

/* Selected direction: Image 2 layout with Image 1 graphite-and-gold theme. */
:root {
  --ink: #f4f1ea;
  --muted: #9ca1a6;
  --line: #34383d;
  --soft-line: #2a2e32;
  --canvas: #111416;
  --surface: #1b1f22;
  --navy: #0a0d0f;
  --navy-2: #e6aa4b;
  --green: #62c58b;
  --green-soft: rgba(98, 197, 139, .12);
  --orange: #f16f68;
  --orange-soft: rgba(241, 111, 104, .12);
  --blue-soft: rgba(117, 168, 232, .12);
  --gold: #e6aa4b;
  --gold-bright: #f3bf63;
  --gold-soft: rgba(230, 170, 75, .13);
  --shadow: 0 14px 38px rgba(0, 0, 0, .2);
  --radius: 8px;
  color-scheme: dark;
}

html, body { background: var(--canvas); color: var(--ink); }
body { font-size: 15px; }
.login-page {
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 3%, rgba(230,170,75,.13), transparent 30rem),
    radial-gradient(circle at 86% 84%, rgba(230,170,75,.06), transparent 34rem),
    #0d1012;
}
.login-brand span, .login-copy > p, .permission-list p { color: #a8adb1; }
.brand-mark { border: 1px solid rgba(230,170,75,.6); border-radius: 10px; background: var(--gold-soft); color: var(--gold-bright); box-shadow: inset 0 0 18px rgba(230,170,75,.06); }
.brand-mark.small { border-radius: 8px; }
.eyebrow, .section-kicker { color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.eyebrow { border-color: rgba(230,170,75,.35); border-radius: 5px; background: var(--gold-soft); }
.permission-list span { border: 1px solid rgba(230,170,75,.3); border-radius: 7px; background: var(--gold-soft); color: var(--gold); }
.permission-list strong { color: var(--ink); }
.login-card { border-color: var(--line); border-radius: 12px; background: rgba(28,32,35,.96); color: var(--ink); box-shadow: 0 28px 80px rgba(0,0,0,.38); }
.demo-pill { border-radius: 4px; background: var(--gold-soft); color: var(--gold); }
.demo-account { border-color: var(--line); border-radius: 6px; background: #15191c; color: #b8bcc0; }
.demo-account:hover, .demo-account.active { border-color: rgba(230,170,75,.7); background: var(--gold-soft); color: var(--gold-bright); }
label { color: #b9bdc0; }
input, select, textarea { border-color: var(--line); border-radius: 6px; background: #14181b; color: var(--ink); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(230,170,75,.1); }
input[type="checkbox"] { accent-color: var(--gold); }
.form-error { color: #ff817b; }
.text-button { color: var(--gold); }
.text-button:hover { color: var(--gold-bright); }
.button { border-radius: 5px; }
.button-primary { border-color: var(--gold-bright); background: var(--gold); color: #17130d; box-shadow: 0 5px 16px rgba(230,170,75,.12); }
.button-primary:hover { background: var(--gold-bright); }
.button-secondary { border-color: var(--line); background: #202428; color: #d8d9d7; }
.button-danger { border-color: rgba(241,111,104,.28); background: var(--orange-soft); color: #ff817b; }
.button-success { border-color: rgba(98,197,139,.28); background: var(--green-soft); color: #72d69a; }
.button-small { border-radius: 4px; }
.icon-button { border-radius: 5px; color: var(--muted); }
.icon-button:hover { background: var(--gold-soft); color: var(--gold); }

.app-shell { grid-template-columns: 238px minmax(0, 1fr); background: var(--canvas); }
.sidebar { padding: 21px 15px; border-right: 1px solid #282c30; background: #0a0d0f; color: var(--ink); }
.sidebar-brand { padding: 0 8px 24px; }
.main-nav { gap: 6px; margin-top: 9px; }
.nav-button { position: relative; border: 1px solid transparent; border-radius: 5px; color: #a8adb1; padding: 12px 13px; }
.nav-button:hover { border-color: #2c3034; background: #15191c; color: var(--ink); }
.nav-button.active { border-color: rgba(230,170,75,.18); background: linear-gradient(90deg, rgba(230,170,75,.18), rgba(230,170,75,.05)); color: var(--gold-bright); box-shadow: none; }
.nav-button.active::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 3px; background: var(--gold); }
.nav-icon { color: currentColor; }
.sidebar-create-actions { display: grid; gap: 8px; margin-top: 18px; }
.sidebar-agent-button { width: 100%; margin-top: 0; border-color: var(--gold); background: transparent; color: var(--gold-bright); }
.sidebar-agent-button:hover { background: var(--gold-soft); }
.sidebar-employee-button { border-color: var(--line); color: var(--ink); }
.sidebar-employee-button:hover { border-color: var(--gold); color: var(--gold-bright); }
.sidebar-spacer { flex: 1; }
.system-card { margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #121619; }
.system-card > * { display: block; }
.system-card strong { margin-top: 9px; font-size: 12px; }
.system-card strong i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(98,197,139,.7); }
.system-card small { margin-top: 8px; color: var(--muted); font-size: 10px; }
.sidebar-foot { border: 0; border-top: 1px solid var(--soft-line); border-radius: 0; padding: 14px 6px 0; background: transparent; }
.sidebar-account-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.sidebar-foot span, .sidebar-foot small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot span { font-size: 12px; }
.sidebar-foot small { color: var(--muted); font-size: 10px; }
.topbar { min-height: 70px; padding: 11px clamp(18px, 2.4vw, 30px); border-color: var(--soft-line); background: rgba(17,20,22,.94); }
.overview-mode .topbar { display: none; }
.topbar h1 { font-size: 18px; }
.topbar p { color: var(--muted); font-size: 11px; }
.account-avatar { width: 36px; height: 36px; border: 1px solid rgba(230,170,75,.25); border-radius: 50%; background: var(--gold-soft); color: var(--gold-bright); }
.content { max-width: 1600px; padding: 19px clamp(16px, 2vw, 26px) 38px; }
.date-range-filter { border-color: var(--line); background: #181c1f; }
.date-range-filter input { border-color: var(--line); background: #111416; color: var(--ink); }

.metric-grid { gap: 13px; }
.metric-card, .panel { border-color: var(--line); border-radius: var(--radius); background: linear-gradient(145deg, #202427, #191d20); box-shadow: var(--shadow); }
.metric-card { position: relative; min-height: 143px; overflow: hidden; padding: 18px; }
.metric-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--gold), transparent 70%); opacity: .82; }
.metric-label { color: #b5b9bc; font-size: 12px; }
.metric-value { font-size: clamp(26px, 2.35vw, 35px); }
.metric-note { color: var(--muted); font-size: 11px; }
.metric-icon { width: 42px; height: 42px; border: 1px solid rgba(230,170,75,.3); border-radius: 6px; background: var(--gold-soft); color: var(--gold); font-size: 18px; }
.metric-card.green .metric-icon { border-color: rgba(98,197,139,.28); background: var(--green-soft); color: var(--green); }
.metric-card.orange .metric-icon { border-color: rgba(241,111,104,.28); background: var(--orange-soft); color: var(--orange); }
.metric-spark { position: absolute; right: 15px; bottom: 15px; width: 88px; height: 31px; display: flex; align-items: end; gap: 5px; opacity: .55; }
.metric-spark::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; border-bottom: 1px solid rgba(230,170,75,.22); }
.metric-spark i { flex: 1; min-height: 3px; border-radius: 2px 2px 0 0; background: var(--gold); }
.metric-card.green .metric-spark i { background: var(--green); }
.metric-card.orange .metric-spark i { background: var(--orange); }

.overview-template { display: grid; grid-template-columns: minmax(255px, .82fr) minmax(330px, 1.15fr) minmax(370px, 1.45fr); grid-template-areas: "settlement gunners agents" "rates rates agents" "ledger ledger approvals"; gap: 13px; margin-top: 13px; align-items: stretch; }
.overview-settlement { grid-area: settlement; }
.overview-gunners { grid-area: gunners; }
.overview-agents { grid-area: agents; }
.overview-rates { grid-area: rates; }
.overview-ledger { grid-area: ledger; }
.overview-approvals { grid-area: approvals; }
.panel-head { min-height: 61px; padding: 13px 16px; border-color: var(--soft-line); }
.panel-head h3 { margin: 3px 0 0; font-size: 15px; }
.panel-head p { color: var(--muted); font-size: 11px; }
.status-pill, .role-pill { border: 1px solid rgba(117,168,232,.2); border-radius: 4px; background: var(--blue-soft); color: #75a8e8; font-size: 10px; }
.status-pill.active, .status-pill.paid { border-color: rgba(98,197,139,.25); background: var(--green-soft); color: var(--green); }
.status-pill.pending, .status-pill.unpaid { border-color: rgba(230,170,75,.28); background: var(--gold-soft); color: var(--gold-bright); }
.status-pill.rejected, .status-pill.suspended { border-color: rgba(241,111,104,.28); background: var(--orange-soft); color: var(--orange); }

.settlement-card-body { min-height: 194px; display: grid; align-content: space-between; gap: 18px; padding: 17px; }
.settlement-amount { font-size: 28px; font-weight: 780; letter-spacing: -.04em; }
.settlement-visual { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 15px; }
.settlement-ring { width: 88px; height: 88px; display: grid; place-content: center; text-align: center; border-radius: 50%; background: radial-gradient(circle at center, #1d2124 56%, transparent 57%), conic-gradient(var(--gold) var(--paid-angle), #3a3f43 0); }
.settlement-ring strong, .settlement-ring span { display: block; }
.settlement-ring strong { font-size: 21px; }
.settlement-ring span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.settlement-legend { display: grid; gap: 10px; }
.settlement-legend > span { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.settlement-legend b { color: var(--ink); font-weight: 650; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.paid { background: var(--gold); }
.legend-dot.pending { background: #555b60; }
.ranking-list { display: grid; padding: 5px 16px 13px; }
.ranking-row { display: grid; grid-template-columns: 29px 1fr; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--soft-line); }
.ranking-row:last-child { border-bottom: 0; }
.rank-number { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 5px; background: #2a2f33; color: #c8cbcd; font-size: 10px; }
.rank-detail > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.rank-detail strong { font-size: 12px; }
.rank-detail b { font-size: 11px; font-variant-numeric: tabular-nums; }
.rank-track { height: 4px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: #30353a; }
.rank-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #c4862e, var(--gold-bright)); }
.overview-agents .ranking-row { padding-block: 11px; }
.agent-assignment-summary { margin: 4px 16px 15px; padding-top: 13px; border-top: 1px solid var(--soft-line); }
.agent-assignment-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.customer-assignment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.customer-assignment-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--soft-line); border-radius: 5px; background: #181c1f; }
.customer-assignment-item strong, .customer-assignment-item small { display: block; }
.customer-assignment-item strong { font-size: 11px; }
.customer-assignment-item small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.customer-assignment-item > b { color: var(--gold); font-size: 9px; font-weight: 750; font-variant-numeric: tabular-nums; }
.price-alert-list { display: grid; gap: 9px; padding: 12px 15px 15px; }
.price-alert { display: grid; grid-template-columns: auto minmax(170px, 1fr) minmax(140px, .7fr) auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--soft-line); border-radius: 5px; background: #181c1f; }
.price-dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.price-dot.big { color: var(--gold); background: var(--gold); }
.price-dot.small { color: var(--green); background: var(--green); }
.price-alert strong, .price-alert span { display: block; }
.price-alert strong { font-size: 12px; }
.price-alert strong small { color: var(--muted); font-size: 9px; }
.price-alert div > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.price-agent-value { color: #c5c8ca; font-size: 11px; font-variant-numeric: tabular-nums; }
.approval-list { display: grid; padding: 3px 14px 13px; }
.approval-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px solid var(--soft-line); }
.approval-row:last-child { border-bottom: 0; }
.approval-avatar { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #2a2f33; color: var(--gold); font-size: 11px; font-weight: 800; }
.approval-row strong, .approval-row small { display: block; min-width: 0; }
.approval-row strong { font-size: 11px; }
.approval-row small { max-width: 145px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.approval-actions { display: flex; gap: 5px; }
.account-issuance { display: grid; gap: 12px; padding: 14px; }
.account-issuance p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.account-issuance .button { justify-self: start; }

.dashboard-grid { gap: 13px; }
th { background: #181c1f; color: var(--gold-bright); font-size: 13px; }
td { border-color: var(--soft-line); color: #d5d6d3; }
tbody tr:hover { background: rgba(230,170,75,.035); }
.commission-detail-table tbody tr.date-band { background: #222629; }
.commission-detail-table tbody tr.date-band:hover { background: #282d30; }
.commission-detail-table tbody tr.date-group-start td { border-top: 2px solid #3b4044; }
.commission-detail-table tbody tr.date-group-start.date-band td { border-top-color: rgba(230,170,75,.28); }
.commission-detail-table .date-cell { font-weight: 700; }
.commission-detail-table tr.date-band .date-cell { color: var(--gold-bright); }
.daily-total-row td { border-top: 1px solid rgba(230,170,75,.42); border-bottom: 1px solid rgba(230,170,75,.2); background: rgba(230,170,75,.075); color: var(--gold-bright); }
.daily-total-row:hover td { background: rgba(230,170,75,.11); }
.daily-total-row td:first-child { padding-left: 14px; }
.daily-total-row td:first-child strong, .daily-total-row td:first-child span { display: block; }
.daily-total-row td:first-child span { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 600; white-space: nowrap; }
.daily-settlement-summary { display: grid; justify-items: start; gap: 4px; min-width: 112px; }
.cell-main { color: var(--ink); }
.cell-sub { color: var(--muted); font-size: 10px; }
.bar-value { color: #c0c3c5; }
.bar { border-radius: 4px 4px 1px 1px; background: linear-gradient(180deg, var(--gold-bright), #95611f); box-shadow: 0 6px 18px rgba(230,170,75,.1); }
.bar-label { color: var(--muted); }
.summary-row { border-color: var(--soft-line); border-radius: 5px; background: #181c1f; }
.pending-card { border-color: rgba(230,170,75,.24); border-radius: 6px; background: var(--gold-soft); }
.pending-card p { color: var(--muted); }
.notice { border-color: rgba(230,170,75,.24); border-radius: 6px; background: var(--gold-soft); color: #d9c49f; }
.empty-state { color: var(--muted); }
.empty-state.compact { padding: 28px 16px; font-size: 11px; }

.modal-root { background: rgba(0,0,0,.72); }
.modal { border: 1px solid var(--line); border-radius: 9px; background: #1b1f22; box-shadow: 0 28px 90px rgba(0,0,0,.55); }
.modal-head { border-color: var(--soft-line); }
.calculation-box { border: 1px solid var(--soft-line); border-radius: 6px; background: #15191c; }
.employee-section-actions > span { color: var(--gold); }
.employee-entry-card { border-color: var(--line); border-radius: 6px; background: #15191c; }
.toast { border: 1px solid rgba(230,170,75,.36); border-radius: 6px; background: #202428; color: var(--ink); box-shadow: 0 16px 45px rgba(0,0,0,.4); }
.toast.error { border-color: rgba(241,111,104,.4); background: #3b2020; }

@media (max-width: 1250px) {
  .overview-template { grid-template-columns: 1fr 1fr; grid-template-areas: "settlement gunners" "agents agents" "rates rates" "ledger ledger" "approvals approvals"; }
}
@media (max-width: 820px) {
  .overview-mode .topbar { display: flex; }
  .overview-template { grid-template-columns: 1fr; grid-template-areas: "settlement" "gunners" "agents" "rates" "ledger" "approvals"; }
}
@media (max-width: 620px) {
  .price-alert { grid-template-columns: auto 1fr auto; }
  .price-agent-value { display: none; }
  .approval-row { grid-template-columns: auto 1fr; }
  .approval-actions { grid-column: 2; }
  .customer-assignment-grid { grid-template-columns: 1fr; }
  .assignment-title { align-items: flex-start; flex-direction: column; }
  .employee-section-actions { width: 100%; justify-content: space-between; }
  .employee-fields-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 430px) {
  .employee-fields-grid { grid-template-columns: 1fr; }
  .employee-fields-grid .employee-name-field { grid-column: auto; }
}
