/* app.css — интерфейс «МедСервис» под iPhone, светлая и тёмная темы. */

:root {
  --bg: #f1f3f7;
  --surface: #ffffff;
  --surface-2: #f5f6f9;
  --surface-3: #eceef3;
  --text: #111827;
  --muted: #6b7280;
  --muted-2: #9aa1ad;
  --line: rgba(17, 24, 39, 0.08);
  --line-strong: rgba(17, 24, 39, 0.14);
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -16px rgba(16, 24, 40, 0.25);
  --radius: 16px;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #2563eb;
  --violet: #7c3aed;
  --green: #059669;
  --gray: #64748b;
  --teal: #0f766e;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1016;
    --surface: #151b23;
    --surface-2: #1b232d;
    --surface-3: #232c38;
    --text: #e8eef5;
    --muted: #93a0b0;
    --muted-2: #6c7a8b;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --accent: #2dd4bf;
    --accent-ink: #04211e;
    --accent-soft: rgba(45, 212, 191, 0.14);
    --danger: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --red: #f87171;
    --amber: #fbbf24;
    --blue: #60a5fa;
    --violet: #a78bfa;
    --green: #34d399;
    --gray: #94a3b8;
    --teal: #2dd4bf;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, system-ui, sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
}

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

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  height: 100dvh;
  max-width: 100%;
}

.appbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 4px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 10px 6px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  min-height: 52px;
}

.appbar-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 2px;
}

.appbar-actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--text);
  flex: none;
}

.icon-btn:active {
  background: var(--surface-3);
}

.icon-btn.hidden {
  display: none;
}

.view {
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 12px;
}

.page {
  padding: 12px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid var(--line);
  z-index: 30;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px 4px;
  border-radius: 12px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
}

.tab.on {
  color: var(--accent);
}

.tab.on svg {
  stroke-width: 2.1;
}

/* ---------- типографика и мелочи ---------- */

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

.small {
  font-size: 12.5px;
}

.tiny {
  font-size: 11.5px;
  color: var(--muted-2);
}

.pad {
  padding: 10px 2px;
}

.pre {
  white-space: pre-wrap;
  margin: 6px 0 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-title {
  font-size: 22px;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.sub-line {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: -6px;
}

.list-count {
  font-size: 12px;
  color: var(--muted-2);
  padding: 0 4px;
  margin-top: -10px;
  margin-bottom: -8px;
}

.link-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

/* ---------- hero ---------- */

.hero {
  padding: 6px 2px 0;
}

.hero-date {
  font-size: 12.5px;
  color: var(--muted);
  text-transform: capitalize;
}

.hero-title {
  font-size: 27px;
  letter-spacing: -0.7px;
  margin: 2px 0 2px;
}

.hero-sub {
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- KPI ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  box-shadow: var(--shadow);
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-value {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
}

.kpi-caption {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 3px;
}

.kpi-bad .kpi-value {
  color: var(--red);
}
.kpi-warn .kpi-value {
  color: var(--amber);
}
.kpi-good .kpi-value {
  color: var(--green);
}

/* ---------- быстрые действия ---------- */

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.qa {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 64px;
  padding: 0 4px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow);
  white-space: nowrap;
  overflow: hidden;
}

.qa:active {
  background: var(--surface-3);
}

.qa svg {
  color: var(--accent);
}

/* ---------- секции и списки ---------- */

.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

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

.section-count {
  font-size: 12px;
  color: var(--muted-2);
  font-weight: 600;
}

.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.list > * + * {
  border-top: 1px solid var(--line);
}

.list.muted-list {
  opacity: 0.72;
}

.row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  background: var(--surface);
  min-height: 58px;
}

.row-tap:active {
  background: var(--surface-2);
}

.row-lead {
  flex: none;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
}

.row-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 3px;
}

.row-badge {
  flex: none;
  display: flex;
  align-items: center;
  max-width: 45%;
}

.row-trail {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
}

.row-actions {
  display: flex;
  gap: 0;
}

.row-chevron {
  flex: none;
  color: var(--muted-2);
  margin-left: -4px;
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 96px;
}

.progress {
  height: 5px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress.big {
  height: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.3s ease;
}

/* ---------- чипы ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--muted);
}

.chip-red {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
}
.chip-amber {
  background: rgba(217, 119, 6, 0.14);
  color: #b45309;
}
.chip-blue {
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}
.chip-violet {
  background: rgba(124, 58, 237, 0.12);
  color: #6d28d9;
}
.chip-green {
  background: rgba(5, 150, 105, 0.13);
  color: #047857;
}
.chip-gray {
  background: rgba(100, 116, 139, 0.14);
  color: #475569;
}

@media (prefers-color-scheme: dark) {
  .chip-red {
    background: rgba(248, 113, 113, 0.16);
    color: #fca5a5;
  }
  .chip-amber {
    background: rgba(251, 191, 36, 0.16);
    color: #fcd34d;
  }
  .chip-blue {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
  }
  .chip-violet {
    background: rgba(167, 139, 250, 0.16);
    color: #c4b5fd;
  }
  .chip-green {
    background: rgba(52, 211, 153, 0.16);
    color: #6ee7b7;
  }
  .chip-gray {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
  }
}

.chips-scroll {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.chips-scroll::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.chip-btn.chip-on {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
}

.chip-count {
  font-size: 11.5px;
  opacity: 0.7;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- плитки/аватары ---------- */

.dot-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--muted);
  flex: none;
}

.dot-tile.big {
  width: 50px;
  height: 50px;
  border-radius: 15px;
}

.tone-red {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
}
.tone-amber {
  background: rgba(217, 119, 6, 0.13);
  color: var(--amber);
}
.tone-blue {
  background: rgba(37, 99, 235, 0.11);
  color: var(--blue);
}
.tone-violet {
  background: rgba(124, 58, 237, 0.11);
  color: var(--violet);
}
.tone-green {
  background: rgba(5, 150, 105, 0.12);
  color: var(--green);
}
.tone-gray {
  background: var(--surface-3);
  color: var(--gray);
}
.tone-teal {
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
}

.avatar-violet {
  background: rgba(124, 58, 237, 0.12);
  color: var(--violet);
}

.avatar-teal-big {
  width: 56px;
  height: 56px;
  font-size: 19px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}

.prio {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-3);
  color: var(--muted);
}

.prio-high {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
}
.prio-normal {
  background: rgba(37, 99, 235, 0.1);
  color: var(--blue);
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.big-name {
  font-size: 17px;
  font-weight: 700;
}

.field-line {
  display: grid;
  grid-template-columns: 34% 1fr;
  gap: 10px;
  font-size: 13.5px;
  align-items: baseline;
}

.fl-label {
  color: var(--muted);
}

.fl-value {
  font-weight: 550;
  word-break: break-word;
}

.sdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray);
  flex: none;
}

.sdot.ok {
  background: var(--green);
}

.sdot.off {
  background: var(--red);
}

/* ---------- профиль ---------- */

.profile {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
}

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

.profile-name {
  font-size: 21px;
  letter-spacing: -0.4px;
  line-height: 1.2;
}

.profile-kind {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.contact-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  color: var(--text);
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.contact-line svg {
  color: var(--accent);
  flex: none;
}

.contact-line a {
  color: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.stat b {
  font-size: 16px;
  font-weight: 750;
  letter-spacing: -0.3px;
}

.stat span {
  font-size: 11.5px;
  color: var(--muted);
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-row .btn {
  min-width: 0;
  font-size: 14px;
  padding: 0 10px;
}

.action-row.four .btn {
  font-size: 13px;
  padding: 0 6px;
}

.rem-chev {
  color: var(--muted-2);
  display: flex;
  align-items: center;
  align-self: center;
}

/* строки напоминаний: своя разметка, чтобы заголовок не сжимался */
.rem-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 13px;
  background: var(--surface);
}

.rem-row:active {
  background: var(--surface-2);
}

.rem-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.rem-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.rem-sub {
  font-size: 12.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rem-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

/* ---------- сегменты и статусы ---------- */

.segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.seg {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 7px 7px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}

.seg-count {
  font-size: 10.5px;
  opacity: 0.65;
  flex: none;
}

.btn-block {
  width: 100%;
}

.status-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 2px;
}

.status-pick {
  flex: none;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}

.status-pick.on {
  background: var(--text);
  color: var(--bg);
  border-color: transparent;
}

.warranty {
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: 10px;
}

.warranty-ok {
  background: rgba(5, 150, 105, 0.1);
  color: var(--green);
}
.warranty-soon {
  background: rgba(217, 119, 6, 0.12);
  color: var(--amber);
}
.warranty-expired {
  background: rgba(220, 38, 38, 0.11);
  color: var(--red);
}

/* ---------- оплата ---------- */

.pay-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pay-top,
.pay-bottom {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--muted);
}

.pay-top b {
  font-size: 15.5px;
  color: var(--text);
}

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: transform 0.08s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.985);
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.55;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-soft {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.danger-text {
  color: var(--danger);
}

.mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.mini-btn:active {
  background: var(--surface-3);
}

.btn-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
}

.btn-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- формы ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  padding-left: 2px;
}

.req {
  color: var(--danger);
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted-2);
  padding-left: 2px;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.input {
  resize: vertical;
  line-height: 1.4;
  min-height: 84px;
}

select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 19px,
    calc(100% - 13px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input[type='date'].input {
  min-height: 44px;
  font-size: 16px;
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
}

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

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

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted-2);
  box-shadow: var(--shadow);
}

.search-input {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding-left: 0;
  font-size: 16px;
}

.search-input:focus {
  box-shadow: none;
  border-color: transparent;
}

.search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* ---------- пустые состояния ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 34px 20px;
  text-align: center;
}

.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted-2);
  margin-bottom: 2px;
}

.empty-title {
  font-size: 15.5px;
  font-weight: 650;
}

.empty-hint {
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
}

.empty .btn {
  margin-top: 8px;
}

/* ---------- шторка ---------- */

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 12, 18, 0.42);
  opacity: 0;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-overlay.show {
  opacity: 1;
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.26s cubic-bezier(0.22, 0.8, 0.24, 1);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18);
}

.sheet-overlay.show .sheet {
  transform: translateY(0);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 11px 8px 18px;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
}

.sheet-foot {
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.confirm-text {
  margin: 4px 0 8px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.45;
}

.welcome-text {
  font-size: 15px;
  line-height: 1.45;
  margin: 2px 0 0;
}

/* ---------- тосты ---------- */

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  padding: 0 16px;
}

.toast {
  max-width: 420px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.24);
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast-good {
  background: rgba(5, 100, 75, 0.95);
}

.toast-bad {
  background: rgba(160, 24, 24, 0.95);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: rgba(226, 232, 240, 0.95);
    color: #0b1016;
  }
  .toast-good {
    background: rgba(52, 211, 153, 0.95);
    color: #04211e;
  }
  .toast-bad {
    background: rgba(248, 113, 113, 0.95);
    color: #2a0505;
  }
}

/* ---------- заметки и таймлайн ---------- */

.note-row {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.note-date {
  font-size: 11.5px;
  color: var(--muted-2);
  font-weight: 600;
}

.note-text {
  font-size: 14px;
  line-height: 1.4;
  white-space: pre-wrap;
}

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

.tl-item {
  display: flex;
  gap: 10px;
  padding-bottom: 14px;
  position: relative;
}

.tl-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted-2);
  margin-top: 5px;
  flex: none;
  position: relative;
  z-index: 1;
}

.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 12px;
  bottom: -2px;
  width: 1.5px;
  background: var(--line-strong);
}

.tl-ticket .tl-dot {
  background: var(--amber);
}
.tl-payment .tl-dot {
  background: var(--green);
}
.tl-note .tl-dot {
  background: var(--blue);
}
.tl-contract .tl-dot {
  background: var(--violet);
}
.tl-equipment .tl-dot {
  background: var(--teal);
}

.tl-body {
  flex: 1;
  min-width: 0;
}

.tl-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.tl-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ---------- прочее ---------- */

.steps {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--muted);
}

.quiet-note {
  font-size: 12px;
  color: var(--muted-2);
  text-align: center;
  padding: 4px 20px 8px;
  line-height: 1.5;
}

.about {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted-2);
  padding-top: 10px;
}

.boot {
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
}

.boot-logo {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
}

.boot-text {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.fatal {
  padding: 40px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- большие экраны ---------- */

@media (min-width: 700px) {
  body {
    background: #e6e9ef;
  }
  .app {
    max-width: 480px;
    margin: 0 auto;
    height: 100dvh;
    background: var(--bg);
    box-shadow: 0 0 60px rgba(16, 24, 40, 0.18);
    position: relative;
  }
  .sheet {
    border-radius: 20px;
    margin-bottom: 24px;
    max-height: 84dvh;
  }
  .sheet-overlay {
    align-items: center;
  }
  .sheet-overlay.show .sheet {
    transform: none;
  }
  .sheet {
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.22s ease;
  }
  .sheet-overlay.show .sheet {
    opacity: 1;
  }
}

@media (prefers-color-scheme: dark) {
  body {
    background: #060a0f;
  }
  .app {
    background: var(--bg);
  }
}

/* iOS: убираем «резинку» у body, скроллим только .view */
html {
  overscroll-behavior: none;
}

@media (max-width: 360px) {
  .kpi-value {
    font-size: 19px;
  }
  .page {
    padding: 10px 12px 24px;
  }
}
