/* Apple design language — web tokens and base styles. Drop into a project as-is; override --accent only if the
   brand has its own blue. Values are calibrated approximations of iOS/macOS system colors (Apple publishes
   roles, not hex), with matching dark values. */
:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --serif: ui-serif, "New York", Georgia, serif;

  --bg: #ffffff;            /* systemBackground */
  --bg-grouped: #f2f2f7;    /* systemGroupedBackground */
  --bg-2: #f2f2f7;          /* secondarySystemBackground */
  --bg-3: #ffffff;          /* tertiary / inset group on grouped bg */
  --fill: rgba(120,120,128,.20); --fill-2: rgba(120,120,128,.16); --fill-3: rgba(118,118,128,.12);
  /* Apple ships secondaryLabel at .60 and systemBlue at #007aff; both land near 3.3:1 on white,
     under WCAG AA for text. Deepened for light mode only — dark mode already clears AA. */
  --label: #000000; --label-2: rgba(60,60,67,.75); --label-3: rgba(60,60,67,.30); --label-4: rgba(60,60,67,.18);
  --separator: rgba(60,60,67,.29); --separator-opaque: #c6c6c8;
  --accent: #0068d6; --green: #34c759; --green-text: #1c7a33; --red-text: #d70015; --red: #ff3b30; --orange: #ff9500; --yellow: #ffcc00;
  --teal: #30b0c7; --indigo: #5856d6; --purple: #af52de; --pink: #ff2d55;
  --gray: #8e8e93; --gray-2: #aeaeb2; --gray-3: #c7c7cc; --gray-4: #d1d1d6; --gray-5: #e5e5ea; --gray-6: #f2f2f7;
  --material: rgba(255,255,255,.72); --material-thin: rgba(255,255,255,.60); --material-thick: rgba(255,255,255,.85);
  --shadow-float: 0 12px 40px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04);

  --r-control: 12px; --r-group: 10px; --r-card: 16px; --r-sheet: 14px; --r-pill: 980px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-11: 44px; --space-16: 64px;
  --ease: cubic-bezier(.2,.8,.2,1); --t-fast: 150ms; --t: 220ms; --t-slow: 350ms;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --bg-grouped: #000000; --bg-2: #1c1c1e; --bg-3: #1c1c1e;
    --fill: rgba(120,120,128,.36); --fill-2: rgba(120,120,128,.32); --fill-3: rgba(118,118,128,.24);
    --label: #ffffff; --label-2: rgba(235,235,245,.60); --label-3: rgba(235,235,245,.30); --label-4: rgba(235,235,245,.18);
    --separator: rgba(84,84,88,.60); --separator-opaque: #38383a;
    --accent: #0a84ff; --green: #30d158; --green-text: #30d158; --red-text: #ff6961; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a;
    --teal: #40c8e0; --indigo: #5e5ce6; --purple: #bf5af2; --pink: #ff375f;
    --gray-2: #636366; --gray-3: #48484a; --gray-4: #3a3a3c; --gray-5: #2c2c2e; --gray-6: #1c1c1e;
    --material: rgba(28,28,30,.72); --material-thin: rgba(28,28,30,.60); --material-thick: rgba(28,28,30,.85);
    --shadow-float: 0 12px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06);
  }
}

/* type scale (iOS). For macOS-density desktop UI set html { font-size: 13px } and scale the classes down. */
html { font: 17px/1.294 var(--font); -webkit-font-smoothing: antialiased; color: var(--label); background: var(--bg); }
.t-large-title { font-size: 34px; line-height: 41px; font-weight: 700; letter-spacing: -.02em; }
.t-title1 { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -.015em; }
.t-title2 { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.012em; }
.t-title3 { font-size: 20px; line-height: 25px; font-weight: 600; }
.t-headline { font-size: 17px; line-height: 22px; font-weight: 600; }
.t-body { font-size: 17px; line-height: 22px; }
.t-callout { font-size: 16px; line-height: 21px; }
.t-subhead { font-size: 15px; line-height: 20px; }
.t-footnote { font-size: 13px; line-height: 18px; }
.t-caption { font-size: 12px; line-height: 16px; }
.t-secondary { color: var(--label-2); }

/* materials */
.material { background: var(--material); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); }
.glass { /* Liquid Glass: one floating element per screen */
  background: var(--material-thin); -webkit-backdrop-filter: saturate(200%) blur(28px); backdrop-filter: saturate(200%) blur(28px);
  border-radius: var(--r-pill); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 1px 0 rgba(0,0,0,.05), 0 8px 30px rgba(0,0,0,.12); }

/* controls */
.btn { font: inherit; font-size: 17px; font-weight: 600; padding: 12px 20px; border: 0; border-radius: var(--r-control);
  background: var(--accent); color: #fff; cursor: pointer; min-height: 44px; transition: filter var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:active { transform: scale(.98); filter: brightness(.92); }
.btn.tinted { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.btn.plain { background: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn.pill { border-radius: var(--r-pill); }
.btn.destructive { background: var(--red); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 2px; }

.seg { display: inline-flex; background: var(--fill-3); border-radius: 9px; padding: 2px; }
.seg > * { font: inherit; font-size: 13px; font-weight: 500; padding: 5px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--label); cursor: pointer; }
.seg > .on { background: var(--bg-3); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }

.switch { appearance: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; cursor: pointer; transition: background var(--t) var(--ease); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.06); transition: transform var(--t) var(--ease); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }

.field { font: inherit; font-size: 17px; padding: 8px 12px; min-height: 36px; border: 0; border-radius: 10px; background: var(--fill-3); color: var(--label); width: 100%; }
.field::placeholder { color: var(--label-3); }

/* grouped inset list (Settings) */
.grouped { background: var(--bg-grouped); padding: var(--space-4); }
.group { background: var(--bg-3); border-radius: var(--r-group); overflow: hidden; }
.group .row { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 10px var(--space-4); color: var(--label); }
.group .row + .row { border-top: 1px solid var(--separator); margin-left: var(--space-4); padding-left: 0; }
.group .row .chev { margin-left: auto; color: var(--label-3); }
.group-footer { color: var(--label-2); font-size: 13px; line-height: 18px; padding: 6px var(--space-4) 0; }

/* bars */
.navbar { position: sticky; top: 0; z-index: 10; height: 52px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--separator); }
.navbar .title { font-size: 17px; font-weight: 600; }
.navbar .back { position: absolute; left: 8px; color: var(--accent); display: inline-flex; align-items: center; gap: 2px; }

/* sheet and alert */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-3); border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-float); padding: 8px var(--space-4) var(--space-6); }
.sheet::before { content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--fill); margin: 0 auto 12px; }
.alert { width: 270px; border-radius: 14px; background: var(--material-thick); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); text-align: center; overflow: hidden; }
.alert .body { padding: 20px 16px 16px; } .alert .title { font-size: 17px; font-weight: 600; } .alert .msg { font-size: 13px; color: var(--label-2); margin-top: 4px; }
.alert .actions { display: flex; border-top: 1px solid var(--separator); }
.alert .actions > * { flex: 1; padding: 11px; font: inherit; color: var(--accent); background: none; border: 0; }
.alert .actions > * + * { border-left: 1px solid var(--separator); }

@media (prefers-reduced-motion: reduce) { * { transition-duration: 1ms !important; animation: none !important; } }
