/* ─────────────────────────────────────────────────────────
   proride.io — cabinet
   Clean, minimal, content-first.
   Theme vars live in /app/shared/ui.css.
   ───────────────────────────────────────────────────────── */

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

:root {
  --radius:   10px;
  --radius-l: 14px;
}

html, body { min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-top: 60px;  /* room for fixed .ph-header */
}
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text-2); }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
[data-lucide] { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }

/* ── Layout ───────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }
@media (max-width: 860px) { .shell { grid-template-columns: 1fr; } }

/* ── Sidebar ──────────────────────────────────────────── */
.side {
  position: sticky; top: 60px; height: calc(100vh - 60px);
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 12px;
}
@media (max-width: 860px) { .side { position: static; height: auto; } }

.side__nav { display: flex; flex-direction: column; gap: 1px; flex: 1; overflow-y: auto; }
.side__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  text-align: left; width: 100%;
  transition: background .12s, color .12s;
}
.side__item:hover { background: var(--surface-2); color: var(--text); }
.side__item.is-active { background: var(--surface-2); color: var(--text); }
.side__item [data-lucide] { width: 16px; height: 16px; color: var(--text-3); }
.side__item.is-active [data-lucide] { color: var(--text); }

.side__count {
  margin-left: auto;
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  padding: 2px 7px; border-radius: 20px;
  background: var(--accent); color: var(--accent-fg);
  min-width: 20px; text-align: center;
}
.side__dot {
  margin-left: auto;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
}
.side__dot.is-warn { background: var(--warn); }
.side__dot.is-err  { background: var(--err); }

.side__group { display: flex; flex-direction: column; gap: 1px; }
.side__group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  text-align: left; width: 100%;
  background: transparent; border: 0; cursor: pointer;
  transition: background .12s, color .12s;
}
.side__group-toggle:hover { background: var(--surface-2); color: var(--text); }
.side__group-toggle [data-lucide] { width: 16px; height: 16px; color: var(--text-3); }
.side__group-chev { margin-left: auto; transition: transform .15s; }
.side__group.is-open > .side__group-toggle .side__group-chev { transform: rotate(180deg); }
.side__group-children { display: none; flex-direction: column; gap: 1px; padding-left: 14px; }
.side__group.is-open > .side__group-children { display: flex; }

/* ── Main ─────────────────────────────────────────────── */
.main {
  padding: 32px 24px 80px;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
}
@media (max-width: 860px) { .main { padding: 24px 16px 60px; } }

.section { display: none; }
.section.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.section__head { margin-bottom: 28px; }
.section__head h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.section__head p { color: var(--text-2); max-width: 620px; }

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: 22px;
  margin-bottom: 16px;
}
.card__title {
  font-size: 13px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.para { color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ── Form ─────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block; font-size: 12px; font-weight: 500; color: var(--text-2);
  margin-bottom: 5px;
}
.form-group input,
.form-group textarea {
  width: 100%; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-group input.is-mono { font-family: var(--mono); font-size: 13px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-fg);
  font-size: 13px; font-weight: 600;
  transition: opacity .12s, background .12s;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn [data-lucide] { width: 14px; height: 14px; }

.btn--ghost {
  background: var(--surface);
  color: var(--text); border: 1px solid var(--border-2);
}
.btn--ghost:hover { background: var(--surface-2); opacity: 1; }

.btn--danger { color: var(--err); border-color: var(--border-2); }
.btn--danger:hover { background: var(--err-bg); border-color: var(--err); }

.btn--sm { padding: 7px 12px; font-size: 12px; }
.btn--xs { padding: 5px 8px; font-size: 11px; }

/* ── Badges ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge--ok   { background: var(--ok-bg);   color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--err  { background: var(--err-bg);  color: var(--err); }
.badge--muted{ background: var(--surface-2); color: var(--text-3); }
.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Logo upload ─────────────────────────────────────── */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 84px; height: 84px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  overflow: hidden; flex-shrink: 0;
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-preview__icon { width: 24px; height: 24px; }
.logo-upload { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ── Code block ──────────────────────────────────────── */
.code {
  position: relative;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  color: var(--text);
  overflow-x: auto;
}
.code pre { white-space: pre-wrap; word-break: break-all; padding-right: 44px; }
.code__copy { position: absolute; top: 8px; right: 8px; }
.code-group { margin-bottom: 14px; }
.code-group:last-child { margin-bottom: 0; }
.code-group__label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 5px;
}

/* ── Token display ───────────────────────────────────── */
.token {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.token__value {
  flex: 1; min-width: 200px;
  padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 13px; color: var(--text);
  word-break: break-all;
}

/* ── DNS table ───────────────────────────────────────── */
.dns-table {
  width: 100%; border-collapse: collapse;
  margin-top: 8px; font-size: 13px;
}
.dns-table th, .dns-table td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.dns-table th {
  color: var(--text-3); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.dns-table td { font-family: var(--mono); }
.dns-table tr:last-child td { border-bottom: 0; }

/* ── Steps ───────────────────────────────────────────── */
.steps { list-style: none; counter-reset: step; }
.steps li {
  padding: 8px 0 8px 32px; position: relative;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps li:first-child { padding-top: 0; }
.steps li:first-child::before { top: 0; }
.steps li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.steps code {
  font-family: var(--mono); background: var(--surface-2);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

/* ── Widget preview ──────────────────────────────────── */
.preview {
  border: 1px solid var(--border); border-radius: var(--radius-l);
  overflow: hidden; background: var(--surface-2);
}
.preview iframe {
  width: 100%; height: 640px; border: 0; display: block; background: #fff;
}

/* ── Requests ────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 18px; border-bottom: 1px solid var(--border);
}
.tabs__btn {
  padding: 10px 14px;
  color: var(--text-3); font-size: 13px; font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
}
.tabs__btn:hover { color: var(--text-2); }
.tabs__btn.is-active { color: var(--text); border-bottom-color: var(--accent); }
.tabs__btn span {
  display: inline-block; margin-left: 5px;
  font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 1px 6px; border-radius: 20px;
  background: var(--surface-2); color: var(--text-3);
  font-weight: 600;
}
.tabs__btn.is-active span { background: var(--accent); color: var(--accent-fg); }

.requests { display: flex; flex-direction: column; gap: 10px; }

.req {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
}
.req__main { min-width: 0; }
.req__head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.req__name { font-weight: 600; font-size: 15px; }
.req__phone {
  font-family: var(--mono); font-size: 13px;
  color: var(--text-2);
}
.req__phone a { text-decoration: none; }
.req__phone a:hover { color: var(--text); }
.req__meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.req__car {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12px;
}
.req__comment {
  margin-top: 8px; color: var(--text-2); font-size: 13px;
  padding: 8px 10px; background: var(--surface-2); border-radius: 6px;
}
.req__actions {
  display: flex; gap: 6px; flex-direction: column; align-items: flex-end;
}
.req__status-select {
  padding: 6px 10px;
  font: inherit; font-size: 12px;
  border: 1px solid var(--border-2); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  cursor: pointer;
}
.req__del {
  padding: 5px; border-radius: 6px; color: var(--text-3);
  transition: color .12s, background .12s;
}
.req__del:hover { color: var(--err); background: var(--err-bg); }

/* ── Empty state ─────────────────────────────────────── */
.empty {
  display: flex; flex-direction: column; align-items: center;
  padding: 60px 20px; color: var(--text-3); text-align: center;
}
.empty__icon { width: 32px; height: 32px; margin-bottom: 12px; color: var(--text-3); stroke-width: 1.5; }
.empty p { margin-bottom: 4px; }

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 18px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-fg);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--err { background: var(--err); }

/* ── Company profile extras ──────────────────────────── */
.req-mark { color: var(--err); margin-left: 2px; }
.hint-inline { color: var(--text-3); font-weight: 400; font-size: 11px; }
.ic-inline { display: inline-block; vertical-align: -3px; margin-right: 4px; color: var(--text-3); }

.form-group textarea {
  resize: vertical; min-height: 100px; font-family: var(--font); line-height: 1.5;
}

.select-input {
  width: 100%; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  font: inherit; cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
                    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}
.select-input:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.checks {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
@media (max-width: 560px) { .checks { grid-template-columns: repeat(2, 1fr); } }
.check {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface);
  cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s;
}
.check:hover { border-color: var(--text-3); }
.check input { accent-color: var(--accent); width: 14px; height: 14px; cursor: pointer; }
.check input:checked + span { color: var(--text); font-weight: 500; }
.check:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.check span { font-size: 13px; color: var(--text-2); }

/* Pricing — radio mode picker (looks like .check but laid out as two rows). */
.pricing-mode {
  display: flex; flex-direction: column; gap: 8px;
}
.pricing-mode__opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-2); background: var(--surface);
  cursor: pointer; user-select: none;
  transition: border-color .12s, background .12s;
}
.pricing-mode__opt:hover { border-color: var(--text-3); }
.pricing-mode__opt input { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.pricing-mode__opt:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }
.pricing-mode__opt span { font-size: 14px; color: var(--text-2); }
.pricing-mode__opt:has(input:checked) span { color: var(--text); font-weight: 500; }

/* Suffix label (%, ₽) glued to the right of the pricing input. */
.pricing-suffix {
  display: inline-flex; align-items: center; padding: 0 12px;
  color: var(--text-2); font-size: 14px; min-width: 30px; justify-content: center;
}


.profile-progress { margin-bottom: 20px; }
.profile-progress__bar {
  height: 6px; border-radius: 4px;
  background: var(--surface-2); overflow: hidden;
  border: 1px solid var(--border);
}
.profile-progress__bar span {
  display: block; height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width .3s ease;
}
.profile-progress .hint { margin-top: 6px; }

.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px;
  padding: 14px 0;
  background: linear-gradient(to bottom, transparent 0, var(--bg) 30%);
}

/* ── Spinner ─────────────────────────────────────────── */
.spin { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Smart lookup blocks ─────────────────────────────── */
.lookup {
  display: flex; gap: 8px; align-items: stretch;
  margin-bottom: 4px;
}
.lookup__input {
  flex: 1; min-width: 0;
  padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-2); border-radius: var(--radius);
  font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
.lookup__input:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.lookup__input.is-mono { font-family: var(--mono); font-size: 13px; }

.lookup-result {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--ok-bg);
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
}
.lookup-result.is-err {
  background: var(--err-bg);
  border-color: color-mix(in srgb, var(--err) 25%, transparent);
}
.lookup-result__head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--ok);
  margin-bottom: 8px;
}
.lookup-result.is-err .lookup-result__head { color: var(--err); }
.lookup-result__head [data-lucide] { width: 16px; height: 16px; }
.lookup-result__title {
  font-size: 15px; color: var(--text);
  font-weight: 600; margin-bottom: 4px;
}
.lookup-result__meta {
  font-size: 12.5px; color: var(--text-2);
  display: flex; flex-wrap: wrap; gap: 4px 12px;
}
.lookup-result__meta span code {
  font-family: var(--mono); font-size: 12px;
  background: var(--surface); padding: 1px 5px; border-radius: 4px;
}
.lookup-result__map {
  margin-top: 12px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}
.lookup-result__map iframe {
  width: 100%; height: 220px; border: 0; display: block;
}

.lookup-extra { margin-top: 14px; }

.link-btn {
  display: inline-block; margin-top: 10px;
  font-size: 13px; color: var(--text-3);
  background: none; border: 0; padding: 0;
  cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--border-2);
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--text); text-decoration-color: var(--text-3); }
.link-btn [data-lucide] { width: 14px; height: 14px; vertical-align: -2px; transition: transform .18s ease; }
.link-btn.is-open [data-lucide] { transform: rotate(180deg); }

/* ── Collapsible cards ───────────────────────────────── */
.card--collapsible { padding: 0; }
.card--collapsible .card__toggle {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 18px 22px;
  cursor: pointer;
  background: none; border: 0; text-align: left;
}
.card--collapsible .card__toggle .card__title {
  margin-bottom: 0; margin-right: auto;
  font-size: 15px; font-weight: 600;
  color: var(--text);
  text-transform: none; letter-spacing: 0;
}
.card--collapsible .card__chev {
  width: 18px; height: 18px;
  color: var(--text-3);
  transition: transform .15s;
}
.card--collapsible.is-open .card__chev { transform: rotate(180deg); }
.card--collapsible .card__body {
  padding: 0 22px 22px; border-top: 1px solid var(--border);
  padding-top: 18px;
}

/* Status chip in collapsible card header */
.card-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.card-status [data-lucide] { width: 13px; height: 13px; }
.card-status--ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: color-mix(in srgb, var(--ok) 25%, transparent);
}
.card-status--warn {
  color: var(--warn, #b45309);
  background: var(--warn-bg, #fef3c7);
  border-color: color-mix(in srgb, var(--warn, #b45309) 25%, transparent);
}
.card-status--empty {
  color: var(--text-3);
  background: var(--surface-2, var(--surface));
  border-color: var(--border);
}

/* Yandex.Maps company card preview */
.ym-card {
  display: flex; gap: 14px; align-items: stretch;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
}
.ym-card__photo {
  flex: 0 0 110px;
  width: 110px; height: 110px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2, var(--surface));
  display: flex; align-items: center; justify-content: center;
}
.ym-card__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ym-card__photo--empty { color: var(--text-3); }
.ym-card__photo--empty [data-lucide] { width: 28px; height: 28px; }
.ym-card__info {
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0; padding: 4px 2px;
}
.ym-card__name {
  font-size: 15px; font-weight: 600; color: var(--text);
  line-height: 1.3;
}
.ym-card__row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.ym-card__row [data-lucide] {
  width: 14px; height: 14px;
  color: var(--text-3); flex-shrink: 0;
}
@media (max-width: 480px) {
  .ym-card { flex-direction: column; }
  .ym-card__photo { width: 100%; height: 180px; flex: none; }
}

/* ── Filters (Данные section) — ai-auto.tech style ───── */
.cf-desktop {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cf-type-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 10px;
}
.cf-primary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .cf-type-row,
  .cf-primary {
    grid-template-columns: 1fr 1fr;
  }
}

.cf-secondary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.cf-country-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cf-secondary-right { display: flex; align-items: center; gap: 8px; }

.cf-more {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
}
.cf-more:hover { border-color: var(--accent); color: var(--text); }
.cf-more__arrow { transition: transform .15s; }
.cf-more[aria-expanded="true"] .cf-more__arrow { transform: rotate(180deg); }
.cf-more[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--text);
}
.cf-more i { width: 16px; height: 16px; }
.cf-more__badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  font-size: .75rem; font-weight: 600;
  line-height: 1;
}
.cf-more__badge[hidden] { display: none; }

.cf-advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-2);
}
@media (max-width: 720px) {
  .cf-advanced-grid { grid-template-columns: 1fr 1fr; }
}

/* Active filter chips row — summary of current selection with × buttons */
.cf-active-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-2);
}
.cf-active-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
  font-size: 13px; line-height: 1; font-weight: 500;
  white-space: nowrap;
}
.cf-active-chip__label { color: var(--text-2); font-weight: 400; margin-right: 2px; }
.cf-active-chip__remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  border: 0; background: transparent;
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px; line-height: 1;
  opacity: .65;
  transition: opacity .12s, background .12s, color .12s;
}
.cf-active-chip__remove:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--text);
}
.cf-active-chips__clear {
  display: inline-flex; align-items: center;
  padding: 4px 10px;
  border: 0; background: transparent;
  color: var(--text-2);
  font-size: 13px; line-height: 1; font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-2);
}
.cf-active-chips__clear:hover { color: var(--text); }

/* Country chip — pill toggle */
.cf-country-chip {
  display: inline-flex; align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px; line-height: 1; font-weight: 500;
  cursor: pointer;
  transition: border-color .12s, background .12s, color .12s;
  white-space: nowrap;
}
.cf-country-chip:hover { border-color: var(--text-3); color: var(--text); }
.cf-country-chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--surface-2, var(--surface));
  color: var(--text);
}

/* Dropdown control — ai-auto.tech style (vertical, label on top) */
.cf-dropdown { position: relative; min-width: 0; }
.cf-dropdown__trigger {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  padding: 6px 26px 6px 10px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: border-color .15s ease;
}
.cf-dropdown__trigger:hover { border-color: var(--text-3); }
.cf-dropdown.is-open > .cf-dropdown__trigger {
  border-color: var(--text);
}
.cf-dropdown__label {
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .1em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.cf-dropdown__value {
  font-size: .85rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.25;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-dropdown__arrow {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  transition: transform .15s ease;
  width: 14px; height: 14px;
}
.cf-dropdown.is-open > .cf-dropdown__trigger .cf-dropdown__arrow {
  transform: translateY(-50%) rotate(180deg);
}

.cf-dropdown__popover {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  min-width: 240px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
}

/* Sticky search at top of popover */
.cf-search-wrap {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cf-search {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font-size: .82rem;
  font-family: inherit;
  box-sizing: border-box;
}
.cf-search:focus { outline: none; border-color: var(--text); }
.cf-search::placeholder { color: var(--text-3); font-weight: 300; }

.cf-options {
  flex: 1 1 auto;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cf-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  min-height: 38px;
  background: none;
  border: 0;
  color: var(--text);
  font-size: .82rem;
  font-weight: 400;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.cf-opt:hover { background: var(--surface-2, var(--surface)); }
.cf-opt.is-active {
  background: var(--surface-2, var(--surface));
  font-weight: 500;
}
.cf-opt__name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cf-opt__count {
  margin-left: auto;
  font-size: .75rem;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  opacity: .85;
}
.cf-opt__empty {
  padding: 16px 14px;
  color: var(--text-3);
  font-size: .82rem;
  text-align: center;
}

/* Custom multi-select check (16x16 square) */
.cf-multi-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  background: var(--surface);
  color: var(--accent-fg, #fff);
  flex-shrink: 0;
  transition: background .12s ease, border-color .12s ease;
}
.cf-multi-check.is-active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.cf-multi-check svg { display: block; }

/* Range popover body */
.cf-range {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.cf-range__input {
  width: 100%;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-2);
  background: var(--surface-2, var(--surface));
  color: var(--text);
  font-size: .8rem;
  font-weight: 400;
  font-family: inherit;
  text-align: center;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s ease;
}
.cf-range__input:focus { outline: none; border-color: var(--text); background: var(--surface); }
.cf-range__dash {
  color: var(--text-3);
  font-size: .9rem;
  flex-shrink: 0;
}

/* Popover footer — Сбросить / Готово, two equal flex-1 buttons */
.cf-popover-actions {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.cf-popover-actions__btn {
  flex: 1 1;
  padding: 8px 14px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.cf-popover-actions__btn:hover {
  color: var(--text);
  border-color: var(--text-3);
}
.cf-popover-actions__btn.is-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.cf-popover-actions__btn.is-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}

.cf-footer {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.cf-count {
  color: var(--text-2);
  font-size: 13px;
}
.cf-count b {
  color: var(--text); font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0 2px;
}

@media (max-width: 720px) {
  .cf-dropdown__popover {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 75vh;
  }
}

/* ── Loading ─────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 60px); color: var(--text-3); font-size: 13px;
}

/* ── Team list ────────────────────────────────────── */
.team-list {
  display: flex; flex-direction: column; gap: 6px;
}
.team-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-2);
}
.team-row__main { min-width: 0; flex: 1; }
.team-row__name { font-weight: 600; font-size: 14px; color: var(--text); }
.team-row__email { font-size: 13px; color: var(--text-2); word-break: break-all; }
.team-row__meta {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* Work hours picker */
.work-hours {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.work-hours__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.work-hours__day {
  flex: 0 0 88px;
  font-size: 14px; font-weight: 500; color: var(--text);
}
.work-hours__range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* Specificity bump: .form-group input { width: 100% } would otherwise stretch these. */
input.work-hours__time {
  width: 110px;
  padding: 9px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input.work-hours__time:focus {
  outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.work-hours__sep { color: var(--text-3); }
.work-hours__closed {
  display: none;
  font-size: 14px; color: var(--text-3);
  font-style: italic;
}
.work-hours--off .work-hours__range { display: none; }
.work-hours--off .work-hours__closed { display: inline; }

/* Soft validation: close <= open */
.work-hours--bad input.work-hours__time {
  border-color: var(--err, #dc2626);
}
.work-hours--bad input.work-hours__time:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

/* "Выходной" toggle styled as a quiet chip, pinned to the right */
.work-hours__off-label {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 13px; color: var(--text-2);
  cursor: pointer; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s;
}
.work-hours__off-label:hover {
  background: var(--surface-2);
}
.work-hours__off-label input {
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
}
.work-hours--off .work-hours__off-label {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-2);
}

@media (max-width: 480px) {
  .work-hours__row { flex-wrap: wrap; row-gap: 6px; }
  .work-hours__day { flex: 0 0 100%; }
  .work-hours__range { flex: 1 1 auto; }
  .work-hours__off-label { margin-left: 0; }
  input.work-hours__time { flex: 1 1 0; width: auto; min-width: 0; }
}

/* ─── Autosave status indicator ─────────────────────────── */
.save-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 1.3;
  padding: 6px 10px; border-radius: 8px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.save-status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.save-status--idle { color: var(--text-2); background: transparent; }
.save-status--idle::before { background: var(--text-3, #aaa); opacity: 0.6; }
.save-status--pending { color: #b06a00; background: rgba(255, 170, 0, 0.10); }
.save-status--saving { color: #5a6cff; background: rgba(90, 108, 255, 0.10); }
.save-status--saving::before { animation: save-pulse 1s ease-in-out infinite; }
.save-status--ok { color: #1a8a3a; background: rgba(26, 138, 58, 0.10); }
.save-status--err { color: #c62828; background: rgba(198, 40, 40, 0.10); }

@keyframes save-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ─── Admin impersonation banner ─── */
.imp-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
  color: #fff;
  font-size: 13px;
  border-bottom: 1px solid #7f1d1d;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.imp-banner__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.imp-banner__inner svg,
.imp-banner__inner [data-lucide] {
  width: 18px; height: 18px; flex-shrink: 0;
}
.imp-banner__inner span { flex: 1; line-height: 1.4; }
.imp-banner__inner b { font-weight: 700; }
.imp-banner__exit {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.imp-banner__exit:hover { background: rgba(255,255,255,0.28); }

body.is-impersonating { outline: 2px solid #dc2626; outline-offset: -2px; }

@media (max-width: 800px) {
  .imp-banner__inner { flex-wrap: wrap; gap: 8px; }
  .imp-banner__exit { width: 100%; padding: 8px; }
}

/* ─── Admin entry link (only for is_admin users not currently impersonating) ─── */
.admin-entry {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 900;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  transition: transform 0.15s;
}
.admin-entry:hover { transform: translateY(-1px); border-color: var(--accent); }
.admin-entry [data-lucide], .admin-entry svg { width: 14px; height: 14px; }
