*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0f0f0f;
  --surface:    #171817;
  --surface2:   #20221f;
  --surface3:   #282b26;
  --border:     #30332e;
  --border-hi:  #474c42;
  --text:       #f2f3ed;
  --text-soft:  #a2a89a;
  --text-dim:   #6c7365;
  --accent:     #c8f135;
  --accent-bg:  rgba(200,241,53,.09);
  --accent-ring:rgba(200,241,53,.25);
  --warn:       #ffb84d;
  --warn-bg:    rgba(255,184,77,.08);
  --err:        #ff5c6c;
  --err-bg:     rgba(255,92,108,.1);
  --blue:       #5b9cf6;
  --blue-bg:    rgba(91,156,246,.08);
  --radius:     12px;
  --mono:       ui-monospace, 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  --display:    ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --body:       ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sidebar-w:  236px;
  --shadow:     0 14px 34px rgba(0,0,0,.2);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.5;
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ───────────────────────────────────────────────────────── */
.app {
  display: block;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -10%, rgba(200,241,53,.07), transparent 32%),
    var(--bg);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: rgba(23,24,23,.96);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 30px 20px 21px;
  border-bottom: 1px solid var(--border);
}
/* ── Shutdown / server control button ────────────────────────────────── */
.shutdown-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 11px;
  font-family: var(--body);
  font-weight: 500;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  white-space: nowrap;
}
.shutdown-btn:hover {
  background: var(--err-bg);
  border-color: var(--err);
  color: var(--err);
}

/* ── Reconnect button ────────────────────────────────────────────────── */
.reconnect-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all .15s;
  margin-top: 4px;
  width: 100%;
  text-align: left;
}
.reconnect-btn:hover {
  border-color: var(--accent-ring);
  color: var(--accent);
}

.brand-logo {
  display: flex;
  align-items: center;
}
.brand-logo img {
  max-width: 160px;
  height: auto;
  transition: filter .6s ease;
}
.brand-logo img.logo-connected {
  filter: drop-shadow(0 0 10px rgba(200,241,53,.28));
}
.brand-logo img.logo-disconnected {
  filter: grayscale(60%) opacity(.5);
}
.brand-biz {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  margin-top: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.health-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.health-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.health-dot.ok  { background: var(--accent); }
.health-dot.err { background: var(--err); }
.health-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Nav ─────────────────────────────────────────────────────────────── */
.sidebar-nav { padding: 12px 10px; flex: 1; }

.nav-group-label {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim);
  padding: 14px 10px 5px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 13px;
  font-family: var(--body);
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.nav-btn:hover  { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent-bg); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.nav-btn .ni    { font-size: 11px; flex-shrink: 0; width: 22px; height: 22px; display:grid; place-items:center; text-align:center; filter: grayscale(1); opacity:.78; border:1px solid var(--border); border-radius:6px; }
.nav-btn.active .ni { filter:none; opacity:1; border-color:var(--accent-ring); background:var(--accent-bg); }
.nav-btn.nav-sub { padding-left: 24px; font-size: 12px; }
.nav-btn.disabled { opacity: .35; cursor: not-allowed; }
.nav-btn.disabled:hover { background: transparent; color: var(--text-soft); }

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}

/* ── Collapsible nav groups ───────────────────────────────────────────── */
.nav-group { margin-bottom: 2px; }

.nav-group-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-soft);
  font-size: 12px;
  font-family: var(--body);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  letter-spacing: .01em;
  transition: background .12s, color .12s;
}
.nav-group-hdr:hover { background: var(--surface2); color: var(--text); }
.nav-group.open .nav-group-hdr { color: var(--text); }

.nav-group-icon { font-size: 11px; flex-shrink: 0; width: 22px; height:22px; display:grid; place-items:center; text-align:center; filter:grayscale(1); opacity:.72; border:1px solid var(--border); border-radius:6px; }
.nav-group-name { flex: 1; }
.nav-group-arrow {
  font-size: 12px;
  color: var(--text-dim);
  transition: transform .18s;
  display: inline-block;
}
.nav-group.open .nav-group-arrow { transform: rotate(90deg); }

.nav-group-children {
  overflow: hidden;
  max-height: 0;
  transition: max-height .22s ease;
}
.nav-group.open .nav-group-children { max-height: 400px; }

/* Child nav buttons are indented to read as sub-items */
.nav-group-children .nav-btn {
  padding-left: 36px;
  font-size: 12px;
  color: var(--text-soft);
}
.nav-group-children .nav-btn .ni {
  font-size: 12px;
  width: 16px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ── Main area ───────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: calc(100vw - var(--sidebar-w));
}

/* ── Topbar ──────────────────────────────────────────────────────────── */
.topbar {
  background: rgba(15,15,15,.84);
  border-bottom: 1px solid var(--border);
  padding: 19px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px);
}
.topbar-title {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-state {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ── Content panels ──────────────────────────────────────────────────── */
.content { padding: 30px 32px 48px; flex: 1; max-width: 1500px; width:100%; margin:0 auto; }
.panel { display: none; }
.panel.active { display: block; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: linear-gradient(145deg, rgba(28,30,27,.97), rgba(21,22,21,.98));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.01em;
}
.card-sub {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 2px;
}
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

/* ── Welcome banner ──────────────────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(110deg, rgba(200,241,53,.11), rgba(23,24,23,.98) 48%);
  border: 1px solid var(--accent-ring);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  position: relative;
}
.welcome-banner h2 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -.02em;
  margin-bottom: 4px;
}
.welcome-banner p {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 18px;
}
.welcome-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.welcome-step {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.welcome-step .ws-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 6px;
}
.welcome-step .ws-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.welcome-step .ws-desc {
  font-size: 12px;
  color: var(--text-soft);
  line-height: 1.55;
}
.welcome-dismiss {
  position: absolute;
  top: 16px; right: 16px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .12s;
}
.welcome-dismiss:hover { color: var(--text-soft); }

/* ── Stat tiles ──────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.stat-tile {
  background: linear-gradient(145deg, var(--surface2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  position: relative;
  overflow: hidden;
}
.stat-tile::after { content:''; position:absolute; inset:auto -16px -30px auto; width:76px; height:76px; border-radius:50%; background:var(--accent); opacity:.035; }
.stat-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -.02em;
}
.stat-value.positive { color: var(--accent); }
.stat-value.negative { color: var(--err); }
.stat-note {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ── Two-column layout ───────────────────────────────────────────────── */
.col2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.col2 .card { margin-bottom: 0; }

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
}
.empty-state .es-icon { font-size: 28px; margin-bottom: 10px; }
.empty-state .es-msg  { font-size: 13px; }
.activity-list { display:flex; flex-direction:column; }
.activity-row { display:flex; align-items:center; gap:11px; padding:10px 0; border-bottom:1px solid var(--border); }
.activity-row:last-child { border-bottom:0; }
.activity-mark { width:30px; height:30px; flex:0 0 30px; display:grid; place-items:center; border-radius:8px; background:var(--accent-bg); border:1px solid var(--accent-ring); color:var(--accent); font-family:var(--mono); font-size:10px; font-weight:700; }
.activity-copy { min-width:0; flex:1; }
.activity-name { color:var(--text); font-size:12px; font-weight:650; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.activity-meta { color:var(--text-dim); font-family:var(--mono); font-size:9px; text-transform:uppercase; letter-spacing:.04em; margin-top:2px; }
.activity-amount { color:var(--text); font-family:var(--mono); font-size:11px; white-space:nowrap; }

/* ── Setup summary table ─────────────────────────────────────────────── */
.setup-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  gap: 12px;
}
.setup-row:last-child { border-bottom: none; }
.setup-row .sk { color: var(--text-soft); flex-shrink: 0; }
.setup-row .sv { font-family: var(--mono); font-size: 12px; color: var(--text); text-align: right; }

/* ── Pill tags ───────────────────────────────────────────────────────── */
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.pill {
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-hi);
  color: var(--text-soft);
  background: var(--surface2);
}
.pill.on { border-color: var(--accent-ring); color: var(--accent); background: var(--accent-bg); }

/* ── Reconcile review card ───────────────────────────────────────────── */
.review-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}
.review-card h4 {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  margin-bottom: 10px;
}
.rrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  font-size: 13px;
}
.rrow:last-child { border-bottom: none; }
.rk { color: var(--text-soft); flex-shrink: 0; }
.rv { font-family: var(--mono); font-size: 12px; color: var(--text); text-align: right; }

/* ── Coming soon panel ───────────────────────────────────────────────── */
.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  gap: 12px;
  color: var(--text-dim);
}
.coming-soon .cs-icon { font-size: 36px; }
.coming-soon h3 {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-soft);
}
.coming-soon p { font-size: 13px; text-align: center; max-width: 320px; line-height: 1.6; }

/* ── Settings panel ──────────────────────────────────────────────────── */
.settings-grid { display: grid; gap: 14px; }
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.setting-row .setting-desc {
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 2px;
}
.setting-row input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 12px;
  min-width: 220px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.setting-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.setting-row select, .card select, .card input, .card textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--body);
  font-size: 12px;
  padding: 8px 12px;
  outline: none;
}
.field-label {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-soft);
  display: block;
  margin-bottom: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 7px;
  font-size: 13px; font-weight: 600;
  font-family: var(--body);
  cursor: pointer; border: none; outline: none;
  transition: transform .12s, filter .12s, border-color .12s, color .12s, background .12s;
}
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { filter: brightness(1.06); transform:translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-soft); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--border-hi); color: var(--text); }
.btn-sm { padding: 6px 13px; font-size: 12px; }

/* Packaging polish: ensure nav labels cannot render doubled/overlapped. */
.nav-btn { position: relative; }
.nav-btn .nav-label {
  display: inline-block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}
.nav-group-name {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Flagship finish ────────────────────────────────────────────────── */
button, input, select, textarea { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.card input:focus, .card select:focus, .card textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.btn[style*="background:var(--accent)"] { color:var(--bg) !important; }
table { border-spacing:0; }
tbody tr { transition:background .12s; }
tbody tr:hover { background:rgba(200,241,53,.035); }
tbody td { border-bottom-color:var(--border) !important; }
::selection { background:var(--accent); color:var(--bg); }
* { scrollbar-width:thin; scrollbar-color:var(--border-hi) transparent; }
::-webkit-scrollbar { width:9px; height:9px; }
::-webkit-scrollbar-thumb { background:var(--border-hi); border:2px solid transparent; background-clip:padding-box; border-radius:999px; }

@media (max-width: 1100px) {
  :root { --sidebar-w: 216px; }
  .content { padding:24px; }
  .topbar { padding:17px 24px; }
  .stat-grid { grid-template-columns:repeat(2, minmax(0,1fr)) !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; transition-duration:.01ms !important; animation-duration:.01ms !important; animation-iteration-count:1 !important; }
}

/* ═════════════════════════════════════════════════════════════════════════
   v0.2 visual refresh
   Loaded after the base sheet, so everything here is a deliberate override.
   Three goals: give money a real typographic treatment, make tables scan,
   and get rid of the flat grey wash the app had between its cards.
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  /* Surfaces step up in even increments instead of drifting. The base is a
     touch warmer than pure neutral so the lime accent does not read acid. */
  --bg:         #0d0e0c;
  --surface:    #151714;
  --surface2:   #1c1f1a;
  --surface3:   #242821;
  --border:     #2b2f28;
  --border-hi:  #414737;
  --text:       #f4f5ef;
  --text-soft:  #a8ae9d;
  --text-dim:   #737a68;
  --accent:     #c8f135;
  --accent-dim: #9dbe28;
  --accent-bg:  rgba(200,241,53,.085);
  --accent-ring:rgba(200,241,53,.28);
  --pos:        #7fd858;
  --neg:        #ff6b78;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 1px 2px rgba(0,0,0,.4), 0 12px 28px -12px rgba(0,0,0,.55);
  --shadow-sm:  0 1px 2px rgba(0,0,0,.35);
}

/* Numerals line up in columns. Every money and quantity figure in the app
   uses this, so a stack of amounts reads as a column, not a ragged list. */
.stat-value, .activity-amount, .setup-row .sv, .rrow .rv,
td[style*="var(--mono)"], .mono, code, kbd {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* ── Icons ───────────────────────────────────────────────────────────── */
.dg-i { display: block; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
.btn [data-icon], .btn .dg-i { margin-right: -1px; }

/* ── App shell ───────────────────────────────────────────────────────── */
.app {
  background:
    radial-gradient(1100px 420px at 82% -14%, rgba(200,241,53,.055), transparent 70%),
    radial-gradient(900px 500px at 8% 108%, rgba(200,241,53,.022), transparent 70%),
    var(--bg);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: linear-gradient(180deg, #15171400 0%, rgba(19,21,18,.55) 100%), rgba(17,19,16,.97);
  border-right: 1px solid var(--border);
}
.sidebar-brand { padding: 26px 18px 18px; }
.brand-biz {
  font-size: 12.5px;
  letter-spacing: -.005em;
  color: var(--text);
  margin-top: 12px;
}
.health-label { letter-spacing: .04em; }
.sidebar-nav { padding: 10px 9px 18px; }

/* Nav icons: a quiet tile that lights up only for the active row. The old
   emoji were greyscale-filtered, which turned them into indistinct blobs. */
.nav-btn .ni,
.nav-group-icon {
  width: 24px; height: 24px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  filter: none;
  opacity: 1;
  transition: color .12s, background .12s, border-color .12s;
}
.nav-btn:hover .ni,
.nav-group-hdr:hover .nav-group-icon { color: var(--text-soft); }
.nav-btn.active .ni {
  color: var(--accent);
  background: var(--accent-bg);
  border-color: var(--accent-ring);
}
.nav-group.open .nav-group-icon { color: var(--text-soft); }
.nav-group-children .nav-btn .ni { width: 20px; height: 20px; border-radius: 6px; }

.nav-btn {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
  gap: 10px;
}
.nav-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
  box-shadow: inset 2px 0 0 var(--accent);
  font-weight: 600;
}
.nav-group-children .nav-btn { padding-left: 34px; }
.nav-group-hdr {
  font-size: 12.5px;
  letter-spacing: .005em;
  padding: 8px 10px;
}
.nav-group-arrow { font-size: 11px; opacity: .6; }
.nav-group.open .nav-group-children { max-height: 460px; }

.sidebar-footer { padding: 14px 18px; }
.sidebar-footer div { letter-spacing: .02em; }

.shutdown-btn, .reconnect-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
}
.reconnect-btn { justify-content: flex-start; }

/* ── Topbar ──────────────────────────────────────────────────────────── */
.topbar {
  padding: 16px 30px;
  background: rgba(13,14,12,.78);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.015em;
}
.topbar-state { letter-spacing: .1em; font-size: 9.5px; }

/* ── Content ─────────────────────────────────────────────────────────── */
.content { padding: 26px 30px 56px; max-width: 1560px; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -.012em; }
.card-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; }
.card-header { margin-bottom: 15px; }

/* ── Stat tiles ──────────────────────────────────────────────────────── */
/* The old tiles carried a blurred lime circle in one corner — decoration
   that fought the number. A hairline rule across the top does the same job
   of separating tiles without competing with the figure. */
.stat-grid { gap: 11px; }
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px 17px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-tile::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  width: auto;
  border-radius: 0;
  background: linear-gradient(90deg, var(--border-hi), transparent 65%);
  opacity: 1;
}
.stat-label {
  font-size: 9.5px;
  letter-spacing: .11em;
  color: var(--text-dim);
  margin-bottom: 9px;
}
.stat-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.05;
}
.stat-value.positive { color: var(--accent); }
.stat-value.negative { color: var(--neg); }
.stat-note { font-size: 11px; margin-top: 6px; color: var(--text-dim); }

/* Five headline figures fit on one row on a wide screen instead of leaving
   an orphan tile wrapped underneath. */
@media (min-width: 1360px) {
  .stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* ── Tables ──────────────────────────────────────────────────────────── */
/* The views build their tables inline, so these rules are written to land on
   whatever markup they emit rather than on a class the JS would have to add. */
.card table { width: 100%; }
.card table thead th {
  font-family: var(--mono) !important;
  font-size: 9.5px !important;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-dim) !important;
  font-weight: 500 !important;
  padding: 0 10px 9px !important;
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}
.card table tbody td {
  padding: 10px !important;
  border-bottom: 1px solid rgba(43,47,40,.7) !important;
  font-size: 12.5px;
  vertical-align: middle;
}
.card table tbody tr:last-child td { border-bottom: 0 !important; }
tbody tr:hover { background: rgba(200,241,53,.028); }

/* ── Empty states ────────────────────────────────────────────────────── */
.empty-state { padding: 44px 16px; }
.empty-state .es-icon {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--text-dim);
  opacity: .8;
  font-size: 0;
}
.empty-state .es-msg { font-size: 13px; line-height: 1.65; color: var(--text-dim); }

.coming-soon .cs-icon { color: var(--text-dim); font-size: 0; }

/* ── Activity list ───────────────────────────────────────────────────── */
.activity-row { padding: 11px 0; }
.activity-mark {
  width: 28px; height: 28px; flex-basis: 28px;
  border-radius: 7px;
  font-size: 9.5px;
  background: var(--surface2);
  border-color: var(--border);
  color: var(--text-soft);
}
.activity-name { font-size: 12.5px; font-weight: 600; }
.activity-meta { font-size: 9px; letter-spacing: .07em; }
.activity-amount { font-size: 12px; }

/* ── Pills ───────────────────────────────────────────────────────────── */
.pill { font-size: 9.5px; padding: 3px 9px; letter-spacing: .03em; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 15px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -.005em;
}
.btn-primary { background: var(--accent); color: #14170c; }
.btn-primary:hover { background: #d3f752; transform: none; filter: none; }
.btn-ghost { background: var(--surface2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface3); border-color: var(--border-hi); color: var(--text); }
.btn-sm { padding: 6px 11px; font-size: 11.5px; }

/* ── Form fields ─────────────────────────────────────────────────────── */
.card input, .card select, .card textarea, .setting-row input, .setting-row select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px 11px;
  font-size: 12.5px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.card input:hover, .card select:hover { border-color: var(--border-hi); }
.card input:focus, .card select:focus, .card textarea:focus,
.setting-row input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background: var(--surface2);
}
input[type="date"] { color-scheme: dark; }
.field-label { font-size: 9.5px; letter-spacing: .1em; color: var(--text-dim); }

/* ── Sub-tabs ────────────────────────────────────────────────────────── */
.subtab, .tab-btn {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.005em;
}

/* ── Welcome banner ──────────────────────────────────────────────────── */
.welcome-banner {
  background: linear-gradient(112deg, rgba(200,241,53,.09), rgba(21,23,20,.98) 52%);
  border-radius: var(--radius-lg);
}
.welcome-step { background: rgba(13,14,12,.5); border-radius: 8px; }

/* ── Setup summary rows ──────────────────────────────────────────────── */
.setup-row { padding: 8px 0; font-size: 12.5px; }
.setup-row .sv { font-size: 12px; }
.setup-row .sk { color: var(--text-dim); }

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #343a2d; }
::-webkit-scrollbar-thumb:hover { background: #454d3a; }

/* ── Dashboard panels ────────────────────────────────────────────────── */
.dash-split {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.dash-split .card { margin-bottom: 0; }
@media (max-width: 1080px) {
  .dash-split { grid-template-columns: minmax(0, 1fr); }
}

.dash-skel {
  height: 190px;
  border-radius: 8px;
  background: linear-gradient(100deg, var(--surface2) 30%, var(--surface3) 50%, var(--surface2) 70%);
  background-size: 220% 100%;
  animation: dash-shimmer 1.4s linear infinite;
}
@keyframes dash-shimmer { to { background-position: -220% 0; } }

.dash-trend-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.dash-trend-figs { display: flex; gap: 28px; }
.dash-trend-figs > div { display: flex; flex-direction: column; gap: 3px; }
.dtf-label {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.dtf-val {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.dtf-val.pos { color: var(--accent); }
.dtf-val.neg { color: var(--neg); }

.dash-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-dim);
}
.dash-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.lg-rev { background: var(--accent); }
.lg-exp { background: #4c5442; }
.dash-chart svg { display: block; overflow: visible; }

/* Needs attention */
.att-list { list-style: none; margin: 0; padding: 0; }
.att-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.att-row:last-child { border-bottom: 0; }
.att-ico {
  width: 28px; height: 28px;
  flex: 0 0 28px;
  border-radius: 7px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.att-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.att-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.att-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.att-when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.att-when.warn { color: #ffc25c; }
.att-when.neg { color: var(--neg); }

/* Product margins */
.marg-list { list-style: none; margin: 0; padding: 0; }
.marg-row { padding: 9px 0; border-bottom: 1px solid var(--border); }
.marg-row:last-child { border-bottom: 0; }
.marg-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.marg-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.marg-profit {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.marg-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  margin: 7px 0 5px;
  overflow: hidden;
}
.marg-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}
.marg-meta {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .04em;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Expenses are not an alarm — only genuine liabilities get a warning color. */
#stat-expenses { color: var(--text); }
#stat-tile-tax { border-top: 1px solid var(--border) !important; }
#stat-tile-tax::after { background: linear-gradient(90deg, #d99b2e, transparent 65%); }
#stat-tax { color: #ffc25c; }

/* ── Form fields ─────────────────────────────────────────────────────── */
/* `.field` is used 114 times across the app but had no rule of its own, so
   every label and input laid out as inline text — labels butted against
   controls and inputs of different widths staggered down the card. */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
}
.field > label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .005em;
  color: var(--text-soft);
}
.field > input,
.field > select,
.field > textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: var(--body);
  font-size: 12.5px;
  padding: 8px 11px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field > input::placeholder,
.field > textarea::placeholder { color: var(--text-dim); }
.field > input:hover, .field > select:hover { border-color: var(--border-hi); }
.field > input:focus,
.field > select:focus,
.field > textarea:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

/* ── Hints and inline alerts ─────────────────────────────────────────── */
.hint {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.alert {
  font-size: 12.5px;
  line-height: 1.55;
  border-radius: 8px;
  padding: 10px 13px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text-soft);
}
.alert:empty { display: none; }
.alert.err { border-color: rgba(255,107,120,.4); background: rgba(255,107,120,.08); color: #ffb0b7; }
.alert.ok { border-color: var(--accent-ring); background: var(--accent-bg); color: var(--accent); }
.alert.warn { border-color: rgba(255,194,92,.4); background: rgba(255,194,92,.08); color: #ffc25c; }

/* A detail pane waiting for a selection should read as an invitation, not as
   a stray line of text pinned to the top-left of an empty card. */
#job-detail > .hint,
#doc-detail > .hint,
#sub-detail > .hint {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
}

/* Status colors. The views had a scattering of Flat-UI hex values left over
   from early prototyping; these are the tokens they now resolve to. */
:root {
  --warn-amber: #ffc25c;
  --info:       #7fb2ff;
  --err:        #ff6b78;
}

/* --border-soft is referenced by the jobs, estimates and invoice list rows but
   was never defined, so those rows drew a transparent border and the list read
   as one undivided block. */
:root { --border-soft: #262a23; }
.job-row:hover, .doc-row:hover, .sub-row:hover {
  border-color: var(--border-hi) !important;
  background: var(--surface2) !important;
}
