/* ============================================================
   Everflow Accounting — "Refined Light" v2 (U-UI)
   The SAME design language as Everflow Practice OS (U27/U29):
   Manrope body + Sora headings, paper surfaces, ink text, ONE
   indigo accent, hairline rules, tabular numerals, quiet chrome,
   the everflow wordmark. Class names unchanged — app.js untouched.
   ============================================================ */
:root {
  --accent: #4F46E5;        /* THE accent — indigo */
  --accent-dark: #4338CA;
  --accent-ink: #3730A3;    /* accent-as-text on soft fills (AA) */
  --accent-soft: #EEF0FE;   /* soft indigo fill */
  --navy: #0E1526;          /* Ink */
  --navy-2: #1B2540;
  --ef-teal-light: #A5B4FC;
  --ef-gold: #D99A2B;

  --bg: #F7F8FA;            /* Paper */
  --sunken: #F1F3F6;
  --card-bg: #FFFFFF;
  --border: #E6E9EF;
  --border-2: #D8DDE6;
  --text: #0E1526;
  --text-2: #4B5565;
  --muted: #5F6B7A;
  --ink-3: #8A94A6;
  --green: #0F8A5F;  --green-soft: #E7F6EF;
  --amber: #B45309;  --amber-soft: #FDF3E3;
  --red: #C2362F;    --red-soft: #FCEBEA;
  --shadow: 0 1px 2px rgba(14, 21, 38, 0.05);
  --shadow-hover: 0 4px 16px rgba(14, 21, 38, 0.07);
}

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

body {
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: "Sora", "Manrope", sans-serif; letter-spacing: -0.01em; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.muted { color: var(--muted); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Everflow wordmark: "ever" upright ink + "flow" italic indigo (Sora) */
.ef-wordmark {
  font-family: "Sora", sans-serif; font-weight: 700; letter-spacing: -0.03em;
  color: var(--navy); line-height: 1;
}
.ef-wordmark .ef-flow { font-style: italic; color: var(--accent); }
.ef-tagline {
  font-family: "Manrope", sans-serif; font-weight: 700; font-size: 11px;
  letter-spacing: 0.28em; color: var(--navy);
}
.brand-caption {
  text-align: center; font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3); font-weight: 600;
}

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar (light, hairline, S1 icons) ---------- */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--card-bg);
  color: var(--text-2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 50;
}
.brand-wrap {
  display: flex; flex-direction: column; gap: 7px;
  padding: 20px 16px 16px; border-bottom: 1px solid var(--border);
}
.nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em;
  padding: 14px 12px 6px; color: var(--ink-3); font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: none; color: var(--text-2);
  padding: 9px 12px; border-radius: 7px; cursor: pointer;
  font-size: 13px; font-weight: 500; margin-bottom: 2px;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--sunken); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.nav-item .ti { color: var(--accent); opacity: .85; font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-item.active .ti { color: var(--accent-ink); opacity: 1; }
.nav-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.25); }

.sidebar-footer {
  padding: 12px 10px; border-top: 1px solid var(--border);
}
.sidebar-footer .whoami { font-size: 11.5px; color: var(--ink-3); padding: 0 12px 8px; }

/* ---------- Main ---------- */
.main { flex: 1; margin-left: 240px; padding: 24px 32px 48px; max-width: 1180px; }

/* ---------- Topbar (white card band, sticky, Sora title) ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 18px; margin-bottom: 20px;
  box-shadow: var(--shadow);
  position: sticky; top: 12px; z-index: 40;
}
.topbar h1 { font-size: 18px; font-weight: 650; color: var(--text); letter-spacing: -0.025em; }
.topbar .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: box-shadow 0.18s ease, border-color 0.18s;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card h2, .card h3 { font-size: 15px; font-weight: 650; }

/* ---------- Buttons (B1: soft square — flat, 8px radius, 34px height) ---------- */
.btn {
  background: var(--accent); color: #fff; border: none;
  min-height: 34px; padding: 0 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.35); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost {
  background: var(--card-bg); border: 1px solid var(--border); color: var(--muted);
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s;
}
.btn.ghost:hover { background: var(--card-bg); color: var(--accent-ink); border-color: var(--accent); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }

/* ---------- Inputs ---------- */
input, select, textarea {
  font: inherit; font-size: 13px; color: var(--text);
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg); outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
label.fld {
  display: block; font-size: 11px; color: var(--ink-3); margin: 8px 0 4px;
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.msg { font-size: 12.5px; color: var(--red); min-height: 16px; }
.msg.ok { color: var(--green); }

/* ---------- Tables ---------- */
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); border-bottom: 1px solid var(--border-2);
  padding: 8px; font-weight: 700;
}
table.grid td { padding: 8px; border-bottom: 1px solid var(--border); }
table.grid tbody tr { transition: background 0.12s; }
table.grid tbody tr:hover td { background: var(--sunken); }
table.grid tfoot td { font-weight: 800; border-top: 2px solid var(--border-2); border-bottom: none; }

/* ---------- Pills ---------- */
.pill {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 700;
  border-radius: 99px; padding: 2px 9px; background: var(--sunken); color: var(--text-2);
  border: none; font-family: inherit;
}
.pill.green  { background: var(--green-soft);  color: var(--green); }
.pill.amber  { background: var(--amber-soft);  color: var(--amber); }
.pill.red    { background: var(--red-soft);    color: var(--red); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); }

.balanced-ok { color: var(--green); font-weight: 800; }
.balanced-no { color: var(--red); font-weight: 800; }
.empty { color: var(--muted); padding: 32px; text-align: center; }

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 9px;
  overflow: hidden; background: var(--card-bg); box-shadow: var(--shadow);
}
.seg button {
  border: none; background: transparent; padding: 7px 14px;
  font-size: 12.5px; cursor: pointer; font-weight: 600; color: var(--muted);
  font-family: inherit; transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text); background: var(--sunken); }
.seg button.active { background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Auth (the Practice OS login card) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.auth-card {
  background: var(--card-bg); border-radius: 16px; padding: 34px;
  width: 370px; max-width: 92vw;
  box-shadow: var(--shadow-hover); border: 1px solid var(--border);
}
.auth-card h2 { font-size: 17px; margin-bottom: 4px; }
.auth-card input {
  width: 100%; padding: 10px 12px; margin-bottom: 10px;
  font-size: 13.5px; border-radius: 8px;
}
.auth-brand { text-align: center; padding: 0 0 20px; }

/* ---------- Journal lines ---------- */
.jlines input.amt { width: 120px; }
.jlines select { max-width: 260px; }

/* ---------- Scrollbars (quiet) ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Print (packs, invoices, reports) ---------- */
@media print {
  .sidebar, .seg, .btn, button, input[type="date"], select, label.fld { display: none !important; }
  .main { margin-left: 0; max-width: none; padding: 0; }
  .topbar { position: static; border: none; box-shadow: none; padding: 0 0 10px; }
  .card { border: none; box-shadow: none; page-break-inside: avoid; padding: 8px 0; }
  body { background: #fff; }
}

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
  .sidebar { position: static; width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .shell { flex-direction: column; }
  .main { margin-left: 0; padding: 16px; }
}
