/* ============================================================
   АвтоСервис CRM — базовые стили (страница входа + дашборд)
   ============================================================ */
:root {
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface2: #f7f9fc;
  --text: #152238;
  --muted: #5f6f88;
  --border: #dde4ee;
  --brand: #1e4fd6;
  --brand-dark: #173faf;
  --brand-soft: #e9effc;
  --accent: #ee7326;
  --ok: #1a7f42;
  --danger: #c62a21;
  --radius: 12px;
  --shadow: 0 12px 32px rgba(20, 40, 100, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { font-weight: 600; }

/* ==================== Страница входа ==================== */
.login-wrap {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  min-height: 100vh;
}

.login-brand {
  background: linear-gradient(155deg, #153a9e 0%, #1e4fd6 58%, #2f6bf0 100%);
  color: #fff;
  padding: 44px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 34px;
}

.brand-logo { display: flex; align-items: center; gap: 13px; font-size: 19px; }
.brand-logo b { font-weight: 700; }

.logo-mark {
  width: 44px; height: 44px; border-radius: 11px;
  background: rgba(255, 255, 255, .16);
  display: grid; place-items: center; flex: none;
}
.logo-mark svg { width: 22px; height: 22px; }

.brand-hero h2 { margin: 0 0 10px; font-size: 31px; line-height: 1.22; }
.brand-hero p { margin: 0; color: rgba(255, 255, 255, .82); max-width: 46ch; }

.brand-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.brand-features li { display: flex; gap: 10px; align-items: center; color: rgba(255, 255, 255, .92); }
.brand-features svg { width: 16px; height: 16px; opacity: .9; flex: none; }

.brand-foot { color: rgba(255, 255, 255, .6); font-size: 13px; }

.login-panel { display: grid; place-items: center; padding: 40px 20px; }

.login-card {
  width: 100%; max-width: 410px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 32px 32px 26px;
}

.login-card h1 { margin: 0 0 4px; font-size: 23px; }
.login-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.field { display: block; margin-bottom: 14px; }
.field > span:first-child {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 5px; color: var(--muted);
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg {
  position: absolute; left: 11px; width: 16px; height: 16px;
  color: var(--muted); pointer-events: none;
}
.input-wrap input {
  width: 100%; height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 42px 0 37px;
  font: inherit; color: var(--text);
  background: #fbfcfe;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
  background: #fff;
}

.toggle-pass {
  position: absolute; right: 5px;
  width: 34px; height: 34px;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.toggle-pass:hover { background: var(--brand-soft); color: var(--brand); }
.toggle-pass svg { width: 16px; height: 16px; }

.form-row {
  display: flex; justify-content: space-between; align-items: center;
  margin: 2px 0 18px; font-size: 13.5px; color: var(--muted);
}
.form-row label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.form-row a { color: var(--brand); text-decoration: none; }
.form-row a:hover { text-decoration: underline; }

.form-error {
  background: #fdecea; color: var(--danger);
  border: 1px solid #f6c6c2;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

.btn {
  width: 100%; height: 46px;
  border: 0; border-radius: 10px;
  background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; font-size: 15.5px;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }

.demo-box { margin-top: 20px; border-top: 1px dashed var(--border); padding-top: 15px; }
.demo-box > span {
  font-size: 12px; font-weight: 600; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.demo-list { display: grid; gap: 8px; margin-top: 10px; }
.demo-chip {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface2); padding: 8px 12px;
  font: inherit; font-size: 13.5px; color: var(--text);
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
}
.demo-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.demo-chip b { display: flex; flex-direction: column; flex: 1; line-height: 1.3; }
.demo-chip b em { font-style: normal; color: var(--muted); font-size: 11.5px; font-weight: 400; }
.demo-chip code { color: var(--muted); font-size: 12px; text-align: right; line-height: 1.35; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot-admin { background: #3b6ce8; }
.dot-manager { background: #ee7326; }
.dot-employee { background: #27a35d; }

@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.shake { animation: shake .3s ease; }

/* ==================== Дашборд ==================== */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: #0f1d33; color: #c6d1e4;
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 14px;
}

.side-logo {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
  color: #fff; font-size: 15px;
}
.side-logo small { display: block; color: #8fa2c2; font-size: 11.5px; font-weight: 400; }
.side-logo .logo-mark { width: 36px; height: 36px; border-radius: 9px; background: rgba(255, 255, 255, .12); }
.side-logo .logo-mark svg { width: 18px; height: 18px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: #7288a8; margin: 8px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 9px;
  color: #c6d1e4; text-decoration: none; font-size: 14px;
}
.nav-item svg { width: 16px; height: 16px; opacity: .85; flex: none; }
a.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.nav-item.locked { opacity: .4; cursor: not-allowed; }
.nav-item.locked .ic-lock { margin-left: auto; width: 13px; height: 13px; }

.side-logout {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: transparent; color: #c6d1e4;
  border-radius: 9px; padding: 10px;
  font: inherit; font-size: 13.5px; cursor: pointer;
}
.side-logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-logout svg { width: 15px; height: 15px; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 15px 28px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
}
.topbar h1 { margin: 0; font-size: 19px; }
.crumb { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.user-chip { display: flex; align-items: center; gap: 11px; }
.user-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-weight: 600;
}
.av-admin { background: #1e4fd6; }
.av-manager { background: #ee7326; }
.av-employee { background: #27a35d; }
.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta small { color: var(--muted); font-size: 12px; }

.role-badge { font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: 99px; }
.rb-admin { background: var(--brand-soft); color: var(--brand); }
.rb-manager { background: #fdefe2; color: #c2570c; }
.rb-employee { background: #e6f6ec; color: var(--ok); }

.content { padding: 26px 28px 40px; display: flex; flex-direction: column; gap: 20px; }

.welcome h2 { margin: 0 0 4px; font-size: 20px; }
.welcome p { margin: 0; color: var(--muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 3px;
}
.kpi small { color: var(--muted); font-size: 12.5px; }
.kpi-val { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); }

.section-title { margin: 6px 0 0; font-size: 15px; }

.module-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.module-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.module-card.locked { opacity: .55; background: var(--surface2); }
.module-ic {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin-bottom: 3px;
}
.module-ic svg { width: 19px; height: 19px; }
.module-ic.big { width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 12px; }
.module-ic.big svg { width: 26px; height: 26px; }
.module-card small { color: var(--muted); }
.module-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; }
.module-foot a { color: var(--brand); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.module-foot a:hover { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 99px;
}
.badge svg { width: 12px; height: 12px; }
.badge-ok { background: #e6f6ec; color: var(--ok); }
.badge-view { background: var(--brand-soft); color: var(--brand); }
.badge-own { background: #fdefe2; color: #c2570c; }
.badge-off { background: #f0f3f8; color: #8a94a6; }

.backlink { color: var(--brand); text-decoration: none; font-size: 13.5px; width: max-content; }
.backlink:hover { text-decoration: underline; }

.placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 46px 24px;
  text-align: center;
}
.placeholder p { color: var(--muted); margin: 0 0 6px; }
.placeholder .badge { margin-top: 8px; }

.demo-note { color: var(--muted); font-size: 13px; margin: 0; }

/* ==================== Адаптивность ==================== */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }

  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 14px; position: relative; z-index: 30; }
  .side-logo { border: 0; padding: 0; }
  .side-logo small { display: none; }
  .side-logo .nav-burger { display: grid; }
  .side-nav, .side-logout, .side-reset { display: none; }
  .sidebar.open { flex-direction: column; align-items: stretch; }
  .sidebar.open .side-nav { display: flex; flex-direction: column; }
  .sidebar.open .side-nav .nav-item { padding: 12px 11px; }
  .sidebar.open .side-logout, .sidebar.open .side-reset { display: flex; margin: 8px 0 0; }
}

@media (max-width: 560px) {
  .kpi-grid, .module-grid { grid-template-columns: 1fr; }
  .role-badge { display: none; }
}

/* ==================== Клиенты и авто ==================== */
[hidden] { display: none !important; }

.page-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

.search-wrap { position: relative; flex: 1; min-width: 220px; max-width: 430px; }
.search-wrap svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--muted); pointer-events: none;
}
.search-wrap input {
  width: 100%; height: 40px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px 0 34px;
  font: inherit; color: var(--text); background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-wrap input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.btn-accent, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.btn-accent { border: 0; background: var(--brand); color: #fff; transition: background .15s; }
.btn-accent:hover { background: var(--brand-dark); }
.btn-ghost { border: 1px solid var(--border); background: transparent; color: var(--text); transition: background .15s; }
.btn-ghost:hover { background: var(--surface2); }
.btn-ghost.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-accent svg, .btn-ghost svg { width: 15px; height: 15px; }

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.table-scroll { overflow-x: auto; }

table.clients { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 780px; }
.clients th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface2); white-space: nowrap;
}
.clients td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.clients tbody tr:last-child td { border-bottom: 0; }
.clients tbody tr { cursor: pointer; transition: background .12s; }
.clients tbody tr:hover { background: var(--brand-soft); }

.td-muted { color: var(--muted); }
.ta-r { text-align: right; }
.ta-c { text-align: center; }
.tab { font-variant-numeric: tabular-nums; }
.year { color: var(--muted); font-size: 12.5px; }
.cell-chev { color: var(--muted); width: 34px; }
.cell-chev svg { width: 15px; height: 15px; }

.cell-user { display: flex; align-items: center; gap: 10px; font-weight: 600; white-space: nowrap; }
.user-avatar.sm { width: 30px; height: 30px; font-size: 13px; }
.user-avatar.lg { width: 52px; height: 52px; font-size: 21px; border-radius: 14px; }
.uav-0 { background: #1e4fd6; }
.uav-1 { background: #27a35d; }
.uav-2 { background: #ee7326; }
.uav-3 { background: #7c3aed; }
.uav-4 { background: #0e7490; }
.uav-5 { background: #be4a3a; }

/* Госномер в виде таблички */
.plate {
  display: inline-block;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700; letter-spacing: .07em; font-size: 12.5px;
  color: #101828; background: #fff;
  border: 1.5px solid #33415c; border-radius: 6px;
  padding: 2px 8px; white-space: nowrap;
}

.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ---------- Модальные окна ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 18, 35, .55);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  background: var(--surface);
  border-radius: 16px; width: 100%; max-width: 460px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  box-shadow: 0 24px 64px rgba(5, 15, 40, .35);
}
.modal-wide { max-width: 660px; }

.card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 20px 22px; border-bottom: 1px solid var(--border);
}
.card-title { flex: 1; min-width: 0; }
.card-title h3 { margin: 0; font-size: 17px; }
.card-title small { color: var(--muted); }
.icon-btn {
  width: 32px; height: 32px; flex: none;
  border: 0; background: transparent; border-radius: 8px;
  color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

.card-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.modal .card-body { padding-top: 20px; }
.modal h3 { margin: 0 0 4px; }
.modal-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

.car-tile {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; background: var(--surface2);
}
.car-main { flex: 1; min-width: 200px; }
.car-main b { font-size: 14.5px; }
.car-main small { display: block; margin-top: 4px; color: var(--muted); }
.car-vin { width: 100%; color: var(--muted); font-size: 12px; font-family: Consolas, monospace; }

.card-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat-tile { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.stat-tile small { display: block; color: var(--muted); font-size: 11.5px; }
.stat-tile b { font-size: 16px; font-variant-numeric: tabular-nums; }

.visit-list { display: flex; flex-direction: column; margin-top: 4px; }
.visit {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px dashed var(--border);
}
.visit:last-child { border-bottom: 0; }
.visit-date { width: 80px; flex: none; color: var(--muted); font-size: 13px; }
.visit-works { flex: 1; min-width: 180px; }
.visit-sum { font-weight: 600; font-variant-numeric: tabular-nums; }

.card-body h4 { margin: 0; font-size: 13.5px; }
.card-note p { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 4px; flex-wrap: wrap; }
.modal .field { margin-bottom: 12px; }
.modal input {
  width: 100%; height: 40px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 12px; font: inherit; color: var(--text); background: #fbfcfe;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.modal input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .field.wide { grid-column: 1 / -1; }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 80;
  transform: translate(-50%, 14px);
  background: #152238; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px;
  max-width: calc(100vw - 40px);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.no-scroll { overflow: hidden; }

@media (max-width: 720px) {
  .card-stats { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.modal textarea {
  width: 100%; min-height: 64px; height: auto;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 9px 12px; font: inherit; color: var(--text); background: #fbfcfe;
  outline: none; resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.modal textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }

/* ==================== Моя работа (личная доска сотрудника) ==================== */
.job-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.job-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.job-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-car { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.job-car b { font-size: 15px; }
.job-client { color: var(--muted); font-size: 13px; }

.job-works { display: flex; flex-direction: column; border-top: 1px dashed var(--border); }
.job-work {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px dashed var(--border);
}
.job-work:last-child { border-bottom: 0; }
.job-work small { color: var(--muted); }
.job-work .badge { margin-right: 6px; }

.job-parts {
  background: #fdefe2; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px; font-size: 13px;
}
.job-parts b { font-size: 12.5px; }

.job-foot {
  margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13.5px;
}
.job-share { font-weight: 600; color: var(--brand); }

@media (max-width: 1080px) {
  .job-grid { grid-template-columns: 1fr; }
}

/* ==================== Склад запчастей ==================== */
.badge-bad { background: #fdecea; color: var(--danger); }

.fits-chip {
  display: inline-block; font-size: 11.5px; line-height: 1.4;
  padding: 2px 8px; margin: 1px 4px 1px 0;
  border-radius: 99px; background: var(--surface2);
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.fits-list .fits-chip { margin: 2px 4px 2px 0; }

.cell-name b { display: block; font-weight: 600; }
.cell-name small { color: var(--muted); font-family: Consolas, "Courier New", monospace; font-size: 11.5px; }
.cell-note { color: var(--muted); font-size: 12.5px; }

.modal select {
  width: 100%; height: 40px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 10px; font: inherit; color: var(--text); background: #fbfcfe;
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.modal select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); background: #fff; }

/* ==================== Заказы-наряды ==================== */
.orders-table { min-width: 960px; }
.b-brand { color: var(--brand); }

.ord-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ord-info .stat-tile b { font-size: 13.5px; font-weight: 600; }

.otbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.otbl th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600;
  padding: 6px 8px; border-bottom: 1px solid var(--border); background: var(--surface2);
}
.otbl td { padding: 7px 8px; border-bottom: 1px dashed var(--border); }
.otbl td:nth-child(n + 3), .otbl th:nth-child(n + 3) { white-space: nowrap; }
.otbl tr.total td { font-weight: 600; border-bottom: 0; }

@media (max-width: 720px) {
  .ord-info { grid-template-columns: 1fr; }
}

/* ---------- Фильтры таблиц ---------- */
.filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-select {
  height: 40px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 0 30px 0 12px;
  font: inherit; font-size: 13.5px; color: var(--text);
  background: var(--surface) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%235f6f88" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>') no-repeat right 10px center;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  outline: none; max-width: 210px;
  transition: border-color .15s, box-shadow .15s;
}
.filter-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.table-count { margin: 0; color: var(--muted); font-size: 12.5px; }

/* ---------- Фильтр-календарь (период дат) ---------- */
.date-range {
  display: flex; align-items: center; gap: 4px;
  height: 40px; padding: 0 6px 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
}
.date-range:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.date-label { color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.date-range input[type="date"] {
  border: 0; background: transparent; outline: none;
  font: inherit; font-size: 13px; color: var(--text);
  height: 34px; padding: 0; width: 126px; cursor: pointer;
}
.date-sep { color: var(--muted); }
.date-clear {
  width: 26px; height: 26px; flex: none;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.date-clear:hover { background: var(--surface2); color: var(--danger); }

@media (max-width: 640px) {
  .date-label { display: none; }
  .date-range input[type="date"] { width: 116px; }
}

/* ==================== Задачник по кластерам ==================== */
.cluster-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }

.cluster-col {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 140px;
}
.cluster-head { display: flex; flex-direction: column; gap: 1px; padding: 0 2px 9px; border-bottom: 1px dashed var(--border); }
.cluster-head b { font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.cluster-head small { color: var(--muted); font-size: 11.5px; }
.cdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.d-queue { background: #3b6ce8; }
.d-progress { background: #ee7326; }
.d-parts { background: #7c3aed; }
.d-done { background: #27a35d; }
.task-empty { color: var(--muted); font-size: 12.5px; text-align: center; padding: 12px 0 6px; }

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 7px;
}
.task-car { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.task-car b { font-size: 13.5px; }
.task-client { color: var(--muted); font-size: 12px; }
.task-works { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.task-work { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.task-work b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.task-parts { background: #fdefe2; border-radius: 8px; padding: 6px 9px; font-size: 12px; }
.task-parts b { font-size: 11.5px; }

.task-foot {
  margin-top: auto; padding-top: 7px; border-top: 1px dashed var(--border);
  display: flex; flex-direction: column; gap: 4px; font-size: 12px;
}
.task-foot .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.task-foot .row b { font-variant-numeric: tabular-nums; }
.task-income { color: var(--brand); }

.cluster-select {
  width: 100%; height: 30px;
  font: inherit; font-size: 12px; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 0 8px; background: var(--surface2); cursor: pointer; outline: none;
}
.cluster-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

.task-edit-btn {
  width: 100%; height: 28px;
  border: 1px dashed var(--border); border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11.5px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.task-edit-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }

.task-del-btn {
  width: 100%; height: 28px;
  border: 1px dashed var(--border); border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11.5px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.task-del-btn:hover { color: var(--danger); border-color: var(--danger); background: #fdecea; }
.task-del-btn.armed { color: var(--danger); border-color: var(--danger); background: #fdecea; font-weight: 600; }

/* ==================== Расписание (график 5/2) ==================== */
.week-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.week-title { font-weight: 600; font-size: 15px; }

.sched-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 980px; }
.sched-table th {
  padding: 10px 8px; border-bottom: 1px solid var(--border); background: var(--surface2);
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); font-weight: 600; text-align: center; white-space: nowrap;
}
.sched-table th small { display: block; font-size: 11px; text-transform: none; letter-spacing: 0; }
.sched-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); text-align: center; }
.sched-table tbody tr:last-child td { border-bottom: 0; }

.sched-emp, .sched-emp-h { text-align: left !important; }
.sched-emp { white-space: nowrap; }
.sched-emp b { display: block; font-weight: 600; font-size: 13.5px; }
.sched-emp small { color: var(--muted); font-size: 11.5px; }
.sched-emp-h { min-width: 150px; }

.day-h.today-h { color: var(--brand); }
.cell-work { background: #e6f6ec; color: var(--ok); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.cell-off { background: var(--surface2); color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.cell-off.has-reason { background: #fdecea; color: var(--danger); }
.cell-total { white-space: nowrap; }
.cell-today { box-shadow: inset 0 0 0 2px var(--brand); }

td.clickable { cursor: pointer; }
td.clickable:hover { outline: 2px solid var(--brand); outline-offset: -2px; }

/* ==================== Финансы ==================== */
.fin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.fin-chart { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.fin-chart h4 { margin: 0 0 10px; font-size: 13.5px; }
.fin-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.fin-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.fin-legend b { color: var(--text); }

.fin-structure { display: flex; height: 14px; border-radius: 99px; overflow: hidden; margin: 8px 0 8px; background: var(--surface2); }
.fin-struct-work { background: var(--brand); }
.fin-struct-parts { background: #ee7326; }

.fin-rules { margin: 14px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.fin-table { min-width: 900px; }
.fin-table td b { font-weight: 600; }
.b-brand { color: var(--brand); }

@media (max-width: 1080px) {
  .fin-grid { grid-template-columns: 1fr; }
}

/* ==================== Отчёты ==================== */
.rep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.rep-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}
.rep-block h3 { margin: 0 0 10px; font-size: 14.5px; }
.rep-sub { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.rep-bar { height: 7px; border-radius: 99px; background: var(--brand-soft); overflow: hidden; margin-top: 5px; max-width: 220px; }
.rep-bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.rep-chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 14px; }
.rep-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--muted);
  min-width: 130px;
}
.rep-chip b { display: block; font-size: 15px; color: var(--text); }

@media (max-width: 1080px) {
  .rep-grid { grid-template-columns: 1fr; }
}

.work-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.work-row input {
  height: 38px; border: 1px solid var(--border); border-radius: 10px;
  padding: 0 11px; font: inherit; font-size: 13.5px; color: var(--text);
  background: #fbfcfe; outline: none; min-width: 0;
}
.work-row .w-name { flex: 1; }
.work-row .w-price { width: 110px; }
.work-row .work-del {
  width: 30px; height: 30px; flex: none;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 15px; cursor: pointer;
}
.work-row .work-del:hover { background: var(--surface2); color: var(--danger); }

@media (max-width: 1080px) {
  .cluster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .cluster-grid { grid-template-columns: 1fr; }
  .work-row .w-price { width: 90px; }
}

/* ==================== Бургер-меню (мобильные) ==================== */
.nav-burger {
  display: none;
  width: 40px; height: 40px;
  margin-left: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 10px;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  place-items: center;
}
.nav-burger svg { width: 20px; height: 20px; }
.nav-burger:hover { background: rgba(255, 255, 255, .16); }

/* ==================== Телефоны ==================== */
@media (max-width: 640px) {
  .content { padding: 16px 14px 26px; }
  .topbar { padding: 12px 14px; }
  .crumb { display: none; }
  .page-head .btn-accent, .page-head .btn-ghost { flex: 1 1 100%; }

  /* Таблицы превращаются в карточки */
  .table-scroll { overflow-x: visible; }
  .clients { min-width: 0 !important; }
  .clients thead { display: none; }
  .clients tbody tr { display: block; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); }
  .clients tbody tr:last-child { border-bottom: 0; }
  .clients tbody tr:hover { background: transparent; }
  .clients tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border-bottom: 0; padding: 3px 0; text-align: right;
  }
  .clients tbody td::before {
    content: attr(data-label);
    color: var(--muted); font-size: 11.5px; text-align: left; flex: 1;
  }
  .clients tbody td:first-child { padding-top: 6px; }
  .clients tbody td:first-child::before { display: none; }
  .clients tbody td.cell-chev { display: none; }
  .cell-user { white-space: normal; }

  .modal-actions { flex-direction: column-reverse; align-items: stretch; }
  .modal-actions .btn-accent, .modal-actions .btn-ghost { width: 100%; }
  .modal .card-body { overflow-x: auto; }
  .rep-block { overflow-x: auto; }
}

/* Расписание: закреплённая колонка сотрудника при прокрутке */
.sched-emp { position: sticky; left: 0; background: var(--surface); z-index: 1; }
th.sched-emp-h { position: sticky; left: 0; background: var(--surface2); z-index: 2; }

/* ==================== Глобальный поиск, бейджи, бэкап ==================== */
.side-search { padding: 0 6px 10px; position: relative; }
.side-search input {
  width: 100%; height: 34px;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px;
  background: rgba(255, 255, 255, .06); color: #e6ecf8;
  padding: 0 10px; font: inherit; font-size: 12.5px; outline: none;
  transition: border-color .15s, background .15s;
}
.side-search input::placeholder { color: #7288a8; }
.side-search input:focus { border-color: #3b6ce8; background: rgba(255, 255, 255, .1); }
.side-search-results {
  position: absolute; left: 6px; right: 6px; top: calc(100% - 2px);
  background: #fff; color: #152238; border-radius: 10px;
  box-shadow: 0 18px 36px rgba(5, 15, 40, .35); z-index: 80; overflow: hidden;
}
.gsr-item {
  display: flex; gap: 9px; width: 100%; align-items: flex-start;
  text-align: left; padding: 8px 10px; border: 0; background: none;
  cursor: pointer; font: inherit; font-size: 12.5px; color: #152238;
}
.gsr-item:hover { background: #e9effc; }
.gsr-item b { display: block; font-weight: 600; }
.gsr-item small { color: #5f6f88; display: block; line-height: 1.3; }
.gsr-ic { color: #1e4fd6; margin-top: 2px; display: grid; place-items: center; }
.gsr-ic svg { width: 14px; height: 14px; }
.gsr-empty { padding: 10px 12px; color: #5f6f88; font-size: 12px; }
.nav-badge {
  margin-left: auto; background: #ee7326; color: #fff;
  font-size: 10.5px; font-weight: 700; border-radius: 99px;
  padding: 1px 7px; line-height: 1.4;
}
.side-tools { display: flex; flex-direction: column; gap: 6px; }
.side-tool {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .14); background: transparent;
  color: #c6d1e4; border-radius: 9px; padding: 8px 10px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.side-tool:hover { background: rgba(255, 255, 255, .08); color: #fff; }
