:root {
  color-scheme: light;
  --ink: #15191f;
  --muted: #6c7480;
  --line: #dfe3e8;
  --soft: #f0f2f5;
  --paper: #ffffff;
  --canvas: #f5f6f8;
  --sidebar: #15191f;
  --sidebar-2: #1c222a;
  --accent: #ffb000;
  --accent-dark: #c97c00;
  --green: #198754;
  --red: #d14343;
  --blue: #3468d4;
  --radius: 16px;
  --shadow: 0 12px 40px rgba(20, 25, 31, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 254px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  background:
    radial-gradient(circle at 28px 30px, rgba(255,176,0,.14), transparent 145px),
    var(--sidebar);
  color: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 30px;
}
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #17191d;
  font-weight: 900;
  letter-spacing: -.05em;
}
.brand-copy { display: grid; }
.brand-copy strong { font-size: 1.05rem; }
.brand-copy small { color: #9099a5; font-size: .75rem; }
.nav { display: grid; gap: 6px; }
.nav-item {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  color: #aeb6c0;
  background: transparent;
  text-align: left;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.is-active {
  color: #fff;
  background: var(--sidebar-2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-icon {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 800;
}
.sidebar-foot { margin-top: auto; display: grid; gap: 12px; }
.user-chip {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  color: #dce1e7;
}
.user-chip small { display: block; color: #8e98a4; }

.main { min-width: 0; }
.topbar {
  min-height: 102px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(20px, 4vw, 46px);
  background: rgba(245,246,248,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 2px 0 0; font-size: clamp(1.5rem, 2vw, 2rem); line-height: 1.1; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.top-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.content { padding: 30px clamp(20px, 4vw, 46px) 56px; }

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-weight: 750;
}
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--accent); color: #17191d; }
.button-secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.button-danger { background: #fff0f0; color: var(--red); border-color: #ffd4d4; }
.button-ghost { color: #bdc4cc; background: transparent; border-color: rgba(255,255,255,.12); }
.button-block { width: 100%; }
.button-small { min-height: 34px; padding: 0 11px; font-size: .85rem; }
.icon-button {
  width: 38px; height: 38px; border: 0; border-radius: 10px;
  background: var(--soft); color: var(--ink); font-size: 1.4rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.search {
  min-width: min(360px, 100%);
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  color: var(--ink);
  outline: none;
}
.search:focus, .field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(255,176,0,.15);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.metric {
  min-height: 128px;
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 4px 18px rgba(20,25,31,.04);
}
.metric::after {
  content: "";
  position: absolute;
  right: -26px;
  bottom: -36px;
  width: 90px;
  height: 90px;
  border: 18px solid var(--metric-color, var(--accent));
  border-radius: 50%;
  opacity: .12;
}
.metric-label { color: var(--muted); font-size: .85rem; font-weight: 700; }
.metric-value { margin-top: 12px; font-size: clamp(1.55rem, 3vw, 2.15rem); font-weight: 900; letter-spacing: -.04em; }
.metric-note { margin-top: 4px; color: var(--muted); font-size: .78rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .75fr); gap: 18px; }
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 5px 20px rgba(20,25,31,.035);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.02rem; }
.panel-body { padding: 20px; }

.table-wrap { width: 100%; overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table th {
  padding: 12px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .045em;
}
.data-table td { padding: 14px; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-order-id]:hover { background: #fff9ea; cursor: pointer; }
.right { text-align: right !important; }
.item-status-select {
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef1f4;
  color: #59616b;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}
.status-work { background: #e9f0ff; color: #2f5bb8; }
.status-ready { background: #e8f7ef; color: #137547; }
.status-wait { background: #fff3d8; color: #9b6500; }
.status-closed { background: #edf0f3; color: #606873; }
.status-income { background: #e8f7ef; color: #137547; }
.status-expense { background: #fff0f0; color: #b73838; }

.progress-track { height: 8px; border-radius: 999px; background: #eceff2; overflow: hidden; }
.progress-bar { height: 100%; border-radius: inherit; background: var(--accent); }
.order-number { font-weight: 900; }
.vehicle-name { font-weight: 800; text-transform: capitalize; }
.phone { color: var(--muted); text-decoration: none; }
.money-negative { color: var(--red); }
.money-positive { color: var(--green); }

.order-list { display: grid; gap: 12px; }
.order-row {
  width: 100%;
  display: grid;
  grid-template-columns: 90px minmax(170px, 1.2fr) minmax(150px, 1fr) 120px 130px 24px;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: inherit;
  text-align: left;
}
.order-row:hover { border-color: #efc45c; box-shadow: 0 6px 22px rgba(20,25,31,.06); }
.order-row small { display: block; color: var(--muted); margin-top: 3px; }
.chevron { font-size: 1.35rem; color: #a1a8b1; }

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  padding: 24px;
  margin-bottom: 18px;
  border-radius: 18px;
  background: var(--sidebar);
  color: #fff;
}
.detail-hero h2 { margin: 3px 0 6px; font-size: clamp(1.5rem, 3vw, 2.2rem); letter-spacing: -.04em; }
.detail-hero .muted { color: #9fa8b3; }
.detail-total { text-align: right; }
.detail-total strong { display: block; font-size: 2rem; color: var(--accent); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.detail-actions .button-secondary { background: #242a32; border-color: #333b46; color: #fff; }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fact { padding: 16px; border-radius: 12px; background: var(--soft); }
.fact small { display: block; color: var(--muted); margin-bottom: 5px; }
.fact strong { display: block; }

.employee-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.employee-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.employee-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.employee-card h3 { margin: 0; }
.employee-code { color: var(--muted); font-size: .78rem; font-weight: 800; }
.employee-pay { margin: 20px 0 8px; font-size: 1.6rem; font-weight: 900; }
.employee-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.employee-stat { padding-top: 10px; border-top: 1px solid var(--line); }
.employee-stat small { color: var(--muted); }
.employee-stat strong { display: block; margin-top: 4px; overflow-wrap: anywhere; }
.employee-payment-filter { margin-bottom: 18px; }
.employee-payment-filter .toolbar { align-items: end; margin-bottom: 10px; }
.employee-payment-filter .toolbar-group { align-items: end; }
.employee-payment-filter p { margin: 0; }
.employee-payment-filter .payment-period-error { color: var(--red); }
.waiting-price { color: #925500; font-size: .85rem; }
.internal-summary { margin-top: 18px; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.internal-summary h3, .internal-summary p { margin: 0; }
.internal-summary p { margin-top: 6px; }
.internal-order-editor { display: grid; gap: 16px; }
.internal-order-editor .facts { margin: 0; }
.internal-price-table { min-width: 920px; }
.internal-price-table input { min-width: 130px; width: 100%; }
.internal-total { text-align: right; font-size: 1.1rem; margin: 0; }
.internal-apply { display: flex; align-items: start; gap: 10px; padding: 16px; background: #fff6df; border-radius: 10px; }
.internal-apply input { width: 18px; min-width: 18px; height: 18px; margin-top: 3px; }
.internal-apply small { display: block; margin-top: 6px; }
.line-internal-price { display: block; margin-top: 8px; color: var(--muted); font-size: .85rem; }

.chart { height: 240px; display: flex; align-items: end; gap: 14px; padding-top: 25px; }
.chart-month { flex: 1; min-width: 38px; height: 100%; display: flex; flex-direction: column; justify-content: end; gap: 8px; text-align: center; color: var(--muted); font-size: .75rem; }
.chart-bars { height: 180px; display: flex; align-items: end; justify-content: center; gap: 5px; }
.chart-bar { width: 11px; min-height: 2px; border-radius: 5px 5px 2px 2px; }
.chart-bar.income { background: var(--green); }
.chart-bar.expense { background: var(--red); }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: .8rem; }
.legend-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

.empty {
  padding: 46px 24px;
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-size: 1.05rem; margin-bottom: 5px; }

.modal {
  width: min(760px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 90px rgba(0,0,0,.28);
}
.modal::backdrop { background: rgba(12,15,19,.62); backdrop-filter: blur(3px); }
.modal-card { max-height: calc(100vh - 32px); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 3px 0 0; }
.modal-body { padding: 22px; overflow: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-wide { grid-column: 1 / -1; }
.field label { color: #4f5761; font-size: .83rem; font-weight: 800; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
.field textarea { min-height: 84px; resize: vertical; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; padding-top: 8px; }
.form-note { grid-column: 1 / -1; color: var(--muted); font-size: .83rem; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 540px) 1fr;
  background: var(--sidebar);
}
.auth-panel {
  min-height: 100vh;
  display: grid;
  align-content: center;
  padding: clamp(28px, 7vw, 72px);
  background: #fff;
}
.auth-panel .brand { padding: 0 0 40px; color: var(--ink); }
.auth-panel .brand-copy small { color: var(--muted); }
.auth-panel h1 { margin: 0 0 8px; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; letter-spacing: -.055em; }
.auth-panel > p { color: var(--muted); margin: 0 0 26px; }
.auth-form { display: grid; gap: 16px; max-width: 390px; }
.auth-visual {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 50px;
  color: white;
  background:
    linear-gradient(140deg, transparent 45%, rgba(255,176,0,.09) 45% 55%, transparent 55%),
    radial-gradient(circle at 70% 30%, rgba(255,176,0,.18), transparent 28%),
    #15191f;
}
.auth-visual::before {
  content: "F8";
  font-size: min(34vw, 390px);
  font-weight: 950;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255,255,255,.07);
  letter-spacing: -.1em;
}
.auth-caption { position: absolute; bottom: 48px; left: 50px; max-width: 470px; color: #abb3be; }
.auth-caption strong { display: block; color: #fff; font-size: 1.2rem; margin-bottom: 6px; }
.auth-error { color: var(--red); min-height: 22px; font-size: .88rem; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.callout {
  padding: 16px;
  border-left: 4px solid var(--accent);
  border-radius: 8px 12px 12px 8px;
  background: #fff7df;
  color: #614710;
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: min(390px, calc(100% - 48px));
  padding: 13px 16px;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast.is-error { background: var(--red); }

[hidden] { display: none !important; }
button:disabled { cursor: default; opacity: .5; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #3468d4; outline-offset: 2px;
}
.field > span { color: #4f5761; font-size: .875rem; font-weight: 750; }
.field label { font-size: .875rem; }
.modal-wide { width: min(1320px, calc(100% - 24px)); }
.order-editor { display: grid; gap: 20px; }
.new-vehicle-fields { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 0; }
.new-vehicle-fields legend { padding: 0 8px; color: var(--muted); font-size: .875rem; }
.editor-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 12px; flex-wrap: wrap; }
.editor-tabs button { border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px; background: var(--soft); color: var(--ink); font-weight: 750; font-size: 1rem; }
.editor-tabs button[aria-selected="true"] { background: var(--ink); color: white; border-color: var(--ink); }
.editor-tabs [data-draft-count] { display: inline-block; padding: 0 6px; margin-left: 8px; border-radius: 4px; background: var(--accent); color: var(--ink); }
.editor-lines { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.editor-lines .panel-head { padding: 14px 16px; flex-wrap: wrap; gap: 10px; }
.editor-lines h3 { margin: 0; font-size: 1rem; }
.editor-lines h3 span { font-size: .875rem; margin-left: 8px; }
.draft-table { min-width: 1020px; table-layout: fixed; }
.draft-table th, .draft-table td { padding: 10px 8px; vertical-align: top; }
.draft-table th:first-child { width: 28%; }
.draft-table th:nth-child(2) { width: 21%; }
.draft-table th:nth-child(3) { width: 8%; }
.draft-table th:nth-child(4) { width: 12%; }
.draft-table th:nth-child(5) { width: 10%; }
.draft-table th:last-child { width: 48px; }
.draft-table input, .draft-table select { width: 100%; min-height: 40px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: white; font: inherit; font-size: .875rem; }
.draft-table input[type="number"] { padding-right: 2px; }
.draft-table .line-comment, .draft-table .line-status { margin-top: 7px; font-size: .875rem; background: var(--soft); }
.draft-table .line-comment { border-color: transparent; }
.draft-table [data-line-total] { padding-top: 20px; font-weight: 750; }
.part-draft { min-width: 680px; }
.part-draft th:first-child { width: 46%; }
.part-draft th:nth-child(2) { width: 14%; }
.part-draft th:nth-child(3) { width: 16%; }
.part-draft th:nth-child(4) { width: auto; }
.part-draft th:last-child { width: 48px; }
.editor-footer { position: sticky; bottom: -22px; margin: 0 -22px -22px; padding: 18px 22px; background: #f6f8fb; border-top: 1px solid var(--line); z-index: 2; }
.order-calculation { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 24px; }
.order-calculation > div { min-width: 100px; }
.order-calculation small { display: block; font-size: .875rem; color: var(--muted); }
.order-calculation strong { display: block; font-size: 1.125rem; }
.order-calculation .field { min-width: 135px; max-width: 230px; }
.order-calculation .field input { max-width: 180px; }
.order-calculation .calculation-total { margin-left: auto; }
.calculation-total strong { font-size: 1.5rem; }
.calculation-total [data-missing-prices] { color: #9a4312; max-width: 200px; }
.form-error { color: var(--red); font-size: .875rem; margin: 10px 0 0; }
.form-error:empty { display: none; }
.order-items-panel { margin-top: 18px; }
.order-sum-note { padding: 18px; background: #eaf0fa; border-radius: 10px; margin-top: 16px; line-height: 1.6; }
.catalog-toolbar { display: flex; align-items: end; gap: 16px; margin-bottom: 16px; }
.catalog-search { flex: 1; max-width: 660px; }
.catalog-category-select { display: none; }
.catalog-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.catalog-groups { display: flex; flex-direction: column; max-height: 58vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 8px; gap: 2px; background: #f6f8fb; }
.catalog-group { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; padding: 9px 10px; border: 0; border-radius: 6px; font-size: .875rem; line-height: 1.4; background: transparent; color: var(--ink); text-align: left; }
.catalog-group span { font-size: .75rem; color: var(--muted); }
.catalog-group:hover { background: #e4e9f1; }
.catalog-group.is-active { background: var(--ink); color: white; }
.catalog-group.is-active span { color: #c8d2e2; }
.catalog-subgroup { padding-left: 22px; }
.catalog-main { min-width: 0; }
.catalog-table-wrap { max-height: 52vh; overflow: auto; }
.catalog-table { min-width: 660px; }
.catalog-table thead { position: sticky; top: 0; z-index: 1; }
.catalog-table thead th { background: #f1f4f8; }
.catalog-table th, .catalog-table td { padding: 11px 12px; font-size: .875rem; }
.catalog-table td:first-child { min-width: 250px; }
.catalog-table small { font-size: .8rem; }
.catalog-table .button { white-space: nowrap; }
.catalog-table .price-missing { color: #805113; font-size: .875rem; white-space: nowrap; }
.catalog-footer, .picker-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; font-size: .875rem; background: #f6f8fb; }
.catalog-paging { display: flex; align-items: center; gap: 10px; }
.catalog-browser > .form-note { margin: 12px 0 0; line-height: 1.5; }
.picker-actions { margin-top: 16px; border-radius: 10px; }
@media (max-width: 820px) {
  .catalog-layout { grid-template-columns: minmax(0, 1fr); }
  .catalog-groups { display: none; }
  .catalog-category-select { display: grid; min-width: 0; }
  .catalog-toolbar { display: grid; grid-template-columns: minmax(0, 1fr); }
  .catalog-table-wrap { max-height: 45vh; }
  .editor-tabs button { font-size: .875rem; padding: 10px 12px; }
  .editor-footer { position: static; }
  .order-calculation .calculation-total { margin-left: 0; }
  .order-calculation .field { max-width: 100%; flex: 1; }
  .modal-wide .modal-body { padding: 16px; }
  .modal-wide .editor-footer { margin: 0 -16px -16px; padding: 16px; }
}

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-2, .settings-grid { grid-template-columns: 1fr; }
  .employee-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .order-row { grid-template-columns: 80px 1fr 1fr 110px 24px; }
  .order-row .order-money { display: none; }
}
@media (max-width: 820px) {
  .app-shell { display: block; padding-bottom: 76px; }
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    width: 100%;
    height: 68px;
    padding: 8px;
    background: var(--sidebar);
  }
  .brand, .sidebar-foot { display: none; }
  .nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav-item {
    min-width: 76px;
    min-height: 52px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    padding: 3px 7px;
    font-size: .66rem;
    text-align: center;
  }
  .nav-item.is-active { box-shadow: inset 0 -3px 0 var(--accent); }
  .nav-icon { width: auto; height: auto; border: 0; font-size: 1rem; }
  .topbar { min-height: 82px; padding: 16px 18px; }
  .content { padding: 20px 14px 34px; }
  .top-actions .button-secondary { display: none; }
  .metric-grid { gap: 10px; }
  .metric { min-height: 112px; padding: 16px; }
  .facts { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .employee-grid { grid-template-columns: 1fr; }
  .order-row { grid-template-columns: 76px minmax(0, 1fr) auto; }
  .order-row .order-client, .order-row .order-status { display: none; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-total { text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
  .field-wide, .form-actions, .form-note { grid-column: 1; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .toolbar { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 100px; }
  .facts { grid-template-columns: 1fr; }
  .top-actions .button { min-height: 40px; padding: 0 12px; }
}

.import-panel { grid-column: 1 / -1; }
.import-source { overflow-wrap: anywhere; }
.import-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0 20px; }
.import-totals > div { padding: 16px; background: var(--soft); border-radius: 10px; }
.import-totals small, .import-totals strong { display: block; }
.import-totals small { color: var(--muted); margin-bottom: 6px; }
.import-totals strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.import-details { margin: 18px 0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.import-details summary { cursor: pointer; font-weight: 600; }
.import-details li { margin: 10px 0; }
.import-details .table-wrap { margin-top: 12px; max-height: 340px; overflow: auto; }
.import-conflict { padding: 16px; border: 1px solid #e7ba58; background: #fffbf2; border-radius: 10px; margin: 12px 0; }
.import-compare { display: block; margin: 8px 0; overflow-wrap: anywhere; }
.import-conflict select { display: block; width: 100%; min-height: 44px; margin-top: 12px; }
.excel-import button:disabled { opacity: .55; cursor: wait; }
@media (max-width: 650px) {
  .import-totals { grid-template-columns: 1fr; gap: 8px; }
  .import-totals > div { padding: 12px; }
}

.settings-wide { grid-column: 1 / -1; }
.category-settings { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 28px; }
.category-setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.category-setting select { min-height: 42px; max-width: 190px; }
.expense-breakdown { display: flex; align-items: center; flex-wrap: wrap; gap: 22px 44px; padding: 20px 24px; margin-bottom: 18px; }
.expense-breakdown small, .expense-breakdown strong { display: block; }
.expense-breakdown small { color: var(--muted); font-size: .875rem; }
.expense-breakdown strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; margin-top: 4px; }
.expense-breakdown button { margin-left: auto; }
.service-checklist { border: 1px solid var(--line); padding: 16px; border-radius: 10px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.service-checklist label { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.service-checklist input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; margin: 0; flex-shrink: 0; }
.row-actions { display: flex; gap: 6px; }
.employee-balance { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 12px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--blue); text-decoration: underline; }
.appointment-list { display: grid; gap: 14px; }
.appointment-card { display: grid; grid-template-columns: 110px minmax(0,1fr) auto; gap: 22px; padding: 24px; border-left: 4px solid var(--accent); }
.appointment-card h3, .appointment-card p { margin: 0 0 8px; }
.appointment-time { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.appointment-time .status { display: block; width: fit-content; margin-top: 10px; font-size: .8rem; }
.appointment-actions { display: flex; flex-direction: column; gap: 10px; align-self: start; }
.appointment-cancelled { border-left-color: var(--line); background: var(--soft); }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
[data-item-employee] { min-width: 160px; max-width: 230px; min-height: 38px; }
@media (max-width: 700px) {
  .category-settings, .service-checklist { grid-template-columns: 1fr; }
  .appointment-card { grid-template-columns: 85px minmax(0,1fr); padding: 18px; gap: 14px; }
  .appointment-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .expense-breakdown { padding: 18px; gap: 18px; }
  .expense-breakdown button { margin-left: 0; }
}

@media print {
  .sidebar, .topbar, .no-print, .toast { display: none !important; }
  .app-shell { display: block; }
  .content { padding: 0; }
  .panel, .detail-hero { box-shadow: none; border: 1px solid #aaa; }
  body { background: #fff; }
}
/* Searchable make/model fields and guided Excel import. */
.vehicle-combo { position: relative; }
.combo-input { display: flex; position: relative; }
.combo-input input { padding-right: 40px; width: 100%; }
.combo-input button { position: absolute; right: 1px; top: 1px; bottom: 1px; width: 36px; border: 0; background: transparent; color: #555; cursor: pointer; }
.combo-options { position: absolute; top: 100%; left: 0; right: 0; max-height: 250px; overflow: auto; background: white; border: 1px solid #cbd0d5; border-radius: 8px; box-shadow: 0 8px 22px #0002; z-index: 12; }
.combo-options[hidden] { display: none; }
.combo-options [role=option], .combo-empty { padding: 10px 12px; cursor: pointer; }
.combo-options [role=option]:hover, .combo-options [aria-selected=true] { background: #fff0bf; }
.combo-empty { color: #626a73; font-size: 13px; cursor: default; }
.import-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid #dedfe2; }
.import-section h3 { margin: 0 0 16px; }
.import-section details { margin: 16px 0; }
.import-section summary { cursor: pointer; }
.import-section .form-grid { margin-bottom: 14px; }
.import-counts { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.import-counts span { background: #f2f3f5; border-radius: 6px; padding: 9px 12px; }
.import-preview-table { max-height: 500px; overflow: auto; margin: 16px 0; }
.import-preview-table table { min-width: 900px; }
.import-preview-table th { position: sticky; top: 0; background: #f3f4f5; z-index: 1; }
.import-reason { display: block; font-size: 12px; line-height: 1.4; margin-top: 5px; white-space: normal; min-width: 190px; max-width: 310px; }
.import-row-error td { background: #fff2ef; }
.import-row-duplicate td { background: #fff9e7; }
.import-row-imported td { color: #69717a; background: #f5f6f7; }
.import-pages { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.import-pages span { font-size: 13px; }
.import-source { max-height: 280px; overflow: auto; }
.excel-import input[type=checkbox] { width: 18px; height: 18px; }
.excel-import[aria-busy=true] { cursor: progress; }
/* Reports reuse the application's compact financial tables. */
.report-controls { padding: 20px; margin-bottom: 20px; }
.report-tabs, .report-actions, .report-category-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.report-tabs { margin-bottom: 20px; }
.report-actions { margin-top: 18px; }
.report-categories { border: 1px solid var(--line); border-radius: 9px; padding: 14px; min-width: 0; }
.report-categories legend { padding: 0 5px; font-weight: 600; }
.report-category-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 12px; margin-top: 15px; }
.report-category-list label { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.report-category-list input { width: 18px; height: 18px; flex-shrink: 0; }
.report-result .panel { margin-top: 20px; }
.report-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 18px 0; }
.report-metric { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 18px; }
.report-metric span, .report-metric strong, .report-metric small { display: block; }
.report-metric span { color: var(--muted); font-size: 14px; }
.report-metric strong { font-size: clamp(19px,2.2vw,28px); margin-top: 8px; overflow-wrap: anywhere; }
.report-metric small { font-size: 12px; margin-top: 5px; color: var(--muted); }
.report-metrics-two { grid-template-columns: repeat(2,minmax(0,1fr)); }
.report-heading h2 { margin-bottom: 6px; }.report-heading p { color: var(--muted); }
.report-notice { background: #fff6dd; border-left: 3px solid var(--accent); padding: 12px 15px; font-size: 14px; line-height: 1.5; }
.report-table { font-size: 14px; }.report-table th { white-space: nowrap; }.report-table td { vertical-align: top; }
.delete-confirm p { line-height: 1.6; }.delete-totals { display: grid; gap: 8px; padding: 14px; background: #fff2ef; border-radius: 8px; }
.material-fields { border: 1px solid var(--line); padding: 16px; border-radius: 8px; min-width: 0; }.material-fields[hidden] { display: none; }
.removed-employee { color: var(--muted); font-size: 12px; margin-left: 5px; }
.vehicle-editor-section { border: 1px solid var(--line); border-radius: 10px; min-width: 0; margin: 0; padding: 16px; }
.vehicle-editor-section legend { padding: 0 6px; font-weight: 700; }
@media(max-width:900px) { .report-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:480px) { .report-controls { padding: 14px; }.report-metrics { gap: 8px; }.report-metric { padding: 12px; }.report-category-list { grid-template-columns: 1fr; } }
/* Employee settlements: independent order payments and manually recorded debts. */
.order-settlements { margin-top: 18px; }
.settlement-note { padding: 0 20px; color: var(--muted, #667085); font-size: 13px; }
.settlement-details { padding: 16px 20px; }
.settlement-details summary { cursor: pointer; font-weight: 600; margin-bottom: 12px; }
.manual-debt-card { border-top: 1px solid var(--border, #e4e7ec); padding: 16px 0; margin-top: 16px; }
.manual-debt-card h4 { margin: 0 0 12px; font-size: 15px; }
.manual-debt-card .employee-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.manual-debt-card .employee-stat strong { font-size: 16px; overflow-wrap: anywhere; }
.manual-debt-card .row-actions { flex-wrap: wrap; margin-top: 12px; }
.archived-debts { margin-top: 24px; }
.archived-debts > .employee-grid { padding: 20px; }
.settlement-confirm { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; line-height: 1.5; }
.settlement-confirm input { width: auto; margin-top: 5px; }
#settlement-payment-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
#settlement-payment-form fieldset[hidden] { display: none; }
.order-settlements small { display: block; }
@media (max-width: 600px) { .manual-debt-card .employee-stats { grid-template-columns: 1fr; } }
