/* pet-pro admin — дизайн-система.
   Токены → база → раскладка → компоненты → страницы. Светлая и тёмная тема по системной настройке. */

/* ============ токены ============ */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-hover: #f3f4f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #111827;
  --text-2: #4b5563;
  --muted: #6b7280;

  --accent: #0f9d8a;
  --accent-hover: #0c8574;
  --accent-soft: #e6f6f3;
  --accent-text: #0b7466;
  --on-accent: #ffffff;

  --ok: #15803d;
  --ok-soft: #e8f7ee;
  --warn: #b45309;
  --warn-soft: #fef5e7;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --danger-soft: #fdecec;
  --info: #2563eb;
  --info-soft: #eaf1fe;

  --sidebar-bg: #0f172a;
  --sidebar-text: #cbd5e1;
  --sidebar-muted: #64748b;
  --sidebar-active: #1e293b;

  --r-xs: 6px;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .25);
  --focus: 0 0 0 3px rgba(15, 157, 138, .3);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #111827;
    --surface-2: #0f172a;
    --surface-hover: #1f2937;
    --border: #1f2937;
    --border-strong: #374151;
    --text: #f3f4f6;
    --text-2: #d1d5db;
    --muted: #9ca3af;
    --accent: #14b8a6;
    --accent-hover: #2dd4bf;
    --accent-soft: rgba(20, 184, 166, .14);
    --accent-text: #5eead4;
    --on-accent: #042f2e;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, .12);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .12);
    --danger: #f87171;
    --danger-hover: #fca5a5;
    --danger-soft: rgba(248, 113, 113, .12);
    --info: #60a5fa;
    --info-soft: rgba(96, 165, 250, .12);
    --sidebar-bg: #020617;
    --sidebar-active: #111827;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 20px 40px -12px rgba(0, 0, 0, .7);
  }
}

/* ============ база ============ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
h2 { font-size: 16px; line-height: 1.35; font-weight: 620; }
h3 { font-size: 14px; font-weight: 620; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--mono); font-size: .875em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.icon { flex: none; display: block; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

/* ============ раскладка ============ */

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

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px;
  background: var(--sidebar-bg); color: var(--sidebar-text);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  border-radius: 10px; background: var(--accent); color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 12px; color: var(--sidebar-muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label {
  margin: 14px 10px 6px; font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--sidebar-muted);
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--sidebar-text); font-weight: 500;
}
.nav a:hover { background: var(--sidebar-active); color: #fff; text-decoration: none; }
.nav a[aria-current="page"] { background: var(--sidebar-active); color: #fff; }
.nav a[aria-current="page"] .icon { color: var(--accent); }
.nav .count {
  margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .08); font-size: 12px; text-align: center; color: var(--sidebar-text);
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); color: var(--sidebar-text); }
.me:hover { background: var(--sidebar-active); text-decoration: none; }
.me-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-text strong { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.me-text small { font-size: 12px; color: var(--sidebar-muted); }
.sidebar .btn-logout {
  width: 100%; justify-content: flex-start; color: var(--sidebar-text);
  background: transparent; border-color: transparent;
}
.sidebar .btn-logout:hover { background: var(--sidebar-active); color: #fff; }

.main { min-width: 0; padding: 28px 32px 64px; }
.container { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.container-narrow { max-width: 760px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head .lead { margin-top: 4px; color: var(--muted); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* мобильная шапка */
.topbar { display: none; }

@media (max-width: 960px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px; background: var(--sidebar-bg); color: #fff;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: 260px;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.nav-open .scrim { display: block; }
  .main { padding: 20px 16px 48px; }
}
.scrim { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(2, 6, 23, .5); }

/* ============ кнопки ============ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-weight: 550; font-size: 14px; line-height: 1; white-space: nowrap;
  cursor: pointer; box-shadow: var(--shadow-xs);
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-danger-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn-block { width: 100%; }
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid currentColor; border-color: var(--muted) transparent var(--muted) transparent;
  animation: spin .7s linear infinite;
}
.btn-primary.is-busy::after, .btn-danger.is-busy::after { border-color: #fff transparent #fff transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

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

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-xs);
}
.card-body { padding: 20px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.card-foot {
  display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px;
  border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }

/* ============ статистика ============ */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.stat {
  display: flex; flex-direction: column; gap: 6px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  color: var(--text);
}
a.stat:hover { border-color: var(--border-strong); text-decoration: none; box-shadow: var(--shadow-sm); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent-soft); color: var(--accent-text);
}

/* ============ бейджи ============ */

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-hover); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-draft { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent-text); }

/* ============ формы ============ */

.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.label { font-size: 13px; font-weight: 600; color: var(--text); }
.label .opt { font-weight: 400; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.hint-row { display: flex; justify-content: space-between; gap: 12px; }
.counter { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.counter.is-over { color: var(--danger); font-weight: 600; }

.input, .select, .textarea {
  width: 100%; min-height: 38px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.textarea-lg { min-height: 200px; }
.select {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.input-sm { min-height: 32px; padding: 5px 10px; font-size: 14px; }

/* выбор карточкой (сложность, вид животного) */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); cursor: pointer;
}
.choice label strong { font-size: 14px; }
.choice label small { color: var(--muted); font-size: 12.5px; }
.choice label:hover { border-color: var(--muted); }
.choice input:checked + label { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.choice input:focus-visible + label { box-shadow: var(--focus); }

/* переключатель */
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}
.switch-row:first-child { border-top: 0; }
.switch-row .text { display: flex; flex-direction: column; gap: 2px; }
.switch-row .text strong { font-size: 14px; font-weight: 600; }
.switch-row .text small { color: var(--muted); font-size: 13px; }
.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; z-index: 1; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track {
  width: 40px; height: 24px; border-radius: 999px; background: var(--border-strong);
  transition: background .15s; position: relative;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* загрузка файлов */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 22px; text-align: center;
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone strong { color: var(--text); font-weight: 600; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.previews:empty { display: none; }
.preview { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-hover); }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview .name {
  position: absolute; inset: auto 0 0 0; padding: 3px 6px; font-size: 11px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .65)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preview.is-bad { outline: 2px solid var(--danger); }

/* ============ галерея ============ */

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.gallery-sm { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.tile { position: relative; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-hover); border: 1px solid var(--border); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tile img + .tile-fallback { display: none; }
.tile img.is-broken { display: none; }
.tile img.is-broken + .tile-fallback { display: grid; }
.tile form { position: absolute; top: 4px; right: 4px; opacity: 0; transition: opacity .12s; }
.tile:hover form, .tile:focus-within form { opacity: 1; }
.tile .btn-icon { width: 26px; height: 26px; background: rgba(17, 24, 39, .75); border: 0; color: #fff; }
.tile .btn-icon:hover { background: var(--danger); }

/* ============ таблицы и списки ============ */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .actions { display: flex; justify-content: flex-end; gap: 4px; }
.cell-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title a { color: var(--text); font-weight: 600; }
.cell-title small { display: block; color: var(--muted); font-size: 13px; }
.thumb { width: 44px; height: 44px; flex: none; border-radius: var(--r-sm); overflow: hidden; background: var(--surface-hover); display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.list > li { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }

/* ============ вкладки и фильтры ============ */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-hover); }
.tabs a {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 550;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.tabs .n { font-size: 12px; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

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

.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 24px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent-text); }
.empty h3 { font-size: 15px; }
.empty p { max-width: 380px; color: var(--muted); font-size: 14px; }

/* ============ уведомления (flash) ============ */

.toasts { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
}
.toast .icon { margin-top: 1px; }
.toast-ok .icon { color: var(--ok); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.toast-error .icon { color: var(--danger); }
.toast p { flex: 1; font-size: 14px; }
.toast button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; font-size: 18px; line-height: 1; }
.toast.is-hiding { opacity: 0; transform: translateY(-6px); transition: .18s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: 14px; background: var(--info-soft); color: var(--text); }
.callout .icon { color: var(--info); margin-top: 1px; }
.callout-warn { background: var(--warn-soft); }
.callout-warn .icon { color: var(--warn); }
.callout-danger { background: var(--danger-soft); }
.callout-danger .icon { color: var(--danger); }

/* ============ диалог подтверждения ============ */

dialog.modal {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(2, 6, 23, .55); }
.modal-body { display: flex; gap: 14px; padding: 22px; }
.modal-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--danger-soft); color: var(--danger); }
.modal-body h2 { margin-bottom: 4px; }
.modal-body p { color: var(--text-2); font-size: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; background: var(--surface-2); border-top: 1px solid var(--border); border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ============ раскрывающееся редактирование ============ */

details.edit > summary { list-style: none; cursor: pointer; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary { display: none; }
.edit-box { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }

/* ============ страницы ============ */

/* вход */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { width: min(400px, 100%); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.auth-brand .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
.auth-brand p { color: var(--muted); }

/* шаги курса */
.steps { counter-reset: step; }
.step { display: flex; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--border); }
.step:first-child { border-top: 0; }
.step-num {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px;
}
.step-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.step-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.step-actions { display: flex; gap: 4px; align-items: flex-start; }

/* посты */
.post { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border-top: 1px solid var(--border); }
.post:first-child { border-top: 0; }
.post-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  overflow: hidden; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 14px;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-brand { background: var(--accent); color: #fff; }
.post-author { display: flex; flex-direction: column; line-height: 1.25; }
.post-author strong { font-size: 14px; }
.post-author small { color: var(--muted); font-size: 12.5px; }
.post-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.post-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* предпросмотр уведомления */
.phone-preview { padding: 18px; border-radius: var(--r-lg); background: linear-gradient(160deg, #1e293b, #0f172a); }
.push {
  display: flex; gap: 10px; padding: 12px; border-radius: 14px;
  background: rgba(255, 255, 255, .92); color: #111827; box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}
.push-icon { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; }
.push-text { min-width: 0; }
.push-text .app { font-size: 11.5px; color: #6b7280; }
.push-text strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.push-text p { font-size: 13.5px; color: #374151; overflow-wrap: anywhere; white-space: pre-wrap; }

/* настройки */
.save-bar {
  position: sticky; bottom: 16px; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.auth-foot { text-align: center; margin-top: 16px; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 6px; }
.input-num { width: 96px; flex: none; }
@media (min-width: 821px) {
  .shell { background: linear-gradient(to right, var(--sidebar-bg) 248px, var(--bg) 248px); }
}
.container > *, .grid-2 > *, .stack > * { min-width: 0; }
@media (max-width: 640px) {
  .hide-sm { display: none; }
  .table td, .table th { padding: 10px 12px; }
  .page-head .actions { width: 100%; }
  .toolbar > form { width: 100%; }
}
