/* Панель «Матчинг». Сначала телефон, затем широкий экран с боковым меню.
   Все цвета заданы ролями в одном месте; тёмная и светлая схемы — два набора одних и тех же ролей. */

:root {
  color-scheme: light;
  --bg: #f2f4fa;
  --surface: #ffffff;
  --surface-2: #f5f6fb;
  --surface-3: #e9ecf5;
  --surface-float: rgba(255, 255, 255, 0.86);
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.14);
  --ink: #0e1422;
  --ink-2: #485267;
  --muted: #78829a;
  --accent: #4f5bea;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(79, 91, 234, 0.11);
  --fill-1: #4f5bea;
  --fill-2: #8b5cf6;
  --accent-shadow: rgba(79, 91, 234, 0.3);
  --track: #dfe3f3;
  --good: #0c9a68;
  --good-soft: rgba(12, 154, 104, 0.12);
  --warning: #c27a03;
  --warning-soft: rgba(224, 150, 14, 0.16);
  --serious: #d9601a;
  --serious-soft: rgba(217, 96, 26, 0.13);
  --critical: #d63a3a;
  --critical-soft: rgba(214, 58, 58, 0.11);
  --glow-1: rgba(79, 91, 234, 0.13);
  --glow-2: rgba(139, 92, 246, 0.1);
  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04), 0 10px 28px rgba(17, 24, 39, 0.05);
  --shadow-float: 0 12px 36px rgba(17, 24, 39, 0.16);
  --radius: 20px;
  --nav-space: 104px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #090c13;
    --surface: #121723;
    --surface-2: #19202f;
    --surface-3: #232c40;
    --surface-float: rgba(22, 28, 42, 0.84);
    --line: rgba(255, 255, 255, 0.07);
    --line-strong: rgba(255, 255, 255, 0.13);
    --ink: #f2f4fa;
    --ink-2: #a9b2c7;
    --muted: #76809a;
    --accent: #7f90ff;
    --accent-2: #b384ff;
    --accent-soft: rgba(127, 144, 255, 0.16);
    --fill-1: #5b68f0;
    --fill-2: #8f62f2;
    --accent-shadow: rgba(111, 124, 255, 0.34);
    --track: #232b40;
    --good: #3dd68c;
    --good-soft: rgba(61, 214, 140, 0.14);
    --warning: #f5b83d;
    --warning-soft: rgba(245, 184, 61, 0.15);
    --serious: #ff9259;
    --serious-soft: rgba(255, 146, 89, 0.15);
    --critical: #ff6e6e;
    --critical-soft: rgba(255, 110, 110, 0.14);
    --glow-1: rgba(111, 124, 255, 0.2);
    --glow-2: rgba(179, 132, 255, 0.14);
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 14px 34px rgba(0, 0, 0, 0.28);
    --shadow-float: 0 16px 44px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090c13;
  --surface: #121723;
  --surface-2: #19202f;
  --surface-3: #232c40;
  --surface-float: rgba(22, 28, 42, 0.84);
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);
  --ink: #f2f4fa;
  --ink-2: #a9b2c7;
  --muted: #76809a;
  --accent: #7f90ff;
  --accent-2: #b384ff;
  --accent-soft: rgba(127, 144, 255, 0.16);
  --fill-1: #5b68f0;
  --fill-2: #8f62f2;
  --accent-shadow: rgba(111, 124, 255, 0.34);
  --track: #232b40;
  --good: #3dd68c;
  --good-soft: rgba(61, 214, 140, 0.14);
  --warning: #f5b83d;
  --warning-soft: rgba(245, 184, 61, 0.15);
  --serious: #ff9259;
  --serious-soft: rgba(255, 146, 89, 0.15);
  --critical: #ff6e6e;
  --critical-soft: rgba(255, 110, 110, 0.14);
  --glow-1: rgba(111, 124, 255, 0.2);
  --glow-2: rgba(179, 132, 255, 0.14);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 14px 34px rgba(0, 0, 0, 0.28);
  --shadow-float: 0 16px 44px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15.5px/1.45 "Inter", "Segoe UI Variable Text", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Мягкое свечение фирменного цвета за содержимым. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 42% at 12% -8%, var(--glow-1), transparent 70%),
    radial-gradient(60% 36% at 105% 2%, var(--glow-2), transparent 70%);
}

h1,
h2,
h3,
p,
dl,
dd,
ol,
ul {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.icon {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.defs {
  position: absolute;
  width: 0;
  height: 0;
}

.grad-a {
  stop-color: var(--accent);
}

.grad-b {
  stop-color: var(--accent-2);
}

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

.muted {
  color: var(--ink-2);
}

.small {
  font-size: 13px;
}

.block {
  display: block;
}

.center {
  text-align: center;
}

.mono {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  letter-spacing: 0.02em;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* Тон состояния: цвет значка и мягкая подложка. Смысл всегда дублируется значком и подписью. */
.tone-neutral {
  --tone: var(--muted);
  --tone-soft: var(--surface-3);
}

.tone-info {
  --tone: var(--accent);
  --tone-soft: var(--accent-soft);
}

.tone-good {
  --tone: var(--good);
  --tone-soft: var(--good-soft);
}

.tone-warning {
  --tone: var(--warning);
  --tone-soft: var(--warning-soft);
}

.tone-serious {
  --tone: var(--serious);
  --tone-soft: var(--serious-soft);
}

.tone-critical {
  --tone: var(--critical);
  --tone-soft: var(--critical-soft);
}

/* --- каркас ------------------------------------------------------------------ */

.app {
  min-height: 100dvh;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  display: none;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 60px;
  padding: 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.topbar h1 {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.logo {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2));
  box-shadow: 0 6px 16px var(--accent-shadow);
  color: #ffffff;
}

.logo.large {
  width: 60px;
  height: 60px;
  border-radius: 19px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-soft);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.pill .icon {
  color: var(--warning);
}

.icon-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button:disabled {
  opacity: 0.6;
}

.icon-button.is-busy .icon {
  animation: spin 0.9s linear infinite;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
  padding: 6px 14px calc(var(--nav-space) + env(safe-area-inset-bottom));
  transition: opacity 0.15s;
}

.content.is-refreshing {
  opacity: 0.7;
}

.cols {
  display: grid;
  gap: 14px;
}

.wide-only {
  display: none;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* Нижнее меню телефона: парящая панель. */
.tabbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  max-width: 520px;
  margin: 0 auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-float);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  box-shadow: var(--shadow-float);
}

.tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 8px 2px 6px;
  border-radius: 18px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.2s, color 0.2s;
}

.tab.is-active {
  background: var(--accent-soft);
  color: var(--ink);
}

.tab.is-active .icon {
  color: var(--accent);
}

.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
}

.badge {
  position: absolute;
  top: -6px;
  left: 12px;
  min-width: 18px;
  padding: 0 5px;
  border: 2px solid var(--surface);
  border-radius: 10px;
  background: var(--critical);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 15px;
  text-align: center;
}

/* --- карточки ---------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

a.card,
button.card {
  transition: transform 0.15s, border-color 0.15s;
}

a.card:active,
button.card:active {
  transform: scale(0.985);
}

.card.flush {
  gap: 0;
  padding: 4px 16px;
}

.card.notice {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 34px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink-2);
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: var(--surface-2);
  color: var(--muted);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 4px 0;
}

.section-head h2 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 650;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.row.between {
  justify-content: space-between;
}

.row.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1;
  min-width: 0;
}

.actions,
.card-actions,
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions .button {
  flex: 1 1 100%;
}

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

.reason {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--tone-soft, var(--surface-2));
  font-size: 14px;
  overflow-wrap: anywhere;
}

.reason .icon {
  margin-top: 1px;
  color: var(--tone, var(--muted));
}

/* --- приветствие и главная цифра --------------------------------------------- */

.greeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px 0;
}

.greeting h2 {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.hero-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(135deg, #4a56e8 0%, #7a5cf0 55%, #a05cf2 100%);
  box-shadow: 0 18px 40px var(--accent-shadow);
  color: #ffffff;
}

.hero-card::before,
.hero-card::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.11);
  pointer-events: none;
}

.hero-card::before {
  top: -70px;
  right: -50px;
  width: 210px;
  height: 210px;
}

.hero-card::after {
  right: 70px;
  bottom: -90px;
  width: 170px;
  height: 170px;
  background: rgba(255, 255, 255, 0.07);
}

.hero-card > * {
  position: relative;
}

.hero-label {
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0.86;
}

.hero-value {
  font-size: clamp(34px, 11vw, 46px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.hero-card .meter {
  height: 8px;
  background: rgba(255, 255, 255, 0.24);
}

.hero-card .meter-fill {
  background: #ffffff;
}

.hero-facts {
  display: flex;
  gap: 22px;
}

.hero-facts dt {
  font-size: 12.5px;
  opacity: 0.8;
}

.hero-facts dd {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* --- показатели ----------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.15s;
}

a.stat:active {
  transform: scale(0.97);
}

.stat.is-alert {
  border-color: color-mix(in srgb, var(--critical) 55%, transparent);
  background: linear-gradient(180deg, var(--critical-soft), transparent 75%), var(--surface);
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--tone-soft);
  color: var(--tone);
}

.badge-icon.round {
  border-radius: 50%;
}

.badge-icon.small {
  width: 30px;
  height: 30px;
  border-radius: 10px;
}

.stat-value {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
}

/* --- заявка в списке -------------------------------------------------------------- */

.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.avatar.user {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2));
  color: #ffffff;
}

.avatar.large {
  width: 54px;
  height: 54px;
  font-size: 17px;
}

.request-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.request-id {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.request-title {
  min-width: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-sums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.sum {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.requisites {
  font-size: 16px;
}

/* Полоса прогресса: дорожка и заливка одного тона. */
.meter {
  height: 7px;
  border-radius: 99px;
  background: var(--track);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  min-width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
}

.meter.is-full .meter-fill {
  background: var(--good);
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--tone-soft, var(--surface-2));
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timer .icon {
  color: var(--tone, var(--muted));
}

.timer.urgency-serious {
  --tone: var(--serious);
  --tone-soft: var(--serious-soft);
}

.timer.urgency-critical {
  --tone: var(--critical);
  --tone-soft: var(--critical-soft);
}

/* --- метки состояния ------------------------------------------------------------ */

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}

.chip .icon {
  color: var(--tone);
}

/* --- шкала этапов заявки ---------------------------------------------------------- */

.stepper {
  display: flex;
  padding: 4px 0 2px;
}

.step {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.step::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--track);
}

.step:first-child::before {
  display: none;
}

.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 3px solid var(--surface);
  border-radius: 50%;
  background: var(--track);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.step.is-done::before,
.step.is-current::before {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.step.is-done .step-dot {
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2));
  color: #ffffff;
}

.step.is-current {
  color: var(--ink);
}

.step.is-current .step-dot {
  background: var(--tone, var(--accent));
  color: #ffffff;
  box-shadow: 0 0 0 5px var(--tone-soft, var(--accent-soft));
}

.step.is-current.state-work .step-dot {
  animation: pulse 2.2s ease-in-out infinite;
}

.step.state-halt {
  --tone: var(--warning);
  --tone-soft: var(--warning-soft);
}

.step.state-stop {
  --tone: var(--critical);
  --tone-soft: var(--critical-soft);
}

/* --- кольцо прогресса и суммы в карточке заявки ------------------------------------ */

.progress {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ring {
  position: relative;
  flex: none;
  width: 112px;
  height: 112px;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--track);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: url(#accent-gradient);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

.ring.is-full .ring-fill {
  stroke: var(--good);
}

.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.ring-label strong {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.ring-label span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.progress-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.big-value {
  font-size: clamp(28px, 8.4vw, 38px);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.label {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.facts > div {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-2);
}

.facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.facts dd {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 12px;
  border-radius: 14px;
  background: var(--tone-soft);
  font-size: 14px;
}

.banner .icon {
  margin-top: 1px;
  color: var(--tone);
}

/* --- списки ----------------------------------------------------------------------- */

.lines {
  display: flex;
  flex-direction: column;
}

.line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.line:first-child {
  border-top: 0;
}

.line.link {
  min-height: 60px;
}

.line-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.line-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.line .chevron {
  color: var(--muted);
}

.timeline {
  display: flex;
  flex-direction: column;
}

.timeline li {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0 0 14px 24px;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--tone, var(--muted));
  box-shadow: 0 0 0 3px var(--tone-soft, var(--surface-3));
}

.timeline li::after {
  content: "";
  position: absolute;
  top: 20px;
  bottom: 0;
  left: 4px;
  width: 2px;
  border-radius: 1px;
  background: var(--line-strong);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li:last-child::after {
  display: none;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding-left: 38px;
  color: var(--ink-2);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: -1px;
  left: 0;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

.filters {
  display: flex;
  gap: 8px;
  margin: 0 -14px;
  padding: 2px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  flex: none;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 600;
}

.filter.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2));
  box-shadow: 0 6px 16px var(--accent-shadow);
  color: #ffffff;
}

.notification {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.notification.is-unread {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 60%), var(--surface);
}

.notification-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.unread-dot {
  flex: none;
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- чеки ------------------------------------------------------------------------- */

.receipt {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.receipt:first-child {
  padding-top: 0;
  border-top: 0;
}

.receipt:last-child {
  padding-bottom: 0;
}

.receipt-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.receipt-name {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 120px;
}

.receipt-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.printed {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.printed span {
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.notes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.notes li {
  position: relative;
  padding-left: 14px;
}

.notes li::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
}

.coverage {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coverage-count {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* --- кнопки и формы ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 650;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s, filter 0.15s, background 0.15s;
}

.button:active {
  transform: scale(0.97);
}

.button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--fill-1), var(--fill-2));
  box-shadow: 0 8px 20px var(--accent-shadow);
  color: #ffffff;
}

.button.danger {
  border-color: transparent;
  background: var(--critical-soft);
  color: var(--critical);
}

.button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--accent);
}

.button.small {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 11px;
  font-size: 13.5px;
}

.button.block {
  width: 100%;
}

.button:disabled {
  opacity: 0.5;
  box-shadow: none;
  cursor: default;
}

:is(.button, .icon-button, .tab, .nav-link, .filter, .stat, .card, .segment, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.form {
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 13.5px;
  font-weight: 650;
}

.field-hint {
  color: var(--ink-2);
  font-size: 13px;
}

input:not([type="checkbox"]),
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

.check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-weight: 550;
}

.check input {
  flex: none;
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.form-error {
  min-height: 20px;
  color: var(--critical);
  font-size: 14px;
  font-weight: 650;
}

.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border-radius: 15px;
  background: var(--surface-2);
}

.segment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
}

.segment.is-active {
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  color: var(--ink);
}

/* --- вход ------------------------------------------------------------------------- */

.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  min-height: 100dvh;
  padding: 24px 16px;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.login-brand h1 {
  font-size: 30px;
  font-weight: 780;
  letter-spacing: -0.03em;
}

.login {
  width: 100%;
  max-width: 390px;
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
}

/* --- диалог и сообщения ------------------------------------------------------------- */

.dialog {
  width: 100%;
  max-width: 100%;
  margin: auto 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  color: var(--ink);
  animation: sheet 0.22s ease-out;
}

.dialog::backdrop {
  background: rgba(5, 8, 14, 0.56);
  backdrop-filter: blur(3px);
}

.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
}

.dialog-body h2 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.dialog-actions .button {
  flex: 1;
}

.toasts {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(66px + env(safe-area-inset-top)); /* сверху: сообщение не закрывает кнопки действий */
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 520px;
  padding: 12px 16px 12px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  font-size: 14px;
  font-weight: 600;
  animation: drop 0.22s ease-out;
}

.toast .icon {
  color: var(--tone);
}

.skeleton {
  height: 104px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 20%, var(--surface-2) 40%, var(--surface) 60%);
  background-size: 300% 100%;
  animation: shimmer 1.3s linear infinite;
}

.skeleton.tall {
  height: 168px;
}

/* --- широкий экран: боковое меню и две колонки ------------------------------------------ */

@media (min-width: 620px) {
  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .actions .button {
    flex: 1 1 calc(50% - 4px);
  }

  .dialog {
    width: min(92vw, 460px);
    margin: auto;
    border-bottom: 1px solid var(--line);
    border-radius: 26px;
  }
}

@media (min-width: 1024px) {
  :root {
    --nav-space: 40px;
  }

  .shell {
    grid-template-columns: 264px minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: 100dvh;
    padding: 22px 14px 18px;
    border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 55%, transparent);
  }

  .sidebar .brand {
    padding: 0 8px;
  }

  .nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
  }

  .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border-radius: 14px;
    color: var(--ink-2);
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
  }

  .nav-link:hover {
    background: var(--surface-2);
    color: var(--ink);
  }

  .nav-link.is-active {
    background: var(--accent-soft);
    color: var(--ink);
  }

  .nav-link.is-active .icon {
    color: var(--accent);
  }

  .nav-link .badge {
    position: static;
    margin-left: auto;
    border: 0;
    line-height: 18px;
  }

  .side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
  }

  .tabbar {
    display: none;
  }

  .topbar {
    min-height: 72px;
    padding: 14px 32px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .topbar .brand {
    display: none;
  }

  .content {
    max-width: 1120px;
    margin: 0;
    padding: 4px 32px 40px;
  }

  .content.narrow {
    max-width: 720px;
  }

  .cols {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
    align-items: start;
    gap: 20px;
  }

  .wide-only {
    display: block;
  }

  .list-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .filters {
    margin: 0;
    padding: 2px 0;
  }

  .toasts {
    left: 264px;
  }

  a.card:hover,
  a.stat:hover {
    border-color: color-mix(in srgb, var(--accent) 45%, transparent);
    transform: translateY(-2px);
  }

  .button:hover:not(:disabled) {
    filter: brightness(1.06);
  }
}

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

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 9px transparent;
  }
}

@keyframes shimmer {
  to {
    background-position: -300% 0;
  }
}

@keyframes sheet {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
}

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