/* CardKeeper — styled after Apple's Human Interface Guidelines for Safari on iPhone and Mac.
   Sizes are in rem so iPhone text follows the Dynamic Type setting (see html rule below). */

:root {
  --bg: #f2f2f7;                       /* systemGroupedBackground */
  --surface: #ffffff;                  /* secondarySystemGroupedBackground */
  --surface-raised: #ffffff;
  --fill: rgba(118, 118, 128, 0.12);   /* tertiarySystemFill: fields, plain buttons */
  --fill-strong: rgba(118, 118, 128, 0.2);
  --highlight: #d1d1d6;                /* pressed row */
  --text: #000000;
  --muted: rgba(60, 60, 67, 0.6);      /* secondaryLabel */
  --faint: rgba(60, 60, 67, 0.3);      /* tertiaryLabel, chevrons */
  --line: rgba(60, 60, 67, 0.29);      /* separator */
  --accent: #007aff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(0, 122, 255, 0.12);
  --good: #248a3d;                     /* accessible green text */
  --good-fill: #34c759;
  --good-soft: rgba(52, 199, 89, 0.15);
  --warn: #c93400;
  --warn-soft: rgba(255, 149, 0, 0.16);
  --bad: #d70015;
  --bad-soft: rgba(255, 59, 48, 0.13);
  --seg-on: #ffffff;
  --glass: rgba(249, 249, 251, 0.88);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 1.5l3 3M3 7.5l3 3 3-3' fill='none' stroke='%233c3c43' stroke-opacity='.6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --toast-bg: rgba(28, 28, 30, 0.94);
  --toast-ink: #ffffff;
  --chip-w: 56px;                      /* small card pictures in lists */
  --radius: 12px;
  --gutter: 16px;
  --tabbar: 62px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-raised: #2c2c2e;
    --fill: rgba(118, 118, 128, 0.24);
    --fill-strong: rgba(118, 118, 128, 0.36);
    --highlight: #3a3a3c;
    --text: #ffffff;
    --muted: rgba(235, 235, 245, 0.6);
    --faint: rgba(235, 235, 245, 0.3);
    --line: rgba(84, 84, 88, 0.65);
    --accent: #0a84ff;
    --accent-soft: rgba(10, 132, 255, 0.2);
    --good: #30d158;
    --good-fill: #30d158;
    --good-soft: rgba(48, 209, 88, 0.18);
    --warn: #ff9f0a;
    --warn-soft: rgba(255, 159, 10, 0.18);
    --bad: #ff453a;
    --bad-soft: rgba(255, 69, 58, 0.18);
    --seg-on: #636366;
    --glass: rgba(28, 28, 30, 0.86);
    --toast-bg: rgba(242, 242, 247, 0.96);
    --toast-ink: #000000;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 1.5l3 3M3 7.5l3 3 3-3' fill='none' stroke='%23ebebf5' stroke-opacity='.6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
/* iPhone/iPad Safari only: honour the Dynamic Type text size (17px at the default setting). */
@supports (font: -apple-system-body) and (-webkit-touch-callout: none) {
  html { font: -apple-system-body; }
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a, button, summary, label, input, select, textarea { touch-action: manipulation; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 2rem; font-weight: 700; letter-spacing: 0.01em; }              /* Large Title */
h2 {                                                                             /* grouped section header */
  font-size: 0.8125rem; font-weight: 400; text-transform: uppercase; letter-spacing: 0.02em;
  color: var(--muted); margin: 1.75rem var(--gutter) 0.4rem;
}
h3 { font-size: 1.0625rem; font-weight: 600; }
p { margin: 0 0 0.75rem; }
b, strong { font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.9375rem; }   /* Subheadline */
.tiny { font-size: 0.8125rem; }    /* Footnote */
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0; }
.prewrap { white-space: pre-wrap; }
.break { word-break: break-all; }
.center { text-align: center; }
.mt { margin-top: 1rem; } .mt-s { margin-top: 0.5rem; } .mb { margin-bottom: 1rem; }
.split { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- frame ---------- */
.app {
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) calc(var(--tabbar) + 40px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
}
.app.bare { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.page { max-width: 720px; margin: 0 auto; }
.page.wide { max-width: 1120px; }
.col { min-width: 0; }
.show-wide { display: none !important; }
.wide-only-inline { display: none; }
.mb-s { margin-bottom: 8px; }
.footnote { padding: 0 var(--gutter); }
.topbar {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: calc(1.25rem + env(safe-area-inset-top)) 0 0.5rem;
}
.topbar .actions { display: flex; gap: 8px; align-items: center; padding-bottom: 4px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 999px;
  background: var(--fill); color: var(--accent);
}
.icon-btn svg { width: 20px; height: 20px; }
button.icon-btn { border: 0; padding: 0; font: inherit; cursor: pointer; }
.icon-btn.plain { background: none; color: var(--faint); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small svg { width: 17px; height: 17px; }
.icon-btn:active { opacity: 0.6; }
.navrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: env(safe-area-inset-top); }
.navrow .back { padding-top: 0; }
.nav-action { font-size: 1.0625rem; min-height: 44px; display: inline-flex; align-items: center; padding-left: 12px; }
.back {
  display: inline-flex; align-items: center; gap: 2px; font-size: 1.0625rem; min-height: 44px;
  padding-top: env(safe-area-inset-top); margin-left: -6px;
}
.back svg { width: 22px; height: 22px; }
/* The back link already clears the notch, so the title under it doesn't add that space again. */
.back:not([hidden]) + .topbar { padding-top: 0.25rem; }

/* Floating glass tab bar (iPhone) */
.tabbar {
  position: fixed; z-index: 20;
  left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom));
  width: min(460px, calc(100vw - 2 * var(--gutter)));
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border: 0.5px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.tabbar nav { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar); padding: 5px; }
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text); font-size: 0.625rem; font-weight: 500; border-radius: 999px; letter-spacing: 0;
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.on { color: var(--accent); background: var(--fill); }
.tabbar a.wide-only, .sidebar-user { display: none; }

/* ---------- grouped lists ---------- */
/* A .stack is one inset-grouped section; each .tile inside it is a row. */
.stack {
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
}
.stack > * { position: relative; }
.stack > .tile, .stack > .stack-row {
  border-radius: 0; background: transparent;
}
.stack > .tile + .tile::before, .stack > * + .stack-row::before, .stack > .stack-row + .tile::before {
  content: ""; position: absolute; top: 0; left: var(--gutter); right: 0;
  border-top: 0.5px solid var(--line);
}
.stack > p { margin: 0; padding: 12px var(--gutter); }
.stack-row { padding: 11px var(--gutter); min-height: 44px; }
.action-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.action-row .btn-row { gap: 6px; }
.title-s { font-weight: 600; }
.row-end { display: inline-flex; align-items: center; gap: 4px; margin-right: -6px; }
.row-end form, .split form { margin: 0; display: inline-flex; }
.used-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }

.tile {
  display: block; position: relative; background: var(--surface); border-radius: var(--radius);
  padding: 11px var(--gutter); color: var(--text); min-height: 44px;
}
a.tile { padding-right: 34px; }
a.tile::after {  /* disclosure chevron */
  content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-top: 2px solid var(--faint); border-right: 2px solid var(--faint); transform: rotate(45deg);
}
a.tile:active { background: var(--highlight); }
.tile.accent { background: var(--accent-soft); }
.stack > .tile.accent { background: var(--accent-soft); }
.tile.warn:not(.stack > .tile) { background: var(--warn-soft); }
.tile .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tile .title { font-weight: 600; font-size: 1.0625rem; }
.tile .line { color: var(--muted); font-size: 0.9375rem; margin-top: 2px; }
.tile.accent .line { color: var(--text); }
.tile .who { font-size: 0.9375rem; color: var(--muted); white-space: nowrap; }
.tile.big { padding-top: 16px; padding-bottom: 16px; }
.tile.big .title { font-size: 1.5rem; font-weight: 700; letter-spacing: 0; }
.eyebrow { font-size: 0.8125rem; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.tile.accent .eyebrow { color: var(--accent); font-weight: 600; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }

.progress { height: 4px; border-radius: 99px; background: var(--fill-strong); overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.progress.done > span { background: var(--good-fill); }
/* Width steps (inline styles are blocked by the CSP). */
.w0 { width: 0; } .w5 { width: 5%; } .w10 { width: 10%; } .w15 { width: 15%; } .w20 { width: 20%; } .w25 { width: 25%; }
.w30 { width: 30%; } .w35 { width: 35%; } .w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w55 { width: 55%; }
.w60 { width: 60%; } .w65 { width: 65%; } .w70 { width: 70%; } .w75 { width: 75%; } .w80 { width: 80%; } .w85 { width: 85%; }
.w90 { width: 90%; } .w95 { width: 95%; } .w100 { width: 100%; }

.badge {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 3px 8px; border-radius: 999px;
  background: var(--fill); color: var(--muted); white-space: nowrap; letter-spacing: 0;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- segmented control ---------- */
.seg {
  display: flex; padding: 2px; margin: 4px 0 12px; border-radius: 9px; background: var(--fill);
  overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg a, .seg button {
  flex: 1 1 0; min-width: max-content; text-align: center; padding: 6px 14px; border-radius: 7px;
  color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 500; border: 0; background: none;
}
.seg a.on, .seg button.on { background: var(--seg-on); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 0;
  background: var(--fill); color: var(--accent); font: inherit; font-size: 1.0625rem; font-weight: 600;
  cursor: pointer; text-align: center; letter-spacing: -0.01em;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { color: var(--bad); }
.btn.block { width: 100%; min-height: 50px; border-radius: 14px; }
.btn.small { min-height: 32px; padding: 5px 14px; font-size: 0.9375rem; border-radius: 999px; }
.btn:active { opacity: 0.6; }
.btn:disabled { opacity: 0.4; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row.centered { justify-content: center; }
.btn-row form { margin: 0; }

/* ---------- forms ---------- */
form.card-form, .panel {
  background: var(--surface); border-radius: var(--radius); padding: var(--gutter);
}
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; align-content: start; }
.field label, .label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.field .hint, .hint { font-size: 0.8125rem; color: var(--muted); }
input[type=text], input[type=tel], input[type=number], input[type=date], input[type=search], input[type=file], input:not([type]), select, textarea {
  width: 100%; min-width: 0; min-height: 44px; margin: 0;
  font: inherit; font-size: max(16px, 1rem);  /* 16px+ stops iOS zooming in on focus */
  color: var(--text); background: var(--fill); border: 0; border-radius: 10px; padding: 10px 12px;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type=date] { display: block; line-height: 1.4; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
input[type=date]::-webkit-calendar-picker-indicator { opacity: 0.6; }
input[type=file] { padding: 10px; font-size: 0.9375rem; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; color: var(--accent); background: var(--surface); border: 0;
  border-radius: 8px; padding: 6px 12px; margin-right: 10px;
}
select { background-image: var(--chev); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
textarea { min-height: 88px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
fieldset { border: 0; padding: 0; margin: 4px 0 8px; min-width: 0; }
legend { font-size: 1.0625rem; font-weight: 600; margin-bottom: 10px; padding: 0; }
.secure-box { border-radius: 12px; padding: 14px; margin: 6px 0 16px; background: var(--accent-soft); }
.secure-box legend { float: left; width: 100%; margin-bottom: 6px; }
.secure-box legend + * { clear: both; }
.secure-box input { background: var(--surface); }
.secure-box .hint { color: var(--text); opacity: 0.75; }
.secure-box [data-scan] { margin: 4px 0 6px; background: var(--surface); }
.scan-hint { margin-top: 6px; }
.picker { margin-bottom: 16px; }
.picker-list:empty { display: none; }
.picker-list, #picker-chosen { --chip-w: 104px; }  /* big enough to recognise the card */
.picker-list { background: var(--fill); }
.picker-list .chip, #picker-chosen .chip { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18); }
#picker-chosen .chip:not([src]) { display: none; }
.picker-list > button.tile { width: 100%; text-align: left; font: inherit; border: 0; cursor: pointer; color: var(--text); padding-right: 16px; }
.picker-list > button.tile:active { background: var(--highlight); }
.picker-list .tag { font-size: 0.75rem; font-weight: 600; color: var(--accent); margin-left: 6px; }
@media (hover: hover) and (pointer: fine) { .picker-list > button.tile:hover { background: var(--fill-strong); } }
.inline-form { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.inline-form input, .inline-form select { flex: 1; min-height: 36px; padding-top: 7px; padding-bottom: 7px; }

/* iOS switches for checkboxes, filled circles for radios */
.check { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 1rem; min-height: 44px; margin-bottom: 4px; }
.check input[type=checkbox] { order: 2; }
.check input[type=checkbox], .check input[type=radio] { -webkit-appearance: none; appearance: none; margin: 0; flex: none; cursor: pointer; }
.check input[type=checkbox] {
  width: 51px; height: 31px; border-radius: 999px; background: var(--fill-strong); position: relative;
  transition: background 0.2s ease;
}
.check input[type=checkbox]::before {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 1px 1px rgba(0, 0, 0, 0.16); transition: transform 0.2s ease;
}
.check input[type=checkbox]:checked { background: var(--good-fill); }
.check input[type=checkbox]:checked::before { transform: translateX(20px); }
.check:has(input[type=radio]) { justify-content: flex-start; }
.check input[type=radio] { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--faint); }
.check input[type=radio]:checked { border: 7px solid var(--accent); }

.notice { border-radius: 12px; padding: 11px 14px; font-size: 0.9375rem; margin: 10px 0; }
.notice.error { background: var(--bad-soft); color: var(--bad); }
.notice.ok { background: var(--good-soft); color: var(--good); }
.notice.info { background: var(--accent-soft); color: var(--text); }

/* ---------- detail ---------- */
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; font-size: 1rem; }
.kv dt, .kv dd { padding: 10px 0; border-top: 0.5px solid var(--line); margin: 0; }
.kv dt:first-of-type, .kv dd:first-of-type { border-top: 0; padding-top: 0; }
.kv dt { color: var(--text); }
.kv dd { text-align: right; color: var(--muted); }
.panel:has(> .kv) { padding-bottom: 10px; }
.hero { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; align-items: center; padding: 6px 0 2px; }
.hero h1 { font-size: 1.75rem; }
.hero .card-art { width: 112px; padding: 8px 10px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16); }
.hero .ca-top { font-size: 0.6875rem; }
.hero .ca-bottom { font-size: 0.5625rem; }
.hero .sub { color: var(--muted); margin-top: 4px; }
details.more { margin-top: 10px; }
details.more > summary {
  cursor: pointer; color: var(--accent); font-weight: 500; font-size: 1rem; list-style: none;
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after {
  content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px); transition: transform 0.2s ease;
}
details.more[open] > summary::after { transform: rotate(225deg) translateY(-2px); }
.history { font-size: 0.875rem; color: var(--muted); display: grid; gap: 8px; }
.history b { color: var(--text); font-weight: 600; }

.count-big { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.count-big small { font-size: 1.0625rem; color: var(--muted); font-weight: 500; }
.count-big.over { color: var(--bad); }
table.simple { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
table.simple td, table.simple th { padding: 9px 6px; border-bottom: 0.5px solid var(--line); text-align: left; vertical-align: middle; }
table.simple tr:last-child td { border-bottom: 0; }
table.simple th { color: var(--muted); font-weight: 500; font-size: 0.8125rem; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- sheets ---------- */
dialog {
  border: 0; padding: 0; color: var(--text); background: var(--surface-raised);
  width: min(440px, calc(100vw - 32px)); border-radius: 16px; box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.dialog-body { padding: 20px; }
.grabber { display: none; width: 36px; height: 5px; border-radius: 3px; background: var(--fill-strong); margin: -8px auto 12px; }
@media (max-width: 599px) { .grabber { display: block; } }
@media (max-width: 599px) {
  /* Bottom sheet on iPhone */
  dialog {
    width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
  dialog[open] { animation: sheet-up 0.32s cubic-bezier(0.2, 0.9, 0.3, 1); }
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.secret-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 0.5px solid var(--line); }
.secret-row:last-of-type { border-bottom: 0; }
.secret-row .label { font-size: 0.8125rem; }
.secret-row .value { font-size: 1.25rem; font-weight: 600; letter-spacing: 0.02em; user-select: all; -webkit-user-select: all; }
.code-box {
  font: 600 1.25rem/1.5 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; text-align: center;
  padding: 16px; border-radius: 12px; background: var(--fill); word-break: break-all; margin: 12px 0;
  user-select: all; -webkit-user-select: all;
}
.qr-wrap { display: flex; justify-content: center; margin: 12px 0 4px; }
.qr { border-radius: 14px; background: #fff; padding: 8px; }

.login { min-height: 82dvh; display: grid; place-items: center; text-align: center; padding-top: env(safe-area-inset-top); }
.login > div { width: min(360px, 100%); }
.login .logo { width: 88px; height: 88px; border-radius: 20px; margin: 0 auto 18px; display: block; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }

/* ---------- card pictures ---------- */
/* Colours only (no logos): a few famous designs by name, otherwise the bank's colour. Set in churn.card_theme. */
.btn svg { width: 1em; height: 1em; flex: none; }
.chip, .card-art { --art: linear-gradient(135deg, #7d7be8, #4340b0); --ink: #ffffff; }
.t-platinum { --art: linear-gradient(135deg, #f3f4f6 0%, #cfd2d8 55%, #a8acb4 100%); --ink: #1d1d1f; }
.t-gold { --art: linear-gradient(135deg, #f2d891 0%, #d4ab52 55%, #a97f2b 100%); --ink: #2b1f05; }
.t-rose { --art: linear-gradient(135deg, #f4cdbd, #c98a76); --ink: #3a1d12; }
.t-green { --art: linear-gradient(135deg, #7fae88, #3d6948); }
.t-black { --art: linear-gradient(135deg, #505056, #121214); }
.t-navy { --art: linear-gradient(135deg, #305596, #0e2250); }
.t-ink { --art: linear-gradient(135deg, #52627a, #1e2836); }
.t-slate { --art: linear-gradient(135deg, #737a87, #343a46); }
.t-chase { --art: linear-gradient(135deg, #3279dc, #0f3f8f); }
.t-amex { --art: linear-gradient(135deg, #5fa8e3, #1f62a8); }
.t-citi { --art: linear-gradient(135deg, #339ad9, #0a3f72); }
.t-capone { --art: linear-gradient(135deg, #2c6189, #0d2a42); }
.t-red { --art: linear-gradient(135deg, #e85a50, #a01f24); }
.t-orange { --art: linear-gradient(135deg, #ffa05a, #e2631f); }
.t-cyan { --art: linear-gradient(135deg, #43c7f0, #0a7fbf); }

.chip {
  display: block; flex: none; position: relative; width: var(--chip-w); height: calc(var(--chip-w) / 1.586);
  border-radius: calc(var(--chip-w) / 9); background: var(--art);
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.14), 0 1px 2px rgba(0, 0, 0, 0.14);
}
.chip::after {
  content: ""; position: absolute; left: 12%; bottom: 16%; width: 32%; height: 9%; border-radius: 2px;
  background: var(--ink); opacity: 0.55;
}
.card-art {
  position: relative; overflow: hidden; width: 100%; aspect-ratio: 1.586; border-radius: 14px; padding: 14px 16px;
  display: flex; flex-direction: column; background: var(--art); color: var(--ink);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.2), inset 0 0 0 0.5px rgba(255, 255, 255, 0.25);
  letter-spacing: 0; user-select: none; -webkit-user-select: none;
}
.card-art::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.24) 0%, rgba(255, 255, 255, 0) 42%);
}
.ca-top { font-weight: 700; font-size: 0.9375rem; }
.ca-name { margin-top: auto; margin-bottom: 6px; font-weight: 600; font-size: 1.0625rem; line-height: 1.2; }
.ca-bottom { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; font-size: 0.8125rem; font-weight: 600; }
.ca-name + .ca-bottom { margin-top: 0; }
.ca-num { letter-spacing: 0.08em; font-variant-numeric: tabular-nums; }
.ca-net { font-style: italic; font-weight: 800; text-transform: uppercase; opacity: 0.9; }

/* A photo of the card replaces the coloured picture. */
.chip.photo { object-fit: cover; background: var(--fill); }
.card-art.photo { background: var(--fill); }
.card-art.photo::before { display: none; }
.card-art.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Photo editor sheet */
.photo-dialog { width: min(560px, calc(100vw - 32px)); }
.photo-canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 640 / 404; margin-top: 12px; border-radius: 14px;
  background: #1c1c1e; touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none;
}
.photo-canvas:active { cursor: grabbing; }
.photo-canvas.painting { cursor: crosshair; }
.photo-tools { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.photo-tools input[type=range] { flex: 1; accent-color: var(--accent); }
.photo-confirm { margin-top: 6px; }

/* Rows with a card picture: the separator starts at the text, like iOS lists with icons. */
.tile.with-chip { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.stack > .tile.with-chip + .tile.with-chip::before, .stack > .card-row + .card-row::before { left: calc(var(--gutter) + var(--chip-w) + 12px); }

/* ---------- Cards list ---------- */
.toolbar { display: grid; gap: 10px; margin: 4px 0 6px; }
.toolbar .seg { margin: 0; }
input.search {
  min-height: 38px; padding: 8px 12px 8px 34px; border-radius: 10px;
  background: var(--fill) no-repeat 11px center / 16px 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='M20 20l-4.6-4.6'/%3E%3C/svg%3E");
}
input.search::-webkit-search-cancel-button { opacity: 0.6; }
.card-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.cr-main { display: grid; min-width: 0; }

.cr-who { color: var(--muted); font-size: 0.9375rem; white-space: nowrap; }
.cr-head, .cr-fee, .cr-opened, .cr-status { display: none; }
.card-row .cr-status:has(.progress) { display: block; grid-column: 2 / -1; }
.card-row .cr-status:has(.progress) .line { display: none; }
.card-row .cr-status .progress { margin-top: 8px; }
@media (max-width: 1179px) { .narrow-hide { display: none; } }

/* ---------- Pay with ---------- */
.pay-hero { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 4px 14px; align-items: center; }
.pay-hero .card-art { padding: 8px 10px; border-radius: 9px; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
.pay-hero .ca-top { font-size: 0.6875rem; }
.pay-hero .ca-bottom { font-size: 0.5625rem; }
.tile.big.pay-hero .pay-head .title { font-size: 1.3125rem; }
.pay-head, .pay-info { min-width: 0; }
.pay-info { grid-column: 1 / -1; margin-top: 8px; }
@media (min-width: 600px) {
  .pay-hero { grid-template-columns: 220px minmax(0, 1fr); gap: 0 20px; align-items: start; }
  .pay-hero .card-art { grid-row: span 2; padding: 14px 16px; border-radius: 13px; }
  .pay-hero .ca-top { font-size: 0.9375rem; }
  .pay-hero .ca-bottom { font-size: 0.75rem; }
  .tile.big.pay-hero .pay-head .title { font-size: 1.5rem; }
  .pay-info { grid-column: 2; }
}
.spend-box { background: var(--surface); border-radius: var(--radius); padding: 12px var(--gutter) 14px; margin-top: 10px; }
.spend-box > label { font-size: 0.9375rem; font-weight: 600; }
.spend-box .inline-form { margin-top: 8px; }

/* ---------- purchases and travel ---------- */
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
.muted-title { font-weight: 400; color: var(--muted); }
.spend-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: 8px; }
.purchase-form .field { margin-bottom: 10px; }
.purchase-form .btn.block { min-height: 44px; }
.purchase-form.panel { padding-bottom: var(--gutter); }
a.points-link { display: block; color: var(--text); }
a.points-link .stack-row { min-height: 0; padding-top: 10px; padding-bottom: 10px; }
.link-text { color: var(--accent); font-weight: 500; }
.chev { width: 8px; height: 8px; border-top: 2px solid var(--faint); border-right: 2px solid var(--faint); transform: rotate(45deg); margin-right: 4px; }
@media (hover: hover) and (pointer: fine) { a.points-link:hover { background: var(--fill); } }

.btn-link { border: 0; background: none; padding: 4px 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link.tiny { font-size: 0.8125rem; }
.tag-bfmr { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em; color: var(--accent); }
ol.steps { padding-left: 1.2rem; margin: 6px 0 0; }
ol.steps li { margin-bottom: 4px; }
input[type=password] { width: 100%; min-width: 0; min-height: 44px; margin: 0; font: inherit; font-size: max(16px, 1rem); color: var(--text); background: var(--fill); border: 0; border-radius: 10px; padding: 10px 12px; -webkit-appearance: none; appearance: none; }

/* ---------- confirmation toast ---------- */
.toast {
  position: fixed; z-index: 30; left: 50%; bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: max-content; max-width: min(440px, calc(100vw - 32px));
  padding: 10px 18px; border-radius: 999px; background: var(--toast-bg); color: var(--toast-ink);
  font-size: 0.9375rem; font-weight: 600; text-align: center; box-shadow: var(--shadow); pointer-events: none;
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  animation: toast 3.8s ease forwards;
}
.app.bare ~ .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
@keyframes toast {
  0% { opacity: 0; translate: 0 12px; }
  7% { opacity: 1; translate: 0 0; }
  85% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

/* ---------- pointer devices (Mac) ---------- */
@media (hover: hover) and (pointer: fine) {
  .scan-only { display: none; }  /* Mac Safari has no camera scan; it offers saved cards instead */
  a.tile:hover { background: color-mix(in srgb, var(--surface) 92%, var(--text)); }
  .stack > a.tile:hover { background: var(--fill); }
  .tile.accent:is(a):hover { background: color-mix(in srgb, var(--accent-soft) 80%, var(--accent)); }
  .btn:hover { filter: brightness(1.06); }
  .btn:active { opacity: 0.75; }
  .tabbar a:hover, .seg a:hover { background: var(--fill); }
  details.more > summary:hover, a:hover { opacity: 0.85; }
}

/* Mac and wide windows: the tab bar becomes a sidebar, like a macOS source list. */
@media (min-width: 900px) {
  .tabbar {
    left: 0; top: 0; bottom: 0; transform: none; width: 232px; border-radius: 0; box-shadow: none;
    border: 0; border-right: 0.5px solid var(--line); padding-top: 64px;
  }
  .tabbar::before { content: "CardKeeper"; position: absolute; top: 22px; left: 22px; font-weight: 700; font-size: 1.0625rem; }
  .tabbar nav { display: flex; flex-direction: column; height: auto; gap: 2px; padding: 0 10px; }
  .tabbar a { flex-direction: row; justify-content: flex-start; gap: 10px; padding: 7px 12px; border-radius: 8px; font-size: 0.9375rem; color: var(--text); }
  .tabbar a svg { width: 20px; height: 20px; color: var(--accent); }
  .tabbar a.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
  .tabbar a.wide-only { display: flex; margin-top: 12px; }
  .hide-wide { display: none !important; }
  .show-wide { display: inline-flex !important; }
  body:has(.tabbar) .app { margin-left: 232px; padding: 0 40px 56px; }
  .topbar { padding-top: 2rem; }
  .navrow { padding-top: 1rem; }
  .seg { max-width: 460px; }
  .tabbar a.sidebar-add {
    margin: 18px 10px 0; padding: 8px 12px; gap: 8px; border-radius: 8px;
    background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 0.9375rem;
  }
  .tabbar a.sidebar-add svg { width: 16px; height: 16px; color: var(--accent-ink); }
  .sidebar-user { display: block; position: absolute; left: 22px; bottom: 20px; font-size: 0.8125rem; color: var(--muted); }
  .hero { grid-template-columns: 184px minmax(0, 1fr); gap: 22px; }
  .hero .card-art { width: 184px; padding: 12px 14px; border-radius: 11px; }
  .hero .ca-top { font-size: 0.8125rem; }
  .hero .ca-bottom { font-size: 0.6875rem; }
  .toast { left: calc(50% + 116px); bottom: 28px; }
}

/* Big Mac windows: main screens split into two columns, and the card list becomes a table. */
@media (min-width: 1180px) {
  .cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col.sticky { position: sticky; top: 20px; }
  .cols > .col > h2:first-child { margin-top: 1.3rem; }
  .form-page .cols { gap: 0 32px; }

  .toolbar { grid-template-columns: auto minmax(220px, 340px) 1fr; align-items: center; }
  .toolbar .btn { justify-self: end; }
  .card-table { --cr-cols: var(--chip-w) minmax(0, 2.3fr) minmax(64px, 0.7fr) minmax(0, 1.7fr) 92px 110px; }
  .card-row, .cr-head { grid-template-columns: var(--cr-cols); }
  .cr-head {
    display: grid; column-gap: 12px; padding: 9px 34px 7px var(--gutter);
    font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em;
    border-bottom: 0.5px solid var(--line);
  }
  .cr-status, .cr-fee, .cr-opened { display: block; font-size: 0.9375rem; color: var(--muted); }
  .card-row .cr-status:has(.progress) { grid-column: auto; }
  .card-row .cr-status:has(.progress) .line { display: block; }
  .card-row .cr-status .line { margin: 0; }
  .card-row .cr-status .progress { margin-top: 6px; }
  .wide-only-inline { display: inline; }
  .narrow-only { display: none; }
  .cr-main .title, .cr-main .line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- shared list pieces ---------- */
.stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 4px;
  background: var(--surface); border-radius: var(--radius); overflow: hidden;
}
.stat { padding: 12px var(--gutter) 13px; min-width: 0; }
.stat + .stat { border-left: 0.5px solid var(--line); }
.stat .label { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-num { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin: 1px 0 2px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) {
  .stat { padding: 10px 12px 11px; }
  .stat-num { font-size: 1.1875rem; }
  .stat .label, .stat-sub { font-size: 0.75rem; }
}
.bad-text { color: var(--bad); }
.num, .amt { font-variant-numeric: tabular-nums; }
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
h2 .h2-aside, .h2-aside { text-transform: none; letter-spacing: 0; font-size: 0.8125rem; color: var(--muted); }
h2.split, h3.split { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
h3.group-head { font-size: 0.8125rem; font-weight: 600; color: var(--muted); margin: 1.1rem var(--gutter) 0.4rem; }
.footnote { font-size: 0.8125rem; color: var(--muted); margin-top: 8px; }

/* Rows that read like a statement: what, then amount on the right. Tapping opens their sheet. */
.purchase-row, .booking-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }
.purchase-row.with-chip { grid-template-columns: auto minmax(0, 1fr) auto; }
.pr-main { min-width: 0; }
.pr-main .title { font-size: 1rem; font-weight: 600; }
.pr-end { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.pr-end .amt { font-size: 1rem; font-weight: 600; white-space: nowrap; }
.amt-sub { font-size: 0.8125rem; white-space: nowrap; max-width: 9.5em; overflow: hidden; text-overflow: ellipsis; }
.pr-paid { margin: 2px 0 0; }
.pr-paid .btn.small { min-height: 28px; padding: 3px 12px; font-size: 0.875rem; }
[data-sheet] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[data-sheet]:active { background: var(--highlight); }
[data-sheet]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (hover: hover) and (pointer: fine) { [data-sheet]:hover { background: var(--fill); } }
#row-sheet .dialog-body:focus { outline: none; }
#row-sheet h3 { font-size: 1.25rem; margin-bottom: 4px; }
#row-sheet .inline-form { display: flex; gap: 8px; }
#row-sheet .inline-form input { flex: 1; margin: 0; }

/* BFMR purchases that need a card: one card, a checklist, one button */
.inbox { background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.inbox-top { display: flex; align-items: center; gap: 10px; padding: 12px var(--gutter); border-bottom: 0.5px solid var(--line); }
.inbox-card { font-size: 0.9375rem; color: var(--muted); white-space: nowrap; }
.inbox-select { flex: 1; min-width: 0; margin: 0; min-height: 40px; font-weight: 600; }
.inbox-list { padding: 0 var(--gutter); }
.inbox-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
  min-height: 56px; padding: 8px 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.inbox-item + .inbox-item, .inbox-more { border-top: 0.5px solid var(--line); }
.inbox-item input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.inbox-item:has(input:not(:checked)) .inbox-text, .inbox-item:has(input:not(:checked)) .amt { opacity: 0.45; }
.inbox-item.no-price { cursor: default; }
.inbox-text { display: flex; flex-direction: column; min-width: 0; }
.inbox-title { font-weight: 600; }
.inbox-text .line { font-size: 0.875rem; color: var(--muted); }
.inbox-item .amt { font-weight: 600; white-space: nowrap; }
.inbox-more summary { padding: 10px 0; color: var(--accent); cursor: pointer; font-size: 0.9375rem; }
.inbox-more .inbox-item:first-of-type { border-top: 0.5px solid var(--line); }
.inbox-actions { display: flex; align-items: center; gap: 8px; padding: 12px var(--gutter); border-top: 0.5px solid var(--line); }
.inbox-add { flex: 1; }
.inbox-tip { font-size: 0.8125rem; color: var(--muted); margin: -4px var(--gutter) 12px; }
@media (max-width: 599px) {
  .inbox-top { flex-direction: column; align-items: stretch; gap: 4px; }
  .inbox-card { font-size: 0.8125rem; }
  .inbox-actions { flex-direction: column; align-items: stretch; gap: 2px; }
  .inbox-actions .btn.plain { align-self: center; min-height: 36px; }
}
.inbox-add { white-space: nowrap; }
.btn.plain { background: none; color: var(--muted); padding-left: 8px; padding-right: 8px; }

/* Tiles that lead with a small coloured icon */
.tile.with-icon { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: center; }
.icon-badge { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: #fff; }
.icon-badge svg { width: 19px; height: 19px; }
.icon-badge.warn { background: #ff9500; }

/* Certificates */
.cert-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: center; }

/* Value by program */
.program-row { display: block; }
.progress.thin { height: 3px; margin-top: 7px; }

/* ---------- ID's and Account #'s ---------- */
.locked-panel { text-align: center; padding: 36px 20px 28px; background: var(--surface); border-radius: var(--radius); margin-top: 8px; }
.locked-panel p { max-width: 400px; margin-left: auto; margin-right: auto; }
.lock-disc { width: 64px; height: 64px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.lock-disc svg { width: 30px; height: 30px; }
.locked-title { font-size: 1.375rem; font-weight: 700; color: var(--text); text-transform: none; letter-spacing: 0; margin: 12px 0 6px; }
.btn.wide-btn { min-width: 240px; margin: 6px 0 14px; }
#ids-root.away #ids-open { visibility: hidden; }

.acct-search { position: relative; display: flex; gap: 8px; align-items: center; margin: 4px 0 10px; }
.acct-search-icon { position: absolute; left: 11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.acct-search input[type=search] { flex: 1; min-width: 0; margin: 0; min-height: 44px; padding-left: 36px; font-size: 1.0625rem; border-radius: 12px; }
.btn.acct-add { flex: none; min-height: 44px; padding: 8px 16px; border-radius: 12px; gap: 6px; }
.btn.acct-add svg { width: 16px; height: 16px; }
/* Who: pills that wrap onto another line, so every name stays in sight however many people there are. */
.people-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.people-pills button {
  min-height: 34px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text);
  font: inherit; font-size: 0.9375rem; font-weight: 500; cursor: pointer;
}
.people-pills button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.people-pills button:active { opacity: 0.6; }
@media (hover: hover) and (pointer: fine) { .people-pills button:not(.on):hover { background: var(--fill-strong); } }
.empty-panel { margin-top: 12px; }
.empty-panel h3 { margin-bottom: 6px; }

.id-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -6px 0 0; }
.id-head .title { min-width: 0; }
.edit-btn { color: var(--accent); }
.edit-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.id-vals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.id-val { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 11px 7px; border-radius: 10px;
  border: 0; background: var(--fill); color: var(--text); font: inherit; text-align: left; cursor: pointer; min-height: 44px; }
.id-val:active { background: var(--fill-strong); }
@media (hover: hover) and (pointer: fine) { .id-val:hover { background: var(--fill-strong); } }
.id-who { font-size: 0.75rem; color: var(--muted); }
.id-num { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }

/* One person's numbers: a plain list, tap a line to copy. */
.acct-line { display: flex; align-items: center; gap: 4px; padding-top: 0; padding-bottom: 0; }
.acct-copy { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0;
  border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.acct-copy:active { opacity: 0.55; }
.acct-prog { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-copy svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linejoin: round; }

.nomatch { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.nomatch p { margin: 0; }
.acct-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px 16px; margin: 10px var(--gutter) 0; }
.acct-foot-links { display: flex; gap: 16px; }
.btn-link.small { font-size: 0.9375rem; font-weight: 500; }
.row-values { margin-top: 4px; }
.copy-toast { animation-duration: 1.8s; }
@media (min-width: 600px) { .wide-dialog { width: min(640px, calc(100vw - 32px)); } }
dialog { max-height: calc(100dvh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.wide-dialog textarea { width: 100%; font: inherit; font-size: 0.9375rem; }
.push-right { margin-left: auto; }
.mb { margin-bottom: 14px; }

/* ---------- passports and IDs ---------- */
.h2-btn { text-transform: none; letter-spacing: 0; padding: 0; }
.migrate-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 10px; }
.migrate-panel p { margin: 0; flex: 1 1 260px; }
.cards-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; }
.cards-empty p { flex: 1 1 200px; margin: 0 0 0 8px; }

/* A person's documents, like a wallet */
.idgroup + .idgroup { margin-top: 14px; }
.idgroup-head { display: flex; align-items: center; gap: 10px; margin: 0 var(--gutter) 6px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-size: 0.8125rem; font-weight: 700; }
.idgroup-name { flex: 1; font-weight: 600; }
.idgroup-add { width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: var(--accent); cursor: pointer; display: grid; place-items: center; }
.idgroup-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.idgroup-add:active { background: var(--fill); }

.idrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; column-gap: 12px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; padding-top: 10px; padding-bottom: 10px; }
.idrow:active { background: var(--highlight); }
@media (hover: hover) and (pointer: fine) { .idrow:hover { background: var(--fill); } }
.idrow:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.stack > .idrow + .idrow::before { left: calc(var(--gutter) + 54px + 12px); }
.idrow-main { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.idrow-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; max-width: 100%; }
.idrow-type { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idrow-place { font-size: 0.875rem; color: var(--muted); white-space: nowrap; }
.idrow-num { display: inline-flex; align-items: center; gap: 6px; margin: 1px -6px -2px; padding: 3px 6px; border: 0; border-radius: 7px;
  background: none; color: var(--text); font: inherit; font-size: 0.9375rem; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; cursor: pointer; }
.idrow-num:active { background: var(--fill-strong); }
@media (hover: hover) and (pointer: fine) { .idrow-num:hover { background: var(--fill); } }
.idrow-num svg { width: 14px; height: 14px; fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linejoin: round; }
.idrow-none { font-size: 0.9375rem; color: var(--muted); }
.idrow-end { display: flex; align-items: center; gap: 8px; }
.idrow-exp { font-size: 0.875rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Little drawings of each kind of document, used until there's a photo */
.docart { position: relative; display: inline-block; flex: none; width: 54px; height: 38px; border-radius: 6px; overflow: hidden;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.12); }
.docart.photo { background: var(--fill); }
.docart img { width: 100%; height: 100%; object-fit: cover; display: block; }
.docart.t-passport { width: 30px; height: 40px; margin: 0 12px; border-radius: 4px; background: linear-gradient(160deg, #2a3b78, #141e48); }
.docart.t-passport::before { content: ""; position: absolute; left: 50%; top: 9px; width: 13px; height: 13px; margin-left: -6.5px;
  border: 1.5px solid #d6b56a; border-radius: 50%; box-sizing: border-box; }
.docart.t-passport::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 9px; height: 1.5px; background: #d6b56a; border-radius: 1px; }
.docart.t-passport.photo { width: 54px; height: 38px; margin: 0; border-radius: 6px; }
.docart.t-license, .docart.t-state_id, .docart.t-other { background: linear-gradient(135deg, #eef3fa, #c8d6ea); }
.docart.t-state_id { background: linear-gradient(135deg, #f2eefa, #d6cbea); }
.docart.t-other { background: linear-gradient(135deg, #f1f1f4, #d4d4dc); }
.docart.t-license::before, .docart.t-state_id::before, .docart.t-other::before { content: ""; position: absolute; left: 6px; top: 8px; width: 13px; height: 17px;
  border-radius: 2px; background: #8fa3c0; }
.docart.t-license::after, .docart.t-state_id::after, .docart.t-other::after { content: ""; position: absolute; left: 24px; right: 7px; top: 10px; height: 3px;
  border-radius: 2px; background: #9fb0c8; box-shadow: 0 6px 0 #b6c3d6, 0 12px 0 #b6c3d6; }
.docart.t-global_entry { background: linear-gradient(135deg, #1f7a8c, #0f4c5f); }
.docart.t-global_entry::after { content: "GE"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.04em; }
.docart.t-ktn { background: linear-gradient(135deg, #2f9e5b, #1c6e3d); }
.docart.t-ktn::after { content: "KTN"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.05em; }
.docart.photo::before, .docart.photo::after { display: none; }
@media (prefers-color-scheme: dark) { .docart { box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18); } }

/* The details sheet */
@media (min-width: 600px) { .viewer-dialog { width: min(640px, calc(100vw - 32px)); } }
.idv-head h3 { font-size: 1.25rem; }
.idv-media { display: flex; flex-direction: column; gap: 10px; margin: 12px 0 4px; }
.idv-fig { margin: 0; position: relative; }
.idv-fig img { width: 100%; height: auto; display: block; border-radius: 12px; background: var(--fill); }
.idv-fig img.loading { filter: blur(8px); }
.idv-fig figcaption { position: absolute; left: 8px; bottom: 8px; padding: 2px 9px; border-radius: 99px; font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.55); color: #fff; }
.idv-addphoto { width: 100%; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; align-items: center;
  padding: 14px; border: 1.5px dashed var(--line); border-radius: 12px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.idv-addphoto .docart { grid-row: 1 / 3; }
.idv-addphoto-text { color: var(--accent); font-weight: 600; }
.idv-addphoto-sub { font-size: 0.8125rem; color: var(--muted); }
.idv-fields { background: var(--fill); border-radius: 12px; padding: 0 14px; margin-top: 10px; }
.idv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; }
.idv-row + .idv-row { border-top: 0.5px solid var(--line); }
.idv-text { display: flex; flex-direction: column; min-width: 0; }
.idv-label { font-size: 0.8125rem; color: var(--muted); }
.idv-value { font-size: 1.0625rem; font-weight: 600; font-variant-numeric: tabular-nums; word-break: break-all; }
.idv-sub { font-size: 0.875rem; color: var(--muted); }
.idv-sub.bad-text { color: var(--bad); }
.idv-sub.warn-text { color: var(--warn); }

/* The editor */
.field .field-label { display: block; font-size: 0.8125rem; color: var(--muted); margin: 0 0 6px 4px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-row button { min-height: 34px; padding: 6px 13px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text);
  font: inherit; font-size: 0.9375rem; font-weight: 500; cursor: pointer; }
.pill-row button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pill-row button:active { opacity: 0.6; }
.idc-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 4px; }
.idc-slot { position: relative; aspect-ratio: 1.42; border-radius: 10px; overflow: hidden; background: var(--fill); }
.idc-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idc-slot-add { position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--accent); cursor: pointer; border: 1.5px dashed var(--line); border-radius: 10px; font: inherit; font-size: 0.9375rem; font-weight: 500;
  background: none; }
.idc-slot-add svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.idc-slot-add.busy { opacity: 0.5; pointer-events: none; }
.idc-slot img + .idc-slot-name { position: absolute; left: 6px; bottom: 6px; padding: 2px 8px; border-radius: 99px; font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.55); color: #fff; }
.idc-slot-remove { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 1.125rem; line-height: 1; }

/* The Add chooser */
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border: 0; border-radius: 12px;
  background: var(--fill); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.choice:active { background: var(--fill-strong); }
.choice-title { font-weight: 600; font-size: 1.0625rem; }
.choice-sub { font-size: 0.875rem; color: var(--muted); }

/* ---------- crop to the document ---------- */
.scan-note { margin: 4px 0 10px; min-height: 1.2em; }
.scan-stage { display: flex; justify-content: center; background: #000; border-radius: 12px; padding: 14px; }
.scan-frame { position: relative; line-height: 0; }
.scan-frame canvas#scan-canvas { display: block; max-width: 100%; }
.scan-overlay { position: absolute; inset: 0; touch-action: none; overflow: visible; cursor: crosshair; }
.scan-shade { fill: rgba(0, 0, 0, 0.5); }
.scan-edge { fill: none; stroke: #0a84ff; stroke-width: 2.5; stroke-linejoin: round; }
.scan-handle { fill: #fff; stroke: #0a84ff; stroke-width: 3; cursor: grab; }
.scan-loupe { position: absolute; top: 8px; left: 8px; width: 120px; height: 120px; border-radius: 50%; border: 3px solid #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45); background: #000; pointer-events: none; }
.scan-loupe.right { left: auto; right: 8px; }

/* ---------- the guided camera: full screen, black, a frame the shape of the document ---------- */
.cam-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; border-radius: 0;
  background: #000; color: #fff; overflow: hidden; }
.cam-dialog[open] { animation: none; }
@media (min-width: 900px) { .cam-dialog { width: min(760px, 92vw); height: min(820px, 92dvh); margin: auto; border-radius: 18px; } }
.cam-body { height: 100%; display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.cam-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.cam-title { font-weight: 600; font-size: 1.0625rem; text-align: center; }
.cam-text { border: 0; background: none; color: #fff; font: inherit; font-size: 1.0625rem; padding: 8px 4px; cursor: pointer; min-width: 64px; }
.cam-spacer { visibility: hidden; }
.cam-stage { position: relative; flex: 1; overflow: hidden; background: #000; }
.cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-still { position: absolute; inset: 16px; width: calc(100% - 32px); height: calc(100% - 32px); object-fit: contain; }
.cam-frame { position: absolute; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55); outline: 2px solid rgba(255, 255, 255, 0.9); }
.cam-c { position: absolute; width: 26px; height: 26px; border: 4px solid #fff; }
.cam-c.tl { left: -6px; top: -6px; border-right: 0; border-bottom: 0; border-top-left-radius: 16px; }
.cam-c.tr { right: -6px; top: -6px; border-left: 0; border-bottom: 0; border-top-right-radius: 16px; }
.cam-c.br { right: -6px; bottom: -6px; border-left: 0; border-top: 0; border-bottom-right-radius: 16px; }
.cam-c.bl { left: -6px; bottom: -6px; border-right: 0; border-top: 0; border-bottom-left-radius: 16px; }
.cam-error { position: absolute; left: 24px; right: 24px; top: 40%; text-align: center; color: #fff; font-size: 1rem; }
.cam-controls { padding: 10px 16px 18px; }
.cam-hint { text-align: center; margin: 0 0 12px; font-size: 0.9375rem; color: rgba(255, 255, 255, 0.85); }
.cam-row { display: flex; align-items: center; justify-content: space-between; }
.cam-shutter { width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; background: #fff; box-shadow: inset 0 0 0 3px #000; cursor: pointer; }
.cam-shutter:active { transform: scale(0.94); }
.cam-shutter:disabled { opacity: 0.4; }
.cam-dialog[data-mode="error"] .cam-shutter { visibility: hidden; }
.cam-library { color: #fff; }
.cam-dialog[data-mode="error"] .cam-library { font-weight: 600; color: #0a84ff; }
.btn.cam-use { min-width: 150px; border-radius: 999px; }

/* ---------- ID's and Account #'s: sections, and insurance, medical, cars, documents (records.js) ---------- */
.rec-art { display: inline-grid; place-items: center; color: #fff; }
.rec-art svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rec-art.s-insurance { background: linear-gradient(135deg, #3a8dde, #1f5fae); }
.rec-art.s-medical { background: linear-gradient(135deg, #ff5a5f, #d42a3a); }
.rec-art.s-vehicles { background: linear-gradient(135deg, #8e8e93, #545458); }
.rec-art.s-documents { background: linear-gradient(135deg, #c9a46a, #9a7438); }
.rec-art.photo { background: var(--fill); }
.rec-initial { font-weight: 700; font-size: 1.0625rem; }
.rec-alert { font-size: 0.9375rem; color: var(--bad); font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-row .idrow-none { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rec-empty { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.rec-empty p { flex: 1 1 200px; margin: 0; }
.idc-photos.pages { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.idc-slot.portrait { aspect-ratio: 0.77; }
.idc-slot.pdf, .idc-slot-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.idc-slot.pdf svg, .idc-slot-add svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.idc-slot.pdf { color: var(--muted); }
.idc-slot-file { position: absolute; inset: auto 6px 8px; font-size: 0.75rem; color: var(--muted); text-align: center; word-break: break-word; }
.idc-slot.pdf .idc-slot-file { position: static; padding: 0 6px; }
label.idc-slot-add { margin: 0; }

.idv-row.alert .idv-value { color: var(--bad); }
.idv-value.multiline { white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere; font-weight: 500; }
.idv-btns { display: flex; gap: 6px; flex: none; }
.idv-h { margin: 16px 4px 6px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; }
.rec-cover-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: 0; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.rec-cover-open .idv-value { color: var(--accent); }
.rec-pdf { width: 100%; display: flex; align-items: center; gap: 12px; padding: 14px; border: 0; border-radius: 12px; background: var(--fill);
  color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.rec-pdf svg { width: 26px; height: 26px; flex: none; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linejoin: round; }
.rec-pdf-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-pdf-open { color: var(--accent); font-weight: 600; }
.rec-log-none { margin: 0 4px 8px; }
.rec-log .idv-fields { margin-top: 0; margin-bottom: 8px; }
.rec-log-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rec-log-form .grid2 { gap: 8px; }
.danger-text { color: var(--bad); }
#rec-fields textarea { min-height: 2.8em; resize: vertical; }
.rec-row .idrow-type { flex: none; max-width: 100%; }
.rec-row .idrow-place { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- ID's and Account #'s: home (categories and people), then one screen each ---------- */
.v-back { border: 0; background: none; color: var(--accent); font: inherit; font-size: 1.0625rem; cursor: pointer; padding-left: 0; }
.cat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 2px 0 6px; }
@media (min-width: 760px) { .cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cat-tile { display: flex; flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; padding: 11px 12px 11px 11px;
  border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.cat-tile:active { background: var(--highlight); }
@media (hover: hover) and (pointer: fine) { .cat-tile:hover { background: var(--fill); } }
.cat-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.cat-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.cat-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat-icon.c-ids { background: #3d4f95; }
.cat-icon.c-loyalty { background: #8a54e8; }
.cat-icon.c-insurance { background: #2f7fd6; }
.cat-icon.c-medical { background: #ff3b30; }
.cat-icon.c-vehicles { background: #7c7c82; }
.cat-icon.c-documents { background: #b88a45; }
.cat-count { font-size: 1.625rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cat-count.zero { color: var(--faint); }
.cat-title { font-weight: 600; font-size: 0.9375rem; color: var(--muted); line-height: 1.2; }
.cat-note { margin-top: -3px; font-size: 0.8125rem; font-weight: 500; color: var(--warn); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.person-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; padding: 12px 4px 10px; border: 0;
  border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 0.9375rem; font-weight: 500; cursor: pointer; }
.person-tile:active { background: var(--highlight); }
@media (hover: hover) and (pointer: fine) { .person-tile:hover { background: var(--fill); } }
.pav { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 1.125rem; }
.pav.a0 { background: #ff9f0a; } .pav.a1 { background: #30b0c7; } .pav.a2 { background: #af52de; }
.pav.a3 { background: #34c759; } .pav.a4 { background: #ff375f; } .pav.a5 { background: #5e5ce6; }
.pname { max-width: 100%; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Beside photo slots, a PDF is the other way in: a slim row, not another big slot. */
.idc-slot.pdf-add:not(.portrait) { grid-column: 1 / -1; aspect-ratio: auto; min-height: 50px; }
.idc-slot.pdf-add:not(.portrait) .idc-slot-add { flex-direction: row; gap: 8px; font-size: 0.9375rem; }
.idc-slot.pdf-add:not(.portrait) .idc-slot-add svg { width: 20px; height: 20px; }

/* a computer that signed in with a QR code from a phone: the vault stays locked there */
.borrowed-note { max-width: 34ch; margin: 0.25rem auto 0.5rem; padding: 0.75rem 1rem; border-radius: 12px; background: var(--fill, rgba(120, 120, 128, 0.12)); font-size: 0.9375rem; line-height: 1.35; }
