/* Кабинет заявок АЗ68 — в стиле нового сайта (Unbounded + Golos Text, ночной зелёный, мятное свечение) */
:root {
  --green: #006e49; --green-hi: #008a5b; --green-deep: #003d29; --green-ink: #012a1c;
  --mint: #7fe3b5; --glow: #3cf0a4; --night: #01170f;
  --soft: #e6f2ec; --paper: #f4f7f5;
  --ink: #14241d; --muted: #5b6b64; --line: #dbe5e0; --red: #c62a21; --red-bg: #fdeeec;
  --display: "Unbounded", "Arial Black", Arial, sans-serif;
  --body: "Golos Text", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --s-new: #006e49; --s-nodial: #b56200; --s-work: #1f5fae;
  --s-meeting: #6c3fa3; --s-deal: #3cf0a4; --s-refuse: #a7b2ad;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--green); }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--mint); outline-offset: 2px; }
h1, h2 { font-family: var(--display); margin: 0; line-height: 1.1; letter-spacing: -.015em; }
h1 { font-size: clamp(22px, 3vw, 30px); font-weight: 700; margin: 6px 0 18px; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- Логотип ---------- */
.logo-txt { font-family: var(--display); font-weight: 800; font-size: 24px; font-style: italic; transform: skewX(-6deg); letter-spacing: -.02em; color: #fff; line-height: 1; display: inline-block; }
.logo-txt b { background: linear-gradient(180deg, #ffd27a, #e0921f); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 1px; }
.brand-sub { font-size: 13px; font-weight: 600; color: var(--glow); }

/* ---------- Шапка ---------- */
.topbar { position: relative; color: #fff; background: var(--night); overflow: hidden; isolation: isolate; }
.topbar::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(50% 140% at 90% 0%, rgba(0,138,91,.55), transparent 70%),
              radial-gradient(30% 120% at 20% 100%, rgba(60,240,164,.14), transparent 70%); }
.topbar-in, .nav-in { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.topbar-in { display: flex; align-items: center; gap: 14px; min-height: 64px; }
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; margin-right: auto; }
.who { font-size: 13px; color: rgba(255,255,255,.65); }
.logout { color: rgba(255,255,255,.85); font-size: 14px; }
.sound-btn { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); border-radius: 12px; padding: 8px 14px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.sound-btn.is-warn { background: var(--glow); border-color: var(--glow); color: var(--night); box-shadow: 0 0 0 4px rgba(60,240,164,.2); }
.sound-btn.is-off { color: #ffb3aa; border-color: rgba(255,120,100,.4); }
.nav { border-top: 1px solid rgba(255,255,255,.08); }
.nav-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: rgba(255,255,255,.6); text-decoration: none; font-weight: 600; font-size: 15px; padding: 12px 12px; white-space: nowrap; border-bottom: 2px solid transparent; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; border-bottom-color: var(--glow); }
@media (max-width: 680px) { .who { display: none; } .topbar-in { min-height: 58px; gap: 10px; } .logo-txt { font-size: 21px; } }

.new-banner { position: sticky; top: 0; z-index: 30; width: 100%; border: 0; font-weight: 700; padding: 14px 16px; background: var(--glow); color: var(--night); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 20px 120px; }
.flash { border-radius: 14px; padding: 13px 16px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--soft); color: var(--green-deep); }
.flash-err { background: var(--red-bg); color: var(--red); }

/* ---------- Поля и кнопки (как на сайте) ---------- */
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 46px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); outline: 0; }
textarea { width: 100%; resize: vertical; margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 11px 20px; border-radius: 14px; border: 0;
  font-weight: 700; font-size: 16px; line-height: 1.2; text-decoration: none; white-space: nowrap; color: #fff; background: var(--green); transition: background .15s, transform .1s; }
.btn:hover { background: var(--green-hi); }
.btn:active { transform: scale(.985); }
.btn.ghost { color: var(--green-deep); background: #fff; box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px var(--green); background: #fff; }
.btn.danger { color: var(--red); background: #fff; box-shadow: inset 0 0 0 2px #efc3bf; }
.btn.danger:hover { background: var(--red-bg); }
.btn.small { min-height: 38px; padding: 7px 12px; font-size: 14px; border-radius: 10px; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn:disabled { cursor: default; }
.form-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.form-row input, .form-row select { flex: 1 1 170px; }
.form-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .form-grid { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }

/* ---------- Вкладки (как чипы калькулятора) ---------- */
.tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -20px 14px; padding: 2px 20px 4px; }
.tab { white-space: nowrap; text-decoration: none; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 10px; padding: 7px 13px; font-weight: 600; font-size: 15px; }
.tab:hover { border-color: var(--green); }
.tab b { margin-left: 7px; color: var(--muted); font-weight: 700; }
.tab.alarm b { color: var(--red); }
.tab.on { background: var(--green); border-color: var(--green); color: #fff; }
.tab.on b { color: var(--mint); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filters input[type=search] { flex: 1 1 220px; }
.custom-dates { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Список заявок ---------- */
.leads { background: #fff; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; }
.lead { --sc: var(--line); position: relative; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: start; padding: 14px 18px 14px 24px; border-top: 1px solid var(--line); }
.lead:first-child { border-top: 0; }
.lead::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sc); }
.lead:hover { background: #f8fbf9; }
.s-new { --sc: var(--s-new); } .s-nodial { --sc: var(--s-nodial); } .s-work { --sc: var(--s-work); }
.s-meeting { --sc: var(--s-meeting); } .s-deal { --sc: var(--s-deal); } .s-refuse { --sc: var(--s-refuse); }
.lead.is-overdue { background: var(--red-bg); --sc: var(--red); }
.lead-body { min-width: 0; }
.lead-name { font-weight: 700; font-size: 17px; color: var(--ink); text-decoration: none; }
.lead-name::after { content: ""; position: absolute; inset: 0; }
.lead-meta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.lead-phone { position: relative; z-index: 1; grid-column: 1; justify-self: start; padding: 4px 0; font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: -.01em; color: var(--green); text-decoration: none; }
.lead-tags { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
@media (min-width: 820px) {
  .lead { grid-template-columns: 1fr 230px 230px; align-items: center; }
  .lead-phone { grid-column: 2; grid-row: 1; }
  .lead-tags { grid-column: 3; grid-row: 1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
}
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.b-new { background: var(--green); color: #fff; }
.b-nodial { background: #fdefdc; color: #8a4a00; }
.b-work { background: #e4edf9; color: #1a4d8c; }
.b-meeting { background: #eee6f8; color: #57318a; }
.b-deal { background: var(--night); color: var(--glow); }
.b-refuse { background: #eef1ef; color: #5d6964; }
.flag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.flag-red { background: var(--red); color: #fff; }
.flag-dup { background: #fff; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 18px 0; flex-wrap: wrap; }

/* ---------- Карточка заявки ---------- */
.back { display: inline-block; margin-bottom: 12px; font-weight: 600; text-decoration: none; color: var(--muted); }
.back:hover { color: var(--green); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 22px; margin-bottom: 16px; }
.lead-head { position: relative; overflow: hidden; color: #fff; border: 0; background: var(--night); isolation: isolate; padding: 26px; }
.lead-head::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(60% 90% at 100% 0%, rgba(0,138,91,.55), transparent 70%), radial-gradient(40% 80% at 0% 100%, rgba(60,240,164,.14), transparent 70%); }
.lead-head::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--sc, var(--glow)); }
.lh-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lh-top h1 { margin: 0; color: #fff; font-size: clamp(24px, 3.4vw, 34px); }
.lh-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: rgba(255,255,255,.65); font-size: 14px; margin: 10px 0 4px; }
.lead-head .muted { color: rgba(255,255,255,.6); }
.lead-head a { color: var(--glow); }
.alert { display: inline-block; color: #fff; background: var(--red); border-radius: 10px; padding: 6px 12px; font-weight: 700; margin: 10px 0 0; }
.note { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 10px 12px; margin: 10px 0 0; font-size: 14px; }
.call { width: 100%; margin-top: 18px; min-height: 58px; font-size: 18px; background: linear-gradient(90deg, var(--green), var(--green-hi)); box-shadow: 0 10px 30px rgba(0,110,73,.45), 0 0 0 1px rgba(60,240,164,.35); }
.call:hover { background: linear-gradient(90deg, var(--green-hi), var(--green-hi)); }
@media (min-width: 820px) { .call { width: auto; padding: 14px 28px; } }

.cols { display: grid; gap: 0 16px; }
@media (min-width: 900px) { .cols { grid-template-columns: 1fr 410px; align-items: start; } .col-actions { order: 2; } }
/* Статусы — плитки как в квизе */
.status-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.status-btns .btn { min-height: 64px; border-radius: 16px; font-size: 16px; color: var(--ink); background: #fff; box-shadow: inset 0 0 0 2px var(--line); transition: transform .15s, box-shadow .15s; }
.status-btns .btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--green), 0 10px 24px rgba(0,60,40,.1); }
.status-btns .btn.is-current { background: var(--green); color: #fff; box-shadow: none; transform: none; }
.refuse-row select { flex: 1 1 180px; }

dl.fields { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 0; margin: 0; }
dl.fields dt, dl.fields dd { padding: 10px 0; border-bottom: 1px dashed var(--line); }
dl.fields dt { color: var(--muted); font-size: 15px; }
dl.fields dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; text-align: right; }
dl.fields dt:last-of-type, dl.fields dd:last-of-type { border-bottom: 0; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { position: relative; padding: 8px 0 12px 22px; }
.history li::before { content: ""; position: absolute; left: 4px; top: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--soft); }
.history li::after { content: ""; position: absolute; left: 7px; top: 26px; bottom: -6px; width: 2px; background: var(--line); }
.history li:last-child::after { display: none; }
.h-when { font-size: 12.5px; color: var(--muted); }
.h-what { overflow-wrap: anywhere; }

/* ---------- Окно «пока вас не было» ---------- */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(1,23,15,.65); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 14px; }
.modal-box { background: #fff; border-radius: 24px; width: min(560px, 100%); max-height: calc(100vh - 28px); overflow: auto; padding: 28px; box-shadow: 0 40px 100px rgba(0,0,0,.4); }
.modal-box h2 { font-size: 22px; margin-bottom: 6px; }
.missed-list { margin-top: 14px; display: grid; gap: 8px; }
.missed-item { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; padding: 12px 14px; border-radius: 14px; background: var(--paper); }
.missed-item a { text-decoration: none; color: var(--ink); }
.missed-item .missed-phone { grid-column: 2; grid-row: 1 / span 2; align-self: center; color: var(--green); font-family: var(--display); font-weight: 700; font-size: 14px; }

/* ---------- Таблицы ---------- */
.table-scroll { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 22px; }
table.stat { width: 100%; border-collapse: collapse; font-size: 15px; }
.stat th, .stat td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.stat th:first-child, .stat td:first-child { text-align: left; }
.stat thead th { color: var(--muted); font-weight: 600; font-size: 13px; }
.stat td:first-child a { font-weight: 700; text-decoration: none; }
.stat tfoot td { font-family: var(--display); font-weight: 700; font-size: 14px; background: var(--night); color: #fff; border-bottom: 0; }
.stat tbody tr:hover { background: #f8fbf9; }
.num-bad { color: var(--red); font-weight: 800; }
.explain { margin-top: 14px; max-width: 75ch; }
.users-table td.actions { text-align: left; white-space: normal; min-width: 150px; }
.users-table tr.is-off td { color: var(--muted); }
details summary { cursor: pointer; color: var(--green); font-weight: 700; }
.details-body { display: grid; gap: 8px; padding-top: 10px; min-width: 320px; }
.city-row { display: grid; gap: 10px; align-items: center; }
.city-row.is-off { opacity: .6; }
.city-info { display: grid; gap: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { min-height: 0; width: 20px; height: 20px; accent-color: var(--green); }
@media (min-width: 820px) { .city-row { grid-template-columns: 1.4fr 1.4fr auto auto; } }

/* ---------- Сигнал «заявка не открыта» ---------- */
.alarm { position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 18px; border-radius: 22px; color: #fff; background: rgba(1,23,15,.95); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(60,240,164,.35), 0 0 50px rgba(60,240,164,.18); }
.alarm-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--glow); flex: none; position: relative; box-shadow: 0 0 14px var(--glow); }
.alarm-dot::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; border: 2px solid var(--glow); animation: alarm-pulse 1.6s ease-out infinite; }
@keyframes alarm-pulse { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.7); opacity: 0; } }
.alarm-text { display: grid; gap: 2px; flex: 1 1 200px; min-width: 0; }
.alarm-text b { font-family: var(--display); font-size: 18px; }
.alarm-more { font-size: 13px; color: rgba(255,255,255,.65); }
.alarm-btn { flex: 1 1 100%; min-height: 52px; background: var(--glow); color: var(--night); }
.alarm-btn:hover { background: #7ff5c2; }
@media (min-width: 700px) { .alarm { left: auto; right: 20px; bottom: 20px; width: 440px; } }

/* ---------- Вход ---------- */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--night); position: relative; overflow: hidden; }
.auth-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 70% at 85% 20%, rgba(0,138,91,.55), transparent 70%), radial-gradient(50% 60% at 10% 90%, rgba(0,110,73,.45), transparent 70%); }
.auth-glow::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px); background-size: 64px 64px; mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent); -webkit-mask-image: radial-gradient(70% 70% at 50% 40%, #000, transparent); }
.auth-box { position: relative; background: #fff; border-radius: 26px; padding: 30px 26px; width: 100%; max-width: 400px;
  box-shadow: 0 40px 100px rgba(0,0,0,.55), 0 0 0 1px rgba(60,240,164,.35), 0 0 60px rgba(60,240,164,.18); }
.auth-brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.auth-brand .logo-txt { color: var(--green); font-size: 28px; }
.auth-brand .brand-sub { color: var(--muted); }
.auth-box label { display: block; font-size: 14px; color: var(--muted); font-weight: 600; margin: 14px 0 6px; }
.auth-box input { width: 100%; padding: 14px 16px; font-size: 17px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
