/* darkmode1 (Phil 19.09 «ночной режим как в iPhone»): one hue table, two skies.
   Light is the default below; [data-theme=dark] and the auto media query carry
   the system dark palette — elevated grays #1c1c1e/#2c2c2e, lifted accents
   (#0a84ff blue), glass turns charcoal. Family hues live here ONCE so every
   wash/accent flips with the theme (widget-presentation sets var() references). */
:root{
 --acc-indigo:#5856d6;--acc-purple:#af52de;--acc-blue:#007aff;--acc-pink:#ff2d55;--acc-green:#34c759;--acc-mint:#00c7be;--acc-orange:#ff9500;
 --wash-indigo:#f2f1fb;--wash-purple:#f9f0fd;--wash-blue:#edf5ff;--wash-pink:#fff0f4;--wash-green:#eaf8ef;--wash-mint:#e6f8f7;--wash-orange:#fff4e5;
 --sky-a:#eef1f5;--sky-b:#fdfdfe;--sky-c:#f3f5f8;
 --surface:#ffffff;--surface-2:#f9fafc;--glass:rgba(255,255,255,.55);--glass-2:rgba(255,255,255,.72);--glass-line:rgba(255,255,255,.65);
 --ink:#1d1d1f;--ink-2:#636366;--ink-3:#8e8e93;--chip:#f2f2f7;--sep:#e5e5ea;--accent:#007aff;--danger:#ff3b30;
 /* канон-фундамент 1M (HIG): рампа macOS typography.md:173-195 · SF-трекинг
    :237-363 (точные pt-значения, 26→+0.22 сверено по корпусу) · LG-стекло
    materials.md:19-23 · элевация — одна тонировка, 3 уровня. Потребители
    переезжают волнами 2-6; здесь только истина. */
 --fs-11:11px;--fs-12:12px;--fs-13:13px;--fs-15:15px;--fs-17:17px;--fs-20:20px;--fs-22:22px;--fs-26:26px;--fs-34:34px;--fs-40:40px;
 --tr-11:.066px;--tr-12:0;--tr-13:-.08px;--tr-15:-.24px;--tr-17:-.43px;--tr-20:-.45px;--tr-22:-.26px;--tr-26:.22px;--tr-34:.4px;--tr-40:.37px;
 --glass-blur:28px;--glass-blur-clear:16px;
 --scrim:rgba(36,48,70,.26);
 --hairline:inset 0 0 0 .5px rgba(120,120,128,.16);
 --shadow-1:0 1px 2px rgba(30,48,74,.08),0 0 1px rgba(30,48,74,.05);
 --shadow-2:0 8px 22px rgba(30,48,74,.12),0 2px 6px rgba(30,48,74,.07);
 --shadow-3:0 22px 56px rgba(30,48,74,.16),0 6px 14px rgba(30,48,74,.08);
}
[data-theme=dark]{
 --acc-indigo:#5e5ce6;--acc-purple:#bf5af2;--acc-blue:#0a84ff;--acc-pink:#ff375f;--acc-green:#30d158;--acc-mint:#66d4cf;--acc-orange:#ff9f0a;
 --wash-indigo:#2a2943;--wash-purple:#3a2450;--wash-blue:#0d2b4e;--wash-pink:#451525;--wash-green:#12351d;--wash-mint:#0e3634;--wash-orange:#41280a;
 --sky-a:#0a0a0d;--sky-b:#16161a;--sky-c:#101014;
 --surface:#1c1c1e;--surface-2:#242428;--glass:rgba(28,28,30,.62);--glass-2:rgba(36,36,40,.78);--glass-line:rgba(255,255,255,.14);
 --ink:#f5f5f7;--ink-2:#c7c7cc;--ink-3:#8e8e93;--chip:#2c2c2e;--sep:#38383a;--accent:#0a84ff;--danger:#ff453a;
 --fs-11:11px;--fs-12:12px;--fs-13:13px;--fs-15:15px;--fs-17:17px;--fs-20:20px;--fs-22:22px;--fs-26:26px;--fs-34:34px;--fs-40:40px;
 --tr-11:.066px;--tr-12:0;--tr-13:-.08px;--tr-15:-.24px;--tr-17:-.43px;--tr-20:-.45px;--tr-22:-.26px;--tr-26:.22px;--tr-34:.4px;--tr-40:.37px;
 --glass-blur:28px;--glass-blur-clear:16px;
 --scrim:rgba(0,0,0,.5);
 --hairline:inset 0 0 0 .5px rgba(255,255,255,.09);
 --shadow-1:0 1px 2px rgba(0,0,0,.30),0 0 1px rgba(0,0,0,.2);
 --shadow-2:0 8px 22px rgba(0,0,0,.38),0 2px 6px rgba(0,0,0,.22);
 --shadow-3:0 22px 56px rgba(0,0,0,.46),0 6px 14px rgba(0,0,0,.26);
}
@media(prefers-color-scheme:dark){
 :root:not([data-theme=light]){
  --acc-indigo:#5e5ce6;--acc-purple:#bf5af2;--acc-blue:#0a84ff;--acc-pink:#ff375f;--acc-green:#30d158;--acc-mint:#66d4cf;--acc-orange:#ff9f0a;
  --wash-indigo:#2a2943;--wash-purple:#3a2450;--wash-blue:#0d2b4e;--wash-pink:#451525;--wash-green:#12351d;--wash-mint:#0e3634;--wash-orange:#41280a;
  --sky-a:#0a0a0d;--sky-b:#16161a;--sky-c:#101014;
  --surface:#1c1c1e;--surface-2:#242428;--glass:rgba(28,28,30,.62);--glass-2:rgba(36,36,40,.78);--glass-line:rgba(255,255,255,.14);
  --ink:#f5f5f7;--ink-2:#c7c7cc;--ink-3:#8e8e93;--chip:#2c2c2e;--sep:#38383a;--accent:#0a84ff;--danger:#ff453a;
  --fs-11:11px;--fs-12:12px;--fs-13:13px;--fs-15:15px;--fs-17:17px;--fs-20:20px;--fs-22:22px;--fs-26:26px;--fs-34:34px;--fs-40:40px;
 --tr-11:.066px;--tr-12:0;--tr-13:-.08px;--tr-15:-.24px;--tr-17:-.43px;--tr-20:-.45px;--tr-22:-.26px;--tr-26:.22px;--tr-34:.4px;--tr-40:.37px;
 --glass-blur:28px;--glass-blur-clear:16px;
 --scrim:rgba(0,0,0,.5);
 --hairline:inset 0 0 0 .5px rgba(255,255,255,.09);
 --shadow-1:0 1px 2px rgba(0,0,0,.30),0 0 1px rgba(0,0,0,.2);
 --shadow-2:0 8px 22px rgba(0,0,0,.38),0 2px 6px rgba(0,0,0,.22);
 --shadow-3:0 22px 56px rgba(0,0,0,.46),0 6px 14px rgba(0,0,0,.26);
 }
}

/* — Сфера под тему — */
#stage{background:linear-gradient(180deg,var(--sky-a) 0%,var(--sky-b) 52%,var(--sky-c) 100%)}
.tile{border-color:var(--surface);background:linear-gradient(165deg,var(--surface),var(--surface-2));box-shadow:0 2px 4px rgba(0,0,0,.06),0 18px 35px rgba(0,0,0,.12),inset 0 1px 0 var(--glass-line),inset 0 0 0 1px rgba(120,120,128,.08),var(--near-shadow)}
.tile h3,.sw-title,.sw-excerpt,.sw-row-text,#stage .tile button.sw-related-row{color:var(--ink)}
.tile p,.sw-label,.sw-meta,.sw-origin,.sw-format,.sw-index,.sw-section-label{color:var(--ink-2)}
.tile .micro,.variety-card{color:var(--ink)}

/* — Чат: острова-хром и пузыри — */
.lenin-chat{--lc-ink:var(--ink);--lc-secondary:var(--ink-2);--lc-accent:var(--accent);color:var(--ink)}
/* lg5b: окно переписки = материал окна macOS 26 — сцена мягко просвечивает,
   хром (шапка) плотнее стекла над скроллом (канон «окно над столом») */
.lc-panel{background:color-mix(in srgb,var(--surface) 86%,transparent);backdrop-filter:blur(40px) saturate(var(--lg-sat));-webkit-backdrop-filter:blur(40px) saturate(var(--lg-sat))}
.lc-header{background:var(--glass)}
[data-theme=dark] .lc-header{background:var(--glass)}
[data-theme=dark] .lc-act-menu{background:var(--glass-2)}
.lc-composer{border-color:var(--sep);background:var(--surface-2)}
.lc-composer:focus-within{background:var(--surface);box-shadow:var(--lg-spec),var(--lg-edge-lo),0 10px 34px rgba(30,48,74,.16)}
/* Путь А·А1 (24.09 18:08): пузыри = семантика роли на токенах темы.
   Исходящий — акцент (iMessage: цвет = мой голос), входящий — стекло
   светлее панели; хвост-угол у последнего в серии — тонкая деталь */
.lc-user .lc-message{background:var(--accent);color:#fff;box-shadow:0 6px 18px rgba(0,122,255,.28)}
.lc-assistant .lc-message{background:var(--surface);color:var(--ink);box-shadow:inset 0 0 0 1px var(--sep),0 8px 22px rgba(0,0,0,.12)}
.lc-user .lc-prose,.lc-user .lc-block{color:#fff}
.lc-user .lc-block{background:rgba(255,255,255,.14);border-color:rgba(255,255,255,.25)}
.lc-turn:last-child .lc-message{border-bottom-left-radius:6px}
.lc-user:last-child .lc-message,.lc-turn.lc-user:last-child .lc-message{border-bottom-right-radius:6px}
[data-theme=dark] .lc-user .lc-message{background:var(--accent);color:#fff}
[data-theme=dark] .lc-assistant .lc-message{background:var(--surface-2);color:var(--ink);box-shadow:inset 0 0 0 1px rgba(255,255,255,.14),0 8px 22px rgba(0,0,0,.35)}
.lc-message:not([open]){background:var(--surface-2)}
.lc-context-chip,.lc-file,.lc-chip,.lc-live{background:var(--chip)}
.lc-sheet{background:var(--surface)}
.lc-sheet-item:not(.is-current):hover{background:rgba(120,120,128,.18)}
.lc-sheet-item.is-current{background:color-mix(in srgb,var(--accent) 14%,transparent)}
.lc-ref{background:color-mix(in srgb,var(--accent) 12%,transparent)}
.lc-status{background:var(--glass)}
.lc-latest{background:var(--surface);border-color:var(--sep)}
.lc-user .lc-text-button{color:#fff}.lc-user .lc-ref{background:rgba(255,255,255,.16)}
.lc-block{border-color:var(--sep);background:var(--surface-2)}
.lc-veil{background:radial-gradient(120% 92% at 50% 42%,rgba(10,10,13,.5),rgba(5,5,8,.66))}
[data-theme=dark] .lc-veil{background:radial-gradient(120% 92% at 50% 42%,rgba(0,0,0,.55),rgba(0,0,0,.72))}
.lc-input{color:var(--ink)}

/* — Виджеты приложений/платформы — */
.aw-description,.aw-subtitle,.aw-fact-value,.aw-event-what,.aw-lastchat-text,.aw-event,.aw-event-when{color:var(--ink-2)}
.aw-fact-label,.aw-docs-cap{color:var(--ink-3)}
.aw-passport,.aw-doc{border-color:var(--sep)}
.aw-doc{background:var(--chip)}
.aw-event{background:var(--chip)}
.aw-lastchat,.aw-pulse{background:var(--chip)}
.aw-lastchat.is-pending{background:color-mix(in srgb,var(--acc-orange) 16%,transparent)}
.e4-badge{background:var(--danger);color:#fff}

/* — Поисковая палитра и ридер — */
.palette{background:rgba(0,0,0,.4)}
.palette-panel{background:var(--glass-2)}
.palette-result button{color:var(--ink)}
.palette-result[aria-selected=true] button{background:color-mix(in srgb,var(--accent) 14%,transparent)}
.reader-panel{background:var(--glass-2) ;color:var(--ink)}
.reader-link{color:var(--ink)}
/* pccard: каталог платформы ночью — стекло, а не белая плита (баг инлайн-стилей) */
.pc{background:rgba(0,0,0,.4)}
.pc-panel{background:var(--glass-2)}
[data-theme=dark] .pc-card .cc{background:linear-gradient(145deg,#2a2a2f,#212125)}
.pc-card h3.pc-title{color:var(--ink)}
.pc-card .pc-anchor.is-mono{background:linear-gradient(145deg,#3a3a40,#2c2c31);color:#c8c8cf}
.pc-card .pc-mi.chat::after{border-color:#242428}

/* — Стек-стопки и бейджи — */
.stk-host{background:var(--glass-2);color:var(--ink-2);box-shadow:var(--lg-line),var(--lg-spec),var(--lg-edge-lo),0 2px 8px rgba(0,0,0,.3)}
.stk-host i{background:var(--surface);box-shadow:inset 0 0 0 1px var(--sep)}
.ink-status{background:var(--glass-2);color:var(--ink-2)}
#boot{color:var(--ink-2)}
.surface-dots i{background:var(--sep)}
.surface-dots i.is-on{background:var(--accent)}
[data-theme=dark] body,[data-theme=dark] .load-error{background:#000;color:var(--ink)}
[data-theme=dark] .load-error{background:var(--surface)}

/* specificity guard: the sphere's own faces speak with #stage prefixes —
   the theme answers at the same weight, loaded last. */
#stage .tile{border-color:var(--surface);background:linear-gradient(165deg,var(--surface),var(--surface-2));color:var(--ink)}
#stage .tile .sw-card h3.sw-title,#stage .tile h3{color:var(--ink)}
#stage .tile .sw-card p.sw-excerpt,#stage .tile .sw-row-text,#stage .tile button.sw-related-row{color:var(--ink-2)}
#stage .tile .sw-label,#stage .tile .sw-meta,#stage .tile .sw-format,#stage .tile .sw-index,#stage .tile .sw-origin,#stage .tile .sw-section-label,#stage .tile .sw-priority{color:var(--ink-2)}
#stage .tile .sw-emblem{background:var(--chip)}
#stage .variety-card{background:linear-gradient(145deg,var(--surface),var(--surface-2));color:var(--ink)}
#stage .aw-widget{color:var(--ink)}
#stage .variety-card.satellite,#stage .variety-card.micro,#stage .variety-card.compact,
#stage .variety-card.detail,#stage .variety-card.wide,#stage .variety-card.feature{background:linear-gradient(145deg,var(--surface),var(--surface-2))}
/* the variety belt carries data-mode/edge-chip/topic-summary variants at higher
   weight — the theme layer answers once, as themes do in UIKit: material wins. */
#stage .tile.variety-card,#stage .variety-card[data-mode=meaning].feature,
#stage .variety-card.edge-chip,#stage .variety-card.topic-summary{background:linear-gradient(145deg,var(--surface),var(--surface-2)) ;border-color:var(--surface) }
#stage .variety-card h3,#stage .variety-card .tag,#stage .variety-card .card-foot,
#stage .variety-card p,#stage .topic-summary p{color:var(--ink) }
#stage .variety-card .tag,#stage .variety-card .card-foot,#stage .topic-summary p{color:var(--ink-2) }
#stage .variety-card .sf-icon{stroke:var(--ink-2) }
/* финальная заметка-гейт: светлые остатки семей добиваются точечно ниже */
#stage .sw-card[data-family=note] .sw-preview{background:var(--wash-orange) ;border-top-color:var(--sep) }
#stage .sw-card[data-family=document] .sw-preview{background:var(--chip) ;border-left-color:var(--sep) }
#stage .sw-card[data-form=note] .sw-preview{background:var(--wash-orange) }
#stage .sw-card[data-form=document] .sw-preview{background:var(--chip) }
#stage .sw-mosaic-item{background:var(--chip) }
#stage .sw-progress progress{background:var(--sep) }
#stage .sw-progress progress::-webkit-progress-bar{background:var(--sep) }
#stage .projection-member{background:var(--chip) ;color:var(--ink-2) }
#stage .sw-emblem{background:var(--chip) }
#stage .reader-link i{background:var(--ink-3) }
.stk-host i{background:var(--surface-2) }
.aw-events .aw-event,#stage .aw-passport{background:transparent }

/* darkfix-deep (Phil 19.09 «некоторые кнопки белые, рамки, текст не видно») —
   дословный список из аудит-машины, не глаз: desk-tile/desk-mini, PNG-символы,
   e5-контролы, паспорта,Launching/buttons, печати с клампом. */
#stage .variety-card.desk-tile{background:linear-gradient(145deg,var(--surface),var(--surface-2)) ;box-shadow:inset 0 0 0 1px var(--sep),0 6px 18px rgba(0,0,0,.35),var(--near-shadow) }
#stage .desk-tile .tag{color:var(--ink-3) }
.desk-mini{background:var(--chip) ;box-shadow:inset 0 0 0 1px var(--sep) }
.desk-plan b{background:var(--ink-3) }
.desk-plan i{background:var(--surface-2) ;box-shadow:inset 0 0 0 1px var(--sep) }
#stage .aw-app{background:var(--chip) }
#stage .aw-read,#stage .aw-e5-open,#stage .aw-e5-btn,#stage .aw-e5-preview{background:var(--chip) }
#stage .aw-e5-primary{background:var(--accent) ;color:#fff }
#stage .aw-e5-text,#stage .aw-e5-input,#stage .aw-e5-select{background:var(--surface-2) ;border-color:var(--sep) ;color:var(--ink) }
#stage .aw-e5-switch{background:#39393d }
#stage .aw-e5-switch .aw-e5-knob{background:#f5f5f7 }
body.e5-armed #stage .aw-e5-switch{background:var(--accent) }
#stage .aw-e5-preview p,#stage .aw-e5-fact b,#stage .aw-widget{color:var(--ink) }
#stage .aw-label,#stage .aw-counts small,#stage .aw-meta,#stage .aw-e5-arm-note,#stage .aw-e5-cap,#stage .aw-e5-preview small,#stage .aw-e5-status,#stage .aw-description,#stage .aw-subtitle{color:var(--ink-2) }
#stage .aw-doc-title{color:var(--ink) }
#stage .aw-doc-meta{color:var(--ink-2) }
#stage .aw-docs-scroll{scrollbar-color:var(--ink-3) transparent}
#stage .aw-items li{border-bottom-color:var(--sep) }
#stage .tile:has(.aw-widget) .surface-pages{border-top-color:var(--sep) }
#stage .sw-index,#stage .sw-section-label,#stage .sw-priority{color:var(--ink-2) }
#stage .aw-pev-when{color:var(--ink-3) }
#stage .aw-pev.is-unread .aw-pev-when{color:var(--accent) }
#stage .aw-lastchat-text{color:var(--ink-2) }
#stage .aw-lastchat .aw-event-when{color:var(--ink-3) }
#stage .sw-preview{border-color:var(--sep) }

/* darkfix-deep · 2: аудит-машина вскрыла целые непротемленные подсистемы —
   surface-hero/peer (literal #fff!), corpus-семейство (Kit/files лица),
   app-location, ax-контролы, nav hover. Иконки красит currentColor родителей. */
#stage .tile.surface-hero,#stage .tile.surface-peer{background:var(--surface) }
#stage .tile.corpus-tile{background:var(--surface) ;color:var(--ink) }
#stage .corpus-face{color:var(--ink) }
#stage .corpus-face h3{color:var(--ink) }
#stage .corpus-face .corpus-copy{color:var(--ink-2) }
#stage .corpus-face pre.corpus-copy{background:var(--surface-2) ;color:var(--ink) }
#stage .corpus-head{color:var(--ink-2) }
#stage .corpus-meta,#stage .corpus-note{color:var(--ink-3) }
#stage .corpus-member{color:var(--ink-2) }
#stage .corpus-action{background:var(--chip) ;color:var(--accent) }
#app-location{color:var(--ink-2) }
#app-location button{color:var(--ink-2) }
#app-location button:hover{color:var(--ink) }
#app-location-title{color:var(--ink) ;font-weight:540}
#app-location small{color:var(--ink-3) }
#stage .aw-lastchat,#stage .aw-pulse,#stage .aw-pev{background:var(--chip) }
#stage .aw-doc-read{background:var(--chip) ;color:var(--accent) }
#stage .ax-photo-frame{background:var(--surface-2) }
#stage .ax-button,#stage button.ax-day{background:var(--chip) ;color:var(--accent) }
#stage button.ax-day[aria-pressed=true]{background:var(--accent) ;color:#fff }
#stage .ax-state,#stage .ax-empty,#stage .ax-metrics span,#stage .ax-copy,#stage .ax-garments{color:var(--ink-2) }
#stage .ax-local,#stage .ax-error,#stage .ax-empty-photo{color:var(--ink-3) }
.aw-badge:has(.apple-symbol){color:var(--ink-2) }
#stage .sw-label{color:var(--ink-2) }
#stage .tile .pw-title{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
#stage .aw-fact-label,#stage .aw-docs-cap,#stage .aw-external{color:var(--ink-2) }
#stage .aw-fact b,#stage .aw-fact-value{color:var(--ink) }
/* the unclassed army (bare small/span/b inside tiles carried dark literals):
   system grammar — values speak ink, labels whisper ink-2. */
[data-theme=dark] #stage .tile b,[data-theme=dark] #stage .tile strong{color:var(--ink) }
[data-theme=dark] #stage .tile small{color:var(--ink-2) }
[data-theme=dark] #stage .tile .sw-accessory,[data-theme=dark] #stage .tile .ax-timer,[data-theme=dark] #stage .tile .aw-counts strong{color:var(--ink) }

/* ПОРТ 1L из Волны 3 (3u): тёмная тема — семантические роли вместо хардкода */
/* 3u(реджект канона 1): текст сферных виджетов протемнён — семантические роли,
   не хардкод (прецедент 19.09 «текст не видно») */
[data-theme=dark] #stage .tile .widget-lines{color:var(--ink-2)}
[data-theme=dark] #stage .tile .widget-lines b{color:var(--ink)}
[data-theme=dark] #stage .tile .widget-numbers small,[data-theme=dark] #stage .tile .widget-caption{color:var(--ink-3)}
[data-theme=dark] #stage .tile .platform-row{color:var(--ink-2)}
[data-theme=dark] #stage .tile .relation-reason{color:var(--ink-3)}
[data-theme=dark] #stage .tile .feature-context span{color:var(--ink-3)}
[data-theme=dark]{--card:#1c1c1e}
