/* Colours. Navy is the app's main colour (top bar, the dark Snapshot box, the logo's front card).
   Teal is the accent: only for things you can tap (buttons, links, the selected tab) and for focus.
   Green / red / amber keep their own meanings (more points, fewer points, soon). */
:root {
  --paper: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #E8ECF3;
  --ink: #14213A;
  --ink-2: #465468;
  --ink-3: #6B788C;
  --line: #D5DBE6;
  --navy: #1C3D73;
  --navy-ink: #FFFFFF;
  --teal: #0F756F;
  --teal-ink: #FFFFFF;
  --teal-soft: #D9EFEC;
  --amber: #D9902B;
  --amber-soft: #FBEBD2;
  --amber-ink: #6B4508;
  --brick: #B8432F;
  --brick-soft: #F7DDD6;
  --green: #2D7A4E;
  --green-soft: #DDF0E4;
  --radius-lg: 18px;
  --radius: 10px;
  --radius-sm: 6px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0D131F;
    --surface: #151D2C;
    --surface-2: #1D2739;
    --ink: #E6EBF2;
    --ink-2: #AAB5C5;
    --ink-3: #8491A5;
    --line: #2A3650;
    --navy: #14223F;
    --navy-ink: #E6EBF2;
    --teal: #3FB3A8;
    --teal-ink: #062421;
    --teal-soft: #173C3A;
    --amber: #F0AE4E;
    --amber-soft: #3B2C14;
    --amber-ink: #F6CF93;
    --brick: #EE8064;
    --brick-soft: #43221B;
    --green: #67C48E;
    --green-soft: #183729;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0D131F; --surface: #151D2C; --surface-2: #1D2739; --ink: #E6EBF2; --ink-2: #AAB5C5; --ink-3: #8491A5;
  --line: #2A3650; --navy: #14223F; --navy-ink: #E6EBF2; --teal: #3FB3A8; --teal-ink: #062421; --teal-soft: #173C3A; --amber: #F0AE4E; --amber-soft: #3B2C14;
  --amber-ink: #F6CF93; --brick: #EE8064; --brick-soft: #43221B; --green: #67C48E; --green-soft: #183729; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font);
  font-size: 15px; line-height: 1.5; font-variant-numeric: tabular-nums;
}
a { color: var(--teal); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0 0 .6em; }
small { font-size: 12.5px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); }
:focus-visible { outline: 2.5px solid var(--teal); outline-offset: 2px; }
.sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: 60px 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; background: var(--navy); color: var(--navy-ink); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--navy-ink); text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.topbar-tools { display: flex; align-items: center; gap: 10px; }
.nav { padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); position: sticky; top: 60px; height: calc(100vh - 60px); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-weight: 600; position: relative; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--teal-soft); color: var(--teal); }
.nav-add { margin: 6px 0; border: 1.5px dashed var(--line); }
.nav-item .dot { margin-left: auto; background: var(--amber); color: #2B1B02; font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.view { padding: 28px 32px 80px; max-width: 1160px; width: 100%; min-width: 0; outline: none; }

.sync-badge { font: inherit; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); padding: 5px 10px; border-radius: 99px; cursor: pointer; text-decoration: none; }
.sync-badge.off { color: var(--ink-3); }
.sync-badge.busy { color: var(--teal); }
.sync-badge.warn { color: var(--amber-ink); background: var(--amber-soft); border-color: var(--amber); } /* "Tap to sync": Google's pass ran out */

/* ---------- type & blocks */
.page-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 18px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lede { font-size: 16px; color: var(--ink-2); max-width: 70ch; }
.block { margin-top: 34px; }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.block h2, .bank-group h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.ok-text { color: var(--green); font-weight: 600; }
.warn-text { color: var(--amber-ink); font-weight: 600; }
.error { color: var(--brick); }
.empty-inline { padding: 22px; border: 1.5px dashed var(--line); border-radius: var(--radius); color: var(--ink-2); margin: 10px 0; }

/* ---------- hero: next to expire */
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 28px; padding: 26px 28px; border-radius: var(--radius-lg); background: var(--navy); color: #EEF2F8; }
.hero.urgent { background: linear-gradient(135deg, #5A3707, #8C5610); }
.hero.quiet { grid-template-columns: 1fr; background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.hero-kicker { font-weight: 600; font-size: 14px; opacity: .8; margin-bottom: 4px; }
.hero-amount { margin: 0; line-height: 1; }
.hero-amount .n { font-size: clamp(44px, 7vw, 72px); font-weight: 800; letter-spacing: -0.035em; color: var(--amber); }
.hero.urgent .hero-amount .n { color: #FFD38A; }
.hero-amount .u { font-size: 20px; font-weight: 600; opacity: .85; }
.hero-when { font-size: 22px; font-weight: 700; margin: 8px 0 14px; letter-spacing: -0.01em; }
.hero-sub { opacity: .78; margin: 10px 0 0; }
.hero-none { font-size: 20px; font-weight: 700; }
.runway { height: 6px; border-radius: 3px; background: rgba(255,255,255,.14); overflow: hidden; max-width: 420px; }
.runway i { display: block; height: 100%; background: var(--amber); border-radius: 3px; }
.hero-list { list-style: none; margin: 0; padding: 0; align-self: center; display: grid; gap: 10px; }
.hero-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-radius: var(--radius); background: rgba(255,255,255,.07); }
.hero-list li span { font-weight: 600; }
.hero-list li b { font-size: 17px; }
.hero-list li em { grid-column: 1 / -1; font-style: normal; font-size: 13px; opacity: .7; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero:not(.quiet) { background: var(--navy); } }
:root[data-theme="dark"] .hero:not(.quiet) { background: var(--navy); }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.stat { padding: 16px 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); display: grid; gap: 2px; color: inherit; text-decoration: none; }
.stat.link:hover { border-color: var(--teal); }
.stat span { color: var(--ink-2); font-weight: 600; font-size: 13.5px; }
.stat strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat small { color: var(--ink-3); }

/* ---------- tables */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.grid { width: 100%; border-collapse: collapse; min-width: 640px; }
.grid th, .grid td { padding: 11px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.grid thead th { font-size: 12.5px; font-weight: 700; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.grid tbody th { font-weight: 600; }
.grid tbody th a { color: var(--ink); text-decoration: none; }
.grid tbody th a:hover { color: var(--teal); text-decoration: underline; }
.grid th small, .grid td small { display: block; color: var(--ink-3); font-weight: 500; }
.grid .num { text-align: right; white-space: nowrap; }
.grid .strong { font-weight: 700; }
.grid tfoot th, .grid tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }
.grid tbody tr:last-child th, .grid tbody tr:last-child td { border-bottom: 0; }
.grid tr.auto th, .grid tr.auto td { color: var(--ink-2); }
.grid.compact th, .grid.compact td { padding: 8px 12px; }
.grid.compact select { max-width: 260px; }
.row-toggle { cursor: pointer; }
.row-toggle:hover { background: var(--surface-2); }
.chev { display: inline-block; width: 8px; height: 8px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(-45deg); margin-right: 10px; transition: transform .15s; position: relative; top: -1px; }
.row-toggle.open .chev { transform: rotate(45deg); }
tr.detail td { background: var(--paper); padding: 6px 18px 14px; }
.stmt-detail { margin-top: 10px; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini td { padding: 4px 8px; border-bottom: 1px dashed var(--line); }
.mini tr.refund td { color: var(--green); }
.bills .closed th, .bills .closed td { color: var(--ink-2); }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.actions-cell .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
.due { font-weight: 700; }
.due.soon { color: var(--amber-ink); }
.due.late { color: var(--brick); }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.warn { background: var(--amber-soft); color: var(--amber-ink); }
.badge.bad { background: var(--brick-soft); color: var(--brick); }
.tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }

/* ---------- controls */
.btn { font: inherit; font-weight: 700; font-size: 14px; border-radius: var(--radius); padding: 9px 16px; border: 1.5px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; line-height: 1.2; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.primary { background: var(--teal); color: var(--teal-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-3); }
.btn.danger { color: var(--brick); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.linklike { font: inherit; color: var(--teal); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.icon-btn { font-size: 20px; line-height: 1; border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 2px 6px; border-radius: 6px; margin-left: auto; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 2px; background: var(--surface); }
.seg button { font: inherit; font-weight: 600; font-size: 13.5px; border: 0; background: none; color: var(--ink-2); padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg.small button { padding: 3px 9px; font-size: 12.5px; }
select, input[type="text"], input[type="date"], input[type="password"], input:not([type]), input[inputmode] {
  font: inherit; font-size: 14.5px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; width: 100%;
}
select { width: auto; max-width: 100%; }
.period-ctl { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.period-ctl input[type="date"] { width: auto; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field { display: grid; gap: 5px; align-content: start; }
.field > span { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.field.narrow { max-width: 260px; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; margin: 8px 0; }
.check input { margin-top: 4px; accent-color: var(--teal); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; align-items: start; }
.span2 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 16px; margin: 16px 0 0; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- import */
.drop { display: grid; gap: 6px; place-items: center; text-align: center; padding: 44px 20px; border: 2px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--teal-soft); }
.drop-title { font-weight: 800; font-size: 18px; }
.drop-sub { color: var(--ink-3); max-width: 46ch; }
#queue { display: grid; gap: 14px; margin-top: 20px; }
.q-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.q-item.done { border-color: var(--green); }
.q-item.bad { border-color: var(--brick); }
.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.q-head b { overflow-wrap: anywhere; }
.pw-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.pw-form .field { flex: 1 1 260px; }
.review-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin: 12px 0; }
.review-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }

/* ---------- cards */
.bank-group { margin-top: 26px; }
.card-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; margin-top: 10px; }
.card-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; display: grid; gap: 8px; align-content: start; }
.card-tile.inactive { opacity: .6; }
.ct-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.ct-top h3 { font-size: 16px; font-weight: 700; }
.ct-points { margin: 0; font-size: 15px; }
.ct-points b { font-size: 20px; letter-spacing: -0.01em; }
.ct-facts { list-style: none; padding: 0; margin: 0; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 2px; }
.card-tile .btn { justify-self: start; }

/* ---------- settings */
.settings { max-width: 720px; padding-bottom: 6px; border-bottom: 1px solid var(--line); padding-bottom: 26px; }
.settings h2 { margin-bottom: 10px; }
.settings .field { margin: 10px 0; }
.steps { padding-left: 20px; }
.stack { display: grid; gap: 8px; justify-items: start; margin: 14px 0; }

/* ---------- welcome */
.welcome { max-width: 760px; padding-top: 20px; }
.welcome h1 { font-size: clamp(30px, 4.6vw, 44px); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 14px; }
.welcome > p { font-size: 17px; color: var(--ink-2); max-width: 60ch; }
.welcome-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.step { display: grid; gap: 4px; align-content: start; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.step:hover { border-color: var(--teal); }
.step b { font-size: 16px; color: var(--teal); }
.step span { color: var(--ink-2); font-size: 14px; }
.history-toggle { margin: 22px 0 10px; }

/* ---------- dialog & toast */
dialog.dlg { border: 0; border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--ink); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 60px rgba(10, 30, 35, .28); }
dialog.dlg.wide { width: min(720px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(12, 28, 32, .5); }
.dlg-body { padding: 22px 24px; }
.dlg-body h2 { font-size: 20px; margin-bottom: 12px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; align-items: center; }
.actions .spacer { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 11px 18px; border-radius: var(--radius); font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--brick); color: #fff; }

/* ---------- phone */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px 1fr auto; }
  .topbar { padding: 0 16px; height: 56px; }
  .brand span { display: none; }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 20; }
  .nav-item { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; text-align: center; }
  .nav-add { border: 0; margin: 0; }
  .nav-add svg { background: var(--teal); color: var(--teal-ink); border-radius: 50%; padding: 3px; width: 28px; height: 28px; }
  .nav-item .dot { position: absolute; top: 2px; right: calc(50% - 22px); }
  .view { padding: 20px 16px 110px; }
  .hero { grid-template-columns: 1fr; padding: 22px 20px; gap: 18px; }
  .stat-row { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .welcome-steps { grid-template-columns: 1fr; }
  .toast { bottom: 90px; }
  .page-title { font-size: 23px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.preview-note { padding: 12px 16px; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber-ink); font-weight: 600; max-width: 720px; }

.notice { display: flex; gap: 12px 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; margin: 12px 0; border-radius: var(--radius); background: var(--amber-soft); color: var(--amber-ink); }
.notice p { margin: 0; font-weight: 600; max-width: 70ch; }
.pick-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.hint { margin-top: 6px; font-size: 13px; color: var(--ink-2); max-width: 46ch; }
.hint .linklike { font-weight: 700; }

.pts-now { font-size: 15px; margin: 0 0 4px; }
.pts-now b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.pts-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; align-items: end; margin: 14px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
@media (max-width: 820px) { .pts-form { grid-template-columns: 1fr; } }
.card-tile .row-actions { justify-self: start; }
.linklike.small { display: block; margin-top: 2px; font-size: 12.5px; }

.card-list { margin-top: 4px; }
.order-list { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; gap: 6px; max-width: 720px; }
.order-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.order-list li.dragging { opacity: .5; }
.order-list li.drop-target { border-color: var(--teal); box-shadow: inset 0 3px 0 var(--teal); }
.grip { color: var(--ink-3); cursor: grab; letter-spacing: -2px; user-select: none; }
.order-name { flex: 1; min-width: 0; display: grid; }
.order-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-btns { display: flex; gap: 4px; }
th.sortable { padding: 0; }
th.sortable button { font: inherit; color: inherit; background: none; border: 0; padding: 11px 14px; width: 100%; text-align: inherit; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; justify-content: inherit; white-space: nowrap; }
th.num.sortable button { justify-content: flex-end; }
th.sortable button:hover { color: var(--ink); }
th.sortable .arrow { font-size: 11px; color: var(--teal); }
.sort-note { margin: -4px 0 8px; }

/* points expiring within 3 months */
:root { --soon: #B23A1E; --soon-soft: #FBE3DA; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --soon: #FF8F6B; --soon-soft: #4A2116; } }
:root[data-theme="dark"] { --soon: #FF8F6B; --soon-soft: #4A2116; }
/* points differ from expected by more than the limit (Settings → Points check).
   --hi is the chosen colour; without one it follows the attention colour above. */
.row-hi { --hi-c: var(--hi, var(--hi-default)); }
.row-hi > th:first-child { box-shadow: inset 4px 0 0 var(--hi-c); }
/* the cell keeps the normal text colour so a light colour such as yellow stays readable */
.cell-hi { font-weight: 800; background: color-mix(in srgb, var(--hi-c) 30%, transparent); }
.hi-sample { --hi-c: var(--hi, var(--hi-default)); display: inline-block; padding: 1px 8px; border-radius: var(--radius-sm); box-shadow: inset 3px 0 0 var(--hi-c); }
/* default highlight colour: yellow (a little deeper in dark mode) */
:root { --hi-default: #F2C230; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --hi-default: #E0B420; } }
:root[data-theme="dark"] { --hi-default: #E0B420; }

/* settings: Google features, reminder steps, highlight colours */
.account-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.account-row p { margin: 0; }
.advanced { margin-top: 12px; }
.advanced summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.feature-list { display: grid; gap: 4px; margin-top: 16px; }
.feature { padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.feature .check { margin: 0; }
.check small, .feature small { display: block; font-weight: 400; margin-top: 2px; }
.check.off, .feature.off { opacity: .55; }
.check.off input, .feature.off input { cursor: not-allowed; }
.row-actions.sub { margin: 8px 0 0 25px; align-items: center; }
.step-group { margin: 16px 0 6px; }
.step-title { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0 0 4px; }
.step-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: 12.5px; font-weight: 800; }
.inline-field { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.inline-field input, .check .inline-field input { width: 90px; height: auto; margin-top: 0; padding: 5px 8px; }
.inline-field select { padding: 5px 8px; }
.field-label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); margin: 14px 0 6px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { position: relative; cursor: pointer; display: inline-grid; place-items: center; }
.swatch input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch .dot { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); }
.swatch .dot.auto { background: var(--hi-default); }
.swatch input[type="color"] { width: 36px; height: 36px; padding: 2px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.swatch input[type="radio"]:checked + .dot, .swatch input[type="radio"]:checked + input[type="color"] { box-shadow: 0 0 0 2.5px var(--ink); }
.swatch input[type="radio"]:focus-visible + .dot { outline: 2px solid var(--teal); outline-offset: 3px; }
.own { margin-top: 4px; padding-left: 4px; }
.feature-info { margin: 0; }
.month-list { display: grid; gap: 6px; margin: 4px 0 8px; }
.month-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upcoming { margin: 0; padding-left: 18px; display: grid; gap: 3px; color: var(--ink-2); }
.rates-notice ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }

.exp-btn { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.exp-btn:hover { text-decoration-color: currentColor; }
.exp-btn.soon, .soon-row th, .soon-row td b { color: var(--soon); }
.soon-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--soon-soft); color: var(--soon); vertical-align: 1px; }
.soon-tag.on-dark { background: #FFD9CC; color: #8A2A12; margin-left: 6px; }
.soon-row { background: var(--soon-soft); }
.sched tbody th small, .sched tbody td small { display: block; }

/* full-screen "sheet" dialogs (points history): fixed top part, scrolling body.
   Phones: whole screen, back button top left. Desktop: centred window, × top right. */
dialog.dlg.sheet[open] { display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { flex: none; padding: 14px 24px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.sheet-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 24px 24px; overscroll-behavior: contain; }
.sheet-scroll .pts-form { margin-top: 0; }
.sheet-scroll:focus { outline: none; } /* focused on open so the back button shows no focus ring */
.sheet-bar { display: flex; align-items: center; gap: 6px; min-height: 40px; margin-bottom: 6px; }
.sheet-bar.desktop { justify-content: space-between; }
.sheet-title { font-size: 19px; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.sheet-title.large { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin: 2px 0 8px; }
.nav-back { display: inline-flex; align-items: center; gap: 2px; font: inherit; font-weight: 600; font-size: 16px; color: var(--teal); background: none; border: 0; padding: 6px 8px 6px 0; cursor: pointer; }
.icon-btn.nav-back { padding: 8px; margin-left: -8px; color: var(--ink); border-radius: 50%; }
.icon-btn.close-x { font-size: 24px; line-height: 1; padding: 4px 10px; }
@media (max-width: 820px) {
  dialog.dlg.sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; inset: 0; border-radius: 0; }
  .sheet-head { padding: calc(8px + env(safe-area-inset-top)) 16px 10px; }
  .sheet-scroll { padding: 14px 16px calc(24px + env(safe-area-inset-bottom)); }
}

/* Spending and points table: five columns by default so it fits a phone;
   » next to "Transactions" adds Domestic / Foreign / Refunds, « hides them again. */
table.grid.period.narrow { min-width: 0; }
.grid th.with-toggle { white-space: nowrap; }
.grid th.with-toggle > button[data-sort] { display: inline-flex; width: auto; padding-right: 4px; }
/* must beat the full-width style of the sort buttons ("th.sortable button") */
.grid th.sortable .col-toggle { display: inline-block; width: auto; padding: 3px 7px; justify-content: center; }
.col-toggle { font: inherit; font-size: 15px; font-weight: 800; line-height: 1; color: var(--teal); background: var(--teal-soft); border: 0; border-radius: 6px; padding: 3px 7px; margin: 8px 10px 8px 0; cursor: pointer; vertical-align: middle; }
.col-toggle:hover { filter: brightness(.95); }
/* the card name stays in view when the table is scrolled sideways */
.grid.period tr > th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
.grid.period thead th:first-child, .grid.period tfoot th:first-child { background: var(--surface-2); }
.grid.period tr.row-toggle:hover > th:first-child { background: var(--surface-2); }
.grid.period tr.row-hi > th:first-child { box-shadow: inset 4px 0 0 var(--hi-c), 1px 0 0 var(--line); }
@media (max-width: 820px) {
  .grid.period th, .grid.period td { padding: 10px 10px; }
  .grid.period tr > th:first-child { max-width: 42vw; }
}

/* full figures on wider screens, short ones on phones */
.phone-only { display: none; }
@media (max-width: 820px) {
  .wide-only { display: none; }
  .phone-only { display: inline; }
  .grid.period th, .grid.period td { padding: 9px 5px; }
  .grid.period thead th, .grid.period thead th button { font-size: 11.5px; }
  .grid.period th.sortable button { white-space: normal; flex-wrap: wrap; }
  .grid.period tr > th:first-child { max-width: 25vw; padding-left: 10px; font-size: 14px; }
  .grid.period thead th, .grid.period th.with-toggle { white-space: normal; }
  .grid.period th.with-toggle > button[data-sort], .grid.period th.sortable button[data-sort] { padding: 9px 5px 2px; }
  .grid.period th.sortable .col-toggle { margin: 0 6px 8px; }
  .grid.period td small { white-space: normal; }
  .grid.period .chev { margin-right: 6px; }
}

/* Card column sort icon: ▲ lit for A–Z, ▼ lit for Z–A, both dim for Custom */
.sort-icon { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1; font-size: 7.5px; color: var(--ink-3); opacity: .55; margin: 0 2px; }
.sort-icon i { font-style: normal; }
.sort-icon.up i:first-child, .sort-icon.down i:last-child { color: var(--teal); opacity: 1; }
.sort-icon.up, .sort-icon.down { opacity: 1; }

/* ---------- app lock (js/lock.js) */
body.locked { overflow: hidden; }
.lock { position: fixed; inset: 0; z-index: 1000; background: var(--paper); display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; color: var(--ink); }
.lock-box { width: 100%; max-width: 320px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--teal); }
.lock-box h1 { margin: 0; font-size: 22px; color: var(--ink); }
.lock-msg { margin: 0; color: var(--ink-2); font-weight: 600; min-height: 1.4em; }
.lock-dots { display: flex; gap: 12px; margin: 6px 0 10px; }
.lock-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--teal); }
.lock-dots i.on { background: var(--teal); }
.lock-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.lock-pad button { font: inherit; font-size: 24px; font-weight: 600; height: 62px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lock-pad button:active { background: var(--teal-soft); }
.lock-box.shake { animation: lockshake .35s; }
@keyframes lockshake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- settings pages (collapsible headings) */
.set-acc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 10px; }
.set-acc > summary { list-style: none; cursor: pointer; font-weight: 700; font-size: 17px; padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; }
.set-acc > summary::-webkit-details-marker { display: none; }
.set-acc > summary::after { content: ''; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .15s; }
.set-acc[open] > summary::after { transform: rotate(-135deg); }
.set-acc-body { padding: 0 18px 8px; }
.set-acc-body > .block:first-child { margin-top: 0; }
.pin-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.pin-form input { font: inherit; letter-spacing: .3em; width: 9em; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }

/* ---------- Snapshot: what needs attention */
.attention { display: grid; gap: 10px; margin-bottom: 18px; }
.att-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.att-card h2 { font-size: 15px; margin: 0 0 8px; }
.att-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.att-row:first-of-type { border-top: 0; }
.att-row small { display: block; color: var(--ink-3); }
.att-row b { font-weight: 700; }
.att-ok { color: var(--green); font-weight: 600; margin: 0; }

/* ---------- Add Statement: scan tokens, save all */
.token-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--teal-soft); color: var(--teal); font-weight: 700; border-radius: 999px; padding: 6px 14px; margin: 0 0 14px; }
.token-pill b { font-size: 17px; }
.save-all { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--green-soft); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0 6px; font-weight: 600; }
details.q-details > summary { cursor: pointer; font-weight: 600; color: var(--teal); margin: 6px 0; }

/* ---------- phones: tables become cards (Bills, points history) */
@media (max-width: 820px) {
  .table-wrap:has(table.cards-on-phone) { border: 0; background: none; overflow: visible; }
  table.cards-on-phone { min-width: 0; }
  table.cards-on-phone thead { display: none; }
  table.cards-on-phone, table.cards-on-phone tbody { display: block; }
  table.cards-on-phone tr { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px; }
  table.cards-on-phone th, table.cards-on-phone td { display: block; border: 0 !important; padding: 2px 0; text-align: left; }
  table.cards-on-phone th[scope=row] { grid-column: 1 / -1; font-size: 16px; }
  table.cards-on-phone td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
  table.cards-on-phone td.num { text-align: left; }
  table.cards-on-phone td.actions-cell { grid-column: 1 / -1; padding-top: 8px; }
  table.cards-on-phone .actions-cell .row-actions { justify-content: flex-start; flex-wrap: wrap; }
  table.cards-on-phone td:empty { display: none; }
}

/* Points by card stays a table on phones: tight columns, card name on up to two rows,
   expiry amount above its date, source label above its date */
.nowrap { white-space: nowrap; }
@media (max-width: 820px) {
  table.grid.pts { min-width: 0; }
  .grid.pts th, .grid.pts td { padding: 9px 4px; font-size: 12.5px; }
  .grid.pts thead th, .grid.pts thead th button { font-size: 11px; white-space: normal; }
  .grid.pts th.sortable button { padding: 9px 4px; gap: 2px; flex-wrap: wrap; }
  .grid.pts tbody th { width: 24vw; max-width: 24vw; padding-left: 8px; font-size: 13.5px; overflow-wrap: anywhere; }
  .grid.pts td small, .grid.pts th small { white-space: normal; font-size: 11px; }
  .grid.pts .exp-btn { text-align: left; padding: 0; }
  .grid.pts .exp-btn b { display: block; }
  .grid.pts .on-word { display: none; }
  .grid.pts .linklike { font-size: 11.5px; text-align: left; }
}

/* points history on phones: stacked rows (specificity matches ".grid.compact td" so the tight padding wins) */
@media (max-width: 820px) {
  .table-wrap:has(table.history-phone) { border: 0; background: none; overflow: visible; }
  table.grid.history-phone { min-width: 0; }
  .grid.history-phone thead { display: none; }
  .grid.history-phone, .grid.history-phone tbody { display: block; }
  .grid.history-phone tr { display: grid; grid-template-columns: 1fr 1fr auto; column-gap: 12px; row-gap: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 12px; margin-bottom: 6px; }
  .grid.history-phone td { display: block; border: 0 !important; padding: 0; line-height: 1.3; text-align: left; }
  .grid.history-phone td:nth-child(1) { grid-column: 1 / 3; font-weight: 700; }
  .grid.history-phone td:nth-child(5) { grid-column: 3; grid-row: 1; text-align: right; }
  .grid.history-phone td:nth-child(2) { grid-column: 1 / -1; }
  .grid.history-phone td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--ink-3); margin-top: 3px; }
  .grid.history-phone td.num { text-align: left; }
  .grid.history-phone td:empty { display: none; }
  .grid.history-phone td:nth-child(5):empty { display: block; }
}
@media (max-width: 820px) { .grid.period th.num.sortable button { flex-wrap: nowrap; } }

/* hide / show the sidebar (menu button, wide screens and landscape phones only) */
.topbar-left { display: flex; align-items: center; gap: 8px; }
.nav-toggle { font: inherit; background: none; border: 0; color: var(--navy-ink); width: 38px; height: 38px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.nav-toggle:hover { background: rgba(255,255,255,.14); }
@media (max-width: 820px) { .nav-toggle { display: none; } }
@media (min-width: 821px) {
  body.nav-hidden .shell { grid-template-columns: minmax(0, 1fr); }
  body.nav-hidden .nav { display: none; }
}

/* Points by card, phones: every heading and its sort icon on ONE row; the Card column gives up space */
@media (max-width: 820px) {
  .grid.pts thead th.num button, .grid.pts thead th:nth-child(4) button { white-space: nowrap; flex-wrap: nowrap; padding: 9px 3px; }
  .grid.pts thead th, .grid.pts thead th button { font-size: 10.5px; }
  .grid.pts tbody th { width: 17vw; max-width: 17vw; padding-left: 6px; font-size: 13px; }
  .grid.pts th, .grid.pts td { padding-left: 3px; padding-right: 3px; }
  .grid.pts thead th:first-child { padding-left: 6px; }
  /* breathing room between Balance, ≈ Miles and Next Exp: extra space on the left of the 3rd and 4th columns.
     ("Sent to partner" rows have one wide cell for Balance + Miles, so their 3rd cell is the Next Exp one.) */
  .grid.pts tr > :nth-child(3), .grid.pts tr:not(.auto) > :nth-child(4) { padding-left: clamp(9px, 2.6vw, 14px); } /* a little less on narrow phones so nothing is pushed off screen */
  .grid.pts thead th:nth-child(4) button { padding-left: 0; }
}

/* Points by card: all headings (including Source) centred on the same line */
.grid.pts thead th { vertical-align: middle; }

/* approximate points check (from the balance change): softer than a confirmed difference */
.cell-hi.approx { font-weight: 600; background: color-mix(in srgb, var(--hi-c) 14%, transparent); outline: 1.5px dashed var(--hi-c); outline-offset: -3px; }

/* ---------- ad space (free plan, js/ads.js): placeholder box like the banner in Gmail / Yahoo Mail */
.ad-slot { position: relative; display: flex; align-items: center; justify-content: center; min-height: 84px; margin: 0 0 18px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: 13px; }
.ad-tag { position: absolute; top: 6px; left: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.grid .ad-row td { padding: 10px 14px; background: var(--paper); }
.grid .ad-row .ad-slot { margin: 0; }
@media (max-width: 820px) {
  table.cards-on-phone tr.ad-row { display: block; background: none; border: 0; padding: 0; margin-bottom: 10px; }
  table.cards-on-phone tr.ad-row td { padding: 0; }
}

.ad-remove { position: absolute; top: 5px; right: 8px; font: inherit; font-size: 11.5px; font-weight: 700; color: var(--teal); background: none; border: 0; padding: 2px 4px; cursor: pointer; text-decoration: underline; }

.about-links { display: flex; flex-wrap: wrap; gap: 6px 18px; }

/* ---------- "How to use" guide (js/tour.js): semi-transparent backdrop with one card per step */
body.touring { overflow: hidden; }
.tour { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(10, 18, 36, 0.62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.tour:focus { outline: none; }
.tour-card { width: 100%; max-width: 420px; max-height: 100%; overflow-y: auto; background: var(--surface); color: var(--ink); border-radius: var(--radius-lg); padding: 18px 18px 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.tour-step { margin: 0 0 8px; font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .03em; text-transform: uppercase; }
.tour-card h2 { margin: 14px 0 6px; font-size: 20px; }
.tour-body { margin: 0; color: var(--ink-2); line-height: 1.5; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 10px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { width: 20px; border-radius: 4px; background: var(--teal); }
.tour-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tour-nav-right { display: flex; gap: 8px; }
.tour-later { display: block; margin: 10px auto 0; }

/* the small drawing of each screen */
.tour-mock { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; font-size: 12px; pointer-events: none; }
.tm-head { font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.tour-mock small { display: block; color: var(--ink-3); font-size: 10.5px; }
.tm-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.tm-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.tm-tile b { display: block; font-size: 16px; margin: 2px 0; }
.tm-list { display: grid; gap: 6px; }
.tm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; }
.tm-card { justify-content: flex-start; }
.tm-card > small:last-child { margin-left: auto; }
.tm-chip { width: 26px; height: 18px; border-radius: 4px; background: var(--navy); flex: none; }
.tm-table { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.tm-tr { display: grid; grid-template-columns: 1.5fr 1fr .9fr .9fr .9fr; gap: 4px; align-items: center; padding: 7px 8px; border-top: 1px solid var(--line); font-size: 11px; }
.tm-th { border-top: 0; background: var(--surface-2); color: var(--ink-3); font-weight: 700; font-size: 10px; }
.tm-hi { box-shadow: inset 3px 0 0 var(--hi-default, #E5B80B); }
.tm-cell-hi { font-weight: 800; background: color-mix(in srgb, var(--hi-default, #E5B80B) 35%, transparent); border-radius: 4px; padding: 1px 3px; }
.tm-badge { font-style: normal; font-weight: 700; font-size: 10.5px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tm-badge.bad { background: var(--brick-soft); color: var(--brick); }
.tm-badge.ok { background: var(--green-soft); color: var(--green); }
.tm-note { margin: 6px 0 0; font-size: 10.5px; color: var(--ink-3); }
.tm-bill { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.tm-bill > b { font-size: 14px; }
.tm-bill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.tm-bill-grid b { display: block; font-size: 13px; }
.tm-soon { color: var(--amber-ink); }
.tm-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.tm-btn { font-style: normal; font-weight: 700; font-size: 11px; padding: 5px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); }
.tm-btn.primary { background: var(--teal); color: var(--teal-ink); border-color: var(--teal); }
.tm-drop { border: 1.5px dashed var(--line); border-radius: 8px; padding: 16px 10px; text-align: center; margin-bottom: 8px; background: var(--surface); }
.tm-drop b { display: block; font-size: 12.5px; margin-bottom: 3px; }

/* solid red button for a delete that cannot be undone */
.btn.danger-solid { background: var(--brick); color: #fff; border-color: var(--brick); }

/* Add Statement: "file removed - Undo" bar */
.undo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--surface-2); border-radius: var(--radius); padding: 8px 12px; margin: 10px 0; }
.undo-bar > span:last-child { display: flex; align-items: center; gap: 6px; }

/* reminder time (Settings and Cards -> Edit) */
.time-field { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 600; }
.time-field input { font: inherit; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }

/* Edit card buttons on phones: Save full width on top, Combine + Cancel side by side, Delete on its own
   below (red text, kept away from Save so it isn't tapped by mistake). Wider screens keep one row. */
@media (max-width: 600px) {
  .card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: stretch; }
  .card-actions .spacer { display: none; }
  .card-actions .btn { width: 100%; justify-content: center; text-align: center; }
  .card-actions .btn.primary { grid-column: 1 / -1; grid-row: 1; padding-top: 12px; padding-bottom: 12px; }
  .card-actions [data-merge] { grid-row: 2; grid-column: 1; }
  .card-actions [data-x] { grid-row: 2; grid-column: 2; }
  .card-actions.new [data-x] { grid-column: 1 / -1; }
  .card-actions [data-del] { grid-row: 3; grid-column: 1 / -1; border: 0; background: none; margin-top: 10px; }
}

/* Edit card: earning rates used before a rate change (card.olderRates) */
.older-rates ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 4px; }
.older-rates li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; background: var(--surface-2, transparent); border: 1px solid var(--line); border-radius: 8px; padding: 4px 4px 4px 10px; }
#rsf .check { align-items: flex-start; margin: 8px 0; }
#rsf .check small { display: block; }

/* How to use guide: the new page slides in from the side it was swiped from (or Next / Back) */
.tour-card.from-right { animation: tour-in-right .22s ease-out; }
.tour-card.from-left { animation: tour-in-left .22s ease-out; }
@keyframes tour-in-right { from { transform: translateX(40px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes tour-in-left { from { transform: translateX(-40px); opacity: .3; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tour-card.from-right, .tour-card.from-left { animation: none; } }
