:root {
  --bg: #070709;
  --bg-2: #0a0a0d;
  --panel: #0d0d11;
  --panel-2: #121218;
  --line: #1f1f27;
  --line-2: #17171e;
  --txt: #f4f2ec;
  --dim: #9b9aa4;
  --faint: #63626d;
  --acid: #d9ff43;
  --acid-dim: #93ad2c;
  --indigo: #8b93ff;
  --warn: #ffb020;
  --bad: #ff5f6d;
  --good: #d9ff43;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
  --sans: "Helvetica Neue", "Segoe UI", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--txt);
  font: 14px/1.5 var(--sans);
  background-color: var(--bg);
  background-image:
    repeating-linear-gradient(90deg, #ffffff05 0 1px, transparent 1px 96px),
    repeating-linear-gradient(0deg, #ffffff04 0 1px, transparent 1px 96px),
    radial-gradient(900px 520px at 92% -10%, #d9ff4312, transparent 62%),
    radial-gradient(760px 520px at -8% 108%, #8b93ff12, transparent 58%);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }

/* ---------------- shell ---------------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh; z-index: 30;
  display: flex; flex-direction: column;
  padding: 16px 0 14px;
  background: linear-gradient(180deg, #0a0a0d, #070709);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 16px 18px; border-bottom: 1px solid var(--line-2); }
.logo {
  width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center;
  background: var(--acid); color: #0a0a05; font-weight: 900; font-size: 19px;
  letter-spacing: -.04em; border-radius: 4px;
  box-shadow: 0 0 0 1px #d9ff4340, 0 12px 30px -18px #d9ff43aa;
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; }
.brand-txt strong { font-size: 14px; letter-spacing: .16em; text-transform: uppercase; }
.brand-txt span { color: var(--faint); font-size: 10px; letter-spacing: .22em; text-transform: uppercase; }

nav { display: flex; flex-direction: column; padding: 10px 8px; gap: 1px; counter-reset: nav; }
.navgroup {
  font-size: 9.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--faint); padding: 14px 8px 4px; display: block;
}
nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px;
  color: var(--dim); font-size: 13px; border-left: 2px solid transparent;
  counter-increment: nav; transition: .12s;
}
nav a::before {
  content: counter(nav, decimal-leading-zero);
  font-family: var(--mono); font-size: 10px; color: #46464f; width: 16px;
}
nav a em { font-style: normal; flex: 1; letter-spacing: .01em; }
nav a:hover { background: #ffffff04; color: var(--txt); }
nav a.active { color: #0c0c05; background: var(--acid); border-left-color: var(--acid); }
nav a.active::before { color: #6d7d1d; }
nav a.active .ico { color: #0c0c05; }
.ico { width: 15px; height: 15px; display: inline-grid; place-items: center; color: var(--faint); }
.ico svg { width: 15px; height: 15px; }
.badge {
  min-width: 19px; text-align: center; font-family: var(--mono); font-size: 10px;
  padding: 1px 5px; border: 1px solid var(--line); color: var(--dim);
}
nav a.active .badge { border-color: #0c0c0533; color: #0c0c05; }
.badge.hot { background: var(--acid); color: #0c0c05; border-color: var(--acid); }

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 9px; padding: 12px 16px 0; border-top: 1px solid var(--line-2); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mode-btn {
  padding: 6px; background: transparent; border: 1px solid var(--line); color: var(--dim);
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase; cursor: pointer;
}
.mode-btn.on { background: #17171f; border-color: var(--indigo); color: var(--indigo); }
.langs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.lang-btn {
  padding: 6px; background: transparent; border: 1px solid var(--line); color: var(--dim);
  font-family: var(--mono); font-size: 10.5px; cursor: pointer;
}
.lang-btn.on { background: var(--acid); border-color: var(--acid); color: #0c0c05; font-weight: 700; }

/* ---------------- topbar ---------------- */
main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 22px;
  padding: 20px 26px 15px; border-bottom: 1px solid var(--line);
  background: #070709ee; backdrop-filter: blur(8px);
}
.title-wrap h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; font-weight: 700; }
.title-wrap p { margin: 4px 0 0; color: var(--faint); font-size: 12px; max-width: 52ch; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  border: 1px solid var(--line); color: var(--faint); font-size: 11px;
  font-family: var(--mono); background: #0b0b0f;
}
.chip b { color: var(--txt); font-weight: 700; }
.chip.good b { color: var(--acid); }
.chip.warn b { color: var(--warn); }
.chip.bad b { color: var(--bad); }

.mebar { display: flex; align-items: center; gap: 6px; }
.engine { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); padding: 4px 4px 4px 10px; font-size: 11.5px; background: #0b0b0f; }
.dot { width: 7px; height: 7px; background: var(--faint); }
.dot.on { background: var(--acid); animation: blink 1.6s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------------- content ---------------- */
#view { padding: 20px 26px 70px; display: flex; flex-direction: column; gap: 16px; }
.banner {
  margin: 14px 26px 0; padding: 6px 11px; font-size: 11px; color: #d9ff43;
  background: #d9ff430f; border: 1px solid #d9ff4333; border-left: 3px solid var(--acid);
}
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  padding: 15px; border-radius: 3px;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 8px; height: 8px; border: 1px solid var(--acid);
  opacity: .55;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card h2 { margin: 0 0 3px; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.card h3 { margin: 14px 0 8px; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--faint); }
.card .hint { color: var(--faint); font-size: 12px; margin: 0 0 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 14px; cursor: pointer; background: transparent;
  border: 1px solid var(--line); color: var(--txt); font-size: 12.5px;
  letter-spacing: .04em; border-radius: 2px; transition: .12s;
}
.btn:hover { border-color: #3a3a46; background: #ffffff06; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--acid); border-color: var(--acid); color: #0b0b04; font-weight: 700; }
.btn.primary:hover { background: #e5ff6b; }
.btn.ghost { color: var(--dim); }
.btn.danger { border-color: #3d2126; color: #ff9aa3; }
.btn.small { padding: 5px 10px; font-size: 11.5px; }
.btn.wide { width: 100%; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
.field.mini select { padding: 6px; }
input, select, textarea {
  background: #08080b; border: 1px solid var(--line); border-radius: 2px;
  padding: 8px 9px; color: var(--txt); outline: none; width: 100%; font-size: 13px;
}
input:focus, select:focus, textarea:focus { border-color: var(--acid); }
textarea { resize: vertical; min-height: 74px; font-family: var(--mono); font-size: 12px; }

/* ---------------- KPIs ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; }
.kpi { position: relative; padding: 12px 13px; background: var(--panel); border: 1px solid var(--line); }
.kpi .k { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); }
.kpi .v { font-family: var(--mono); font-size: 27px; font-weight: 700; letter-spacing: -.03em; margin-top: 5px; }
.kpi .v small { font-size: 12px; color: var(--faint); }
.kpi .t { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.kpi.good .v { color: var(--acid); }
.kpi.warn .v { color: var(--warn); }
.kpi.bad .v { color: var(--bad); }
.kpi.good::before { content: ""; position: absolute; inset: auto 0 0 0; height: 2px; background: var(--acid); }

/* ---------------- queue ---------------- */
.queue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.qcard {
  position: relative; display: flex; flex-direction: column; gap: 9px;
  padding: 13px; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--line);
}
.qcard.mine { border-left-color: var(--acid); background: linear-gradient(90deg, #d9ff4309, var(--panel) 46%); }
.qcard.late { border-left-color: var(--bad); }
.qcard.warn { border-left-color: var(--warn); }
.qhead { display: flex; align-items: center; gap: 8px; }
.flag {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: .1em;
  padding: 2px 5px; border: 1px solid var(--line); color: var(--dim);
}
.flag.it { border-color: #2f4a2a; color: #b9e58c; }
.flag.en { border-color: #2a2f55; color: #b3b9ff; }
.qnum { font-family: var(--mono); font-size: 14px; letter-spacing: .03em; white-space: nowrap; }
.qname { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.qmeta { display: flex; justify-content: space-between; gap: 10px; font-size: 10.5px; color: var(--faint); font-family: var(--mono); }
.tbar { height: 4px; background: #17171e; overflow: hidden; }
.tbar i {
  display: block; height: 100%; transition: width .6s linear;
  background: repeating-linear-gradient(90deg, var(--acid) 0 6px, #0000 6px 9px);
}
.qcard.warn .tbar i { background: repeating-linear-gradient(90deg, var(--warn) 0 6px, #0000 6px 9px); }
.qcard.late .tbar i { background: repeating-linear-gradient(90deg, var(--bad) 0 6px, #0000 6px 9px); }
.qactions { display: flex; gap: 6px; }
.qactions .btn { flex: 1; }
.conn-strip { font-size: 11.5px; padding: 7px 9px; background: #d9ff4312; border: 1px solid #d9ff4340; color: var(--acid); }
.disp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }

.empty { padding: 54px 20px; text-align: center; border: 1px dashed var(--line); color: var(--faint); }
.empty strong { display: block; color: var(--txt); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 5px; }

/* ---------------- funnel / tables ---------------- */
.funnel { display: flex; flex-direction: column; gap: 6px; }
.fstep { display: grid; grid-template-columns: 132px 1fr 52px; gap: 9px; align-items: center; font-size: 11px; color: var(--dim); }
.fbar { height: 8px; background: #14141a; }
.fbar i { display: block; height: 100%; background: linear-gradient(90deg, #6f8222, var(--acid)); }
.fstep b { text-align: right; font-family: var(--mono); color: var(--txt); }

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); padding: 6px 7px; border-bottom: 1px solid var(--line); }
td { padding: 6px 7px; border-bottom: 1px solid var(--line-2); color: var(--dim); }
td.num { font-family: var(--mono); }
.pill { display: inline-block; padding: 1px 6px; font-family: var(--mono); font-size: 10px; border: 1px solid var(--line); color: var(--dim); }
.pill.missed { border-color: #33481f; color: var(--acid); }
.pill.answered_short { border-color: #2e3260; color: #b3b9ff; }
.pill.ring_drop { border-color: #4a3a19; color: var(--warn); }

/* ---------------- campaigns ---------------- */
.camp { display: flex; flex-direction: column; gap: 11px; }
.camp-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.camp-head strong { font-size: 13px; letter-spacing: .02em; }
.camp-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.prompt-box { border: 1px solid var(--line-2); padding: 9px; background: #08080b; }
.prompt-box .lbl { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--dim); cursor: pointer; }
.switch input { width: auto; accent-color: var(--acid); }

.sip-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 9px; }
.note { font-size: 11.5px; color: var(--faint); border-left: 2px solid var(--acid); padding-left: 9px; }

/* ---------------- trace ---------------- */
.trace {
  font-family: var(--mono); font-size: 11px; background: #050507; border: 1px solid var(--line);
  padding: 9px; height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 2px;
}
.trace div { color: var(--faint); }
.trace div b { color: var(--acid); }
.trace div.err b { color: var(--bad); }

/* ---------------- phone ---------------- */
.phone-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.phone-row strong { font-size: 13px; letter-spacing: .04em; }
.phone-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.phone-err { font-size: 11.5px; color: var(--bad); margin-bottom: 8px; }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }

/* ---------------- toast / modal ---------------- */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 90; padding: 9px 13px;
  background: #121218; border: 1px solid var(--line); font-size: 12.5px;
  opacity: 0; transform: translateY(6px); transition: .18s; pointer-events: none; max-width: 340px;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { border-color: #4a2226; color: #ffb4b9; }
.modal-backdrop { position: fixed; inset: 0; background: #040407cc; display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { width: min(520px, 100%); background: var(--panel); border: 1px solid var(--line); padding: 17px; }

/* ---------------- login ---------------- */
.login { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 100vh; }
.login-art {
  position: relative; padding: 40px; display: flex; flex-direction: column; justify-content: space-between;
  background:
    repeating-linear-gradient(90deg, #ffffff06 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, #ffffff05 0 1px, transparent 1px 64px),
    radial-gradient(600px 400px at 20% 90%, #d9ff4318, transparent 60%),
    #08080a;
  border-right: 1px solid var(--line);
}
.login-big { font-size: clamp(120px, 20vw, 260px); font-weight: 900; line-height: .8; color: var(--acid); letter-spacing: -.06em; }
.login-tag { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--faint); }
.login-tag strong { display: block; color: var(--txt); font-size: 15px; letter-spacing: .2em; margin-bottom: 6px; }
.login-form-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: min(360px, 100%); }
.login-card h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.01em; }
.login-card p.sub { margin: 0 0 20px; color: var(--faint); font-size: 12px; }
.login-card .field { margin-bottom: 12px; }
.lf-err { min-height: 18px; font-size: 11.5px; color: var(--bad); margin: 4px 0 10px; }
.hp { position: absolute; left: -9999px; }
.login-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 11px; color: var(--faint); }
.cred-hint { margin-top: 18px; padding: 10px; border: 1px dashed var(--line); font-size: 10.5px; color: var(--faint); font-family: var(--mono); line-height: 1.7; }

@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; }
  nav { flex-direction: row; flex-wrap: wrap; }
  .rail-foot { flex-direction: row; align-items: center; border: 0; }
  .topbar { flex-direction: column; }
  #view { padding: 16px; }
  .login { grid-template-columns: 1fr; }
  .login-art { min-height: 180px; padding: 22px; }
  .login-big { font-size: 84px; }
}
