:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #5a677d;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --accent-soft: #eef2ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #047857;
  --ok-soft: #ecfdf5;
  --excel: #0f7b4f;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -18px rgba(15, 23, 42, .35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1000px 500px at 10% -10%, #e0e7ff 0%, transparent 55%),
    radial-gradient(800px 400px at 110% 0%, #fae8ff 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

body.admin {
  background:
    radial-gradient(900px 420px at 0% -10%, #e0e7ff 0%, transparent 55%),
    var(--bg);
}

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

h1, h2, h3, p { margin: 0; }

img { max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hint { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.req { color: var(--danger); font-weight: 700; }
.grow { flex: 1; }

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 22px 18px 56px;
}

body.admin .wrap { max-width: 1240px; }

.wrap-inner { max-width: 780px; margin: 0 auto; }

.footer {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 18px 26px;
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.footer-sep { opacity: .8; }

/* ---------- шапка ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}

.topbar-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

body.admin .topbar-inner { max-width: 1240px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16.5px;
  letter-spacing: -.02em;
  color: var(--text);
}
.brand:hover { color: var(--text); }
.brand .logo { width: 32px; height: 32px; border-radius: 10px; box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .8); }
.brand-dot { color: var(--accent); padding: 0 1px; }

.topnav { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topnav form { margin: 0; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.admin-tabs {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab {
  flex: 0 0 auto;
  padding: 11px 14px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
}
.admin-tab:hover { color: var(--text); background: rgba(238, 242, 255, .7); }
.admin-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { background: #f8fafc; border-color: #94a3b8; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.xs { height: 29px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.full { width: 100%; }

.btn.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #5b52ea, var(--accent));
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(79, 70, 229, .9);
}
.btn.primary:hover { background: linear-gradient(180deg, var(--accent), var(--accent-dark)); color: #fff; }

.btn.ghost { background: rgba(255, 255, 255, .7); }
.btn.danger { color: var(--danger); background: #fff; border-color: #fecaca; }
.btn.danger:hover { background: var(--danger-soft); border-color: #fca5a5; color: #b91c1c; }
.btn.excel { color: #fff; border-color: transparent; background: linear-gradient(180deg, #0f7b4f, #0a5c3a); box-shadow: 0 6px 14px -8px rgba(15, 123, 79, .8); }
.btn.excel:hover { background: #0b6641; color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- общие карточки ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent);
  margin-bottom: 5px;
}

.hero, .page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin: 10px 0 20px;
  flex-wrap: wrap;
}
.hero h1, .page-head h1 { font-size: 31px; line-height: 1.12; letter-spacing: -.035em; }
.hero-sub { color: var(--muted); font-size: 14px; margin-top: 7px; }
.hero-sub b { color: var(--text); }
.hero-btn { flex: 0 0 auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 2px 0 14px;
}
.back:hover { color: var(--accent); }

/* ---------- форма ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span-2 { grid-column: span 2; }
.field .label { font-size: 13px; font-weight: 600; color: #334155; }

input[type="text"], input[type="search"], input[type="password"],
input[type="date"], input[type="color"], select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.35;
}
textarea { resize: vertical; min-height: 68px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6l5-4.5' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(79, 70, 229, .35); outline-offset: 1px; border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { background: #f8fafc; color: #94a3b8; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- добавление ---------- */

.add-card {
  margin-bottom: 26px;
  overflow: hidden;
}

.add-card > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
}
.add-card > summary::-webkit-details-marker { display: none; }
.add-card > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.add-summary:hover { background: #fafaff; }

.add-plus {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 500;
  line-height: 1;
}
.add-caption { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.add-caption b { font-size: 15px; letter-spacing: -.01em; }
.add-caption small { color: var(--muted); font-size: 12.5px; }

.chev {
  margin-left: auto;
  width: 9px;
  height: 9px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  transition: transform .18s;
  margin-right: 4px;
}
.add-card[open] .chev { transform: rotate(225deg); }

.add-body { padding: 2px 18px 20px; border-top: 1px solid var(--line); }
.add-body .form { padding-top: 16px; }
.add-card > .form { padding: 18px; }
.card-body { padding: 18px; }
.card-foot {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: #fbfcff;
  border-radius: 0 0 var(--radius) var(--radius);
}

.photo-field {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #f8fafc;
}
.photo-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.file-input {
  width: 100%;
  font-size: 13.5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
}
.file-input::file-selector-button {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  margin-right: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.photo-preview, .photo-current {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 11px;
  flex-wrap: wrap;
}
.photo-preview img, .photo-current img {
  width: 108px;
  height: 108px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
}
.photo-current > div { display: flex; flex-direction: column; gap: 6px; padding-top: 3px; }

/* ---------- уведомления ---------- */

.alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  margin: 0 0 14px;
  border: 1px solid transparent;
}
.alert svg { width: 20px; height: 20px; flex: 0 0 auto; margin-top: 1px; }
.alert p { margin-top: 3px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert.error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert.warn a { color: #92400e; text-decoration: underline; }
.add-body > .alert { margin-top: 14px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 17px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 16px 32px -12px rgba(15, 23, 42, .6);
  max-width: calc(100vw - 32px);
  transition: opacity .5s, transform .5s;
}
.toast.error { background: #991b1b; }
.toast-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; flex: 0 0 auto; }
.toast.error .toast-dot { background: #fca5a5; }
.toast.hide { opacity: 0; transform: translate(-50%, 10px); }

/* ---------- фильтры ---------- */

.filters { padding: 14px 16px; margin-bottom: 18px; }
.filter-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr .9fr .9fr;
  gap: 11px;
}
.filters .field .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.filters input, .filters select { min-height: 40px; font-size: 14px; }
.filter-actions { display: flex; align-items: center; gap: 9px; margin-top: 12px; flex-wrap: wrap; }

.section-head { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
.section-head h2 { font-size: 19px; letter-spacing: -.02em; }
.count-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- записи ---------- */

.records { display: grid; gap: 11px; }

.record-card {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
}
.record-card:hover { border-color: #c7d2fe; box-shadow: 0 10px 26px -18px rgba(49, 46, 129, .55); }

.record-photo {
  flex: 0 0 auto;
  width: 78px;
  height: 78px;
  border-radius: 12px;
  overflow: hidden;
  background: #eef2ff;
  display: block;
}
.record-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.record-photo.empty { display: grid; place-items: center; color: #a5b4fc; background: #f1f5ff; }
.record-photo.empty svg { width: 28px; height: 28px; }

.record-main { flex: 1; min-width: 0; }
.record-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.rec-title { min-width: 0; }
.rec-title h3 { font-size: 15.5px; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.rec-sub { margin-top: 3px; font-size: 12px; }
.rec-code { color: var(--muted); }
.rec-code.muted { color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  color: #1e293b;
  color: color-mix(in srgb, var(--c, #475569) 42%, #0f172a);
  background: #eef2ff;
  background: color-mix(in srgb, var(--c, #475569) 11%, #fff);
  border: 1px solid #e2e8f0;
  border-color: color-mix(in srgb, var(--c, #475569) 26%, #fff);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #475569); flex: 0 0 auto; }
.badge.ok { --c: #047857; }
.badge.muted { --c: #64748b; }

.rec-facts { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: #334155; flex-wrap: wrap; }
.rec-facts .qty { color: var(--text); }
.rec-facts .qty b { font-weight: 700; }
.rec-facts .sep { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }
.rec-facts .reason { overflow-wrap: anywhere; }

.rec-comment {
  margin-top: 6px;
  font-size: 12.8px;
  color: #475569;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.record-bottom { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; font-size: 12.3px; color: var(--muted); }
.rec-seller { color: #334155; font-weight: 600; }
.rec-date::before { content: "·"; margin-right: 8px; color: #cbd5e1; }
.mine-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; }
.record-actions { margin-left: auto; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.record-actions form { margin: 0; }

.more-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 20px; }

.empty {
  text-align: center;
  padding: 46px 22px;
  color: var(--muted);
}
.empty h3 { color: var(--text); font-size: 18px; margin: 14px 0 5px; }
.empty p { font-size: 13.5px; margin-bottom: 16px; }
.empty-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 700;
}
.empty-icon svg { width: 27px; height: 27px; }

/* ---------- админка ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: var(--text);
  box-shadow: 0 1px 1px rgba(15, 23, 42, .03);
  min-width: 0;
}
.stat-card:hover { border-color: #c7d2fe; color: var(--text); }
.stat-card .stat-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-card b { font-size: 23px; line-height: 1.15; letter-spacing: -.02em; }
.stat-card .hint { font-size: 11.5px; }
.stat-card.total { background: linear-gradient(160deg, #5b52ea, #4338ca); border-color: transparent; color: #fff; }
.stat-card.total .stat-label, .stat-card.total .hint { color: #ffffff; }
.stat-card.chip { flex-direction: row; align-items: center; justify-content: space-between; gap: 8px; }
.stat-card.chip .badge { font-size: 11px; }
.stat-card.chip b { font-size: 19px; color: #334155; }
.stat-card.chip.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 70, 229, .14); background: #fbfbff; }

.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #f8fafc;
  padding: 11px 12px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}
.table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: top; font-size: 13.5px; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr:hover { background: #fbfcff; }
.table td.num, .table th.num { text-align: center; }
.table .t-name { font-weight: 600; overflow-wrap: anywhere; }
.table .t-code { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.reason-cell { max-width: 230px; overflow-wrap: anywhere; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline-block; margin: 0 4px 4px 0; }
.row-actions .btn { margin-bottom: 2px; }

.thumb-link img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; background: #fff; }

.status-form { display: flex; gap: 4px; align-items: center; margin: 0; }
.status-form select { min-height: 32px; height: 32px; padding: 4px 26px 4px 8px; font-size: 12.5px; border-radius: 8px; width: auto; max-width: 150px; background-position: right 8px center; }
.status-form .btn { height: 32px; }

.inline-add { display: flex; align-items: flex-end; gap: 10px; padding: 14px 16px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-add .field { margin: 0; }
.inline-add .field.grow { flex: 1 1 220px; }
.inline-add .check { padding-bottom: 11px; }
.color-field { flex: 0 0 auto; width: 96px; }
.color-input { width: 48px; height: 44px; padding: 4px; border-radius: 10px; cursor: pointer; }
.row-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
.row-form input[type="text"] { height: 34px; min-height: 34px; padding: 5px 9px; font-size: 13.5px; width: auto; max-width: 220px; }
.row-form .color-input { width: 40px; height: 34px; min-height: 34px; padding: 3px; }
.table .row-form { min-width: 260px; }

.settings-card { margin-bottom: 14px; }
.settings-card h2 { font-size: 17px; margin-bottom: 3px; letter-spacing: -.01em; }
.settings-card .field { margin-top: 12px; max-width: 460px; }

.export-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.export-note p { margin-top: 3px; max-width: 620px; }

.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  margin-top: 14px;
  border-color: #fecaca;
  flex-wrap: wrap;
}
.danger-zone b { color: #991b1b; }

.static-field { display: flex; align-items: center; gap: 8px; min-height: 44px; flex-wrap: wrap; }

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

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 18px;
  background:
    radial-gradient(800px 500px at 50% -10%, #c7d2fe 0%, transparent 60%),
    radial-gradient(600px 400px at 100% 100%, #fae8ff 0%, transparent 55%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 22px;
  border-radius: 20px;
}
.auth-logo { width: 54px; height: 54px; margin-bottom: 16px; }
.auth-logo .logo { width: 54px; height: 54px; border-radius: 16px; }
.auth-card h1 { font-size: 23px; letter-spacing: -.025em; }
.auth-sub { margin: 5px 0 20px; }
.auth-card .form { display: flex; flex-direction: column; gap: 13px; }
.auth-card .alert { margin-bottom: 14px; }
.auth-back { display: block; text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-back:hover { color: var(--accent); }

/* ---------- ошибки ---------- */

.error-page {
  max-width: 520px;
  margin: 42px auto;
  padding: 34px 26px;
  text-align: center;
}
.error-code { font-size: 54px; font-weight: 800; color: var(--accent); letter-spacing: -.04em; line-height: 1; }
.error-page h1 { font-size: 22px; margin: 10px 0 7px; }
.error-page p { color: var(--muted); font-size: 14px; }
.error-actions { display: flex; justify-content: center; gap: 9px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- адаптив ---------- */

@media (max-width: 900px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: span 2; }
  .record-photo { width: 68px; height: 68px; }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .wrap { padding: 16px 13px 44px; }
  .topbar-inner { padding: 9px 13px; }
  .hero, .page-head { align-items: flex-start; }
  .hero h1, .page-head h1 { font-size: 26px; }
  .hero-btn { width: 100%; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .form-grid { grid-template-columns: 1fr; gap: 12px; }
  .field.span-2 { grid-column: auto; }
  .filter-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .search-field { grid-column: span 2; }
  .filter-actions .btn { flex: 1; }
  .filters { padding: 12px; }
  .record-card { padding: 12px; gap: 11px; }
  .record-photo { width: 62px; height: 62px; border-radius: 10px; }
  .record-photo.empty svg { width: 23px; height: 23px; }
  .record-head { flex-direction: column; gap: 6px; }
  .record-head .badge { align-self: flex-start; }
  .record-actions { width: 100%; margin-left: 0; margin-top: 4px; }
  .record-actions .btn { flex: 1; }
  .rec-date::before { display: none; }
  .rec-date { margin-left: 0; }
  .add-card > summary { padding: 14px; }
  .add-body { padding: 0 14px 16px; }
  .add-card > .form { padding: 14px; }
  .card-body, .card-foot { padding: 14px; }
  .inline-add { align-items: stretch; }
  .inline-add .check { padding-bottom: 0; }
  .inline-add .btn { width: 100%; }
  .color-field { width: 80px; }
  .toast { width: max-content; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-card.total { grid-column: span 2; flex-direction: row; align-items: center; justify-content: space-between; }
  .stat-card.total b { font-size: 27px; }
  .export-note { align-items: stretch; }
  .export-note .btn { width: 100%; }
  .settings-card .field { max-width: none; }
  .danger-zone { align-items: stretch; }
  .danger-zone .btn { width: 100%; }
  .auth-card { padding: 24px 18px 20px; }
}

@media (max-width: 760px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tbody { display: grid; gap: 10px; }
  .table tbody tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 11px 12px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  }
  .table td {
    border: 0;
    padding: 4px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
  }
  .table td::before {
    content: attr(data-label);
    flex: 0 0 88px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding-top: 1px;
  }
  .table td.num { text-align: left; }
  .table td.row-actions { justify-content: flex-end; padding-top: 9px; }
  .table td.row-actions::before { display: none; }
  .table td .row-form { min-width: 0; flex: 1; justify-content: flex-end; }
  .table td .row-form input[type="text"] { flex: 1; max-width: none; min-width: 0; }
  .table td .status-form { flex: 1; justify-content: flex-end; }
  .table-wrap { overflow: visible; }
  .table-card { background: transparent; border: 0; box-shadow: none; padding: 0; }
  .table-card .table tbody tr:first-child td { border-top: 0; }
  .table td[data-label="Причина"] .reason-cell { text-align: right; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
