/* Apple UI Kit — base shared by both platforms (reset, type, glass recipe, scrims). */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: var(--fs-body)/1.3 var(--font); letter-spacing: -0.012em; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
html.mac body { line-height: 16px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
svg { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 1px; }
input::placeholder, textarea::placeholder { color: var(--text3); }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--green-text); } .neg { color: var(--red); } .warn { color: var(--orange-text); } .muted { color: var(--text2); }
.c-red { background: var(--red); } .c-blue { background: var(--blue); } .c-gray { background: var(--gray); } .c-green { background: var(--green); }
.c-orange { background: var(--orange); } .c-purple { background: var(--purple); } .c-teal { background: #0093a0; } .c-yellow { background: var(--yellow); }

/* Liquid Glass is for controls and navigation only — never for content (HIG "Materials") */
.glass, .gbtn, .tabbar, .alert, .as-group, .as-cancel, .cmenu, .popover {
  background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-shadow), inset 0 .5px 0 var(--glass-edge), inset 0 0 0 .5px var(--glass-edge);
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .gbtn, .tabbar, .alert, .as-group, .as-cancel, .cmenu, .popover { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* scrims (sheet / alert / action sheet) */
.scrim { position: fixed; inset: 0; z-index: 100; background: transparent; transition: background .3s; }
.scrim.in { background: var(--scrim); }
.scrim.center { z-index: 200; display: grid; place-items: center; padding: 20px; }
.scrim.bottom { z-index: 200; display: flex; align-items: flex-end; justify-content: center; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }

/* pop-up / pull-down: a real <select> dressed as Apple's button (the system menu opens) */
.popup { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.popup select { -webkit-appearance: none; appearance: none; border: 0; background: none; padding: 0 20px 0 0; outline: none; cursor: pointer; min-width: 0; max-width: 100%; text-overflow: ellipsis; color: inherit; }
.popup .pop-ic { position: absolute; right: 0; width: 15px; height: 15px; pointer-events: none; stroke-width: 2.2; opacity: .7; }
.sel-btn { position: relative; display: inline-grid; place-items: center; }
.sel-cover { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* switch */
.switch { position: relative; display: inline-block; width: 63px; height: 28px; margin-left: auto; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--fill); transition: background .25s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 37px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .25s var(--ease); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(22px); }

/* segmented control */
.seg { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--fill); }
.seg button { flex: 1; height: 32px; border: 0; border-radius: 999px; background: none; font-size: 14px; font-weight: 500; white-space: nowrap; color: var(--text); }
.seg button.on { background: var(--card); font-weight: 600; box-shadow: 0 2px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }

/* compact date picker: the date as text in a capsule; a tap opens the system picker */
.dp { position: relative; display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border-radius: 8px; background: var(--fill2); color: var(--text); white-space: nowrap; }
.dp-input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.dp.empty .dp-text { color: var(--text3); }
.dp-clear { position: relative; z-index: 1; border: 0; background: none; padding: 0; color: var(--text3); display: grid; }
.dp-clear svg { width: 14px; height: 14px; }

/* empty state (ContentUnavailableView) */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: min(62vh, 520px); padding: 24px; color: var(--text2); }   /* ContentUnavailableView: centred */
.empty-state > svg { width: 52px; height: 52px; stroke-width: 1.4; margin-bottom: 14px; }
.es-title { font-size: 20px; font-weight: 700; color: var(--text); }
.es-msg { font-size: 17px; margin-top: 6px; max-width: 300px; }
.empty-state .btn-prominent { height: 34px; padding: 0 14px; font-size: 15px; font-weight: 500; }
.empty-state > button, .empty-state > a { margin-top: 18px; }
.spin { width: 22px; height: 22px; border: 2.5px solid var(--fill); border-top-color: var(--text2); border-radius: 50%; display: inline-block; animation: kit-spin .8s linear infinite; }
@keyframes kit-spin { to { transform: rotate(360deg); } }

/* buttons */
.btn-tinted { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 18px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 15px; font-weight: 600; border: 0; }
.btn-prominent { display: inline-flex; align-items: center; justify-content: center; height: 52px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 600; }
.btn-prominent:disabled { opacity: .5; }

/* grouped list / form (iOS inset grouped, Mac grouped Form) — sizes per platform below */
.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-h > span:empty, .section-f:empty, .group:empty { display: none; }
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.group > * { position: relative; }
.group > * + *::before { content: ""; position: absolute; z-index: 2; top: 0; pointer-events: none; }
.row { display: flex; align-items: center; width: 100%; border: 0; background: var(--card); color: var(--text); text-align: left; text-decoration: none; }
a.row, button.row { cursor: pointer; }
.row .grow { flex: 1; min-width: 0; }
.row .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--text2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { flex: none; text-align: right; max-width: 55%; color: var(--text2); }
.row .chev { color: var(--text3); flex: none; }
.row.action { color: var(--accent); }
.row.action.destructive { color: var(--red); }
.icon-dot { display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; }
.field { display: flex; align-items: center; gap: 12px; background: var(--card); }
.field > .flabel { flex: none; width: 40%; max-width: 190px; }
.field > input, .field > textarea, .field .f-pop select { flex: 1; min-width: 0; border: 0; background: none; outline: none; text-align: right; color: var(--text); }
.field .f-pop { flex: 1; justify-content: flex-end; }
.field .f-pop select { text-align: right; text-align-last: right; }
.field .unit { color: var(--text2); flex: none; }
.field.stack { flex-direction: column; align-items: stretch; }
.field.stack textarea { text-align: left; resize: vertical; }

/* avatar / monogram (Contacts): grey gradient with initials, or a photo */
.avatar { display: grid; place-items: center; border-radius: 50%; flex: none; overflow: hidden; color: #fff; font-weight: 600; letter-spacing: .02em;
  background: linear-gradient(#a5abb8, #858994); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Contacts card (contact poster) — CNContactViewController on macOS 27.3 and iOS 27.3
   (references/mac/contact-*.png, references/ios/contact-*.png). No photo: macOS shows a glass circle with a person silhouette,
   iOS shows only the poster. Text is white on the poster in light and dark. ---------- */
.ccard { --cc-fill: light-dark(rgba(130,118,255,.33), rgba(255,255,255,.075));   /* measured card #5f66bd on #4e609c (light), #352a56 on #251b42 (dark) */
  --cc-btn: light-dark(rgba(255,255,255,.16), rgba(255,255,255,.1));
  position: relative; min-height: 100%; color: #fff;   /* text stays white on the poster in both themes */
  background: #19132d; background-image: linear-gradient(180deg, light-dark(#8fa0b9, #6c7593) 0, light-dark(#8b9db7, #6c7593) 100px, light-dark(#7684ab, #483e70) 300px, light-dark(#4e609c, #251b42) 500px, light-dark(#37447f, #19132d) 680px);
  background-color: light-dark(#37447f, #19132d); }   /* poster colours sampled at 100 / 300 / 500 / 660 pt on iOS 27.3 */
.cc-head { display: flex; flex-direction: column; align-items: center; text-align: center; }
.cc-photo { display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: rgba(255,255,255,.1);
  box-shadow: inset 0 1.5px 1px rgba(255,255,255,.55), inset 0 -1px 2px rgba(0,0,0,.18), 0 0 0 1px rgba(255,255,255,.22), 0 6px 20px rgba(0,0,0,.12); }
.cc-photo img { width: 100%; height: 100%; object-fit: cover; }
.cc-photo .silhouette { width: 78%; height: 78%; margin-top: 8%; }
.cc-name { font-weight: 700; text-shadow: 0 1px 6px rgba(0,0,0,.25); overflow-wrap: anywhere; }
.cc-sub { font-weight: 600; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.cc-actions { display: flex; justify-content: center; }
.cc-act { display: grid; place-items: center; border-radius: 50%; border: 0; padding: 0; color: #fff; background: var(--cc-btn);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 0 0 .5px rgba(255,255,255,.25), 0 0 0 .5px rgba(0,0,0,.25); -webkit-backdrop-filter: blur(10px) saturate(160%); backdrop-filter: blur(10px) saturate(160%); }
.cc-act { --knock: light-dark(#7c86b2, #4a4170); }
.cc-act:disabled { color: rgba(255,255,255,.4); }
.cc-act svg { stroke-width: 1.9; }
.cc-cards { display: flex; flex-direction: column; margin: 0 auto; }
.cc-card { background: var(--cc-fill); overflow: hidden; }
.cc-item { position: relative; display: flex; align-items: center; gap: 10px; }
.cc-item + .cc-item::before { content: ""; position: absolute; top: 0; left: inherit; right: 0; border-top: .5px solid rgba(255,255,255,.22); }
.cc-text { flex: 1; min-width: 0; display: block; border: 0; background: none; padding: 0; color: #fff; text-align: left; text-decoration: none; font: inherit; }
.cc-label { display: block; color: rgba(255,255,255,.9); }
.cc-value { display: block; color: #fff; overflow-wrap: anywhere; white-space: pre-line; }
.cc-item.plain { width: 100%; border: 0; background: none; color: #fff; text-align: left; font: inherit; }
.cc-item.plain .chev { margin-left: auto; color: rgba(255,255,255,.75); }
.cc-item.destructive, .cc-item.destructive .cc-value { color: #ff8a80; }
.cc-act-sm { flex: none; display: grid; place-items: center; border: 0; padding: 0; color: #fff; background: none; }
/* Mac sizes (CNContactViewController, macOS 27.3): glass photo 180 pt, name 17 pt bold, subtitle 11 pt, icon buttons 40 pt (gap 8),
   cards 360 pt wide, radius 14, gap 7, label 11 pt over value 13 pt, small round action on the right */
html.mac .ccard { padding: calc(var(--toolbar-h) + 8px) 20px 40px; }
html.mac .cc-photo { width: 180px; height: 180px; margin-bottom: 14px; }
html.mac .ccard.has-photo .cc-photo { width: 198px; height: 198px; }
html.mac .cc-name { font-size: 17px; line-height: 22px; }
html.mac .cc-sub { font-size: 11px; line-height: 14px; margin-top: 2px; }
html.mac .cc-actions { gap: 8px; margin: 14px 0 18px; }
html.mac .cc-act { width: 40px; height: 40px; }
html.mac .cc-act svg { width: 18px; height: 18px; }
html.mac .cc-cards { width: 360px; max-width: 100%; gap: 7px; }
html.mac .cc-card { border-radius: 14px; }
html.mac .cc-item { min-height: 44px; padding: 10px 14px 11px; font-size: 13px; left: 0; }
html.mac .cc-item + .cc-item::before { left: 14px; }
html.mac .cc-label { font-size: 11px; line-height: 14px; margin-bottom: 2px; }
html.mac .cc-value { font-size: 13px; line-height: 17px; }
html.mac .cc-act-sm { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.2); }
html.mac .cc-act-sm svg { width: 12px; height: 12px; stroke-width: 2.2; }
html.mac button.cc-text:hover, html.mac a.cc-text:hover, html.mac .cc-item.plain:hover { opacity: .85; }
/* iPhone sizes (iOS 27.3): poster ~ 300 pt above the name, name 24 pt bold, icon buttons 62 pt (gap 8), cards inset 16, radius 26,
   gap 7, label 15 pt over value 17 pt, plain icon on the right */
html.ios .ccard { margin: calc(-56px - env(safe-area-inset-top)) -16px 0; padding: calc(env(safe-area-inset-top) + 56px) 16px 140px; }
html.ios .ccard:not(.has-photo) .cc-head { padding-top: 262px; }   /* name at ~343 pt on a 667 pt screen */
html.ios .cc-photo { width: 150px; height: 150px; margin: 30px 0 18px; }
html.ios .cc-name { font-size: 24px; line-height: 30px; }
html.ios .cc-sub { font-size: 15px; margin-top: 2px; }
html.ios .cc-actions { gap: 8px; margin: 18px 0 22px; }
html.ios .cc-act { width: 62px; height: 62px; }
html.ios .cc-act svg { width: 26px; height: 26px; }
html.ios .cc-cards { gap: 7px; }
html.ios .cc-card { border-radius: 26px; }
html.ios .cc-item { min-height: 62px; padding: 12px 18px 13px; font-size: 17px; }
html.ios .cc-item + .cc-item::before { left: 18px; right: 18px; }
html.ios .cc-label { font-size: 15px; line-height: 20px; }
html.ios .cc-value { font-size: 17px; line-height: 22px; }
html.ios .cc-act-sm { width: 30px; height: 30px; }
html.ios .cc-act-sm svg { width: 18px; height: 18px; stroke-width: 2; }
html.ios .cc-text:active, html.ios .cc-item.plain:active { opacity: .7; }

/* values sit at the trailing edge of a form row (System Settings): date field too */
.field > .dp { margin-left: auto; }
/* a contact card at the top of a longer page (the app's own sections follow below the poster) */
.ccard.in-page { min-height: 0; }
html.ios .ccard.in-page { padding-bottom: 22px; margin-bottom: 18px; }
html.mac .ccard.in-page { padding-top: 24px; padding-bottom: 24px; margin-bottom: 18px; border-radius: 14px; }

/* ---------- Money bar (QuickBooks money bar, drawn like macOS Storage) ---------- */
.money-bar { display: flex; gap: 28px; padding: 14px 20px 16px; }
.mb-group { flex: 1 1 0; min-width: 150px; }   /* an empty group keeps room for its heading on one line */
.mb-head { display: flex; gap: 6px; align-items: baseline; white-space: nowrap; font-size: var(--fs-foot); color: var(--text2); }
.mb-label { font-weight: 600; }
.mb-note { color: var(--text2); overflow: hidden; text-overflow: ellipsis; }
.mb-total { margin-top: 1px; font-size: 20px; line-height: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mb-track { display: flex; gap: 2px; height: 8px; margin: 8px 0 8px; border-radius: 4px; overflow: hidden; background: var(--fill); }
.mb-track i { flex-basis: 4px; min-width: 4px; }
.mb-red { background: var(--red); } .mb-orange { background: var(--orange); } .mb-blue { background: var(--blue); }
.mb-green { background: var(--green); } .mb-gray { background: var(--gray); }
.mb-legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-left: -6px; }
.mb-item { display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px; border: 0; border-radius: 6px; background: none;
  font: inherit; font-size: var(--fs-foot); color: var(--text2); white-space: nowrap; }
button.mb-item:hover { background: var(--fill); }
.mb-item.on { background: var(--accent-soft); color: var(--accent); }
.mb-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mb-v { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.mb-item.on .mb-v { color: var(--accent); }
html.ios .money-bar { flex-wrap: wrap; gap: 14px 20px; padding: 14px 16px; margin: 0 0 var(--section-gap); border-radius: var(--radius); background: var(--card); }
html.ios .mb-group { flex: 1 1 140px !important; }
html.ios .mb-item { font-size: 13px; }
