/* ============================================================
   LeadGuard — экран ОЧЕРЕДИ ЗАЯВОК (специфика поверх base.css).
   Фильтры, поповеры, статус-бейджи, таблица, режимы плотности,
   состояния, пагинация. Дизайн-система «Точность».
   ============================================================ */

/* ── Фильтры ──────────────────────────── */
.filters { flex:none; padding:12px 18px; background:var(--panel); border-bottom:1px solid var(--line);
  display:flex; flex-direction:column; gap:10px; }
.frow { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.search { position:relative; display:flex; align-items:center; min-width:280px; flex:1; max-width:440px; }
.search svg { position:absolute; left:11px; width:16px; height:16px; color:var(--ph); pointer-events:none; }
.search input { width:100%; height:36px; padding:0 12px 0 34px; border:1px solid var(--line-strong); border-radius:9px;
  background:var(--surface); color:var(--text); font-size:13.5px; outline:none; transition:border-color .18s,box-shadow .18s; }
.search input::placeholder { color:var(--ph); }
.search input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }

.ctrl-wrap { position:relative; }
.ctrl { height:36px; padding:0 11px; border:1px solid var(--line-strong); border-radius:9px; background:var(--surface);
  color:var(--text); font-size:13px; display:flex; align-items:center; gap:8px; transition:border-color .18s,box-shadow .18s; white-space:nowrap; }
.ctrl:hover { border-color:var(--line-strong); }
.ctrl[data-open="true"] { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }
.ctrl .lbl { color:var(--faint); }
.ctrl .val { color:var(--text); font-weight:500; }
.ctrl .cnt { min-width:18px; height:18px; padding:0 5px; border-radius:6px; background:var(--accent); color:#fff;
  font-size:12px; font-weight:600; display:grid; place-items:center; }
.ctrl .chev { width:14px; height:14px; color:var(--faint); margin-left:2px; }
.date { height:36px; padding:0 10px; border:1px solid var(--line-strong); border-radius:9px; background:var(--surface);
  color:var(--text); font-family:'JetBrains Mono',monospace; font-size:12.5px; outline:none; transition:border-color .18s,box-shadow .18s; color-scheme:light; }
[data-theme="dark"] .date { color-scheme:dark; }
.date:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }
.dash { color:var(--faint); }
.frow .sp { flex:1; }

/* чипы активных фильтров */
.chips { display:flex; flex-wrap:wrap; gap:6px; align-items:center; min-height:4px; }
.chips:empty { display:none; }
.chips .lead { font-size:12px; color:var(--faint); margin-right:2px; }
.chip { display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 6px 0 10px; border-radius:7px;
  background:var(--surface); border:1px solid var(--line-strong); font-size:12.5px; color:var(--text); }
.chip b { font-weight:600; }
.chip .x { width:18px; height:18px; border-radius:5px; color:var(--faint); display:grid; place-items:center; transition:.15s; }
.chip .x svg { width:11px; height:11px; }
.chip .x:hover { background:var(--accent-soft); color:var(--accent); }

/* поповеры мультивыбора/выбора */
.pop { position:absolute; z-index:60; margin-top:6px; min-width:230px; max-height:340px; overflow:auto;
  background:var(--surface); border:1px solid var(--line-strong); border-radius:11px; box-shadow:var(--shadow-pop); padding:6px; }
.opt { display:flex; align-items:center; gap:9px; padding:7px 9px; border-radius:8px; font-size:13px; color:var(--text); transition:background-color .12s; }
.opt:hover { background:var(--hover); }
.opt .ck { width:17px; height:17px; border:1.5px solid var(--line-strong); border-radius:5px; flex:none; display:grid; place-items:center;
  background:var(--field); transition:background-color .12s,border-color .12s; }
.opt .ck svg { width:11px; height:11px; opacity:0; }
.opt[data-on="true"] .ck { background:var(--accent); border-color:var(--accent); }
.opt[data-on="true"] .ck svg { opacity:1; }
.opt .radio { width:16px; height:16px; border-radius:50%; border:1.5px solid var(--line-strong); flex:none; display:grid; place-items:center; }
.opt[data-on="true"] .radio { border-color:var(--accent); }
.opt[data-on="true"] .radio::after { content:""; width:8px; height:8px; border-radius:50%; background:var(--accent); }
.pop .sep { height:1px; background:var(--line); margin:5px 2px; }
.pop .pchk { display:flex; align-items:center; gap:9px; padding:7px 9px; border-radius:8px; font-size:13px; cursor:pointer; }
.pop .pchk:hover { background:var(--hover); }
/* заголовок группы статусов и пометка «авто» в выпадающем списке */
.pop-grp { font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--ph); padding:8px 9px 3px; }
.pop-grp:first-child { padding-top:2px; }
.opt .auto-tag { margin-left:auto; font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.04em;
  color:var(--faint); background:var(--field); border:1px solid var(--line); border-radius:5px; padding:1px 5px; }

/* ── Статус-бейдж (oklch по hue) ──────── */
.badge { display:inline-flex; align-items:center; gap:6px; height:23px; padding:0 9px 0 8px; border-radius:7px;
  font-size:12px; font-weight:600; white-space:nowrap; line-height:1;
  background:oklch(var(--b-bg-l) 0.035 var(--bh)); color:oklch(var(--b-tx-l) 0.10 var(--bh)); }
.badge .dot { width:6px; height:6px; border-radius:50%; background:oklch(0.62 0.16 var(--bh)); flex:none; }
.badge.neutral { background:var(--field); color:var(--muted); }
[data-theme="dark"] .badge.neutral { background:#2A2F38; }
.badge.neutral .dot { background:var(--faint); }
.badge.dashed { background:transparent; border:1px dashed var(--line-strong); color:var(--faint); }
.badge.dashed .dot { background:var(--faint); }
.statussel { display:inline-flex; align-items:center; gap:5px; border-radius:7px; padding:1px 4px 1px 1px; transition:background-color .15s; max-width:100%; }
.statussel:hover { background:var(--hover); }
.statussel .chev { width:13px; height:13px; color:var(--faint); flex:none; }
.statussel:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
/* read-only ячейки чужой заявки (правка только владельцу/админу) */
.statusro { display:inline-flex; align-items:center; gap:5px; padding:1px 4px; opacity:.85; cursor:default; }
.comment-ro { display:block; padding:5px 2px; color:var(--text); white-space:pre-wrap; word-break:break-word; }

/* ── Выбор консультанта (взять/снять/назначить) ── */
.consultsel { display:inline-flex; align-items:center; gap:5px; border-radius:7px; padding:2px 6px; font-size:13px;
  transition:background-color .15s; max-width:100%; cursor:pointer; }
.consultsel:hover { background:var(--hover); }
.consultsel .chev { width:13px; height:13px; color:var(--faint); flex:none; }
.consultsel:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.consult-pop .pop-search { padding:2px 2px 6px; position:sticky; top:0; background:var(--surface); }
.consult-pop .pop-search input { width:100%; box-sizing:border-box; height:32px; padding:0 10px; font-size:13px;
  color:var(--text); background:var(--field); border:1px solid var(--line-strong); border-radius:8px; }
.consult-pop .pop-search input:focus { outline:none; border-color:var(--accent); }
.consult-pop .opt { cursor:pointer; }
.consult-pop .opt[data-on="true"] { background:var(--hover); font-weight:600; }
.consult-pop .pop-empty { padding:8px 9px; font-size:13px; color:var(--faint); }

/* ── Таблица ──────────────────────────── */
.main { flex:1; position:relative; overflow:hidden; display:flex; flex-direction:column; }
.scroll { flex:1; overflow:auto; }
table { border-collapse:separate; border-spacing:0; width:max-content; min-width:100%; font-size:13px; }
th, td { text-align:left; vertical-align:middle; }
thead th { position:sticky; top:0; z-index:3; background:var(--surface); color:var(--muted);
  font-size:13.5px; font-weight:600; padding:0 14px; height:42px; border-bottom:1px solid var(--line-strong); white-space:nowrap; }
thead th .sub { font-family:'JetBrains Mono',monospace; font-size:11px; color:var(--ph); font-weight:400; margin-left:6px; }
thead th.sortable { cursor:pointer; user-select:none; }
thead th.sortable:hover { color:var(--text); }
thead th .ar { color:var(--accent); margin-left:4px; font-weight:700; }
thead th.right { text-align:right; }
tbody td { padding:0 14px; color:var(--text); border-bottom:1px solid var(--line); }
tbody td.ro { color:var(--ro); }
tbody td.num { font-family:'JetBrains Mono',monospace; font-size:12.5px; text-align:right; }
tbody tr.data:hover td { background:var(--hover); }
.ctrlc { width:38px; padding-left:14px !important; }
.expander { width:22px; height:22px; border-radius:6px; color:var(--faint); display:inline-grid; place-items:center; transition:.15s; }
.expander svg { width:14px; height:14px; transition:transform .18s; }
.expander:hover { color:var(--accent); background:var(--hover); }
.expander[data-on="true"] svg { transform:rotate(90deg); color:var(--accent); }
.name { font-weight:600; }
.src { display:inline-flex; align-items:center; gap:7px; color:var(--muted); white-space:nowrap; }
.src .fav { width:8px; height:8px; border-radius:2px; flex:none; }
.src .srclogo { width:18px; height:18px; flex:none; display:inline-grid; place-items:center; }
.src .srclogo svg { width:18px; height:18px; display:block; }
.empty-val { color:var(--ph); }

/* тех. поля */
.tech { display:none; }
body.show-tech .tech { display:table-cell; }
/* скрываемая группа в раскрытии строки (Адрес/услуга) — это div, поэтому отдельный класс */
.tech-group { display:none; }
body.show-tech .tech-group { display:flex; }
.tech .v { font-family:'JetBrains Mono',monospace; font-size:12px; color:var(--faint); max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; vertical-align:middle; }

/* info обрезка + раскрытие */
.info { max-width:300px; }
.info .clip { display:flex; align-items:center; gap:7px; cursor:pointer; }
.info .clip span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ro); }
.info .clip:hover span { color:var(--text); }
.info .exp { width:18px; height:18px; flex:none; color:var(--faint); display:grid; place-items:center; }
.info .clip:hover .exp { color:var(--accent); }
.exprow td { padding:0 !important; border-bottom:1px solid var(--line); background:var(--panel); }
.expinner { padding:14px 18px 16px 48px; display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:14px 28px; }
.exgroup { display:flex; flex-direction:column; gap:7px; }
.exgroup .h { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; color:var(--accent); padding-bottom:3px; border-bottom:1px solid var(--line); }
.exf { display:flex; gap:10px; font-size:13px; align-items:baseline; }
.exf .k { flex:none; width:120px; color:var(--faint); font-size:12px; }
.exf .val { color:var(--text); word-break:break-word; }
.exf .val.full { white-space:pre-wrap; line-height:1.5; }

/* редактируемые ячейки */
.edit { position:relative; }
.edit input, .edit textarea { width:100%; min-height:30px; padding:5px 8px; border:1px solid transparent; border-radius:7px;
  background:transparent; font-size:13px; color:var(--text); outline:none; transition:border-color .15s,background-color .15s,box-shadow .15s; }
.edit textarea { resize:none; line-height:1.4; overflow:hidden; white-space:pre-wrap; display:block; }
.edit input::placeholder, .edit textarea::placeholder { color:var(--ph); }
.edit input:hover, .edit textarea:hover { background:var(--hover); }
.edit input:focus, .edit textarea:focus { background:var(--surface); border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); }
.savemark { position:absolute; right:7px; top:9px; display:flex; align-items:center; gap:4px; font-size:12px; pointer-events:none; }
.savemark svg { width:14px; height:14px; }
.savemark.saving { color:var(--faint); } .savemark.saving svg { animation:spin .7s linear infinite; }
.savemark.saved { color:var(--ok); }
.savemark.error { color:var(--accent); pointer-events:auto; cursor:pointer; }
@keyframes spin { to { transform:rotate(360deg); } }

/* режимы плотности */
table[data-view="rows"] tbody td { height:48px; }
table[data-view="grid"] { font-size:12.5px; }
table[data-view="grid"] thead th { height:34px; background:var(--panel); border-right:1px solid var(--line); }
table[data-view="grid"] tbody td { height:36px; border-right:1px solid var(--line); padding:0 10px; }
table[data-view="grid"] tbody tr.data:nth-child(odd of .data) td { background:var(--zebra); }
table[data-view="grid"] tbody tr.data:hover td { background:var(--hover); }
table[data-view="grid"] .edit input, table[data-view="grid"] .edit textarea { min-height:26px; }

/* скелетон */
@keyframes sh { 0%{ background-position:-200px 0; } 100%{ background-position:calc(200px + 100%) 0; } }
.skel { height:12px; border-radius:5px; background:var(--field);
  background-image:linear-gradient(90deg, transparent 0, var(--hover) 40px, transparent 80px);
  background-size:200px 100%; background-repeat:no-repeat; animation:sh 1.1s ease infinite; }

/* состояния */
.state { position:absolute; inset:0; display:none; flex-direction:column; align-items:center; justify-content:center; gap:14px; text-align:center; padding:40px; background:var(--bg); }
.state.show { display:flex; }
.state .ic { width:54px; height:54px; border-radius:14px; background:var(--field); display:grid; place-items:center; color:var(--faint); }
.state .ic svg { width:26px; height:26px; }
.state.err .ic { background:var(--accent-soft); color:var(--accent); }
.state h3 { font-size:16px; font-weight:600; color:var(--text); }
.state p { font-size:13.5px; color:var(--muted); max-width:340px; line-height:1.5; }

/* футер / пагинация */
.foot { flex:none; min-height:50px; display:flex; align-items:center; justify-content:space-between; gap:14px; padding:8px 18px;
  background:var(--surface); border-top:1px solid var(--line); flex-wrap:wrap; }
.foot .info { font-size:12.5px; color:var(--muted); }
.foot .info b { color:var(--text); font-weight:600; }
.foot .info .num { font-family:'JetBrains Mono',monospace; }
.pager { display:flex; align-items:center; gap:4px; }
.pager button { min-width:32px; height:32px; padding:0 8px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface);
  color:var(--muted); font-size:13px; display:grid; place-items:center; transition:.15s; }
.pager button svg { width:15px; height:15px; }
.pager button:hover:not(:disabled) { color:var(--text); border-color:var(--line-strong); background:var(--hover); }
.pager button[data-on="true"] { background:var(--accent); color:#fff; border-color:var(--accent); font-weight:600; }
.pager button:disabled { opacity:.4; cursor:not-allowed; }
.pager .ell { color:var(--ph); padding:0 2px; }
.pgsize { display:flex; align-items:center; gap:7px; font-size:12.5px; color:var(--faint); }
.pgsize select { height:32px; padding:0 8px; border:1px solid var(--line-strong); border-radius:8px; background:var(--surface); color:var(--text); }

/* ── Комбобокс консультанта (выпадающий список с поиском) ── */
.combo { display:inline-flex; align-items:center; gap:5px; max-width:100%; border-radius:7px; padding:4px 6px;
  cursor:pointer; color:var(--text); transition:background-color .15s; }
.combo:hover { background:var(--hover); }
.combo:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
.combo .combo-txt { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.combo .combo-ph { color:var(--ph); }
.combo .chev { width:13px; height:13px; color:var(--faint); flex:none; }
.combo-pop { min-width:230px; padding:0; overflow:hidden; }
.combo-search { padding:7px; border-bottom:1px solid var(--line); }
.combo-search input { width:100%; height:32px; padding:0 10px; border:1px solid var(--line-strong); border-radius:8px;
  background:var(--field); color:var(--text); font-size:13px; outline:none; transition:border-color .15s,box-shadow .15s; }
.combo-search input::placeholder { color:var(--ph); }
.combo-search input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); background:var(--surface); }
.combo-list { max-height:240px; overflow:auto; padding:6px; }
.combo-list .opt { cursor:pointer; }
.combo-list .opt[data-on="true"] { background:var(--accent-soft); color:var(--accent); font-weight:500; }
.combo-empty { padding:11px; text-align:center; color:var(--faint); font-size:12.5px; }

/* ── Имя текущего консультанта в шапке ── */
.op-name { font-size:12.5px; color:var(--faint); max-width:170px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.op-name:empty { display:none; }

/* ── Окно входа консультанта (видно при body.op-locked) ── */
.auth { position:fixed; inset:0; z-index:200; display:none; align-items:center; justify-content:center;
  padding:24px; background:radial-gradient(58% 46% at 50% 32%, var(--accent-soft), transparent 70%), var(--bg); }
body.op-locked .auth { display:flex; }
body.op-locked .app { display:none; }
.auth::before { content:""; position:absolute; inset:0; pointer-events:none;
  background-image:linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size:34px 34px; mask-image:radial-gradient(120% 80% at 50% 0%, #000 30%, transparent 75%); }
.auth-card { position:relative; width:100%; max-width:360px; background:var(--surface); border:1px solid var(--line);
  border-radius:16px; padding:30px 28px; box-shadow:var(--shadow-pop); text-align:center; }
.auth-logo { width:50px; height:50px; border-radius:14px; background:linear-gradient(150deg, var(--accent-hover), var(--accent));
  display:grid; place-items:center; margin:0 auto 16px; box-shadow:0 10px 26px -8px var(--accent-ring); }
.auth-logo svg { width:24px; height:24px; }
.auth-card h1 { font-size:21px; font-weight:700; letter-spacing:-.02em; margin-bottom:5px; }
.auth-card p { font-size:13.5px; color:var(--faint); line-height:1.5; margin-bottom:20px; }
.auth-field { display:flex; flex-direction:column; gap:10px; }
.auth-field input { height:46px; padding:0 14px; border:1px solid var(--line-strong); border-radius:10px;
  background:var(--field); color:var(--text); font-size:15px; outline:none; transition:border-color .18s,box-shadow .18s; }
.auth-field input::placeholder { color:var(--ph); }
.auth-field input:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-ring); background:var(--surface); }
.auth-field .btn { width:100%; height:46px; justify-content:center; font-size:15px; }
.pass-wrap { position:relative; }
.pass-wrap input { width:100%; padding-right:44px; }
.eye { position:absolute; right:6px; top:50%; transform:translateY(-50%); width:32px; height:32px; border-radius:8px;
  display:grid; place-items:center; color:var(--faint); background:transparent; transition:color .15s,background-color .15s; }
.eye svg { width:18px; height:18px; }
.eye:hover { color:var(--text); background:var(--hover); }
.eye[data-on="true"] { color:var(--accent); }
.auth-err { min-height:17px; margin-top:11px; font-size:12.5px; font-weight:500; color:var(--accent); }
.auth-shake { animation:shake .38s; }
@keyframes shake { 0%,100% { transform:translateX(0); } 20%,60% { transform:translateX(-6px); } 40%,80% { transform:translateX(6px); } }
