/* =============================================================================
   style.css — page styling for the Titus Financial Review app.
   Plain CSS, no framework. Colors echo the report palette in the spec.
   ============================================================================= */

/* Light theme (default). All colors are variables so a dark theme is just a
   second set of these values — see [data-theme="dark"] below. The four brand
   accents (green/red/blue/amber) double as chart-series colors in app.js. */
:root {
  --green: #1d9e75;
  --red: #e24b4a;
  --blue: #185fa5;
  --amber: #854f0b;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e3e7ec;
  --bg: #f7f9fb;
  --panel: #ffffff;
  --highlight: #eef6f2;
  --panel-2: #ffffff;      /* surfaces of inputs, chips, comment icons */
  --hover: #fafcfe;        /* table-row hover tint */
  --primary-hover: #14497f;/* primary-button hover */
  --on-ink: #ffffff;       /* text drawn on an --ink-filled background */
}

/* Dark theme. Set by a toggle (theme.js) which flips data-theme on <html> and
   persists it to localStorage. The accents are nudged brighter so variance
   text and the chart palette keep enough contrast on the dark canvas. */
[data-theme="dark"] {
  --green: #35c596;
  --red: #f4716f;
  --blue: #5aa1e6;
  --amber: #d9a23f;
  --ink: #e6eaf0;
  --muted: #97a3b3;
  --line: #313a47;
  --bg: #0f141a;
  --panel: #19212b;
  --highlight: #16302a;
  --panel-2: #222c38;
  --hover: #202a36;
  --primary-hover: #4a90d9;
  --on-ink: #0f141a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---- Top bar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-right label { color: var(--muted); font-size: 13px; }
.topbar-label { color: var(--muted); font-size: 12px; }
.review-select {
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 13px; background: var(--panel-2); color: var(--ink);
}

/* Light/dark toggle button (top bar on the report page, floating on upload). */
.theme-toggle {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle:hover { background: var(--bg); }
.theme-toggle--floating {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.upload-link {
  font-size: 13px;
  color: var(--blue);
  text-decoration: none;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 6px;
}
.upload-link:hover { background: var(--bg); }

/* ---- Top navbar: brand (logo + KCP Finance + active company) on the left,
   inline report controls in the middle, and a collapsible ☰ menu on the right.
   Replaces the old .topbar (whose styles remain above, now unused). ---- */
.navbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 10px 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink); flex: 0 0 auto;
}
.nav-logo { height: 30px; width: auto; display: block; border-radius: 4px; }
.nav-brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.2px; }
.nav-company {
  font-size: 13px; color: var(--muted); white-space: nowrap;
  padding-left: 10px; border-left: 1px solid var(--line);
}
.nav-mid { flex: 1 1 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-right { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }

.nav-menu-wrap { position: relative; }
.nav-menu-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  width: 36px; height: 32px; border-radius: 6px; cursor: pointer;
  font-size: 16px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.nav-menu-btn:hover { background: var(--bg); }
.nav-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  padding: 6px; z-index: 60; display: flex; flex-direction: column;
}
.nav-menu[hidden] { display: none; }   /* beats the .nav-menu display:flex above */
.nav-menu-id { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-menu-id-label {
  display: block; font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.nav-menu-id-name { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.nav-menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px; border-radius: 6px; font-size: 14px;
  color: var(--ink); text-decoration: none;
  background: none; border: none; width: 100%; text-align: left;
  cursor: pointer; font: inherit;
}
.nav-menu-item:hover { background: var(--bg); }
.nav-menu-item--soon { color: var(--muted); }
.nav-soon {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--amber); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 7px; background: var(--panel-2);
}
.nav-menu-signout {
  color: var(--red); border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px; margin-top: 4px;
}

/* Login screen logo (centered above the wordmark). */
.login-logo { display: block; width: 76px; height: auto; margin: 0 auto 14px; border-radius: 12px; }

/* Company picker section inside the ☰ menu. */
.nav-menu-section { padding: 2px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-menu-section[hidden] { display: none; }
.nav-menu-section-label {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.4px; padding: 4px 10px 2px;
}
.nav-company-item.active { font-weight: 700; }
.nav-company-item.active::after { content: "✓"; color: var(--green); margin-left: auto; }

/* Sticky per-company report header — sits just below the (sticky) navbar. */
.report-bar {
  position: sticky; top: 53px; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding: 12px 22px 10px;
}
.report-bar-row {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
}
.report-company { margin: 0; font-size: 18px; font-weight: 700; }
.report-controls { display: flex; align-items: center; gap: 8px; }

/* Company tab strip (shown only in the "All companies" view). */
.company-tabs { max-width: 1180px; margin: 0 auto 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.company-tab {
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--muted); font-size: 13px;
  cursor: pointer; text-decoration: none;
}
.company-tab:hover { background: var(--panel); color: var(--ink); }
.company-tab.active {
  background: var(--ink); color: var(--on-ink); border-color: var(--ink); font-weight: 600;
}

/* ---- Layout ---- */
main { max-width: 1180px; margin: 0 auto; padding: 24px 22px 80px; }
.report { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px; }
.report-divider { border: none; height: 28px; }
.report h2 { margin: 0 0 4px; font-size: 18px; }
.report .subtitle { color: var(--muted); margin: 0 0 16px; font-size: 13px; }

.no-data { max-width: 640px; margin: 80px auto; text-align: center; }
.no-data h2 { font-size: 20px; }
.no-data a { color: var(--blue); }

/* ---- Month selector buttons ---- */
.month-selector { display: flex; gap: 6px; margin: 4px 0 16px; flex-wrap: wrap; }
.month-btn {
  border: 1px solid var(--line);
  background: var(--panel-2);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
}
.month-btn:hover { background: var(--bg); }
.month-btn.active { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* ---- Tables ---- */
table.fin { width: 100%; border-collapse: collapse; }
table.fin th, table.fin td { padding: 7px 10px; text-align: right; white-space: nowrap; }
table.fin th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); border-bottom: 2px solid var(--line); }
table.fin td.label, table.fin th.label { text-align: left; }
table.fin td.label.indent { padding-left: 26px; }
table.fin tr.section td { font-weight: 700; padding-top: 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
table.fin tr.subtotal td { font-weight: 600; border-top: 1px solid var(--line); }
table.fin tr.total td { font-weight: 700; border-top: 2px solid var(--ink); }
table.fin tr.highlight td { background: var(--highlight); }
table.fin tr.datarow:hover { background: var(--hover); }
.num-neutral { color: var(--ink); }
.var-green { color: var(--green); font-weight: 600; }
.var-red { color: var(--red); font-weight: 600; }
.var-gray { color: var(--muted); }

/* ---- GL drill-down (Reports 1 & 2): expand a line into its GL accounts ---- */
.gl-toggle {
  display: inline-block; width: 12px; margin-right: 5px;
  color: var(--muted); font-size: 10px; line-height: 1; vertical-align: middle;
}
table.fin td.label.expandable { cursor: pointer; user-select: none; }
table.fin td.label.expandable:hover { color: var(--blue); }
table.fin tr.gl-sub td { font-size: 12px; color: var(--muted); padding-top: 4px; padding-bottom: 4px; }
table.fin tr.gl-sub td.label.gl-acct { padding-left: 44px; font-style: italic; white-space: normal; }
table.fin tr.gl-sub:hover td { background: var(--hover); }

/* ---- Report 2 month delineation: distinguish % from $ and group by month ---- */
table.fin td.ytd-pct, table.fin th.ytd-pct { font-style: italic; color: var(--muted); background: rgba(127, 127, 127, 0.045); }
table.fin td.ytd-month-end, table.fin th.ytd-month-end { border-right: 1px solid var(--line); }
/* The YTD summary column (Report 2): bolded + lightly washed, boxed off from the months. */
table.fin td.ytd-summary, table.fin th.ytd-summary { font-weight: 700; background: rgba(127, 127, 127, 0.10); }
table.fin td.ytd-dollar.ytd-summary, table.fin th.ytd-dollar.ytd-summary { border-left: 2px solid var(--line); }
/* Report 2 is wide: scroll it horizontally inside the card, line-item column frozen. */
.ytd-scroll { overflow-x: auto; }
.ytd-scroll table.fin th.label,
.ytd-scroll table.fin td.label:not([colspan]) {
  position: sticky; left: 0; z-index: 2; background: var(--panel);
}
.ytd-scroll table.fin tr.highlight td.label { background: var(--highlight); }
.trend-cell { font-size: 16px; }
.trend-up-good, .trend-down-good { color: var(--green); }
.trend-up-bad, .trend-down-bad { color: var(--red); }
.trend-flat { color: var(--muted); }

/* ---- Comment icons + badges ---- */
td.comment-col, th.comment-col { width: 34px; text-align: center; }
.comment-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  cursor: pointer; font-size: 12px; position: relative; line-height: 1;
}
.comment-icon:hover { border-color: var(--blue); color: var(--blue); }
.comment-icon.has-notes { border-color: var(--blue); color: var(--blue); }
.badge {
  position: absolute; top: -7px; right: -7px;
  background: var(--blue); color: #fff; border-radius: 9px;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; padding: 0 3px; font-weight: 700;
}

/* ---- Note panels (inline in tables and below charts) ---- */
.note-panel {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 8px 0; text-align: left; max-width: 560px;
}
.note-panel.chart-panel { margin: 12px 0 0; }
.note-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.note-panel-title { font-weight: 600; font-size: 13px; }
.note-panel-close { cursor: pointer; border: none; background: none; color: var(--muted); font-size: 18px; line-height: 1; }
.note-thread { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.note-item { background: var(--bg); border-radius: 6px; padding: 8px 10px; position: relative; }
.note-item .meta { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
/* Admin-only per-comment delete control (top-right of each note). */
.note-delete {
  position: absolute; top: 6px; right: 8px;
  border: none; background: none; color: var(--muted);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px;
}
.note-delete:hover { color: var(--red); }
.note-delete:disabled { opacity: 0.4; cursor: default; }
.note-item > div:not(.meta) { padding-right: 16px; }  /* keep text clear of the × */
.note-item .meta .author { font-weight: 700; color: var(--ink); }
.note-empty { color: var(--muted); font-size: 13px; font-style: italic; }
.note-form { display: flex; flex-direction: column; gap: 6px; }
.note-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-family: inherit; font-size: 13px; resize: vertical; min-height: 54px; }
.note-form .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.note-error { color: var(--red); font-size: 12px; }

/* ---- Buttons ---- */
.primary-btn { background: var(--blue); color: #fff; border: none; padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.primary-btn:hover { background: var(--primary-hover); }
.primary-btn:disabled { opacity: 0.6; cursor: default; }

/* ---- Charts ---- */
.chart-box { position: relative; height: 420px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); }
.legend-swatch { width: 22px; height: 0; border-top-width: 3px; border-top-style: solid; }
.legend-swatch.dashed { border-top-style: dashed; }
.segment-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.segment-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); border-radius: 16px; padding: 4px 11px; cursor: pointer; font-size: 12px; }
.segment-btn:hover { background: var(--bg); }
.segment-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.segment-btn .seg-badge { background: var(--blue); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; font-weight: 700; }

/* ---- Upload page ---- */
.upload-wrap { max-width: 620px; margin: 50px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 30px 34px; }
.upload-wrap h1 { margin: 0; font-size: 22px; }
.upload-wrap h2 { margin: 4px 0 6px; font-size: 16px; color: var(--muted); font-weight: 500; }
.upload-intro { color: var(--muted); margin-bottom: 22px; }
.upload-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 18px; }
.upload-card h3 { margin: 0 0 4px; font-size: 15px; }
.upload-card p { color: var(--muted); margin: 0 0 12px; font-size: 13px; }
.upload-card input[type="file"] { display: block; margin-bottom: 10px; font-size: 13px; }
.upload-status { margin-top: 10px; font-size: 13px; min-height: 18px; }
.upload-status.success { color: var(--green); }
.upload-status.error { color: var(--red); }
.upload-status.pending { color: var(--muted); }
.upload-footer { margin-top: 8px; }
.upload-footer a { color: var(--blue); text-decoration: none; }
/* Table 7 upload cards: a small "set once / monthly" tag + labeled file pickers. */
.card-tag {
  font-size: 11px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; margin-left: 6px;
  text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.file-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.file-label input[type="file"] { margin-top: 4px; }
/* Upload page: group headings (Monthly vs Set once) + the divider between them. */
.upload-section {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); margin: 4px 0 12px;
}
.upload-divider { border: none; border-top: 1px solid var(--line); margin: 26px 0 18px; }

/* ---- Table 7: per-crane Core Gross Margin ---- */
.table7-summary { font-weight: 600; color: var(--ink); }
.table7-equip { font-size: 12px; color: var(--muted); font-weight: 400; }
table.fin tr.table7-idle td { color: var(--muted); }
table.fin tr.table7-idle td.label { font-style: italic; }

/* ---- Auth: identity bar, sign-out, login, admin, access-request ---- */
.current-user { color: var(--muted); font-size: 13px; }
.text-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
.text-btn:hover { background: var(--bg); }

/* Login page */
.login-wrap {
  max-width: 420px; margin: 90px auto; text-align: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 36px 34px;
}
.login-wrap h1 { margin: 0; font-size: 22px; }
.login-wrap h2 { margin: 4px 0 18px; font-size: 16px; color: var(--muted); font-weight: 500; }
.login-intro { color: var(--muted); margin-bottom: 22px; }
.login-status { margin-top: 14px; font-size: 13px; min-height: 18px; color: var(--muted); }

/* Access-required screen reuses .no-data; give its button some breathing room. */
#needs-access .primary-btn, #upload-gate .primary-btn { margin-top: 14px; }

/* Admin page */
.admin-wrap { max-width: 820px; margin: 30px auto; padding: 0 22px; }
.admin-message { margin: 12px 0; font-size: 13px; color: var(--muted); min-height: 18px; }
.admin-message.error { color: var(--red); }
.admin-message.success { color: var(--green); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab-btn {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 9px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--ink); border-bottom-color: var(--blue); font-weight: 600; }
.tab-panel[hidden] { display: none; }

/* Add-user form (Users & roles tab) */
.add-user-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 6px 0 18px; }
.add-user-card h3 { margin: 0 0 10px; font-size: 14px; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row input, .form-row select {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 8px; font-size: 13px;
}
.form-row input { min-width: 160px; }
.form-hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }

/* Status pill in the users table */
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; text-transform: capitalize; }
.pill.active { background: var(--highlight); color: var(--green); }
.pill.pending { background: var(--panel-2); color: var(--amber); }
.pill.denied { background: var(--panel-2); color: var(--red); }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.admin-table th, .admin-table td {
  text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.admin-table th { color: var(--muted); font-weight: 600; }
.admin-table select {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 6px; padding: 4px 6px;
}
.small-btn { padding: 4px 10px; font-size: 12px; margin-left: 6px; }

/* Review-version management list (upload page) */
.versions-list { font-size: 13px; }
.version-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.version-row:last-child { border-bottom: none; }
.version-row .small-btn { background: var(--red); }

/* ---- Report 6: AR trends & payment forecast ---- */
.ar-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 18px; border-bottom: 1px solid var(--line); }
.ar-tab {
  border: 1px solid var(--line); border-bottom: none; background: var(--panel-2); color: var(--muted);
  padding: 8px 16px; border-radius: 8px 8px 0 0; cursor: pointer; font-size: 13px; position: relative; top: 1px;
}
.ar-tab:hover { background: var(--bg); }
.ar-tab.active { background: var(--panel); color: var(--ink); font-weight: 600; border-bottom: 2px solid var(--panel); }
.ar-view { padding-top: 4px; overflow-x: auto; }
.ar-subhead { margin: 22px 0 8px; font-size: 14px; }
.ar-intro { font-size: 13px; color: var(--ink); margin: 4px 0 14px; }
.ar-caption { font-size: 12px; color: var(--muted); margin: 8px 0 18px; max-width: 760px; }
.ar-footnote { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 8px; }
.ar-recon {
  font-size: 12.5px; line-height: 1.5; margin: 0 0 16px; padding: 10px 14px; border-radius: 8px;
  background: var(--highlight); border: 1px solid var(--line); color: var(--ink);
}
.ar-recon.warn { background: rgba(226, 75, 74, 0.10); border-color: var(--red); }

/* ---- "Show all comments" drawer (collapsed by default) ---- */
.comments-drawer { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 10px; }
.comments-drawer-summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--blue);
  list-style: none; user-select: none; display: inline-flex; align-items: center;
}
.comments-drawer-summary::-webkit-details-marker { display: none; }
.comments-drawer-summary::before { content: "\25B8"; margin-right: 6px; font-size: 11px; }
details[open] > .comments-drawer-summary::before { content: "\25BE"; }
.comments-drawer-summary:hover { text-decoration: underline; }
.comments-drawer-body { margin-top: 12px; display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.cd-group-title { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 5px; }
.cd-empty { color: var(--muted); font-style: italic; font-size: 13px; }
.ar-table { margin-top: 14px; }

/* Customer Detail (Report 6, Tab 4): cap the height to ~15-20 rows and scroll
   both ways, with the header row and the totals row pinned so the month columns
   stay readable no matter how far down the list you scroll. */
.ar-detail-scroll {
  margin-top: 14px; max-height: 560px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
.ar-detail-scroll table.ar-table { margin-top: 0; }
.ar-detail-scroll thead th {
  position: sticky; top: 0; z-index: 3; background: var(--panel);
  /* border-collapse drops the cell border when sticky, so back it with a shadow */
  box-shadow: inset 0 -2px 0 var(--line);
}
.ar-detail-scroll tr.total td {
  position: sticky; bottom: 0; z-index: 2; background: var(--panel);
  box-shadow: inset 0 2px 0 var(--ink);
}
/* Freeze the Customer column on the left while the month values scroll across. */
.ar-detail-scroll th.label, .ar-detail-scroll td.label {
  position: sticky; left: 0; z-index: 2; background: var(--panel);
}
.ar-detail-scroll thead th.label { z-index: 5; }       /* top-left corner: above the sticky header */
.ar-detail-scroll tr.total td.label { z-index: 4; }    /* bottom-left corner: above the sticky total */
/* Month delineators in the detail table: a divider after each Collections column. */
table.fin.ar-table td.ar-month-end, table.fin.ar-table th.ar-month-end {
  border-right: 1px solid var(--line);
}

/* Report 7 detail table: cap height with a sticky header + pinned fleet-total row. */
.table7-scroll {
  margin-top: 14px; max-height: 560px; overflow: auto;
  border: 1px solid var(--line); border-radius: 8px;
}
.table7-scroll table.table7-table { margin-top: 0; }
.table7-scroll thead th {
  position: sticky; top: 0; z-index: 3; background: var(--panel);
  box-shadow: inset 0 -2px 0 var(--line);
}
.table7-scroll tr.total td {
  position: sticky; bottom: 0; z-index: 2; background: var(--highlight);
  box-shadow: inset 0 2px 0 var(--ink);
}
/* "What's excluded" caveat under the Report 7 headline. */
.table7-note {
  font-size: 12px; color: var(--muted); line-height: 1.5; max-width: 860px;
  margin: 4px 0 14px; padding: 9px 12px;
  background: rgba(127, 127, 127, 0.05); border-left: 3px solid var(--line); border-radius: 4px;
}
.table7-note strong { color: var(--ink); }
/* Report 7 reconciliation bridge (collapsible; reuses the comments-drawer chrome). */
.table7-recon-table { max-width: 660px; margin: 12px 0 4px; }
.table7-recon-table td { padding: 5px 10px; }
.table7-recon-table td.label { white-space: normal; }
/* Amber for mid-size open balances ($50K–$200K). Red/neutral reuse var-red/num-neutral. */
.ar-amber { color: var(--amber); font-weight: 600; }
