/* =========================================================================
   Nudi.mk — Design System
   No frameworks, no build step. Pure CSS custom properties.
   Rebrand: change --brand-* tokens below and the BRAND object in app.js
   ========================================================================= */

/* ---------- 1. Tokens ---------- */
:root {
  /* brand */
  --brand:        #6C4CF1;
  --brand-600:    #5B3CE8;
  --brand-700:    #4C2FD4;
  --brand-soft:   #EEEAFE;
  --brand-softer: #F6F3FF;
  --brand-grad:   linear-gradient(135deg, #7C5CFF 0%, #5B3CE8 100%);

  /* surfaces */
  --bg:           #F5F6FA;
  --surface:      #FFFFFF;
  --surface-2:    #FAFAFD;
  --surface-3:    #F2F3F8;
  --border:       #E8E9F1;
  --border-soft:  #F0F1F6;

  /* text */
  --text:         #14142B;
  --text-2:       #45455E;
  --muted:        #71718C;
  --muted-2:      #9A9AB2;

  /* status */
  --green:        #16A34A;
  --green-soft:   #E7F7EE;
  --red:          #E5484D;
  --red-soft:     #FDECEC;
  --amber:        #E8940C;
  --amber-soft:   #FDF3E2;
  --blue:         #2563EB;
  --blue-soft:    #E8F0FE;

  /* shape */
  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-full: 999px;

  /* elevation */
  --sh-sm: 0 1px 2px rgba(20,20,43,.06);
  --sh:    0 2px 8px rgba(20,20,43,.06), 0 1px 2px rgba(20,20,43,.04);
  --sh-md: 0 8px 24px rgba(20,20,43,.08);
  --sh-lg: 0 16px 48px rgba(20,20,43,.12);
  --ring:  0 0 0 3px rgba(108,76,241,.18);

  /* layout */
  --header-h: 66px;
  --wrap: 1240px;
  --gap: 20px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition: 160ms cubic-bezier(.4,0,.2,1);
}

[data-theme="dark"] {
  --bg:           #0E0E17;
  --surface:      #171724;
  --surface-2:    #1C1C2B;
  --surface-3:    #232335;
  --border:       #292940;
  --border-soft:  #222234;

  --text:         #F2F2F7;
  --text-2:       #C9C9D8;
  --muted:        #9494AE;
  --muted-2:      #6E6E8C;

  --brand-soft:   #241E45;
  --brand-softer: #1D1935;

  --green-soft:   #10281B;
  --red-soft:     #2C1618;
  --amber-soft:   #2B2010;
  --blue-soft:    #131F3C;

  --sh-sm: 0 1px 2px rgba(0,0,0,.4);
  --sh:    0 2px 8px rgba(0,0,0,.35);
  --sh-md: 0 8px 24px rgba(0,0,0,.45);
  --sh-lg: 0 16px 48px rgba(0,0,0,.55);
}

/* ---------- 2. Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
/* the header is sticky, so anything jumped to via #anchor must stop below it —
   otherwise the target lands at y=0 and is hidden behind the header */
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
img, svg, video { display: block; max-width: 100%; }
/* Safety net: any inline icon without an explicit size renders at 16px
   instead of stretching to fill its container. Zero specificity via :where(),
   so every rule below still wins. Charts set width="…" and are excluded. */
:where(svg:not([width])) { width: 16px; height: 16px; flex-shrink: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--brand); color: #fff; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

/* ---------- 3. Typography ---------- */
h1,h2,h3,h4 { line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 30px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
.h-xl { font-size: 42px; line-height: 1.12; letter-spacing: -.03em; font-weight: 800; }
.lead { color: var(--muted); font-size: 14px; }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.mono-num { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 4. Layout ---------- */
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; width: 100%; }
.page { padding: 26px 0 64px; }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap-row { display: flex; flex-wrap: wrap; align-items: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { display: flex; align-items: center; justify-content: center; }
.g4{gap:4px}.g6{gap:6px}.g8{gap:8px}.g10{gap:10px}.g12{gap:12px}.g16{gap:16px}.g20{gap:20px}.g24{gap:24px}
.mt4{margin-top:4px}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}
.mt20{margin-top:20px}.mt24{margin-top:24px}.mt32{margin-top:32px}.mt40{margin-top:40px}
.mb4{margin-bottom:4px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}
.mb20{margin-bottom:20px}.mb24{margin-bottom:24px}.mb32{margin-bottom:32px}
.hide { display: none !important; }
.full { width: 100%; }

/* app shell: sidebar + content
   min-width:0 on the children is load-bearing: grid items default to
   min-width:auto, so a wide child (the horizontal side-nav on small screens)
   would stretch its column and drag the whole page into horizontal scroll
   instead of scrolling inside its own container. */
.shell { display: grid; grid-template-columns: 250px minmax(0,1fr); gap: 24px; align-items: start; }
.shell > * { min-width: 0; }
.shell-wide { grid-template-columns: 272px minmax(0,1fr); }

/* ---------- 5. Header ---------- */
.header {
  position: sticky; top: 0; z-index: 90;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex; align-items: center;
}
.header-inner { display: flex; align-items: center; gap: 18px; width: 100%; }

.logo { display: inline-flex; align-items: baseline; gap: 1px; font-size: 21px; font-weight: 800; letter-spacing: -.03em; flex-shrink: 0; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand-grad);
  display: grid; place-items: center; margin-right: 8px; align-self: center;
  box-shadow: 0 3px 10px rgba(108,76,241,.35);
}
.logo-mark svg { width: 16px; height: 16px; }
.logo-name { color: var(--text); }
.logo-accent { color: var(--brand); }
.logo-tld { font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.nav a {
  padding: 8px 14px; border-radius: var(--r-sm); font-weight: 500; color: var(--text-2);
  transition: var(--transition); white-space: nowrap;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
/* active tab gets the same underline treatment as .tabs, so every tabbed
   surface in the app animates and reads the same way */
.nav a { position: relative; }
.nav a.active { color: var(--brand); font-weight: 600; background: transparent; }
.nav a.active::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: -13px;
  height: 2px; background: var(--brand); border-radius: 2px 2px 0 0;
}
.nav a.active:hover { background: var(--surface-3); }

.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--text-2); transition: var(--transition);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .count {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand); color: #fff; border-radius: var(--r-full);
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--surface);
}
.icon-btn.with-label { width: auto; padding: 0 10px; gap: 6px; font-size: 13px; font-weight: 500; }

.avatar {
  border-radius: 50%; background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
  width: 32px; height: 32px; font-size: 12px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 46px; height: 46px; font-size: 16px; }
.avatar-xl { width: 84px; height: 84px; font-size: 30px; }
.avatar-sm { width: 26px; height: 26px; font-size: 10px; }

.profile-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: var(--r-full); transition: var(--transition); font-weight: 500;
}
.profile-chip:hover { background: var(--surface-3); }

/* dropdown */
.dd { position: relative; }
.dd-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--sh-lg); padding: 6px; z-index: 200;
  opacity: 0; visibility: hidden; transform: translateY(-6px); transition: var(--transition);
}
.dd.open .dd-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dd-menu a, .dd-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: 13.5px;
  transition: var(--transition);
}
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-3); color: var(--text); }
.dd-menu a svg, .dd-menu button svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.dd-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dd-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dd-menu .danger { color: var(--red); }
.dd-menu .danger svg { color: var(--red); }
.dd-menu .checked { color: var(--brand); font-weight: 600; }

.burger { display: none; }

/* ---- header progressive collapse -------------------------------------
   The full header needs ~1180px. Rather than letting it overflow and clip
   (which pushed the CTA and language switcher off-screen between 980 and
   1180px), drop the least essential pieces as space runs out. Everything
   removed here is still reachable from the profile dropdown. */
.dd-lang-only { display: none; }                       /* shown only once .header-lang is hidden */
.header-inner > * { min-width: 0; }
.nav { flex-shrink: 1; overflow: hidden; }

@media (max-width: 1279px) { .profile-chip .chip-label { display: none; } }
@media (max-width: 1179px) {
  .header-msg, .header-lang { display: none; }
  .dd-lang-only { display: flex; }
}
@media (max-width: 1079px) { .header-cta .cta-full { display: none; } }

/* ---------- 6. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: var(--transition); border: 1px solid transparent; cursor: pointer;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }

.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(108,76,241,.28); }
.btn-primary:hover { background: var(--brand-600); box-shadow: 0 4px 14px rgba(108,76,241,.36); }
.btn-grad { background: var(--brand-grad); color: #fff; box-shadow: 0 3px 12px rgba(108,76,241,.32); }
.btn-grad:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); border-color: var(--muted-2); }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-soft { background: var(--brand-soft); color: var(--brand); }
.btn-soft:hover { background: #E3DDFC; }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-subtle { background: var(--surface-3); color: var(--text-2); }
.btn-subtle:hover { background: var(--border); }
.btn-sm { height: 33px; padding: 0 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 15px; border-radius: var(--r); }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }

.link { color: var(--brand); font-weight: 600; transition: var(--transition); }
.link:hover { color: var(--brand-700); text-decoration: underline; }

/* ---------- 7. Cards & panels ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: 20px; }
.card-head {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;          /* title + controls must be able to stack on narrow screens */
}
.card-head > * { min-width: 0; }

/* Two-column splits. Use these instead of an inline grid-template-columns:
   an inline style cannot be overridden by a media query, so inline column
   definitions silently break the mobile layout. */
.split { display: grid; gap: 20px; align-items: start; grid-template-columns: 1.35fr 1fr; }
.split-even { grid-template-columns: 1fr 1fr; }
.split-rev  { grid-template-columns: 1fr 1.15fr; }
.split > * { min-width: 0; }
@media (max-width: 980px) {
  .split, .split-even, .split-rev { grid-template-columns: minmax(0,1fr); }
}
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }

.section-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }

/* ---------- 8. Badges & pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; white-space: nowrap;
}
.badge-green { background: var(--green); color: #fff; }
.badge-brand { background: var(--brand); color: #fff; }
.badge-amber { background: var(--amber); color: #fff; }
.badge-red   { background: var(--red); color: #fff; }
.badge-grey  { background: var(--surface-3); color: var(--muted); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-red   { background: var(--red-soft); color: var(--red); }
.chip-blue  { background: var(--blue-soft); color: var(--blue); }
.chip-brand { background: var(--brand-soft); color: var(--brand); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: var(--r-full); font-size: 12px; font-weight: 600;
}
.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 13px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--border);
  font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: var(--transition);
}
.pill:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pill-x { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px;
  border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand); font-size: 12.5px; font-weight: 600; }
.pill-x button { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--brand); }
.pill-x button:hover { background: rgba(108,76,241,.2); }
.pill-x svg { width: 12px; height: 12px; }

/* ---------- 9. Forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 0 13px; height: 42px; font-size: 13.5px;
  color: var(--text); transition: var(--transition);
}
.textarea { height: auto; padding: 11px 13px; resize: vertical; min-height: 96px; line-height: 1.6; }
/* form controls carry an intrinsic minimum size; without this they refuse to
   shrink inside a flex row and push the page into horizontal scroll */
.input, .select, .textarea, .input-icon { min-width: 0; }
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.err, .select.err, .textarea.err { border-color: var(--red); }
.err-msg { font-size: 11.5px; color: var(--red); font-weight: 500; }
.select {
  appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371718C' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239494AE' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted-2); pointer-events: none; }
.input-icon .input, .input-icon .select { padding-left: 40px; }
.input-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px;
  border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.input-clear:hover { background: var(--surface-3); color: var(--text); }
.input-clear svg { position: static; transform: none; width: 13px; height: 13px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 16px; }

/* checkbox / radio */
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.check input { appearance: none; width: 17px; height: 17px; border: 1.6px solid var(--border);
  border-radius: 5px; background: var(--surface); transition: var(--transition); flex-shrink: 0; cursor: pointer; position: relative; }
.check input:hover { border-color: var(--brand); }
.check input:checked { background: var(--brand); border-color: var(--brand); }
.check input:checked::after {
  content: ''; position: absolute; left: 5px; top: 1.5px; width: 4px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(43deg);
}
.check input[type=radio] { border-radius: 50%; }
.check input[type=radio]:checked::after { left: 4px; top: 4px; width: 5px; height: 5px; border: 0; background: #fff; border-radius: 50%; transform: none; }
.check.count { justify-content: space-between; width: 100%; }
.check .n { color: var(--muted-2); font-size: 12px; }

/* switch */
.switch { position: relative; width: 40px; height: 22px; flex-shrink: 0; }
.switch input { appearance: none; width: 100%; height: 100%; background: var(--border); border-radius: var(--r-full); cursor: pointer; transition: var(--transition); }
.switch input:checked { background: var(--brand); }
.switch input::after { content:''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%; transition: var(--transition); box-shadow: var(--sh-sm); }
.switch input:checked::after { left: 21px; }

/* range slider */
.range-wrap { position: relative; height: 22px; display: flex; align-items: center; }
.range-track { position: absolute; left: 0; right: 0; height: 4px; background: var(--border); border-radius: 3px; }
.range-fill { position: absolute; height: 4px; background: var(--brand); border-radius: 3px; }
input[type=range] { appearance: none; width: 100%; background: transparent; position: absolute; height: 22px; pointer-events: none; margin: 0; }
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--brand); cursor: grab; pointer-events: auto; box-shadow: var(--sh-sm);
}
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  border: 3px solid var(--brand); cursor: grab; pointer-events: auto;
}

/* segmented */
.seg { display: inline-flex; background: var(--surface-3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button { padding: 6px 13px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); transition: var(--transition); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--sh-sm); }

/* view toggle */
.viewtog { display: inline-flex; border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.viewtog button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); transition: var(--transition); }
.viewtog button svg { width: 17px; height: 17px; }
.viewtog button.active { background: var(--brand-soft); color: var(--brand); }

/* ---------- 10. Sidebar ---------- */
.sidebar { position: sticky; top: calc(var(--header-h) + 20px); }
.side-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 8px; box-shadow: var(--sh-sm); }
.side-user { padding: 18px 16px 16px; text-align: center; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.side-user .avatar { margin: 0 auto 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--text-2); font-size: 13.5px; font-weight: 500; transition: var(--transition);
}
.side-nav a svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; transition: var(--transition); }
.side-nav a:hover { background: var(--surface-3); color: var(--text); }
.side-nav a:hover svg { color: var(--text-2); }
.side-nav a.active { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 2px 8px rgba(108,76,241,.3); }
.side-nav a.active svg { color: #fff; }
.side-nav a.soft-active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.side-nav a.soft-active svg { color: var(--brand); }
.side-nav a.danger { color: var(--red); }
.side-nav a.danger svg { color: var(--red); }
.side-nav a.danger:hover { background: var(--red-soft); }
.side-nav .n { margin-left: auto; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: var(--r-full); display: grid; place-items: center; }
.side-nav a.active .n { background: rgba(255,255,255,.25); }
.side-nav .tag { margin-left: auto; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: var(--r-full); text-transform: uppercase; }
.side-sep { height: 1px; background: var(--border); margin: 8px 4px; }
.side-group { font-size: 10.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase;
  letter-spacing: .07em; padding: 14px 12px 6px; }

.promo-card { background: linear-gradient(150deg, var(--brand-soft), var(--brand-softer)); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 18px; margin-top: 16px; }

/* ---------- 11. Listing cards ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.listing-grid.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.listing-grid.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }

.lcard {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; transition: var(--transition); display: flex; flex-direction: column; position: relative;
}
.lcard:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: transparent; }
.lcard-media { position: relative; aspect-ratio: 4/3; background: var(--surface-3); overflow: hidden; }
.lcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms cubic-bezier(.4,0,.2,1); }
.lcard:hover .lcard-media img { transform: scale(1.05); }
.lcard-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2; }
.lcard-fav {
  position: absolute; top: 9px; right: 9px; z-index: 2; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.92); backdrop-filter: blur(6px); display: grid; place-items: center;
  color: var(--muted); transition: var(--transition); box-shadow: var(--sh-sm);
}
.lcard-fav svg { width: 17px; height: 17px; }
.lcard-fav:hover { transform: scale(1.1); color: var(--red); }
.lcard-fav.on { color: var(--red); }
.lcard-fav.on svg { fill: var(--red); }
.lcard-photos { position: absolute; bottom: 9px; right: 9px; z-index: 2; display: flex; align-items: center; gap: 4px;
  background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--r-full); }
.lcard-photos svg { width: 12px; height: 12px; }
.lcard-body { padding: 13px 14px 15px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.lcard-price { font-size: 17px; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.lcard-title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.4; }
.lcard-specs { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.lcard-specs span { display: inline-flex; align-items: center; gap: 4px; }
.lcard-specs svg { width: 12px; height: 12px; }
.lcard-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 11.5px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.lcard-meta .loc { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.lcard-meta svg { width: 12px; height: 12px; flex-shrink: 0; }

/* list view */
.lcard.list { flex-direction: row; }
.lcard.list .lcard-media { width: 230px; aspect-ratio: auto; flex-shrink: 0; }
.lcard.list .lcard-body { padding: 16px 18px; }
.lcard.list .lcard-title { font-size: 15px; }
.lcard.list .lcard-price { font-size: 19px; }
.lcard.list .lcard-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* horizontal scroller */
.scroller-wrap { position: relative; }
.scroller { display: flex; gap: 16px; overflow-x: auto; scroll-behavior: smooth; padding: 4px 2px 8px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { flex: 0 0 232px; }
.scroll-btn {
  position: absolute; top: 38%; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--sh-md);
  display: grid; place-items: center; color: var(--text-2); z-index: 5; transition: var(--transition);
}
.scroll-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.scroll-btn svg { width: 17px; height: 17px; }
.scroll-btn.left { left: -14px; }
.scroll-btn.right { right: -14px; }

/* ---------- 12. Hero + search ---------- */
.hero {
  background: linear-gradient(115deg, #F1EEFE 0%, #F7F5FF 45%, #FBF7FF 100%);
  border-bottom: 1px solid var(--border); position: relative; overflow: hidden;
}
[data-theme="dark"] .hero { background: linear-gradient(115deg, #1A1633 0%, #171727 55%, #1B1730 100%); }
.hero-inner { padding: 52px 0 40px; position: relative; z-index: 2; display: grid; grid-template-columns: 1.15fr .85fr; gap: 30px; align-items: center; }
.hero-art { position: relative; }
.hero-art .blob { position: absolute; border-radius: 50%; filter: blur(46px); opacity: .5; }
.hero-art .b1 { width: 230px; height: 230px; background: #A78BFA; top: -30px; right: 30px; }
.hero-art .b2 { width: 190px; height: 190px; background: #C4B5FD; bottom: -20px; right: 130px; }
.hero-art img { position: relative; border-radius: var(--r-xl); box-shadow: var(--sh-lg); }

.searchbar {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 8px; gap: 8px; box-shadow: var(--sh-md); align-items: center;
  display: grid;
  /* the selects need a floor, not a share: at 1fr they shrank until
     "Сите категории" was clipped to "Сите категор". minmax() guarantees the
     longest option still fits, and the text field absorbs whatever is left. */
  grid-template-columns: minmax(0, 1.5fr) minmax(178px, 0.9fr) minmax(178px, 0.9fr) auto;
}
.searchbar .input, .searchbar .select { border-color: transparent; background: transparent; height: 46px; }
.searchbar .input:focus, .searchbar .select:focus { background: var(--surface-2); border-color: var(--brand); }
.searchbar .divider { width: 1px; height: 26px; background: var(--border); }
.hot-tags { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.hot-tags .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* filter bar (sticky search page) */
.filterbar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--sh-sm); }
.topsearch { display: grid; gap: 10px; align-items: center;
  grid-template-columns: minmax(0,1.4fr) minmax(168px,0.9fr) minmax(168px,0.9fr) minmax(150px,0.8fr) auto; }
@media (max-width: 1100px) { .topsearch { grid-template-columns: 1.4fr 1fr 1fr auto; }
                             .topsearch > :nth-child(3) { display: none; } }
@media (max-width: 860px)  { .topsearch { grid-template-columns: 1fr 1fr; }
                             .topsearch > :nth-child(3) { display: revert; } }
@media (max-width: 560px)  { .topsearch { grid-template-columns: 1fr; } }

/* ---------- 13. Category tiles ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(8, minmax(0,1fr)); gap: 14px; }
.cat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px 10px 15px; text-align: center; transition: var(--transition);
  /* flex column + margin-top:auto on the count keeps the counts on one line
     across the row even when a category name wraps to two lines */
  display: flex; flex-direction: column; align-items: center;
}
.cat-tile:hover { border-color: var(--brand); transform: translateY(-3px); box-shadow: var(--sh-md); }
.cat-ico {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 14px;
  background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; transition: var(--transition);
}
.cat-ico svg { width: 22px; height: 22px; }
.cat-tile:hover .cat-ico { background: var(--brand); color: #fff; }
.cat-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.cat-n { font-size: 11px; color: var(--muted-2); margin-top: auto; padding-top: 3px; }

/* big category banners */
.cat-banner { position: relative; border-radius: var(--r-lg); overflow: hidden; aspect-ratio: 16/10; display: block; }
.cat-banner img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms; }
.cat-banner:hover img { transform: scale(1.06); }
.cat-banner::after { content:''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,8,30,.82) 0%, rgba(10,8,30,.15) 55%, transparent 100%); }
.cat-banner-txt { position: absolute; left: 18px; bottom: 16px; right: 18px; z-index: 2; color: #fff; }
.cat-banner-txt h3 { color: #fff; font-size: 17px; }
.cat-banner-txt p { font-size: 12.5px; opacity: .85; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.cat-banner-txt svg { width: 13px; height: 13px; }
.cat-banner-go { position: absolute; right: 16px; bottom: 16px; z-index: 3; width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255,255,255,.2); backdrop-filter: blur(6px); display: grid; place-items: center; color: #fff; transition: var(--transition); }
.cat-banner:hover .cat-banner-go { background: var(--brand); }
.cat-banner-go svg { width: 16px; height: 16px; }

/* subcategory strip */
.sub-strip { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.sub-tile { background: var(--brand-softer); border: 1px solid var(--border-soft); border-radius: var(--r);
  padding: 14px; text-align: center; transition: var(--transition); }
.sub-tile:hover { background: var(--brand-soft); border-color: var(--brand); }
.sub-tile svg { width: 22px; height: 22px; color: var(--brand); margin: 0 auto 8px; }
.sub-tile .nm { font-size: 12.5px; font-weight: 600; }
.sub-tile .n { font-size: 11px; color: var(--muted); }

/* ---------- 14. Stat tiles ---------- */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 18px; box-shadow: var(--sh-sm); transition: var(--transition);
}
.stat:hover { box-shadow: var(--sh); }
.stat-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin-bottom: 12px; }
.stat-ico svg { width: 19px; height: 19px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 25px; font-weight: 800; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; margin-top: 6px; }
.stat-delta svg { width: 12px; height: 12px; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }
.delta-flat { color: var(--muted); }

/* ---------- 15. Tables ---------- */
.tbl { width: 100%; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tbl tbody tr { transition: var(--transition); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .thumb { width: 46px; height: 34px; border-radius: 7px; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.tbl-scroll { overflow-x: auto; }

/* ---------- 16. Listing detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0,1fr) 350px; gap: 24px; align-items: start; }
.gallery-main { position: relative; aspect-ratio: 16/10; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-3); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gal-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255,255,255,.92); display: grid; place-items: center; color: var(--text); transition: var(--transition); box-shadow: var(--sh-md);
}
.gal-nav:hover { background: #fff; transform: translateY(-50%) scale(1.08); }
.gal-nav svg { width: 18px; height: 18px; }
.gal-nav.prev { left: 14px; } .gal-nav.next { right: 14px; }
.gal-count { position: absolute; top: 14px; right: 14px; background: rgba(0,0,0,.62); color: #fff;
  padding: 5px 11px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.gal-count svg { width: 13px; height: 13px; }
.thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 10px; }
.thumb-btn { aspect-ratio: 4/3; border-radius: var(--r-sm); overflow: hidden; border: 2px solid transparent; transition: var(--transition); background: var(--surface-3); position: relative; }
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }
.thumb-btn.active { border-color: var(--brand); }
.thumb-btn:hover { opacity: .85; }
.thumb-more { position: absolute; inset: 0; background: rgba(10,8,30,.65); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }

.spec-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 20px 16px; }
.spec { display: flex; gap: 11px; align-items: flex-start; }
.spec-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--brand-softer); color: var(--brand);
  display: grid; place-items: center; flex-shrink: 0; }
.spec-ico svg { width: 16px; height: 16px; }
.spec-label { font-size: 11.5px; color: var(--muted); }
.spec-value { font-size: 13.5px; font-weight: 600; margin-top: 1px; }

.price-box { font-size: 30px; font-weight: 800; color: var(--brand); letter-spacing: -.03em; }
.seller-box { display: flex; align-items: center; gap: 12px; }
.trust-list { display: flex; flex-direction: column; gap: 10px; }
.trust-item { display: flex; gap: 9px; font-size: 12.5px; color: var(--text-2); align-items: flex-start; }
.trust-item svg { width: 15px; height: 15px; color: var(--green); flex-shrink: 0; margin-top: 2px; }

.map-box { height: 230px; border-radius: var(--r); overflow: hidden; position: relative; background: var(--surface-3); }
.map-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-100%); color: var(--brand); }
.map-pin svg { width: 34px; height: 34px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.3)); }

/* ---------- 17. Wizard (post ad) ---------- */
.steps { display: flex; align-items: flex-start; justify-content: space-between; position: relative; padding: 0 20px; }
.steps::before { content: ''; position: absolute; top: 17px; left: 60px; right: 60px; height: 2px; background: var(--border); z-index: 0; }
.step { display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; z-index: 1; flex: 1; }
.step-dot {
  width: 34px; height: 34px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border);
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--muted-2); transition: var(--transition);
}
.step-name { font-size: 12px; font-weight: 500; color: var(--muted); }
.step.active .step-dot { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.step.active .step-name { color: var(--brand); font-weight: 700; }
.step.done .step-dot { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.step.done .step-name { color: var(--text-2); }
.step-bar { height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.step-bar span { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width 300ms ease; }

.cat-search {
  display: flex; align-items: center; gap: 8px; padding: 0 10px; margin-bottom: 10px;
  height: 38px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2);
  flex-shrink: 0;
}
.cat-search svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.cat-search input {
  border: 0; background: transparent; outline: none; font-size: 13px; color: var(--text); width: 100%; font-family: inherit;
}
.cat-search input::placeholder { color: var(--muted); }

/* the rail's height is pinned by JS (syncRailHeight in objavi.html) to match
   the step panel's actual height, so cat-list scrolls inside a fixed-height
   box instead of growing past it and pushing the page down. It's a column
   flex box so the search field keeps its own height and cat-list fills
   whatever is left. The height below is just the pre-JS/no-JS fallback. */
.cat-rail { display: flex; flex-direction: column; height: 560px; }

.cat-list {
  display: flex; flex-direction: column; gap: 3px;
  flex: 1; min-height: 0; overflow-y: auto;
  padding-right: 8px; margin-right: -8px;
  scrollbar-width: thin; scrollbar-color: var(--brand-soft) transparent;
}
.cat-list::-webkit-scrollbar { width: 6px; }
.cat-list::-webkit-scrollbar-track { background: transparent; }
.cat-list::-webkit-scrollbar-thumb { background: var(--brand-soft); border: 0; border-radius: 8px; }
.cat-list:hover::-webkit-scrollbar-thumb { background: var(--brand); }
.cat-list button {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2); transition: var(--transition); width: 100%; text-align: left;
  flex-shrink: 0;
}
.cat-list button svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.cat-list button:hover { background: var(--surface-3); }
.cat-list button.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.cat-list button.active svg { color: var(--brand); }

/* uploader */
.uploader {
  border: 2px dashed var(--border); border-radius: var(--r); padding: 30px 20px; text-align: center;
  transition: var(--transition); cursor: pointer; background: var(--surface-2);
}
.uploader:hover, .uploader.drag { border-color: var(--brand); background: var(--brand-softer); }
.uploader svg { width: 30px; height: 30px; color: var(--brand); margin: 0 auto 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--surface-3); cursor: grab; }
.photo-cell img { width: 100%; height: 100%; object-fit: cover; }
.photo-cell.dragging { opacity: .4; }
.photo-cell.over { outline: 2px dashed var(--brand); outline-offset: -2px; }
.photo-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(20,20,43,.72); color: #fff; display: grid; place-items: center; transition: var(--transition);
}
.photo-del:hover { background: var(--red); }
.photo-del svg { width: 13px; height: 13px; }
.photo-main { position: absolute; bottom: 6px; left: 6px; background: var(--brand); color: #fff;
  font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: var(--r-full); text-transform: uppercase; }
.photo-add {
  aspect-ratio: 1; border: 2px dashed var(--border); border-radius: var(--r); display: grid; place-items: center;
  color: var(--brand); background: var(--brand-softer); transition: var(--transition); cursor: pointer;
}
.photo-add:hover { border-color: var(--brand); background: var(--brand-soft); }
.photo-add svg { width: 22px; height: 22px; margin-bottom: 5px; }

/* ---------- 18. Messages ---------- */
.msg-layout { display: grid; grid-template-columns: 300px minmax(0,1fr) 280px; gap: 18px; height: calc(100vh - var(--header-h) - 52px); }
.msg-col { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.thread-list { overflow-y: auto; flex: 1; }
.thread {
  display: flex; gap: 11px; padding: 12px 14px; cursor: pointer; transition: var(--transition);
  border-bottom: 1px solid var(--border-soft); position: relative;
}
.thread:hover { background: var(--surface-2); }
.thread.active { background: var(--brand-softer); }
.thread.active::before { content:''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--brand); }
.thread-name { font-size: 13px; font-weight: 600; }
.thread-sub { font-size: 11.5px; color: var(--brand); font-weight: 500; }
.thread-prev { font-size: 12px; color: var(--muted); margin-top: 1px; }
.thread-time { font-size: 11px; color: var(--muted-2); white-space: nowrap; }
.thread .n { background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px;
  border-radius: var(--r-full); display: grid; place-items: center; margin-left: auto; padding: 0 5px; }

.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 11px 12px; font-size: 13px; font-weight: 600; color: var(--muted); position: relative; transition: var(--transition); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--brand); }
.tabs button.active::after { content:''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }

.chat-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.bubble-row { display: flex; gap: 9px; align-items: flex-end; max-width: 74%; }
.bubble-row.me { margin-left: auto; flex-direction: row-reverse; }
.bubble {
  padding: 10px 13px; border-radius: 16px; font-size: 13.2px; line-height: 1.5;
  background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: var(--sh-sm);
}
.bubble-row.me .bubble { background: var(--brand); color: #fff; border-color: transparent;
  border-bottom-left-radius: 16px; border-bottom-right-radius: 5px; }
.bubble-time { font-size: 10.5px; color: var(--muted-2); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.bubble-row.me .bubble-time { color: rgba(255,255,255,.75); justify-content: flex-end; }
.bubble-time svg { width: 13px; height: 13px; }
.chat-day { text-align: center; font-size: 11.5px; color: var(--muted); margin: 6px 0; }
.chat-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-bottom: 7px; }
.chat-imgs img { border-radius: 9px; aspect-ratio: 4/3; object-fit: cover; }
.typing { display: inline-flex; gap: 3px; padding: 12px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); animation: bounce 1.3s infinite; }
.typing i:nth-child(2){animation-delay:.18s} .typing i:nth-child(3){animation-delay:.36s}
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-5px);opacity:1} }

.chat-input { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 9px; align-items: center; background: var(--surface); }
.quick-replies { display: flex; gap: 8px; padding: 12px 14px 0; flex-wrap: wrap; }

.chat-listing { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); align-items: center; background: var(--surface-2); }
.chat-listing img { width: 74px; height: 54px; border-radius: var(--r-sm); object-fit: cover; flex-shrink: 0; }

/* ---------- 19. Notifications ---------- */
.notif {
  display: flex; gap: 14px; padding: 15px 18px; border-bottom: 1px solid var(--border-soft);
  transition: var(--transition); cursor: pointer; align-items: flex-start;
}
.notif:hover { background: var(--surface-2); }
.notif.unread { background: var(--brand-softer); }
.notif-ico { width: 38px; height: 38px; border-radius: 11px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; flex-shrink: 0; }
.notif-ico svg { width: 18px; height: 18px; }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; margin-top: 7px; }
.notif-dot.read { background: var(--border); }

/* ---------- 20. Pagination ---------- */
.pager { display: flex; align-items: center; gap: 5px; }
.pager button {
  min-width: 34px; height: 34px; padding: 0 9px; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  color: var(--text-2); border: 1px solid var(--border); background: var(--surface); transition: var(--transition);
}
.pager button:hover:not(:disabled):not(.active) { border-color: var(--brand); color: var(--brand); }
.pager button.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager .dots { color: var(--muted-2); padding: 0 3px; }

/* ---------- 21. Breadcrumb ---------- */
.crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.crumb a:hover { color: var(--brand); }
.crumb svg { width: 13px; height: 13px; color: var(--muted-2); }
.crumb .cur { color: var(--brand); font-weight: 600; }

/* ---------- 22. Charts ---------- */
.chart { width: 100%; height: 200px; }
.chart-legend { display: flex; flex-direction: column; gap: 11px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-wrap { position: relative; width: 150px; height: 150px; flex-shrink: 0; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }

/* ---------- 23. Misc ---------- */
.divider { height: 1px; background: var(--border); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); flex-shrink: 0; }

.empty { text-align: center; padding: 56px 20px; }
.empty-ico { width: 62px; height: 62px; border-radius: 20px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; margin: 0 auto 16px; }
.empty-ico svg { width: 28px; height: 28px; }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--border-soft) 50%, var(--surface-3) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--r-sm); }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* banner / CTA */
.cta-band {
  background: linear-gradient(120deg, var(--brand-soft) 0%, var(--brand-softer) 100%);
  border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px 28px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.cta-ico { width: 56px; height: 56px; border-radius: var(--r); background: var(--brand-grad); color: #fff;
  display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 6px 18px rgba(108,76,241,.35); }
.cta-ico svg { width: 27px; height: 27px; }

.feature { display: flex; gap: 13px; align-items: flex-start; }
.feature-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; flex-shrink: 0; }
.feature-ico svg { width: 19px; height: 19px; }

.howto { display: flex; gap: 14px; align-items: flex-start; }
.howto-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* toast */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 500; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--r); padding: 12px 16px; box-shadow: var(--sh-lg); display: flex; gap: 11px;
  align-items: center; min-width: 260px; max-width: 380px; animation: slideIn 260ms cubic-bezier(.4,0,.2,1);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast svg { width: 18px; height: 18px; color: var(--brand); flex-shrink: 0; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--red); }
.toast.out { animation: slideOut 220ms forwards; }
@keyframes slideIn { from { opacity:0; transform: translateX(24px) } to { opacity:1; transform:none } }
@keyframes slideOut { to { opacity:0; transform: translateX(24px) } }

/* modal */
.modal-host { position: fixed; inset: 0; z-index: 400; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-host.open { display: flex; }
.modal-bg { position: absolute; inset: 0; background: rgba(12,10,30,.55); backdrop-filter: blur(3px); animation: fade 180ms; }
.modal {
  position: relative; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-lg);
  width: 100%; max-width: 440px; animation: pop 220ms cubic-bezier(.4,0,.2,1); max-height: 90vh; overflow: auto;
}
@keyframes fade { from{opacity:0} to{opacity:1} }
@keyframes pop { from { opacity:0; transform: scale(.95) translateY(10px) } to { opacity:1; transform:none } }

/* footer */
.footer { background: var(--surface); border-top: 1px solid var(--border); padding: 44px 0 26px; margin-top: 56px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 34px; }
.footer h4 { font-size: 13px; margin-bottom: 13px; }
.footer-links { display: flex; flex-direction: column; gap: 9px; }
.footer-links a { font-size: 13px; color: var(--muted); transition: var(--transition); }
.footer-links a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 32px; padding-top: 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.social { display: flex; gap: 8px; }
.social a { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--muted);
  display: grid; place-items: center; transition: var(--transition); }
.social a:hover { background: var(--brand); color: #fff; }
.social svg { width: 16px; height: 16px; }

/* trust bar */
.trustbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.trust-cell { display: flex; align-items: center; gap: 11px; }
.trust-cell svg { width: 20px; height: 20px; color: var(--brand); flex-shrink: 0; }

/* admin */
.admin-shell { display: grid; grid-template-columns: 246px minmax(0,1fr); min-height: 100vh; }
.admin-side { background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-main { padding: 22px 26px 60px; min-width: 0; }
.admin-top { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 18px; display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.approve-row { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.approve-row:last-child { border-bottom: 0; }
.approve-row img { width: 50px; height: 38px; border-radius: 7px; object-fit: cover; flex-shrink: 0; background: var(--surface-3); }
.act-btn { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; transition: var(--transition); }
.act-btn svg { width: 15px; height: 15px; }
.act-ok { background: var(--green-soft); color: var(--green); }
.act-ok:hover { background: var(--green); color: #fff; }
.act-no { background: var(--red-soft); color: var(--red); }
.act-no:hover { background: var(--red); color: #fff; }

/* activity feed */
.act-item { display: flex; gap: 12px; padding: 11px 0; align-items: flex-start; }
.act-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.act-ico svg { width: 15px; height: 15px; }

/* progress list */
.tip-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; }
.tip-item svg { width: 16px; height: 16px; color: var(--green); flex-shrink: 0; margin-top: 2px; }

/* ---------- 24. Responsive ---------- */
@media (max-width: 1180px) {
  .listing-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .listing-grid.g5 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .cat-grid { grid-template-columns: repeat(6, minmax(0,1fr)); }
  .msg-layout { grid-template-columns: 260px minmax(0,1fr); }
  .msg-aside { display: none; }
  .detail-grid { grid-template-columns: minmax(0,1fr) 310px; }
  .spec-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .footer-grid { grid-template-columns: 1.5fr repeat(3, 1fr); }
}
@media (max-width: 980px) {
  .nav { display: none; }
  .burger { display: grid; }
  .shell { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: static; min-width: 0; }
  .side-card { overflow: hidden; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 4px;
              scrollbar-width: thin; }
  .side-nav a { white-space: nowrap; flex: 0 0 auto; }
  .side-sep, .side-group { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .searchbar { grid-template-columns: 1fr; }
  .searchbar .divider { display: none; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sub-strip { grid-template-columns: repeat(3, 1fr); }
  .photo-grid { grid-template-columns: repeat(4, 1fr); }
  .trustbar { grid-template-columns: repeat(2, 1fr); }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { display: none; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { padding: 0; }
  .step-name { display: none; }
  .steps::before { left: 20px; right: 20px; }
}
@media (max-width: 760px) {
  :root { --gap: 14px; }
  .wrap { padding: 0 16px; }
  h1 { font-size: 24px; }
  .h-xl { font-size: 30px; }
  .listing-grid, .listing-grid.g5, .listing-grid.g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .spec-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
  .msg-layout { grid-template-columns: 1fr; height: auto; }
  .msg-list-col { display: none; }
  .msg-layout.show-list .msg-list-col { display: flex; }
  .msg-layout.show-list .msg-chat-col { display: none; }
  .lcard.list { flex-direction: column; }
  .lcard.list .lcard-media { width: 100%; aspect-ratio: 4/3; }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .card-pad, .card-body { padding: 16px; }
  .hero-inner { padding: 34px 0 28px; }
  .trustbar { grid-template-columns: 1fr; }
  .sub-strip { grid-template-columns: repeat(2, 1fr); }
}

/* mobile drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(12,10,30,.5); z-index: 300; opacity: 0; visibility: hidden; transition: var(--transition); }
.drawer-bg.open { opacity: 1; visibility: visible; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 274px; background: var(--surface); z-index: 301;
  transform: translateX(-100%); transition: transform 260ms cubic-bezier(.4,0,.2,1); padding: 18px; overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer .side-nav { flex-direction: column; }

@media print {
  .header, .footer, .sidebar, .btn, .toast-host { display: none !important; }
  body { background: #fff; }
}

/* ---------- 25. Vehicle filter panel -------------------------------------
   Built from the existing tokens only (--brand, --surface, --border …) so it
   inherits the site's colours and works in dark mode with no extra rules. */
.vf-panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 16px; box-shadow: var(--sh-sm);
}
/* Controls WRAP, they never shrink below a readable width.
   Fixed column counts were the bug: a 5-column row with two inputs nested in
   one cell gave each price field about a tenth of the panel, which clipped
   "Сите марки" to "Сите марк" and "От/До" to "Fr/Tc". auto-fit + a minimum
   means the browser fits as many full-width controls per row as it can and
   moves the rest down, at any screen size. */
.vf-row {
  display: grid; gap: 14px 10px; margin-bottom: 12px; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
}
.vf-row:last-child { margin-bottom: 0; }
.vf-row > * { min-width: 0; }
/* the range pairs (price / year / km) need room for two controls */
.vf-row .vf-wide { grid-column: span 1; }
.vf-pair { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; }
.vf-label { font-size: 11.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; display: block; }
.vf-panel .select, .vf-panel .input { height: 40px; font-size: 13px; }
/* a little more text room: tighter chevron gutter, and an ellipsis as a last
   resort so an over-long option degrades gracefully instead of hard-clipping */
.vf-panel .select {
  padding-right: 28px; background-position: right 9px center; text-overflow: ellipsis;
}
.vf-panel .input { padding-left: 11px; padding-right: 11px; }

/* body-type picker — silhouettes behave like a multi-select of pills */
.body-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.body-opt {
  width: 58px; height: 40px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; transition: var(--transition); position: relative;
}
.body-opt svg { width: 34px; height: 20px; }
.body-opt:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-softer); }
.body-opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.body-opt.on::after {
  content: ''; position: absolute; top: -4px; right: -4px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 2px var(--surface);
}
.body-opt .cap {
  position: absolute; bottom: -16px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--muted-2); white-space: nowrap;
}
.body-pick.with-caps { margin-bottom: 18px; row-gap: 22px; }

/* colour swatches */
.color-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.color-opt {
  width: 26px; height: 26px; border-radius: 7px; cursor: pointer; position: relative;
  border: 1px solid var(--border); transition: var(--transition);
}
.color-opt:hover { transform: scale(1.12); }
.color-opt.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }

.vf-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vf-count { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1100px) { .vf-5 { grid-template-columns: repeat(3, minmax(0,1fr)); }
                             .vf-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 700px)  { .vf-5, .vf-4, .vf-2 { grid-template-columns: 1fr; } }

/* A button must never be wider than the screen it is on. At 360px the CTA
   button pushed the page 25px wide and the whole site scrolled sideways. */
.btn { max-width: 100%; }
.cta-band > * { min-width: 0; }
@media (max-width: 430px) {
  .cta-band .btn-lg,
  .vf-actions .btn { width: 100%; }
  .vf-actions { gap: 8px; }
  .vf-actions .grow { display: none; }
}

/* Very small phones (≤380px, e.g. iPhone SE). The header collapse stages stop
   at 980px; below ~380 the remaining icons still overran the screen and made
   the whole page scroll sideways. Tighten the gaps rather than hide controls. */
@media (max-width: 380px) {
  .wrap { padding: 0 12px; }
  .header-actions { gap: 0; }
  .header-inner { gap: 8px; }
  .icon-btn { width: 34px; }
  .icon-btn.with-label { padding: 0 6px; }
  .header-cta { padding: 0 12px; }
  .logo { font-size: 19px; }
  .logo-mark { margin-right: 6px; }
}
