/* Дизайн-система автосервисной CRM.
   Тёмное боковое меню, светлое рабочее поле, янтарный акцент. */

:root {
  --nav: #101827;
  --nav-soft: #1b2437;
  --nav-line: #2a3448;
  --nav-text: #a9b4c7;

  --accent: #f59e0b;
  --accent-dark: #d97706;
  --blue: #2563eb;
  --green: #059669;
  --red: #dc2626;

  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f1f4f9;
  --card: #ffffff;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* ── Каркас ─────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 246px;
  flex-shrink: 0;
  background: var(--nav);
  color: var(--nav-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand {
  padding: 17px 18px;
  border-bottom: 1px solid var(--nav-line);
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.brand-name { color: #fff; font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.brand-sub { color: #6d7a91; font-size: 11px; margin-top: 1px; }

.side nav { flex: 1; overflow-y: auto; padding: 12px 10px; scrollbar-width: none; }
.side nav::-webkit-scrollbar { width: 0; }

.nav-group {
  margin: 15px 8px 5px;
  padding-top: 13px;
  border-top: 1px solid var(--nav-line);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #64748b;
}
.nav-group:first-child { margin-top: 2px; padding-top: 0; border-top: 0; }

.nav-a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--nav-text);
  font-weight: 500;
  position: relative;
  transition: background .12s, color .12s;
}
.nav-a:hover { background: var(--nav-soft); color: #fff; }
.nav-a.on { background: linear-gradient(90deg, rgba(245,158,11,.16), rgba(245,158,11,.03)); color: #fff; }
.nav-a.on::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-ic { width: 17px; text-align: center; flex-shrink: 0; opacity: .85; font-size: 15px; }
.nav-a.on .nav-ic { opacity: 1; }
.nav-count {
  margin-left: auto;
  background: var(--nav-soft);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-a.on .nav-count { background: rgba(245,158,11,.22); color: #fcd34d; }

.side-foot { border-top: 1px solid var(--nav-line); padding: 12px 14px; }
.side-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--nav-soft);
  display: flex; align-items: center; justify-content: center;
  color: #cbd5e1; font-weight: 600; font-size: 12.5px;
  flex-shrink: 0;
}
.side-user-name { color: #e2e8f0; font-size: 13px; font-weight: 500; }
.side-user-role { color: #64748b; font-size: 11px; }

/* ── Рабочее поле ───────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.head {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 26px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: sticky; top: 0; z-index: 20;
}
.head h1 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.head-sub { color: var(--ink-3); font-size: 12.5px; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.search {
  position: relative;
  width: 300px;
}
.search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 13.5px;
  font-family: inherit;
  background: #f8fafc;
  outline: none;
  transition: border-color .12s, background .12s;
}
.search input:focus { border-color: var(--accent); background: #fff; }
.search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 13px; }

.body { padding: 22px 26px 40px; flex: 1; }

/* ── Кнопки ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

/* ── Карточки ───────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .muted { font-size: 12.5px; color: var(--ink-3); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: #fafbfd; }

/* ── Плитки показателей ─────────────────────────────── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
  box-shadow: var(--shadow);
}
.tile-label { font-size: 12px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.tile-value { font-size: 25px; font-weight: 650; letter-spacing: -.025em; margin-top: 6px; line-height: 1.15; }
.tile-note { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.tile-value.ok { color: var(--green); }
.tile-value.warn { color: var(--accent-dark); }
.tile-value.bad { color: var(--red); }

/* ── Таблицы ────────────────────────────────────────── */
.tbl { font-size: 13.5px; }
.tbl th {
  text-align: left;
  padding: 9px 14px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-3);
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .strong { font-weight: 600; }

.tbl-wrap { overflow-x: auto; }

/* ── Мелочи ─────────────────────────────────────────── */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}
.pill-new  { background: #eff6ff; color: #1d4ed8; }
.pill-work { background: #fffbeb; color: #b45309; }
.pill-done { background: #ecfdf5; color: #047857; }
.pill-issued { background: #f1f5f9; color: #475569; }
.pill-canceled { background: #fef2f2; color: #b91c1c; }
.pill-red  { background: #fef2f2; color: #b91c1c; }
.pill-green{ background: #ecfdf5; color: #047857; }

.plate {
  display: inline-block;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .03em;
  background: #fff;
  border: 1.5px solid #334155;
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
}

.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-side { display: grid; grid-template-columns: 1fr 330px; gap: 16px; align-items: start; }
@media (max-width: 1100px) {
  .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; }
}

.row { display: flex; align-items: center; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.mb { margin-bottom: 16px; }

/* Полоса заполнения — для остатков склада и долей */
.bar { height: 5px; background: #eef2f7; border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.bar > i.low { background: var(--red); }
.bar > i.mid { background: var(--accent); }

/* Список фильтров-вкладок */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 6px 13px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: #fff;
  border: 1px solid var(--line);
}
.tab:hover { background: #f8fafc; }
.tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab .n { opacity: .6; margin-left: 4px; font-size: 12px; }

/* Строка «параметр — значение» в карточках */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eef2f7; font-size: 13.5px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--ink-3); }
.kv dd { font-weight: 500; text-align: right; }

/* Лента истории обслуживания */
.tl { position: relative; padding-left: 22px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -20px; top: 5px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
}
.tl-date { font-size: 12px; color: var(--ink-3); }
.tl-title { font-weight: 600; font-size: 13.5px; margin-top: 1px; }
.tl-body { font-size: 13px; color: var(--ink-2); margin-top: 3px; }

/* Колонки-столбики простого графика выручки */
.chart { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.chart .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.chart .col > i {
  display: block; width: 100%; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #fbbf24, #f59e0b);
  min-height: 3px;
}
.chart .col span { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }

/* Вход */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #101827, #1e293b);
  padding: 20px;
}
.login-card { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.login-card h1 { font-size: 20px; margin-bottom: 5px; }
.login-card p.sub { color: var(--ink-3); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.field input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; font-size: 14px; font-family: inherit; outline: none;
}
.field input:focus { border-color: var(--accent); }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; }
.demo-hint { margin-top: 18px; padding: 12px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 9px; font-size: 12.5px; color: #92400e; }
.err { background: #fef2f2; color: #b91c1c; padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }

/* Печатная форма наряда */
@media print {
  .side, .head, .no-print { display: none !important; }
  .body { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
