/* ftrack — minimal mobile-first stylesheet. No framework. */
* { box-sizing: border-box; }

:root {
  --bg: #0f0f10;
  --panel: #1a1a1c;
  --panel-2: #141416;
  --row-hover: #1c1c1f;
  --border: #2a2a2c;
  --text: #e8e8e8;
  --muted: #888;
  --accent: #10b981;
  --accent-2: #34d399;
  --positive: #10b981;
  --negative: #ef4444;
  --scheduled: #94a3b8;
  --overdue: #f59e0b;
  --reconciled: #60a5fa;
  --cleared: #10b981;
  --uncleared: #777;
  --danger: #ef4444;
  --warn: #f59e0b;
}

html, body {
  margin: 0; padding: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
:focus { outline: none; }
button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
  border-radius: 4px;
}
code { font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace; font-size: 0.85em; }
kbd { display: inline-block; padding: 0 0.35em; border: 1px solid var(--border);
      border-radius: 3px; background: var(--panel-2); font: 0.8em monospace; }

/* ──────────────────────────────────────────────────────────── header */
header {
  padding: 0.9rem 1rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 0.75rem;
}
.header-brand { display: flex; align-items: flex-start; gap: 0.5rem; }
.sidebar-toggle { display: none; }
@media (max-width: 900px) {
  .sidebar-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; color: var(--text); font-size: 1.25rem;
    cursor: pointer; padding: 0.25rem 0.5rem;
  }
}
header h1 {
  margin: 0; font-size: 1.4rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--accent);
}
.header-sub { color: var(--muted); font-size: 0.9rem; }

.header-actions { display: flex; align-items: center; gap: 0.5rem; }
.net-pill {
  background: var(--panel); border: 1px solid var(--border);
  padding: 0.35rem 0.75rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; color: var(--positive);
}
.net-pill.negative { color: var(--negative); }

/* user menu */
.user-menu { position: relative; flex-shrink: 0; }
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #0c0c10;
  border: 0; font: inherit; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  text-transform: uppercase;
}
.user-avatar:hover { filter: brightness(1.1); }
.user-avatar[hidden] { display: none; }
.user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 14rem; max-width: 18rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  z-index: 100; padding: 0.35rem;
  display: flex; flex-direction: column; gap: 0.05rem;
}
.user-dropdown[hidden] { display: none; }
.user-dropdown-email {
  display: flex; flex-direction: column; gap: 0.1rem;
  padding: 0.5rem 0.75rem; border-radius: 6px;
  color: var(--text); text-decoration: none;
}
.user-dropdown-email:hover { background: var(--panel-2); }
.user-dropdown-email-text { font-size: 0.85rem; }
.user-dropdown-email-sub { font-size: 0.7rem; color: var(--muted); }
.user-dropdown-sep { height: 1px; background: var(--border); margin: 0.25rem 0; }
.user-dropdown-item {
  background: none; border: 0; color: var(--text);
  text-align: left; padding: 0.5rem 0.75rem; border-radius: 6px;
  cursor: pointer; font: inherit;
}
.user-dropdown-item:hover { background: var(--panel-2); }

/* ──────────────────────────────────────────────────────────── auth */
.auth-overlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.auth-overlay[hidden] { display: none; }
body.unauth main, body.unauth header .icon-btn { visibility: hidden; }
.auth-panel {
  width: 100%; max-width: 360px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem;
}
.auth-panel h2 { margin: 0 0 1rem; font-size: 1.25rem; text-align: center; }
.auth-panel p { margin: 0 0 1rem; color: var(--muted); text-align: center; }
.auth-cta {
  display: inline-block; text-align: center; text-decoration: none;
  width: 100%; margin-bottom: 0.75rem;
}

/* ──────────────────────────────────────────────────────────── layout */
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  /* Desktop uses the full viewport width; mobile breakpoint below
     switches to a single column. A dedicated mobile layout will land
     later — until then, narrow viewports just get the same content
     with a drawer-style sidebar. */
  padding: 0.75rem 1rem 2rem;
  min-height: calc(100vh - 60px);
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 0; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px; background: var(--panel); z-index: 100;
    transform: translateX(-100%); transition: transform 0.2s ease;
    padding: 1rem; overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 95;
  }
  .content { padding: 1rem; }
}

.sidebar {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 0.85rem;
}
.sidebar-section-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 0.85rem 0 0.35rem 0.25rem;
}
.sidebar-section-label:first-child { margin-top: 0; }
.account-list, .sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-group-label {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); padding: 0.3rem 0.5rem 0.1rem;
}
.sidebar-item {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 0.35rem;
  width: 100%; padding: 0.5rem 0.65rem;
  background: none; border: 0; color: var(--text);
  border-radius: 7px; text-align: left; cursor: pointer; font: inherit;
}
.sidebar-item:hover { background: var(--panel); }
.sidebar-item.active {
  background: var(--panel);
  box-shadow: inset 3px 0 0 var(--accent);
}
.account-name { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-balance { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.85rem; }
.account-balance.negative { color: var(--negative); }
/* Each account is a row: name+balance is a clickable sidebar-item, and the
   edit button sits next to it as a sibling (no nested-button HTML). */
.account-row {
  display: flex; align-items: stretch; gap: 0.2rem;
  border-radius: 7px;
}
.account-row .sidebar-item { flex: 1; min-width: 0; }
.account-edit {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 1.95rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.account-edit:hover, .account-edit:focus-visible {
  background: var(--accent);
  color: #0c0c10;
  border-color: var(--accent);
  outline: none;
}
.account-row.active .account-edit {
  background: var(--panel); border-color: var(--border);
}
.sidebar-item-flat {
  display: block; width: 100%; padding: 0.45rem 0.65rem;
  background: none; border: 0; color: var(--text);
  text-align: left; cursor: pointer; font: inherit; border-radius: 7px;
}
.sidebar-item-flat:hover { background: var(--panel); }
.sidebar-action {
  display: block; width: 100%; padding: 0.5rem 0.65rem;
  background: none; border: 1px dashed var(--border); color: var(--muted);
  border-radius: 7px; text-align: left; cursor: pointer; font: inherit;
  margin-top: 0.35rem;
}
.sidebar-action:hover { color: var(--text); border-color: var(--accent); }
.sidebar-net {
  margin-top: 0.6rem; padding: 0.5rem 0.65rem;
  font-size: 0.85rem; color: var(--muted);
  border-top: 1px solid var(--border);
}
.sidebar-net strong { color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar-net strong.negative { color: var(--negative); }

/* ──────────────────────────────────────────────────────────── content */
.content { min-width: 0; position: relative; }
.content.drag-over { outline: 2px dashed var(--accent); outline-offset: -8px; }

.register-header {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 0 0 0.7rem;
}
.register-title-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.register-title-row h2 { margin: 0; font-size: 1.25rem; }
.register-balances {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: baseline;
}
.bal-part { font-size: 0.9rem; color: var(--muted); }
.bal-part strong {
  color: var(--text); font-variant-numeric: tabular-nums;
  margin-left: 0.3rem;
}
.bal-part strong.negative { color: var(--negative); }
.bal-op { color: var(--muted); font-size: 0.9rem; }
.bal-working strong { font-weight: 700; }
.register-actions {
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
  position: relative;
}
.register-actions input[type=search] {
  flex: 1; min-width: 14rem;
  /* Match vertical metrics of the .btn-primary / .btn-ghost siblings
     (`padding: 0.55rem`) — the 1px border adds 2px to total height
     vs. zero-border buttons, so they line up nearly perfectly. */
  padding: 0.55rem 0.7rem; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px; font: inherit;
  box-sizing: border-box;
}

/* Actions dropdown menu (consolidates Transfer / Import / Reconcile). */
.actions-menu-wrap { position: relative; }
.actions-menu-wrap .caret { font-size: 0.75em; margin-left: 0.15em; }
.actions-menu {
  position: absolute;
  top: calc(100% + 4px); left: 0;
  min-width: 12rem;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.3rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  z-index: 60;
  display: flex; flex-direction: column; gap: 0.05rem;
}
.actions-menu[hidden] { display: none; }
.actions-menu button {
  background: none; border: 0; color: var(--text);
  padding: 0.45rem 0.7rem; text-align: left; cursor: pointer;
  border-radius: 5px; font: inherit; font-size: 0.9rem;
}
.actions-menu button:hover:not(:disabled) { background: var(--panel-2); }
.actions-menu button:disabled { color: var(--muted); cursor: not-allowed; }
.filter-badge {
  display: inline-block; min-width: 1.1em; padding: 0 0.3em;
  background: var(--accent); color: #0c0c10; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; margin-left: 0.3rem;
}
/* `display: inline-block` overrides the browser's [hidden] default, so be
   explicit about hiding when the badge has no active filters to show. */
.filter-badge[hidden] { display: none; }
.filter-dropdown {
  position: absolute; top: 100%; right: 0; z-index: 80;
  width: min(34rem, 96vw);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.filter-dropdown[hidden] { display: none; }
.filter-group {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.65rem;
}
@media (max-width: 600px) {
  .filter-group { grid-template-columns: 1fr; }
}
.filter-group label {
  display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem;
  color: var(--muted);
}
.filter-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }

/* ──────────────────────────────────────────────────────────── register */
.register-wrap {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: auto; background: var(--panel-2);
}
.tx-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.9rem; min-width: 760px;
}
.tx-table thead th {
  background: var(--panel); color: var(--muted);
  font-weight: 500; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.06em; padding: 0.5rem 0.65rem; text-align: left;
  position: sticky; top: 0; z-index: 2;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.tx-table thead th:last-child { border-right: 0; }
.tx-table th.col-amount, .tx-table th.col-balance { text-align: right; }
.tx-row { cursor: pointer; }
.tx-row td {
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: middle;
}
.tx-row td:last-child { border-right: 0; }
.tx-row:nth-child(even) td { background: rgba(255,255,255,0.01); }
.tx-row:hover td { background: var(--row-hover); }
.tx-row.reconciled td { background: rgba(96, 165, 250, 0.05); }
.tx-row.reconciled:hover td { background: rgba(96, 165, 250, 0.1); }
.tx-row.split-parent td { font-weight: 600; }
/* Pending = posted_date is in the future. Recurring = has a recurrence rule.
   Overdue = recurring template whose date is in the past (auto-advance hasn't
   caught up yet, or the user is looking at it before a refresh). */
.tx-row.pending { color: var(--scheduled); }
.tx-row.pending td { background: #101010; }
.tx-row.pending:hover td { background: #161616; }
.tx-row.overdue td:first-child { box-shadow: inset 3px 0 0 var(--overdue); }
.tx-row .recur-tag { color: var(--accent); margin-left: 0.2rem; cursor: help; }
.tx-row.transfer { color: #cbd5e1; }
.tx-row.split-row td { background: rgba(255,255,255,0.025); font-size: 0.85rem; color: var(--muted); }
.tx-row.split-row td.col-category { padding-left: 1.6rem; color: var(--text); }
.col-status { width: 2.8rem; min-width: 2.8rem; text-align: center; }
.tx-table thead th.col-status,
.tx-table tbody td.col-status { text-align: center; }
.col-date { width: 7.5rem; min-width: 7.5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-account {
  width: 11rem; min-width: 9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--muted);
}
/* When a single account is selected the column is redundant — hide it.
   The table sets data-view="single" via JS based on state.selectedAccount. */
.tx-table[data-view="single"] .col-account { display: none; }
.col-amount, .col-balance {
  text-align: right; font-variant-numeric: tabular-nums;
  min-width: 6.5rem; white-space: nowrap;
}
.col-amount.outflow { color: var(--negative); }
.col-amount.inflow { color: var(--positive); }
.col-balance.negative { color: var(--negative); }
.status-btn {
  background: none; border: 0; color: var(--uncleared); cursor: pointer;
  font-size: 1.75rem; line-height: 1;
  padding: 0.05rem 0.35rem;
  min-width: 2.1rem;
  border-radius: 4px;
}
.status-btn:hover { background: rgba(255,255,255,0.06); }
.tx-row.cleared .status-btn { color: var(--cleared); }
.tx-row.reconciled .status-btn { color: var(--reconciled); cursor: not-allowed; }
.col-status[title] { cursor: help; }
.status-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.5em; height: 1.5em;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  font-size: 0.72em;
  font-weight: 700;
  /* The "?" glyph sits slightly above the optical center of the box, so
     nudge it down a touch and use the box height for vertical centering. */
  line-height: 1;
  padding-top: 0.05em;
}

/* Pending (future-dated) rows use a non-interactive marker — clearing only
   makes sense once a transaction is in the past. */
.tx-row.pending .col-status .sched-marker {
  display: inline-block; color: var(--scheduled); font-size: 1.3rem;
  line-height: 1; cursor: help;
}

/* Single green hairline between pending and posted rows. */
.register-divider td {
  padding: 0;
  height: 3px;
  background: var(--accent);
  border: 0;
}
.register-divider:hover td { background: var(--accent); }

.empty-state {
  padding: 2.5rem 1.25rem; color: var(--muted); text-align: center;
}
.empty-state p { margin: 0; }
.load-more-wrap { padding: 0.75rem; text-align: center; }

/* ──────────────────────────────────────────────────────────── buttons */
.btn-primary, .btn-ghost, .btn-danger {
  background: var(--accent); color: #08120d;
  border: 0; padding: 0.55rem 0.95rem; border-radius: 7px;
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost {
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); font-weight: 500;
}
.btn-ghost:hover { background: var(--panel-2); border-color: #444; }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: #08120d; }
.btn-link {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font: inherit; padding: 0.2rem 0.35rem;
}
.btn-link:hover { color: var(--accent-2); text-decoration: underline; }
.btn-link.muted { color: var(--muted); }
.btn-link.muted:hover { color: var(--text); }
.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-size: 1.25rem; padding: 0 0.4rem; border-radius: 4px;
}
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* ──────────────────────────────────────────────────────────── modal */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal.open { display: flex; }
/* Lock background scroll while any modal is open. */
body.modal-open,
body:has(.modal.open) { overflow: hidden; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-panel {
  position: relative; z-index: 1;
  width: min(640px, 96vw); max-height: 90vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.2rem;
  box-shadow: 0 16px 40px rgba(0,0,0,0.7);
}
.modal-panel-narrow { width: min(420px, 96vw); }
.modal-panel-wide { width: min(960px, 96vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.7rem;
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-actions {
  display: flex; justify-content: space-between; gap: 0.5rem;
  margin-top: 1rem; flex-wrap: wrap;
}
.modal-actions-left { display: flex; gap: 0.5rem; align-items: center; }
.modal-actions-right { display: flex; gap: 0.5rem; }
.settings-form { display: flex; flex-direction: column; gap: 0.65rem; }
.settings-form label {
  display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted);
}
.settings-form label.check-row {
  flex-direction: row; align-items: center; gap: 0.5rem; color: var(--text);
}
.settings-form input[type=text], .settings-form input[type=number],
.settings-form input[type=date], .settings-form select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 0.6rem; font: inherit;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.55rem; }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid.disabled label { opacity: 0.6; }

/* splits */
.splits-header { display: flex; justify-content: space-between; align-items: center;
                 margin-top: 0.5rem; }
.splits-remaining { font-size: 0.85rem; }
.splits-remaining.ok { color: var(--positive); }
.splits-remaining.bad { color: var(--negative); }
.splits-container {
  display: flex; flex-direction: column; gap: 0.4rem;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 7px; padding: 0.6rem; margin-top: 0.4rem;
}
.split-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr) minmax(0, 0.9fr) auto;
  gap: 0.4rem;
  align-items: center;
}
.split-input-row > [data-fld=memo] {
  grid-column: 1 / -1;
}
@media (max-width: 640px) {
  .split-input-row { grid-template-columns: 1fr 1fr auto; }
  .split-input-row > [data-fld=category_id] { grid-column: 1 / -1; }
}
.split-input-row > * {
  min-width: 0;
  background: var(--panel); color: var(--text); border: 1px solid var(--border);
  border-radius: 5px; padding: 0.3rem 0.5rem; font: inherit; font-size: 0.85rem;
}
.split-input-row .split-remove {
  background: none; border: 0; color: var(--negative);
  cursor: pointer; font-size: 1.2rem; padding: 0 0.4rem;
  min-width: 1.8rem;
}

/* category manager */
.cat-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
@media (max-width: 540px) { .cat-body { grid-template-columns: 1fr; } }
.cat-group {
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.7rem;
}
.cat-group-head { font-weight: 600; margin-bottom: 0.4rem; color: var(--accent); }
.cat-list { list-style: none; margin: 0; padding: 0;
            display: flex; flex-direction: column; gap: 0.3rem; }
.cat-item {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.4rem; background: var(--panel); border-radius: 5px;
}
.cat-name { flex: 1; }
.cat-tag {
  font-size: 0.7rem; color: var(--muted); text-transform: uppercase;
}
.cat-add-form { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.cat-add-form input {
  flex: 1; background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 0.35rem 0.55rem; font: inherit;
}

/* rules / scheduled tables */
.rules-table, .sched-table {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
  margin-bottom: 0.6rem;
}
.rules-table th, .sched-table th {
  text-align: left; padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--border); color: var(--muted);
  font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em;
  font-size: 0.7rem;
}
.rules-table td, .sched-table td {
  padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--border);
}
.rule-add-form {
  display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 0.4rem;
  margin-top: 0.5rem;
}
@media (max-width: 600px) { .rule-add-form { grid-template-columns: 1fr; } }
.rule-add-form input, .rule-add-form select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 0.4rem 0.55rem; font: inherit;
}

/* import preview */
.import-summary {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  padding: 0.5rem 0; color: var(--muted); font-size: 0.85rem;
}
.import-summary strong { color: var(--text); }
.import-table-wrap {
  max-height: 60vh; overflow: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.import-table {
  width: 100%; border-collapse: collapse; font-size: 0.83rem;
}
.import-table th, .import-table td {
  padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: top;
}
.import-table thead th {
  position: sticky; top: 0; background: var(--panel);
  color: var(--muted); text-transform: uppercase; font-size: 0.7rem;
  letter-spacing: 0.04em;
}
.import-table tr.duplicate { opacity: 0.55; }
.import-table td.ro { color: var(--muted); font-variant-numeric: tabular-nums; }
.import-table input, .import-table select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 0.25rem 0.4rem; font: inherit; font-size: 0.82rem; width: 100%;
}
.dup-badge {
  display: inline-block; margin-left: 0.3rem;
  font-size: 0.65rem; color: var(--warn);
}

/* reconcile diff */
.rec-diff-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.75rem; margin: 0.5rem 0;
  font-variant-numeric: tabular-nums;
}
.rec-diff-card > div { display: flex; justify-content: space-between; }
.rec-diff.ok { color: var(--positive); }
.rec-diff.bad { color: var(--negative); }

/* confirm / prompt / toast / help */
.confirm-msg { margin: 0 0 1rem; color: var(--text); }
.prompt-input {
  width: 100%; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 0.45rem 0.6rem; font: inherit;
}
.toast {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--border);
  padding: 0.5rem 0.95rem; border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  z-index: 500;
  font-size: 0.9rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.18s ease, visibility 0s linear 0.18s;
}
.toast.show {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity 0.18s ease, visibility 0s linear;
}
.toast[data-kind="err"] { border-color: var(--danger); color: var(--danger); }
.toast[data-kind="warn"] { border-color: var(--warn); color: var(--warn); }
.toast[data-kind="ok"] { border-color: var(--accent); color: var(--accent); }

.help-body { font-size: 0.9rem; }
.help-grid {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 0.85rem;
  margin: 0 0 1rem; padding: 0;
}
.help-grid dt { font-family: monospace; color: var(--accent); }
.help-grid dt.help-section {
  font-family: inherit; color: var(--muted); text-transform: uppercase;
  font-size: 0.75rem; letter-spacing: 0.06em; margin-top: 0.5rem;
}
.help-note { color: var(--muted); font-size: 0.85rem; }

.muted { color: var(--muted); }
.muted-hint { color: var(--muted); font-size: 0.8rem; }
.negative { color: var(--negative); }

/* Mobile */
@media (max-width: 480px) {
  header { padding: 0.65rem 0.75rem; }
  header h1 { font-size: 1.1rem; }
  .register-actions .btn-primary,
  .register-actions .btn-ghost { padding: 0.45rem 0.7rem; font-size: 0.85rem; }
  .tx-table { font-size: 0.82rem; }
  .col-memo { display: none; }
}
