/* MyWarranty — mobile-first, tuned for iPhone Safari (safe areas, 16px+ inputs, 44pt targets, dvh). */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --bg: #f2f5f7;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --text: #0c1b24;
  --muted: #4a5e6a;
  --line: #e0e7ec;
  --line-strong: #c3cfd7;
  --field-border: #7d909c;
  --shadow: 0 1px 2px rgba(12, 27, 36, .05), 0 6px 20px rgba(12, 27, 36, .06);

  --brand: #0a766e;
  --brand-hover: #086059;
  --brand-text: #08665f;
  --brand-soft: #ddf4f0;
  --on-brand: #ffffff;
  --focus: rgba(10, 118, 110, .35);
  --hero-1: #0a6b66;
  --hero-2: #0a5a76;
  --hero-3: #083c5a;

  --ok-bg: #dff4e8;   --ok-fg: #0b5d2e;
  --warn-bg: #ffefcf; --warn-fg: #7a4200;
  --bad-bg: #fde3df;  --bad-fg: #9b1c13;
  --none-bg: #e6ecf0; --none-fg: #3d5260;

  --radius: 18px;
  --radius-sm: 14px;
  --tab-h: 58px;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #091216;
    --surface: #101c22;
    --surface-2: #14252c;
    --text: #e8f1f4;
    --muted: #9db3bd;
    --line: #1f333c;
    --line-strong: #324a55;
    --field-border: #5f7a88;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);

    --brand: #2fd6c2;
    --brand-hover: #5fe3d3;
    --brand-text: #4fe0cd;
    --brand-soft: #0f3a3a;
    --on-brand: #03201c;
    --focus: rgba(47, 214, 194, .4);
    --hero-1: #0a6560;
    --hero-2: #0a5270;
    --hero-3: #083956;

    --ok-bg: #123b2a;   --ok-fg: #86e6ae;
    --warn-bg: #43300c; --warn-fg: #ffc96b;
    --bad-bg: #4a1914;  --bad-fg: #ffa097;
    --none-bg: #22333c; --none-fg: #b2c5ce;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--brand-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; padding: 10px 14px; background: var(--brand); color: var(--on-brand); border-radius: 10px; }
.skip:focus { top: calc(var(--safe-t) + 8px); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }

.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }

h1 { font-size: 30px; line-height: 1.12; font-weight: 760; letter-spacing: -0.022em; }
h2 { font-size: 20px; line-height: 1.2; font-weight: 720; letter-spacing: -0.012em; }
h3 { font-size: 17px; font-weight: 680; }

/* ---------- app shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.content {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: calc(var(--safe-t) * 0 + 18px) max(var(--gutter), env(safe-area-inset-right)) calc(var(--tab-h) + var(--safe-b) + 28px) max(var(--gutter), env(safe-area-inset-left));
}
.sidebar { display: none; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 0 env(safe-area-inset-right) var(--safe-b) env(safe-area-inset-left);
  background: var(--surface);
  border-top: 1px solid var(--line);
}
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .tabbar { background: color-mix(in srgb, var(--surface) 82%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: var(--tab-h); padding: 6px 2px 4px;
  background: none; border: 0; color: var(--muted);
  font-size: 11px; font-weight: 620; letter-spacing: .01em; text-decoration: none;
}
.tab .i { width: 25px; height: 25px; stroke-width: 1.7; }
.tab[aria-current="page"] { color: var(--brand-text); }
.tab[aria-current="page"] .i { stroke-width: 2.1; }
.tab:active { opacity: .6; }
.tab--add .tab__plus {
  display: grid; place-items: center; width: 54px; height: 54px; margin-top: -24px;
  border-radius: 50%; color: #fff;
  background: linear-gradient(145deg, var(--hero-1), var(--hero-3));
  box-shadow: 0 6px 16px rgba(9, 63, 94, .35), 0 0 0 5px var(--bg);
}
.tab--add .tab__plus .i { width: 26px; height: 26px; stroke-width: 2.3; }
.tab--add { color: var(--muted); }
.tab--add span:last-child { margin-top: -2px; }
.is-form .tabbar { display: none; }
.is-form .content { padding-bottom: 24px; }

/* wide screens: sidebar instead of tab bar */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; }
  .tabbar { display: none; }
  .content { max-width: 980px; padding: 40px 40px 56px; }
  .is-form .content { padding-bottom: 56px; }
  .sidebar {
    display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: 24px 16px; background: var(--surface); border-right: 1px solid var(--line);
  }
  .sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text); font-weight: 760; font-size: 20px; letter-spacing: -.02em; }
  .sidebar__brand:hover { text-decoration: none; }
  .sidebar__brand img { width: 34px; height: 34px; }
  .sidebar__brand b { color: var(--brand-text); font-weight: inherit; }
  .side-nav { display: grid; gap: 4px; }
  .side-link { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 12px; color: var(--text); font-weight: 600; }
  .side-link:hover { background: var(--surface-2); text-decoration: none; }
  .side-link[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
  .sidebar__sep { flex: 1; }
  .sidebar .btn { margin: 6px 4px 10px; }
}

/* ---------- page head ---------- */
.page-head { margin-bottom: 18px; }
.page-head__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head__actions { display: flex; gap: 8px; flex: none; }
.lead { margin-top: 6px; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -8px 0 2px -6px; padding: 0 8px 0 2px; font-weight: 600; color: var(--brand-text); }
.back .i { width: 1.4em; height: 1.4em; }

/* ---------- cards & lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card--pad { padding: 18px; }
.stack > * + * { margin-top: 16px; }
.section { margin-top: 28px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.section__head .link { font-weight: 600; font-size: 15px; }

.list { overflow: hidden; }
.item {
  display: flex; align-items: center; gap: 14px; min-height: 68px; padding: 12px 16px;
  color: var(--text); text-decoration: none; background: transparent;
}
a.item:hover { text-decoration: none; background: var(--surface-2); }
a.item:active { background: var(--surface-2); }
.item + .item { border-top: 1px solid var(--line); }
.item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item__title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__meta { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__end { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; flex: none; }
.item__sub { font-size: 13px; color: var(--muted); }
.item__chev { color: var(--line-strong); margin-left: -4px; }
.item__amount { font-weight: 720; font-variant-numeric: tabular-nums; }

.avatar {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px;
  background: var(--tone-bg, var(--brand-soft)); color: var(--tone-fg, var(--brand-text));
}
.avatar .i { width: 24px; height: 24px; }
.avatar--lg { width: 62px; height: 62px; border-radius: 19px; }
.avatar--lg .i { width: 32px; height: 32px; }
.avatar--brand { border-radius: 50%; color: #fff; font-weight: 760; font-size: 19px; background: #3f5b6b; }

.tone-teal   { --tone-bg: #dcf4ef; --tone-fg: #08665f; }
.tone-blue   { --tone-bg: #e1ecfb; --tone-fg: #1b4aa0; }
.tone-violet { --tone-bg: #ece6fa; --tone-fg: #573bad; }
.tone-amber  { --tone-bg: #ffefd0; --tone-fg: #874800; }
.tone-rose   { --tone-bg: #fce4ea; --tone-fg: #a02548; }
.tone-slate  { --tone-bg: #e7edf1; --tone-fg: #3b4e5c; }
@media (prefers-color-scheme: dark) {
  .tone-teal   { --tone-bg: #123e3c; --tone-fg: #6fe6d6; }
  .tone-blue   { --tone-bg: #14304f; --tone-fg: #9cc4ff; }
  .tone-violet { --tone-bg: #2a2150; --tone-fg: #c4b2ff; }
  .tone-amber  { --tone-bg: #46310b; --tone-fg: #ffc874; }
  .tone-rose   { --tone-bg: #4a1a28; --tone-fg: #ffa5bc; }
  .tone-slate  { --tone-bg: #22323b; --tone-fg: #b5c8d2; }
}

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 13px; font-weight: 680; line-height: 1.5; white-space: nowrap; }
.chip .i { width: 14px; height: 14px; stroke-width: 2.2; }
.chip--active   { background: var(--ok-bg);   color: var(--ok-fg); }
.chip--expiring { background: var(--warn-bg); color: var(--warn-fg); }
.chip--expired  { background: var(--bad-bg);  color: var(--bad-fg); }
.chip--none     { background: var(--none-bg); color: var(--none-fg); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px; border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-size: 17px; font-weight: 670; line-height: 1.1; text-align: center; text-decoration: none; cursor: pointer;
  background: var(--brand); color: var(--on-brand);
  transition: transform .08s ease, background-color .15s ease, opacity .15s ease;
}
.btn:hover { background: var(--brand-hover); text-decoration: none; }
.btn:active { transform: scale(.975); }
.btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .55; pointer-events: none; }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--field-border); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--soft { background: var(--brand-soft); color: var(--brand-text); }
.btn--soft:hover { background: var(--brand-soft); filter: brightness(.97); }
.btn--ghost { background: transparent; color: var(--brand-text); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { background: transparent; color: var(--bad-fg); border-color: color-mix(in srgb, var(--bad-fg) 45%, transparent); }
.btn--danger:hover { background: var(--bad-bg); }
.btn--sm { min-height: 44px; padding: 0 16px; font-size: 16px; }
.btn--block { display: flex; width: 100%; }
.btn .i { width: 1.2em; height: 1.2em; stroke-width: 2; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-row > .btn { flex: 1 1 180px; }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; }
.form-card { padding: 18px; display: grid; gap: 18px; }
.form-card > h2 { margin-bottom: -6px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label { font-size: 15px; font-weight: 650; }
.field .opt { margin-left: 6px; color: var(--muted); font-weight: 500; font-size: 13px; }
.field input:not([type="checkbox"]):not([type="file"]):not([type="hidden"]), .field select, .field textarea {
  width: 100%; min-height: 52px; padding: 12px 14px;
  background: var(--surface); color: var(--text);
  border: 1.5px solid var(--field-border); border-radius: var(--radius-sm);
  font-size: 17px; line-height: 1.3;
  -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 1; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.field input[type="date"] { display: block; text-align: left; min-width: 0; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.select { position: relative; }
.select select { padding-right: 44px; }
.select__chev { position: absolute; right: 14px; top: 50%; margin-top: -0.625em; pointer-events: none; color: var(--muted); }
.field__hint { font-size: 14px; color: var(--muted); }
.field__error { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; font-weight: 600; color: var(--bad-fg); }
.field__error .i { margin-top: 2px; width: 1.1em; height: 1.1em; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--bad-fg); }
.field-row { display: grid; gap: 18px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }

.check { display: flex; align-items: flex-start; gap: 12px; min-height: 44px; padding: 4px 0; font-size: 16px; }
.check input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--brand); }
.check.has-error { color: var(--bad-fg); }

.actions-bar {
  position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px;
  margin: 8px calc(var(--gutter) * -1) 0; padding: 12px var(--gutter) calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.actions-bar .btn { flex: 1; }
.actions-bar .btn--secondary { flex: 0 0 auto; }
@media (min-width: 900px) { .actions-bar { position: static; margin: 8px 0 0; padding: 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; } .actions-bar .btn { flex: 0 0 auto; min-width: 180px; } }

/* ---------- flash ---------- */
.flash { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; padding: 13px 14px; border-radius: var(--radius-sm); font-weight: 600; font-size: 16px; line-height: 1.35; }
.flash .i { margin-top: 1px; }
.flash--success { background: var(--ok-bg); color: var(--ok-fg); }
.flash--warn { background: var(--warn-bg); color: var(--warn-fg); }
.flash--error { background: var(--bad-bg); color: var(--bad-fg); }
.flash--info { background: var(--brand-soft); color: var(--brand-text); }

/* ---------- filters ---------- */
.search { position: relative; }
.search .i { position: absolute; left: 14px; top: 50%; margin-top: -0.625em; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 52px; padding: 12px 14px 12px 44px; font-size: 17px;
  background: var(--surface); border: 1.5px solid var(--field-border); border-radius: 16px; -webkit-appearance: none; appearance: none; color: var(--text);
}
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.pills { display: flex; gap: 8px; margin: 14px calc(var(--gutter) * -1) 4px; padding: 2px var(--gutter); overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 16px; scroll-snap-align: start;
  border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); color: var(--text); font-weight: 620; font-size: 15px; white-space: nowrap;
}
.pill:hover { text-decoration: none; background: var(--surface-2); }
.pill[aria-current="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pill__n { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; }
.pill[aria-current="true"] .pill__n { background: rgba(255, 255, 255, .22); color: inherit; }
@media (prefers-color-scheme: dark) { .pill[aria-current="true"] .pill__n { background: rgba(0, 0, 0, .18); } }
.filters { display: grid; gap: 12px; }
.filters__row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters select { min-height: 46px; padding: 0 36px 0 14px; font-size: 16px; background: var(--surface); border: 1.5px solid var(--field-border); border-radius: 14px; -webkit-appearance: none; appearance: none; width: 100%; color: var(--text); }
.filters .select__chev { right: 12px; }

/* ---------- dashboard ---------- */
.hero {
  position: relative; overflow: hidden; padding: 22px 20px 20px; border-radius: 26px; color: #fff;
  background: linear-gradient(140deg, var(--hero-1) 0%, var(--hero-2) 58%, var(--hero-3) 100%);
  box-shadow: 0 10px 28px rgba(9, 63, 94, .28);
}
.hero::after { content: ""; position: absolute; right: -34px; top: -26px; width: 190px; height: 190px; background: url("/assets/logo-mark.svg") no-repeat center / contain; opacity: .1; pointer-events: none; filter: grayscale(1) brightness(3); }
.hero__eyebrow { font-size: 15px; font-weight: 620; opacity: .92; }
.hero__title { margin-top: 2px; font-size: 27px; line-height: 1.15; }
.stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.stat { padding: 12px 12px 11px; border-radius: 16px; background: rgba(255, 255, 255, .12); }
.stat dt { font-size: 13px; line-height: 1.25; font-weight: 600; opacity: .95; min-height: 2.5em; }
.stat dd { margin-top: 4px; font-size: 27px; font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat dd small { font-size: 15px; font-weight: 650; }
.stat--warn { background: rgba(255, 207, 96, .22); }
@media (max-width: 380px) { .stat dd { font-size: 23px; } .stat dt { font-size: 12px; } }

.empty { padding: 34px 22px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty__icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 22px; background: var(--brand-soft); color: var(--brand-text); }
.empty__icon .i { width: 34px; height: 34px; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--muted); max-width: 34ch; }
.empty .btn { margin-top: 8px; }

.steps { display: grid; gap: 12px; counter-reset: s; }
.steps li { position: relative; padding-left: 42px; min-height: 30px; counter-increment: s; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-weight: 760; font-size: 15px; }

.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--text); font-size: 14px; font-weight: 650; text-align: center; box-shadow: var(--shadow); }
.quick a:hover { text-decoration: none; background: var(--surface-2); }
.quick a:active { transform: scale(.97); }
.quick .avatar { width: 48px; height: 48px; }

/* ---------- device detail ---------- */
.detail-head { display: flex; align-items: center; gap: 16px; padding: 18px; }
.detail-head h1 { font-size: 24px; overflow-wrap: anywhere; }
.detail-head p { margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.warranty { padding: 18px; display: grid; gap: 12px; }
.warranty__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.warranty__date { font-weight: 720; font-size: 18px; }
.warranty__rem { font-size: 22px; font-weight: 760; letter-spacing: -.015em; line-height: 1.2; }
.warranty--expiring .warranty__rem { color: var(--warn-fg); }
.warranty--expired .warranty__rem { color: var(--bad-fg); }
.warranty--active .warranty__rem { color: var(--ok-fg); }
.meter { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--none-bg); -webkit-appearance: none; appearance: none; }
.meter::-webkit-progress-bar { background: var(--none-bg); border-radius: 999px; }
.meter::-webkit-progress-value { border-radius: 999px; background: #1f9d63; }
.meter::-moz-progress-bar { border-radius: 999px; background: #1f9d63; }
.meter--expiring::-webkit-progress-value { background: #d98a0a; }
.meter--expiring::-moz-progress-bar { background: #d98a0a; }
.meter--expired::-webkit-progress-value { background: #cf3b2e; }
.meter--expired::-moz-progress-bar { background: #cf3b2e; }
.facts { display: grid; }
.fact { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 54px; padding: 10px 18px; }
.fact + .fact { border-top: 1px solid var(--line); }
.fact dt { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 15px; flex: none; }
.fact dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.fact dd .btn { min-height: 36px; padding: 0 10px; font-size: 14px; margin-left: 6px; }
.notes { padding: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.thumb { position: relative; }
.thumb > a { display: block; aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb--file > a { display: grid; place-items: center; align-content: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 650; }
.thumb--file .i { width: 34px; height: 34px; color: var(--brand-text); }
.thumb__meta { margin-top: 4px; font-size: 12px; color: var(--muted); text-align: center; }
.receipt-view { padding: 10px; }
.receipt-view img { display: block; width: 100%; height: auto; border-radius: 10px; }
.receipt-view__zoom { touch-action: pan-x pan-y pinch-zoom; }

/* receipt picker */
.picker { display: grid; gap: 12px; }
.picker__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.picker__actions .btn { padding: 0 10px; min-height: 56px; }
.picker__hint { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.picker__hint .i { margin-top: 2px; color: var(--brand-text); }
.picker__status { min-height: 1.4em; font-size: 14px; font-weight: 600; color: var(--brand-text); }
.staged { display: grid; gap: 8px; }
.staged li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.staged img, .staged .staged__file { flex: none; width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface); display: grid; place-items: center; color: var(--brand-text); }
.staged__text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; }
.staged__text strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.staged__text span { color: var(--muted); }
.staged button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); }
.staged button:hover { background: var(--bad-bg); color: var(--bad-fg); }

/* ---------- subscriptions ---------- */
.hero--sub { padding-bottom: 22px; }
.money-big { margin-top: 6px; font-size: 40px; line-height: 1.05; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.money-big small { font-size: 18px; font-weight: 650; opacity: .9; letter-spacing: 0; }
.hero__row { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 10px; font-size: 15px; font-weight: 600; opacity: .95; }
.stack-bar { position: relative; z-index: 1; display: block; width: 100%; height: 12px; margin-top: 16px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .18); }
.stack-bar rect { shape-rendering: crispEdges; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.preset { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 12px 8px 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; color: var(--text); font-weight: 640; font-size: 15px; }
.preset:hover { text-decoration: none; background: var(--surface-2); }
.preset[aria-current="true"] { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.preset .avatar { width: 38px; height: 38px; font-size: 16px; }
.paused { opacity: .6; }

/* ---------- settings ---------- */
.group { display: grid; gap: 0; }
.group > summary { list-style: none; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 16px; cursor: pointer; font-weight: 650; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary > .i:last-child { margin-left: auto; color: var(--line-strong); transition: transform .2s ease; }
.group[open] > summary > .i:last-child { transform: rotate(90deg); }
.group__body { padding: 4px 16px 18px; display: grid; gap: 16px; }
.token-new { padding: 14px; border-radius: 14px; background: var(--brand-soft); color: var(--text); display: grid; gap: 8px; }
.token-new code { display: block; padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }
.kv { display: flex; justify-content: space-between; gap: 16px; font-size: 15px; }
.danger-zone { margin-top: 28px; display: grid; gap: 10px; }

/* ---------- sheets / dialogs ---------- */
dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(6, 18, 24, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet { width: 100%; margin: auto 0 0; }
.sheet[open] { animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
.sheet__panel { max-width: 560px; margin: 0 auto; padding: 10px 16px calc(18px + var(--safe-b)); background: var(--surface); border-radius: 26px 26px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .2); }
.sheet__grab { width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 99px; background: var(--line-strong); }
.sheet__panel h2 { margin: 2px 4px 10px; font-size: 19px; }
.sheet__panel p { margin: 0 4px 14px; color: var(--muted); }
.sheet__links { display: grid; gap: 4px; }
.sheet__link { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 8px 10px; border-radius: 16px; color: var(--text); font-weight: 650; }
.sheet__link:hover { text-decoration: none; background: var(--surface-2); }
.sheet__link small { display: block; font-weight: 500; color: var(--muted); font-size: 14px; }
.sheet__cancel { margin-top: 10px; }
.sheet--center { margin: auto; padding: 16px; max-width: 460px; }
.sheet--center .sheet__panel { border-radius: 24px; padding-bottom: 18px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

.ios-hint { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 25; max-width: 520px; margin: 0 auto; padding: 14px 14px 14px 16px; display: flex; gap: 12px; align-items: flex-start; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 34px rgba(0, 0, 0, .22); font-size: 15px; }
.ios-hint strong { display: block; font-size: 16px; }
.ios-hint .btn { min-height: 44px; min-width: 44px; padding: 0 10px; flex: none; }

/* ---------- public pages (landing, auth, legal) ---------- */
.pub-head { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: saturate(180%) blur(16px); backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid transparent; }
.pub-head__in { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 1080px; margin: 0 auto; min-height: 62px; padding: 0 max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left)); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 20px; font-weight: 780; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--brand-text); font-weight: 780; }
.pub-main { max-width: 1080px; margin: 0 auto; padding: 8px max(var(--gutter), env(safe-area-inset-right)) 40px max(var(--gutter), env(safe-area-inset-left)); }
.pub-foot { max-width: 1080px; margin: 0 auto; padding: 24px max(var(--gutter), env(safe-area-inset-left)) calc(32px + var(--safe-b)); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.pub-foot nav { display: flex; gap: 18px; flex-wrap: wrap; }
.pub-foot a { color: var(--muted); }

.landing-hero { display: grid; gap: 28px; padding: 22px 0 6px; }
.landing-hero h1 { font-size: clamp(34px, 9vw, 58px); line-height: 1.04; letter-spacing: -.035em; font-weight: 800; }
.landing-hero h1 em { font-style: normal; background: linear-gradient(120deg, #0b8f84, #0a5f7a); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (prefers-color-scheme: dark) { .landing-hero h1 em { background: linear-gradient(120deg, #4fe8d6, #6fb8ff); -webkit-background-clip: text; background-clip: text; } }
.landing-hero .lead { margin-top: 14px; font-size: 19px; line-height: 1.5; max-width: 34ch; }
.landing-hero .btn-row { margin-top: 24px; }
.landing-hero .btn-row .btn { flex: 0 1 auto; min-width: 190px; }
.trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 18px; color: var(--muted); font-size: 14px; font-weight: 600; }
.trust span { display: inline-flex; align-items: center; gap: 6px; }
.trust .i { color: var(--brand-text); width: 1.1em; height: 1.1em; }
@media (min-width: 880px) { .landing-hero { grid-template-columns: 1.1fr .9fr; align-items: center; gap: 40px; padding-top: 48px; } }

/* phone mock-up drawn in CSS so it stays crisp and weighs nothing */
.phone { position: relative; width: min(300px, 78vw); margin: 0 auto; padding: 11px; border-radius: 46px; background: #0d1a21; box-shadow: 0 30px 60px rgba(9, 63, 94, .28), inset 0 0 0 2px #2a3b45; }
.phone__screen { overflow: hidden; border-radius: 36px; background: #f2f5f7; color: #0c1b24; padding: 38px 12px 14px; display: grid; gap: 10px; min-height: 520px; align-content: start; }
.phone::before { content: ""; position: absolute; top: 19px; left: 50%; width: 82px; height: 22px; margin-left: -41px; border-radius: 99px; background: #0d1a21; z-index: 2; }
.phone .hero { padding: 14px 12px 12px; border-radius: 20px; }
.phone .hero__title { font-size: 19px; }
.phone .stats { margin-top: 12px; gap: 6px; }
.phone .stat { padding: 8px 8px 7px; border-radius: 12px; }
.phone .stat dt { font-size: 10px; min-height: 2.6em; }
.phone .stat dd { font-size: 20px; margin-top: 2px; }
.phone .list { box-shadow: none; }
.phone .item { min-height: 56px; padding: 8px 10px; gap: 10px; }
.phone .avatar { width: 36px; height: 36px; border-radius: 11px; }
.phone .avatar .i { width: 20px; height: 20px; }
.phone .item__title { font-size: 14px; }
.phone .item__meta { font-size: 11.5px; }
.phone .chip { font-size: 10.5px; padding: 1px 7px 1px 5px; }
.phone .chip .i { width: 11px; height: 11px; }
.phone .item__sub { font-size: 10.5px; }
.phone .tone-teal { --tone-bg: #dcf4ef; --tone-fg: #08665f; } .phone .tone-blue { --tone-bg: #e1ecfb; --tone-fg: #1b4aa0; } .phone .tone-violet { --tone-bg: #ece6fa; --tone-fg: #573bad; }
.phone .chip--active { background: #dff4e8; color: #0b5d2e; } .phone .chip--expiring { background: #ffefcf; color: #7a4200; } .phone .chip--expired { background: #fde3df; color: #9b1c13; }
.phone .card { background: #fff; border-color: #e0e7ec; } .phone .item__meta, .phone .item__sub { color: #4a5e6a; } .phone .item + .item { border-color: #e0e7ec; }

.features { display: grid; gap: 12px; margin-top: 44px; }
@media (min-width: 640px) { .features { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .features { grid-template-columns: repeat(4, 1fr); } }
.feature { padding: 20px; display: grid; gap: 10px; align-content: start; }
.feature .avatar { margin-bottom: 4px; }
.feature p { color: var(--muted); font-size: 16px; }
.how { margin-top: 44px; padding: 26px 22px; }
.how h2 { font-size: 26px; margin-bottom: 18px; }
.how .steps { gap: 16px; }
.how .steps strong { display: block; }
.how .steps span { color: var(--muted); }
@media (min-width: 880px) { .how .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; } .how .steps li { padding-left: 0; padding-top: 44px; } }
.cta { margin-top: 44px; padding: 34px 22px; text-align: center; border-radius: 26px; color: #fff; background: linear-gradient(140deg, var(--hero-1), var(--hero-3)); display: grid; gap: 14px; justify-items: center; }
.cta h2 { font-size: 28px; }
.cta p { max-width: 38ch; opacity: .95; }
.cta .btn { background: #fff; color: #08403c; }
.cta .btn:hover { background: #eafaf7; }
.cta small { opacity: .9; font-size: 14px; }

.auth { max-width: 460px; margin: 0 auto; padding-top: 18px; }
.auth h1 { margin-bottom: 6px; }
.auth .form-card { margin-top: 20px; }
.auth__alt { margin-top: 18px; text-align: center; color: var(--muted); }
.auth__alt a { font-weight: 650; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.prose { max-width: 70ch; padding-top: 12px; }
.prose h1 { margin-bottom: 14px; }
.prose h2 { margin: 26px 0 8px; font-size: 21px; }
.prose p, .prose ul { margin-top: 10px; }
.prose ul { list-style: disc; padding-left: 22px; }
.prose li + li { margin-top: 6px; }

.err-page { max-width: 460px; margin: 40px auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.err-page .code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--brand-text); line-height: 1; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .tabbar, .sidebar, .actions-bar, .btn { display: none !important; } body { background: #fff; } }

/* ---------- small helpers used by the views ---------- */
.section__steps { margin: 14px 0 4px; }
.btn-row--top, .btn--top { margin-top: 18px; }
.ok-note { display: flex; align-items: center; gap: 12px; }
.ok-note .i { width: 26px; height: 26px; color: var(--ok-fg); }
.ok-note p { color: var(--muted); }
.pub-nav { flex-wrap: nowrap; gap: 6px; }
.pub-nav .btn { flex: 0 0 auto; }
.list--top, .empty--top, .thumbs--top { margin-top: 14px; }
.add-receipt { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.meta-line { text-align: center; padding-top: 4px; }
.stack--top { margin-top: 16px; }
.lead-small { margin-top: 6px; }
.preset-grid--top { margin-top: 16px; }
.token-list { box-shadow: none; }

/* ---------- round 2: findings from the iPhone check ---------- */
.item--device { align-items: flex-start; }
.item--device .avatar { margin-top: 2px; }
.item--device .item__title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.3; }
.item__status { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; }
.item--device .item__chev { align-self: center; }
.more-filters > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 2px; list-style: none; cursor: pointer; font-weight: 620; font-size: 15px; color: var(--brand-text); }
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters .pill__n { margin-left: 2px; background: var(--brand-soft); color: var(--brand-text); }
.more-filters[open] > summary { margin-bottom: 4px; }
.filters__row { grid-template-columns: 1fr; }
@media (min-width: 560px) { .filters__row { grid-template-columns: 1fr 1fr; } }
.hero { background: radial-gradient(120% 95% at 100% 0%, rgba(255, 255, 255, .17), rgba(255, 255, 255, 0) 58%), linear-gradient(140deg, var(--hero-1) 0%, var(--hero-2) 58%, var(--hero-3) 100%); }
.hero::after { content: none; }
.stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr); }
.ios-hint { padding: 11px 6px 11px 14px; font-size: 14.5px; line-height: 1.35; align-items: center; }
.ios-hint strong { font-size: 15px; }
.ios-hint > .i:first-child { width: 28px; height: 28px; color: var(--brand-text); }
.ios-hint .i { vertical-align: -0.28em; }
.landing-hero .btn-row .btn { flex: 1 1 100%; }
@media (min-width: 560px) { .landing-hero .btn-row .btn { flex: 0 1 auto; } }
.phone .item--device .item__title { font-size: 14px; }
.phone .item__status { margin-top: 3px; }
.tab { font-size: 11px; }
.stat dd { font-size: clamp(21px, 6.4vw, 27px); white-space: nowrap; }

.picker__status { min-height: 0; }

.sheet__panel:focus { outline: none; }

.preset-strip { display: flex; gap: 10px; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.preset-strip::-webkit-scrollbar { display: none; }
.preset-strip .preset { flex: none; scroll-snap-align: start; min-width: 148px; }
@media (min-width: 900px) { .preset-strip { flex-wrap: wrap; margin: 0; padding: 2px 0 8px; overflow: visible; } }

/* grid children may shrink below their content, so scrolling strips scroll instead of widening the page */
.form > *, .stack > *, .filters > * { min-width: 0; }
.preset-strip { max-width: 100%; }

/* very small phones (iPhone SE 1st gen, 320 px) */
@media (max-width: 359px) {
  .pub-nav .btn--ghost { display: none; }
  .brand { font-size: 18px; }
  .brand img { width: 30px; height: 30px; }
  .stats { gap: 6px; }
  .stat { padding: 10px 9px; }
}

.is-form .ios-hint { display: none; }
