/* Soft Beauty CRM — mobile-first */
:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #8b5cf6;
  --accent-soft: #ede9fe;
  --rose: #f472b6;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #f87171;
  --radius: 20px;
  --radius-sm: 14px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 4px 20px rgba(17, 24, 39, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

#shell {
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
}

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

.app-wrap {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 8px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.icon-btn {
  border: none;
  background: var(--card);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.trial-pill {
  display: inline-block;
  margin: 0 16px 8px;
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

.trial-pill--active-demo {
  max-width: calc(100% - 32px);
  box-sizing: border-box;
}

.content {
  padding: 0 16px 24px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  margin-bottom: 12px;
}

.card.compact {
  padding: 12px 14px;
}

/* Список клиентов: белая карточка + тонкий фирменный акцент */
.client-card.card {
  cursor: pointer;
  border-left: 3px solid var(--accent);
  transition:
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.client-card:hover {
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.35);
}

.client-card:active {
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.12);
}

.client-card .status-line {
  color: var(--muted);
}

/* Завершение записи: карточка материала (название + круглая «×», поле ниже) */
.c-mat-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.c-mat-card__title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  line-height: 1.35;
  font-size: 1rem;
  word-break: break-word;
  overflow-wrap: break-word;
}

button.c-mat-remove {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: none;
}

button.c-mat-remove:active {
  opacity: 0.85;
  background: var(--accent-soft);
}

.card-title {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-big {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.stat-grid .card {
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, #8b5cf6, #ec4899);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-cautious {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: none;
}

.btn-cautious:hover {
  border-color: rgba(0, 0, 0, 0.28);
  background: var(--bg);
}

.btn-cautious:active {
  transform: translateY(1px);
}

.material-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  align-items: stretch;
}

.material-detail__actions .btn {
  width: auto;
}

.material-detail__actions .btn-primary {
  flex: 1;
  min-width: 160px;
}

.material-detail__actions .btn-secondary {
  flex: 0 1 auto;
  min-width: 140px;
}

/* Вспомогательное действие в карточке записи — перенос (слабее «Завершить») */
.btn.btn-reschedule {
  width: auto;
  max-width: 100%;
  padding: 6px 12px;
  min-height: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
  align-self: flex-start;
}

.btn.btn-reschedule:hover {
  color: var(--text);
  border-color: #d1d5db;
  background: var(--bg);
}

.btn.btn-reschedule:active {
  background: var(--accent-soft);
  color: var(--text);
}

.record-card__appt-actions {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}

/* Два действия в строку (например «Перенести» и «Отменить») */
.record-card__appt-actions-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.record-card__appt-actions-row .btn {
  flex: 1;
  width: auto;
  padding: 10px;
}

/* Поле даты: показываем ДД.ММ.ГГГГ, но открываем календарь */
.date-overlay {
  position: relative;
}

.date-overlay__ui {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.date-overlay__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 2;
  cursor: pointer;
}

/* Мастер записи: единый вид информационных карточек (шаги 1–4) */
.wizard-info-card {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
}

.wizard-info-card__title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

/* Вторичные действия под карточкой (клиент, услуга, наценка) — столбик, на всю ширину */
.wizard-step-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.wizard-step-actions .btn {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px dashed var(--accent-soft);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  margin-bottom: 12px;
}

.field:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

textarea.field {
  min-height: 88px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 10px;
}

.row .field {
  flex: 1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.chip.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.difficulty-scale {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.difficulty-scale button {
  flex: 1;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}

.difficulty-scale button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.service-card,
.client-card,
.record-card {
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.service-card:active,
.client-card:active,
.record-card:active {
  transform: scale(0.99);
}

.sv-price-card {
  cursor: default;
}

.client-card.is-selected,
.service-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.warn {
  background: #fef3c7;
  color: #b45309;
}

.badge.ok {
  background: #d1fae5;
  color: #047857;
}

/* Склад: нет в наличии — спокойно, без резкого красного */
.badge.out {
  background: #f4f4f5;
  color: #9f5969;
}

.status-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 6px;
}

.appt-notes {
  margin-top: 6px;
}

.appt-notes__line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.appt-notes__line:first-child {
  margin-top: 0;
}

.nav-bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0));
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 50;
}

.nav-bottom a {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.56rem;
  color: var(--muted);
  padding: 6px 1px 5px;
  margin: 3px 1px;
  border-radius: 10px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.nav-bottom a .ico {
  font-size: 1.06rem;
  line-height: 1;
}

.nav-bottom a span:not(.ico) {
  max-width: 100%;
  text-align: center;
  line-height: 1.15;
}

.nav-bottom a.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-soft);
}

.ob-root {
  padding: 24px 20px 32px;
  max-width: 400px;
  margin: 0 auto;
  text-align: center;
}

.ob-root h1 {
  font-size: 1.5rem;
  margin: 0 0 8px;
}

.ob-root p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 20px;
}

.ob-pwa-hint {
  margin-top: 14px;
  margin-bottom: 0;
  max-width: 100%;
}

.ob-root .ob-pwa-hint__lead {
  margin: 0 0 8px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.ob-pwa-toggle {
  width: auto;
  margin: 0 auto;
  display: inline-flex;
  justify-content: center;
  font-size: 0.85rem;
  padding: 8px 14px;
}

.ob-pwa-detail {
  margin-top: 10px;
  text-align: left;
}

.ob-pwa-detail__inner {
  font-size: 0.82rem;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.ob-pwa-detail__inner p {
  margin: 0 0 10px;
  color: var(--muted);
}

.ob-pwa-detail__inner p:last-child {
  margin-bottom: 0;
}

.ob-pwa-detail__title {
  font-weight: 600;
  color: var(--text) !important;
  margin-bottom: 8px !important;
}

.ob-pwa-detail__foot {
  margin-top: 8px !important;
}

.lock-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  max-width: 400px;
  margin: 0 auto;
}

.step-bar {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.wizard-footer {
  position: sticky;
  bottom: 0;
  padding: 12px 0 8px;
  background: linear-gradient(180deg, transparent, var(--bg) 30%);
}

.segmented {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}

.segmented button {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.segmented button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Финансы: заметный блок периода в фирменном фиолетовом стиле */
.finance-tabs-wrap {
  margin: 0 0 18px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #faf5ff 0%, #ffffff 55%);
  border: 1px solid #e9d5ff;
  box-shadow:
    0 2px 10px rgba(139, 92, 246, 0.07),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.finance-tabs.segmented {
  margin-bottom: 0;
  gap: 8px;
}

.finance-tabs button {
  position: relative;
  border-width: 1.5px;
  padding: 11px 8px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.finance-tabs button:not(.active) {
  color: #5c5470;
  background: #fefeff;
  border-color: #ddd6fe;
}

.finance-tabs button:not(.active):hover {
  border-color: #c4b5fd;
  background: #faf8ff;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.12);
}

.finance-tabs button:not(.active):active {
  box-shadow: 0 1px 4px rgba(139, 92, 246, 0.1);
}

.finance-tabs button.active {
  border: 2px solid var(--accent);
  background: linear-gradient(145deg, #ede9fe 0%, #e9d5ff 45%, #ddd6fe 100%);
  color: #5b21b6;
  font-weight: 700;
  box-shadow:
    0 2px 12px rgba(139, 92, 246, 0.24),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.finance-tabs button.active:hover {
  border-color: #7c3aed;
  box-shadow:
    0 3px 14px rgba(124, 58, 237, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.finance-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  z-index: 1;
}

/* Экран финансового отчёта */
.finance-report-page {
  padding-bottom: 28px;
}

.finance-report-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 6px 0 4px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.finance-report-meta {
  margin: 0 0 16px !important;
  font-size: 0.92rem !important;
}

.finance-report-doc {
  padding: 18px 16px;
}

.finance-report-brand-line {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
}

.finance-report-doc-kind {
  margin: 0 0 12px;
  font-size: 1.08rem;
  font-weight: 700;
}

.finance-report-lines {
  margin: 0 0 6px;
  font-size: 0.9rem !important;
  line-height: 1.4;
}

.finance-report-lines:last-of-type {
  margin-bottom: 14px !important;
}

.finance-report-section {
  margin: 18px 0 12px;
  font-size: 1rem;
  font-weight: 700;
}

.finance-report-section:first-of-type {
  margin-top: 14px;
}

.finance-report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px 4px;
  border-radius: var(--radius-sm);
}

table.finance-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background: var(--card);
}

table.finance-report-table--dense {
  font-size: 0.78rem;
}

table.finance-report-table th,
table.finance-report-table td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

table.finance-report-table--dense th,
table.finance-report-table--dense td {
  padding: 7px 8px;
}

table.finance-report-table th {
  background: var(--accent-soft);
  color: #5b21b6;
  font-weight: 600;
  white-space: nowrap;
}

table.finance-report-table td.finance-report-num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.finance-report-empty {
  margin: 4px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.finance-report-actions {
  margin-bottom: 12px;
}

.finance-report-actions .back-row {
  margin-bottom: 10px;
}

.finance-report-actions .btn-secondary {
  width: 100%;
}

/* Отчёт по складу — экран (аналог финансового отчёта) */
.warehouse-report-page {
  padding-bottom: 28px;
}

.warehouse-report-title {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 6px 0 4px;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.warehouse-report-meta {
  margin: 0 0 16px !important;
  font-size: 0.92rem !important;
}

.warehouse-report-doc {
  padding: 18px 16px;
}

.warehouse-report-brand-line {
  margin: 0 0 2px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent);
}

.warehouse-report-doc-kind {
  margin: 0 0 12px;
  font-size: 1.08rem;
  font-weight: 700;
}

.warehouse-report-lines {
  margin: 0 0 6px;
  font-size: 0.9rem !important;
  line-height: 1.4;
}

.warehouse-report-filter-applied {
  font-weight: 600;
}

.warehouse-report-section {
  margin: 18px 0 12px;
  font-size: 1rem;
  font-weight: 700;
}

.warehouse-report-section:first-of-type {
  margin-top: 14px;
}

.warehouse-report-stock-empty {
  margin: 6px 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.warehouse-report-actions .btn-secondary {
  width: 100%;
}

@media print {
  .no-print {
    display: none !important;
  }

  html,
  body {
    background: #fff !important;
    color: #111827;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  #shell {
    padding-bottom: 0 !important;
    min-height: 0 !important;
  }

  .app-wrap {
    max-width: none;
  }

  .nav-bottom {
    display: none !important;
  }

  .finance-report-page {
    padding-bottom: 0 !important;
  }

  .finance-report-title {
    font-size: 1.05rem;
    margin-top: 0;
  }

  .finance-report-meta {
    margin-bottom: 10px !important;
  }

  .finance-report-doc.card {
    box-shadow: none !important;
    border: 1px solid #d1d5db;
    padding: 14px 12px;
    break-inside: avoid;
  }

  .finance-report-brand-line {
    color: #5b21b6 !important;
  }

  .finance-report-table-wrap {
    overflow: visible !important;
    margin: 0;
    padding: 0;
  }

  table.finance-report-table {
    background: #fff !important;
    font-size: 0.82rem;
    color: #111827 !important;
  }

  table.finance-report-table--dense {
    font-size: 0.72rem;
  }

  table.finance-report-table th {
    background: #ede9fe !important;
    color: #111827 !important;
  }

  table.finance-report-table th,
  table.finance-report-table td {
    border-color: #9ca3af !important;
  }

  table.finance-report-table thead {
    display: table-header-group;
  }

  table.finance-report-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .finance-report-section {
    break-after: avoid;
  }

  /* ----- Печать: отчёт по складу — нейтрально, без фиолета в таблице ----- */
  .warehouse-report-page {
    padding-bottom: 0 !important;
  }

  .warehouse-report-title {
    font-size: 1.05rem;
    margin-top: 0;
    color: #111827 !important;
  }

  .warehouse-report-meta {
    margin-bottom: 10px !important;
    color: #374151 !important;
  }

  /* Отчёт на печати — без «карточной» обводки вокруг блока, только текст и таблицы */
  .warehouse-report-doc.card {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    margin-bottom: 0 !important;
    break-inside: avoid;
    background: transparent !important;
    color: #111827 !important;
  }

  .warehouse-report-brand-line {
    color: #374151 !important;
  }

  .warehouse-report-doc-kind {
    color: #111827 !important;
  }

  .warehouse-report-doc .muted,
  .warehouse-report-lines {
    color: #374151 !important;
  }

  .warehouse-report-doc .finance-report-table th {
    background: #e5e7eb !important;
    color: #111827 !important;
  }

  .warehouse-report-doc .finance-report-table td {
    background: #fff !important;
    color: #111827 !important;
  }

  .warehouse-report-stock-empty {
    color: #374151 !important;
  }

  .warehouse-report-section {
    break-after: avoid;
    color: #111827 !important;
  }
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Экран «Склад» */
.warehouse-summary-card .warehouse-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
  margin-top: 4px;
}

.warehouse-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.warehouse-stat__label {
  font-size: 0.78rem !important;
  line-height: 1.3;
}

.warehouse-stat__value {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Фильтр перед отчётом по складу */
.warehouse-report-filter-card {
  margin-bottom: 12px;
}

.warehouse-report-filter-card .label:first-of-type {
  margin-top: 2px;
}

.warehouse-report-filter-card .field + .label {
  margin-top: 12px;
}

/* Кнопки «Пополнить» и «Отчёт» на вкладке «Склад» */
.warehouse-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.warehouse-actions .btn-primary,
.warehouse-actions .btn-secondary {
  width: 100%;
}

/* Быстрый поиск по списку склада (отдельно от «Фильтр отчёта») */
.warehouse-shelf-search {
  margin-bottom: 12px;
}

.warehouse-shelf-search .label {
  margin-bottom: 6px;
}

/* Карточка позиции на складе — только бейдж статуса, без дубля текста «Статус:» */
.warehouse-stock-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.warehouse-stock-card__title {
  font-weight: 700;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}

.warehouse-stock-card__head + .status-line {
  margin-top: 8px;
}

.warehouse-stock-card .warehouse-stock-card__muted {
  color: var(--muted);
}

.warehouse-stock-card--compact.card {
  padding: 11px 14px;
  margin-bottom: 8px;
}

.warehouse-stock-card__body--compact .warehouse-stock-card__title {
  font-size: 0.93rem;
  line-height: 1.25;
}

.warehouse-stock-line {
  margin-top: 6px;
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--muted);
}

.warehouse-stock-card--compact .warehouse-badge {
  font-size: 0.71rem;
  padding: 4px 10px;
}

.warehouse-stock-card--out .warehouse-stock-card__title {
  color: #4b5563;
}

.warehouse-stock-card--out .warehouse-stock-card__muted {
  color: #6b7280;
}

.warehouse-stock-card--out .warehouse-stock-line {
  color: #6b7280;
}

.warehouse-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  flex-shrink: 0;
  line-height: 1.2;
}

.warehouse-badge--ok {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.warehouse-badge--low {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fdba74;
}

.warehouse-badge--out {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.warehouse-stock-card {
  cursor: pointer;
}

.warehouse-empty-list {
  margin: 8px 0 0;
  text-align: center;
  line-height: 1.45;
}

/* «Тест и сохранение данных»: вертикальный ритм, подписи только под кнопками */
.svc-data-card {
  text-align: center;
}

.svc-data-lead {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 400;
}

.svc-data-action {
  margin-bottom: 15px;
}

.svc-data-action:last-child {
  margin-bottom: 0;
}

.svc-data-hint {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
  font-weight: 400;
}

.svc-data-hint--fine {
  font-size: 0.8rem;
  margin-top: 4px;
}

.svc-data-footnote {
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.9rem;
  z-index: 100;
  max-width: 90vw;
  box-shadow: var(--shadow-md);
}

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

.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.back-row a {
  font-weight: 600;
  color: var(--accent);
}

.empty-hint {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
  font-size: 0.95rem;
}

.profit-pos {
  color: var(--ok);
  font-weight: 700;
}

.profit-neg {
  color: var(--bad);
  font-weight: 700;
}

hr.soft {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

.mat-pick-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  padding: max(16px, env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  align-items: flex-end;
  justify-content: stretch;
}

.mat-pick-sheet.is-open {
  display: flex;
  flex-direction: column;
}

.mat-pick-sheet-inner {
  flex: 0 1 auto;
  max-height: min(76vh, 540px);
  overflow-y: auto;
  padding: 16px;
  margin: auto 0;
  border-radius: var(--radius-sm);
}

.mat-pick-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.mat-pick-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

button.mat-pick-item {
  width: 100%;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font: inherit;
  box-shadow: var(--shadow);
}

button.mat-pick-item:active {
  transform: scale(0.995);
}

.mat-pick-item .muted-line {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 4px;
}

.mat-pick-item.mat-pick-item--zero {
  border-style: dashed;
  border-color: var(--warn);
}

/* Удаление записи: компактная корзина, удобная зона тапа */
.record-card__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.record-card__main {
  flex: 1;
  min-width: 0;
}

.record-card__aside {
  flex-shrink: 0;
  max-width: 46%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.record-card__aside > .appt-notes {
  margin-top: 0;
  width: 100%;
  text-align: left;
}

.record-card__head-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.appt-delete-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.appt-delete-btn__ico {
  display: block;
  font-size: 17px;
  line-height: 1;
}

.appt-delete-btn:hover {
  color: #b91c1c;
  background: rgba(248, 113, 113, 0.12);
}

.appt-delete-btn:active {
  color: #991b1b;
  background: rgba(248, 113, 113, 0.18);
}

/* Модальное подтверждение (замена window.confirm во встроенном превью) */
.ui-confirm {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-bottom));
}

.ui-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
}

.ui-confirm__card {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 16px;
  padding: 18px;
}

.ui-confirm__text {
  margin: 0 0 18px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-line;
}

.ui-confirm__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* Фокус: обводка только при навигации с клавиатуры, не при каждом клике мышью */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ячейки статистики на «Сегодня»: без синего выделения текста при тапе/протаскивании */
.stat-grid .card.compact,
.stat-grid .stat-big {
  -webkit-user-select: none;
  user-select: none;
}

/* Экран «Пополнение склада»: переключатель «из списка» / «новый» */
.pm-mode-card {
  margin-bottom: 16px;
}
.pm-mode-tabs {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: stretch;
}
.pm-mode-tab {
  flex: 1;
  min-height: 48px;
  padding: 12px 10px;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.28;
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}
.pm-mode-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* «Пополнение склада»: выбор материала через кнопку + нативный select поверх */
.pm-pick-tab {
  position: relative;
  flex: 1;
}

.pm-pick-tab__native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 3;
  cursor: pointer;
}
