:root {
  --bg: #0a0a0c;
  --bg-panel: #111113;
  --bg-card: #131316;
  --bg-hover: #19191d;
  --border: #28282c;
  --border-soft: #1e1e22;
  --accent: #c9a24d;
  --accent-soft: rgba(201, 162, 77, 0.14);
  --text: #e9e7e1;
  --text-dim: #9a9aa2;
  --text-faint: #616166;
  --green: #4cbf7d;
  --green-soft: rgba(76, 191, 125, 0.14);
  --red: #e2665f;
  --red-soft: rgba(226, 102, 95, 0.14);
  --amber: #d9a441;
  --amber-soft: rgba(217, 164, 65, 0.14);
  --gray-soft: rgba(154, 154, 162, 0.14);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

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

/* Sidebar */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 22px 0 0;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logo {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 20px;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 0 24px 26px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 18px;
}
.logo span { color: var(--text); }

/* Tenant Console account card (replaces the plain wordmark there) */
.account-card {
  padding: 0 20px 18px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 16px;
  flex-shrink: 0;
}
.account-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.account-brand-logo {
  width: 32px; height: 32px; border-radius: 7px; object-fit: cover;
  border: 1px solid var(--border); flex-shrink: 0;
}
.account-brand-mono {
  width: 32px; height: 32px; border-radius: 7px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 13px;
  border: 1px solid var(--border); flex-shrink: 0;
}
.account-brand-name {
  font-family: var(--serif); color: var(--text); font-size: 15px;
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-chevron { color: var(--text-faint); font-size: 10px; flex-shrink: 0; }
.account-user-name { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.account-user-email {
  font-size: 12px; color: var(--text-dim); margin: 0;
  display: flex; align-items: center; gap: 6px; overflow: hidden;
}
.account-user-email span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-user-email .nav-icon svg { width: 13px; height: 13px; }

.sidebar-footer { flex-shrink: 0; padding: 12px 20px; border-top: 1px solid var(--border-soft); }
.logout-link { display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13.5px; padding: 6px 0; }
.logout-link:hover { color: var(--red); }

.nav { flex: 1; overflow-y: auto; padding-bottom: 16px; }

.nav-group { padding: 0 12px; margin-bottom: 22px; }

/* Tenant Console nav rows: a nav-link plus an optional quick-add "+" button
   beside it. Platform Console's nav-links aren't wrapped in .nav-row, so
   this is additive and doesn't change that sidebar's layout. */
.nav-row { display: flex; align-items: center; gap: 2px; padding: 0 12px; }
.nav-row .nav-link { flex: 1; padding: 8px; margin-bottom: 0; }
.nav-quick-add {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
}
.nav-quick-add:hover { background: var(--accent-soft); color: var(--accent); }

.nav-group-label {
  font-size: 10.5px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 12px 8px;
  margin: 0;
  font-weight: 600;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 5px;
  color: var(--text);
  font-size: 13.5px;
  margin-bottom: 2px;
}

.nav-link:hover { background: var(--bg-hover); color: var(--text); }

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-icon { display: inline-flex; flex-shrink: 0; opacity: 1; }
.nav-icon svg { display: block; }

/* Main */
.main { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}

.page-heading {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  font-weight: 400;
}

.topbar-right { display: flex; align-items: center; gap: 16px; }

.signed-in { font-size: 13px; color: var(--text-dim); }
.signed-in strong { color: var(--text); font-weight: 600; }

.badge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.logout-form { margin: 0; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 7px 16px;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--sans);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-ghost-sm {
  font-size: 12.5px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.btn-ghost-sm:hover { border-color: var(--accent); color: var(--accent); }

.content { padding: 30px 36px 60px; }

.page-subtitle { color: var(--text-dim); font-size: 13.5px; margin: -8px 0 20px; }

/* Stat tiles */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 18px 20px;
}
.tile.tone-amber { border-left-color: var(--amber); }
.tile.tone-red { border-left-color: var(--red); }

.tile-label {
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
  font-weight: 600;
}

.tile-value {
  font-family: var(--serif);
  font-size: 28px;
  color: var(--accent);
  margin: 0 0 6px;
}
.tile.tone-amber .tile-value { color: var(--amber); }
.tile.tone-red .tile-value { color: var(--red); }

.tile-sub { font-size: 12.5px; color: var(--text-faint); margin: 0; }

/* Panels */
.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  overflow: hidden;
}
.panel-wide { margin-bottom: 20px; }

.panel-header {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.kv-table { padding: 0 20px; }

.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  gap: 12px;
}
.kv-row:last-child { border-bottom: none; }

.kv-key {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
  flex-shrink: 0;
}

.kv-value { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.kv-detail { color: var(--text-dim); font-size: 12.5px; }

.panel-footer-link {
  display: block;
  padding: 14px 20px;
  font-size: 12.5px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}
.panel-footer-link:hover { color: var(--accent); }

/* Tables */
.table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow-x: auto;
}
.table-wrap-flush { border: none; border-radius: 0; border-top: 1px solid var(--border-soft); }

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  text-align: left;
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
  white-space: nowrap;
}

.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.col-actions { text-align: right; width: 1%; }

.empty-row { text-align: center; color: var(--text-faint); padding: 32px 18px; }

/* Pills */
.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-gray { background: var(--gray-soft); color: var(--text-dim); }

/* Placeholder */
.placeholder-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 60px 40px;
  text-align: center;
  max-width: 560px;
  margin: 40px auto 0;
}
.placeholder-eyebrow {
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 14px;
}
.placeholder-title {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 14px;
  font-weight: 400;
}
.placeholder-desc { color: var(--text-dim); font-size: 13.5px; line-height: 1.7; margin: 0; }

/* Buttons */
.btn-primary {
  display: inline-block;
  background: var(--accent);
  color: #14110a;
  border: none;
  padding: 9px 18px;
  border-radius: 5px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  text-align: center;
}
.btn-primary:hover { opacity: 0.9; }
.btn-block { display: block; width: 100%; }

/* Page actions row (list pages with a create button) */
.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-actions .page-subtitle { margin: 0; }

/* Flash / messages */
.flash-list { margin-bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  padding: 11px 16px;
  border-radius: 4px;
  font-size: 13.5px;
  border: 1px solid var(--border);
}
.flash-success { background: var(--green-soft); color: var(--green); border-color: transparent; }
.flash-error { background: var(--red-soft); color: var(--red); border-color: transparent; }
.flash-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Empty state (dashboard onboarding nudge) */
.empty-state {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 22px 24px;
  margin-bottom: 26px;
}
.empty-state-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.empty-state-desc { color: var(--text-dim); font-size: 13.5px; margin: 0 0 16px; }

/* Forms */
.form-panel { padding: 0 0 22px; margin-bottom: 20px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 20px;
  padding: 20px;
}
.form-field-wide { grid-column: 1 / -1; }
.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.field-help { font-size: 12px; color: var(--text-faint); margin: 6px 0 0; }
.field-error { font-size: 12px; color: var(--red); margin: 6px 0 0; }

.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="password"],
.form-field select,
.form-field textarea,
.auth-form input[type="text"],
.auth-form input[type="password"] {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: var(--sans);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.form-field input[type="checkbox"] { width: auto; margin-top: 4px; }
.form-field select:disabled,
.form-field input:disabled { opacity: 0.55; cursor: not-allowed; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 4px 20px 0;
}

/* Line items (Invoice line-item table) */
.line-items-header { margin-top: 4px; }
.line-items-wrap { margin: 0 20px 14px; }
.line-items-table th, .line-items-table td { white-space: normal; }
.line-items-table input[type="text"],
.line-items-table input[type="number"],
.line-items-table select {
  width: 100%;
  min-width: 90px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 9px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--sans);
}
.line-items-table input:focus,
.line-items-table select:focus { outline: none; border-color: var(--accent); }
.line-items-table .col-est { color: var(--text-dim); font-size: 13px; white-space: nowrap; }
.line-item-row.marked-deleted { opacity: 0.4; }
.line-item-row.marked-deleted input, .line-item-row.marked-deleted select { text-decoration: line-through; }
.delete-row-label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.line-items-actions { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 4px; }
.line-items-total { margin: 0; font-size: 13px; color: var(--text-dim); }
.line-items-total span { color: var(--text); font-weight: 600; }

/* ==========================================================================
   Invoice form — light theme (opt-in via body.theme-invoice-ninja)
   Scoped entirely under body.theme-invoice-ninja so no other page in the
   console is affected. The sidebar stays the console's normal dark/gold —
   only the topbar + content area switch to a light, card-based look for
   this one page.
   ========================================================================== */
body.theme-invoice-ninja .topbar {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}
body.theme-invoice-ninja .page-heading { color: #111827; }
body.theme-invoice-ninja .content { background: #f3f4f6; }
body.theme-invoice-ninja .flash {
  background: #fff;
  border-color: #e5e7eb;
}
body.theme-invoice-ninja .flash-success { background: #ecfdf5; color: #047857; }
body.theme-invoice-ninja .flash-error { background: #fef2f2; color: #b91c1c; }
body.theme-invoice-ninja .flash-info { background: #eff6ff; color: #1d4ed8; }

.inv-theme { color: #1f2937; font-size: 13.5px; }
.inv-theme a { color: #2563eb; }

.inv-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.inv-breadcrumb { color: #6b7280; font-size: 13px; }
.inv-breadcrumb a { color: #6b7280; }
.inv-breadcrumb a:hover { color: #2563eb; }
.inv-breadcrumb .inv-crumb-current { color: #111827; font-weight: 600; }
.inv-toolbar-actions { display: flex; gap: 10px; }

.inv-btn {
  display: inline-block;
  border-radius: 5px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  border: 1px solid transparent;
}
.inv-btn-primary { background: #111827; color: #fff; }
.inv-btn-primary:hover { background: #1f2937; }
.inv-btn-ghost { background: #fff; color: #374151; border-color: #d1d5db; }
.inv-btn-ghost:hover { border-color: #9ca3af; }
.inv-btn-link {
  background: none;
  border: none;
  color: #2563eb;
  cursor: pointer;
  font-size: 13.5px;
  font-family: var(--sans);
  padding: 0;
}
.inv-btn-link:hover { text-decoration: underline; }

.inv-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 18px 20px;
}
.inv-header-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}
@media (max-width: 900px) { .inv-header-grid { grid-template-columns: 1fr; } }

.inv-card-label {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0 0 6px;
}
.inv-field-row { margin-bottom: 14px; }
.inv-field-row:last-child { margin-bottom: 0; }
.inv-field-row label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 5px;
}

.inv-theme select,
.inv-theme input[type="text"],
.inv-theme input[type="email"],
.inv-theme input[type="number"],
.inv-theme input[type="date"],
.inv-theme textarea {
  width: 100%;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #1f2937;
  padding: 8px 11px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: var(--sans);
}
.inv-theme select:focus,
.inv-theme input:focus,
.inv-theme textarea:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.inv-theme select:disabled,
.inv-theme input:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
.inv-theme .field-error { color: #dc2626; font-size: 12px; margin: 5px 0 0; }
.inv-theme .field-help { color: #9ca3af; font-size: 11.5px; margin: 5px 0 0; }

.inv-contact-preview {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 5px;
  font-size: 12.5px;
  color: #4b5563;
  display: none;
}
.inv-contact-preview.visible { display: block; }
.inv-contact-preview strong { color: #1f2937; }

.inv-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e5e7eb; margin-bottom: 0; }
.inv-tab {
  padding: 10px 16px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  user-select: none;
}
.inv-tab.active { color: #111827; border-bottom-color: #2563eb; font-weight: 600; }
.inv-tab:hover:not(.active) { color: #374151; }

.inv-items-card { padding: 0; margin-bottom: 16px; overflow-x: auto; }
.inv-items-table { width: 100%; border-collapse: collapse; }
.inv-items-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #9ca3af;
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.inv-items-table td { padding: 10px 14px; border-bottom: 1px solid #f1f2f4; vertical-align: top; }
.inv-items-table tbody tr:last-child td { border-bottom: none; }
.inv-items-table .inv-col-total { white-space: nowrap; color: #374151; font-variant-numeric: tabular-nums; padding-top: 18px; }
.inv-items-table .inv-col-drag { width: 28px; padding-top: 16px; cursor: grab; color: #c7cad0; text-align: center; }
.inv-items-table .inv-col-drag:active { cursor: grabbing; }
.inv-items-table tr.inv-drag-over td { box-shadow: inset 0 2px 0 #2563eb; }
.inv-items-table .inv-col-remove { width: 32px; padding-top: 14px; text-align: center; }
.inv-remove-btn {
  background: none;
  border: none;
  color: #b0b4bb;
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  line-height: 1;
}
.inv-remove-btn:hover { color: #dc2626; }
.inv-items-table input, .inv-items-table select, .inv-items-table textarea { min-width: 90px; }
.inv-items-table textarea { resize: vertical; min-height: 34px; }
tr.inv-line-marked-deleted { opacity: 0.4; }
tr.inv-line-marked-deleted input, tr.inv-line-marked-deleted select, tr.inv-line-marked-deleted textarea { text-decoration: line-through; }
.inv-add-item-row { padding: 12px 14px; border-top: 1px solid #f1f2f4; }

.inv-bottom-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .inv-bottom-grid { grid-template-columns: 1fr; } }
.inv-notes-card { padding: 0; }
.inv-notes-card .inv-tabs { padding: 0 20px; }
.inv-tab-panel { padding: 16px 20px; }

.inv-summary-card { padding: 4px 20px; }
.inv-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #f1f2f4;
  font-size: 13.5px;
}
.inv-summary-row:last-child { border-bottom: none; }
.inv-summary-row span:first-child { color: #6b7280; }
.inv-summary-row span:last-child { font-variant-numeric: tabular-nums; color: #1f2937; }
.inv-summary-total span:last-child { font-weight: 700; font-size: 15px; color: #111827; }
.inv-summary-balance span:last-child { font-weight: 700; color: #b45309; }

.inv-form-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.inv-address-line { margin: 2px 0; font-size: 13px; color: #4b5563; }
.inv-detail-text { margin: 0; font-size: 13px; color: #374151; line-height: 1.6; white-space: pre-wrap; }
.inv-empty-note { color: #9ca3af; margin: 0; font-size: 13px; }
.inv-private-box {
  margin-top: 16px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 5px;
}
.inv-private-box .inv-card-label { color: #92400e; }

/* Invoice detail (read-only view) */
.inv-detail-header { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.inv-detail-header h1 { font-family: var(--sans); font-size: 21px; font-weight: 700; color: #111827; margin: 0; }
.inv-section-title {
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #9ca3af;
  margin: 0 0 10px;
}

/* Invoice Actions dropdown — used on the (dark-themed) invoice list and
   the (light-themed) invoice detail page, so it ships with dark-theme
   defaults here and a .inv-theme override below for the light page. It's
   positioned via JS with `position: fixed`, not CSS-anchored to its
   toggle button, so it's never clipped by the invoice list's
   overflow-x: auto table wrapper. */
.inv-actions-menu { position: relative; display: inline-block; }
.inv-actions-toggle { display: inline-flex; align-items: center; gap: 6px; }
.inv-actions-toggle .inv-menu-icon { width: 14px; height: 14px; }
.inv-actions-dropdown {
  position: fixed;
  min-width: 190px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 1000;
}
.inv-actions-dropdown[hidden] { display: none; }
.inv-menu-form { margin: 0; }
.inv-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
  text-decoration: none;
}
.inv-menu-item:hover { background: var(--bg-hover); color: var(--text); }
.inv-menu-item-danger { color: var(--red); }
.inv-menu-item-danger:hover { background: var(--red-soft); color: var(--red); }
/* Icons are plain inline SVGs (see _invoice_actions_menu.html) rather than
   an icon font/library, so this app never needs an external asset just to
   render them — currentColor keeps every icon matching its item's text
   color (including the danger-red Delete item) with zero extra rules. */
.inv-menu-icon { width: 15px; height: 15px; flex: none; color: inherit; }
.inv-menu-item span.inv-menu-label { flex: 1; }
.inv-menu-divider { height: 1px; background: var(--border); margin: 5px 4px; }

.inv-theme .inv-actions-dropdown {
  background: #fff;
  border-color: #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.inv-theme .inv-menu-item { color: #374151; }
.inv-theme .inv-menu-item:hover { background: #f3f4f6; color: #111827; }
.inv-theme .inv-menu-item-danger { color: #dc2626; }
.inv-theme .inv-menu-item-danger:hover { background: #fef2f2; color: #b91c1c; }
.inv-theme .inv-menu-divider { background: #e5e7eb; }

/* "Scheduled" reminder badge — Invoice.scheduled_send_date, see
   invoice_schedule in portal_views.py. Shown on the detail page header and
   in the invoice list next to Status. */
.inv-scheduled-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 10px 3px 8px;
}
.inv-scheduled-badge svg { width: 12px; height: 12px; }

/* Comments (InvoiceComment) — an internal note thread, staff-only. */
.inv-comment { padding: 10px 0; border-bottom: 1px solid #f1f2f4; }
.inv-comment:last-of-type { border-bottom: none; }
.inv-comment-meta { font-size: 12px; color: #9ca3af; margin-bottom: 4px; }
.inv-comment-meta strong { color: #374151; }
.inv-comment-body { margin: 0; font-size: 13px; color: #374151; line-height: 1.6; white-space: pre-wrap; }
.inv-comment-form { margin-top: 14px; }

/* Auth (login) page */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  padding: 36px 32px;
}
.auth-logo { padding: 0 0 8px; border: none; margin-bottom: 0; font-size: 22px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.auth-logo-img {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
  border: 1px solid var(--border); flex-shrink: 0;
}
.auth-monogram {
  width: 48px; height: 48px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  border: 1px solid var(--border); flex-shrink: 0;
}
.auth-brand-name { font-family: var(--serif); font-size: 21px; color: var(--accent); letter-spacing: 0.3px; }
.auth-sub { color: var(--text-dim); font-size: 13px; margin: 0 0 24px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form .field-label { margin-top: 12px; }
.auth-form .btn-primary { margin-top: 22px; }

/* Plan cards (Subscription Plans page) */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  align-items: start;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.plan-card-header {
  padding: 20px 20px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.plan-name {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
  font-weight: 400;
}

.plan-cycle {
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 4px 20px 0;
}

.plan-price {
  padding: 18px 20px 14px;
}

.plan-price-value {
  font-family: var(--serif);
  font-size: 30px;
  color: var(--text);
}

.plan-price-cycle {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-left: 4px;
}

.plan-stats {
  padding: 0 20px;
  flex: 1;
}
.plan-stats .kv-row:last-child { border-bottom: none; }

.plan-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border-soft);
  margin-top: 14px;
}

.plan-tenant-count { font-size: 12.5px; color: var(--text-faint); }

/* Responsive */
@media (max-width: 900px) {
  .sidebar { position: static; height: auto; width: 100%; }
  .shell { flex-direction: column; }
  .topbar { padding: 18px 20px; }
  .content { padding: 22px 20px 50px; }
}
