:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #14181f;
  --ink-2: #4b5563;
  --muted: #8b93a1;
  --line: #e6e8ec;
  --line-2: #eef0f3;
  --accent: #3558e0;
  --accent-ink: #2440b8;
  --accent-soft: #edf1fe;
  --ok: #0f7b5f;
  --ok-soft: #e6f5f0;
  --warn: #a9650a;
  --warn-soft: #fdf3e3;
  --danger: #c22b2b;
  --danger-soft: #fdeceb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 1px 3px rgba(17, 24, 39, .03);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
code { font: 12.5px/1.4 ui-monospace, "Cascadia Code", Consolas, monospace; background: #f2f3f6; padding: 1px 5px; border-radius: 5px; }

.i { flex: none; }

/* ---------------------------------------------------------------- каркас */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  display: flex; flex-direction: column; gap: 22px;
  padding: 22px 16px 18px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; flex-direction: column; gap: 7px; padding: 0 6px; }
.brand-logo { width: 172px; height: auto; display: block; }
.brand-sub {
  font-size: 10.5px; font-weight: 500; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); padding-left: 2px;
}

nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; font-size: 13.5px;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: #f4f5f8; color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.build { font-size: 11px; color: var(--muted); padding-left: 10px; }

.main { padding: 26px 34px 60px; max-width: 1560px; }
/* Реестр занимает всю ширину окна, остальные страницы — колонку по центру. */
body.wide .main { max-width: none; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.topbar h1 { font-size: 21px; letter-spacing: -.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.topbar-actions { display: flex; gap: 8px; }
.topbar-empty { justify-content: flex-end; }

/* ---------------------------------------------------------------- кнопки */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink);
  cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: #fafbfc; border-color: #d8dbe1; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.link { color: var(--accent); font-size: 12.5px; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- карточки */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 14.5px; letter-spacing: -.005em; }
.card-hint { font-size: 11.5px; color: var(--muted); }
.card-ask { border-color: #f0dcc0; background: linear-gradient(#fffdf9, #fff); }
.card-ok { border-color: #d9ece5; }
.card-result { border-color: #cfe3ff; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.metric {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.metric-label { font-size: 12px; color: var(--muted); }
.metric-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.metric-link { display: block; transition: border-color .12s, box-shadow .12s, transform .12s; }
.metric-link:hover {
  border-color: #cdd8f0; box-shadow: 0 2px 10px rgba(31, 41, 61, .07); transform: translateY(-1px);
  text-decoration: none;
}
.metric-link:hover .metric-label { color: var(--accent-ink); }
.metric-hint { font-size: 11.5px; color: var(--muted); }
.metric.danger .metric-value { color: var(--danger); }
.metric.warn .metric-value { color: var(--warn); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------------------------------------------------------------- строки-ссылки */
.row-link {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 8px; margin: 0 -8px; border-radius: 8px; border-bottom: 1px solid var(--line-2);
}
.row-link:last-child { border-bottom: none; }
.row-link:hover { background: #f8f9fb; }
.row-no { font-weight: 600; font-size: 13px; min-width: 74px; font-variant-numeric: tabular-nums; }
.row-main { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); }
.row-plan { font-variant-numeric: tabular-nums; color: var(--muted); }
.row-right { margin-left: auto; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.late { color: var(--danger); font-size: 11.5px; }
.empty { color: var(--muted); font-size: 13px; padding: 8px 0; }

/* ---------------------------------------------------------------- бейджи */
.badge {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 550; letter-spacing: .01em;
  background: #f1f3f6; color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--accent-soft); color: var(--accent-ink); }
.badge-empty { background: transparent; color: var(--muted); }

.pill { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; background: #f4f5f7; color: var(--ink-2); white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.ghost { background: transparent; color: #b3b9c4; }
.cell-empty { color: #c9ced8; }

/* ---------------------------------------------------------------- тулбар / таблица */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  font-size: 12.5px; color: var(--ink-2);
}
.chip b { font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.is-active b { color: rgba(255, 255, 255, .7); }

.search input {
  height: 32px; width: 240px; padding: 0 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); font: inherit; font-size: 13px;
}
.search input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }

.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: auto; box-shadow: var(--shadow); max-height: calc(100vh - 210px);
  width: fit-content; max-width: 100%;
}
table.grid { border-collapse: separate; border-spacing: 0; width: auto; min-width: 0; font-size: 12.5px; }
table.grid thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fbfbfc; border-bottom: 1px solid var(--line);
  padding: 9px 10px; text-align: left; font-weight: 600; font-size: 11.5px;
  color: var(--ink-2); white-space: normal; letter-spacing: .01em;
  width: 1px; vertical-align: bottom;
}
table.grid tbody td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.grid tbody tr:hover td { background: #fafbfd; }
table.grid tbody tr:last-child td { border-bottom: none; }
table.grid td.num, table.grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tbody td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.grid tbody tr:hover td:first-child { background: #fafbfd; }
.cell-no { font-weight: 600; }
.cell-no a:hover { color: var(--accent); }
.flag {
  display: inline-grid; place-items: center; margin-left: 6px;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; font-weight: 700; background: var(--warn-soft); color: var(--warn);
}
.table-note { color: var(--muted); font-size: 12px; margin: 10px 2px 0; }

/* ---------------------------------------------------------------- вкладки реестра */
.tabs { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 8px 14px; font-size: 13px; color: var(--ink-2); border-radius: 8px 8px 0 0;
  border: 1px solid transparent; border-bottom: none; margin-bottom: -1px;
}
.tab:hover { background: #f6f7f9; color: var(--ink); }
.tab b { font-weight: 600; color: var(--muted); margin-left: 5px; font-variant-numeric: tabular-nums; }
.tab.is-active {
  color: var(--accent-ink); font-weight: 650; background: var(--accent-soft);
  border-color: transparent; border-radius: 8px; box-shadow: none;
}
.inline-form { display: inline; margin: 0; }
.btn-danger { color: var(--danger); border-color: #f0d2d2; }
.btn-danger:hover { background: var(--danger-soft); border-color: #e9b9b9; }
.tab.is-active b { color: var(--accent-ink); }

/* ------------------------------------------------- скрытие колонок (только у себя) */
table.grid thead th { position: relative; }
.th-label { display: inline-block; padding-right: 2px; }
.col-hide {
  position: absolute; top: 2px; right: 2px;
  width: 15px; height: 15px; line-height: 13px; padding: 0;
  border: none; border-radius: 4px; background: transparent;
  color: #b6bcc7; font-size: 13px; cursor: pointer; opacity: 0;
  transition: opacity .12s, background .12s, color .12s;
}
table.grid thead th:hover .col-hide { opacity: 1; }
.col-hide:hover { background: var(--danger-soft); color: var(--danger); }
.col-hidden { display: none !important; }

.cols-box { position: relative; }
.cols-badge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--accent-soft); color: var(--accent-ink);
  font-size: 10.5px; font-weight: 600; margin-left: 2px;
}
.cols-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20;
  width: 268px; max-height: 340px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .12); padding: 10px 12px;
}
.cols-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding-bottom: 7px; margin-bottom: 6px; border-bottom: 1px solid var(--line-2);
}
.cols-head .link { font-size: 11.5px; }
.cols-list { display: flex; flex-direction: column; gap: 3px; }
.cols-item {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  padding: 3px 4px; border-radius: 6px; cursor: pointer; color: var(--ink-2);
}
.cols-item:hover { background: #f6f7f9; }
.cols-badge[hidden] { display: none; }
.cols-panel[hidden] { display: none; }
.cols-item input { margin: 0; accent-color: var(--accent); }
.cols-item input:disabled { opacity: .45; }
.cols-note { margin: 8px 0 0; font-size: 11px; color: var(--muted); line-height: 1.35; }

/* Статус в ячейке: список открывается по клику, без стрелки — она съедала ширину. */
.status-select {
  appearance: none; -webkit-appearance: none;
  border: 1px solid transparent; border-radius: 6px;
  background-color: #f1f3f6; color: var(--ink-2);
  font: inherit; font-size: 11.5px; font-weight: 550;
  padding: 3px 8px; cursor: pointer; max-width: 100%;
  text-overflow: ellipsis;
}
.status-select:hover { border-color: #d8dbe1; background-color: #eceef2; }
.status-select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.status-select[data-value=""] { background-color: transparent; color: var(--muted); }
.status-select[data-value=""]:hover { background-color: #eceef2; }
.status-select[data-value="Х"] { background-color: transparent; color: #b3b9c4; }
.status-select[data-value="На складе"],
.status-select[data-value="Оплачен"],
.status-select[data-value="Вывезен"] { background-color: var(--ok-soft); color: var(--ok); }
.status-select[data-value="Заказан"],
.status-select[data-value="Готов к заказу"],
.status-select[data-value="Бронь"],
.status-select[data-value="В работе"],
.status-select[data-value="Отложка"] { background-color: var(--accent-soft); color: var(--accent-ink); }
.status-select[data-value="не отпр."],
.status-select[data-value="Частично на складе"],
.status-select[data-value="Не готов"] { background-color: var(--warn-soft); color: var(--warn); }
.status-select[data-value="Расторгнут"],
.status-select[data-value="Увед. раст."] { background-color: var(--danger-soft); color: var(--danger); }
.grid-full .status-select { font-size: 11px; padding: 2px 6px; }

/* Правка значений прямо в таблице: в покое — обычный текст, по клику — поле. */
.inline-edit {
  border: none; background: none; font: inherit; font-size: inherit;
  color: inherit; padding: 1px 4px; margin: -1px -4px; border-radius: 5px;
  cursor: pointer; font-variant-numeric: tabular-nums; text-align: left;
  max-width: 100%;
}
.inline-edit:hover { background: #eef1f6; color: var(--accent-ink); }
.inline-edit.is-long {
  display: inline-block; max-width: 148px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.inline-input {
  height: 24px; padding: 0 4px; border-radius: 6px;
  border: 1px solid var(--accent); font: inherit; font-size: 12px;
  background: #fff; color: var(--ink); box-shadow: 0 0 0 2px var(--accent-soft);
}
.inline-input[type="date"] { width: 122px; }
.inline-input[type="number"] { width: 96px; text-align: right; }
.inline-input[type="text"] { width: 190px; }
.grid-full .inline-input[type="text"] { width: 150px; }

select.mini-select { font-size: 11px; padding: 2px 7px; }
.status-select[data-value="Да"] { background-color: var(--ok-soft); color: var(--ok); }
.status-select[data-value="Нет"] { background-color: #f1f3f6; color: var(--ink-2); }

/* Полный вид: ширина колонки — по содержимому, таблица тянется на всю ширину окна. */
table.grid.grid-full { width: 100%; min-width: max-content; font-size: 12px; }
table.grid.grid-full thead th {
  padding: 7px 7px; font-size: 10.5px; letter-spacing: 0;
  max-width: 96px; line-height: 1.2;
}
table.grid.grid-full tbody td {
  padding: 6px 7px; white-space: nowrap; max-width: 132px;
  overflow: hidden; text-overflow: ellipsis;
}
table.grid.grid-full .pill,
table.grid.grid-full .badge { height: 20px; padding: 0 6px; white-space: nowrap; }

/* ---------------------------------------------------------------- карточка заказа */
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.order-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-no { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.order-meta { font-size: 12px; color: var(--muted); }
.order-actions { display: flex; gap: 8px; }

.flash {
  background: var(--accent-soft); color: var(--accent-ink); border: 1px solid #d8e1fb;
  padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px;
}
.flash.flash-warn {
  background: var(--warn-soft); color: #8a5308; border-color: #ecdcc2;
}

.detail-grid { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
.col-left, .col-right { min-width: 0; }

.kv { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); flex: none; max-width: 52%; }
.kv b { text-align: right; font-weight: 550; font-variant-numeric: tabular-nums; }
.kv.total { border-top: 1px solid var(--line); border-bottom: none; margin-top: 4px; padding-top: 9px; }
.kv.total b { font-weight: 650; }
.num { font-variant-numeric: tabular-nums; }
.chk { font-size: 11px; margin-left: 4px; }
.chk.ok { color: var(--ok); }
.chk.bad { color: var(--danger); font-weight: 700; }

.subsection { margin-top: 16px; }
.sub-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.sub-head h3, .group-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
details summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: baseline; }
details summary::-webkit-details-marker { display: none; }
details summary h3::before { content: "▸ "; color: var(--muted); }
details[open] summary h3::before { content: "▾ "; }

table.mini { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
table.mini th { text-align: left; font-weight: 600; font-size: 11px; color: var(--muted); padding: 5px 6px; border-bottom: 1px solid var(--line); text-transform: uppercase; letter-spacing: .04em; }
table.mini td { padding: 5px 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
table.mini tbody tr:last-child td { border-bottom: none; }

/* поля */
.field-group { margin-bottom: 18px; }
.field-group:last-child { margin-bottom: 0; }
.group-title { margin-bottom: 6px; }
.field {
  display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; align-items: center;
  padding: 6px 8px; margin: 0 -8px; border-radius: 7px; cursor: pointer;
}
.field:hover { background: #f8f9fb; }
.field-label { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 5px; }
.hint-i {
  display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  background: #eef0f4; color: var(--muted); font-size: 9px; font-style: normal; font-weight: 700;
  cursor: help;
}
.field-value { font-size: 13px; font-weight: 500; min-height: 20px; overflow: hidden; text-overflow: ellipsis; }
.field-value.is-empty { color: #c2c8d2; font-weight: 400; }
.field input, .field select {
  width: 100%; height: 30px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--accent); font: inherit; font-size: 13px; background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* вопросы */
.q-list { display: flex; flex-direction: column; gap: 12px; }
.q { border-top: 1px solid #f3e7d3; padding-top: 12px; }
.q:first-child { border-top: none; padding-top: 0; }
.q-text { font-size: 13px; margin-bottom: 8px; }
.q-controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-chip {
  height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid #ecdcc2;
  background: #fff; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink);
}
.q-chip:hover { background: var(--warn-soft); border-color: #e6cda4; }
.q-chip.is-default { border-color: var(--accent); color: var(--accent-ink); background: #fff; }
.q-more {
  border: none; background: none; font: inherit; font-size: 12px; color: var(--muted);
  text-decoration: underline; cursor: pointer; padding: 0 2px;
}
.q-input {
  height: 28px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line);
  font: inherit; font-size: 12.5px; width: 170px;
}
.q-input[hidden] { display: none; }
.q-remember { font-size: 11.5px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }

/* история */
.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.events li { display: flex; gap: 10px; font-size: 12.5px; }
.ev-time { color: var(--muted); flex: none; width: 74px; font-variant-numeric: tabular-nums; }
.ev-link { color: var(--ink); font-weight: 600; font-size: 12.5px; width: 82px; flex: none; }
.ev-link:hover { color: var(--accent); }
.ev-text { color: var(--ink-2); }

.file-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.file-label { cursor: pointer; }
.file-label:has(input:not(:placeholder-shown)) { color: var(--accent-ink); }

/* ---------------------------------------------------------------- импорт */
.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px dashed #cfd4dd; border-radius: 11px; background: #fbfcfd;
  padding: 34px 20px; cursor: pointer; text-align: center; transition: border-color .12s, background .12s;
}
.drop:hover, .drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { color: var(--accent); }
.drop-title { font-weight: 600; font-size: 14px; }
.drop-sub { font-size: 12.5px; color: var(--muted); }
.drop-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.hint { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }
.steps { margin: 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; display: flex; flex-direction: column; gap: 7px; }
.steps b { color: var(--ink); }
.ok { color: var(--ok); font-size: 13px; }
.err { color: var(--danger); font-size: 13px; }
.result-body { font-size: 13px; }

/* ---------------------------------------------------------------- пустая база / новый заказ */
.empty-state { text-align: center; padding: 38px 24px 32px; }
.empty-art { color: #c9cfda; display: flex; justify-content: center; margin-bottom: 12px; }
.empty-state h2 { font-size: 18px; letter-spacing: -.01em; margin-bottom: 8px; }
.empty-text { max-width: 540px; margin: 0 auto 18px; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.card.narrow { max-width: 540px; }
.new-order { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 16px; }
.form-label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.form-label input {
  height: 34px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line);
  font: inherit; font-size: 14px; min-width: 240px; background: #fff; color: var(--ink);
}
.form-label input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; }
  .sidebar-foot { display: none; }
  nav { flex-direction: row; }
  .main { padding: 20px 16px 40px; }
  .import-grid { grid-template-columns: 1fr; }
  .field { grid-template-columns: 1fr; gap: 2px; }
}


/* ---------------------------------------------------------------- почта */
.mail-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .mail-grid { grid-template-columns: 1fr; } }
.mail-form { display: flex; flex-direction: column; gap: 10px; }
.mail-form input { width: 100%; }
.mail-actions { margin-top: 4px; }
.mail-status { font-size: 12.5px; margin: 0 0 10px; }
.mail-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.mail-head { display: flex; gap: 8px; align-items: center; }
.mail-subject { font-weight: 600; font-size: 13.5px; }
.mail-new {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  background: var(--accent-soft); color: var(--accent-ink); border-radius: 5px; padding: 2px 6px;
}
.mail-meta { font-size: 12px; color: var(--muted); margin: 3px 0 8px; }
.mail-file {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-top: 1px dashed var(--line-2);
}
.mail-file-name { font-size: 12.5px; }
.mail-file-size { font-size: 11.5px; color: var(--muted); margin-left: auto; }
.mail-file .inline-form { margin-left: 10px; }
.mail-empty { color: var(--muted); font-size: 13px; padding: 14px 0; }
.btn-small { padding: 5px 10px; font-size: 12px; }


/* ---------------------------------------------------------------- админка */
.login-wrap { max-width: 420px; margin: 40px auto 0; }
.login-card { padding-bottom: 18px; }
.admin-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
@media (max-width: 1100px) { .admin-grid { grid-template-columns: 1fr; } }
.source-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.source-form input, .source-form select { width: 100%; }
.source-mail { border-top: 1px solid var(--line); padding-top: 10px; }
.admin-user { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.admin-pass { margin-top: 12px; font-size: 12.5px; }
.admin-pass summary { cursor: pointer; color: var(--muted); }


/* ------------------------------------------------------------ пользователи */
.auth-switch { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }
.users-group { margin-bottom: 14px; }
.users-group h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.user-row:last-child { border-bottom: none; }
.user-actions { display: flex; gap: 6px; }
.side-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); padding: 0 6px 8px; }
