/* Оформление приложения. Мобильный экран — основной, на компьютере контент центрируется.
   Цвета: фиолетовая шапка, оранжевые действия, серый фон, графитовое меню. Шрифт Onest (лицензия OFL, лежит в /fonts). */
@font-face { font-family: 'Onest'; src: url(/fonts/Onest.ttf) format('truetype'); font-weight: 200 900; font-display: swap; }
:root {
  --bg: #eeeff2;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --ink: #1d1f24;
  --ink-2: #4a4e57;
  --muted: #80848e;
  --line: #e2e4e9;
  --line-2: #cfd2d9;
  --accent: #ec6a10;
  --accent-hover: #d15a06;
  --accent-soft: #ffeedf;
  --accent-ink: #ffffff;
  --brand: #6b36d6;
  --brand-dark: #3c1d86;
  --brand-soft: #f0e9fd;
  --nav-bg: #2a2c33;
  --warn: #7a3fe0;
  --warn-soft: #f2eafe;
  --danger: #b42318;
  --danger-soft: #fdeceb;
  --ok: #1d7436;
  --ok-soft: #e6f4ea;
  --info: #6b36d6;
  --info-soft: #f0e9fd;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(20, 24, 32, .07), 0 1px 1px rgba(20, 24, 32, .04);
  --nav-h: 64px;
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); }
body { min-height: 100vh; }
svg { width: 20px; height: 20px; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* Каркас */
.app { min-height: 100vh; padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.app.no-nav { padding-bottom: 24px; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(244, 242, 237, .94);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 860px; margin: 0 auto; display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 6px 16px; }
.topbar h1 { font-size: 20px; line-height: 1.2; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .sub { display: block; font-size: 12px; font-weight: 400; color: var(--muted); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: rgba(0, 0, 0, .05); }
.icon-btn svg { width: 22px; height: 22px; }
.page { max-width: 860px; margin: 0 auto; padding: 12px 16px 16px; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-in { max-width: 860px; margin: 0 auto; display: flex; height: var(--nav-h); }
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11.5px; color: var(--muted); text-decoration: none; position: relative; border: 0; background: none; cursor: pointer;
}
.nav-item svg { width: 23px; height: 23px; }
.nav-item.active { color: var(--accent); font-weight: 600; }
.nav-badge {
  position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* Карточки и списки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card, .card + .section-title, .stack > * + * { margin-top: 10px; }
.card-pad { padding: 14px 16px; }
.section-title { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 18px 4px 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 10px 0; }

.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; background: none; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0;
}
.list-item:last-child { border-bottom: 0; }
button.list-item, a.list-item { cursor: pointer; }
button.list-item:hover, a.list-item:hover { background: var(--surface-2); }
.list-item .chev { color: var(--line-2); flex: none; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { text-align: right; font-weight: 500; }

/* Наряды */
.order-card {
  display: block; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
}
.order-card + .order-card { margin-top: 10px; }
.order-card:hover { border-color: var(--line-2); border-left-color: inherit; }
.order-card.overdue { border-left-color: var(--danger); }
.order-card.clinic { border-left-color: #c58a12; }
.order-card.done { border-left-color: var(--ok); }
.order-card.canceled { border-left-color: var(--muted); opacity: .8; }
.order-card .num { color: var(--muted); font-weight: 600; margin-right: 4px; }
.order-card .title { font-weight: 650; }
.order-card .patient { font-weight: 600; margin-top: 2px; }
.order-card .works { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.order-card .foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 8px; }
.order-card .sum { text-align: right; font-weight: 650; white-space: nowrap; }
.order-card .sum .pay { display: block; font-size: 11.5px; font-weight: 500; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 12px;
  font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.chip.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.chip.new { background: var(--danger); color: #fff; border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-paid { color: var(--ok); }
.pay-unpaid { color: var(--warn); }
.pay-partial { color: var(--info); }

/* Вкладки, поиск */
.tabs { display: flex; background: rgba(0, 0, 0, .05); border-radius: 12px; padding: 3px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1; border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.tab .cnt { font-weight: 500; color: var(--muted); margin-left: 4px; font-size: 12px; }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.search { position: relative; margin: 10px 0; }
.search input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 40px 0 40px; }
.search svg { position: absolute; left: 12px; top: 11px; width: 21px; height: 21px; color: var(--muted); }
.search .clear { position: absolute; right: 4px; top: 2px; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; cursor: pointer;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 19px; height: 19px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: #efc6c2; }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1 1 auto; }
.fab {
  position: fixed; right: max(16px, calc(50% - 414px)); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 25;
  width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: #fff; display: flex;
  align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(78, 37, 176, .38); cursor: pointer;
}
.fab svg { width: 28px; height: 28px; }
.sticky-actions {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); z-index: 15; padding: 10px 0 4px;
  background: linear-gradient(to top, var(--bg) 70%, rgba(238, 239, 242, 0));
}
.app.no-nav .sticky-actions { bottom: 0; }

/* Формы */
.field { display: block; margin-bottom: 12px; }
.field > .label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); margin: 0 2px 6px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin: 5px 2px 0; }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); padding: 10px 12px;
}
textarea.input { min-height: 84px; resize: vertical; }
.input:focus, .search input:focus { outline: 2px solid rgba(236, 106, 16, .35); outline-offset: 0; border-color: var(--accent); }
.select-btn {
  width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); padding: 10px 12px;
  text-align: left; display: flex; align-items: center; gap: 8px; cursor: pointer;
}
.select-btn .ph { color: var(--muted); }
.select-btn svg { width: 18px; height: 18px; color: var(--muted); margin-left: auto; flex: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.checkbox { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--accent); }
.quick-dates { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; overflow: hidden; background: var(--surface); }
.stepper button { width: 36px; height: 38px; border: 0; background: var(--surface-2); font-size: 18px; cursor: pointer; }
.stepper input { width: 52px; height: 38px; border: 0; text-align: center; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.money-input { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); padding-right: 10px; }
.money-input input { width: 92px; height: 38px; border: 0; background: transparent; text-align: right; padding: 0 6px; font-weight: 600; }
.money-input span { color: var(--muted); }

/* Позиции и операции в форме наряда */
.line-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.line-item:last-child { border-bottom: 0; }
.line-item .name { font-weight: 600; }
.line-item .controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.line-item .total { margin-left: auto; font-weight: 650; white-space: nowrap; }
.worker-btn {
  min-height: 38px; border-radius: 11px; border: 1px dashed var(--line-2); background: var(--surface); padding: 0 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; font-weight: 600;
}
.worker-btn.set { border-style: solid; background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.add-line { width: 100%; border: 0; background: transparent; padding: 13px; color: var(--accent); font-weight: 650; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-line:hover { background: var(--surface-2); }
.add-line svg { width: 19px; height: 19px; }

/* Цвета и зубная формула */
.shades { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.shade { height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.shade.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.teeth { user-select: none; -webkit-user-select: none; }
.teeth .modes { margin-bottom: 10px; }
.jaw { display: grid; grid-template-columns: repeat(8, 1fr) 8px repeat(8, 1fr); gap: 3px; }
.jaw + .jaw { margin-top: 3px; padding-top: 4px; border-top: 2px solid var(--ink); }
.tooth {
  height: 40px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 11.5px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; padding: 0;
}
.tooth.mark { background: var(--ink); color: #fff; border-color: var(--ink); }
.tooth.bridge { background: #5b6168; color: #fff; border-color: #5b6168; }
.tooth.start { outline: 2px solid var(--accent); outline-offset: 1px; }
.tooth.readonly { cursor: default; }
.teeth .legend { margin-top: 8px; font-size: 13px; color: var(--muted); }
@media (max-width: 420px) { .tooth { height: 34px; font-size: 10.5px; border-radius: 6px; } .jaw { gap: 2px; } }

/* Модальные окна (снизу на телефоне, по центру на компьютере) */
.overlay { position: fixed; inset: 0; background: rgba(20, 22, 25, .42); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 88vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .18); padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 18px; max-height: 80vh; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; }
.sheet-head h2 { margin: 0; font-size: 18px; flex: 1; }
.sheet-body { overflow: auto; padding: 4px 16px 16px; }
.sheet-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.sheet-foot .btn { flex: 1; }
.picker-item small { display: block; color: var(--muted); font-size: 12.5px; }
.picker-group { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 12px 16px 6px; background: var(--surface-2); }

/* Уведомления */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 20px); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: #23272b; color: #fff; border-radius: 12px; padding: 11px 16px; max-width: 520px; font-weight: 500; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); pointer-events: auto; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--accent); }

/* Пустые состояния, загрузка */
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty svg { width: 42px; height: 42px; color: var(--line-2); display: block; margin: 0 auto 10px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Итоги */
.stat { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.stat:last-child { border-bottom: 0; }
.stat .t { font-weight: 600; }
.stat .s { font-size: 12.5px; color: var(--muted); }
.stat .n { font-size: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.n.red { color: var(--danger); } .n.green { color: var(--ok); } .n.gold { color: var(--warn); }
.month-nav { display: flex; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; margin-bottom: 10px; }
.month-nav .m { font-weight: 700; font-size: 16px; }
.big-total { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* Вход */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.brand-mark { width: 48px; height: 48px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 30px; height: 30px; }
.brand h1 { font-size: 22px; margin: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.error-text { color: var(--danger); font-weight: 500; margin: 8px 2px; }
.note-box { background: var(--warn-soft); color: #6d4205; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; }
.info-box { background: var(--info-soft); color: #1b3f7a; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }

/* Печать */
.print-toolbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line); }
.print-toolbar-in { max-width: 860px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.print-stage { padding: 16px; display: flex; justify-content: center; overflow-x: auto; }
.paper { background: #fff; width: 210mm; min-height: 297mm; box-shadow: 0 2px 12px rgba(0, 0, 0, .15); position: relative; color: #222; flex: none; }
@media print {
  html, body { background: #fff; }
  .print-toolbar, .bottom-nav, .topbar, #toasts { display: none !important; }
  .print-stage { padding: 0; display: block; }
  .paper { box-shadow: none; margin: 0; }
  .app { padding: 0 !important; }
}

/* ---- Тема: шапка, меню, кнопки ---- */
.topbar { background: linear-gradient(120deg, var(--brand-dark), var(--brand)); border-bottom: 0; color: #fff; }
.topbar h1 { color: #fff; font-weight: 700; letter-spacing: -.01em; }
.topbar .sub { color: rgba(255, 255, 255, .75); }
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.bottom-nav { background: var(--nav-bg); border-top: 0; }
.nav-item { color: #a3a7b1; }
.nav-item.active { color: #ff8a2a; }
.fab { background: linear-gradient(135deg, #7b4ef0, #4e25b0); }
.btn.primary { background: linear-gradient(135deg, #ff8a2a, #e45a05); border-color: transparent; color: #fff; }
.btn.primary:hover { background: linear-gradient(135deg, #f57f1f, #cf5204); }
.tabs { background: #e1e3e8; }
.big-total { font-variant-numeric: tabular-nums; }
.order-card.clinic { border-left-color: var(--brand); }
.brand-mark { background: linear-gradient(135deg, #ff8a1f, #6b36d6); }
.techs { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.techs .t { display: inline-flex; align-items: center; gap: 4px; }
.techs .t svg { width: 15px; height: 15px; color: var(--brand); }
.techs .t.done { color: var(--muted); }
.techs .t.done svg { color: var(--ok); }
.techs .t.none { color: var(--danger); }
.who { display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 17px; background: linear-gradient(135deg, #7b4ef0, #4e25b0); }
.avatar.alt { background: linear-gradient(135deg, #ff8a2a, #e45a05); }
.board-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 14px 6px; }
.board-card + .board-card { margin-top: 12px; }
.board-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.board-row:first-of-type { margin-top: 10px; }
.board-row .grow { min-width: 0; }
.big-count { font-size: 22px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; }
.board-card { scroll-margin-top: 70px; }

/* ---- Фото и видео ---- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.media-tile { position: relative; aspect-ratio: 1; border: 0; padding: 0; border-radius: 12px; overflow: hidden; background: #d9dbe1; cursor: pointer; display: block; width: 100%; }
.media-tile img, .media-tile video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.media-tile .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.media-tile .play svg { width: 40px; height: 40px; filter: drop-shadow(0 1px 4px rgba(0,0,0,.5)); }
.media-tile .doc { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; font-size: 12px; color: var(--ink-2); text-align: center; word-break: break-word; }
.media-tile .doc svg { width: 30px; height: 30px; color: var(--brand); }
.media-empty { width: 100%; border: 2px dashed var(--line-2); background: var(--surface); border-radius: var(--radius); padding: 18px 16px; display: flex; align-items: center; gap: 12px; color: var(--muted); cursor: pointer; text-align: left; font-size: 14px; }
.media-empty svg { width: 30px; height: 30px; color: var(--accent); flex: none; }
.upload-bar { background: var(--surface); border-radius: 10px; padding: 8px 12px; margin-bottom: 6px; font-size: 13px; box-shadow: var(--shadow); }
.upload-bar span { display: block; }
.upload-bar i { display: block; height: 5px; background: var(--line); border-radius: 3px; margin-top: 6px; overflow: hidden; }
.upload-bar b { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.section-title.row { display: flex; align-items: center; }
.viewer { position: fixed; inset: 0; z-index: 70; background: #0d0e12; display: flex; flex-direction: column; color: #fff; }
.viewer-top { display: flex; align-items: center; gap: 6px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top)); }
.viewer-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; }
.viewer-stage img, .viewer-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer-cap { text-align: center; font-size: 13px; color: rgba(255,255,255,.7); padding: 8px 12px max(14px, env(safe-area-inset-bottom)); }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 64px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.viewer-nav.prev { left: 8px; } .viewer-nav.next { right: 8px; }

/* ---- Чаты ---- */
.chat-row .avatar { width: 46px; height: 46px; }
.avatar svg { width: 22px; height: 22px; }
.unread { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.chat-page .page { padding-bottom: 96px; }
.chat-list { display: flex; flex-direction: column; gap: 4px; }
.chat-empty { text-align: center; color: var(--muted); padding: 40px 0; }
.msg { display: flex; }
.msg.mine { justify-content: flex-end; }
.bubble { max-width: min(78%, 520px); background: var(--surface); border-radius: 16px 16px 16px 6px; padding: 7px 10px 5px; box-shadow: var(--shadow); }
.msg.mine .bubble { background: #ffe7d3; border-radius: 16px 16px 6px 16px; }
.bubble .media-tile { width: min(260px, 62vw); aspect-ratio: auto; height: auto; max-height: 340px; margin: 2px 0 4px; }
.bubble .media-tile img, .bubble .media-tile video { height: auto; max-height: 340px; }
.who-name { font-size: 12.5px; font-weight: 700; color: var(--brand); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; word-wrap: break-word; font-size: 15px; }
.msg-time { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; }
.order-link { color: var(--brand); font-weight: 600; }
.order-link.block { display: inline-flex; align-items: center; gap: 5px; background: var(--brand-soft); border-radius: 8px; padding: 4px 8px; text-decoration: none; margin: 2px 0; }
.order-link.block svg { width: 16px; height: 16px; }
.chat-file { display: flex; align-items: center; gap: 8px; background: rgba(0,0,0,.04); border-radius: 10px; padding: 8px 10px; color: var(--ink); text-decoration: none; min-width: 200px; }
.chat-composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 10px max(8px, env(safe-area-inset-bottom)); }
.chat-composer-in { max-width: 860px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; }
.chat-progress { max-width: 860px; margin: 0 auto; }
.chat-input { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 20px; padding: 9px 14px; font-size: 15px; line-height: 1.35; max-height: 140px; background: var(--surface-2); outline: none; }
.chat-input:focus { border-color: var(--accent); }
.chat-send, .chat-attach { width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; }
.chat-send { background: linear-gradient(135deg, #ff8a2a, #e45a05); color: #fff; }
.chat-send:disabled { opacity: .5; }
.chat-attach { background: transparent; color: var(--ink-2); }
.nav-item { font-size: 11px; }
.media-add { background: var(--surface); border: 2px dashed var(--line-2); color: var(--accent); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 600; text-align: center; padding: 8px; line-height: 1.2; }
.media-add svg { width: 28px; height: 28px; }
.media-add:hover { border-color: var(--accent); background: var(--accent-soft); }
.media-remove { position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; }
.media-remove svg { width: 15px; height: 15px; }

/* Логотип */
.brand-logo { flex-direction: column; align-items: flex-start; gap: 10px; }
.auth-logo { width: 220px; max-width: 100%; height: auto; display: block; }
.brand-logo p { margin: 0; color: var(--muted); }

.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-xl { width: 76px; height: 76px; font-size: 30px; flex: none; }
.nick-pill { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 10px; border: 1.5px solid var(--ink); border-radius: 20px; color: var(--ink); }

/* Подсказка включить уведомления */
.push-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 40;
  max-width: 600px; margin: 0 auto; display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
  box-shadow: 0 8px 24px rgba(30, 20, 60, .18);
}
.app.no-nav ~ .push-banner { bottom: 12px; }
