/* ═══════════════════════════════════════════════════════════════════
   GOD PLAN v9 · общий стиль по утверждённым макетам design/mockups (25.09.2026)
   · фон #0B0B0C, карточки #161618 со скруглением 18–24 и волоском по краю
   · Unbounded на заголовках и крупных числах, Onest на тексте,
     IBM Plex Mono на датах и метках капителью
   · коралл #EA8369 только там, где действие; жёлтый, синий и красный сигналы
   · телефон главный: 390 по ширине, цели касания от 44 px, плавающая панель снизу;
     от 900 px левое меню, панель и круглая кнопка прячутся
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --bg: #0B0B0C;
  --surface: #161618;
  --surface-hover: #1A1A1D;
  --surface-2: #1C1C1F;
  --surface-3: #232326;
  --sidebar: #0E0E10;
  --ink: #F4F1EC;
  --ink-2: #C9C5BE;
  --ink-3: #9A968F;
  --line: rgba(255, 255, 255, .06);
  --line-2: rgba(255, 255, 255, .08);
  --line-3: rgba(255, 255, 255, .12);
  --coral: #EA8369;
  --coral-hi: #F3A48F;
  --coral-ink: #1A0F0B;
  --amber: #F2C14E;
  --blue: #6EA8FF;
  --disp: Unbounded, Onest, system-ui, sans-serif;
  --text: Onest, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --bar-bottom: max(20px, calc(var(--sab) + 8px));
  --side-w: 248px;
  --ease: cubic-bezier(.22, .9, .28, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: var(--text); font-size: 15px; line-height: normal;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body.locked { overflow: hidden; }
a { color: var(--coral); text-decoration: none; }
a:hover { color: var(--coral-hi); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; margin: 0; }
h1, h2, h3, p { margin: 0; font-weight: inherit; }
:focus-visible { outline: 2px solid var(--coral); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); font-size: 14px; line-height: 1.45; }

/* ── страница ─────────────────────────────────────────────────── */
.main {
  max-width: 560px; margin: 0 auto; outline: none;
  /* снизу место под панель и круглую кнопку, чтобы последняя карточка доезжала выше них */
  padding: calc(20px + var(--sat)) 16px calc(176px + var(--sab));
}
.main.enter { animation: enter .28s var(--ease); }
.data-freshness { display: flex; flex-direction: column; gap: 8px; padding: 14px; margin-bottom: 18px;
  border: 1px solid var(--amber); border-radius: 14px; background: #292315; color: var(--ink); line-height: 1.4; }
.data-freshness strong { color: var(--amber); font-weight: 600; }
.data-freshness span { font-size: 13px; }
.data-freshness button { min-height: 44px; align-self: flex-start; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 8px; }
.page-head-txt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.page-title { font-family: var(--disp); font-size: 24px; font-weight: 600; }
.h2 { font-family: var(--disp); font-size: 15px; font-weight: 600; }
.avatar-btn {
  flex: none; width: 44px; height: 44px; border-radius: 22px; border: 1px solid var(--line-3);
  background: var(--surface); color: var(--ink); font-family: var(--disp); font-size: 16px; font-weight: 600;
  display: grid; place-items: center; transition: background-color .15s;
}
.avatar-btn:hover { background: var(--surface-2); }

/* тона кружков-иконок и аватаров: фон и цвет буквы из макета «Сегодня» */
.tone-coral { background: #2A2320; color: #EA8369; }
.tone-blue { background: #1E2633; color: #6EA8FF; }
.tone-neutral { background: #232326; color: #C9C5BE; }
.tone-amber { background: #2A2519; color: #F2C14E; }
.tone-green { background: #1A2821; color: #5CC49A; }
.tone-red { background: #2C1C20; color: #EE7A8A; }

/* метки на строках и карточках: моно 11 px, цвет по смыслу (макеты «Сегодня» и «Клиенты») */
.tag { flex: none; font-family: var(--mono); font-size: 11px; padding: 5px 9px; border-radius: 10px; white-space: nowrap; }
.tag-amber { background: rgba(242, 193, 78, .14); color: #F2C14E; }
.tag-coral { background: rgba(234, 131, 105, .16); color: #EA8369; }
.tag-blue { background: rgba(110, 168, 255, .14); color: #6EA8FF; }
.tag-muted { background: rgba(255, 255, 255, .06); color: #9A968F; }
.tag-green { background: rgba(92, 196, 154, .14); color: #5CC49A; }

/* ── плавающая панель вкладок ─────────────────────────────────── */
.tabbar {
  position: fixed; z-index: 30; left: 16px; right: 16px; bottom: var(--bar-bottom);
  max-width: 528px; height: 68px; margin: 0 auto; padding: 0 6px; border-radius: 34px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  box-shadow: 0 -12px 32px rgba(11, 11, 12, .9);
  display: flex; justify-content: space-around; align-items: center;
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 60px; min-height: 48px; padding: 6px 0; border-radius: 22px;
  color: var(--ink-3); font-size: 10px; transition: color .2s, background-color .2s;
}
.tab:hover { color: var(--ink-2); }
.tab.on { background: rgba(234, 131, 105, .14); color: var(--coral); }
.tab svg { flex: none; }

.fab {
  position: fixed; z-index: 31; right: 24px; bottom: calc(var(--bar-bottom) + 82px);
  width: 56px; height: 56px; border-radius: 28px; background: var(--coral); color: var(--coral-ink);
  display: grid; place-items: center; box-shadow: 0 10px 30px rgba(234, 131, 105, .35);
  transition: transform .25s var(--ease);
}
.fab:active { transform: scale(.94); }
body.toasting .fab { transform: translateY(-64px); }
@media (min-width: 592px) { .fab { right: calc(50% - 280px + 24px); } }

/* ── левое меню от 900 px ─────────────────────────────────────── */
.side { display: none; }
.side-logo { font-family: var(--disp); font-size: 17px; font-weight: 700; letter-spacing: .02em; padding: 4px 12px 8px; }
.side-logo b { color: var(--coral); font-weight: 700; }
.side-add {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; border-radius: 24px;
  background: var(--coral); color: var(--coral-ink); font-size: 15px; font-weight: 600;
  box-shadow: 0 10px 30px rgba(234, 131, 105, .22); transition: background-color .15s;
}
.side-add:hover { background: var(--coral-hi); }
.side-add-ic { font-family: var(--disp); font-size: 20px; line-height: 1; margin-top: -2px; }
.side-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side-link {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 14px;
  color: var(--ink-3); font-size: 14px; font-weight: 500; transition: color .15s, background-color .15s;
}
.side-link:hover { color: var(--ink); background: rgba(255, 255, 255, .03); }
.side-link.on { color: var(--coral); background: rgba(234, 131, 105, .14); }
.side-sep { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 18px 12px 8px; }
.side-me {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 20px; text-align: left;
  border: 1px solid var(--line); background: var(--surface); transition: background-color .15s;
}
.side-me:hover { background: var(--surface-hover); }
.side-me-av { flex: none; width: 38px; height: 38px; border-radius: 19px; background: var(--surface-3); display: grid; place-items: center; font-family: var(--disp); font-size: 15px; font-weight: 600; }
.side-me-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; font-weight: 600; }
.side-me-txt small { font-size: 12px; font-weight: 400; color: var(--ink-3); }

@media (min-width: 900px) {
  .side {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: var(--side-w);
    display: flex; flex-direction: column; gap: 18px; padding: 28px 16px 20px;
    background: var(--sidebar); border-right: 1px solid var(--line);
  }
  .tabbar, .fab { display: none; }
  .main { max-width: none; margin: 0 0 0 var(--side-w); padding: 36px 48px 64px; }
  .page-title { font-size: 28px; }
  .page { max-width: 640px; }
}

/* ── шторка: снизу на телефоне, окном по центру на компьютере ──── */
.scrim {
  position: fixed; inset: 0; z-index: 60; background: rgba(4, 4, 5, .62);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .28s;
}
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; z-index: 61; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto;
  max-height: calc(100vh - 32px - var(--sat)); max-height: calc(100dvh - 32px - var(--sat));
  display: flex; flex-direction: column; outline: none;
  background: #121214; border: 1px solid var(--line-2); border-bottom: 0; border-radius: 28px 28px 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, .5);
  transform: translateY(105%); transition: transform .32s var(--ease);
}
.sheet.on { transform: translateY(0); }
.sheet.dragging { transition: none; }
.sheet-grab { flex: none; display: flex; justify-content: center; padding: 10px 0 0; touch-action: none; }
.sheet-grab i { width: 36px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); }
.sheet-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 10px 10px 20px; touch-action: none; }
.sheet-head .icon-btn:first-child { margin-left: -12px; }
.sheet-title { flex: 1; min-width: 0; font-family: var(--disp); font-size: 18px; font-weight: 600; line-height: 1.25; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px calc(24px + var(--sab)); }
.icon-btn {
  flex: none; width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center;
  color: var(--ink-3); transition: color .15s, background-color .15s;
}
.icon-btn:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }

@media (min-width: 900px) {
  .sheet {
    top: 50%; bottom: auto; right: auto; left: calc(var(--side-w) + (100% - var(--side-w)) / 2);
    width: min(480px, calc(100% - var(--side-w) - 64px)); max-height: min(780px, 88vh);
    border-radius: 28px; border-bottom: 1px solid var(--line-2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
    opacity: 0; transform: translate(-50%, -46%); transition: transform .28s var(--ease), opacity .2s;
  }
  .sheet.on { opacity: 1; transform: translate(-50%, -50%); }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: 14px; }
}

/* шторка «Ещё» */
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.more-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 128px; padding: 16px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  transition: background-color .15s, border-color .15s;
}
.more-tile:hover { color: var(--ink); background: var(--surface-hover); }
.more-tile.on { border-color: rgba(234, 131, 105, .45); }
.more-ic { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; margin-bottom: auto; }
.more-name { font-family: var(--disp); font-size: 15px; font-weight: 600; line-height: 1.25; margin-top: 14px; }
.more-sub { font-size: 13px; color: var(--ink-3); line-height: 1.3; }

/* ── быстрая запись и формы ───────────────────────────────────── */
.qa-list { display: flex; flex-direction: column; gap: 8px; }
.qa-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 12px 12px 12px 14px;
  border-radius: 20px; background: var(--surface); border: 1px solid var(--line); text-align: left;
  transition: background-color .15s;
}
.qa-item:hover { background: var(--surface-hover); }
.qa-ic { flex: none; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; }
.qa-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.qa-name { font-size: 15px; font-weight: 600; }
.qa-sub { font-size: 13px; color: var(--ink-3); }
.qa-go { flex: none; color: #6A6660; display: grid; }

.form { display: flex; flex-direction: column; gap: 18px; padding-top: 2px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-lbl { font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); line-height: 1.3; }
.input {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .04); color: var(--ink); font-size: 16px; line-height: 1.3;
  -webkit-appearance: none; appearance: none; transition: border-color .15s, background-color .15s;
}
.input::placeholder { color: #75716B; }
.input:focus { outline: none; border-color: rgba(234, 131, 105, .6); background: rgba(234, 131, 105, .05); }
textarea.input { resize: none; line-height: 1.45; }
.sum-field { display: flex; align-items: baseline; gap: 10px; padding: 4px 2px 12px; border-bottom: 1px solid var(--line-3); cursor: text; }
.sum-field:focus-within { border-bottom-color: var(--coral); }
.sum-input {
  flex: 0 1 auto; width: 1.6ch; max-width: 100%; min-width: 0; padding: 0; border: 0; background: none; outline: none; color: var(--ink);
  font-family: var(--disp); font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2;
}
.sum-input::placeholder { color: #4D4A46; }
.sum-cur { font-family: var(--disp); font-size: 24px; font-weight: 600; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid rgba(255, 255, 255, .1);
  background: var(--surface); color: var(--ink-2); font-size: 14px; transition: background-color .15s, color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #111; font-weight: 600; }
.form-note { font-size: 13px; line-height: 1.45; color: var(--ink-3); }
.btn-primary {
  min-height: 52px; padding: 0 20px; border-radius: 26px; background: var(--coral); color: var(--coral-ink);
  font-size: 16px; font-weight: 600; transition: background-color .15s, opacity .15s;
}
.btn-primary:hover { background: var(--coral-hi); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border-radius: 24px; border: 1px solid rgba(255, 255, 255, .14); color: var(--ink); font-size: 15px;
  transition: background-color .15s;
}
.btn-ghost:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.set-links { display: flex; flex-direction: column; gap: 4px; margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
.set-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 4px; color: var(--ink-2); font-size: 15px; text-align: left; }
.set-link:hover { color: var(--ink); }
.set-link svg { color: var(--ink-3); }

/* ── тост ─────────────────────────────────────────────────────── */
.toast {
  position: fixed; z-index: 70; left: 16px; right: 16px; bottom: calc(var(--bar-bottom) + 78px);
  max-width: 440px; min-height: 52px; margin: 0 auto; padding: 4px 6px 4px 16px;
  display: flex; align-items: center; gap: 10px; border-radius: 18px;
  background: var(--surface-3); border: 1px solid var(--line-3); box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  font-size: 14px; line-height: 1.35; opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .22s, transform .22s var(--ease);
}
.toast.on { opacity: 1; transform: none; pointer-events: auto; }
.toast-text { flex: 1; min-width: 0; padding: 8px 0; }
.toast-undo { flex: none; min-height: 44px; padding: 0 14px; border-radius: 22px; color: var(--coral); font-weight: 600; }
.toast-undo:hover { background: rgba(234, 131, 105, .1); }
@media (min-width: 900px) { .toast { left: var(--side-w); right: 0; bottom: 28px; } }

/* ── заглушки разделов ────────────────────────────────────────── */
.stub {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 22px 20px;
  border-radius: 24px; border: 1px solid var(--line); background: linear-gradient(180deg, #1C1B22 0%, #161618 100%);
}
.stub-ic { width: 48px; height: 48px; border-radius: 24px; display: grid; place-items: center; background: rgba(234, 131, 105, .12); color: var(--coral); }
.stub-title { font-family: var(--disp); font-size: 18px; font-weight: 600; line-height: 1.3; }
.stub-text { font-size: 15px; line-height: 1.5; color: var(--ink-2); }
.stub .btn-ghost { margin-top: 6px; }

/* ── вход ─────────────────────────────────────────────────────── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  position: relative; overflow: hidden; width: 100%; max-width: 360px; padding: 40px 24px 26px;
  display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: center; border-radius: 32px;
  background: radial-gradient(120% 70% at 50% 0%, #3A2622 0%, #1C1719 50%, #121214 100%);
  border: 1px solid rgba(255, 255, 255, .09); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 24px 60px rgba(0, 0, 0, .5);
}
.login-glow {
  position: absolute; left: 50%; top: -70px; width: 240px; height: 240px; margin-left: -120px; border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 150, 110, .42) 0%, rgba(234, 131, 105, .1) 45%, rgba(234, 131, 105, 0) 70%);
  filter: blur(18px); pointer-events: none;
}
.login-card > :not(.login-glow) { position: relative; }
.login-logo { font-family: var(--disp); font-size: 26px; font-weight: 700; letter-spacing: .01em; }
.login-sub { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #B7B2AA; }
.login-pin {
  height: 60px; margin-top: 6px; border-radius: 18px; border: 1px solid var(--line-3); background: rgba(255, 255, 255, .05);
  color: var(--ink); text-align: center; font-family: var(--mono); font-size: 26px; font-weight: 500;
  letter-spacing: .5em; padding: 0 0 0 .5em; -webkit-appearance: none; appearance: none;
}
.login-pin:focus { outline: none; border-color: rgba(234, 131, 105, .6); }
.login-pin::placeholder { color: #5E5A55; }
.login-err { min-height: 20px; font-size: 14px; color: #F08A8A; }

/* ── скелет, пока грузится ────────────────────────────────────── */
.sk { position: relative; overflow: hidden; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.sk::after {
  content: ''; position: absolute; inset: 0; transform: translateX(-100%); animation: shimmer 1.4s infinite;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .035), transparent);
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-row { height: 70px; }

.noscript { padding: 40px 16px; text-align: center; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
