/* SALT — панель. Фирменные тона: сливочный фон, винный акцент, серо-бежевые нейтрали. */
:root {
  --bg: #f4f0e8;
  --surface: #fffdf9;
  --surface-2: #f8f4ec;
  --line: #e6dfd3;
  --line-strong: #d3c9b9;
  --ink: #1f1b18;
  --ink-2: #5b544d;
  --ink-3: #8b8379;
  --wine: #6b1f2e;
  --wine-strong: #521623;
  --wine-soft: #f2e4e6;
  --good: #2c6e47;
  --good-soft: #e3efe7;
  --warn: #9a5b00;
  --warn-soft: #f7e9d2;
  --info: #2f5b86;
  --info-soft: #e2ebf3;
  --danger: #a8261f;
  --danger-soft: #f6dfdd;
  --muted-soft: #ece7dd;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(31, 27, 24, .04), 0 6px 20px rgba(31, 27, 24, .05);
  --sidebar: 236px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}
a { color: var(--wine); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.01em; margin: 0; }
p { margin: 0 0 .75rem; }
button { font: inherit; }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 24px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 8px; padding: 4px 12px 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { font-family: var(--serif); font-size: 26px; letter-spacing: .12em; color: var(--wine); }
.brand-sub { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block; width: 100%; text-align: left;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; background: none; border: 0; cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--wine-soft); color: var(--wine); font-weight: 600; }
.nav-link-small { font-size: 13px; padding: 6px 12px; color: var(--ink-3); }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.sidebar-foot form { margin: 0; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 12px 12px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--wine); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 12px; color: var(--ink-3); }

.main { padding: 32px 40px 64px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-title { font-size: 26px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.crumbs span { margin: 0 6px; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; line-height: 1.2; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--wine); border-color: var(--wine); color: #fff; }
.btn-primary:hover { background: var(--wine-strong); border-color: var(--wine-strong); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- карточки и плитки ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-title { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }
.main > * + *:not(.page-head) { margin-top: 20px; }
.stack { display: grid; gap: 20px; align-content: start; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid-2, .grid-3 { align-items: start; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tile-label { font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.tile-value { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.tile-value small { font-size: 15px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.tile-note { font-size: 13px; color: var(--ink-3); margin-top: 8px; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 11px 14px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbf8f2; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .row-title { font-weight: 600; color: var(--ink); }
.table td.nowrap { white-space: nowrap; }
.table .row-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 1px; }
.table td.muted { color: var(--ink-3); }
.table .dim td { color: var(--ink-3); }
.count { font-size: 13px; color: var(--ink-3); font-weight: 500; }

/* ---------- бейджи и чипы ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.3; white-space: nowrap; }
.badge-good { background: var(--good-soft); color: var(--good); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: var(--muted-soft); color: var(--ink-2); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-block; padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; color: var(--ink-2); background: var(--surface); white-space: nowrap; }

/* ---------- фильтры ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.filters input[type=search], .filters select {
  padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: 14px; color: var(--ink); min-width: 160px;
}
.filters input[type=search] { min-width: 260px; }
.filters .spacer { flex: 1; }

/* ---------- формы ---------- */
.form { max-width: 880px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section { padding: 20px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-section-title { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); font: inherit; font-size: 14px; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus {
  outline: 2px solid rgba(107, 31, 46, .25); outline-offset: 0; border-color: var(--wine);
}
.field textarea { resize: vertical; min-height: 96px; }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.field .error { font-size: 12.5px; color: var(--danger); }
.field-check { flex-direction: row; align-items: center; gap: 10px; }
.field-check input { width: auto; }
.field-check label { font-weight: 500; color: var(--ink); }
.field-choices > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 16px; }
.field-choices > div > div label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 14px; }
.field-choices input { width: auto; accent-color: var(--wine); }
.form-errors { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-foot { display: flex; gap: 10px; padding: 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

/* ---------- описания ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; font-size: 14px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }
.notes { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); }
.section-title { font-size: 15px; font-weight: 600; margin: 28px 0 12px; }

/* ---------- полосы (распределение) ---------- */
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 140px 1fr 32px; align-items: center; gap: 12px; font-size: 13.5px; }
.bar-track { height: 8px; background: var(--muted-soft); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--wine); border-radius: 4px; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- списки внимания ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 12px; }
.list li:last-child { border-bottom: 0; }
.list .sub { color: var(--ink-3); font-size: 13px; }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-3); font-size: 14px; }
.empty .btn { margin-top: 12px; }

/* ---------- сообщения ---------- */
.messages { display: grid; gap: 8px; margin-bottom: 20px; }
.message { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 14px; background: var(--surface); border: 1px solid var(--line); }
.message-success { background: var(--good-soft); color: var(--good); border-color: transparent; }
.message-error { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- вход ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; padding: 36px 32px; }
.login-brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 28px; }
.login-card .field { margin-bottom: 14px; }
.login-error { margin-bottom: 14px; font-size: 14px; color: var(--danger); }

/* ---------- утилиты ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.right { text-align: right; }
.mt { margin-top: 20px; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 16px; font-size: 14px; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 0; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-link { width: auto; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; align-items: center; gap: 4px; }
  .me { padding: 0; }
  .me-text { display: none; }
  .main { padding: 20px 16px 48px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-main { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .field-choices > div { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .bar { grid-template-columns: 100px 1fr 32px; }
}
