/* ============================================================
   Buyback CRM — Design System
   Minimalis, flat, warm-neutral, dark/light, mobile-first.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  --bg:         #f6f6f4;
  --surface:    #ffffff;
  --surface-2:  #fbfbfa;
  --surface-3:  #f1f1ee;
  --border:     #e7e6e1;
  --border-2:   #d8d7d1;
  --text:       #191917;
  --text-muted: #6f6f68;
  --text-faint: #9a9992;
  --accent:     #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft:#e7efeb;
  --wa:         #12866f;
  --wa-soft:    #e2f1ec;
  --danger:     #b03434;
  --danger-soft:#f8e7e6;
  --warn:       #96601a;
  --warn-soft:  #f8efe0;
  --ok:         #22734a;
  --ok-soft:    #e4f1e9;

  --radius:   12px;
  --radius-sm:9px;
  --radius-lg:16px;
  --shadow:   0 1px 2px rgba(20,20,18,.04), 0 6px 18px rgba(20,20,18,.05);
  --shadow-sm:0 1px 2px rgba(20,20,18,.05);
  --ring:     0 0 0 3px rgba(47,93,80,.16);

  --fld-h: 40px;
  --space: 16px;
  --maxw: 1400px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --bg:         #131316;
  --surface:    #1b1c20;
  --surface-2:  #202126;
  --surface-3:  #26272d;
  --border:     #2b2c32;
  --border-2:   #383a42;
  --text:       #ececea;
  --text-muted: #9b9ba3;
  --text-faint: #6f707a;
  --accent:     #6fbf9c;
  --accent-ink: #10201a;
  --accent-soft:#1e2f29;
  --wa:         #4bd0ae;
  --wa-soft:    #17302a;
  --danger:     #f08b8b;
  --danger-soft:#33201f;
  --warn:       #e0b072;
  --warn-soft:  #33291a;
  --ok:         #86d3a6;
  --ok-soft:    #1a3025;
  --shadow:     0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
  --ring:       0 0 0 3px rgba(111,191,156,.22);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --bg:#131316; --surface:#1b1c20; --surface-2:#202126; --surface-3:#26272d;
    --border:#2b2c32; --border-2:#383a42; --text:#ececea; --text-muted:#9b9ba3;
    --text-faint:#6f707a; --accent:#6fbf9c; --accent-ink:#10201a; --accent-soft:#1e2f29;
    --wa:#4bd0ae; --wa-soft:#17302a; --danger:#f08b8b; --danger-soft:#33201f;
    --warn:#e0b072; --warn-soft:#33291a; --ok:#86d3a6; --ok-soft:#1a3025;
    --shadow:0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
    --shadow-sm:0 1px 2px rgba(0,0,0,.35); --ring:0 0 0 3px rgba(111,191,156,.22);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 10px clamp(14px, 3vw, 26px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand__mark {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 750; font-size: 13px; letter-spacing: .02em;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 14px; }
.brand__text small { color: var(--text-faint); font-size: 11px; }

.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav__link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 9px; white-space: nowrap;
  color: var(--text-muted); font-weight: 550; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav__link:hover { background: var(--surface-3); color: var(--text); }
.nav__link.is-active { background: var(--accent-soft); color: var(--accent); }
html[data-theme="dark"] .nav__link.is-active { color: var(--accent); }
.nav__icon { font-size: 14px; opacity: .85; }

.topbar__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }
.user { font-size: 13px; color: var(--text-muted); font-weight: 550; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  height: 36px; min-width: 36px; padding: 0 9px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  display: inline-grid; place-items: center; cursor: pointer; font-size: 15px;
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: inline; }

.nav-toggle {
  display: none; width: 40px; height: 36px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 9px; cursor: pointer;
  flex-direction: column; gap: 4px; align-items: center; justify-content: center;
}
.nav-toggle span { width: 16px; height: 1.6px; background: var(--text-muted); border-radius: 2px; }

.main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(16px, 2.4vw, 26px); }
.footer {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 20px clamp(14px, 3vw, 26px); color: var(--text-faint); font-size: 12px;
  border-top: 1px solid var(--border); max-width: var(--maxw); margin: 0 auto; width: 100%;
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }
.page-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13.5px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--fld-h); padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-3); color: var(--text); }
.btn--danger { background: transparent; border-color: var(--border-2); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* WhatsApp button */
.btn-wa {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 11px; border-radius: 8px; cursor: pointer;
  background: var(--wa-soft); color: var(--wa); border: 1px solid transparent;
  font-weight: 650; font-size: 12.5px; white-space: nowrap;
}
.btn-wa:hover { border-color: var(--wa); }
.btn-wa svg { width: 15px; height: 15px; }
.btn-wa.is-disabled { opacity: .45; pointer-events: none; }

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%; height: var(--fld-h); padding: 0 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 104px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.select { 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='%239a9a92' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters .input, .filters .select { width: auto; min-width: 150px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card__pad { padding: 18px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.card__head h3 { font-size: 14.5px; }
.card__head p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-faint); }

.grid { display: grid; gap: 14px; }
.grid--kpi { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.kpi { padding: 16px 18px; }
.kpi__label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi__value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.kpi__sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }
.kpi--accent .kpi__value { color: var(--accent); }

/* ---------- Toolbar / filter bar ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar__search { flex: 1; min-width: 180px; position: relative; }
.toolbar__search .input { padding-left: 34px; }
.toolbar__search::before { content: "⌕"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-faint); font-size: 15px; }
.toolbar__meta { color: var(--text-muted); font-size: 12.5px; margin-left: auto; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text-muted); font-size: 12.5px; font-weight: 550; cursor: pointer;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.is-on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip__x { font-size: 14px; line-height: 1; opacity: .7; }

.filter-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); }
.filter-panel .field { margin: 0; }
.range { display: flex; align-items: center; gap: 6px; }
.range .input { min-width: 0; }

/* ---------- Table ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table thead th {
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-2); color: var(--text-muted);
  font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .03em;
}
.table thead th.sortable { cursor: pointer; user-select: none; }
.table thead th.sortable:hover { color: var(--text); }
.table thead th .arrow { opacity: .4; font-size: 10px; margin-left: 3px; }
.table thead th.is-sorted { color: var(--accent); }
.table tbody tr:hover td { background: var(--surface-2); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:last-child td { border-bottom: 0; }

/* Sticky action column (WA) + name column */
.col-fixed { position: sticky; left: 0; z-index: 4; background: var(--surface); }
.table tbody tr:hover .col-fixed { background: var(--surface-2); }
.table thead th.col-fixed { z-index: 6; background: var(--surface-2); }
.col-name { position: sticky; left: var(--col-fixed-w, 56px); z-index: 3; background: var(--surface); }
.table tbody tr:hover .col-name { background: var(--surface-2); }
.table thead th.col-name { z-index: 5; background: var(--surface-2); }
.col-check { width: 40px; text-align: center !important; }
.table td.col-check { padding-left: 12px; padding-right: 0; }

.cell-name { font-weight: 600; }
.cell-sub { display: block; color: var(--text-faint); font-size: 11.5px; font-weight: 400; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge--btn { cursor: pointer; }
.badge--btn:hover { filter: brightness(.96); }
.badge--gray   { background: var(--surface-3); color: var(--text-muted); }
.badge--blue   { background: #e6effb; color: #2a5f9e; }
.badge--sky    { background: #e2f2f7; color: #207086; }
.badge--orange { background: #fbeddf; color: #a05a17; }
.badge--amber  { background: #fbf1d9; color: #8a6314; }
.badge--violet { background: #efe9fa; color: #5b3fa0; }
.badge--cyan   { background: #def2f0; color: #16706a; }
.badge--slate  { background: #e9eaee; color: #4c5464; }
.badge--green  { background: #e1f3e8; color: #1d6b3f; }
html[data-theme="dark"] .badge--blue   { background: #1b2c42; color: #8fbdff; }
html[data-theme="dark"] .badge--sky    { background: #14313a; color: #7fd4e8; }
html[data-theme="dark"] .badge--orange { background: #3a2a17; color: #eab57f; }
html[data-theme="dark"] .badge--amber  { background: #38300f; color: #e2cd7a; }
html[data-theme="dark"] .badge--violet { background: #2a2244; color: #bfa8f5; }
html[data-theme="dark"] .badge--cyan   { background: #123230; color: #7fd6cd; }
html[data-theme="dark"] .badge--slate  { background: #2a2c34; color: #aeb4c2; }
html[data-theme="dark"] .badge--green  { background: #16351f; color: #79d99a; }
html[data-theme="dark"] .badge--gray   { background: #26272d; color: #9b9ba3; }

/* Compensation pill */
.comp { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.comp__main { font-weight: 650; }
.comp__flag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--warn-soft); color: var(--warn); font-weight: 650; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert--danger { background: var(--danger-soft); color: var(--danger); }
.alert--warn { background: var(--warn-soft); color: var(--warn); }
.alert--ok { background: var(--ok-soft); color: var(--ok); }
.alert--info { background: var(--accent-soft); color: var(--accent); }

/* ---------- Empty / loading ---------- */
.empty { padding: 56px 20px; text-align: center; color: var(--text-muted); }
.empty__title { font-weight: 650; color: var(--text); margin-bottom: 4px; }
.skeleton { height: 14px; background: var(--surface-3); border-radius: 6px; animation: pulse 1.4s ease infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(12,12,10,.42); backdrop-filter: blur(2px); overflow-y: auto; }
.modal-root[hidden] { display: none; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); max-height: 92vh; display: flex; flex-direction: column; }
.modal--wide { max-width: 720px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--border); }
.modal__head h3 { font-size: 16px; }
.modal__close { border: 0; background: transparent; color: var(--text-faint); font-size: 20px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.modal__close:hover { background: var(--surface-3); color: var(--text); }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 9px; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 10px; font-size: 13px; font-weight: 550; box-shadow: var(--shadow); animation: toastIn .2s ease; max-width: 340px; }
.toast--ok { background: var(--ok); color: #fff; }
.toast--err { background: var(--danger); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Compensation summary ---------- */
.summary-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--border); }
.summary-row:last-child { border-bottom: 0; }
.summary-row__k { color: var(--text-muted); font-size: 13px; }
.summary-row__v { font-weight: 650; font-variant-numeric: tabular-nums; }
.summary-row--hi .summary-row__k, .summary-row--hi .summary-row__v { color: var(--accent); }

/* ---------- Activity timeline ---------- */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline__item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.timeline__item:last-child { border-bottom: 0; }
.timeline__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex-shrink: 0; }
.timeline__time { color: var(--text-faint); font-size: 12px; }

/* ---------- Auth ---------- */
.auth-body { display: grid; place-items: center; min-height: 100vh; position: relative; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 30px; }
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head .brand__mark { margin: 0 auto 12px; width: 44px; height: 44px; font-size: 15px; }
.auth-head h1 { font-size: 20px; }
.auth-head p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }
.auth-form { margin-top: 4px; }
.auth-theme { position: fixed; top: 16px; right: 16px; }
.auth-foot { text-align: center; font-size: 12px; color: var(--text-faint); margin: 18px 0 0; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-16 { margin-bottom: 16px; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.scroll-x { overflow-x: auto; }
.spacer { flex: 1; }

/* ============================================================
   Responsive — mobile-first behaviour
   ============================================================ */
@media (max-width: 860px) {
  .nav-toggle { display: flex; }
  .brand__text small { display: none; }
  .user { display: none; }
  .nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px; gap: 2px; display: none; box-shadow: var(--shadow);
  }
  .nav.is-open { display: flex; }
  .nav__link { padding: 11px 13px; }
  .topbar { position: sticky; }
  .topbar__actions { margin-left: 0; }
  .topbar { gap: 10px; }
  .brand { margin-right: auto; }
}

@media (max-width: 720px) {
  /* Filter panel becomes a bottom sheet */
  .filter-panel { grid-template-columns: 1fr; }

  /* Table -> cards */
  .table-wrap { overflow-x: visible; }
  .table { border-spacing: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    margin-bottom: 10px; padding: 8px 14px 12px; box-shadow: var(--shadow-sm);
  }
  .table tbody tr:hover td { background: transparent; }
  .table td {
    border: 0; padding: 5px 0; white-space: normal;
    display: flex; align-items: baseline; gap: 10px; justify-content: space-between;
    text-align: left !important;
  }
  .table td::before {
    content: attr(data-label); color: var(--text-faint); font-size: 11.5px;
    font-weight: 650; text-transform: uppercase; letter-spacing: .03em; flex-shrink: 0;
  }
  .table td.num { text-align: right !important; }
  .col-fixed, .col-name { position: static !important; background: transparent !important; }
  .table td.col-check { padding: 2px 0 6px; justify-content: flex-start; }
  .table td.cell-actions {
    justify-content: flex-start; padding-bottom: 10px; border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
  }
  .table td.cell-actions::before { display: none; }
  .cell-actions .btn-wa { height: 40px; padding: 0 16px; font-size: 13.5px; }
  .cell-actions { gap: 8px; flex-wrap: wrap; }
  .toast-stack { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; }
  .modal { max-width: none; }
  .grid--kpi { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Selection bar (blast) ---------- */
.selection-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text);
}

/* hidden attribute selalu menang atas display:flex/grid */
[hidden] { display: none !important; }

/* ---------- Lebar kolom aksi (sticky) agar sejajar offset kolom nama ---------- */
.table th.col-actions, .table td.col-actions { width: 108px; min-width: 108px; }
.table td.col-actions { display: flex; align-items: center; gap: 8px; }
.table th.col-actions { text-align: left; }
@media (max-width: 720px) {
  .table th.col-actions, .table td.col-actions { width: auto; min-width: 0; }
}

/* ---------- Dashboard: funnel & keputusan ---------- */
.funnel__row { margin-bottom: 16px; }
.funnel__row:last-child { margin-bottom: 0; }
.funnel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.funnel__label { font-weight: 600; font-size: 13.5px; }
.funnel__count { font-variant-numeric: tabular-nums; font-weight: 700; }
.funnel__bar { height: 26px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.funnel__fill { height: 100%; background: var(--accent); border-radius: 8px; transition: width .3s; }
.funnel__conv { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.decisions { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.decision { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.decision__count { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Kartu bahaya (hapus data) ---------- */
.card--danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.card--danger .card__head h3 { color: var(--danger); }

/* ---------- Grafik ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart__x { fill: var(--text-faint); font-size: 10px; font-family: var(--font); }
.chart__v { fill: var(--text-muted); font-size: 10px; font-family: var(--font); font-weight: 600; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { width: 170px; height: 170px; flex-shrink: 0; }
.donut circle { transition: stroke-dasharray .3s; }
.donut__num { fill: var(--text); font-size: 6px; font-weight: 700; font-family: var(--font); }
.donut__lbl { fill: var(--text-faint); font-size: 3.2px; font-family: var(--font); }

.legend { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 170px; }
.legend__item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend__label { flex: 1; color: var(--text-muted); }
.legend__val { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Layout dashboard (desktop) ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.dash-section { display: grid; gap: 14px; margin-top: 16px; }
.dash-section--hero { grid-template-columns: 1.4fr 1fr; align-items: start; }
.dash-section--split { grid-template-columns: 1fr 1fr; align-items: start; }
.dash-section > .card, .grid > .card { min-width: 0; }

@media (max-width: 1180px) {
  .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .dash-section--hero, .dash-section--split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.donut { width: 190px; height: 190px; }
@media (max-width: 720px) { .donut { width: 150px; height: 150px; } }

/* Kartu KPI: aksen tipis di atas + angka lebih tegas */
.dash-kpis .kpi { position: relative; overflow: hidden; }
.dash-kpis .kpi::after {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--border-2); opacity: .9;
}
.dash-kpis .kpi--accent::after { background: var(--accent); }
.dash-kpis .kpi__value { font-size: 28px; }

/* Kartu grafik: sama tinggi & konten di tengah */
.dash-section--hero, .dash-section--split { align-items: stretch; }
.dash-section > .card { display: flex; flex-direction: column; }
.dash-section > .card > .card__pad { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.dash-section .donut-wrap { justify-content: center; }

/* ---------- Notifikasi filter default ---------- */
.notice { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border); font-size: 13px; }
.notice .btn { margin-left: auto; }

/* ---------- Kartu ringkas (mobile) ---------- */
.mobile-cards { display: none; }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.mcard.is-sel { border-color: var(--accent); box-shadow: var(--ring); }
.mcard__head { display: flex; align-items: center; gap: 10px; }
.mcard__id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mcard__name { font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard__sub { color: var(--text-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mcard__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mchip { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--text-muted); font-weight: 550; }
.mchip strong { color: var(--text); font-weight: 700; }
.mcard__extra { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.mrow { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 12.5px; }
.mrow__k { color: var(--text-faint); flex-shrink: 0; }
.mrow__v { text-align: right; }
.mcard__foot { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.mcard__foot .btn--sm { height: 30px; padding: 0 9px; }

@media (max-width: 720px) {
  .table-wrap { display: none; }
  .mobile-cards { display: block; padding: 12px; }
  .notice .btn { margin-left: 0; }
  .mcard .btn-wa { height: 40px; padding: 0 14px; }
}

/* Badge warna merah (Reject Kondisi) */
.badge--red { background: #fbe4e4; color: #a12828; }
html[data-theme="dark"] .badge--red { background: #3a1c1c; color: #f0a0a0; }

/* ---------- Funnel klik + daftar tahap ---------- */
.funnel__row.is-clickable { padding: 6px 8px; margin: 0 -8px 10px; border-radius: 9px; transition: background .15s; }
.funnel__row.is-clickable:last-child { margin-bottom: -6px; }
.funnel__row.is-clickable:hover { background: var(--surface-3); }
.funnel__row.is-clickable:hover .funnel__label { color: var(--accent); }

.stage-list { display: flex; flex-direction: column; }
.stage-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stage-item:last-child { border-bottom: 0; }
.stage-item__tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-muted); flex-shrink: 0; }
.stage-item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage-item__name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-item__meta { color: var(--text-faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-item .btn-wa { flex-shrink: 0; }

/* ---------- Kalkulator: combobox + hasil ---------- */
.combo { position: relative; }
.combo__list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; }
.combo__item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  padding: 9px 12px; border: 0; background: transparent; cursor: pointer; text-align: left; color: inherit; }
.combo__item:hover { background: var(--surface-3); }
.combo__k { font-weight: 600; font-size: 13.5px; }
.combo__n { font-size: 12px; color: var(--text-faint); }
.combo__empty { padding: 12px; color: var(--text-faint); font-size: 13px; }

.calc-out { margin-top: 16px; padding: 16px 18px; border-radius: var(--radius);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border)); }
.calc-out__label { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.calc-out__value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 4px; }
.calc-out__sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---------- Input file: hilangkan tampilan kotak default ---------- */
input[type="file"] { width: 100%; font-size: 13px; color: var(--text-muted); padding: 0; border: 0; background: transparent; }
input[type="file"]::file-selector-button,
input[type="file"]::-webkit-file-upload-button {
  font: inherit; font-weight: 600; font-size: 13px; margin-right: 12px;
  padding: 9px 14px; border-radius: 9px; border: 1px solid var(--border-2);
  background: var(--surface); color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
input[type="file"]::file-selector-button:hover,
input[type="file"]::-webkit-file-upload-button:hover { background: var(--surface-3); }
html[data-theme="dark"] input[type="file"]::file-selector-button,
html[data-theme="dark"] input[type="file"]::-webkit-file-upload-button { background: var(--surface-2); }

/* ---------- Hero: estimasi kompensasi (highlight) ---------- */
.calc-hero { padding: 20px 22px; border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--border));
  box-shadow: 0 1px 2px rgba(20,20,18,.04); }
.calc-hero__label { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); }
.calc-hero__range { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px;
  margin-top: 8px; font-size: 30px; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; color: var(--text); }
.calc-hero__dash { color: var(--text-faint); font-weight: 400; font-size: .7em; }
.calc-hero__hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
@media (max-width: 560px) {
  .calc-hero { padding: 16px; }
  .calc-hero__range { font-size: 20px; gap: 6px; }
}
