/* ---------- Token system (DJ Stafford Consulting brand guidelines v1.0) ---------- */

:root {
  --ink: #0B2A56;
  --ink-soft: #3D5580;
  --slate: #6D6D6F;
  --steel: #9A9A9C;
  --steel-pale: #C7C7C9;
  --mist: #F2F2F3;
  --white: #FFFFFF;

  --paper: var(--mist);
  --paper-raised: var(--white);
  --line: #E1E1E2;
  --grey: var(--slate);

  --red: #B0392C;
  --amber: #C1811C;
  --green: #3E7A5C;

  --font-display: 'EB Garamond', Garamond, 'Times New Roman', serif;
  --font-body: Arial, Helvetica, sans-serif;
  --font-mono: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
}

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

/* ---------- Sidebar ---------- */

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--ink);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 26px;
}

.brand-logo { width: 170px; height: auto; display: block; }

.brand-kicker {
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--steel-pale);
}

.btn-add {
  background: transparent;
  border: 1px solid #2C4A78;
  color: var(--white);
  padding: 10px 12px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 10px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-add:hover { background: #163A66; border-color: var(--steel); }

.btn-refresh-all {
  background: transparent;
  border: 1px solid #2C4A78;
  color: var(--steel-pale);
  padding: 9px 12px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  margin-bottom: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-refresh-all:hover { background: #163A66; border-color: var(--steel); }
.btn-refresh-all:disabled { opacity: 0.6; cursor: default; }

.last-updated {
  font-size: 10.5px;
  font-family: var(--font-body);
  color: #8B93AC;
  margin-bottom: 18px;
  min-height: 14px;
}

.sidebar-dashboard-link {
  display: block; width: 100%; text-align: left; background: transparent;
  border: none; border-radius: 4px; color: var(--steel-pale); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; padding: 11px 10px; cursor: pointer; margin-bottom: 18px;
  transition: background 0.15s, color 0.15s;
}
.sidebar-dashboard-link:hover { background: #163A66; color: var(--white); }
.sidebar-dashboard-link.active { background: #1B4A82; color: var(--white); }

.sidebar-add-row { display: flex; gap: 6px; }
.sidebar-add-row .btn-add { flex: 1; margin-bottom: 10px; font-size: 12.5px; padding: 9px 8px; }

.company-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }

.company-item {
  padding: 10px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background 0.15s;
}
.company-item:hover { background: #163A66; }
.company-item.active { background: #163A66; border-left-color: var(--steel); }

.company-item .num {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--steel-pale);
  display: block;
  margin-top: 2px;
}

.company-item .entity-type-tag {
  display: inline-block; font-size: 9px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--steel-pale); background: rgba(255,255,255,0.08); padding: 1px 6px; border-radius: 2px;
  margin-top: 3px;
}

.company-item .flags { margin-top: 4px; display: flex; gap: 6px; }
.company-item .flags span { font-size: 9.5px; padding: 1px 5px; border-radius: 2px; letter-spacing: 0.04em; }
.flag-overdue { background: rgba(176,57,44,0.25); color: #E8998E; }
.flag-urgent { background: rgba(193,129,28,0.25); color: #E9BE85; }

.btn-settings {
  background: none;
  border: none;
  color: var(--steel-pale);
  font-size: 13px;
  text-align: left;
  padding: 10px 4px 0;
  cursor: pointer;
  border-top: 1px solid #23406E;
  margin-top: 14px;
}
.btn-settings:hover { color: var(--white); }

/* ---------- Main content ---------- */

.main { flex: 1; padding: 36px 48px; max-width: 1080px; }

.header-top { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; }

.main-header h1 { font-family: var(--font-display); font-weight: 600; font-size: 30px; margin: 0 0 4px; }

.header-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); margin-bottom: 24px; }

.view-tabs { display: flex; gap: 2px; background: var(--line); border-radius: 5px; padding: 2px; flex-shrink: 0; }

.tab-btn {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
}
.tab-btn.active { background: var(--paper-raised); color: var(--ink); box-shadow: 0 1px 2px rgba(11,42,86,0.12); }

#banner-area .banner {
  border: 1px solid var(--line);
  background: var(--paper-raised);
  padding: 12px 16px;
  border-radius: 4px;
  font-size: 13.5px;
  margin-bottom: 20px;
  border-left: 3px solid var(--ink);
}
#banner-area .banner.error { border-left-color: var(--red); color: #7A281E; }

/* Register: grouped ledger rows */

.month-group { margin-bottom: 8px; }

.month-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--grey);
  padding: 18px 0 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}

.ledger-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.ledger-row:hover { background: rgba(11,42,86,0.03); }

.stamp {
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  line-height: 1;
  transform: rotate(-4deg);
}
.stamp .n { font-size: 17px; font-weight: 600; }
.stamp .u { font-size: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.stamp.overdue { color: var(--red); }
.stamp.urgent { color: var(--amber); }
.stamp.upcoming { color: var(--green); }
.stamp.later { color: var(--grey); }

.ledger-main { flex: 1; min-width: 0; }
.ledger-type { font-size: 14.5px; font-weight: 500; }
.ledger-company { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.ledger-right { text-align: right; flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.ledger-date { font-family: var(--font-mono); font-size: 13px; }

.source-tag {
  display: inline-block;
  margin-top: 4px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 2px;
}
.source-tag.live { background: rgba(11,42,86,0.10); color: var(--ink); }
.source-tag.estimated { background: rgba(109,109,111,0.12); color: var(--grey); }

.btn-mark-complete {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-mark-complete:hover { border-color: var(--green); color: var(--green); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--grey);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* ---------- Modals ---------- */

.modal { border: none; border-radius: 6px; padding: 28px; width: 420px; box-shadow: 0 20px 60px rgba(11,42,86,0.25); font-family: var(--font-body); }
.modal-wide { width: 640px; max-height: 80vh; overflow-y: auto; }
.modal::backdrop { background: rgba(11,42,86,0.45); }
.modal h2 { font-family: var(--font-display); margin: 0 0 8px; font-size: 21px; }
.modal-help { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 18px; }
.modal-help a { color: var(--ink); }
.modal label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 14px; }
.modal input[type="text"], .modal input[type="password"] {
  display: block; width: 100%; margin-top: 6px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-mono); font-size: 13.5px;
}
.modal-error { color: var(--red); font-size: 12.5px; min-height: 16px; margin-bottom: 6px; }
.modal-note { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 6px; }

.settings-divider { border-top: 1px solid var(--line); margin: 22px 0; }

.xero-tenant-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.xero-tenant-row select {
  font-family: var(--font-body); font-size: 12.5px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 4px; min-width: 200px;
}
.xero-status-line { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 10px; }
.xero-status-line.connected { color: var(--green); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.btn-primary, .btn-secondary { padding: 9px 16px; border-radius: 4px; font-size: 13px; cursor: pointer; border: 1px solid transparent; }
.btn-primary { background: var(--ink); color: white; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-secondary { background: none; border-color: var(--line); color: var(--ink); }
.btn-secondary:hover { background: var(--paper); }

/* ---------- Company detail ---------- */

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.detail-header h2 { font-family: var(--font-display); margin: 0 0 4px; }
.detail-num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.detail-status { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 3px; background: rgba(62,122,92,0.15); color: var(--green); }
.detail-section { margin-bottom: 20px; }
.detail-section h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--grey); margin-bottom: 10px; }
.detail-toggle { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13.5px; }
.detail-select, .detail-textarea { font-family: var(--font-body); font-size: 13.5px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; }
.detail-textarea { width: 100%; min-height: 60px; resize: vertical; }
.detail-actions { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Dashboard (RAG matrix) ---------- */

.dashboard-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
.dashboard-table { border-collapse: collapse; width: 100%; min-width: 720px; background: var(--paper-raised); }
.dashboard-table th, .dashboard-table td { border: 1px solid rgba(255,255,255,0.5); padding: 0; }
.dashboard-table thead th {
  background: var(--ink); color: var(--white); font-family: var(--font-body); font-size: 12px;
  font-weight: 600; text-align: left; padding: 12px 14px; border: 1px solid #23406E;
}
.dashboard-table thead th:first-child { background: var(--ink); }
.dashboard-row-label { background: var(--ink); color: var(--white); font-size: 13px; font-weight: 500; padding: 12px 14px; vertical-align: top; border: 1px solid #23406E; min-width: 160px; }
.dashboard-row-label .num { display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--steel-pale); font-weight: 400; margin-top: 2px; }
.dashboard-cell { text-align: center; vertical-align: middle; min-width: 120px; }
.dashboard-cell-inner { padding: 14px 10px; font-family: var(--font-mono); font-size: 13px; font-weight: 600; cursor: pointer; height: 100%; }
.dashboard-cell-inner:hover { filter: brightness(1.06); }
.dashboard-cell.empty .dashboard-cell-inner { background: var(--paper); color: var(--grey); cursor: default; font-weight: 400; font-family: var(--font-body); font-size: 12px; }
.dashboard-cell.rag-overdue .dashboard-cell-inner, .dashboard-cell.rag-urgent .dashboard-cell-inner { background: var(--red); color: white; }
.dashboard-cell.rag-upcoming .dashboard-cell-inner { background: var(--amber); color: white; }
.dashboard-cell.rag-later .dashboard-cell-inner { background: var(--green); color: white; }

.dashboard-legend { display: flex; gap: 18px; margin-top: 16px; font-size: 12px; color: var(--ink-soft); }
.dashboard-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-dot.red { background: var(--red); }
.legend-dot.amber { background: var(--amber); }
.legend-dot.green { background: var(--green); }

.dashboard-note { font-size: 12px; color: var(--ink-soft); line-height: 1.6; margin-top: 14px; max-width: 640px; }
.dashboard-note a { color: var(--ink); }

/* ---------- Cell popover ---------- */

.cell-popover {
  position: fixed; z-index: 50; background: var(--ink); color: var(--white); border-radius: 8px;
  padding: 16px 18px; width: 270px; font-size: 13px; line-height: 1.6; box-shadow: 0 12px 32px rgba(11,42,86,0.35);
}
.cell-popover .pop-type { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.cell-popover .pop-company { color: var(--steel-pale); font-size: 12px; margin-bottom: 8px; }
.cell-popover .pop-date { font-family: var(--font-mono); font-size: 13px; margin-bottom: 8px; }
.cell-popover .pop-applies { font-size: 11.5px; color: var(--steel-pale); margin-bottom: 8px; }
.cell-popover .pop-source { display: inline-block; font-size: 9.5px; letter-spacing: 0.06em; padding: 2px 7px; border-radius: 2px; }
.cell-popover .pop-source.live { background: rgba(255,255,255,0.22); color: var(--white); }
.cell-popover .pop-source.estimated { background: rgba(255,255,255,0.12); color: var(--steel-pale); }
.cell-popover .btn-mark-complete {
  margin-top: 10px; width: 100%; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
  color: var(--white); text-align: center;
}
.cell-popover .btn-mark-complete:hover { background: rgba(255,255,255,0.18); border-color: var(--white); }

/* ---------- Profile view ---------- */

.profile-selector { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.profile-chip { border: 1px solid var(--line); background: var(--paper-raised); padding: 7px 13px; border-radius: 16px; font-size: 12.5px; cursor: pointer; color: var(--ink-soft); }
.profile-chip:hover { border-color: var(--ink-soft); }
.profile-chip.active { background: var(--ink); color: white; border-color: var(--ink); }

.profile-warning {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--mist);
  border: 1px solid #D8D8D9; border-left: 3px solid var(--ink); border-radius: 4px; padding: 12px 16px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-soft); margin-bottom: 22px;
}
.profile-warning code { font-family: var(--font-mono); background: rgba(0,0,0,0.06); padding: 1px 5px; border-radius: 3px; }

.profile-section { margin-bottom: 26px; }
.profile-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--grey); margin-bottom: 12px; }
.profile-readonly { font-size: 13.5px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.profile-grid label { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.profile-grid input { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-mono); font-size: 13px; color: var(--ink); }

.profile-empty-note { font-size: 12.5px; color: var(--grey); }

.director-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.director-name { flex: 1; font-size: 13.5px; }
.director-row input { width: 220px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font-family: var(--font-mono); font-size: 13px; }

.share-table { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.share-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.share-table td { padding: 4px 8px 4px 0; }
.share-table input { width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; font-family: var(--font-body); }
.share-table select {
  width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 12.5px; font-family: var(--font-body); background: var(--paper-raised);
}

.mapping-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--line); }
.mapping-group-row td {
  padding-top: 16px; padding-bottom: 4px; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--grey); border-bottom: none; font-weight: 600;
}
.mapping-suggested td:last-child { position: relative; }
.mapping-suggested select { border-color: var(--amber); }
.mapping-suggested-tag {
  display: block; font-size: 10.5px; color: var(--amber); margin-top: 3px; font-style: italic;
}

.preview-table th { text-align: right; }
.preview-table th:first-child { text-align: left; }
.preview-table td { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.preview-table td:first-child { text-align: left; font-family: var(--font-body); }
.aged-table th, .aged-table td { font-size: 12px; padding: 6px 4px; }
.aged-table th:first-child, .aged-table td:first-child { min-width: 140px; }
.preview-subtotal-row td {
  font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 2px double var(--ink);
  padding-top: 8px; padding-bottom: 8px;
}
.preview-sectiontotal-row td {
  font-weight: 600; color: var(--ink-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--ink-soft);
  padding-top: 6px; padding-bottom: 6px;
}

.balance-check {
  border-radius: 6px; padding: 14px 18px; margin-top: 8px; font-size: 13.5px; line-height: 1.6;
}
.balance-check-ok { background: rgba(62,122,92,0.10); border: 1px solid var(--green); color: var(--green); }
.balance-check-fail { background: rgba(176,57,44,0.08); border: 1px solid var(--red); color: var(--red); }

.pdf-page-list {
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.pdf-page-option {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  font-size: 13.5px; background: var(--paper-raised); border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.pdf-page-option:last-child { border-bottom: none; }
.pdf-page-option:hover { background: var(--mist); }
.pdf-page-soon {
  margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--steel); background: var(--mist); padding: 2px 8px; border-radius: 10px;
}

.branding-logo-row { display: flex; align-items: center; gap: 18px; }
.branding-logo-preview {
  width: 140px; height: 80px; border: 1px dashed var(--line); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; background: var(--mist);
  flex-shrink: 0; overflow: hidden;
}
.branding-logo-preview img { max-width: 120px; max-height: 64px; object-fit: contain; }
.branding-logo-preview span { font-size: 11px; color: var(--steel); text-align: center; padding: 0 8px; }
.profile-grid input[type="color"] {
  width: 60px; height: 34px; padding: 3px; margin-top: 6px; border: 1px solid var(--line);
  border-radius: 4px; cursor: pointer;
}
.profile-grid select {
  width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 4px; font-family: var(--font-body); font-size: 13px; background: var(--paper-raised);
}
.btn-remove-row { background: none; border: none; color: var(--grey); cursor: pointer; font-size: 14px; padding: 4px 8px; }
.btn-remove-row:hover { color: var(--red); }
.btn-move-row { background: none; border: none; color: var(--steel); cursor: pointer; font-size: 10px; padding: 4px 5px; }
.btn-move-row:hover { color: var(--ink); }
.btn-move-row:disabled { opacity: 0.25; cursor: default; }
.btn-move-row:disabled:hover { color: var(--steel); }

.profile-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
#profile-save-status { font-size: 12.5px; color: var(--green); }

.sensitive-field:disabled { background: var(--mist); color: var(--steel); cursor: not-allowed; font-style: italic; }
.locked-note { font-size: 11.5px; color: var(--steel); margin-top: 8px; font-style: italic; }

/* ---------- Report template editor ---------- */

.template-statement { margin-bottom: 30px; }
.template-statement h3 {
  font-family: var(--font-display); font-size: 18px; font-weight: 600;
  margin-bottom: 14px; color: var(--ink);
}
.template-sections { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }

.template-section {
  border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; background: var(--paper-raised);
}
.section-header-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-header-row .section-name {
  flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
}
.section-header-row .section-sign {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; font-size: 12.5px; font-family: var(--font-body);
}

.section-subtotal-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
  padding-bottom: 12px; border-bottom: 1px dashed var(--line); font-size: 12.5px; color: var(--ink-soft);
}
.section-subtotal-row label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.section-subtotal-row input[type="text"] {
  flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font-size: 12.5px; font-family: var(--font-body);
}
.section-subtotal-row input[type="text"]:disabled { background: var(--mist); color: var(--steel); }

.template-line-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.line-item-row { display: flex; align-items: center; gap: 8px; }
.line-item-row .line-item-name {
  flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; font-family: var(--font-body);
}

/* ---------- Login / first-run setup page ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
}

.login-shell { width: 100%; max-width: 420px; padding: 24px; }

.login-card {
  background: var(--paper-raised);
  border-radius: 10px;
  padding: 36px 32px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.login-logo { width: 150px; height: auto; display: block; margin: 0 auto 26px; filter: invert(0); }
.login-body .login-logo { filter: none; }

.login-view h1 {
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  color: var(--ink); margin: 0 0 10px;
}

.login-help { font-size: 13px; color: var(--ink-soft); line-height: 1.5; margin-bottom: 18px; }
.login-hint { font-size: 12px; color: var(--slate); line-height: 1.5; margin: 10px 0 18px; word-break: break-all; }
.login-hint code {
  background: var(--mist); padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); font-size: 12px;
}

.login-view form { display: flex; flex-direction: column; gap: 14px; }
.login-view label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--ink-soft); font-weight: 500; }
.login-view input[type="text"],
.login-view input[type="password"] {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; font-size: 14px; font-family: var(--font-body);
}
.login-view input[type="text"]:focus,
.login-view input[type="password"]:focus { outline: 2px solid var(--ink-soft); outline-offset: 1px; }

.login-error { color: var(--red); font-size: 12.5px; min-height: 16px; }
.login-submit { width: 100%; padding: 11px 16px; font-size: 14px; margin-top: 4px; }

.login-linklike {
  display: block; margin: 16px auto 0; background: none; border: none; color: var(--ink-soft);
  font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 0;
}
.login-linklike:hover { color: var(--ink); }

.login-qr { display: block; width: 200px; height: 200px; margin: 0 auto 6px; border: 1px solid var(--line); border-radius: 6px; }

.login-backup-codes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  background: var(--mist); border-radius: 6px; padding: 16px; margin-bottom: 20px;
}
.login-backup-code {
  font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.5px; color: var(--ink);
  background: var(--paper-raised); border: 1px solid var(--line); border-radius: 4px;
  padding: 8px 10px; text-align: center;
}
