/* Our Contacts — styled after Apple's Contacts app: system colours, grouped rounded lists,
   coloured initials, and a card with quick actions. */
:root {
  /* Apple's light-mode system colours */
  --bg: #f2f2f7;          /* grouped background */
  --surface: #ffffff;     /* grouped cells */
  --raised: #ffffff;
  --fill: rgba(118, 118, 128, .12);   /* search fields, inputs, segmented controls */
  --hover: #ebebf0;
  --ink: #000000;
  --muted: #6c6c70;       /* secondary label (a touch darker than Apple's for readability) */
  --line: #d1d1d6;        /* separators */
  --accent: #007aff;      /* systemBlue */
  --on-accent: #ffffff;
  --mark: #ffe58a;
  --warn: #ff3b30;        /* systemRed */
  --amber: #ff9500;
  --bar: rgba(249, 249, 249, .86);
  --shadow: 0 12px 40px rgba(0, 0, 0, .18);
  --av-blue: #007aff; --av-green: #34c759; --av-indigo: #5856d6; --av-orange: #ff9500;
  --av-pink: #ff2d55; --av-purple: #af52de; --av-red: #ff3b30; --av-teal: #30b0c7;
  --av-yellow: #f2b300; --av-mint: #00c7be; --av-brown: #a2845e; --av-cyan: #32ade6;
  color-scheme: light;
}
/* Dark colours: used when the device is in dark mode (unless Light was chosen under ? → Appearance),
   or always when Dark was chosen. Keep the two blocks below identical. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --raised: #2c2c2e; --fill: rgba(118, 118, 128, .24); --hover: #2c2c2e;
    --ink: #ffffff; --muted: #a1a1a8; --line: #38383a;
    --accent: #0a84ff; --on-accent: #ffffff; --mark: #6b5a12; --warn: #ff453a; --amber: #ff9f0a;
    --bar: rgba(22, 22, 24, .86); --shadow: 0 12px 40px rgba(0, 0, 0, .6);
    --av-blue: #0a84ff; --av-green: #30d158; --av-indigo: #5e5ce6; --av-orange: #ff9f0a;
    --av-pink: #ff375f; --av-purple: #bf5af2; --av-red: #ff453a; --av-teal: #40c8e0;
    --av-yellow: #e6b800; --av-mint: #63e6e2; --av-brown: #ac8e68; --av-cyan: #64d2ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --raised: #2c2c2e; --fill: rgba(118, 118, 128, .24); --hover: #2c2c2e;
  --ink: #ffffff; --muted: #a1a1a8; --line: #38383a;
  --accent: #0a84ff; --on-accent: #ffffff; --mark: #6b5a12; --warn: #ff453a; --amber: #ff9f0a;
  --bar: rgba(22, 22, 24, .86); --shadow: 0 12px 40px rgba(0, 0, 0, .6);
  --av-blue: #0a84ff; --av-green: #30d158; --av-indigo: #5e5ce6; --av-orange: #ff9f0a;
  --av-pink: #ff375f; --av-purple: #bf5af2; --av-red: #ff453a; --av-teal: #40c8e0;
  --av-yellow: #e6b800; --av-mint: #63e6e2; --av-brown: #ac8e68; --av-cyan: #64d2ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }
:root { --hair: 1px; }
@media (min-resolution: 2dppx) { :root { --hair: .5px; } }
html, body { margin: 0; height: 100%; }
/* Everything sized in rem scales from here. Text size (? → slider): Small · Medium (default) · Large · Extra large · Largest */
html { font-size: 16.5px; }
html[data-size="small"] { font-size: 15.5px; }
html[data-size="large"] { font-size: 18.5px; }
html[data-size="xlarge"] { font-size: 20.5px; }
html[data-size="xxlarge"] { font-size: 22.5px; }
@media (max-width: 760px) {   /* phones: Medium = iPhone standard reading size */
  html { font-size: 17px; }
  html[data-size="small"] { font-size: 16px; }
  html[data-size="large"] { font-size: 19px; }
  html[data-size="xlarge"] { font-size: 21px; }
  html[data-size="xxlarge"] { font-size: 23px; }
}
body {
  font: 400 1rem/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.01em;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons: soft grey fill by default, solid blue for the main action, plain blue text for links */
button {
  font: inherit; font-weight: 500; color: var(--accent); background: var(--fill);
  border: 0; border-radius: 10px; padding: 7px 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
button:hover { filter: brightness(.96); }
button:active { opacity: .7; }
button.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.icon { width: 34px; height: 34px; padding: 0; font-size: 1.1rem; line-height: 1; flex: none; border-radius: 50%; font-weight: 600; }
button.link { background: none; padding: 2px 0; color: var(--accent); text-align: left; border-radius: 0; }
button.link:hover { background: none; text-decoration: underline; filter: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

input, textarea, select {
  font: inherit; color: var(--ink); background: var(--fill);
  border: 0; border-radius: 10px; padding: 8px 11px; min-width: 0;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; line-height: 1.45; }

/* ── Screens ── */
.center-screen { min-height: 100dvh; display: grid; place-items: center; padding: 16px; color: var(--muted); }
.signin-card {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  padding: 36px 28px; text-align: center; max-width: 360px; width: 100%; color: var(--ink);
}
.signin-card h1 { margin: 0 0 6px; font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.signin-card p { color: var(--muted); margin: 0 0 22px; }
.signin-card .primary { padding: 10px 22px; border-radius: 99px; }

#app { display: flex; flex-direction: column; height: 100dvh; }
main { flex: 1; min-height: 0; position: relative; display: flex; overflow: hidden; }
/* Pull-to-refresh (home-screen app on phones) */
.ptr { position: absolute; top: 0; left: 50%; width: 30px; height: 30px; margin-left: -15px; z-index: 5;
  opacity: 0; transform: translateY(-40px); pointer-events: none; }
.ptr-ring { width: 100%; height: 100%; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent);
  background: var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.15); box-sizing: border-box; }
.ptr.spinning .ptr-ring { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
.ptr.settle, .list.settle { transition: transform .25s ease, opacity .25s ease; }

/* ── Header: translucent bar with a large title, like iOS ── */
.bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: var(--hair) solid var(--line); position: relative; z-index: 3;
}
.app-title { margin: 0; font-size: 1.6rem; font-weight: 700; letter-spacing: -.025em; flex: 1; min-width: 0; }
.app-title button { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; padding: 0; border-radius: 0;
  display: inline-flex; align-items: center; gap: 10px; }
.app-title button:hover { filter: none; }
.title-icon { width: 32px; height: 32px; border-radius: 22.5%; box-shadow: 0 0 0 .5px var(--line), 0 1px 3px rgba(0,0,0,.12); }
.tools { display: flex; align-items: center; gap: 8px; }
.search { position: relative; }
#search { width: 300px; padding: 8px 12px 8px 32px; }
/* Magnifying glass inside the search box, like Apple's search fields */
.search-icon { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  color: var(--muted); pointer-events: none; }
#new-btn { border-radius: 99px; padding: 7px 16px; }

.banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 20px; font-size: .88rem;
  background: color-mix(in srgb, var(--amber) 16%, var(--surface)); border-bottom: var(--hair) solid var(--line);
}
.banner span { flex: 1; min-width: 12rem; }
.banner.update { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.banner.offline { background: var(--surface); color: var(--muted); }
.banner button { padding: 4px 12px; font-size: .85rem; border-radius: 99px; background: var(--surface); }
.banner button.primary { background: var(--accent); }
.banner button.icon { width: 26px; height: 26px; padding: 0; background: var(--fill); color: var(--muted); }

/* ── Avatars: initials on a coloured gradient circle ── */
.avatar {
  --c: var(--av-blue);
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: .92rem; font-weight: 600; letter-spacing: .02em; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 72%, #fff), var(--c));
  box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .06);
  user-select: none;
}
.av-glyph { width: 58%; height: 58%; }
.avatar.xl { width: 6rem; height: 6rem; font-size: 2.35rem; font-weight: 600; box-shadow: 0 6px 18px color-mix(in srgb, var(--c) 35%, transparent); }
.av-blue { --c: var(--av-blue); } .av-green { --c: var(--av-green); } .av-indigo { --c: var(--av-indigo); }
.av-orange { --c: var(--av-orange); } .av-pink { --c: var(--av-pink); } .av-purple { --c: var(--av-purple); }
.av-red { --c: var(--av-red); } .av-teal { --c: var(--av-teal); } .av-yellow { --c: var(--av-yellow); }
.av-mint { --c: var(--av-mint); } .av-brown { --c: var(--av-brown); } .av-cyan { --c: var(--av-cyan); }

/* ── List: inset grouped sections, one per letter ── */
.list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 56px; }
.list > * { width: min(780px, calc(100% - 40px)); margin-left: auto; margin-right: auto; }
.lh {
  position: sticky; top: 0; z-index: 2; margin: 0 auto; padding: 14px 16px 6px;
  font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--muted);
  background: var(--bg);
}
.group { background: var(--surface); border-radius: 12px; overflow: hidden; margin-bottom: 6px; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  border: 0; border-radius: 0; padding: 9px 16px; background: var(--surface); color: var(--ink); font-weight: 400;
}
.row:not(:last-child)::after {   /* hairline separator, inset past the avatar */
  content: ""; position: absolute; left: calc(16px + 2.4rem + 12px); right: 0; bottom: 0; height: var(--hair); background: var(--line);
}
.row:hover { background: var(--hover); filter: none; }
.row:active { opacity: 1; background: var(--hover); }
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.rn { flex: 1; min-width: 0; }
.rn b { font-weight: 600; }
.rc { display: block; font-size: .8rem; color: var(--muted); margin-top: 1px; }
.rd { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.empty, .count { padding: 24px 16px; color: var(--muted); }
.count .link, .empty .link { margin-left: 6px; font-size: inherit; }
.rc.in-notes { font-style: italic; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count { padding: 12px 16px 6px; font-size: .82rem; }

.letters {
  display: flex; flex-direction: column; justify-content: center; padding: 4px 4px; gap: 0; overflow-y: auto;
}
.letters button { background: none; padding: 1px 6px; font-size: .7rem; font-weight: 600; color: var(--accent); border-radius: 4px; }
.letters button:hover { background: var(--fill); }
.letters:empty { display: none; }

/* ── Dialogs ── */
dialog {
  border: 0; border-radius: 16px; padding: 20px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  width: min(600px, 94vw);
}
dialog::backdrop { background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog h2 { margin: 0 0 12px; font-size: 1.2rem; font-weight: 700; letter-spacing: -.015em; }
dialog h2[tabindex="-1"]:focus { outline: none; }

/* ── Contact card: centred avatar and name, quick actions, grouped details ── */
.card { width: min(560px, 94vw); max-height: 92vh; background: var(--bg); padding: 14px 20px 20px; }
.card-top { display: flex; justify-content: space-between; align-items: center; margin: 0 -8px 2px; }
.nav-btn { background: none; padding: 6px 8px; font-size: 1rem; font-weight: 500; color: var(--accent); }
.nav-btn:hover { background: var(--fill); filter: none; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4px 0 6px; }
.hero h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.025em; margin: 12px 0 0; overflow-wrap: anywhere; }
.sub { margin: 3px 0 0; color: var(--muted); }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; margin-top: 18px; }
.quick-actions:empty { display: none; }
.qa {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px 8px;
  background: var(--surface); border-radius: 12px; color: var(--accent); font-size: .72rem; font-weight: 500;
}
.qa:hover { text-decoration: none; background: var(--hover); }
.qa svg { width: 1.35rem; height: 1.35rem; }
.qa.off { color: var(--muted); opacity: .45; }
.view-body { margin: 16px 0 4px; display: flex; flex-direction: column; gap: 14px; }
.view-body .group, .mini .group, .hv-text .group { margin: 0; }
.cell { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 9px 16px 10px; overflow-wrap: anywhere; }
.cell + .cell::before { content: ""; position: absolute; left: 16px; right: 0; top: 0; height: var(--hair); background: var(--line); }
.cell .lbl { font-size: .8rem; color: var(--ink); text-transform: lowercase; }
.cell .val { font-size: 1rem; }
.notes { display: block; white-space: normal; font-size: .95rem; max-height: 40vh; overflow-y: auto; }
.card-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.card-actions.sticky { position: sticky; bottom: -20px; background: var(--bg); padding: 12px 0 4px; margin-bottom: -4px; border-top: var(--hair) solid var(--line); }
.meta { flex: 1; font-size: .8rem; color: var(--muted); }
#delete-btn { color: var(--warn); }
.note {
  font-size: .85rem; padding: 9px 12px; border-radius: 10px; margin: 0;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

/* Edit form: white grouped fields on the grey card background */
#edit { display: flex; flex-direction: column; gap: 12px; }
#edit h2 { margin-bottom: 0; }
#edit label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
#edit label > input:not([type="radio"]), #edit label > textarea { font-size: 1rem; color: var(--ink); width: 100%; }
#edit input, #edit textarea, #edit select { background: var(--surface); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
legend { font-size: .8rem; color: var(--muted); padding: 0; margin-bottom: 4px; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.frow { display: flex; gap: 6px; align-items: flex-start; }
.frow .lab { width: 7.5em; flex: none; font-size: .9rem; color: var(--accent); }
.frow .val { flex: 1 1 0; min-width: 0; width: 100%; }
.frow .rm { width: 30px; height: 30px; margin-top: 3px; background: none; color: var(--warn); font-size: 1.3rem; }
fieldset .link { align-self: flex-start; font-size: .9rem; font-weight: 500; }
.bday { flex-direction: row; flex-wrap: wrap; align-items: center; }
.bday legend { width: 100%; }
#f-bday { width: 6em; }
#f-byear { width: 10em; }

.conflict { border-radius: 12px; padding: 14px; background: color-mix(in srgb, var(--amber) 12%, var(--surface)); }
.conflict > p { margin: 0 0 10px; font-weight: 600; }
.cf { margin-bottom: 12px; }
.cf h4 { margin: 0 0 6px; font-size: .85rem; }
.cf label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 2px solid transparent; border-radius: 10px; margin-bottom: 4px; background: var(--surface); color: var(--ink) !important; font-size: .9rem !important; flex-direction: row !important; cursor: pointer; }
.cf label:has(input:checked) { border-color: var(--accent); }
.cf input { accent-color: var(--accent); }
.cf .v .lbl { color: var(--muted); margin-right: 8px; }
.cf .v { display: block; font-size: .88rem; max-height: 8rem; overflow: auto; }
.conflict-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.history-wrap:has(#history-btn[hidden]) { display: none; }
.history-wrap { margin-top: 10px; }
.history { margin-top: 8px; max-height: 40vh; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.hv { border-radius: 12px; padding: 10px 12px; background: var(--surface); font-size: .85rem; }
.hv summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.hv-text { margin: 8px 0; }
.hv-text .group { background: var(--bg); }

/* ── Help & import ── */
.help { width: min(640px, 94vw); max-height: 88vh; }
.help h3 { margin: 20px 0 8px; font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* Title row with a Close button that stays pinned while the panel scrolls */
.dialog-head { position: sticky; top: -20px; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: -20px -20px 0; padding: 16px 20px 12px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-bottom: var(--hair) solid var(--line); }
.dialog-head h2 { margin: 0; }
#help-close-top { background: none; font-weight: 600; }
/* Appearance choice: an iOS segmented control */
.theme-seg { display: inline-flex; border-radius: 9px; padding: 2px; background: var(--fill); }
.theme-seg button { background: transparent; padding: 5px 16px; font-size: .9rem; font-weight: 500; color: var(--ink); border-radius: 7px; }
.theme-seg button.on { background: var(--raised); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .14), 0 0 0 .5px rgba(0, 0, 0, .04); }
/* Text size slider, like iOS: small A — track — big A */
.size-slider { display: flex; align-items: center; gap: 12px; max-width: 360px; }
.size-slider input { flex: 1; accent-color: var(--accent); height: 28px; margin: 0; padding: 0; border: 0; background: none; }
.size-a { font-weight: 700; line-height: 1; color: var(--ink); }
.size-a.small { font-size: 13px; } .size-a.big { font-size: 24px; }
.size-name { font-size: .85rem; color: var(--muted); margin-top: 2px; }
.keys { border-collapse: collapse; font-size: .9rem; }
.keys td { padding: 4px 12px 4px 0; vertical-align: top; }
.keys td:first-child { white-space: nowrap; }
kbd {
  display: inline-block; min-width: 1.6em; text-align: center; font: 600 .8rem ui-monospace, "SF Mono", Menlo, monospace;
  border-radius: 5px; padding: 1px 5px; margin-right: 2px; background: var(--fill); box-shadow: inset 0 -1px 0 var(--line);
}
code { font: .8rem ui-monospace, "SF Mono", Menlo, monospace; }
.toggle { display: inline-flex; gap: 6px; align-items: center; color: var(--ink); }
.toggle input { accent-color: var(--accent); }
.help-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 20px; }

.import { width: min(760px, 94vw); max-height: 90vh; }
.import p { margin: 0 0 12px; font-size: .9rem; }
#import-file { font: inherit; margin-bottom: 8px; max-width: 100%; border: 0; padding: 0; background: none; }
.import-preview { font-size: .9rem; }
.import-preview ul { padding-left: 20px; margin: 8px 0 12px; }
.import-preview li { margin-bottom: 4px; }
.import-preview .warn { color: var(--warn); }
.import-preview .summary { font-size: .95rem; margin-top: 8px; }
.mapping, .samples { margin: 8px 0; }
.mapping summary, .samples summary { cursor: pointer; color: var(--accent); }
.mapping table { border-collapse: collapse; margin-top: 8px; font-size: .85rem; width: 100%; }
.mapping td { padding: 3px 8px 3px 0; vertical-align: middle; }
.mapping td:last-child { overflow-wrap: anywhere; }
.mapping select { padding: 4px 8px; font-size: .85rem; }
.mini { border-radius: 12px; padding: 10px 12px; margin-top: 8px; background: var(--bg); }
.mini .group { margin-top: 6px; }
.mini .notes { max-height: 6rem; }
#import-progress { width: 100%; margin: 8px 0; accent-color: var(--accent); }

/* ── Toast ── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50; bottom: 32px;
  border-radius: 99px; padding: 10px 18px; box-shadow: var(--shadow);
  background: color-mix(in srgb, var(--raised) 92%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  font-size: .9rem; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: 14px;
}
.toast[hidden] { display: none; }
.toast-btn { white-space: nowrap; background: none; padding: 2px 4px; color: var(--accent); font-weight: 700; }
.toast-btn:hover { background: none; text-decoration: underline; filter: none; }
.toast.error { color: var(--warn); border-radius: 14px; }

/* ── Desktop / mobile switch ── */
@media (min-width: 761px) { .mobile-only { display: none !important; } }
@media (max-width: 760px) {
  .desktop-only { display: none !important; }
  /* Extra room at the top so the title clears the iPhone clock / Dynamic Island area. */
  .bar { flex-wrap: wrap; gap: 10px; padding: 10px 16px; padding-top: calc(max(10px, env(safe-area-inset-top)) + 14px); }
  .app-title { font-size: 1.75rem; }
  .title-icon { width: 30px; height: 30px; }
  .tools { width: 100%; }
  .search { flex: 1; min-width: 0; }
  #search { width: 100%; font-size: max(16px, 1rem); } /* 16px+ stops iOS zooming */
  input, textarea, select { font-size: max(16px, 1rem); }
  .rd { display: none; }
  .list > * { width: calc(100% - 24px); }
  .letters { padding: 2px 1px; }
  .letters button { padding: 0 4px; font-size: .64rem; }
  dialog.card {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh;
    margin: 0; border-radius: 0; padding: 12px 16px 16px;
    padding-top: calc(max(12px, env(safe-area-inset-top)) + 10px); padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  .grid2 { grid-template-columns: 1fr; }
  .frow .lab { width: 6em; }
  .card-actions { flex-wrap: wrap; }
  .meta { width: 100%; flex-basis: 100%; order: 9; }
}
