/* Shinka Finance — SPA styles
 *
 * Dark-theme baseline trimmed from shinka-srm. Scope is intentionally small:
 * the M1 SPA has just three views (login / drives / browse), so we only keep
 * tokens, base resets, forms, buttons, cards, and a few feedback states.
 * Future milestones (queue UI, period close) will extend this file rather
 * than introducing a CSS framework.
 */

:root {
  --bg: #0f1419;
  --panel: #1a1f27;
  --line: #2d3339;
  --text: #e4e6eb;
  --muted: #9ca3af;
  --brand: #3b82f6;
  --brand-2: #1e40af;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --surface: #1a1f27;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    "Manrope",
    "Avenir Next",
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
}

small {
  color: var(--muted);
  font-size: 0.82rem;
}

input, button, select, textarea {
  font: inherit;
  color: inherit;
}

/* ── Auth shell (login screen) ──────────────────────────────────────────── */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 24px;
}

.auth-shell h1 {
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  color: var(--brand);
  text-align: center;
}

.auth-shell .card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-shell label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.auth-shell input {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}

.auth-shell input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

button {
  border: 1px solid transparent;
  background: var(--brand);
  color: #fff;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

button:hover {
  background: var(--brand-2);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.primary {
  background: var(--brand);
}

button.primary:hover {
  background: var(--brand-2);
}

button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--brand);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #dc2626;
}

/* ── Top bar (drives + browse views) ────────────────────────────────────── */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar h1 {
  font-size: 1.35rem;
  color: var(--brand);
  letter-spacing: 0.02em;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

main {
  padding: 24px 28px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Cards / list items ─────────────────────────────────────────────────── */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.cards li.empty {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}

.drive-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drive-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drive-meta {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  font-size: 0.85rem;
}

.drive-meta dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.72rem;
  font-weight: 700;
  align-self: center;
}

.drive-meta dd {
  margin: 0;
  word-break: break-word;
}

.drive-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.child-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* ── Flash messages ─────────────────────────────────────────────────────── */

.flash {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-weight: 500;
  border: 1px solid transparent;
}

.flash-success {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.25);
}

.flash-error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.25);
}

.flash-info {
  background: rgba(59, 130, 246, 0.12);
  color: var(--brand);
  border-color: rgba(59, 130, 246, 0.25);
}

/* ── Inline form error (login) ──────────────────────────────────────────── */

.error {
  margin: 0;
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.2em;
}

/* ── Root folder picker (inline expansion on drive cards) ───────────────── */

.root-picker {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px;
}

.root-picker-status {
  margin: 0;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.root-picker-error {
  color: var(--danger);
}

.root-picker-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.root-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.88rem;
}

.root-pick-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--brand);
}

.root-pick-current {
  background: rgba(59, 130, 246, 0.10);
  border-color: rgba(59, 130, 246, 0.25);
}

.root-pick-name {
  word-break: break-word;
}

.root-pick-tag {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Responsive niceties ────────────────────────────────────────────────── */

@media (max-width: 540px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  main {
    padding: 16px;
  }
}

/* ── Navigation bar (M4 — multi-view) ───────────────────────────────────── */

.topbar-nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  transition: color 0.15s, background 0.15s;
}

.topbar-nav a:hover { color: var(--text); background: var(--line); }
.topbar-nav a.active { color: var(--brand); background: rgba(59,130,246,0.12); }

/* ── Queue toolbar ──────────────────────────────────────────────────────── */

.queue-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.queue-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.queue-toolbar select {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--text);
  font-size: 0.9rem;
}

/* ── Queue card ─────────────────────────────────────────────────────────── */

#queue-list, #orphan-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 24px;
}

/* #payouts view — section headings between Unmatched/Disputed/Matched card
   groups. Cards themselves reuse .queue-card / .status-stats / .stat-card. */
.payout-section-h {
  margin: 18px 0 6px;
  font-size: 0.95rem;
  color: var(--muted);
}
.payout-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.queue-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.queue-card.done {
  opacity: 0.6;
  border-color: var(--success);
}

.queue-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-card-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
}

.queue-card-actions {
  display: flex;
  gap: 8px;
  padding-top: 4px;
}

/* Flag panel (inline notes prompt under a queue card) */
.flag-panel {
  margin-top: 12px;
  padding: 12px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.flag-panel-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}
.flag-panel-label textarea {
  width: 100%;
  padding: 6px 8px;
  background: rgba(0,0,0,0.25);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  resize: vertical;
}
.flag-panel-actions {
  display: flex;
  gap: 8px;
}

/* Manual match picker (inline under a queue card) */
.match-picker {
  margin-top: 12px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.match-picker-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.match-picker-toolbar .match-q {
  flex: 1 1 240px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.25);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.match-picker-toolbar select {
  background: rgba(0,0,0,0.25);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
}
.match-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.match-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 8px 10px;
  background: rgba(0,0,0,0.18);
  border-radius: var(--radius-sm);
  align-items: center;
}
.match-result-main {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.match-result-date { font-size: 0.82rem; color: var(--muted); min-width: 90px; }
.match-result-fc {
  background: rgba(59,130,246,0.15);
  color: var(--brand);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.match-result-name { font-size: 0.9rem; word-break: break-all; }
.match-result-meta { grid-column: 1 / 2; font-size: 0.78rem; }
.match-pick { grid-row: 1 / span 2; }

/* Status badges */
.funding-badge {
  background: rgba(59,130,246,0.18);
  color: var(--brand);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.posted-at {
  font-size: 0.82rem;
  color: var(--muted);
}

.queue-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.queue-status.auto      { background: rgba(245,158,11,0.15); color: var(--warning); }
.queue-status.suggested { background: rgba(59,130,246,0.15); color: var(--brand); }
.queue-status.confirmed { background: rgba(34,197,94,0.15);  color: var(--success); }
.queue-status.disputed  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.queue-status.unclassified { background: var(--line); color: var(--muted); }

/* Amount */
.amount { font-weight: 700; font-size: 1rem; white-space: nowrap; }
.amount.debit  { color: var(--danger); }
.amount.credit { color: var(--success); }

/* Misc */
.counterparty { font-weight: 600; }
.ref, .doc-link, .category { color: var(--muted); font-size: 0.82rem; }
.doc-link.no-match { color: var(--warning); }

.success-text { color: var(--success); font-size: 0.88rem; font-weight: 600; }
.warning-text { color: var(--warning); font-size: 0.88rem; font-weight: 600; }

/* Small buttons */
button.small { padding: 5px 12px; font-size: 0.82rem; }

/* ── Export view ──────────────────────────────────────────────────────────── */
.export-main { max-width: 760px; margin: 2rem auto; padding: 0 1rem; }
.export-main h2 { margin-bottom: 1.2rem; }
.export-main h3 { margin: 2rem 0 0.8rem; }

.export-form { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.export-form .form-row { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.export-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.export-form input[type="date"],
.export-form select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 0.95rem; }
.export-form .checkbox-label { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.export-form input[type="checkbox"] { width: 16px; height: 16px; }
.fx-policy-help { flex: 1 1 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem 1.1rem; font-size: 0.84rem; color: var(--muted); line-height: 1.55; }
.fx-policy-help strong { color: var(--text); }
.fx-policy-help ul { margin: 0.5rem 0 0.5rem 1.5rem; padding: 0; }
.fx-policy-help li { list-style: disc; margin-bottom: 0.35rem; }

/* ── Logbook form (#bugreport / #diary) — mirrors .export-form shape ───────── */
.logbook-form { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.logbook-form .form-row { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.logbook-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.logbook-form input, .logbook-form select, .logbook-form textarea { padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 0.95rem; }
.logbook-form textarea { min-height: 80px; resize: vertical; }
.logbook-form .form-row-full { flex: 1 1 100%; }
.logbook-form .form-row-full label { flex: 1; }
.logbook-form .form-row-full textarea { width: 100%; box-sizing: border-box; }

.export-success { background: rgba(34,197,94,0.08); border: 1px solid var(--success); border-radius: 8px; padding: 1rem 1.2rem; display: flex; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }
.export-success p { margin: 0; }
.fx-warn { color: var(--warning); margin-left: 8px; font-size: 0.88rem; }

.export-history-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.export-history-table th, .export-history-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.export-history-table th { color: var(--muted); font-weight: 600; }

a.button { display: inline-block; padding: 8px 18px; border-radius: 6px; font-size: 0.88rem; font-weight: 600; text-decoration: none; }
a.button.primary { background: var(--brand); color: #fff; }
a.button.small { padding: 5px 12px; }

/* ── Status view ──────────────────────────────────────────────────────────── */
.status-main { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.status-main h2 { margin-bottom: 1.2rem; }
.status-section { margin-bottom: 2.4rem; }
.status-section h3 { font-size: 1rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .8rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }

.status-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.status-table th, .status-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.status-table th { color: var(--muted); font-weight: 600; }
.status-table tr.row-error td { color: var(--danger); }

.status-stats { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1.2rem; min-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-card.stat-warn { border-color: var(--warning); }
.stat-num { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--muted); text-align: center; }
.warn-text { color: var(--warning); font-weight: 600; }

/* ── Transactions view ────────────────────────────────────────────────────── */
.tx-main { max-width: 1200px; margin: 2rem auto; padding: 0 1rem; }
.tx-main h2 { margin-bottom: 1rem; }

.tx-filter { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.tx-filter-row { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.tx-filter label { display: flex; flex-direction: column; gap: 3px; font-size: 0.82rem; color: var(--muted); }
.tx-filter input, .tx-filter select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 0.88rem; }
.tx-filter input[type="text"] { min-width: 160px; }

.tx-count { font-size: 0.82rem; color: var(--muted); margin-bottom: .6rem; }

.tx-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tx-table th, .tx-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tx-table th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg); }
.tx-table .tx-desc, .tx-table .tx-ref, .tx-table .doc-link { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

/* Click-to-expand truncated cells */
.tx-table td.cell-expandable { cursor: pointer; }
.tx-table td.cell-expandable:hover { color: var(--text); text-decoration: underline dotted; }
.cell-popover {
  position: absolute;
  z-index: 1000;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  white-space: normal;
  word-break: break-word;
}

/* Sortable column headers (tx-table + status/export tables) */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th.sortable.active { color: var(--text); }
th.sortable .sort-ind { font-size: 0.78em; color: var(--brand); }

.tx-pagination { margin-top: 1rem; text-align: center; }

/* Quick period shortcuts */
.tx-quick-periods { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .8rem; }
.tx-quick-btn { padding: 4px 10px; font-size: 0.78rem; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; transition: all .15s; }
.tx-quick-btn:hover, .tx-quick-btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Profile page */
.profile-main {
  max-width: 420px;
  margin: 60px auto;
  padding: 0 16px;
}
.profile-main h2 {
  font-size: 1.4rem;
  margin-bottom: 28px;
  color: var(--text);
}
.profile-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
}
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-form label small {
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.profile-form input[type="password"] {
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 140ms;
  /* Override browser autofill yellow/white background */
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
.profile-form input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}
.profile-divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 4px 0 6px;
}
.profile-actions { padding-top: 4px; }
.profile-actions button { min-width: 140px; }

.btn-sm {
  display: inline-flex;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  transition: all .15s;
  background: transparent;
  cursor: pointer;
  line-height: 1;
}
.btn-sm:hover, .btn-sm.active {
  background: rgba(255,255,255,0.06);
  border-color: var(--brand);
}

/* Logbook inline edit panel (reuses .card for the form itself) */
.logbook-edit-panel {
  margin-top: 12px;
}
.logbook-edit-panel .logbook-edit-form {
  margin: 0;
}

/* ── Subscriptions form + charge picker ─────────────────────────────────── */
.subs-form { max-width: 720px; }
.subs-form .subs-section {
  border: 1px solid var(--border, #2a2a35);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 16px;
  overflow: hidden;   /* keep picker results inside the fieldset border */
}
.subs-form .subs-section legend {
  padding: 0 6px;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  opacity: 0.85;
}
.subs-form label { display: block; margin: 10px 0; }
.subs-form label small { display: block; font-weight: 400; margin-top: 4px; }
/* inputs: match the .export-form / .logbook-form convention — without explicit
   background+color the global `color: inherit` (light --text) lands on a default
   white field = unreadable (the bug in the screenshot). */
.subs-form input, .subs-form select, .subs-form textarea {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
}
.subs-form input::placeholder, .subs-form textarea::placeholder { color: var(--muted); }
.subs-form .form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.subs-form .form-row label { flex: 1 1 130px; margin: 6px 0; }
.subs-advanced { margin: 0 0 16px; }
.subs-advanced summary { cursor: pointer; opacity: 0.8; font-size: 0.9rem; }
.subs-advanced label { display: block; margin: 10px 0; }

/* charge picker */
.subs-finder { margin-top: 8px; }
.subs-tx-results { margin-top: 8px; overflow: hidden; }
.subs-tx-list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow-y: auto; border-radius: 6px; }
.subs-tx-list li { margin: 0; }
.subs-tx-pick {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 1px solid var(--border, #2a2a35);
  padding: 7px 8px;
  cursor: pointer;
  color: inherit;
  font-size: 0.85rem;
}
.subs-tx-pick:hover { background: var(--surface-2, rgba(255,255,255,0.06)); border-color: var(--accent, #5b8def); border-radius: 6px; }
.subs-tx-when { flex: 0 0 92px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.subs-tx-amt { flex: 0 0 110px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.subs-tx-acct { flex: 0 0 64px; opacity: 0.7; text-transform: uppercase; font-size: 0.72rem; }
.subs-tx-cp { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subs-tx-ref { flex: 0 0 auto; }
.subs-tx-pick .tag { flex: 0 0 auto; }
