/* Sprint Sales — app styles */
:root {
  --brand: #1230F5;
  --brand-600: #0E26D0;
  --brand-50: #EEF1FF;
  --brand-100: #DDE3FF;
  --ink: #0B1023;
  --ink-2: #3A4160;
  --muted: #6B7290;
  --line: #E6E8F0;
  --line-2: #F0F2F7;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --ok: #0E9F6E;
  --ok-50: #E7F8F1;
  --bad: #E0353B;
  --bad-50: #FDECEC;
  --warn: #B7791F;
  --warn-50: #FFF6E5;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 64, .04), 0 4px 16px rgba(16, 24, 64, .04);
  --shadow-lg: 0 10px 40px rgba(16, 24, 64, .14);
  --side: 248px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ethi: 'Noto Sans Ethiopic', var(--font);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5;
  color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 28px; font-weight: 800; line-height: 1.15; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 800; }
p { margin: 0; }
code { background: var(--line-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.ic { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.center { text-align: center; }
.r { text-align: right !important; }
.grow { flex: 1; min-width: 0; }
.clip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.strike { text-decoration: line-through; color: var(--muted); }
.ethi, .am { font-family: var(--ethi); }
.inline { display: inline; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--card);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 16px; z-index: 30;
}
.brand { display: block; padding: 4px 10px 18px; }
.brand img { height: 46px; width: auto; display: block; }
.side-cta { margin: 4px 0 18px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 600; transition: background .15s, color .15s;
}
.side-nav a:hover { background: var(--line-2); color: var(--ink); }
.side-nav a.active { background: var(--brand-50); color: var(--brand); }
.side-foot {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 0; border-top: 1px solid var(--line);
}
.who { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.who strong { display: block; font-size: 14px; }
.who small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar { display: none; }
.main { margin-left: var(--side); padding: 32px 40px 60px; max-width: calc(1240px + var(--side)); }
.bottom-nav { display: none; }

/* ---------- Avatars / badges ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--brand), #4F63FF); color: #fff; font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 32px; height: 32px; font-size: 12px; border-radius: 10px; }
.avatar.lg { width: 58px; height: 58px; font-size: 20px; border-radius: 16px; }
.no-badge {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--brand);
  background: var(--brand-50); padding: 4px 9px; border-radius: 8px; white-space: nowrap;
}
.tag { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 3px 8px; border-radius: 999px; background: var(--line-2); color: var(--muted); vertical-align: middle; }
.tag.lg { font-size: 12px; padding: 4px 10px; margin-left: 6px; }
.tag-void { background: var(--bad-50); color: var(--bad); }
.tag-ok { background: var(--ok-50); color: var(--ok); }
.pill { display: inline-block; font-weight: 700; font-size: 12px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.pill-up { background: rgba(255,255,255,.18); color: #fff; }
.pill-down { background: rgba(255,255,255,.18); color: #FFD3D3; }
.amt { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid transparent; font: inherit; font-weight: 700; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(18, 48, 245, .25); }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #222844; color: #fff; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: #CBD0E0; color: var(--ink); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { background: #C42A30; color: #fff; }
.btn-danger-ghost { background: transparent; color: var(--bad); border-color: #F5C9CB; }
.btn-danger-ghost:hover { background: var(--bad-50); color: var(--bad); }
.btn-block { width: 100%; }
.btn-lg { height: 50px; font-size: 15px; border-radius: 14px; }
.btn.disabled { pointer-events: none; opacity: .45; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-50); color: var(--bad); }
.link { font-weight: 700; font-size: 14px; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p.muted { margin-top: 4px; }
.eyebrow { color: var(--muted); font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.back:hover { color: var(--brand); }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.with-avatar { display: flex; align-items: center; gap: 16px; }
.no-chip {
  display: flex; flex-direction: column; align-items: flex-end; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 16px;
}
.no-chip span { font-size: 12px; color: var(--muted); font-weight: 600; }
.no-chip strong { font-size: 22px; color: #D0212B; letter-spacing: .04em; font-variant-numeric: tabular-nums; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card.flush { overflow: hidden; }
.card.narrow { max-width: 760px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head + .pad { padding-top: 16px; }
.pad { padding: 22px; }
.pad-x { padding-left: 22px; padding-right: 22px; }
.pad-b { padding-bottom: 22px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.stats.three { grid-template-columns: 1.4fr 1fr 1fr; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 10px 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-val.sm { font-size: 20px; }
.stat-val small { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat-hero {
  background: radial-gradient(120% 140% at 100% 0%, #4A5CFF 0%, var(--brand) 45%, #0A1FB8 100%);
  border: 0; color: #fff; position: relative; overflow: hidden;
}
.stat-hero::after {
  content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.stat-hero .stat-top, .stat-hero .stat-sub, .stat-hero .stat-val small { color: rgba(255,255,255,.82); }
.stat-hero .stat-val { font-size: 30px; }

/* ---------- Dashboard ---------- */
.grid-dash { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; }
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; padding: 22px; height: 250px; }
.bar-col { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.bar-val { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { flex: 1; width: 100%; max-width: 54px; display: flex; align-items: flex-end; background: var(--line-2); border-radius: 10px; overflow: hidden; }
.bar { width: 100%; background: var(--brand-100); border-radius: 10px; transition: height .6s cubic-bezier(.2,.8,.2,1); }
.bar-col.current .bar { background: var(--brand); }
.bar-col.current .bar-val { color: var(--brand); }
.bar-lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.rank { list-style: none; margin: 0; padding: 12px 14px 14px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px; }
.rank li + li { border-top: 1px solid var(--line-2); }
.rank a, .rank .grow { font-weight: 700; color: var(--ink); }
.rank small { display: block; font-weight: 500; }
.rank strong { font-variant-numeric: tabular-nums; }

/* ---------- Lists ---------- */
.list { padding: 10px 12px 12px; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 10px; border-radius: 12px; color: var(--ink); }
.list-row + .list-row { border-top: 1px solid var(--line-2); }
.list-row:hover { background: var(--line-2); color: var(--ink); }
.list-row strong { display: block; font-size: 14px; }
.list-row small { display: block; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 14px 16px; background: #FAFBFD; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-size: 14px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: #FAFBFF; }
.table tr.is-void td { color: var(--muted); }
.table tr.is-void .amt { text-decoration: line-through; }
.table tr.is-muted td { opacity: .55; }
.table td.actions { white-space: nowrap; width: 1%; }
.table.lines td, .table.lines th { padding-left: 22px; padding-right: 22px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-top: 1px solid var(--line); }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; padding: 12px; flex-wrap: wrap; align-items: center; }
.filters input[type=date], .filters select { height: 42px; }
.search { flex: 1 1 260px; display: flex; align-items: center; gap: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--muted); }
.search input { border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 0 !important; height: 40px; flex: 1; }
.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }
.summary-strip > div { background: var(--card); padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.summary-strip span { color: var(--muted); font-size: 13px; font-weight: 600; }
.summary-strip strong { font-variant-numeric: tabular-nums; font-size: 17px; }
.summary-strip .accent { color: var(--brand); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-section { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field > span small, .field small.hint { font-weight: 500; color: var(--muted); font-size: 12px; }
input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); width: 100%; background: var(--card);
  border: 1px solid #DADDE8; border-radius: 12px; padding: 0 14px; height: 46px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 12px 14px; resize: vertical; }
select { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7290' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(18, 48, 245, .12); }
input:disabled { background: var(--line-2); color: var(--muted); }
input[type=file] { height: auto; padding: 10px; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.form-actions { display: flex; gap: 10px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--brand); font-size: 14px; list-style: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "– "; }
details.more[open] summary { margin-bottom: 14px; }

/* switch */
.switch { position: relative; display: inline-block; width: 36px; height: 21px; vertical-align: middle; margin-right: 6px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #CDD2E1; border-radius: 99px; transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(15px); }

/* ---------- Sale form ---------- */
.sale-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.sale-side { position: sticky; top: 24px; }
.items { padding: 16px 22px 8px; }
.item-head, .item-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 76px 130px 120px 36px; gap: 10px; align-items: center; }
.item-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 2px 8px; }
.item-row { padding: 6px 0; }
.item-row .field > span { display: none; }
.item-row input { height: 44px; }
.f-amt { text-align: right; font-variant-numeric: tabular-nums; }
.f-amt .lbl { display: none; }
.f-amt strong { font-size: 15px; }
.totals { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.totals > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.totals dt { color: var(--ink-2); font-weight: 600; font-size: 14px; display: flex; align-items: center; }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 700; }
.totals .grand { border-top: 1px dashed var(--line); padding-top: 14px; margin-top: 2px; }
.totals .grand dt { font-weight: 800; color: var(--ink); }
.totals .grand dd { font-size: 24px; font-weight: 800; color: var(--brand); white-space: nowrap; }
.totals .grand dd small { font-size: 12px; color: var(--muted); }
.totals.compact { max-width: 360px; margin-left: auto; }
.words { margin-top: 14px; background: var(--brand-50); color: var(--brand-600); border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 13px; line-height: 1.45; }
.ec-line { margin-top: 12px; }
.side-actions { padding: 0 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.hint { margin-top: -6px; padding: 0 10px; }
.mobile-total { display: none; }

/* ---------- KV ---------- */
.kv { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; }
.kv > div.stack { flex-direction: column; gap: 4px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; text-align: right; word-break: break-word; }
.kv .stack dd { text-align: left; font-weight: 500; }

/* ---------- Clients ---------- */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.client-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
.client-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--brand-100); color: var(--ink); }
.cc-top { display: flex; align-items: center; gap: 12px; }
.cc-top strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-top small { display: block; }
.cc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.cc-stats span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cc-stats strong { font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- Settings ---------- */
.settings .card { max-width: 860px; }
#account { max-width: 860px; }
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-row > div { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 220px; }
.logo-preview { height: 64px; width: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.sticky-save { position: sticky; bottom: 16px; max-width: 860px; display: flex; justify-content: flex-end; margin: -4px 0 24px; z-index: 5; }

/* ---------- Flash / empty / modal ---------- */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 600; animation: slideIn .25s ease; }
.flash span { flex: 1; }
.flash-success { background: var(--ok-50); color: #05603A; }
.flash-error { background: var(--bad-50); color: #A1191F; }
.flash-info { background: var(--brand-50); color: var(--brand-600); }
.flash-x { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 2px; }
.flash.static { animation: none; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.empty { text-align: center; padding: 48px 24px; }
.empty-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-50); color: var(--brand); }
.empty h3 { font-size: 17px; margin-bottom: 4px; }
.empty p { color: var(--muted); margin-bottom: 18px; font-size: 14px; }
.note { padding: 12px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; margin: 16px 0; }
.note.warn { background: var(--warn-50); color: #7A4E0C; }

dialog.modal { border: 0; border-radius: 20px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(11, 16, 35, .45); backdrop-filter: blur(2px); }
dialog.modal form { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
dialog.modal[open] { animation: pop .18s ease; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
@keyframes pop { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* ---------- Auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(900px 500px at 10% -10%, rgba(18,48,245,.16), transparent 60%),
  radial-gradient(700px 400px at 110% 110%, rgba(18,48,245,.12), transparent 60%), var(--bg); }
.auth-wrap { width: 100%; max-width: 420px; }
.auth-wrap.wide { max-width: 560px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 32px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-size: 24px; margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 22px; }
.auth-logo { height: 54px; width: auto; display: block; margin-bottom: 22px; }
.auth-foot { text-align: center; color: var(--muted); font-size: 13px; margin-top: 18px; }
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; font-weight: 600; }
.checks li { display: flex; gap: 8px; align-items: center; }
.checks li span { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; }
.checks .ok span { background: var(--ok-50); color: var(--ok); }
.checks .bad { color: var(--bad); }
.checks .bad span { background: var(--bad-50); color: var(--bad); }
.success-badge { width: 56px; height: 56px; border-radius: 18px; background: var(--ok-50); color: var(--ok); display: grid; place-items: center; margin-bottom: 16px; }

/* ================= Responsive ================= */
@media (max-width: 1180px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats.three { grid-template-columns: 1fr 1fr 1fr; }
  .sale-grid { grid-template-columns: minmax(0, 1fr) 300px; }
  .item-head, .item-row { grid-template-columns: minmax(0, 1fr) 90px 64px 110px 100px 36px; }
}

@media (max-width: 960px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20;
    background: rgba(255,255,255,.88); backdrop-filter: saturate(1.6) blur(12px); border-bottom: 1px solid var(--line);
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  }
  .brand-sm img { height: 34px; display: block; }
  .main { margin-left: 0; padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
    background: rgba(255,255,255,.94); backdrop-filter: saturate(1.6) blur(12px); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 0; }
  .bottom-nav a.on { color: var(--brand); }
  .bottom-nav .fab {
    width: 54px; height: 54px; margin: -22px auto 0; border-radius: 18px; background: var(--brand); color: #fff;
    justify-content: center; box-shadow: 0 10px 24px rgba(18,48,245,.35);
  }
  .grid-dash { grid-template-columns: 1fr; }
  .sale-grid { grid-template-columns: 1fr; }
  .sale-side { position: static; }
  .hide-sm { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  h1 { font-size: 24px; }
  .page-head { align-items: flex-start; margin-bottom: 18px; }
  .page-head .btn span { display: none; }
  .page-head .btn { padding: 0 14px; }
  .stats, .stats.three { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-hero { grid-column: 1 / -1; }
  .stat { padding: 14px 16px; }
  .stat-val { font-size: 21px; }
  .stat-hero .stat-val { font-size: 28px; }
  .bars { gap: 8px; padding: 16px; height: 210px; }
  .card-head { padding: 16px 16px 0; }
  .pad { padding: 16px; }
  .pad-x { padding-left: 16px; padding-right: 16px; }
  .pad-b { padding-bottom: 16px; }
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .summary-strip { grid-template-columns: 1fr; }
  .summary-strip > div { padding: 12px 16px; }
  .filters input[type=date], .filters select { flex: 1 1 40%; }
  .filters .btn { flex: 1; }

  /* responsive tables -> cards */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--line); position: relative; }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-size: 13px; text-align: left; }
  .table.responsive td.actions { position: absolute; top: 8px; right: 10px; width: auto; padding: 0; }
  .table.responsive td.actions::before { display: none; }
  .table.responsive td:first-child { justify-content: flex-start; padding-bottom: 6px; }
  .table.responsive td:first-child::before { display: none; }
  .table.responsive .block { display: inline; margin-left: 6px; }
  .clip { max-width: 180px; }
  .table.lines { font-size: 13px; }
  .table.lines th, .table.lines td { padding: 10px 8px; }
  .table.lines th:nth-child(3), .table.lines td:nth-child(3), .table.lines th:first-child, .table.lines td:first-child { display: none; }

  /* sale items -> stacked cards */
  .item-head { display: none; }
  .items { padding: 12px 16px 4px; display: flex; flex-direction: column; gap: 12px; }
  .item-row {
    grid-template-columns: 1fr .7fr 1.4fr; gap: 10px; padding: 14px; background: var(--bg); border-radius: 14px; position: relative;
  }
  .item-row .field > span { display: block; font-size: 12px; }
  .item-row .f-desc { grid-column: 1 / -1; padding-right: 40px; }
  .item-row .f-amt { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line); padding-top: 10px; }
  .item-row .f-amt .lbl { display: inline; color: var(--muted); font-weight: 600; font-size: 13px; }
  .item-row [data-remove] { position: absolute; top: 10px; right: 8px; }
  .item-row input { background: #fff; }

  .no-chip { padding: 6px 12px; }
  .no-chip strong { font-size: 18px; }
  .sale-form .side-actions { display: none; }
  .sale-form .hint { margin-bottom: 8px; }
  .mobile-total {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 0; right: 0;
    bottom: calc(66px + env(safe-area-inset-bottom)); z-index: 24; padding: 10px 16px; background: var(--ink); color: #fff;
  }
  .mobile-total small { display: block; color: rgba(255,255,255,.7); font-size: 11px; font-weight: 600; }
  .mobile-total strong { font-size: 18px; font-variant-numeric: tabular-nums; }
  .sale-form { padding-bottom: 70px; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .with-avatar .avatar.lg { width: 48px; height: 48px; }
  .auth-card { padding: 24px 20px; border-radius: 20px; }
  .checks { grid-template-columns: 1fr; }
  .form-actions { padding: 14px 16px; }
}

/* ================= Phase 2: pipeline ================= */
.side-ctas { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 4px 0 18px; }
.side-ctas .side-cta { margin: 0; padding: 0 14px; }
.top-actions { display: flex; gap: 2px; }
.ink { color: var(--ink); }

/* stage badge */
.stage-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 3px 10px 3px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); white-space: nowrap; }
.stage-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.lead-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* pipeline stats */
.pipe-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.pipe-stats > * { background: var(--card); padding: 14px 18px; color: var(--ink); display: flex; flex-direction: column; }
.pipe-stats span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pipe-stats strong { font-size: 21px; font-weight: 800; margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.pipe-stats small { color: var(--muted); font-size: 12px; }
.pipe-stats a.alert { background: #FFF7F0; }
.pipe-stats a.alert strong { color: #C2410C; }

/* board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px; scroll-snap-type: x proximity; }
.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb { background: #D5D9E6; border-radius: 99px; }
.col { background: #EEF0F6; border-radius: 16px; display: flex; flex-direction: column; min-height: 420px; scroll-snap-align: start; border-top: 3px solid var(--c); }
.col-won, .col-lost { background: #F2F3F7; }
.col-head { padding: 12px 14px 8px; }
.col-title { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; }
.col-title .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.col-title .count { margin-left: auto; background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px; }
.col-sum { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.col-sum small { font-weight: 600; }
.col-body { flex: 1; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.col-empty { display: none; border: 2px dashed #CDD2E1; border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); font-size: 13px; font-weight: 600; }
.col-body:not(:has(.deal)) .col-empty { display: block; }
.col-add { margin: 0 10px 10px; padding: 9px; border-radius: 10px; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.col-add:hover { background: #fff; color: var(--brand); }
.deal { display: block; background: #fff; border-radius: 12px; padding: 12px 12px 10px; color: var(--ink); border: 1px solid transparent; box-shadow: 0 1px 2px rgba(16,24,64,.06); cursor: grab; transition: box-shadow .15s, border-color .15s; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.deal:hover { border-color: var(--brand-100); box-shadow: 0 6px 18px rgba(16,24,64,.08); color: var(--ink); }
.deal-top { display: flex; align-items: flex-start; gap: 8px; }
.deal-top strong { flex: 1; font-size: 14px; line-height: 1.35; }
.deal-val { font-size: 13px; font-weight: 800; color: var(--ink); background: var(--line-2); padding: 1px 8px; border-radius: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.deal-who { font-size: 13px; color: var(--muted); margin-top: 2px; }
.deal-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.chip { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 7px; background: var(--brand-50); color: var(--brand); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted-chip { background: var(--bad-50); color: var(--bad); }
.won-chip { background: var(--ok-50); color: var(--ok); }
.col-lost .deal, .col-won .deal { opacity: .85; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: 0 14px 30px rgba(16,24,64,.18) !important; transform: rotate(1.5deg); }
.board-hint { margin-top: -4px; }

/* follow-up chips */
.fu { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 7px; white-space: nowrap; background: var(--line-2); color: var(--muted); }
.fu .ic { width: 12px; height: 12px; }
.fu-overdue { background: var(--bad-50); color: var(--bad); }
.fu-today { background: #FFF1E0; color: #C2410C; }
.fu-soon { background: var(--brand-50); color: var(--brand); }
.fu-none { background: #FFF6E5; color: #92600A; }
.fu-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.fu-dot.fu-overdue { background: var(--bad); box-shadow: 0 0 0 4px var(--bad-50); }
.fu-dot.fu-today { background: #F97316; box-shadow: 0 0 0 4px #FFF1E0; }
.fu-dot.fu-soon { background: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }

/* dashboard */
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.badge-count { background: var(--bad); color: #fff; font-size: 12px; font-weight: 800; padding: 1px 8px; border-radius: 999px; }
.fu-empty { text-align: center; padding: 26px 20px 28px; }
.fu-empty .empty-ic { background: var(--ok-50); color: var(--ok); width: 54px; height: 54px; margin-bottom: 10px; }
.fu-row strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nofu { display: flex; align-items: center; gap: 8px; margin: 0 22px 18px; padding: 10px 12px; border-radius: 10px; background: #FFF6E5; color: #92600A; font-size: 13px; font-weight: 600; }
.nofu a { color: inherit; text-decoration: underline; }
.pipe-total { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.pipe-total small { font-size: 13px; color: var(--muted); }
.pipe-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.pipe-mini li { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 12px; font-size: 13px; }
.pm-lbl { font-weight: 700; color: var(--ink-2); }
.pm-track { height: 10px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.pm-track span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.pm-val { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.goal { margin: 10px 0 8px; position: relative; z-index: 1; }
.goal-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,.22); overflow: hidden; }
.goal-bar span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.goal-txt { font-size: 12px; color: rgba(255,255,255,.85); margin-top: 5px; font-weight: 600; }

/* lead view: stepper */
.stepper { display: flex; align-items: center; gap: 6px; padding: 10px; flex-wrap: wrap; }
.step { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background .15s; }
.step:hover:not(:disabled) { background: var(--line-2); color: var(--ink); }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--line-2); font-size: 12px; }
.step-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step.done .step-dot { background: color-mix(in srgb, var(--c) 15%, white); color: var(--c); }
.step.done { color: var(--ink-2); }
.step.current { background: color-mix(in srgb, var(--c) 10%, white); color: var(--c); cursor: default; }
.step.current .step-dot { background: var(--c); color: #fff; }
.step-end { display: flex; gap: 8px; margin-left: auto; padding-left: 8px; border-left: 1px solid var(--line); }
.btn-win { background: var(--ok-50); color: var(--ok); }
.btn-win:hover, .btn-win.on { background: var(--ok); color: #fff; }
.btn-lose { background: var(--bad-50); color: var(--bad); }
.btn-lose:hover, .btn-lose.on { background: var(--bad); color: #fff; }
.btn:disabled { cursor: default; }
.btn-win.on:disabled, .btn-lose.on:disabled { opacity: 1; }

/* follow-up card */
.fu-card { overflow: hidden; }
.fu-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; background: var(--brand-50); }
.fu-ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand); color: #fff; flex: none; }
.fu-when { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); }
.fu-head strong { display: block; font-size: 16px; margin-top: 2px; }
.fu-card-overdue .fu-head { background: var(--bad-50); } .fu-card-overdue .fu-ic { background: var(--bad); } .fu-card-overdue .fu-when { color: var(--bad); }
.fu-card-today .fu-head { background: #FFF1E0; } .fu-card-today .fu-ic { background: #F97316; } .fu-card-today .fu-when { color: #C2410C; }
.fu-card-none .fu-head { background: #FFF6E5; } .fu-card-none .fu-ic { background: #D99A1E; } .fu-card-none .fu-when { color: #92600A; }
.fu-done { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.fu-actions { display: flex; justify-content: flex-end; }
.stack-14 { display: flex; flex-direction: column; gap: 14px; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates button { font: inherit; font-size: 12.5px; font-weight: 700; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.quick-dates button:hover { border-color: var(--brand); color: var(--brand); }
.quick-dates button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.field .quick-dates { margin-bottom: 4px; }

/* activity */
.act-form { padding: 16px 22px; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.type-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.type-chips label { cursor: pointer; }
.type-chips input { position: absolute; opacity: 0; pointer-events: none; }
.type-chips span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 9px; background: var(--line-2); color: var(--ink-2); }
.type-chips input:checked + span { background: var(--ink); color: #fff; }
.type-chips input:focus-visible + span { outline: 2px solid var(--brand); }
.act-actions { display: flex; justify-content: flex-end; }
.timeline { list-style: none; margin: 0; padding: 14px 22px 20px; position: relative; }
.tl { display: flex; gap: 14px; position: relative; padding-bottom: 16px; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line-2); }
.tl-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--line-2); color: var(--ink-2); }
.tl-stage .tl-ic { background: var(--brand-50); color: var(--brand); }
.tl-followup .tl-ic, .tl-sale .tl-ic { background: var(--ok-50); color: var(--ok); }
.tl-call .tl-ic, .tl-meeting .tl-ic { background: #F3EDFF; color: #7C3AED; }
.tl-body { flex: 1; min-width: 0; padding-top: 4px; }
.tl-meta { font-size: 12px; color: var(--muted); }
.tl-meta strong { color: var(--ink-2); }
.tl-body p { margin-top: 3px; font-size: 14px; word-break: break-word; }

/* lost reasons */
.reason-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reason { cursor: pointer; }
.reason input { position: absolute; opacity: 0; }
.reason span { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--ink-2); text-align: center; }
.reason input:checked + span { border-color: var(--bad); background: var(--bad-50); color: var(--bad); }
.won-burst { font-size: 40px; line-height: 1; }

/* mobile create menu */
button.fab { border: 0; font: inherit; cursor: pointer; }
.fab-menu { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); width: min(340px, calc(100vw - 32px)); background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); padding: 8px; display: flex; flex-direction: column; gap: 2px; animation: pop .16s ease; }
.fab-menu a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; color: var(--ink); }
.fab-menu a:hover { background: var(--line-2); color: var(--ink); }
.fab-menu strong { display: block; font-size: 15px; }
.fab-menu small { display: block; color: var(--muted); font-size: 12px; }
.fm-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.fm-ic.lead { background: #F3EDFF; color: #7C3AED; }
.bottom-nav .fab.open { transform: rotate(45deg); }
.bottom-nav .fab { transition: transform .2s; }

@media (max-width: 1180px) {
  .step-lbl { display: none; }
  .step { flex: 0 0 auto; }
  .step.current .step-lbl { display: inline; }
}
@media (max-width: 960px) {
  .pipe-stats { grid-template-columns: 1fr 1fr; }
  .board { grid-auto-columns: 82%; margin: 0 -16px; padding: 2px 16px 14px; scroll-padding: 16px; }
  .col { min-height: 300px; }
}
@media (max-width: 720px) {
  .pipe-stats strong { font-size: 18px; }
  .pipe-stats > * { padding: 12px 14px; }
  .stepper { gap: 4px; }
  .step { padding: 8px; }
  .step-end { width: 100%; margin: 6px 0 0; padding: 8px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .step-end .btn { flex: 1; }
  .fu-head { padding: 16px; }
  .fu-done, .act-form { padding: 16px; }
  .timeline { padding: 14px 16px 16px; }
  .pipe-mini li { grid-template-columns: 90px 1fr auto; gap: 8px; }
  .nofu { margin: 0 16px 16px; }
  .reason-grid { grid-template-columns: 1fr; }
}
.sortable-fallback { opacity: .95 !important; box-shadow: 0 18px 40px rgba(16,24,64,.22) !important; transform: rotate(2deg); }
.main.main-wide { max-width: none; }
.grid-dash > *, .sale-grid > * { min-width: 0; }
.type-chips input, .reason input { width: 1px; height: 1px; }
.type-chips label, .reason { position: relative; }
.filters select, .filters input[type=date] { width: auto; flex: 0 0 auto; min-width: 150px; }
@media (max-width: 720px) { .filters select, .filters input[type=date] { flex: 1 1 40%; } }
