  /* ===== Apple HIG pass 2 (Nov 2026): consistent corners, iPad/Fold sidebar, bottom sheets, grouped lists, light mode ===== */
  :root { --r-ctl: 12px; --r-card: 20px; }

  /* 7: iPad, open Fold and small laptops get the sidebar too (it used to start at 1100px) */
  @media (min-width: 768px) and (max-width: 1099px) {
    body { padding-bottom: 24px; }
    main { max-width: none; margin: 0 0 0 112px; padding: 22px 28px 32px 16px; }
    nav.tabs { left: 14px; right: auto; top: 50%; bottom: auto; transform: translateY(-50%); width: 84px; flex-direction: column; gap: 6px; padding: 8px; border-radius: 24px; }
    nav.tabs button { flex: none; padding: 13px 0 10px; font-size: 11px; gap: 6px; }
    nav.tabs .beam { top: 0; bottom: auto; left: 8px; right: 8px; width: auto !important; }
    nav.tabs .beam::before { top: 25%; bottom: 25%; left: -1px; right: auto; width: 2px; height: auto; }
    #dlg .card { width: min(520px, 100%); }
  }

  /* 8: popups slide up from the bottom on a phone, with a grab handle (like Apple Maps) */
  @media (max-width: 599px) {
    #dlg, #ask { align-items: end !important; place-items: end center !important; padding: calc(16px + env(safe-area-inset-top)) 0 0 !important; }
    #ask .card { position: relative; width: 100% !important; max-width: 100% !important; border-radius: 22px 22px 0 0 !important; padding-top: 28px !important;
                 padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important; animation: zxsheet .28s cubic-bezier(.2, .8, .2, 1) !important; }
    #ask .card::before { content: ""; position: absolute; top: 9px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(150, 170, 190, .45); }
    #dlg .card { position: relative; width: 100% !important; max-width: 100% !important; border-radius: 22px 22px 0 0 !important; padding-top: 28px !important;
                 padding-bottom: calc(18px + env(safe-area-inset-bottom)) !important; max-height: calc(100dvh - 40px - env(safe-area-inset-top)) !important;
                 animation: zxsheet .28s cubic-bezier(.2, .8, .2, 1); }
    #dlg .card::before { content: ""; position: absolute; top: 9px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(150, 170, 190, .45); }
  }
  @keyframes zxsheet { from { transform: translateY(40px); opacity: .4; } }

  /* 8: Control center rows grouped like the iPhone Settings app */
  #view-settings .card.set-row { border-radius: 0 !important; margin-top: 0 !important; margin-bottom: 0 !important; box-shadow: none !important; position: relative; }
  #view-settings .card.set-row + .card.set-row::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: 1px; background: var(--line); }
  #view-settings :not(.card.set-row) + .card.set-row { border-top-left-radius: var(--r-card) !important; border-top-right-radius: var(--r-card) !important; }
  #view-settings .card.set-row:not(:has(+ .card.set-row)) { border-bottom-left-radius: var(--r-card) !important; border-bottom-right-radius: var(--r-card) !important; margin-bottom: 8px !important; }
  .zx-theme { flex: none; min-width: 210px; } .zx-theme button { min-height: 36px; font-size: 13px !important; }

  /* 5: consistent corners on the common pieces */
  input, select, textarea { border-radius: var(--r-ctl); }
  .card, .list-item, .zx-stat, .zx-tile, .zx-group { border-radius: var(--r-card); }

  /* 6: light mode */
  html[data-theme="light"] { color-scheme: light; background: #f2f4f8; }
  html[data-theme="light"] body {
    --bg: #f2f4f8; --bg2: #ffffff; --panel: #ffffff; --panel-solid: #ffffff;
    --line: rgba(15, 40, 80, .10); --line-strong: rgba(20, 70, 160, .28);
    --text: #0b1726; --muted: #5b6b7f; --faint: #8794a6;
    --accent: #0a6cff; --accent-2: #3b5bdb; --accent-text: #ffffff; --violet: #6e56cf; --orange: #c2410c;
    --grad: linear-gradient(120deg, #0891b2 0%, #2563eb 55%, #6e56cf 100%);
    --ok: #15a34a; --danger: #e5484d; --warn-c: #c27803; --glow: none; --glow-strong: none;
    --zx1: #0891b2; --zx2: #2563eb; --zx3: #6e56cf; --zx1-rgb: 8, 145, 178; --zx2-rgb: 37, 99, 235; --zx-red: #e5484d;
    color: var(--text);
    background: radial-gradient(900px 520px at 50% -12%, rgba(37, 99, 235, .10), transparent 62%), radial-gradient(600px 480px at 110% 70%, rgba(110, 86, 207, .07), transparent 62%), #f2f4f8 !important;
  }
  html[data-theme="light"] body.recording { --zx1: #f43f5e; --zx2: #e11d48; --zx3: #fb7185; --zx1-rgb: 244, 63, 94; --zx2-rgb: 225, 29, 72;
    --accent: #e11d48; --accent-2: #be123c; --grad: linear-gradient(120deg, #fb7185 0%, #e11d48 55%, #f43f5e 100%); --line-strong: rgba(225, 29, 72, .35); }
  html[data-theme="light"] body::before { opacity: .25; }
  html[data-theme="light"] body.recording::after { background: radial-gradient(900px 600px at 80% -10%, rgba(244, 63, 94, .12), transparent 70%); }
  html[data-theme="light"] .card, html[data-theme="light"] .list-item, html[data-theme="light"] .swipe .swcard, html[data-theme="light"] .swipe .person,
  html[data-theme="light"] .zx-stat, html[data-theme="light"] .zx-group, html[data-theme="light"] .msg.assistant, html[data-theme="light"] .slashmenu,
  html[data-theme="light"] .achip, html[data-theme="light"] .cseg, html[data-theme="light"] #gWorkStatus, html[data-theme="light"] .dlgx, html[data-theme="light"] .mebtn,
  html[data-theme="light"] .gen-del, html[data-theme="light"] .gen-save, html[data-theme="light"] .gen-copy {
    background: #ffffff !important; border-color: var(--line) !important; color: var(--text);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .05) !important; }
  html[data-theme="light"] .card::before, html[data-theme="light"] .card::after { opacity: .35; }
  html[data-theme="light"] nav.tabs { background: rgba(255, 255, 255, .88) !important; border-color: var(--line) !important; box-shadow: 0 8px 30px rgba(15, 23, 42, .12) !important; }
  html[data-theme="light"] nav.tabs button { color: #8794a6 !important; }
  html[data-theme="light"] nav.tabs button.active { color: var(--accent) !important; }
  html[data-theme="light"] nav.tabs .beam { background: rgba(37, 99, 235, .08) !important; box-shadow: inset 0 0 0 1px rgba(37, 99, 235, .22) !important; }
  html[data-theme="light"] input, html[data-theme="light"] select, html[data-theme="light"] textarea { background: #ffffff !important; color: var(--text) !important; border-color: rgba(15, 40, 80, .16) !important; }
  html[data-theme="light"] input::placeholder, html[data-theme="light"] textarea::placeholder { color: #8794a6; }
  html[data-theme="light"] #dlg { background: rgba(15, 23, 42, .32) !important; }
  html[data-theme="light"] button.ghost, html[data-theme="light"] .ghost { background: #ffffff !important; color: var(--accent) !important; border-color: rgba(20, 70, 160, .2) !important; }
  html[data-theme="light"] .status { background: rgba(21, 163, 74, .08) !important; color: #15803d !important; border-color: rgba(21, 163, 74, .25) !important; }
  html[data-theme="light"] .zx-tile { background: radial-gradient(120% 90% at 85% 90%, color-mix(in srgb, var(--c) 16%, transparent), transparent 60%), #ffffff !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 18px rgba(15, 23, 42, .05) !important; }
  html[data-theme="light"] .zx-tile .ic { background: color-mix(in srgb, var(--c) 12%, #fff); }
  html[data-theme="light"] .zx-row .rt small, html[data-theme="light"] .zx-stat span { color: var(--muted); }
  html[data-theme="light"] h1, html[data-theme="light"] h2 { text-shadow: none !important; }
  html[data-theme="light"] .seg-choice button { background: rgba(37, 99, 235, .06); }
  /* the home hero stays a dark "widget" in light mode so the RECORD circle and galaxy still glow */
  html[data-theme="light"] .zx-hero { --text: #eaf8ff; --muted: #93adc2; --faint: #5f7a90; --line: rgba(120, 220, 255, .13); --line-strong: rgba(120, 220, 255, .38);
    --zx1: #5ef1ff; --zx2: #4f8bff; --zx3: #a993ff; --zx1-rgb: 94, 241, 255; --zx2-rgb: 79, 139, 255; --accent: #5ef1ff;
    color: var(--text); background: linear-gradient(180deg, #0a182a, #050c18) !important; box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
  html[data-theme="light"] body.recording .zx-hero { --zx1: #ff8fa3; --zx2: #ff3b5c; --zx3: #ff6b81; --zx1-rgb: 255, 143, 163; --zx2-rgb: 255, 59, 92; --accent: #ff6b81; }
  html[data-theme="light"] .zx-hero input { background: none !important; color: var(--text) !important; }
  html[data-theme="light"] .zx-hero .card { background: none !important; box-shadow: none !important; border: 0 !important; }
  html[data-theme="light"] #ask { background: rgba(15, 23, 42, .32) !important; }
  html[data-theme="light"] button.on:not(.zx-chip):not(.achip), html[data-theme="light"] .seg-choice button.on { background: var(--accent) !important; color: #fff !important; border-color: transparent !important; box-shadow: none !important; }
  html[data-theme="light"] button.on:not(.zx-chip):not(.achip) * { color: #fff !important; }

