/* =====================================================================
   SellFire Media — Payment Dashboard
   Brand colours from the SellFire logo
   ===================================================================== */
@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(../fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(../fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(../fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url(../fonts/inter-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(../fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(../fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  /* brand */
  --brand-violet-light: #C94DF5;
  --brand-violet: #9B30E0;
  --brand-purple: #7B2FBE;
  --brand-deep: #2E0A5E;
  --brand-deeper: #1C0540;
  --brand-red: #FF1E1E;
  --brand-orange: #FF5A1F;
  --brand-amber: #FFA41B;
  --brand-yellow: #FFC93C;
  --brand-pink: #F25C8A;
  --success: #22C55E;

  --grad-tagline: linear-gradient(90deg, #2E0A5E 0%, #7B2FBE 50%, #F25C8A 100%);
  --grad-flame: linear-gradient(135deg, #FF1E1E 0%, #FF5A1F 50%, #FFC93C 100%);
  --grad-violet: linear-gradient(135deg, #C94DF5 0%, #7B2FBE 100%);

  /* semantic */
  --bg: #F5F2FA;
  --surface: #FFFFFF;
  --surface-2: #FAF8FD;
  --ink: #1A1428;
  --ink-2: #3D3550;
  --muted: #6E6683;
  --line: #E8E2F0;
  --line-2: #F0ECF6;
  --focus: #9B30E0;

  --overdue: #E11414;  --overdue-bg: #FFE9E9;
  --today: #E04A10;    --today-bg: #FFEFE6;
  --soon: #A86200;     --soon-bg: #FFF4DE;
  --upcoming: #6A27A8; --upcoming-bg: #F3EAFC;
  --ok: #15803D;       --ok-bg: #E6F7EC;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(46, 10, 94, .06), 0 4px 14px rgba(46, 10, 94, .06);
  --shadow-lg: 0 10px 40px rgba(46, 10, 94, .18);
  --sidebar-w: 248px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Barlow Condensed", "Oswald", "Arial Narrow", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand-purple); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 14px; font-weight: 700; margin: 22px 0 10px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; color: var(--brand-deep); }
h3 small { font-size: 12px; font-weight: 500; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--line-2); padding: 1px 5px; border-radius: 5px; }
.ic { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--brand-deep) 0%, var(--brand-deeper) 100%);
  color: #fff; display: flex; flex-direction: column; z-index: 40;
}
.sidebar::after { /* subtle flame glow */
  content: ""; position: absolute; inset: auto 0 0 0; height: 220px; pointer-events: none;
  background: radial-gradient(120% 90% at 0% 100%, rgba(255, 90, 31, .22), transparent 60%);
}
.brand { padding: 22px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { width: 176px; height: auto; }
.brand-sub { display: inline-block; margin-top: 10px; font: 600 12px/1 var(--font-display); letter-spacing: 1.6px; text-transform: uppercase;
  padding: 5px 10px; border-radius: 0 999px 999px 0; background: var(--grad-tagline); }
.nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; position: relative; z-index: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: rgba(255,255,255,.78); font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--grad-violet); color: #fff; box-shadow: 0 6px 18px rgba(155, 48, 224, .35); }
.nav a.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--grad-flame); }
.nav-badge { margin-left: auto; background: var(--brand-orange); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.side-foot { display: flex; align-items: center; gap: 8px; padding: 14px 14px 16px; border-top: 1px solid rgba(255,255,255,.08); position: relative; z-index: 1; }
.me { display: flex; align-items: center; gap: 10px; color: #fff; flex: 1; min-width: 0; }
.me:hover { text-decoration: none; }
.me b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { display: block; color: rgba(255,255,255,.6); font-size: 11.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--grad-flame); display: grid; place-items: center; font-weight: 700; flex-shrink: 0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; padding: 14px 28px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar h1 { font: 700 26px/1 var(--font-display); text-transform: uppercase; letter-spacing: .6px; color: var(--brand-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; width: min(360px, 40vw); color: var(--muted); }
.search input { border: 0; background: transparent; padding: 9px 0; width: 100%; font: inherit; color: var(--ink); outline: none; }
.search:focus-within { border-color: var(--brand-violet); box-shadow: 0 0 0 3px rgba(155,48,224,.12); }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); text-decoration: none; }
.icon-btn.light { background: transparent; border-color: rgba(255,255,255,.15); color: #fff; }
.icon-btn.light:hover { background: rgba(255,255,255,.1); }
.bell b { position: absolute; top: -6px; right: -6px; background: var(--brand-red); color: #fff; font-size: 11px; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; }
.menu-btn { display: none; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 28px 0; }
.content { padding: 18px 28px 28px; display: flex; flex-direction: column; gap: 18px; flex: 1; }
.foot { padding: 14px 28px 20px; color: var(--muted); font-size: 12px; }
.scrim { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card:not(.card-flush) > .card-head { padding: 0 0 12px; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--upcoming-bg); color: var(--upcoming); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-2 > div { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 16px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); overflow: hidden; transition: transform .15s, box-shadow .15s; }
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--kc, var(--brand-purple)); }
.kpi-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--kbg, var(--upcoming-bg)); color: var(--kc, var(--brand-purple)); margin-bottom: 8px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi-value { font: 700 26px/1.15 var(--font-display); letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-brand { background: var(--grad-tagline); color: #fff; border: 0; }
.kpi-brand::before { background: var(--grad-flame); }
.kpi-brand .kpi-ic { background: rgba(255,255,255,.16); color: #fff; }
.kpi-brand .kpi-label, .kpi-brand .kpi-sub { color: rgba(255,255,255,.82); }
.kpi-overdue { --kc: var(--overdue); --kbg: var(--overdue-bg); }
.kpi-overdue .kpi-value { color: var(--overdue); }
.kpi-today { --kc: var(--brand-orange); --kbg: var(--today-bg); }
.kpi-soon { --kc: var(--brand-amber); --kbg: var(--soon-bg); }
.kpi-purple { --kc: var(--brand-violet); --kbg: var(--upcoming-bg); }
.kpi-paid { --kc: var(--success); --kbg: var(--ok-bg); }
.kpi-calm { --kc: #D9D1E5; --kbg: var(--line-2); }
.kpi-calm .kpi-ic { color: var(--muted); }

/* ---------- Alerts / flash ---------- */
.flash { position: relative; padding: 12px 40px 12px 14px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 500; }
.flash-success { background: var(--ok-bg); border-color: #BCE7CB; color: #11622F; }
.flash-error { background: var(--overdue-bg); border-color: #FFC6C6; color: #A10E0E; }
.flash-info { background: var(--upcoming-bg); border-color: #E0CCF6; color: var(--brand-deep); }
.flash-x { position: absolute; right: 8px; top: 8px; border: 0; background: transparent; color: inherit; cursor: pointer; opacity: .6; padding: 4px; }
.auth-card .flash { padding-right: 14px; margin-bottom: 14px; }
.alert { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; }
.alert > div { flex: 1; }
.alert ul { margin: 6px 0; padding-left: 18px; }
.alert-overdue { background: linear-gradient(90deg, #FFE5E5, #FFF1EA); border-color: #FFC1C1; color: #8E0B0B; }
.alert-overdue .ic { color: var(--overdue); }
.alert-warn { background: var(--soon-bg); border-color: #FFDFA3; color: #6B3E00; }
.alert-warn .ic { color: var(--brand-amber); }
.alert.small { padding: 10px 12px; font-size: 13px; margin-top: 10px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; font: 600 14px/1.2 var(--font); cursor: pointer; white-space: nowrap; transition: filter .15s, box-shadow .15s, background .15s; color: var(--ink); background: var(--surface); }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn-primary { background: var(--grad-violet); color: #fff; box-shadow: 0 4px 14px rgba(123, 47, 190, .3); }
.btn-success { background: #16A34A; color: #fff; box-shadow: 0 4px 12px rgba(22, 163, 74, .25); }
.btn-danger { background: var(--brand-red); color: #fff; }
.btn-warn { background: var(--brand-amber); color: #3B2300; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: #D7CCE6; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--brand-purple); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.linklike:hover { text-decoration: underline; }
.link { font-weight: 600; }
.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.inline-form.wrap { flex-wrap: wrap; margin: 0 0 12px; }
.inline-form.wrap input { flex: 1; min-width: 140px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.stack .btn { justify-content: flex-start; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-wide { max-width: 980px; }
label, .label-text { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
input, select, textarea {
  font: 400 14px/1.4 var(--font); color: var(--ink); background: #fff; border: 1px solid #D9D1E5; border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-violet); box-shadow: 0 0 0 3px rgba(155,48,224,.14); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand-violet); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
fieldset:disabled { opacity: .65; }
legend { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.span-2 { grid-column: span 2; }
.hint { font-size: 12.5px; font-weight: 400; color: var(--muted); margin: 0; }
.hint-list { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }
.hint-list li { margin: 3px 0; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
.form-actions { display: flex; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line-2); margin-top: 6px; padding-top: 18px; }
.num-input { font-family: var(--mono); }
.otp { font: 600 24px/1 var(--mono); letter-spacing: 8px; text-align: center; padding: 12px; }
.select-filter { margin-bottom: 4px; }
.seg { flex-direction: row; gap: 12px; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg-opt { flex: 1; min-width: 180px; cursor: pointer; }
.seg-opt input { position: absolute; opacity: 0; }
.seg-opt span { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; font-size: 14px; flex-wrap: wrap; }
.seg-opt small { width: 100%; font-weight: 400; color: var(--muted); font-family: var(--mono); font-size: 12px; padding-left: 28px; }
.seg-opt input:checked + span { border-color: var(--brand-violet); background: var(--upcoming-bg); color: var(--brand-deep); box-shadow: 0 0 0 3px rgba(155,48,224,.12); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--focus); }
[data-typeform][data-type=freelancer] .only-company, [data-typeform][data-type=company] .only-freelancer { display: none; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px; border: 2px dashed #D3C3E8; border-radius: 14px; background: var(--surface-2); color: var(--muted); text-align: center; cursor: pointer; font-weight: 500; }
.drop .ic { color: var(--brand-violet); }
.drop b { color: var(--brand-purple); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.over { border-color: var(--brand-violet); background: var(--upcoming-bg); }
.drop-files { color: var(--ink); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 16px; }
.filters label { flex: 1 1 150px; max-width: 260px; }
.filters label:first-of-type { flex-basis: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:hover { background: #FCFAFE; }
.table tfoot td { background: var(--surface-2); border-top: 1px solid var(--line); }
.table-tight td { padding: 8px 12px; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .cb { width: 36px; }
.actions-col { text-align: right; white-space: nowrap; }
.actions-col > * { margin-left: 4px; }
.sub { display: block; color: var(--muted); font-size: 12px; font-weight: 400; margin-top: 2px; }
.strong { font-weight: 600; }
.mono { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.big { font-size: 18px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
tr.row-overdue td:first-child { box-shadow: inset 4px 0 0 var(--overdue); }
tr.row-today td:first-child { box-shadow: inset 4px 0 0 var(--brand-orange); }
tr.row-soon td:first-child { box-shadow: inset 4px 0 0 var(--brand-amber); }
tr.row-bad { background: #FFF6F6; }
tr.row-flag td { background: #FFFBF0; }
.details-cell { max-width: 420px; word-break: break-word; color: var(--ink-2); }
.text-ok { color: var(--ok); }
.text-bad { color: var(--overdue); }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; padding: 14px; font-size: 13px; color: var(--muted); }
.pager a { font-weight: 600; }
.bulk-bar { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; background: var(--brand-deep); color: #fff; }

/* ---------- Badges / tags / due ---------- */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st-submitted { background: var(--upcoming-bg); color: var(--upcoming); }
.st-approved { background: var(--ok-bg); color: var(--ok); }
.st-paid { background: #16A34A; color: #fff; }
.st-rejected { background: var(--overdue-bg); color: var(--overdue); }
.st-on_hold { background: var(--soon-bg); color: var(--soon); }
.st-acc-active { background: var(--ok-bg); color: var(--ok); }
.st-acc-inactive { background: var(--line-2); color: var(--muted); }
.st-acc-archived { background: #ECEAF0; color: #8A8398; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); margin-left: 4px; vertical-align: middle; }
.table td > .tag:first-child { margin-left: 0; }
.tag-freelancer { background: #F7E9FF; color: #8A22C9; }
.tag-company { background: #FFEDE4; color: #C2410C; }
.tag-urgent { background: var(--brand-red); color: #fff; }
.tag-warn { background: var(--soon-bg); color: var(--soon); }
.due { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.due::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.due.big { font-size: 14px; padding: 6px 12px; }
.due-overdue { background: var(--overdue-bg); color: var(--overdue); }
.due-today { background: var(--today-bg); color: var(--today); }
.due-soon { background: var(--soon-bg); color: var(--soon); }
.due-upcoming { background: var(--upcoming-bg); color: var(--upcoming); }
.due-paid { background: var(--ok-bg); color: var(--ok); }
.due-muted { background: var(--line-2); color: var(--muted); }
.due-muted::before { display: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; font-size: 13px; }
.tabs a:hover { text-decoration: none; border-color: #D3C3E8; }
.tabs a.active { background: var(--brand-deep); border-color: var(--brand-deep); color: #fff; }
.tabs a.tab-overdue.active, .tabs a.tab-attention.active { background: var(--overdue); border-color: var(--overdue); }
.tabs a.tab-today.active { background: var(--brand-orange); border-color: var(--brand-orange); }
.tabs-sm { padding: 10px 16px 0; }
.tabs-sm a { padding: 5px 10px; font-size: 12px; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.dash-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.chart-box { position: relative; height: 210px; }
.chart-box.tall { height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw-overdue { background: var(--brand-red); } .sw-today { background: var(--brand-orange); } .sw-soon { background: var(--brand-amber); }
.sw-upcoming { background: var(--brand-purple); } .sw-paid { background: var(--success); }
.split { margin-bottom: 14px; }
.split:last-child { margin-bottom: 0; }
.split-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13.5px; margin-bottom: 6px; }
.split-top span { display: inline-flex; align-items: center; gap: 6px; }
.bar { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: 6px; }
.bar-freelancer { background: var(--grad-violet); }
.bar-company { background: var(--grad-flame); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--brand-purple); }
.feed-approve .dot { background: var(--success); } .feed-pay .dot { background: #16A34A; box-shadow: 0 0 0 3px var(--ok-bg); }
.feed-reject .dot, .feed-reverse .dot { background: var(--brand-red); } .feed-hold .dot { background: var(--brand-amber); }
.feed-created .dot { background: var(--brand-violet-light); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .ic { color: #CDB8E6; }
.empty.ok .ic { color: var(--success); }
.empty p { margin: 0; max-width: 380px; }

/* ---------- Accounts ---------- */
.acc-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.acc-ic { width: 54px; height: 54px; border-radius: 14px; display: grid; place-items: center; color: #fff; }
.acc-freelancer { background: var(--grad-violet); }
.acc-company { background: var(--grad-flame); }
.acc-stats { margin-left: auto; display: flex; gap: 28px; }
.acc-stats div { display: flex; flex-direction: column; }
.acc-stats small { color: var(--muted); font-size: 12px; }
.acc-stats b { font: 700 22px/1.2 var(--font-display); color: var(--brand-deep); }
.dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 9px 14px; margin: 10px 0 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; word-break: break-word; }
.dl.bank { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; }
.revealed { background: var(--soon-bg); padding: 2px 6px; border-radius: 5px; font-weight: 700; letter-spacing: 1px; }
.pending-box { margin-top: 14px; border: 1.5px solid #FFD68A; background: #FFFBF1; border-radius: 12px; padding: 14px; }
.pending-title { display: flex; align-items: center; gap: 8px; color: #6B3E00; font-size: 13px; }
.pending-title .ic { color: var(--brand-amber); }
.collapse { margin-top: 16px; border-top: 1px solid var(--line-2); padding-top: 12px; }
.collapse summary { cursor: pointer; font-weight: 600; color: var(--brand-purple); }
.collapse[open] summary { margin-bottom: 12px; }

/* ---------- Invoice view ---------- */
.inv-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 6px solid var(--brand-purple); }
.due-edge-overdue { border-left-color: var(--overdue); }
.due-edge-today { border-left-color: var(--brand-orange); }
.due-edge-soon { border-left-color: var(--brand-amber); }
.due-edge-paid { border-left-color: var(--success); }
.due-edge-muted { border-left-color: #C9C2D4; }
.inv-amount { font: 700 34px/1.1 var(--font-display); color: var(--brand-deep); letter-spacing: .3px; }
.inv-head-badges { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inv-head-badges .badge { font-size: 13px; padding: 6px 12px; }
.inv-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
.inv-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.pdf-card { position: sticky; top: 84px; }
.pdf-frame { display: block; width: 100%; height: calc(100vh - 180px); min-height: 560px; border: 0; background: #F1EEF5; }
.action-bar h2 { margin-bottom: 12px; }
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-body { position: absolute; z-index: 20; top: calc(100% + 8px); left: 0; width: 320px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 14px; text-align: left; white-space: normal; }
.pop-right .pop-body { left: auto; right: 0; }
.paid-box { background: var(--ok-bg); border-radius: 12px; padding: 14px; border: 1px solid #BCE7CB; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 6px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--brand-purple); }
.timeline .tl-approve::before { border-color: var(--success); } .timeline .tl-pay::before { background: var(--success); border-color: var(--success); }
.timeline .tl-reject::before, .timeline .tl-reverse::before { border-color: var(--brand-red); } .timeline .tl-hold::before { border-color: var(--brand-amber); }
.tl-reason { margin-top: 4px; padding: 6px 10px; background: var(--surface-2); border-radius: 8px; color: var(--ink-2); }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.comment p { margin: 4px 0 0; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.reminder-plan { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line-2); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; }
.cal-head h2 { margin: 0; font: 700 24px/1 var(--font-display); text-transform: uppercase; color: var(--brand-deep); min-width: 190px; text-align: center; }
.cal-total { margin-left: auto; font-size: 13px; }
.cal-legend { margin: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.cal-dow { padding: 10px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); text-align: center; }
.cal-day { min-height: 118px; padding: 8px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #FBFAFC; }
.cal-day.out .cal-date span { color: #BDB6C9; }
.cal-day.is-today { background: #FFF8F3; box-shadow: inset 0 0 0 2px var(--brand-orange); }
.cal-date { display: flex; justify-content: space-between; align-items: baseline; gap: 4px; font-size: 13px; font-weight: 700; }
.cal-date b { font-size: 11px; color: var(--brand-deep); background: var(--upcoming-bg); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.cal-chip { display: block; font-size: 11.5px; font-weight: 600; padding: 3px 7px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-chip:hover { text-decoration: none; filter: brightness(.96); }
.chip-overdue { background: var(--overdue-bg); color: var(--overdue); border-left: 3px solid var(--overdue); }
.chip-today { background: var(--today-bg); color: var(--today); border-left: 3px solid var(--brand-orange); }
.chip-soon { background: var(--soon-bg); color: var(--soon); border-left: 3px solid var(--brand-amber); }
.chip-upcoming { background: var(--upcoming-bg); color: var(--upcoming); border-left: 3px solid var(--brand-purple); }
.chip-paid { background: var(--ok-bg); color: var(--ok); border-left: 3px solid var(--success); text-decoration: line-through; text-decoration-color: rgba(21,128,61,.4); }
.cal-more { font-size: 11.5px; font-weight: 600; }

/* ---------- Statement / print ---------- */
.statement .st-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-bottom: 16px; margin-bottom: 8px; border-bottom: 4px solid transparent; border-image: var(--grad-tagline) 1; }
.st-brand { display: flex; align-items: center; gap: 12px; }
.st-brand img { width: 52px; }
.st-brand b { display: block; font: 700 22px/1 var(--font-display); text-transform: uppercase; color: var(--brand-deep); }
.st-brand small { color: var(--muted); }
.st-meta { display: flex; gap: 28px; }
.st-meta div { display: flex; flex-direction: column; }
.st-meta small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; }
.st-foot { margin-top: 16px; }
.print-title { display: none; }
.preview { max-height: 520px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; background: radial-gradient(90% 60% at 100% 0%, rgba(242,92,138,.35), transparent 60%), radial-gradient(70% 60% at 0% 100%, rgba(255,90,31,.28), transparent 60%), linear-gradient(160deg, #2E0A5E, #1C0540); display: grid; place-items: center; padding: 24px 16px; }
.auth-wrap { width: 100%; max-width: 430px; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-brand img { width: 250px; }
.auth-card { background: #fff; border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.auth-title { font: 700 30px/1 var(--font-display); text-transform: uppercase; color: var(--brand-deep); margin-bottom: 6px; }
.auth-card .muted { margin: 0 0 18px; }
.auth-link { text-align: center; margin: 14px 0 0; font-size: 13px; }
.auth-foot { text-align: center; color: rgba(255,255,255,.6); font-size: 12px; margin-top: 18px; }
.steps { padding-left: 20px; margin: 0 0 14px; color: var(--ink-2); }
.qr-box { text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
#qr { display: inline-block; background: #fff; padding: 8px; border-radius: 10px; }
#qr img, #qr svg { width: 180px; height: 180px; }
.secret { display: inline-block; font-size: 14px; letter-spacing: 1.5px; padding: 6px 10px; word-break: break-all; }

/* ---------- Responsive ---------- */
@media (max-width: 1380px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .dash-grid, .inv-grid { grid-template-columns: minmax(0, 1fr); }
  .pdf-card { position: static; }
  .pdf-frame { height: 70vh; }
}
@media (max-width: 960px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(20,5,40,.45); z-index: 35; }
  .menu-btn { display: inline-grid; }
  .grid-2, .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar h1 { font-size: 22px; }
  .search { width: auto; flex: 1; min-width: 0; }
  .page-actions { padding: 14px 16px 0; }
  .content { padding: 14px 16px 20px; }
  .foot { padding: 12px 16px 18px; }
}
@media (max-width: 720px) {
  .kpis, .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-value { font-size: 22px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .topbar h1 { display: none; }
  .search { margin-left: 0; }
  .acc-stats { margin-left: 0; width: 100%; }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
  .calendar { grid-template-columns: minmax(0, 1fr); }
  .cal-dow { display: none; }
  .cal-day { min-height: 0; border-right: 0; }
  .cal-day.out, .cal-day:not(:has(.cal-chip)):not(.is-today) { display: none; }
  .cal-date span::after { content: " " attr(data-dow); }
  .pop-body { width: min(320px, calc(100vw - 48px)); }
  .filters label { max-width: none; }
  .table td, .table th { padding: 10px 10px; }
  .page-actions .btn { flex: 1 1 auto; }
  /* tables become stacked cards on phones */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody { display: block; }
  .table-cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .table-cards td { display: block; border: 0; padding: 0; }
  .table-cards td:first-child { box-shadow: none !important; width: 100%; display: flex; align-items: center; gap: 8px; }
  .table-cards td:first-child .sub { display: inline; margin: 0; }
  .table-cards tr.row-overdue { box-shadow: inset 4px 0 0 var(--overdue); }
  .table-cards tr.row-today { box-shadow: inset 4px 0 0 var(--brand-orange); }
  .table-cards tr.row-soon { box-shadow: inset 4px 0 0 var(--brand-amber); }
  .table-cards td.num { margin-left: auto; text-align: right; }
  .table-cards td.cb { width: auto; order: -1; }
  .table-cards td.actions-col { width: 100%; text-align: left; }
  .table-cards td.actions-col > * { margin: 0 6px 0 0; }
}

@media print {
  .sidebar, .topbar, .page-actions, .no-print, .foot, .flash, .bulk-bar, .pager, .scrim { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-title { display: block; font: 700 18px var(--font-display); text-transform: uppercase; margin-bottom: 12px; color: var(--brand-deep); }
  .table th { background: #F3F0F7 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .statement .st-head { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: inherit; }
}
