@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

* , *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Command Center tokens — light is the default theme, dark is opt-in ── */
:root {
  --page-bk: #e5e1d3;
  --bg: #faf9f4;
  --surface: #ffffff;
  --surface2: #f1efe6;
  --surface3: #e9e6d8;
  --border: #e5e1d2;
  --border-soft: #edeade;
  --text: #201e17;
  --text-muted: #7a7462;
  --text-muted2: #5f5947;
  --text-faint: #a19b87;
  --text-faint2: #b3ac98;
  /* Solar Traders Africa brand colors, 2026-10-03 — read off their real logo
     (deep blue + gold sun/Africa mark), replacing End Loadshedding's green. */
  --accent: #1c3f94;
  --accent-hover: #15316f;
  --accent-text: #17316e;
  --accent-tint: #e3e8f5;
  --accent-soft: #f3f5fb;
  --red: #a34d3f;
  --red-tint: #f4e3dd;
  --amber: #9c7620;
  --amber-tint: #f5e9c9;
  --blue: #3d5f8f;
  --blue-tint: #e2e8f1;
  --coral: #b1614f;
  --coral-tint: #f4e2dc;
  --chrome: #f1efe6;
  --chrome-text: #6b6555;
  --shadow-1: 0 1px 2px rgba(30,26,15,0.05);
  --shadow-2: 0 6px 16px -8px rgba(30,26,15,0.10), 0 2px 4px -1px rgba(30,26,15,0.05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bk: #030303;
    --bg: #131210;
    --surface: #1b1a15;
    --surface2: #211f18;
    --surface3: #272417;
    --border: #302d22;
    --border-soft: #27251c;
    --text: #eee9dc;
    --text-muted: #a49c87;
    --text-muted2: #8c8570;
    --text-faint: #625c4b;
    --text-faint2: #524c3d;
    --accent: #6c8ee0;
    --accent-hover: #85a3ea;
    --accent-text: #9db6ee;
    --accent-tint: #16203a;
    --accent-soft: #121a2e;
    --red: #c58e7f;
    --red-tint: #251a16;
    --amber: #cdab68;
    --amber-tint: #251f12;
    --blue: #91acce;
    --blue-tint: #18202c;
    --coral: #cf9484;
    --coral-tint: #251b17;
    --chrome: #1b1a15;
    --chrome-text: #8c8570;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-2: 0 10px 24px -10px rgba(0,0,0,0.5), 0 2px 6px -1px rgba(0,0,0,0.3);
  }
}
:root[data-theme="dark"] {
  --page-bk: #030303;
  --bg: #131210;
  --surface: #1b1a15;
  --surface2: #211f18;
  --surface3: #272417;
  --border: #302d22;
  --border-soft: #27251c;
  --text: #eee9dc;
  --text-muted: #a49c87;
  --text-muted2: #8c8570;
  --text-faint: #625c4b;
  --text-faint2: #524c3d;
  --accent: #6c8ee0;
  --accent-hover: #85a3ea;
  --accent-text: #9db6ee;
  --accent-tint: #16203a;
  --accent-soft: #121a2e;
  --red: #c58e7f;
  --red-tint: #251a16;
  --amber: #cdab68;
  --amber-tint: #251f12;
  --blue: #91acce;
  --blue-tint: #18202c;
  --coral: #cf9484;
  --coral-tint: #251b17;
  --chrome: #1b1a15;
  --chrome-text: #8c8570;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-2: 0 10px 24px -10px rgba(0,0,0,0.5), 0 2px 6px -1px rgba(0,0,0,0.3);
}

/* ── Legacy variable names kept as live aliases so nothing silently breaks ── */
:root {
  --bg-page: var(--bg);
  --bg-surface: var(--surface);
  --bg-surface2: var(--surface2);
  --bg-surface3: var(--surface3);
  --bg-input: var(--surface2);
  --bg-hover: var(--surface2);
  --text-primary: var(--text);
  --text-placeholder: var(--text-faint);
  --accent-light: var(--accent-text);
  --shadow-card: var(--shadow-2);
  --blue-soft: var(--blue-tint);
  --red-soft: var(--red-tint);
  --purple: var(--coral);
  --purple-soft: var(--coral-tint);
  --amber-soft: var(--amber-tint);
}

html, body { height: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }
.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

/* ── App shell: sidebar + main ── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 13px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 22px; }
.brand-mark {
  box-sizing: border-box;
  width: 32px; height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-name { font-size: 12px; font-weight: 700; letter-spacing: 0.2px; color: var(--text); white-space: nowrap; }
.brand-sub { font-size: 10px; color: var(--text-faint); margin-top: 1px; }

.nav-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 14px 9px 6px;
}
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted2);
  transition: background 0.12s, color 0.12s;
}
.nav a svg { width: 14.5px; height: 14.5px; flex-shrink: 0; opacity: 0.8; }
.nav a .lbl { flex: 1; }
.nav a .ct { font-size: 10px; font-family: 'IBM Plex Mono', monospace; color: var(--text-faint); background: var(--surface2); padding: 1px 6px; border-radius: 20px; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a.active { background: var(--accent-tint); color: var(--accent-text); font-weight: 600; }
.nav a.active svg { opacity: 1; }
.nav a.active .ct { background: rgba(28,63,148,0.14); color: var(--accent-text); }

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 9px;
  padding-inline: 7px;
}
.avatar {
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--accent);
  color: #fdfdf8;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  object-fit: cover;
}
.who-name { font-size: 11.5px; font-weight: 600; color: var(--text); }
.who-role { font-size: 10px; color: var(--text-faint); }

.theme-toggle-btn {
  width: 26px; height: 26px;
  padding: 0;
  border-radius: 7px;
  font-size: 0.78rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle-btn:hover { border-color: var(--accent); color: var(--text); }
.theme-toggle-fixed { position: absolute; top: 20px; right: 20px; }

.logout-btn {
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
}
.logout-btn:hover { border-color: var(--text-faint); color: var(--text); }

.main { flex: 1; min-width: 0; }

/* ── Topbar (breadcrumb / search / icon actions) ── */
.topbar {
  height: 54px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}
.crumb { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.crumb b { color: var(--text); font-weight: 600; }
.topbar-search {
  flex: 1; max-width: 340px;
  display: flex; align-items: center; gap: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 11px;
  color: var(--text-faint);
  font-size: 12px;
}
.topbar-search svg { width: 13px; height: 13px; flex-shrink: 0; }
.topbar-search input {
  border: none; background: none; padding: 0; flex: 1; color: var(--text); font-size: 12px; outline: none;
}
.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search kbd { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.container { max-width: 1450px; margin: 0 auto; padding: 28px 32px 44px; }

/* ── Page head (title + primary actions) ── */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.pagehead h1 { font-size: 21px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); }
.pagehead .sub { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.actions { display: flex; gap: 9px; }

/* ── Cards / panels ── */
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-1);
}
.card { padding: 24px; }
.card h2 { font-size: 1rem; margin-bottom: 18px; color: var(--text); font-weight: 700; }

.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 12.5px; font-weight: 600; margin: 0; }
.panel-head .meta { font-size: 11px; color: var(--text-faint); }
.panel-body { padding: 18px; }

.center-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  background: var(--bg);
}

.login-card { width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; font-size: 1.3rem; font-weight: 800; color: var(--accent-text); margin-bottom: 4px; }
.login-card p.sub { text-align: center; color: var(--text-faint); font-size: 0.82rem; margin-bottom: 24px; }

.tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 9px; padding: 4px; margin-bottom: 24px; }
.tab { flex: 1; padding: 8px; text-align: center; font-size: 0.85rem; font-weight: 600; border-radius: 6px; cursor: pointer; color: var(--text-faint); transition: all 0.15s; user-select: none; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.form-group { margin-bottom: 14px; }
label { display: block; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 70px; }
.status-select { width: auto; padding: 6px 8px; font-size: 0.78rem; border-radius: 6px; }

.phone-input-group { display: flex; }
.phone-input-group .phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: var(--surface3);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.phone-input-group input { border-radius: 0 8px 8px 0; }

/* ── Buttons ── */
.btn {
  font-family: inherit;
  padding: 10px 16px;
  background: var(--accent);
  color: #fdfdf8;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  box-shadow: var(--shadow-1), 0 4px 10px -3px rgba(28,63,148,0.28);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 13px; height: 13px; }
.btn.full { width: 100%; justify-content: center; }
/* Real feature, 2026-09-28: was mobile-only (native share sheet); shareDocPdf()/shareCurrentDoc() already fall back to a plain download when navigator.share isn't available, so it's safe to show on every screen size. */

.fab-add {
  display: none; position: fixed; right: 18px; width: 56px; height: 56px;
  border-radius: 50%; background: var(--accent); color: #fff; border: none;
  align-items: center; justify-content: center; font-size: 28px; line-height: 1;
  box-shadow: 0 6px 16px rgba(28,63,148,0.4); z-index: 55; padding: 0;
}
.fab-add:active { transform: translateY(1px); }

.items-list-mobile { display: none; }
.ilist { border-top: 1px solid var(--border); }
.irow { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.irow-name { font-size: 0.85rem; font-weight: 600; line-height: 1.35; }
.irow-bottom { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; }
.irow-calc { font-size: 0.76rem; color: var(--text-faint); }
.irow-total { font-size: 0.88rem; font-weight: 700; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fdfdf8; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.btn.secondary:hover { background: var(--surface2); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; box-shadow: var(--shadow-1); }
.btn.danger:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 11px; font-size: 0.76rem; }

.error-msg { color: var(--red); font-size: 0.82rem; margin-top: 10px; text-align: center; min-height: 1em; }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 10px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-faint); padding: 10px 12px; border-bottom: 1px solid var(--border); }
th.num, td.num { text-align: right; }
th .sort { display: inline-flex; align-items: center; gap: 3px; }
th .sort svg { width: 9px; height: 9px; opacity: 0.6; flex-shrink: 0; }
.chk { width: 32px; }
.chk input { accent-color: var(--accent); }
td { padding: 13px 12px; border-bottom: 1px solid var(--border-soft); font-size: 0.85rem; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

.badge, .pill { display: inline-flex; align-items: center; padding: 3.5px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; text-transform: capitalize; }
.badge.draft, .pill.draft { background: var(--surface2); color: var(--text-muted); }
.badge.sent, .pill.sent { background: var(--blue-tint); color: var(--blue); }
.badge.paid, .badge.accepted, .pill.accepted { background: var(--accent-tint); color: var(--accent-text); }
.badge.overdue, .badge.expired, .pill.expired { background: var(--amber-tint); color: var(--amber); }
.badge.cancelled, .pill.cancelled { background: var(--red-tint); color: var(--red); }

.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.combo-wrap { position: relative; flex: 1; }
.combo-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  max-height: 220px;
  overflow-y: auto;
  margin-top: 4px;
  box-shadow: var(--shadow-2);
}
.combo-item { padding: 10px 12px; font-size: 0.85rem; cursor: pointer; }
.combo-item:hover { background: var(--accent-tint); color: var(--accent-text); }
.combo-empty { padding: 10px 12px; font-size: 0.82rem; color: var(--text-faint); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.toolbar h2 { margin-bottom: 0; }

.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(20,18,12,0.5); align-items: center; justify-content: center; z-index: 70; padding: 20px; }
:root[data-theme="dark"] .modal-backdrop { background: rgba(0,0,0,0.65); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .modal-backdrop { background: rgba(0,0,0,0.65); } }
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2), 0 30px 70px -24px rgba(20,18,12,0.3);
}
.modal h3 { margin-bottom: 18px; font-size: 1.02rem; font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.item-row { display: grid; grid-template-columns: auto 3fr 1fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row input { padding: 8px 10px; font-size: 0.85rem; }
.item-row textarea.item-desc {
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  min-height: 34px;
}
.item-amount { padding: 8px 10px; font-size: 0.85rem; color: var(--accent-text); font-weight: 600; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-row.dragging { opacity: 0.4; }
.item-drag {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: grab;
  color: var(--text-faint);
  font-size: 1.3rem;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
}
.item-drag:hover { background: var(--surface2); color: var(--text); }
.item-drag:active { cursor: grabbing; }

.totals-line { display: flex; justify-content: flex-end; gap: 16px; padding: 10px 0; font-size: 0.9rem; color: var(--text-muted); }
.totals-line.grand { color: var(--text); font-weight: 700; font-size: 1.05rem; border-top: 1px solid var(--border); }

.empty-state { text-align: center; color: var(--text-faint); padding: 40px 0; font-size: 0.88rem; }

.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.helper-text { color: var(--text-faint); font-size: 0.78rem; margin-top: 4px; }

.logo-preview { width: 90px; height: auto; border-radius: 8px; margin-bottom: 10px; background: var(--surface2); padding: 6px; }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ── Legacy page-topbar (home.html header row before the redesign is fully adopted elsewhere) ── */
.page-topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.page-search { flex: 1; position: relative; }
.page-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-faint); }
.page-search input { padding-left: 40px; background: var(--surface); }
.icon-btn {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: none; background: none; appearance: none;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface2); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot, .icon-btn .bubble {
  position: absolute; top: 4px; right: 4px;
  background: var(--red); color: #fff;
  font-size: 0.62rem; font-weight: 700;
  border-radius: 20px; padding: 1px 5px; line-height: 1.3;
}
.icon-btn .bubble { width: 7px; height: 7px; padding: 0; border: 1.5px solid var(--bg); }

.notif-wrap { position: relative; }
.notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 320px;
  z-index: 80;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-panel-head { padding: 11px 14px; font-size: 0.76rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 1px solid var(--border-soft); }
.notif-list { max-height: 280px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface2); }
.notif-mark { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--amber); }
.notif-mark.red { background: var(--red); }
.notif-text .t { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.notif-text .s { font-size: 0.76rem; color: var(--text-faint); margin-top: 1px; }
.notif-empty { padding: 20px 14px; font-size: 0.82rem; color: var(--text-faint); text-align: center; }

.page-user { display: flex; align-items: center; gap: 8px; flex-shrink: 0; cursor: pointer; }
.page-user .avatar { width: 30px; height: 30px; }
.page-user .name { font-size: 0.82rem; font-weight: 600; }

/* ── Hero balance card ── */
.hero {
  background: linear-gradient(155deg, var(--accent-tint), var(--surface) 60%);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-2);
  padding: 24px 28px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.hero-left .tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--accent-text); background: var(--accent-tint); padding: 3px 9px; border-radius: 99px; margin-bottom: 12px; }
.hero-left .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.hero-left .value { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.hero-left .delta { font-size: 12px; margin-top: 8px; color: var(--accent-text); font-weight: 600; }
.hero-right { flex-shrink: 0; text-align: right; }
.hero-right .spark-label { font-size: 10.5px; color: var(--text-faint); margin-bottom: 6px; }

.hcarousel, .hcarousel-dots { display: none; }
.hcarousel {
  gap: 10px; overflow-x: auto; margin: 0 0 4px; padding-bottom: 4px;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch;
}
.hcarousel::-webkit-scrollbar { display: none; }
.hcard {
  scroll-snap-align: start; flex: 0 0 78%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; box-shadow: var(--shadow-1);
}
.hcard.accent { background: linear-gradient(155deg, var(--accent-tint), var(--surface) 70%); }
.hcard-tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 10.5px; font-weight: 700; background: var(--surface2); color: var(--text-muted); margin-bottom: 10px; }
.hcard-tag.warn { background: var(--red-tint); color: var(--red); }
.hcard-tag.ok { background: var(--accent-tint); color: var(--accent-text); }
.hcard-label { font-size: 12px; color: var(--text-muted); }
.hcard-value { font-size: 26px; font-weight: 700; letter-spacing: -0.5px; margin-top: 3px; }
.hcard-sub { font-size: 11px; color: var(--text-faint); margin-top: 6px; }
.hcarousel-dots { justify-content: center; gap: 5px; margin: 0 0 16px; }
.hdot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); transition: all 0.15s; }
.hdot.active { background: var(--accent); width: 14px; border-radius: 3px; }

.bottom-tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(20,18,12,0.06);
}
.bt-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; color: var(--text-faint); font-size: 10px; font-weight: 600;
  text-decoration: none;
}
.bt-item svg { width: 20px; height: 20px; }
.bt-item.active { color: var(--accent); }

.more-sheet-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(20,18,12,0.5); z-index: 65;
}
:root[data-theme="dark"] .more-sheet-backdrop { background: rgba(0,0,0,0.65); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .more-sheet-backdrop { background: rgba(0,0,0,0.65); } }
.more-sheet-backdrop.open { display: block; }
.more-sheet {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 66;
  background: var(--surface); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-2);
  padding: 12px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 75vh; overflow-y: auto;
}
.more-sheet.open { display: block; }
.more-sheet .sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 4px; margin: 0 auto 14px; }
.more-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; }
.more-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 2px; border-bottom: 1px solid var(--border-soft);
  font-size: 0.85rem; font-weight: 600; color: var(--text); cursor: pointer;
}
.more-row-icon { color: var(--text-muted); display: flex; }
.more-row-icon svg { width: 17px; height: 17px; }
.more-group-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); margin: 16px 0 8px; }
.more-group-label:first-of-type { margin-top: 0; }
.more-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.more-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; }
.more-tile-icon {
  width: 46px; height: 46px; border-radius: 13px; background: var(--surface2);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.more-tile-icon svg { width: 19px; height: 19px; }
.more-tile span { font-size: 10px; color: var(--text-muted); text-align: center; font-weight: 600; }

/* ── Stat tiles ── */
.stats3, .stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.stat, .stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow-1); }
.stat .label, .stat-tile .stat-label { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.stat .value, .stat-tile .stat-value { font-size: 19px; font-weight: 700; }
.stat .delta { font-size: 10.5px; margin-top: 6px; }
.stat .delta.up, .stat-tile .stat-change.up { color: var(--accent-text); }
.stat .delta.down, .stat-tile .stat-change.down { color: var(--red); }
.stat .delta.flat { color: var(--text-faint); }
.stat-tile .stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.stat-tile .stat-change { font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--surface2); }
.stat-tile .stat-change.up { background: var(--accent-tint); }
.stat-tile .stat-change.down { background: var(--red-tint); }

.dash-grid, .grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
.grid.grid-even { grid-template-columns: 1fr 1fr; }
.dash-main-col, .dash-side-col, .col-main, .col-side { min-width: 0; }
@media (max-width: 700px) {
  .grid.grid-even { grid-template-columns: 1fr; }
}

.chip-row { display: flex; gap: 3px; background: var(--surface2); padding: 3px; border-radius: 7px; }
.chip { font-size: 10.5px; font-weight: 600; padding: 4.5px 11px; border-radius: 5px; color: var(--text-faint); cursor: pointer; border: none; }

/* ── Reports: Quotes/Invoices summary card ── */
.reports-summary { display: flex; padding: 22px 26px; }
.reports-summary-col { flex: 1; }
.reports-summary-divider { width: 1px; background: var(--border); margin: 0 26px; }
.reports-summary-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.reports-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.reports-stats { display: flex; gap: 30px; }
.reports-stat-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 5px; }
.reports-stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.reports-legend { display: flex; gap: 14px; font-size: 11px; color: var(--text-muted); }
.reports-legend span { display: flex; align-items: center; gap: 5px; }
.reports-legend i { width: 9px; height: 9px; border-radius: 2px; display: block; }
.reports-current-row td { background: var(--accent-tint); font-weight: 600; }
.reports-current-row td:first-child { color: var(--text); }
.reports-current-row td.num:first-of-type { color: var(--accent-text); }
.chip.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.filters { display: flex; gap: 6px; padding: 12px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fchip { font-size: 11px; font-weight: 600; padding: 4.5px 11px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
.fchip.active { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }

.tfoot { display: flex; justify-content: space-between; align-items: center; padding: 11px 18px; font-size: 11px; color: var(--text-faint); border-top: 1px solid var(--border); }
.pager { display: flex; align-items: center; gap: 3px; }
.pgbtn { width: 23px; height: 23px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10.5px; color: var(--text-muted); cursor: pointer; }
.pgbtn.active { background: var(--surface2); color: var(--text); font-weight: 600; }
.pgbtn[disabled] { opacity: 0.4; cursor: default; }

.pipeline, .pipeline-grid { display: grid; grid-template-columns: repeat(5, 1fr); }
.pstage { padding: 15px 16px; border-right: 1px solid var(--border-soft); }
.pstage:last-child { border-right: none; }
.pstage .pname { font-size: 10px; color: var(--text-faint); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.3px; }
.pstage .pcount { font-size: 17px; font-weight: 700; }
.pstage .ptotal { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
/* legacy colored pipeline tiles, restyled to the new neutral/tinted language */
.pipeline-stage { border-radius: 10px; padding: 12px 14px; border: 1px solid var(--border); background: var(--surface2); }
.pipeline-stage .stage-name { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.pipeline-stage .stage-count { font-size: 1.2rem; font-weight: 700; color: var(--text); }
.pipeline-stage .stage-total { font-size: 0.7rem; color: var(--text-faint); margin-top: 2px; }
.pipeline-stage.s4, .pipeline-stage.s5 { background: var(--accent-tint); border-color: transparent; }
.pipeline-stage.s4 .stage-name, .pipeline-stage.s5 .stage-name { color: var(--accent-text); }
.pipeline-stage.s2 { background: var(--blue-tint); border-color: transparent; }
.pipeline-stage.s2 .stage-name { color: var(--blue); }
.pipeline-stage.s3 { background: var(--amber-tint); border-color: transparent; }
.pipeline-stage.s3 .stage-name { color: var(--amber); }

.flag-list, .activity { display: flex; flex-direction: column; }
.flag { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-top: 1px solid var(--border-soft); }
.flag:first-child { border-top: none; padding-top: 0; }
.flag-mark { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.flag-mark.red { background: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }
.flag-mark.amber { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-tint); }
.flag-mark.green { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.flag-text .t { font-size: 12px; font-weight: 600; color: var(--text); }
.flag-text .s { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.flag-go { margin-left: auto; font-size: 10.5px; font-weight: 600; color: var(--text-muted); align-self: center; flex-shrink: 0; cursor: pointer; }
.flag-go:hover { color: var(--accent-text); }

.aitem, .insight-item, .activity-item { display: flex; align-items: center; gap: 10px; padding: 9.5px 0; border-top: 1px solid var(--border-soft); }
.aitem:first-child, .insight-item:first-child, .activity-item:first-child { border-top: none; padding-top: 0; }
.day-label { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); padding: 12px 0 4px; }
.day-label:first-child { padding-top: 0; }
.day-label + .aitem { border-top: none; padding-top: 0; }
.aav { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0; }
.aitem .t { font-size: 11.5px; flex: 1; color: var(--text); }
.aitem .t b, .aitem .t-name { font-weight: 600; }
.aitem .when { font-size: 10.5px; color: var(--text-faint); flex-shrink: 0; font-family: 'IBM Plex Mono', monospace; }

/* Recent activity row: quote amount dropped, name on its own line with the quote details
   underneath instead of one long line that wraps mid-sentence — the " — " separator only
   makes sense inline, so it's dropped along with the line break. */
.activity-price { display: none; }
.aitem .t-name, .aitem .t-doc { display: block; }
.aitem .t-sep { display: none; }
.aitem .t-doc { color: var(--text-muted); margin-top: 2px; }

.insight-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 0.86rem;
}
.insight-icon.warn { background: var(--amber-tint); color: var(--amber); }
.insight-icon.danger { background: var(--red-tint); color: var(--red); }
.insight-icon.ok { background: var(--accent-tint); color: var(--accent-text); }
.insight-icon.info { background: var(--blue-tint); color: var(--blue); }
.insight-text { flex: 1; min-width: 0; }
.insight-text .title { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.insight-text .sub { font-size: 0.76rem; color: var(--text-faint); margin-top: 1px; }
.insight-item .btn { flex-shrink: 0; }

.coming-soon { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.coming-soon .big-icon { margin-bottom: 14px; display: flex; justify-content: center; }
.coming-soon .big-icon svg { width: 40px; height: 40px; color: var(--text-faint); }
.coming-soon h2 { color: var(--text); margin-bottom: 8px; font-size: 1.05rem; }
.coming-soon p { max-width: 420px; margin: 0 auto; font-size: 0.86rem; line-height: 1.5; }

@media (max-width: 900px) {
  .dash-grid, .grid { grid-template-columns: 1fr; }
  .stats3, .stat-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .app-shell { flex-direction: column; position: relative; }
  /* The old horizontal scroll-through-everything nav is replaced by the bottom tab bar
     (primary 4) plus its "More" tab (everything else) — just the brand strip stays up top. */
  .sidebar { width: 100%; height: auto; position: static; padding: 10px 14px; }
  .brand { padding: 0; }
  .nav-label, .nav { display: none; }
  .sidebar-foot { display: none; }
  .topbar-search { display: none; }

  /* Notification bell + avatar sit in the top-right corner of the brand row, next to the
     logo. Positioned absolute (not fixed) against .app-shell so they scroll away with the
     header like normal page content, instead of staying pinned to the screen. */
  .topbar-right { position: absolute; top: 10px; right: 14px; z-index: 20; margin-left: 0; }
  .page-user .name { display: none; }

  .bottom-tabbar { display: flex; }
  .app-shell { padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }

  /* Customers/Quotes/Invoices segmented control duplicates the bottom tab bar on mobile. */
  .tabs { display: none; }

  .container { padding: 16px; }
  .card, .panel { border-radius: 12px; }
  .card { padding: 18px; }

  .page-topbar { flex-wrap: wrap; }
  .greeting-row { flex-direction: column; }
  .quick-actions .btn { flex: 1; justify-content: center; }
  .pagehead { align-items: flex-start; }

  .toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .toolbar .btn { width: 100%; }
  /* Quotes/Invoices: the top toolbar (heading + "+ New ...") is replaced by a
     floating "+" button, so the whole thing is hidden here instead of just the button. */
  #view-quote .toolbar, #view-invoice .toolbar { display: none; }
  .fab-add { display: flex; bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 16px); }
  /* With the heading gone, the outer card's own border/box just outlines the button —
     strip it so the button sits flat on the page, matching the hero/list below. Padding
     is left as-is since the hero/list edge-to-edge math below is calculated against it. */
  #view-quote.card, #view-invoice.card {
    background: none; border: none; border-radius: 0; box-shadow: none;
  }

  .grid-2 { grid-template-columns: 1fr; }

  /* Reports: Quotes/Invoices side-by-side columns stack instead of squeezing into one
     cramped row, and the divider between them becomes a horizontal rule. */
  .reports-summary { flex-direction: column; padding: 18px 16px; gap: 18px; }
  .reports-summary-divider { width: auto; height: 1px; margin: 0; }
  .reports-stats { gap: 22px; flex-wrap: wrap; }

  /* Only 3 plain columns — unlike the desktop-style data tables elsewhere, it never needs
     the horizontal-scroll min-width those get, which was forcing this table (and its panel)
     wider than the screen. */
  #activity-table-panel table { min-width: 0; }

  table { font-size: 0.82rem; min-width: 560px; }
  th, td { padding: 9px 8px; }

  /* Modals become bottom sheets on mobile — slide up from the bottom edge, full width,
     rounded only at the top, with a small drag handle, instead of a centered popup. */
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal {
    padding: 14px 18px 22px; border-radius: 18px 18px 0 0; max-width: 100%; max-height: 88vh;
    position: relative;
  }
  .modal::before {
    content: ''; display: block; width: 36px; height: 4px; background: var(--border);
    border-radius: 4px; margin: 0 auto 14px;
  }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
  /* Quote/invoice detail: stacked item rows instead of a table that doesn't fit and clips text. */
  .items-table-desktop { display: none; }
  .items-list-mobile { display: block; }

  .item-row {
    grid-template-columns: auto 1fr 1fr;
    grid-template-areas: "drag desc desc" "drag qty rate" ". amount amount" ". remove remove";
  }
  .item-row .item-drag { grid-area: drag; }
  .item-row .item-desc { grid-area: desc; }
  .item-row .item-qty { grid-area: qty; }
  .item-row .item-rate { grid-area: rate; }
  .item-row .item-amount { grid-area: amount; }
  .item-row button.btn { grid-area: remove; width: 100%; }

  .row-actions { flex-wrap: wrap; }

  .login-card { max-width: 100%; }

  /* Pipeline: one full-width row per stage instead of cramped columns */
  .pipeline, .pipeline-grid { grid-template-columns: 1fr; }
  .pstage {
    border-right: none; border-top: 1px solid var(--border-soft);
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  }
  .pstage:first-child { border-top: none; }
  .pstage .pname { margin-bottom: 0; text-transform: capitalize; }
  .pstage .ptotal { margin-top: 0; }

  /* Quotes list: cards instead of a cramped table */
  #quote-table-wrap { display: none; }
  #quote-cards-mobile { display: flex; }

  /* Invoices list: same card treatment as Quotes */
  #invoice-table-wrap { display: none; }
  #invoice-cards-mobile { display: flex; }

  /* Customers list: cards instead of a cut-off table */
  #customers-table-wrap { display: none; }
  #customer-cards-mobile { display: flex; }

  /* Overview: just the quick-glance numbers and the two lists you'd act on — the chart, the
     5-row pipeline table and the recent-quotes table don't read well at this width. */
  #stat-grid, #chart-panel, #pipeline-panel, #recent-quotes-panel { display: none; }

  /* The single static hero card becomes a swipeable carousel of the same real numbers. */
  #hero-card { display: none; }
  #hero-carousel, #hero-dots { display: flex; }

  /* Quotes: "Recent activity" and "Needs attention" both dropped on mobile — straight from
     the hero into the actual quote list. */
  #quote-stats, #quote-pipeline-panel, #quote-toprow { display: none; }

  /* Invoices: same treatment — stats grid, pipeline table and the Needs attention/Recent
     activity sidebar all dropped on mobile, straight from the hero into the invoice list. */
  #invoice-stats, #invoice-pipeline-panel, #view-invoice .col-side { display: none; }

  /* Quotes/Invoices hero card: keeps its rounded corners/border, just sits a bit closer to
     the screen edges than the default card gutter. */
  #view-quote > .hero, #view-invoice > .hero {
    margin-top: -8px; margin-left: -27px; margin-right: -27px; width: calc(100% + 54px);
  }

  /* Quotes/Invoices list: bleeds to the screen edges instead of sitting in the page gutter —
     the header/filters/search/pager keep their own inset, only the card rows go edge-to-edge. */
  #quote-list-panel, #invoice-list-panel {
    border-radius: 0; border-left: none; border-right: none; border-bottom: none;
    margin-left: -35px; margin-right: -35px; margin-bottom: -18px; width: calc(100% + 70px);
  }
  #quote-list-panel .panel-body, #invoice-list-panel .panel-body { padding-left: 0; padding-right: 0; }
  #quote-list-panel .panel-body > .form-group,
  #quote-list-panel .panel-body > .bulk-bar,
  #quote-list-panel .panel-body > .tfoot,
  #quote-list-panel .panel-body > .empty-state,
  #invoice-list-panel .panel-body > .form-group,
  #invoice-list-panel .panel-body > .bulk-bar,
  #invoice-list-panel .panel-body > .tfoot,
  #invoice-list-panel .panel-body > .empty-state {
    padding-left: 18px; padding-right: 18px;
  }
  #quote-cards-mobile, #invoice-cards-mobile { gap: 0; }
  #quote-cards-mobile .swipe-row, #invoice-cards-mobile .swipe-row { border-radius: 0; }
  #quote-cards-mobile .qcard, #invoice-cards-mobile .qcard {
    border-radius: 0; border-left: none; border-right: none; border-top: none;
    padding: 12px 18px;
  }
}

@media (min-width: 701px) {
  #quote-cards-mobile { display: none; }
  #invoice-cards-mobile { display: none; }
  #customer-cards-mobile { display: none; }
}

#customer-cards-mobile { flex-direction: column; gap: 8px; }
.ccard {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px;
  background: var(--surface); display: flex; align-items: center; gap: 11px;
}
.ccard-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.ccard-info { min-width: 0; flex: 1; }
.ccard-name { font-size: 13px; font-weight: 600; }
.ccard-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard-chev { color: var(--text-faint); flex-shrink: 0; font-size: 16px; }
.ccard-expand { margin-top: -2px; }
.ccard-expand > td, .ccard-expand { background: var(--surface2); border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; padding: 16px; margin-top: -9px; margin-bottom: 8px; }

#quote-cards-mobile, #invoice-cards-mobile { flex-direction: column; gap: 10px; }

.swipe-row { position: relative; border-radius: 10px; overflow: hidden; }
.swipe-actions {
  position: absolute; top: 0; right: 0; bottom: 0; width: 96px;
  display: flex; z-index: 1;
}
.swipe-btn {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; border: none;
}
.swipe-btn svg { width: 16px; height: 16px; }
.swipe-btn.email { background: var(--blue); }
.swipe-btn.pdf { background: var(--accent); }
.swipe-btn.more { background: var(--text-muted); }

.qcard {
  position: relative; z-index: 2; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; background: var(--surface); touch-action: pan-y;
}
.qcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.qcard-num { font-size: 12px; font-weight: 700; }
.qcard-cust { font-size: 13px; font-weight: 600; margin-top: 3px; }
.qcard-sub { font-size: 11px; color: var(--text-faint); margin-top: 1px; }
.qcard-top .status-select { flex-shrink: 0; }
.qcard-mid { display: flex; justify-content: space-between; align-items: baseline; }
.qcard-total { font-size: 15px; font-weight: 700; }
.qcard-date { font-size: 11px; color: var(--text-faint); }
.qcard-more { display: none; gap: 6px; margin-top: 8px; flex-wrap: wrap; position: relative; z-index: 2; }
.qcard-more .btn { flex: 1 1 auto; }
.qcard-status-change {
  flex: 1 1 100%; display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.qcard-status-change label { font-size: 11px; color: var(--text-faint); flex-shrink: 0; }
.qcard-status-change select { flex: 1; font-size: 12px; padding: 4px 6px; border-radius: 6px; }

/* ── Dashboard home: greeting row (still used by home.html) ── */
.greeting-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 14px; }
.greeting-row h1 { font-size: 1.35rem; font-weight: 800; color: var(--text); }
.greeting-row p { color: var(--text-faint); font-size: 0.86rem; margin-top: 3px; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-actions .btn { display: flex; align-items: center; gap: 6px; }
.quick-actions .btn svg { width: 14px; height: 14px; }

/* ── Quotes table: bulk select, sortable header, icon actions, overflow menu ── */
th.chk, td.chk { width: 32px; }
.sort-th { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.sort-th svg { opacity: 0.6; }

.bulk-bar { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.bulk-bar .count { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }

.icon-btn-sm {
  width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn-sm:hover { background: var(--surface2); color: var(--text); }
.icon-btn-sm svg { width: 13px; height: 13px; }

.quote-more-menu {
  position: absolute; z-index: 80; min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-2); padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.quote-more-menu button {
  text-align: left; font-family: inherit; font-size: 0.8rem; font-weight: 500;
  padding: 7px 9px; border-radius: 6px; border: none; background: transparent; color: var(--text);
  cursor: pointer;
}
.quote-more-menu button:hover { background: var(--surface2); }
.quote-more-menu button.danger { color: var(--red); }
.quote-more-menu-status { padding: 6px 9px 2px; border-top: 1px solid var(--border-soft); margin-top: 2px; }
.quote-more-menu-status label { display: block; font-size: 0.68rem; color: var(--text-faint); margin-bottom: 4px; }
.quote-more-menu-status select { width: 100%; padding: 5px 7px; font-size: 0.78rem; border-radius: 6px; }

/* Quotes table: reserve space for icon actions so they never get squeezed into a vertical stack */
th.qact, td.qact { width: 112px; white-space: nowrap; }
td.qact .row-actions { flex-wrap: nowrap; }
#quote-table .q-cust, #quote-table .q-sub { max-width: 150px; overflow-wrap: break-word; }

th.owner-col, td.owner-cell-td { width: 34px; text-align: center; padding-left: 4px; padding-right: 4px; }
.owner-av {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: #fff;
  flex-shrink: 0; cursor: default;
  object-fit: cover;
}

/* ── Customer detail page ── */
.cust-link { color: var(--accent-text); font-weight: 600; }
.cust-link:hover { text-decoration: underline; }

.cust-header { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-1); padding: 20px 22px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cust-id { display: flex; gap: 14px; align-items: center; }
.cust-avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700; flex-shrink: 0; }
.cust-name { font-size: 18px; font-weight: 700; color: var(--text); }
.cust-since { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.cust-contacts { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 10px; }
.cust-contact { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.cust-contact svg { width: 13px; height: 13px; color: var(--text-faint); flex-shrink: 0; }

.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stats4 .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; box-shadow: var(--shadow-1); }
.stats4 .stat .label { font-size: 10.5px; color: var(--text-faint); margin-bottom: 7px; }
.stats4 .stat .value { font-size: 18px; font-weight: 700; }
.stats4 .stat .delta { font-size: 10px; margin-top: 5px; color: var(--text-faint); }
.stats4 .stat .delta.warn { color: var(--red); }
@media (max-width: 700px) {
  .stats4 { grid-template-columns: repeat(2, 1fr); }
}

.timeline { padding: 4px 18px 14px; }
.titem { display: flex; gap: 11px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.titem:first-child { border-top: none; }
.tdot { width: 7px; height: 7px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.ttext .t { font-size: 11.5px; font-weight: 600; color: var(--text); }
.ttext .s { font-size: 10.5px; color: var(--text-faint); margin-top: 1px; }

/* ── Customer notes / call log ── */
.note-compose { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.note-compose textarea { width: 100%; min-height: 56px; padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface2); font-family: inherit; font-size: 12px; color: var(--text); resize: vertical; }
.note-compose textarea::placeholder { color: var(--text-faint); }
.note-compose-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.note-types { display: flex; gap: 5px; }
.note-type { font-size: 10px; font-weight: 600; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; }
.note-type.active { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }

.note-list { padding: 4px 18px 14px; }
.note-item { display: flex; gap: 11px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.note-item:first-child { border-top: none; }
.note-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; flex-shrink: 0; }
.note-body { flex: 1; min-width: 0; }
.note-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.note-author { font-size: 11.5px; font-weight: 600; }
.note-kind { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; padding: 2px 7px; border-radius: 5px; margin-left: 6px; }
.note-kind.call { background: var(--blue-tint); color: var(--blue); }
.note-kind.meeting { background: var(--amber-tint); color: var(--amber); }
.note-kind.note { background: var(--surface2); color: var(--text-muted); }
.note-when { font-size: 10.5px; color: var(--text-faint); font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; }
.note-text { font-size: 12px; color: var(--text-muted2); margin-top: 4px; line-height: 1.5; white-space: pre-wrap; }

/* ── Expand-in-place customer detail (Customers list) ── */
.cust-link { cursor: pointer; }
.cust-expand-row > td { background: var(--surface2); padding: 18px !important; border-bottom: 1px solid var(--border); }
.cust-expand-row .stats4 { margin-bottom: 16px; }

/* ── Whole customer row is clickable, not just the name ── */
#customers-table tbody tr.cust-row { cursor: pointer; }
#customers-table tbody tr.cust-row:hover td { background: var(--surface2); }

/* ── Invoices: status pills not already covered, overdue-days sub-label ── */
.pill.paid { background: var(--accent-tint); color: var(--accent-text); }
.pill.overdue { background: var(--red-tint); color: var(--red); }
.days-late { font-size: 10px; color: var(--red); font-weight: 600; margin-top: 2px; }
