/* ============================================================
   ЗОВ MiniApp — design system v5
   4 темы: brand (ЗОВ) · b (Foundry) · c (Boardroom) · d (Atelier)
   Переключатель — `<html data-variant="b|c|d">`, состояние в localStorage.
   Палитры B/C/D извлечены из дашбордов (Figma → Claude → HTML).
   ============================================================ */

/* ===========================================================
   Общие константы — не зависят от темы
   =========================================================== */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s7: 32px; --s8: 40px;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ===========================================================
   1. BRAND — ЗОВ (default, без data-variant)
   Синий + зелёный, Inter, мягкие скругления
   =========================================================== */
:root {
  --paper:        var(--tg-theme-bg-color, #FAFAF7);
  --paper-2:      var(--tg-theme-secondary-bg-color, #F0EDE5);
  --card:         var(--tg-theme-section-bg-color, #FFFFFF);
  --ink:          var(--tg-theme-text-color, #0F0F0E);
  --ink-2:        #2A2622;
  --muted:        var(--tg-theme-hint-color, #6E6A62);
  --muted-2:      #A09C92;
  --line:         rgba(15, 15, 14, 0.08);
  --line-strong:  rgba(15, 15, 14, 0.18);

  --accent-1:     #003E7E;   /* brand blue */
  --accent-2:     #76BD22;   /* brand green */
  --accent-3:     #C0392B;
  --status-active: #76BD22;
  --status-lapsed: #C0392B;
  --status-grace:  #B07E00;

  --r-card: 14px;
  --r-btn:  12px;
  --r-tag:  6px;
  --r-pill: 999px;

  --font-ui:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;

  --ribbon: linear-gradient(90deg, var(--accent-1) 0%, var(--accent-2) 100%);
  --warm:   rgba(0, 62, 126, 0.08);  /* icon bg tint */

  /* palette-switch swatches */
  --ps-a: #003E7E;
  --ps-b: #76BD22;
}

html[data-theme="dark"]:not([data-variant]) {
  --paper:   var(--tg-theme-bg-color, #14130E);
  --paper-2: var(--tg-theme-secondary-bg-color, #1F1D17);
  --card:    var(--tg-theme-section-bg-color, #1C1A14);
  --ink:     var(--tg-theme-text-color, #F4F1EA);
  --ink-2:   #C8C3B5;
  --muted:   var(--tg-theme-hint-color, #A5A299);
  --muted-2: #807D74;
  --line:    rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
}

/* ===========================================================
   2. VARIANT B — Foundry
   Тёплый крем + горчица. Archivo, острые углы.
   Палитра: --paper #EFE9D8 · --ink #15140F · --accent #B68A1A
   =========================================================== */
html[data-variant="b"] {
  --paper:        #EFE9D8;
  --paper-2:      #E2DAC1;
  --card:         #EAE3CC;
  --ink:          #15140F;
  --ink-2:        #2A2820;
  --muted:        #5C5849;
  --muted-2:      #8C8773;
  --line:         rgba(21, 20, 15, 0.10);
  --line-strong:  rgba(21, 20, 15, 0.22);

  --accent-1:     #B68A1A;   /* mustard / горчица */
  --accent-2:     #4B6B26;   /* тёмно-зелёный */
  --accent-3:     #8B2B16;   /* бордо */
  --status-active: #4B6B26;
  --status-lapsed: #8B2B16;
  --status-grace:  #B68A1A;

  --r-card: 4px;
  --r-btn:  4px;
  --r-tag:  2px;
  --r-pill: 999px;

  --font-ui:      "Archivo", -apple-system, system-ui, sans-serif;
  --font-display: "Instrument Serif", Georgia, serif;

  --ribbon: linear-gradient(90deg, #15140F 0%, #B68A1A 100%);
  --warm:   rgba(182, 138, 26, 0.10);

  --ps-a: #EFE9D8;
  --ps-b: #B68A1A;
}

/* ===========================================================
   3. VARIANT C — Boardroom
   Петроль + медь. Geist, умеренные скругления.
   Палитра: --paper #F2E9D6 · --ink #0E2A2E · --accent #D08A55
   =========================================================== */
html[data-variant="c"] {
  --paper:        #F2E9D6;
  --paper-2:      #D8CFBB;
  --card:         #EDE5D0;
  --ink:          #0E2A2E;
  --ink-2:        #1B3E43;
  --muted:        #6E7B77;
  --muted-2:      #9DA8A4;
  --line:         rgba(14, 42, 46, 0.10);
  --line-strong:  rgba(14, 42, 46, 0.22);

  --accent-1:     #D08A55;   /* copper / медь */
  --accent-2:     #143438;   /* petrol / петроль */
  --accent-3:     #8B2B16;
  --status-active: #7FB58A;
  --status-lapsed: #E07D6C;
  --status-grace:  #D08A55;

  --r-card: 6px;
  --r-btn:  6px;
  --r-tag:  3px;
  --r-pill: 999px;

  --font-ui:      "Geist", -apple-system, system-ui, sans-serif;
  --font-display: "Newsreader", Georgia, serif;

  --ribbon: linear-gradient(90deg, #0E2A2E 0%, #D08A55 100%);
  --warm:   rgba(208, 138, 85, 0.10);

  --ps-a: #143438;
  --ps-b: #D08A55;
}

/* ===========================================================
   4. VARIANT D — Atelier
   Серо-голубой голубь + стальной синий. Manrope, мягкие скругления.
   Палитра: --paper #E9EBEF · --ink #14181F · --accent #2E5266
   =========================================================== */
html[data-variant="d"] {
  --paper:        #E9EBEF;
  --paper-2:      #DCDFE6;
  --card:         #FFFFFF;
  --ink:          #14181F;
  --ink-2:        #2D3340;
  --muted:        #5F6573;
  --muted-2:      #8A8F9C;
  --line:         rgba(20, 24, 31, 0.09);
  --line-strong:  rgba(20, 24, 31, 0.20);

  --accent-1:     #2E5266;   /* steel blue / стальной синий */
  --accent-2:     #2F6B45;   /* зелёный */
  --accent-3:     #99362E;   /* красный */
  --status-active: #2F6B45;
  --status-lapsed: #99362E;
  --status-grace:  #B07A1A;

  --r-card: 12px;
  --r-btn:  10px;
  --r-tag:  6px;
  --r-pill: 999px;

  --font-ui:      "Manrope", -apple-system, system-ui, sans-serif;
  --font-display: "Newsreader", Georgia, serif;

  --ribbon: linear-gradient(90deg, #2E5266 0%, #2F6B45 100%);
  --warm:   rgba(46, 82, 102, 0.10);

  --ps-a: #2E5266;
  --ps-b: #E9EBEF;
}

/* ============================================================
   Reset
   ============================================================ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  line-height: var(--lh, 1.45);
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; padding: 0; }

/* ============================================================
   Layout
   ============================================================ */
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s3) var(--s4) calc(var(--s7) + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* ============================================================
   Palette switcher — 4 кнопки-образца цветов
   ============================================================ */
.palette-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: var(--s4);
  padding: 2px 0;
}

.palette-switcher__label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-right: 2px;
  user-select: none;
}

.ps-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px 5px 7px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  background: var(--card);
}

.ps-btn:active { opacity: 0.7; }

.ps-btn.active {
  border-color: var(--ink);
}

.ps-swatches {
  display: flex;
  gap: 3px;
  align-items: center;
}

.ps-dot {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ps-dot--outline {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18);
}

.ps-name {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.ps-btn.active .ps-name { color: var(--ink); }

/* Legacy .theme-switch — оставлен для совместимости */
.theme-switch {
  display: flex;
  gap: 0;
  margin-bottom: var(--s5);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-tag);
  overflow: hidden;
  background: var(--card);
}
.theme-switch button {
  flex: 1;
  padding: 8px 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--line-strong);
  transition: all 0.12s;
}
.theme-switch button:last-child { border-right: none; }
.theme-switch button.active { background: var(--ink); color: var(--paper); }

/* ============================================================
   Loader (брендированный — логотип ЗОВ + дыхание)
   ============================================================ */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 18px;
  padding: 24px;
}

/* Полноэкранный «splash» — фон карамельный, поверх плавающий логотип */
.loader.splash {
  position: fixed;
  inset: 0;
  background: var(--paper, #FBF7F0);
  z-index: 999;
  animation: splashFadeIn 0.3s ease-out;
}

.loader-logo {
  width: 88px;
  height: auto;
  display: block;
  animation: logoBreath 2.2s ease-in-out infinite;
}
.loader-logo path { fill: var(--walnut, #6B4A2B); }

/* Бренд @wasrusgen1 на splash — SVG-лого + CRM */
.brand-logo-wrap {
  position: relative;
  display: inline-block;
}
.brand-logo {
  width: 70%;
  max-width: 260px;
  height: auto;
  display: block;
  margin: 0 auto;
  animation: logoBreath 2.2s ease-in-out infinite;
  filter: drop-shadow(0 6px 16px rgba(44, 62, 80, 0.18));
}

/* Опилки — 16 точек летают вокруг пилы */
.splash-dust {
  position: absolute;
  inset: -10% -25% -10% -25%;
  pointer-events: none;
}
.splash-dust .dust {
  position: absolute;
  width: 3px;
  height: 3px;
  background: #2C3E50;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
}
/* 16 точек с разными траекториями (8 влево, 8 вправо) */
.splash-dust .d1  { left: 30%; top: 45%; animation: dustFly 3.6s ease-out 0.0s infinite; --dx:-30px; --dy:-55px; }
.splash-dust .d2  { left: 35%; top: 50%; animation: dustFly 4.2s ease-out 0.4s infinite; --dx:-55px; --dy:-30px; }
.splash-dust .d3  { left: 25%; top: 55%; animation: dustFly 3.2s ease-out 0.8s infinite; --dx:-65px; --dy: 15px; }
.splash-dust .d4  { left: 32%; top: 60%; animation: dustFly 5.0s ease-out 0.2s infinite; --dx:-25px; --dy: 55px; }
.splash-dust .d5  { left: 38%; top: 40%; animation: dustFly 4.5s ease-out 0.6s infinite; --dx:-40px; --dy:-70px; }
.splash-dust .d6  { left: 20%; top: 50%; animation: dustFly 3.8s ease-out 1.1s infinite; --dx:-70px; --dy:-15px; }
.splash-dust .d7  { left: 28%; top: 65%; animation: dustFly 4.4s ease-out 0.5s infinite; --dx:-50px; --dy: 40px; }
.splash-dust .d8  { left: 22%; top: 38%; animation: dustFly 3.5s ease-out 0.9s infinite; --dx:-60px; --dy:-65px; }
.splash-dust .d9  { left: 70%; top: 45%; animation: dustFly 3.4s ease-out 0.3s infinite; --dx: 40px; --dy:-55px; }
.splash-dust .d10 { left: 65%; top: 50%; animation: dustFly 4.0s ease-out 0.7s infinite; --dx: 60px; --dy:-25px; }
.splash-dust .d11 { left: 75%; top: 55%; animation: dustFly 3.2s ease-out 1.0s infinite; --dx: 70px; --dy: 15px; }
.splash-dust .d12 { left: 68%; top: 60%; animation: dustFly 5.0s ease-out 0.2s infinite; --dx: 25px; --dy: 55px; }
.splash-dust .d13 { left: 62%; top: 40%; animation: dustFly 4.5s ease-out 0.6s infinite; --dx: 45px; --dy:-65px; }
.splash-dust .d14 { left: 80%; top: 50%; animation: dustFly 3.8s ease-out 0.1s infinite; --dx: 75px; --dy:-15px; }
.splash-dust .d15 { left: 72%; top: 65%; animation: dustFly 4.4s ease-out 0.4s infinite; --dx: 55px; --dy: 40px; }
.splash-dust .d16 { left: 78%; top: 38%; animation: dustFly 3.5s ease-out 0.8s infinite; --dx: 65px; --dy:-65px; }

@keyframes dustFly {
  0%   { opacity: 0;    transform: translate(0, 0) scale(0.4); }
  15%  { opacity: 0.55; }
  60%  { opacity: 0.35; }
  100% { opacity: 0;    transform: translate(var(--dx), var(--dy)) scale(1.1); }
}
.brand-tagline-gold {
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.4em;
  color: #2C3E50;
  margin-top: 6px;
  line-height: 1;
  display: inline-block;
}

.loader-caption {
  font-family: var(--font-display, "Newsreader", serif);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-2, #6B5C4A);
  letter-spacing: 0.01em;
  text-align: center;
  opacity: 0.8;
}
.loader-caption-sub {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  color: var(--muted, #998877);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-top: 4px;
}

/* Слоган бренда — Cormorant Garamond Italic, сдержанный serif-италик */
.loader-tagline {
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  color: var(--walnut, #6B4A2B);
  letter-spacing: 0.005em;
  text-align: center;
}

.loader-bar {
  width: 140px;
  height: 2px;
  background: rgba(107, 74, 43, 0.12);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}
.loader-bar::after {
  content: "";
  position: absolute;
  top: 0; left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #2C3E50 50%, transparent);
  animation: loaderBarSlide 1.4s ease-in-out infinite;
}

/* Старый spinner — оставлен для подэкранов (.loader-inline) */
.spinner {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--line-strong);
  border-top-color: var(--accent-1);
  border-radius: var(--r-pill);
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes logoBreath {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50%      { transform: scale(1.04); opacity: 1; }
}
@keyframes loaderBarSlide {
  0%   { left: -40%; }
  100% { left: 100%; }
}
@keyframes splashFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.loader.splash.hide {
  /* Мгновенно отключаем взаимодействие, чтобы splash не блокировал клики во время fade */
  pointer-events: none !important;
  animation: splashFadeOut 0.4s ease-out forwards;
}
@keyframes splashFadeOut {
  to { opacity: 0; visibility: hidden; }
}

/* ============================================================
   Profile card
   ============================================================ */
.profile-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: var(--s5) var(--s4) var(--s4);
  margin-bottom: var(--s5);
  position: relative;
  overflow: hidden;
}

.profile-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--ribbon);
}

.profile-card .role-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s2);
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.profile-card .role-tag::after {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--line-strong);
}

.profile-card .head-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  margin-bottom: var(--s3);
}

.profile-card .info { flex: 1; min-width: 0; }

.profile-card .name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: var(--s1);
  word-break: break-word;
}

.profile-card .meta {
  font-size: 14px;
  color: var(--ink-2);
}

.profile-card .avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  color: var(--accent-1);
  border: 1px solid var(--line-strong);
}

.profile-card .meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}

.profile-card .meta-row .sep { color: var(--muted-2); }

.profile-card .status-row {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.profile-card .status-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--status-active);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-active) 22%, transparent);
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-active) 22%, transparent); }
  50%      { box-shadow: 0 0 0 6px color-mix(in srgb, var(--status-active) 0%, transparent); }
}

.profile-card .status-dot.lapsed {
  background: var(--status-lapsed);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-lapsed) 22%, transparent);
  animation: none;
}

.profile-card .status-dot.grace {
  background: var(--status-grace);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-grace) 22%, transparent);
}

/* ============================================================
   Section label
   ============================================================ */
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding: 0 var(--s4);
  margin: var(--s5) 0 var(--s2);
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-strong);
}

/* ============================================================
   Menu (grouped list)
   ============================================================ */
.menu {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  overflow: hidden;
}

.menu + .menu { margin-top: var(--s4); }

.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 10px var(--s4);
  min-height: 48px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}

.menu-item + .menu-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--s4);
  right: 0;
  height: 1px;
  background: var(--line);
}

.menu-item:active { background: var(--paper-2); }

.menu-item .icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--ink);
}

.menu-item .icon svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.6;
}

.menu-item .icon.green { color: var(--status-active); }
.menu-item .icon.blue  { color: var(--accent-1); }
.menu-item .icon.gold  { color: var(--accent-2); }

.menu-item .text { flex: 1; min-width: 0; }

.menu-item .label {
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.menu-item .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}

.menu-item .chevron {
  color: var(--muted-2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.menu-item .chevron svg { width: 18px; height: 18px; }

.menu-item.disabled { cursor: not-allowed; }
.menu-item.disabled .label,
.menu-item.disabled .icon { color: var(--muted); opacity: 0.65; }

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  border-radius: var(--r-tag);
  background: var(--paper-2);
  color: var(--muted);
  vertical-align: 2px;
}

/* ============================================================
   Footer
   ============================================================ */
.footer-hint {
  text-align: center;
  margin-top: var(--s8);
  padding: var(--s5) var(--s4) 0;
  border-top: 1px solid var(--line);
}

.footer-hint .signature {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-2);
  margin-bottom: var(--s2);
}

.footer-hint .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.footer-hint a { color: var(--accent-1); }

/* ============================================================
   Error
   ============================================================ */
.error {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: var(--s7) var(--s5);
  text-align: center;
  color: var(--muted);
}

.error h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 var(--s2);
  color: var(--ink);
}

/* ============================================================
   HOME — Manager dashboard (mockup v2)
   ============================================================ */

/* App content needs bottom padding for fixed nav */
body.has-bottom-nav #app {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

/* ============= Greeting ============= */
.greeting {
  display: flex;
  align-items: flex-start;
  gap: var(--s4);
  margin-bottom: var(--s5);
}

.greeting-text { flex: 1; min-width: 0; }

.greeting-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s2);
}

.greeting-headline {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 32px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.greeting-headline .accent {
  color: var(--accent-2);    /* walnut акцент на части фразы */
}

.bell-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--card);
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  color: var(--ink);
  cursor: pointer;
}

.bell-btn svg { width: 20px; height: 20px; stroke-width: 1.6; }

.bell-btn .dot {
  position: absolute;
  top: 7px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: var(--r-pill);
  background: #C0392B;
  border: 1.5px solid var(--paper);
}

/* ============= Hero task card ============= */
.hero {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-card);
  padding: var(--s4);
  margin-bottom: var(--s6);
  position: relative;
  overflow: hidden;
}

.hero::before {
  /* тонкая бренд-полоса слева */
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent-2), var(--status-active));
}

.hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(251, 247, 240, 0.55);
  margin-bottom: var(--s3);
}

.hero-meta .left { display: inline-flex; align-items: center; gap: var(--s2); }
.hero-meta .left .sep { color: rgba(251, 247, 240, 0.30); }

.hero-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  padding: 3px 8px;
  border-radius: var(--r-tag);
  background: rgba(251, 247, 240, 0.08);
  color: rgba(251, 247, 240, 0.85);
}

.hero-client {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--paper);
  margin-bottom: 4px;
}

.hero-address {
  font-family: var(--font-ui);
  font-size: 14px;
  color: rgba(251, 247, 240, 0.70);
  margin-bottom: var(--s4);
}

.hero-actions {
  display: flex;
  gap: var(--s2);
}

.btn-gold {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  padding: 10px var(--s3);
  border-radius: var(--r-btn);
  background: #C9985E;
  color: #1F1A14;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.btn-gold svg { width: 16px; height: 16px; stroke-width: 1.7; }

.btn-icon-dark {
  width: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-btn);
  background: rgba(251, 247, 240, 0.10);
  color: var(--paper);
  cursor: pointer;
}

.btn-icon-dark svg { width: 18px; height: 18px; stroke-width: 1.6; }

/* ============= Section header (with right-action) ============= */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: 0 var(--s2);
  margin: var(--s5) 0 var(--s2);
}

.section-head .label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-head .label .count {
  color: var(--ink);
  margin-left: 4px;
}

.section-head .more {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  cursor: pointer;
}

/* ============= Quick actions (2x2 grid) ============= */
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s3);
}

.quick-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: background 0.12s;
}

.quick-card:active { background: var(--paper-2); }

.quick-card .icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--accent-2);
  margin: 0;
}

.quick-card .icon svg { width: 20px; height: 20px; stroke-width: 1.6; }

.quick-card .title {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
}

.quick-card .subtitle {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.2;
}

/* ============= Project card ============= */
.project-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.project-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: var(--s4);
  cursor: pointer;
}

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: 4px;
}

.project-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  flex: 1;
}

.project-pill {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-tag);
  white-space: nowrap;
}

.project-pill.waiting { background: var(--paper-2); color: var(--accent-2); }
.project-pill.active  { background: var(--paper-2); color: var(--status-active); }
.project-pill.urgent  { background: rgba(192,57,43,0.10); color: #8C3F1E; }

.project-address {
  font-family: var(--font-ui);
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: var(--s3);
}

.project-progress {
  height: 3px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-bottom: var(--s2);
}

.project-progress .bar {
  height: 100%;
  background: var(--accent-2);
  border-radius: inherit;
}

.project-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted);
}

.project-foot .stage { color: var(--ink-2); }

/* ============= Bottom navigation ============= */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  background: var(--paper);
  border-top: 1px solid var(--line-strong);
  padding: 6px 0 calc(8px + env(safe-area-inset-bottom));
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  padding: 6px 2px;
  position: relative;
  cursor: pointer;
}

.bottom-nav button.active { color: var(--ink); }

.bottom-nav button svg { width: 22px; height: 22px; stroke-width: 1.6; }

.bottom-nav .fab {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  margin: 0 8px;
  transform: translateY(-12px);
  box-shadow: 0 4px 14px rgba(31, 26, 20, 0.25);
}

.bottom-nav .fab svg { width: 22px; height: 22px; stroke-width: 2.2; color: var(--paper); }

.bottom-nav .badge {
  position: absolute;
  top: 2px;
  right: 22%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--r-pill);
  background: #C0392B;
  color: var(--paper);
  font-size: 10px;
  font-weight: 600;
  display: grid;
  place-items: center;
  letter-spacing: 0;
}


/* ============================================================
   Per-theme personality overrides v5.1
   Tokens distilled from B/C/D reference dashboards.
   ============================================================ */

/* -------------------------------------------------------
   B — Foundry: Archivo 800, sharp corners, dark header
   Dashboard: font-weight 400/700/800, radius 0px, lh 1.5
   ------------------------------------------------------- */
html[data-variant="b"] {
  --r-card: 0px;
  --r-btn:  0px;
  --r-tag:  0px;
  --lh: 1.5;
}

/* Dark header extends edge-to-edge — palette switcher + greeting */
html[data-variant="b"] .palette-switcher,
html[data-variant="b"] .greeting {
  margin-inline: calc(-1 * var(--s4));
  padding-inline: var(--s4);
  background: var(--ink);
}
html[data-variant="b"] .palette-switcher {
  margin-top:    calc(-1 * var(--s3));
  padding-top:   var(--s3);
  padding-bottom: var(--s2);
}
html[data-variant="b"] .greeting {
  padding-bottom: var(--s5);
  margin-bottom:  var(--s5);
}

/* Palette switcher on dark bg */
html[data-variant="b"] .palette-switcher__label     { color: rgba(239,233,216,0.38); }
html[data-variant="b"] .ps-btn                      { background: rgba(239,233,216,0.06); border-color: rgba(239,233,216,0.12); }
html[data-variant="b"] .ps-btn.active               { background: rgba(239,233,216,0.15); border-color: rgba(239,233,216,0.55); }
html[data-variant="b"] .ps-name                     { color: rgba(239,233,216,0.55); }
html[data-variant="b"] .ps-btn.active .ps-name      { color: #EFE9D8; }

/* Greeting typography — Archivo Heavy */
html[data-variant="b"] .greeting-kicker             { color: rgba(239,233,216,0.45); }
html[data-variant="b"] .greeting-headline {
  font-family: var(--font-ui);
  font-style:  normal;
  font-weight: 800;
  font-size:   34px;
  letter-spacing: -0.04em;
  color: #EFE9D8;
}
html[data-variant="b"] .greeting-headline .accent   { color: #B68A1A; }

/* Section labels — wider tracking, ink weight */
html[data-variant="b"] .section-head .label {
  font-weight:     700;
  letter-spacing:  0.18em;
}

/* Cards — flat with visible border */
html[data-variant="b"] .quick-card,
html[data-variant="b"] .card,
html[data-variant="b"] .today-card {
  border-width: 1.5px;
}

/* -------------------------------------------------------
   C — Boardroom: Geist 400, sharp corners, petrol header
   Dashboard: font-weight 400/500, radius 0/999px, lh 1.12
   ------------------------------------------------------- */
html[data-variant="c"] {
  --r-card: 0px;
  --r-btn:  0px;
  --r-tag:  999px;   /* pills stay pill-shaped */
  --lh: 1.12;
}

/* Dark petrol header */
html[data-variant="c"] .palette-switcher,
html[data-variant="c"] .greeting {
  margin-inline: calc(-1 * var(--s4));
  padding-inline: var(--s4);
  background: var(--ink);
}
html[data-variant="c"] .palette-switcher {
  margin-top:    calc(-1 * var(--s3));
  padding-top:   var(--s3);
  padding-bottom: var(--s2);
}
html[data-variant="c"] .greeting {
  padding-bottom: var(--s5);
  margin-bottom:  var(--s5);
}

/* Palette switcher on dark bg */
html[data-variant="c"] .palette-switcher__label     { color: rgba(242,233,214,0.35); }
html[data-variant="c"] .ps-btn                      { background: rgba(242,233,214,0.06); border-color: rgba(242,233,214,0.12); }
html[data-variant="c"] .ps-btn.active               { background: rgba(242,233,214,0.14); border-color: rgba(242,233,214,0.50); }
html[data-variant="c"] .ps-name                     { color: rgba(242,233,214,0.50); }
html[data-variant="c"] .ps-btn.active .ps-name      { color: #F2E9D6; }

/* Greeting typography — Geist Regular, restrained */
html[data-variant="c"] .greeting-kicker             { color: rgba(242,233,214,0.40); }
html[data-variant="c"] .greeting-headline {
  font-family: var(--font-ui);
  font-style:  normal;
  font-weight: 400;
  font-size:   30px;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: #F2E9D6;
}
html[data-variant="c"] .greeting-headline .accent   { color: #D08A55; }

/* Section labels — Geist, moderate weight */
html[data-variant="c"] .section-head .label {
  font-family:    var(--font-ui);
  font-weight:    500;
  letter-spacing: 0.10em;
}

/* -------------------------------------------------------
   D — Atelier: Manrope 700, white card header, dove bg
   Dashboard: font-weight 400/600/700, lh 1.1, white cards
   ------------------------------------------------------- */
html[data-variant="d"] {
  --lh: 1.1;
}

/* White card header — floats on dove background */
html[data-variant="d"] .palette-switcher,
html[data-variant="d"] .greeting {
  margin-inline: calc(-1 * var(--s4));
  padding-inline: var(--s4);
  background: var(--card);
}
html[data-variant="d"] .palette-switcher {
  margin-top:    calc(-1 * var(--s3));
  padding-top:   var(--s3);
  padding-bottom: var(--s2);
}
html[data-variant="d"] .greeting {
  padding-bottom: var(--s4);
  margin-bottom:  0;
  border-bottom:  1px solid var(--line);
}

/* Greeting typography — Manrope Bold */
html[data-variant="d"] .greeting-headline {
  font-family: var(--font-ui);
  font-style:  normal;
  font-weight: 700;
  font-size:   30px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
html[data-variant="d"] .greeting-headline .accent   { color: var(--accent-1); }

/* Section labels — prominent uppercase, Manrope semibold */
html[data-variant="d"] .section-head .label {
  font-family:    var(--font-ui);
  font-weight:    700;
  font-size:      10px;
  letter-spacing: 0.16em;
  color: var(--ink-2);
}

/* ============================================================
   Client list cards — все темы
   Явные стили чтобы текст не сливался с фоном ни в одной теме
   ============================================================ */
.client-list {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.client-card {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  padding: var(--s4);
  cursor: pointer;
  transition: background 0.12s;
}

.client-card:active { background: var(--paper-2); }

.client-card-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: 6px;
}

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--warm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-1);
  flex-shrink: 0;
  text-transform: uppercase;
  user-select: none;
}

.client-avatar.lg {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.client-meta {
  flex: 1;
  min-width: 0;
}

.client-name {
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  color: #0E1621;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-phone {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: #0E1621;
  margin-top: 2px;
}

.client-arrow {
  color: #0E1621;
  flex-shrink: 0;
}

.client-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0E1621;
}

.client-detail-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
}

.client-detail-name {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
  letter-spacing: -0.01em;
}

.client-detail-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── История заказов — таймлайн ─────────────────────────────── */
.orders-timeline {
  padding: 8px 0 0;
}
.orders-item {
  display: flex;
  gap: 0;
  padding: 0 16px 0 12px;
}
.orders-item--link {
  cursor: pointer;
}
.orders-item--link:active {
  opacity: 0.7;
}
.orders-item-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 36px;
  flex-shrink: 0;
}
.orders-item-icon {
  font-size: 20px;
  line-height: 1;
  padding: 4px 0;
  z-index: 1;
  background: transparent;
}
.orders-item-line {
  width: 2px;
  flex: 1;
  min-height: 16px;
  background: var(--border, #e8e8e8);
  margin: 2px 0;
}
.orders-item:last-child .orders-item-line {
  display: none;
}
.orders-item-body {
  flex: 1;
  padding: 4px 0 20px 4px;
}
.orders-item-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 2px;
}
.orders-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin: 2px 0;
}
.orders-item-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* cabinet / orders shared blocks */
.block {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  padding: 14px 14px 10px;
}
.block-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 8px;
}
.assembly-card {
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--surface, #fff);
}
.btn-sm {
  font-size: 13px;
  padding: 7px 14px;
}
/* ── SignRequest overlay ─────────────────────────────────────── */
.signreq-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.signreq-sheet {
  width: 100%; max-height: 92dvh; overflow-y: auto;
  background: var(--surface, #fff);
  border-radius: 20px 20px 0 0;
  padding: 0 0 env(safe-area-inset-bottom, 16px);
}
.signreq-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
  position: sticky; top: 0;
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #eee);
  z-index: 1;
}
.signreq-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.signreq-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; color: var(--muted); padding: 4px 8px;
}
.signreq-tabs {
  display: flex; gap: 4px; padding: 10px 12px 0; flex-wrap: wrap;
}
.signreq-tab {
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border); border-radius: 20px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 6px 12px; cursor: pointer;
  transition: background .15s, color .15s;
}
.signreq-tab.active {
  background: var(--accent, #003E7E); color: #fff; border-color: transparent;
}
.signreq-panel { padding: 14px 16px 8px; }
.signreq-canvas-wrap {
  position: relative; width: 100%; height: 160px;
  border: 2px solid var(--border); border-radius: 10px;
  background: var(--bg, #f9f9f9); overflow: hidden;
  cursor: crosshair; touch-action: none;
}
.signreq-canvas-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.signreq-canvas-hint {
  position: absolute; inset: 0; display: flex;
  align-items: center; justify-content: center;
  font-size: 13px; color: var(--muted); pointer-events: none;
  opacity: .6;
}
.signreq-name-row { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.signreq-cta { margin-top: 12px; }
.signreq-cta .btn-primary { width: 100%; }
.signreq-err {
  color: #C0392B; font-size: 12px; margin-top: 6px; min-height: 16px;
}
.signreq-code-info {
  font-size: 13px; color: var(--ink); margin-bottom: 12px;
  padding: 10px 12px; background: var(--surface-2, var(--surface));
  border-radius: 8px; border: 1px solid var(--border);
}
/* ─────────────────────────────────────────────────────────────── */
