/* ============================================================
   RenewedOS — shell + shared UI · Renewed One phone
   Contract: brand-spec.md (baseline = user's FiveM screenshots;
   spacing / radius / motion DNA inherited from Premium DS).
   Sections: 1 tokens · 2 base · 3 stage/frame · 4 wallpaper
   5 shared UI · 6 statusbar · 7 lock · 8 home · 9 drawer
   10 shade/QS · 11 app host · 12 navbar · 13 overlays
   ============================================================ */

/* 1 · TOKENS ------------------------------------------------ */
:root {
  --bg: oklch(14% 0.012 255);
  --bg-deep: oklch(10% 0.01 255);
  --surface: oklch(23% 0.016 255 / 0.78);
  --surface-solid: oklch(21% 0.015 255);
  --surface-2: oklch(31% 0.018 255 / 0.85);
  --scrim: oklch(12% 0.012 255 / 0.82);
  --fg: oklch(96% 0.004 250);
  --fg-2: oklch(85% 0.008 250);
  --muted: oklch(66% 0.014 250);
  --border: oklch(100% 0 0 / 0.09);
  --border-soft: oklch(100% 0 0 / 0.05);
  --accent: oklch(83% 0.06 245);
  --accent-strong: oklch(72% 0.11 245);
  --accent-soft: oklch(83% 0.06 245 / 0.16);
  --accent-on: oklch(22% 0.03 250);
  --success: oklch(58% 0.1 155);
  --danger: oklch(62% 0.19 25);
  --violet: oklch(60% 0.1 300);

  --font-ui: "DM Sans", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  /* Premium DS DNA — spacing / radius / motion */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-12: 48px;
  --radius-sm: 10px; --radius-md: 16px; --radius-lg: 24px;
  --radius-xl: 30px; --radius-pill: 9999px;
  --motion-fast: 170ms; --motion-base: 280ms;
  --ease-standard: cubic-bezier(0.22, 1, 0.36, 1);
  --focus-ring: 0 0 0 2px var(--bg-deep), 0 0 0 4px var(--accent);

  --sb-h: 44px;      /* status bar */
  --nav-h: 0px;      /* gesture bar overlays app chrome; no reserved row */
  --gesture-h: 32px; /* generous click target for the visible indicator */
}

[data-accent="mint"]   { --accent: oklch(84% 0.1 165);  --accent-strong: oklch(72% 0.14 165); --accent-soft: oklch(84% 0.1 165 / 0.16); }
[data-accent="violet"] { --accent: oklch(80% 0.09 300); --accent-strong: oklch(69% 0.14 300); --accent-soft: oklch(80% 0.09 300 / 0.16); }
[data-accent="amber"]  { --accent: oklch(86% 0.1 85);   --accent-strong: oklch(77% 0.13 75);  --accent-soft: oklch(86% 0.1 85 / 0.16); }

[data-theme="light"] {
  --bg: oklch(96% 0.006 250);
  --bg-deep: oklch(92% 0.008 250);
  --surface: oklch(99% 0.002 250 / 0.8);
  --surface-solid: oklch(98% 0.003 250);
  --surface-2: oklch(92% 0.008 250 / 0.9);
  --scrim: oklch(95% 0.006 250 / 0.85);
  --fg: oklch(23% 0.015 255);
  --fg-2: oklch(36% 0.012 255);
  --muted: oklch(50% 0.012 255);
  --border: oklch(0% 0 0 / 0.1);
  --border-soft: oklch(0% 0 0 / 0.05);
  --accent: oklch(55% 0.13 250);
  --accent-strong: oklch(48% 0.15 250);
  --accent-soft: oklch(55% 0.13 250 / 0.14);
  --accent-on: oklch(98% 0.003 250);
}
[data-theme="light"][data-accent="mint"]   { --accent: oklch(52% 0.12 165); --accent-strong: oklch(45% 0.13 165); --accent-soft: oklch(52% 0.12 165 / 0.14); }
[data-theme="light"][data-accent="violet"] { --accent: oklch(52% 0.15 300); --accent-strong: oklch(45% 0.17 300); --accent-soft: oklch(52% 0.15 300 / 0.14); }
[data-theme="light"][data-accent="amber"]  { --accent: oklch(58% 0.13 70);  --accent-strong: oklch(50% 0.14 70);  --accent-soft: oklch(58% 0.13 70 / 0.14); }

/* 2 · BASE --------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--fg);
  background: oklch(11% 0.008 255);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; background: none; border: 0; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: 0.46; }
svg { display: block; }
button:focus-visible, a:focus-visible, .app:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }

/* 3 · STAGE + DEVICE FRAME ----------------------------------- */
.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(80% 60% at 50% 32%, oklch(16% 0.015 255), oklch(9% 0.008 255));
}
.fit { transition: transform var(--motion-base) var(--ease-standard); }
.phone {
  position: relative;
  width: 412px; height: 915px;
  border-radius: 47px;
  padding: 10px;
  background: linear-gradient(160deg, oklch(33% 0.008 255), oklch(17% 0.008 255));
  box-shadow: 0 40px 90px oklch(0% 0 0 / 0.55), inset 0 0 0 1.5px oklch(55% 0.01 255 / 0.35);
}
.side-btn {
  position: absolute; right: -3.5px; width: 3.5px;
  border-radius: 2px; background: oklch(45% 0.01 255);
  border: 0; padding: 0;
}
.side-btn.power { top: 252px; height: 68px; cursor: pointer; }
.side-btn.vol   { top: 152px; height: 84px; }
.screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 38px;
  overflow: hidden;
  background: var(--bg);
}
.punch {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  width: 15px; height: 15px; border-radius: 50%;
  background: oklch(6% 0 0);
  box-shadow: inset 0 0 3px oklch(32% 0.02 250), 0 0 0 2px oklch(0% 0 0 / 0.35);
  z-index: 90; pointer-events: none;
}
@media (max-width: 520px) {
  .stage { place-items: stretch; }
  .fit { transform: none !important; }
  .phone { width: 100%; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; background: none; }
  .screen { border-radius: 0; }
  .side-btn { display: none; }
}

/* 4 · WALLPAPER ---------------------------------------------- */
.wallpaper { position: absolute; inset: 0; z-index: 1; }
.wallpaper::before {
  content: ""; position: absolute; inset: 0; opacity: 0;
  background: oklch(96% 0.006 250 / 0.55);
  transition: opacity var(--motion-base);
}
[data-theme="light"] .wallpaper::before { opacity: 1; }
.wallpaper::after {
  content: ""; position: absolute; inset: 0;
  background-repeat: no-repeat; background-size: cover; background-position: center;
  opacity: 0.65;
}
[data-wallpaper="mesh"] .wallpaper {
  background:
    radial-gradient(120% 80% at 88% 6%, oklch(30% 0.05 210 / 0.55), transparent 55%),
    radial-gradient(150% 100% at 8% 100%, oklch(34% 0.07 200 / 0.5), transparent 60%),
    linear-gradient(180deg, oklch(13% 0.014 255), oklch(10% 0.012 240));
}
/* wallpaper artwork asset (SVG mesh waves) — color lives in the asset, not the UI palette */
[data-wallpaper="mesh"] .wallpaper::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 412 915' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%2366d9df' stroke-width='0.7'%3E%3Cpath stroke-opacity='.20' d='M-20 620 C 90 540 170 700 260 630 S 430 560 440 615'/%3E%3Cpath stroke-opacity='.16' d='M-20 650 C 90 570 175 730 265 660 S 430 590 440 645'/%3E%3Cpath stroke-opacity='.13' d='M-20 685 C 95 605 180 765 270 695 S 430 625 440 680'/%3E%3Cpath stroke-opacity='.10' d='M-20 725 C 95 645 185 800 275 730 S 430 665 440 720'/%3E%3Cpath stroke-opacity='.08' d='M-20 770 C 100 690 190 845 280 775 S 430 710 440 765'/%3E%3Cpath stroke-opacity='.06' d='M-20 820 C 100 740 195 890 285 825 S 430 760 440 815'/%3E%3Cpath stroke-opacity='.12' d='M180 60 C 250 110 320 70 430 150'/%3E%3Cpath stroke-opacity='.09' d='M200 30 C 275 85 340 45 435 115'/%3E%3Cpath stroke-opacity='.06' d='M230 5 C 300 60 360 25 438 80'/%3E%3C/g%3E%3C/svg%3E");
}
[data-wallpaper="dusk"] .wallpaper {
  background: linear-gradient(205deg, oklch(30% 0.06 280), oklch(15% 0.03 265) 48%, oklch(24% 0.07 45) 115%);
}
[data-wallpaper="carbon"] .wallpaper {
  background:
    radial-gradient(100% 70% at 50% 0%, oklch(17% 0.008 255), transparent 70%),
    repeating-linear-gradient(135deg, oklch(14.5% 0.006 255) 0 3px, oklch(12.5% 0.006 255) 3px 6px);
}
[data-wallpaper="vice"] .wallpaper {
  background: linear-gradient(215deg, oklch(38% 0.09 200), oklch(17% 0.05 290) 58%, oklch(32% 0.1 335));
}

/* 5 · SHARED UI (used by shell AND system apps) --------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--fg-2);
  transition: background var(--motion-fast), transform var(--motion-fast);
}
.icon-btn:active { background: var(--accent-soft); transform: scale(0.92); }
.icon-btn svg { width: 19px; height: 19px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--violet); color: oklch(98% 0.003 250);
  font-weight: 700; font-size: 16px; flex: none;
}
.row { display: flex; align-items: center; gap: var(--space-4); padding: 14px var(--space-4); min-height: 56px; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--border-soft); }
.row .r-ic {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: var(--surface-2); color: var(--fg-2);
  display: grid; place-items: center;
}
.row .r-ic svg { width: 19px; height: 19px; }
.row .r-body { flex: 1; min-width: 0; }
.row .r-title { font-weight: 600; font-size: 15px; }
.row .r-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row .r-end { color: var(--muted); flex: none; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.row .r-end svg { width: 17px; height: 17px; }
.row.is-disabled { opacity: 0.45; pointer-events: none; }
button.row { transition: background var(--motion-fast); border-radius: 0; }
button.row:active { background: var(--accent-soft); }

.switch { position: relative; width: 46px; height: 27px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 2; }
.switch .tr {
  position: absolute; inset: 0; border-radius: var(--radius-pill);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background var(--motion-fast), border-color var(--motion-fast);
}
.switch .tr::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--muted);
  transition: transform var(--motion-base) var(--ease-standard), background var(--motion-fast);
}
.switch input:checked + .tr { background: var(--accent); border-color: transparent; }
.switch input:checked + .tr::after { transform: translateX(19px); background: var(--accent-on); }
.switch input:focus-visible + .tr { box-shadow: var(--focus-ring); }

.range {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 32px; border-radius: var(--radius-pill);
  background:
    linear-gradient(var(--accent), var(--accent)) 0 / var(--val, 60%) 100% no-repeat,
    var(--surface-2);
  border: 1px solid var(--border-soft);
  outline: none; cursor: pointer;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 4px; height: 18px; border-radius: 2px;
  background: var(--fg); opacity: 0.85;
}
.range::-moz-range-thumb { width: 4px; height: 18px; border-radius: 2px; background: var(--fg); border: 0; }
.range:focus-visible { box-shadow: var(--focus-ring); }

/* 6 · STATUS BAR --------------------------------------------- */
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; height: var(--sb-h);
  z-index: 66;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  font-size: 14.5px; font-weight: 600; color: var(--fg);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  touch-action: none;
  width: 100%; text-align: left;
}
.sb-right { display: flex; align-items: center; gap: 7px; }
.sb-right svg { width: 15px; height: 15px; }
.sb-ic { display: block; }
.sb-ic.off { display: none; }
.batt {
  font-size: 10.5px; font-weight: 700;
  background: var(--fg); color: var(--bg);
  padding: 2px 5.5px; border-radius: 6px; line-height: 1;
}

/* 7 · LOCK SCREEN --------------------------------------------- */
.lock {
  position: absolute; inset: 0; z-index: 70;
  display: flex; flex-direction: column; align-items: center;
  padding: 68px 24px 26px;
  background: oklch(0% 0 0 / 0.18);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: transform 0.45s var(--ease-standard), opacity 0.4s;
  touch-action: none;
}
.screen:not(.is-locked) .lock { transform: translateY(-103%); opacity: 0; pointer-events: none; visibility: hidden; }
.lock-pill {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-soft);
  color: var(--fg-2);
}
.lock-pill svg { width: 15px; height: 15px; }
.lock-clock {
  font-size: 98px; font-weight: 700; line-height: 0.92;
  letter-spacing: -0.02em; text-align: center; margin-top: 24px;
}
.lock-date { margin-top: 16px; font-size: 15.5px; font-weight: 600; color: var(--fg-2); }
.lock-chips { display: flex; gap: 12px; margin-top: 26px; }
.lock-chip {
  position: relative;
  width: 64px; height: 64px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border-soft);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--fg);
}
.lock-chip svg { width: 19px; height: 19px; }
.lock-chip span { font-size: 9.5px; font-weight: 600; color: var(--fg-2); }
.lock-chip .badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 17px; height: 17px; border-radius: 9px;
  background: var(--accent); color: var(--accent-on);
  font-size: 10.5px; font-weight: 700;
  display: grid; place-items: center; padding: 0 4px;
}
.lock-foot {
  margin-top: auto;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: var(--fg-2); font-size: 13.5px; font-weight: 600;
  padding-bottom: 50px;
}
.lock-foot svg { width: 16px; height: 16px; animation: hint-bob 2.2s var(--ease-standard) 4; /* capped loop — WCAG 2.2.2, no indefinite ambient motion */ }
@keyframes hint-bob { 0%, 100% { transform: translateY(2px); opacity: 0.6; } 50% { transform: translateY(-3px); opacity: 1; } }
.lock-corners {
  position: absolute; bottom: 26px; left: 26px; right: 26px;
  display: flex; justify-content: space-between;
}
.lock-corners .icon-btn { width: 50px; height: 50px; background: var(--surface); }

/* 8 · HOME ---------------------------------------------------- */
.home {
  position: absolute; inset: 0; z-index: 20;
  padding: calc(var(--sb-h) + 12px) 16px 0;
  display: flex; flex-direction: column; gap: 16px;
  touch-action: none;
}
.weather { padding: 18px 20px 14px; }
.w-top { display: flex; align-items: flex-start; justify-content: space-between; }
.w-left { display: flex; align-items: flex-start; gap: 12px; }
.w-temp { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; }
.w-city { font-size: 15px; font-weight: 600; margin-top: 4px; }
.w-cond { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.w-glyph { color: var(--fg-2); }
.w-glyph svg { width: 30px; height: 30px; }
.w-hours {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border-soft);
  margin-top: 14px; padding-top: 12px; text-align: center;
}
.w-h span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.w-h svg { width: 16px; height: 16px; margin: 5px auto 4px; color: var(--fg-2); }
.w-h b { font-size: 13px; font-weight: 600; }
.search-pill {
  display: flex; align-items: center; gap: 12px;
  height: 48px; flex: none; width: 100%;
  border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border-soft);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 0 18px;
  color: var(--muted); font-size: 15px; font-weight: 500;
}
.search-pill svg { width: 18px; height: 18px; }
.search-pill .grow { flex: 1; text-align: left; }
.app-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  row-gap: 16px; column-gap: 8px;
}
.app { display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; transition: transform var(--motion-fast); }
.app:active { transform: scale(0.9); }
.app-ic {
  width: 61px; height: 61px; border-radius: 21px;
  background: var(--surface-solid);
  border: 1px solid var(--border-soft);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px oklch(0% 0 0 / 0.25);
}
.app-ic svg { width: 26px; height: 26px; }
.app-ic .mono { display: grid; place-items: center; }
.app-ic svg.art { width: 37px; height: 37px; }
.app-name {
  font-size: 11.5px; font-weight: 500; color: var(--fg-2);
  max-width: 78px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.up-hint { margin-top: auto; align-self: center; color: var(--muted); padding-bottom: 116px; }
.up-hint svg { width: 18px; height: 18px; }
.dock {
  position: absolute; left: 14px; right: 14px;
  bottom: calc(var(--gesture-h) + 10px);
  height: 86px; z-index: 22;
  border-radius: var(--radius-xl);
  background: var(--surface); border: 1px solid var(--border-soft);
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  display: grid; grid-template-columns: repeat(4, 1fr); place-items: center;
}
.dock .app-name { display: none; }
.dock .app-ic { box-shadow: none; background: var(--surface-2); }

/* 9 · APP DRAWER ---------------------------------------------- */
.drawer {
  position: absolute; inset: 0; z-index: 50;
  background: var(--scrim);
  backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px);
  padding: calc(var(--sb-h) + 10px) 16px 0;
  display: flex; flex-direction: column; gap: 16px;
  transform: translateY(103%);
  visibility: hidden;
  transition: transform 0.38s var(--ease-standard), visibility 0s linear 0.38s;
}
.drawer.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.drawer-search {
  display: flex; align-items: center; gap: 12px;
  height: 48px; flex: none;
  border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border-soft);
  padding: 0 18px; color: var(--muted);
}
.drawer-search svg { width: 18px; height: 18px; flex: none; }
.drawer-search input { flex: 1; outline: none; color: var(--fg); font-size: 15px; }
.drawer-search input::placeholder { color: var(--muted); }
.drawer-search:focus-within { box-shadow: var(--focus-ring); border-color: transparent; }
.drawer-grid {
  flex: 1; overflow-y: auto; align-content: start;
  display: grid; grid-template-columns: repeat(4, 1fr);
  row-gap: 18px; column-gap: 8px;
  padding-bottom: calc(var(--gesture-h) + 16px);
  scrollbar-width: none;
}
.drawer-grid::-webkit-scrollbar { display: none; }
.drawer-empty { grid-column: 1 / -1; text-align: center; color: var(--muted); font-size: 14px; padding-top: 40px; }

/* 10 · SHADE + QUICK SETTINGS --------------------------------- */
.shade {
  position: absolute; inset: 0; z-index: 55;
  background: var(--scrim);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  transform: translateY(-103%);
  visibility: hidden;
  transition: transform 0.4s var(--ease-standard), visibility 0s linear 0.4s;
  display: flex; flex-direction: column;
  padding: calc(var(--sb-h) + 6px) 16px 0;
}
.shade.is-open { transform: none; visibility: visible; transition-delay: 0s; }
.shade-scroll {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: calc(var(--gesture-h) + 18px);
  scrollbar-width: none;
}
.shade-scroll::-webkit-scrollbar { display: none; }
.shade-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 0; }
.shade-num { font-size: 15px; font-weight: 700; transition: filter var(--motion-fast); }
.shade-num.blurred { filter: blur(7px); }
.shade-actions { display: flex; gap: 10px; }
.shade-actions .icon-btn { width: 38px; height: 38px; }
.qs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 8px; padding: 4px 0; }
.qs-tile { display: flex; flex-direction: column; align-items: center; gap: 7px; }
.qs-b {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-soft);
  display: grid; place-items: center; color: var(--fg-2);
  transition: background var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
}
.qs-b svg { width: 22px; height: 22px; }
.qs-tile:active .qs-b { transform: scale(0.9); }
.qs-tile[aria-pressed="true"] .qs-b { background: var(--accent); color: var(--accent-on); border-color: transparent; }
.qs-tile > span {
  font-size: 10.5px; font-weight: 500; color: var(--fg-2);
  max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slider-row { display: flex; align-items: center; gap: 12px; color: var(--fg-2); }
.slider-row svg { width: 19px; height: 19px; flex: none; }
.shade .card .row .r-ic { border-radius: 50%; }
.notif-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 2px 6px 0;
  color: var(--muted); font-size: 12.5px; font-weight: 600;
}
.notif-head button { color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 4px 8px; }
.n-app { font-size: 11px; color: var(--muted); font-weight: 600; }
.n-title { font-size: 14px; font-weight: 600; margin-top: 1px; }
.n-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.n-empty { padding: 22px; text-align: center; color: var(--muted); font-size: 13.5px; }
.n-x { width: 30px; height: 30px; background: transparent; border-color: transparent; flex: none; }

/* 11 · APP HOST ----------------------------------------------- */
.apphost {
  position: absolute; inset: 0; z-index: 45;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transform: scale(0.982);
  visibility: hidden;
  transition: opacity 220ms ease, transform 260ms var(--ease-standard), visibility 0s linear 260ms;
}
.apphost.is-open { opacity: 1; pointer-events: auto; transform: none; visibility: visible; transition-delay: 0s; }
.apphost iframe {
  width: 100%; height: 100%; border: 0; display: block;
  background: var(--bg); opacity: 1;
  transition: opacity var(--motion-fast);
}
.apphost.is-loading iframe,
.apphost.is-error iframe { opacity: 0; }
.app-state {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: var(--space-8); color: var(--fg-2); text-align: center;
  font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity var(--motion-fast);
}
.apphost.is-loading .app-state,
.apphost.is-error .app-state { opacity: 1; pointer-events: auto; }
.app-state-spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: app-spin 0.8s linear infinite;
}
.apphost.is-error .app-state-spinner { display: none; }
.app-retry {
  min-width: 112px; min-height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-pill); background: var(--surface-2);
  border: 1px solid var(--border); color: var(--fg);
  font-size: 13.5px; font-weight: 600;
}
@keyframes app-spin { to { transform: rotate(1turn); } }

/* 12 · NAV BAR ------------------------------------------------ */
.navbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 24px;
  z-index: 58;
  display: flex; align-items: flex-end; justify-content: center;
  color: var(--fg-2);
  background: transparent;
  transition: opacity var(--motion-base);
}
.home-gesture {
  width: 104px; height: 24px; margin-bottom: 0;
  display: grid; place-items: center;
  border-radius: var(--radius-pill);
  color: inherit; background: transparent;
}
.home-gesture span {
  width: 76px; height: 3px; border-radius: var(--radius-pill);
  background: currentColor;
  opacity: 0.88;
  transition: width var(--motion-fast), opacity var(--motion-fast), transform 120ms;
}
.home-gesture:active span { width: 68px; opacity: 1; transform: scaleY(1.15); }
.screen.is-locked .navbar { opacity: 0; pointer-events: none; }

/* 13 · OVERLAYS ----------------------------------------------- */
.toast {
  position: absolute; left: 50%; bottom: calc(var(--gesture-h) + 66px);
  transform: translateX(-50%) translateY(10px);
  z-index: 82;
  background: var(--surface-2); border: 1px solid var(--border);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--fg);
  padding: 11px 18px; border-radius: var(--radius-pill);
  font-size: 13.5px; font-weight: 500;
  max-width: 320px; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.3s var(--ease-standard);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.dim { position: absolute; inset: 0; z-index: 86; background: oklch(0% 0 0); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.flash {
  position: absolute; inset: 0 0 auto 0; height: 42%;
  z-index: 85; pointer-events: none; opacity: 0;
  background: radial-gradient(80% 100% at 50% 0%, oklch(100% 0 0 / 0.26), transparent 70%);
  transition: opacity 0.3s;
}
.flash.on { opacity: 1; }

/* System-app chrome (inside iframes; os.css is shared) -------- */
.app-body {
  background: var(--bg); color: var(--fg);
  font-family: var(--font-ui);
  height: 100dvh; overflow: hidden; position: relative;
}
.app-body .card { overflow: clip; }
.app-page {
  position: absolute; inset: 0;
  background: var(--bg);
  padding: calc(var(--sb-h) + 12px) 16px calc(var(--gesture-h) + 18px);
  overflow-y: auto; scrollbar-width: none;
  transform: translateX(100%);
  transition: transform 0.32s var(--ease-standard);
}
.app-page::-webkit-scrollbar { display: none; }
.app-page.is-root { transform: none; }
.app-page.is-on { transform: none; }
.page-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 14px; }
.page-head .icon-btn { width: 38px; height: 38px; background: transparent; border-color: transparent; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.app-title { font-size: 30px; font-weight: 700; letter-spacing: -0.01em; margin: 18px 6px 20px; }
.group-label { font-size: 12px; font-weight: 700; color: var(--accent); margin: 18px 8px 8px; letter-spacing: 0.02em; }

/* 14 · ACCESSIBILITY + POINTER STATES ------------------------ */
#statusbar:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }

/* Desktop pointer hover affordances — touch devices are unaffected */
@media (hover: hover) {
  .icon-btn:hover { background: var(--accent-soft); color: var(--fg); }
  button.row:hover { background: var(--accent-soft); }
  .home-gesture:hover span { opacity: 1; }
  .app:hover .app-ic,
  .qs-tile:hover .qs-b,
  .lock-chip:hover,
  .search-pill:hover,
  .drawer-search:hover { border-color: var(--accent); }
}

/* Short viewports (full-bleed on small phones): keep the grid clear of the dock */
@media (max-width: 520px) and (max-height: 740px) {
  .home { gap: 10px; padding-top: calc(var(--sb-h) + 6px); }
  .weather { padding: 12px 16px 10px; }
  .w-temp { font-size: 38px; }
  .w-hours { margin-top: 10px; padding-top: 9px; }
  .app-grid { row-gap: 12px; }
  .up-hint { display: none; }
}

/* Respect reduced-motion: stop the looping unlock hint + on-axis transitions */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .lock-foot svg { animation: none; }
}
