/* CarPoint CRM — design tokens and components.
   One bold element: the EU number plate. Everything else stays quiet. */

:root {
  --bg: #EDF0F4;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --line: #DEE3EA;
  --line-2: #EBEEF3;
  --ink: #0F2341;
  --ink-2: #4A5A72;
  --ink-3: #8492A6;
  --blue: #1667E0;
  --blue-600: #0F55C2;
  --blue-soft: #E6EEFC;
  --eu: #003399;
  --star: #FFCC00;
  --green: #12805A;
  --green-soft: #E1F3EB;
  --red: #C53A3A;
  --red-soft: #FBEAEA;
  --amber: #9A6210;
  --amber-soft: #FCF1DA;

  --r-xl: 18px;
  --r-lg: 12px;
  --r: 8px;
  --r-sm: 5px;

  --pop: 0 18px 40px -12px rgba(15, 35, 65, .28), 0 2px 6px rgba(15, 35, 65, .06);
  --lift: 0 6px 16px -8px rgba(15, 35, 65, .25);

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --plate-font: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;

  --t-xs: 12px;
  --t-sm: 13px;
  --t-base: 14px;
  --t-md: 16px;
  --t-lg: 20px;
  --t-xl: 28px;

  --fast: 140ms;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px; color: var(--ink); }
.brand-mark {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue); color: #fff;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 16px; }
.brand-text small { color: var(--ink-3); font-size: var(--t-xs); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r);
  color: var(--ink-2); font-weight: 500;
  transition: background var(--fast), color var(--fast);
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-600); }
.nav .count {
  margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 10px;
  font-size: var(--t-xs); font-weight: 600; text-align: center; line-height: 20px;
  background: var(--line-2); color: var(--ink-2);
}
.nav .count.hot { background: var(--star); color: var(--ink); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 0 6px; }
.me { display: flex; align-items: center; gap: 10px; }
.me small { display: block; color: var(--ink-3); font-size: var(--t-xs); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 28px;
  background: rgba(237, 240, 244, .88);
  backdrop-filter: blur(10px);
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search { position: relative; flex: 1; max-width: 420px; }
.search input {
  width: 100%; height: 40px; padding: 0 14px 0 40px;
  border: 1px solid var(--line); border-radius: 20px;
  background: var(--surface);
}
.search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.search-ico { position: absolute; left: 13px; top: 11px; color: var(--ink-3); }
.search-results {
  position: absolute; left: 0; right: 0; top: 46px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--pop); padding: 6px; max-height: 360px; overflow: auto;
}
.search-results button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: var(--r);
  text-align: left; cursor: pointer;
}
.search-results button:hover, .search-results button:focus-visible { background: var(--surface-2); }
.search-results .grp { padding: 6px 10px 2px; font-size: var(--t-xs); color: var(--ink-3); }
.search-results .grow { flex: 1; min-width: 0; }
.search-results small { display: block; color: var(--ink-3); font-size: var(--t-xs); }

.bell {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line);
}
.bell:hover { color: var(--ink); }
.bell .badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--star); color: var(--ink);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.view { padding: 8px 28px 48px; outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 10px 0 20px; }
.page-head h1 { font-size: var(--t-xl); line-height: 1.1; font-weight: 700; letter-spacing: -.02em; }
.page-head p { color: var(--ink-2); margin-top: 6px; }
.page-head .spacer { flex: 1; }

/* ---------- Buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 20px;
  border: 1px solid transparent; cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), transform var(--fast);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #C5CDD8; }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 10px; }
.btn-quiet:hover { background: var(--line-2); color: var(--ink); }
.btn-danger { background: transparent; color: var(--red); padding: 0 10px; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--t-sm); }
.btn-icon { width: 36px; padding: 0; }
.btn-wa { background: #1FA855; color: #fff; }
.btn-wa:hover { background: #178C46; }
.btn-tg { background: #229ED9; color: #fff; }
.btn-tg:hover { background: #1A86BA; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: var(--t-xs); color: var(--ink-2); font-weight: 500; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.textarea { height: auto; min-height: 72px; padding: 9px 11px; resize: vertical; }
.select { padding-right: 30px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238492A6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.err { color: var(--red); font-size: var(--t-xs); min-height: 16px; }

.seg { display: inline-flex; padding: 3px; border-radius: 20px; background: var(--line-2); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 16px;
  font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.seg button svg.i { width: 15px; height: 15px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 35, 65, .12); }

.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input { appearance: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line); position: relative; cursor: pointer; transition: background var(--fast); flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform var(--fast) var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked { background: var(--blue); }
.toggle input:checked::after { transform: translateX(16px); }

/* ---------- Surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 20px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { font-size: var(--t-md); font-weight: 600; }
.panel-head .link { margin-left: auto; font-size: var(--t-sm); font-weight: 500; }
.empty { padding: 26px 10px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- Small atoms ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px; border-radius: 12px;
  font-size: var(--t-xs); font-weight: 500; white-space: nowrap;
  background: var(--line-2); color: var(--ink-2);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--green-soft); color: var(--green); }
.chip.warn { background: var(--amber-soft); color: var(--amber); }
.chip.bad { background: var(--red-soft); color: var(--red); }
.chip.info { background: var(--blue-soft); color: var(--blue-600); }
.chip.solid { background: rgba(255,255,255,.92); color: var(--ink); box-shadow: 0 1px 2px rgba(15,35,65,.12); }
.src { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-xs); color: var(--ink-2); white-space: nowrap; }
.src i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.avatar.lg { width: 34px; height: 34px; font-size: 13px; }

/* EU number plate — the signature element */
.plate {
  display: inline-flex; align-items: stretch; height: 24px;
  border: 1.5px solid var(--ink); border-radius: 4px; overflow: hidden;
  background: #fff; flex: none;
  box-shadow: 0 1px 0 rgba(15, 35, 65, .12);
}
.plate i {
  width: 14px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 1px; background: var(--eu); color: #fff;
  font-style: normal; font-family: var(--plate-font); font-size: 10px; font-weight: 600; line-height: 1;
  position: relative;
}
.plate i::before {
  content: ""; position: absolute; top: 3px; left: 50%; width: 7px; height: 7px; margin-left: -3.5px;
  border-radius: 50%; border: 1.4px dotted var(--star);
}
.plate b {
  padding: 0 7px; display: flex; align-items: center;
  font-family: var(--plate-font); font-weight: 600; font-size: 16px; letter-spacing: .06em; line-height: 1;
  color: var(--ink); white-space: nowrap;
}
.plate.de b { letter-spacing: .04em; }
.plate.none { border-style: dashed; border-color: var(--ink-3); }
.plate.none b { color: var(--ink-3); font-size: 13px; letter-spacing: .02em; }
.plate.lg { height: 34px; border-width: 2px; }
.plate.lg i { width: 20px; font-size: 13px; }
.plate.lg i::before { width: 10px; height: 10px; margin-left: -5px; top: 4px; }
.plate.lg b { font-size: 23px; padding: 0 10px; }

/* ---------- Dashboard ---------- */
.kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  margin-bottom: 20px; overflow: hidden;
}
.kpi { padding: 18px 20px; border-left: 1px solid var(--line-2); }
.kpi:first-child { border-left: 0; }
.kpi p { color: var(--ink-2); font-size: var(--t-sm); }
.kpi strong { display: block; font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; }
.kpi small { font-size: var(--t-xs); color: var(--ink-3); }
.kpi small.up { color: var(--green); }
.kpi small.down { color: var(--red); }

.dash { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.dash .col { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.funnel { display: flex; flex-direction: column; gap: 6px; }
.funnel-row { display: grid; grid-template-columns: 170px 1fr 80px; align-items: center; gap: 12px; cursor: pointer; border-radius: var(--r); padding: 3px 4px; border: 0; background: none; text-align: left; width: 100%; }
.funnel-row:hover { background: var(--surface-2); }
.funnel-row .lbl { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; }
.funnel-row .lbl i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bar { height: 24px; border-radius: 6px; background: var(--line-2); position: relative; overflow: hidden; }
.bar span { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 6px; transform-origin: left; animation: grow .7s var(--ease) both; }
.bar em { position: absolute; left: 9px; top: 0; line-height: 24px; font-style: normal; font-size: var(--t-xs); font-weight: 700; color: var(--ink); }
.funnel-row .val { text-align: right; font-size: var(--t-sm); color: var(--ink-2); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.svc-mini { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.svc-mini button {
  text-align: left; border: 1px solid var(--line-2); background: var(--surface-2);
  border-radius: var(--r-lg); padding: 12px; cursor: pointer;
  transition: border-color var(--fast);
}
.svc-mini button:hover { border-color: var(--blue); }
.svc-mini b { display: block; font-size: 22px; letter-spacing: -.02em; }
.svc-mini span { font-size: var(--t-xs); color: var(--ink-2); }

.src-bars { display: flex; flex-direction: column; gap: 10px; }
.src-bar { display: grid; grid-template-columns: 110px 1fr 36px; gap: 10px; align-items: center; font-size: var(--t-sm); }
.src-bar .track { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.src-bar .track span { display: block; height: 100%; border-radius: 4px; }
.src-bar .v { text-align: right; color: var(--ink-2); }

.rows { display: flex; flex-direction: column; }
.row-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 6px;
  border: 0; border-top: 1px solid var(--line-2); cursor: pointer;
  background: none; text-align: left; width: 100%;
}
.row-item:first-child { border-top: 0; }
.row-item:hover { background: var(--surface-2); }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .s { font-size: var(--t-xs); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-line { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line-2); }
.task-line:first-child { border-top: 0; }
.task-line .grow { flex: 1; min-width: 0; }
.task-line .t { font-weight: 500; }
.task-line .s { font-size: var(--t-xs); color: var(--ink-3); background: none; border: 0; padding: 0; cursor: pointer; }
.task-line .s:hover { color: var(--blue); }
.due { font-size: var(--t-xs); white-space: nowrap; color: var(--ink-2); }
.due.over { color: var(--red); font-weight: 600; }
.due.soon { color: var(--amber); font-weight: 600; }

.check {
  width: 20px; height: 20px; border-radius: 6px; border: 1.6px solid #B8C2CF; background: #fff; flex: none;
  display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff;
  transition: background var(--fast), border-color var(--fast);
}
.check:hover { border-color: var(--green); }
.check[aria-checked="true"] { background: var(--green); border-color: var(--green); }
.check svg.i { width: 13px; height: 13px; stroke-width: 3; }

.rent-today { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.rent-today b { font-size: 26px; letter-spacing: -.02em; }
.occ { display: flex; gap: 3px; margin-bottom: 8px; }
.occ span { flex: 1; height: 26px; border-radius: 4px; background: var(--line-2); }
.occ span.on { background: var(--blue); }

/* ---------- Leads ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .select { width: auto; min-width: 150px; height: 36px; border-radius: 18px; }
.toolbar .input { width: 220px; height: 36px; border-radius: 18px; }

.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(262px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: #E4E8EE; border-radius: var(--r-xl); padding: 10px; min-height: 240px; transition: background var(--fast), box-shadow var(--fast); }
.kcol.over { background: var(--blue-soft); box-shadow: inset 0 0 0 2px var(--blue); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; }
.kcol-head i { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head b { font-size: var(--t-sm); }
.kcol-head .n { font-size: var(--t-xs); color: var(--ink-2); background: rgba(255,255,255,.75); padding: 0 7px; border-radius: 9px; line-height: 18px; }
.kcol-head .sum { margin-left: auto; font-size: var(--t-xs); color: var(--ink-2); }
.kcol-body { display: flex; flex-direction: column; gap: 8px; }
.lcard {
  background: var(--surface); border-radius: var(--r-lg); padding: 12px;
  border: 1px solid transparent; cursor: grab; text-align: left; width: 100%;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.lcard:hover { border-color: #C9D2DE; box-shadow: var(--lift); }
.lcard.dragging { opacity: .45; transform: rotate(1.5deg); }
.lcard .name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.lcard .name .new-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.lcard .what { font-size: var(--t-sm); color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard .meta { display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--ink-3); }
.lcard .meta .money { margin-left: auto; color: var(--ink); font-weight: 600; }
.lcard .task { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); padding: 5px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.lcard .task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcard .task.over { background: var(--red-soft); color: var(--red); }
.lcard .task.soon { background: var(--amber-soft); color: var(--amber); }
.lcard .task svg.i { width: 13px; height: 13px; }
.kcol.lost { background: #ECEEF1; }
.kcol.lost .lcard { opacity: .8; }
.kcol .more { width: 100%; border: 0; background: rgba(255,255,255,.6); border-radius: var(--r); padding: 7px; font-size: var(--t-xs); color: var(--ink-2); cursor: pointer; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 900px; }
.table th { text-align: left; font-weight: 500; font-size: var(--t-xs); color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); font-size: var(--t-sm); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .who b { display: block; font-weight: 600; font-size: var(--t-base); }
.table .who small { color: var(--ink-3); }

/* ---------- Drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 35, 65, .32); z-index: 50; animation: fade .18s ease both; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51;
  width: min(580px, 100vw); background: var(--bg);
  display: flex; flex-direction: column;
  box-shadow: var(--pop);
  animation: slide .26s var(--ease) both;
}
@keyframes slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { background: var(--surface); padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .row1 { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head h2 { font-size: 22px; letter-spacing: -.01em; }
.drawer-head .sub { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--ink-2); font-size: var(--t-sm); }
.drawer-head .close { margin-left: auto; }
.quick { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 22px 30px; display: flex; flex-direction: column; gap: 14px; }
.sect { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.sect h3 { font-size: var(--t-sm); font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.sect h3 .muted { font-weight: 400; margin-left: auto; }
.linked-car { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line-2); border-radius: var(--r); margin-top: 10px; }
.linked-car svg { width: 90px; height: auto; flex: none; }
.linked-car .grow { flex: 1; min-width: 0; }

.stages { display: flex; gap: 4px; }
.stages button {
  flex: 1; min-width: 0; border: 0; cursor: pointer; padding: 4px 0;
  display: flex; flex-direction: column; gap: 6px; background: none; text-align: left;
}
.stages button span { height: 6px; border-radius: 3px; background: var(--line); transition: background var(--fast); }
.stages button small { font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stages button.done span { background: var(--blue); }
.stages button.cur small { color: var(--ink); font-weight: 600; }
.stages button:hover span { background: #9DBDF2; }
.stages.won button span { background: var(--green); }
.stages.lost button span { background: #C9D0DA; }
.stage-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: var(--t-sm); }
.steps li button.stepn {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff;
  font-size: 11px; font-weight: 600; color: var(--ink-3); cursor: pointer; flex: none; padding: 0;
  display: grid; place-items: center;
}
.steps li.done button.stepn { background: var(--green); border-color: var(--green); color: #fff; }
.steps li.cur button.stepn { border-color: var(--blue); color: var(--blue); }
.steps li.done .lbl { color: var(--ink-3); text-decoration: line-through; text-decoration-color: #C5CDD8; }
.steps li.cur .lbl { font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: var(--t-sm); }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); box-shadow: 0 0 0 3px var(--surface); }
.timeline li::after { content: ""; position: absolute; left: 8.5px; top: 16px; bottom: 0; width: 1px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline li.note::before { background: var(--blue); }
.timeline li.stage::before { background: var(--green); }
.timeline li.task::before { background: var(--star); }
.timeline .when { color: var(--ink-3); font-size: var(--t-xs); }

.quick-due { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.quick-due button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 14px; padding: 4px 10px; font-size: var(--t-xs); cursor: pointer; }
.quick-due button[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-600); }
.add-row { display: flex; gap: 8px; align-items: center; }
.add-row .input { flex: 1; }

.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal-wrap .scrim { z-index: 0; position: fixed; }
.modal {
  position: relative; z-index: 1; width: min(620px, 100%);
  background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--pop);
  animation: pop .22s var(--ease) both;
}
.modal.wide { width: min(880px, 100%); }
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 18px; }
.modal-head .btn { margin-left: auto; }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 22px 18px; }
.modal-foot .left { margin-right: auto; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: #fff; padding: 12px 14px 12px 16px; border-radius: var(--r-lg);
  box-shadow: var(--pop); max-width: 400px; font-size: var(--t-sm);
  animation: pop .22s var(--ease) both;
}
.toast .btn { height: 30px; font-size: var(--t-xs); background: rgba(255,255,255,.14); color: #fff; }
.toast .btn:hover { background: rgba(255,255,255,.24); }
.toast.warn { background: #2A2410; box-shadow: inset 4px 0 0 var(--star), var(--pop); }
.toast.err { background: #3A1616; }

/* Telegram-style preview of the bot message */
.tg-toast {
  pointer-events: auto; width: 340px; border-radius: 14px; overflow: hidden;
  background: #17212B; color: #F5F5F5; box-shadow: var(--pop);
  animation: pop .26s var(--ease) both; font-size: var(--t-sm);
}
.tg-toast header { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #232E3C; }
.tg-toast header .av { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.tg-toast header b { display: block; font-size: var(--t-sm); }
.tg-toast header small { color: #7F91A4; font-size: 11px; }
.tg-toast .msg { margin: 10px 12px 12px; padding: 9px 11px; background: #182533; border-radius: 10px 10px 10px 4px; border: 1px solid #2B5278; line-height: 1.5; }
.tg-toast .msg .k { color: #7F91A4; }
.tg-toast .msg .time { text-align: right; color: #6D8096; font-size: 11px; margin-top: 4px; }
.tg-toast footer { display: flex; border-top: 1px solid #22303F; }
.tg-toast footer button { flex: 1; border: 0; background: none; color: #6AB2F2; padding: 9px; cursor: pointer; font-size: var(--t-sm); }
.tg-toast footer button:hover { background: #1E2B38; }

/* ---------- Catalog ---------- */
.cat-layout { display: grid; grid-template-columns: 250px 1fr; gap: 20px; align-items: start; }
.filters { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 14px; }
.filters .range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filters .reset { align-self: flex-start; }
.cat-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cat-top .found { color: var(--ink-2); font-size: var(--t-sm); }
.cat-top .select { width: auto; height: 36px; border-radius: 18px; margin-left: auto; }
.cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.car {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; text-align: left; padding: 0; display: flex; flex-direction: column;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.car:hover { border-color: #C3CDDA; box-shadow: var(--lift); transform: translateY(-2px); }
.car.sold { opacity: .62; }
.car-img { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(180deg, #F3F5F8 0%, #E5E9EF 100%); display: grid; place-items: center; overflow: hidden; }
.car-img svg { width: 90%; height: auto; }
.car-img .tags { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.car-img .plate { position: absolute; right: 8px; bottom: 8px; }
.car-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.car-body h3 { font-size: var(--t-md); font-weight: 600; }
.car-body .spec { font-size: var(--t-xs); color: var(--ink-2); }
.car-body .price { margin-top: auto; padding-top: 8px; font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.car-body .price small { font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); }

.car-detail { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.car-detail .car-img { border-radius: var(--r-lg); }
.car-detail h3 { font-size: 22px; letter-spacing: -.01em; }
.car-detail .price { font-size: 26px; font-weight: 700; margin-top: 4px; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 14px 0; }
.specs div small { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.specs div b { font-weight: 600; }
.car-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- Rental timeline ---------- */
.rent-grid { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow-x: auto; }
.rg-inner { min-width: 1120px; }
.rg-row { display: grid; grid-template-columns: 220px repeat(21, minmax(0, 1fr)); border-top: 1px solid var(--line-2); min-height: 52px; }
.rg-row:first-child { border-top: 0; }
.rg-car { grid-row: 1; grid-column: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 8px 14px; border-right: 1px solid var(--line); position: sticky; left: 0; background: var(--surface); z-index: 3; }
.rg-car b { font-size: var(--t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rg-car small { color: var(--ink-3); font-size: var(--t-xs); display: flex; gap: 8px; align-items: center; }
.rg-car .plate { height: 19px; }
.rg-car .plate b { font-size: 13px; padding: 0 5px; }
.rg-car .plate i { width: 11px; font-size: 8px; }
.rg-car .plate i::before { width: 5px; height: 5px; margin-left: -2.5px; top: 2px; }
.rg-day { grid-row: 1; text-align: center; font-size: 11px; color: var(--ink-3); padding: 8px 0; border-left: 1px solid var(--line-2); }
.rg-day b { display: block; font-size: var(--t-sm); color: var(--ink); }
.rg-day.we { background: #F8F9FB; }
.rg-day.today { background: var(--blue-soft); }
.rg-day.today b { color: var(--blue-600); }
.rg-cell { grid-row: 1; border: 0; border-left: 1px solid var(--line-2); background: none; cursor: copy; padding: 0; }
.rg-cell.we { background: #FAFBFC; }
.rg-cell.today { background: rgba(22, 103, 224, .06); }
.rg-cell:hover { background: var(--blue-soft); }
.rg-book {
  grid-row: 1; align-self: center; height: 32px; margin: 0 3px; z-index: 2; position: relative;
  border-radius: 7px; background: var(--blue); color: #fff; border: 0;
  font-size: var(--t-xs); font-weight: 500; padding: 0 9px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
}
.rg-book.past { background: #A9B8CC; }
.rg-book.now { background: var(--ink); }
.rg-book:hover { filter: brightness(1.1); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: var(--t-xs); color: var(--ink-2); margin: 12px 2px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Services ---------- */
.svc-list { display: flex; flex-direction: column; gap: 14px; }
.svc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 24px; align-items: center; }
.svc h2 { font-size: var(--t-lg); letter-spacing: -.01em; }
.svc p { color: var(--ink-2); margin-top: 4px; font-size: var(--t-sm); max-width: 46ch; }
.svc-stats { display: flex; gap: 22px; margin-top: 14px; }
.svc-stats div small { display: block; font-size: var(--t-xs); color: var(--ink-3); }
.svc-stats div b { font-size: 18px; }
.flow { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: s; }
.flow li { counter-increment: s; display: flex; align-items: center; gap: 7px; font-size: var(--t-xs); background: var(--surface-2); border: 1px solid var(--line-2); padding: 5px 10px 5px 5px; border-radius: 14px; }
.flow li::before { content: counter(s); width: 18px; height: 18px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.flow li .n { margin-left: 2px; color: var(--blue-600); font-weight: 600; }

/* ---------- Tasks ---------- */
.task-groups { display: flex; flex-direction: column; gap: 16px; max-width: 940px; }
.task-groups h2 { font-size: var(--t-md); display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.settings .panel p.help { color: var(--ink-2); font-size: var(--t-sm); margin-bottom: 14px; max-width: 62ch; }
.settings .stack { display: flex; flex-direction: column; gap: 12px; }
.settings .row-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.mgr-row { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px; align-items: center; }
code.inline { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: var(--t-xs); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
  .svc { grid-template-columns: 1fr; gap: 14px; }
  .settings { grid-template-columns: 1fr; }
  .svc-mini { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40;
    flex-direction: row; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--line);
  }
  .brand, .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; overflow-x: auto; gap: 0; justify-content: space-between; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .funnel-row .lbl span { overflow: hidden; text-overflow: ellipsis; }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 8px; font-size: 11px; min-width: 62px; }
  .nav .count { display: none; }
  .view { padding: 4px 16px 96px; }
  .top { padding: 10px 16px; gap: 10px; }
  .hide-sm { display: none; }
  .top .btn { width: 40px; padding: 0; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi:nth-child(3) { border-left: 0; }
  .kpi:nth-child(n+3) { border-top: 1px solid var(--line-2); }
  .cat-layout { grid-template-columns: 1fr; }
  .filters { position: static; display: grid; grid-template-columns: 1fr 1fr; }
  .car-detail { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 120px 1fr 64px; }
  .svc-mini { grid-template-columns: repeat(2, 1fr); }
  .toolbar .input { width: 100%; }
  .toasts { left: 12px; right: 12px; bottom: 76px; align-items: stretch; }
  .tg-toast { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
