/* Apple UI Kit — iOS 27 (Liquid Glass) iPhone components. Only under html.ios.
   Checked against iOS 27.3 Settings and Contacts in the Simulator (GHL SE2): nav bar glass circles, large title, inset grouped cards,
   ✕ / ✓ sheets, left-aligned alerts with capsule buttons, floating tab bar that shrinks while scrolling. */

html.ios .app { min-height: 100vh; min-height: 100dvh; padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
html.ios .page { padding: 0 16px; }

/* glass button (nav bar, sheet bar): 44 pt circle or capsule */
html.ios .gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--tap); min-width: var(--tap); padding: 0 16px; border: 0; border-radius: 999px;
  color: var(--text); font-size: var(--fs-body); font-weight: 500; white-space: nowrap; transition: transform .2s, background .2s; }
html.ios .gbtn.round { width: var(--tap); padding: 0; }
html.ios .gbtn svg { width: 21px; height: 21px; stroke-width: 2.1; }
html.ios .gbtn:active { transform: scale(1.08); }
html.ios .gbtn.prominent { background: var(--accent); color: #fff; }
html.ios .gbtn:disabled { color: var(--text3); }
html.ios .popup.gbtn { padding: 0 14px 0 16px; }
html.ios .popup.gbtn select { font-size: 15px; font-weight: 500; height: var(--tap); padding-right: 22px; }
html.ios .popup.gbtn .pop-ic { right: 12px; }

/* nav bar: back = chevron-only glass circle (iOS 26+), title collapses from the large title, scroll edge blur */
.navbar { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); }
.navbar::before { content: ""; position: absolute; inset: 0 0 -18px; opacity: 0; transition: opacity .2s; pointer-events: none;
  background: linear-gradient(var(--bg) 0%, color-mix(in srgb, var(--bg) 70%, transparent) 60%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); -webkit-mask-image: linear-gradient(#000 60%, transparent); mask-image: linear-gradient(#000 60%, transparent); }
.navbar.scrolled::before { opacity: 1; }
.nb-in { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; height: 56px; padding: 0 16px; }
.nb-lead, .nb-trail { display: flex; gap: 8px; min-width: 0; }
.nb-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 200px); opacity: 0; transition: opacity .18s; pointer-events: none; }
.navbar.inline .nb-title { opacity: 1; }
.nb-group { display: inline-flex; align-items: center; height: var(--tap); padding: 0 4px; border-radius: 999px; }   /* iOS 27.3: neighbours share one capsule */
.nb-group > :is(button, a) { display: grid; place-items: center; width: 44px; height: 44px; border: 0; background: none; color: var(--text); padding: 0; }
.nb-group > :is(button, a) svg { width: 21px; height: 21px; stroke-width: 2.1; }
.page-head { padding: 0 16px; }
h1.large { font-size: var(--fs-large); line-height: 41px; font-weight: 700; letter-spacing: .01em; margin: 2px 0 10px; }
.searchbar { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; margin: 0 0 6px; border-radius: 999px; background: var(--fill); color: var(--text2); }
.searchbar svg { width: 17px; height: 17px; flex: none; }
.searchbar input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 17px; color: var(--text); }

/* floating tab bar: shrinks to the selected tab while scrolling down */
.tabbar { position: fixed; z-index: 30; left: 20px; right: 20px; bottom: max(21px, calc(env(safe-area-inset-bottom) - 6px));
  display: flex; gap: 2px; padding: 4px; border-radius: 999px; max-width: 520px; margin: 0 auto; transition: right .35s var(--ease), padding .3s; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; height: 56px; border-radius: 999px;
  color: var(--text); font-size: 10px; font-weight: 600; letter-spacing: .01em; min-width: 0; transition: background .2s, color .2s; }
.tabbar a svg { width: 26px; height: 26px; stroke-width: 1.9; --tab-dot: light-dark(#fff, #1c1c1e); }
.tabbar a.on { color: var(--accent); background: light-dark(rgba(0,0,0,.075), rgba(255,255,255,.12)); }
.tabbar.min { right: calc(100% - 16px - 72px); }
.tabbar.min a:not(.on) { display: none; }
.tabbar.min a.on { background: none; }
.tabbar.min a.on span { display: none; }

/* inset grouped list (Settings) — I-Set */
html.ios .section-h { margin: 34px 16px 8px; font-size: 17px; font-weight: 600; color: var(--text2); text-transform: none; letter-spacing: 0; }   /* iOS 27.3: sentence case, same size as the rows */
html.ios .section-h a { font-size: 17px; font-weight: 400; }
html.ios .section-f { font-size: 13px; color: var(--text2); margin: 7px 16px 0; }
html.ios .group > * + *::before { left: 16px; right: 20px; border-top: .5px solid var(--sep); }
html.ios .group > * + .row:has(> .icon-dot)::before, html.ios .group > * + .sw:has(.icon-dot)::before { left: 60px; }
html.ios .row { min-height: var(--row-h); padding: 18px 16px; gap: 12px; }   /* iOS 27.3 List: 58 pt single line, 83 pt with a subtitle */
html.ios a.row:active, html.ios button.row:active { background: color-mix(in srgb, var(--card) 80%, var(--text3)); }
html.ios .row .sub { font-size: 15px; line-height: 20px; margin-top: 4px; }
html.ios .row .title { line-height: 22px; }
html.ios .row .chev { width: 8px; height: 13px; margin-left: -2px; }
html.ios .row:has(> .icon-dot) { min-height: 58px; padding-top: 12px; padding-bottom: 12px; }
html.ios .icon-dot { width: 30px; height: 30px; border-radius: 8px; font-size: 14px; }
html.ios .icon-dot svg { width: 18px; height: 18px; }
html.ios .field { min-height: var(--row-h); padding: 4px 16px; }
html.ios .field > input, html.ios .field > textarea, html.ios .field .f-pop select { padding: 13px 0; font-size: 17px; }   /* ≥16 px: Safari doesn't zoom */
html.ios .field .f-pop, html.ios .field .f-pop select { color: var(--text2); }
html.ios .field .f-pop select { padding-right: 22px; }
html.ios .field.stack { padding-top: 4px; }
html.ios .field.stack textarea { min-height: 66px; padding: 10px 0; }
html.ios .seg-wrap { margin: 4px 0 12px; }
html.ios .dp { font-size: 17px; }

/* swipe actions */
.sw { overflow: hidden; }
.sw > .row { position: relative; z-index: 1; touch-action: pan-y; transition: transform .3s var(--ease); }
.sw-acts { position: absolute; inset: 0 0 0 auto; display: flex; opacity: 0; }
.sw-btn { border: 0; min-width: 88px; padding: 0 16px; color: #fff; font-size: 15px; font-weight: 600; background: var(--gray); }
.sw-btn.red { background: var(--red); }

/* record detail (Wallet / Mail detail): big amount, then grouped rows */
.hero { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 6px 0 18px; text-align: center; }
.hero .big { font-size: 40px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.hero .cap { font-size: 15px; color: var(--text2); }

/* sheet: card from the bottom, ✕ / title / ✓, grabber; pull down to close */
html.ios .sheet { position: absolute; left: 0; right: 0; bottom: 0; top: calc(env(safe-area-inset-top) + 10px); display: flex; flex-direction: column;
  background: var(--sheet); border-radius: 38px 38px 0 0; transform: translateY(105%); transition: transform .42s var(--ease); box-shadow: 0 -2px 30px rgba(0,0,0,.18); }
html.ios .scrim.in .sheet { transform: none; }
html.ios .sheet :is(.group, .row, .field) { background: var(--sheet-card); }
html.ios .sheet .seg button.on { background: var(--sheet-card); }
html.ios .sheet-head { position: relative; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 14px 16px 10px; touch-action: none; }
.grabber { position: absolute; top: 6px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--text3); }
html.ios .sheet-title { text-align: center; font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.ios .sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 4px 16px calc(40px + env(safe-area-inset-bottom)); }

/* alert — UIAlertController on iOS 27.3 (references/ios/alert*.png): text left, grey capsules (Cancel / OK in the label colour,
   Delete in red), blue only for a preferred action; two side by side, more stacked */
html.ios .alert { background: light-dark(rgba(246,246,246,.94), rgba(36,36,38,.94)); width: 314px; max-width: calc(100% - 40px); padding: 22px 16px 16px; border-radius: 34px; text-align: left; opacity: 0; transform: scale(1.1); transition: opacity .18s, transform .25s var(--ease); }
html.ios .scrim.in .alert { opacity: 1; transform: none; }
html.ios .a-title { padding: 0 14px; font-size: 17px; font-weight: 600; }
html.ios .a-msg { padding: 0 14px; font-size: 15px; color: var(--text2); line-height: 1.4; margin-top: 6px; }
html.ios .a-btns { display: flex; gap: 8px; margin-top: 18px; }
html.ios .a-btns.stack { flex-direction: column; }
html.ios .a-btns.stack .ab { flex: none; }
html.ios .ab { flex: 1 1 0; min-width: 0; padding: 0 12px; white-space: nowrap; height: 46px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text); font-size: 17px; font-weight: 500; }
html.ios .ab.destructive { color: var(--red); }
html.ios .ab.is-default { background: var(--accent); color: #fff; }

/* action sheet — iOS 27.3: a floating card of grey capsules (Cancel the last one); from a button it opens as a popover under it, no Cancel */
.scrim.pop-scrim { z-index: 200; }
.scrim.pop-scrim.in { background: transparent; }   /* a dialog from a button doesn't dim the screen (iOS 27.3) */
.asheet { background: light-dark(rgba(246,246,246,.94), rgba(36,36,38,.94)); width: 320px; max-width: calc(100% - 40px); display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 34px; opacity: 0; transform: scale(1.06); transition: opacity .2s, transform .3s var(--ease); }
.scrim.in .asheet { opacity: 1; transform: none; }
.asheet.pop { position: fixed; width: 240px; background: light-dark(rgba(246,246,246,.94), rgba(36,36,38,.94)); border-radius: 26px; padding: 12px; gap: 8px; transform: scale(.6); }
.as-head { padding: 4px 8px 2px; text-align: center; }
.as-title { font-size: 15px; font-weight: 400; color: var(--text); }
.as-msg { font-size: 13px; color: var(--text2); margin-top: 3px; }
.as-btn { display: block; width: 100%; height: 46px; border: 0; border-radius: 999px; background: var(--fill); color: var(--text); font-size: 17px; font-weight: 500; }
.as-btn.destructive { color: var(--red); }

/* menus — UIMenu on iOS 27.3 (references/ios/menu-*.png, opened with XCUITest): opens over its button, glass, 26 pt corners,
   symbols on the LEADING side, rows 41 pt, thin separator lines; items without a symbol start at the symbol column */
html.ios .cmenu { position: fixed; z-index: 300; min-width: 200px; max-width: calc(100% - 32px); padding: 8px 0; border-radius: 26px;
  background: light-dark(rgba(250,250,250,.86), rgba(48,48,50,.86)); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 12px 40px rgba(0,0,0,.18), inset 0 0 0 .5px light-dark(rgba(255,255,255,.8), rgba(255,255,255,.12)); transform-origin: top right; animation: kit-menu .22s var(--ease); }
@keyframes kit-menu { from { opacity: 0; transform: scale(.7); } }
html.ios .cm-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 41px; padding: 0 20px; border: 0; background: none; color: var(--text); text-align: left; font-size: 17px; }
html.ios .cm-item:active { background: var(--fill2); }
html.ios .cm-item.destructive { color: var(--red); }
html.ios .cm-label { flex: 1; }
html.ios .cm-ic { width: 19px; height: 19px; flex: none; stroke-width: 1.8; }
html.ios span.cm-ic { display: none; }
html.ios .cm-check { width: 18px; flex: none; display: grid; }
html.ios .cm-check svg { width: 16px; height: 16px; stroke-width: 2.4; }
html.ios .cm-more { width: 9px; height: 14px; stroke-width: 2.2; }
html.ios .cm-sep { height: .5px; margin: 6px 20px; background: var(--sep); }
html.ios .cm-head { padding: 6px 20px 4px; font-size: 13px; color: var(--text2); }

/* ---------- search (iOS 27.3, references/ios/list*, search*, p17-*): apps with tabs have Search as the LAST ITEM INSIDE the tab bar
   (not a separate circle); it opens a Search page. Apps without tabs (Settings, Contacts) float a 48 pt search capsule at the bottom,
   with a round glass button beside it (Contacts' +). ---------- */
.bsearch-bar { position: fixed; z-index: 30; left: 16px; right: 16px; bottom: max(19px, calc(env(safe-area-inset-bottom) - 6px)); display: flex; gap: 10px; align-items: center; }
.bsearch { flex: 1; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-radius: 999px; color: var(--text2); min-width: 0; }
.bsearch svg { width: 19px; height: 19px; flex: none; }
.bsearch input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 17px; color: var(--text); }
.bsearch input::-webkit-search-cancel-button { -webkit-appearance: none; }
.bsearch .bs-clear { border: 0; background: var(--text3); color: var(--bg); width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.bsearch .bs-clear svg { width: 11px; height: 11px; stroke-width: 3; }
.bsearch-bar .gbtn.round { width: 48px; height: 48px; flex: none; }
.search-page .bsearch { position: sticky; top: 8px; margin: 0 0 12px; height: 44px; background: var(--fill); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* active search (iOS 27.3 references/ios/searching-*): glass capsule at the top + round ✕, tab bar hidden */
.search-top { position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 6px); left: 16px; right: 16px; display: flex; gap: 10px; align-items: center; }
.search-top .bsearch { height: 44px; }
.search-top .gbtn.round { width: 44px; height: 44px; flex: none; }
html.ios.searching .tabbar, html.ios.searching .navbar { visibility: hidden; }
/* a list's own search field (iOS 27.3 references/ios/listsearch-*): hidden under the large title until the list is pulled down */
.search-drawer { height: 0; overflow: hidden; opacity: 0; transition: height .3s var(--ease), opacity .2s; }
.search-drawer.open { height: 48px; opacity: 1; }
.search-drawer .searchbar { margin: 2px 0 6px; }
.nb-group > .sel-btn { display: grid; place-items: center; width: 44px; height: 44px; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--text); }
.nb-group > .sel-btn svg { width: 21px; height: 21px; stroke-width: 2.1; }
/* Safari (iOS 26+) colours the area under its own bar from a solid FIXED element at the screen edge. The dimming layer is see-through and the sheet
   inside it is not looked at, so without this strip the page's colour shows below the sheet (purple under a customer form). It sits behind the sheet. */
html.ios .sheet-scrim::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 8px; z-index: -1; background: var(--sheet); }   /* from the first frame and never faded: Safari looks only once */
