/* Lumio brand tokens and the operator panel. */

:root {
  --ink: #0F1834;
  --ink-2: #39415F;
  --muted: #687089;
  --line: #E2E6EE;
  --line-2: #EDF0F5;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --indigo: #4650D8;
  --indigo-ink: #2F37B8;
  --indigo-soft: #EEEFFD;
  --indigo-line: #CDD0F7;
  --amber: #D99027;
  --amber-ink: #8F5506;
  --amber-soft: #FDF2E1;
  --amber-line: #F2D6A8;
  --rose: #C73A4E;
  --rose-soft: #FCE8EB;
  --green: #16855A;
  --green-soft: #E3F4EA;
  --radius: 14px;
  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --lc-surface: #FFFFFF;
  --lc-text: var(--ink);
  --lc-muted: var(--muted);
  --lc-line: var(--line);
  --lc-line-strong: #C9CFDC;
  --lc-track: var(--line-2);
  --lc-accent: var(--indigo);
  --lc-accent-ink: #fff;
  --lc-human: var(--amber);
  --lc-ok: var(--green);
  --lc-ok-bg: var(--green-soft);
  --lc-wait: #A86400;
  --lc-wait-bg: var(--amber-soft);
  --lc-bad: var(--rose);
  --lc-bad-bg: var(--rose-soft);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

body.app {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 68px 1fr; height: 100%; }

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 0;
  background: var(--ink);
  color: #AEB5CC;
}

.rail-logo { display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 14px; }
.rail-logo img { width: 30px; height: 30px; }

.rail a {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  text-decoration: none;
}

.rail a svg { width: 22px; height: 22px; }
.rail a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rail a[aria-current="page"] { background: rgba(255, 255, 255, .12); color: #fff; }
.rail a[aria-current="page"]::before { content: ""; position: absolute; left: -11px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: #8F96FF; }

.rail a .tip {
  position: absolute;
  left: 56px;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-4px);
  transition: .15s;
  z-index: 10;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
}

.rail a:hover .tip, .rail a:focus-visible .tip { opacity: 1; transform: none; }
.rail-badge { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--amber); color: #2A1A02; font-size: 10.5px; font-weight: 750; line-height: 17px; text-align: center; }

.rail-me { margin-top: auto; position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--amber); color: #2A1A02; font-weight: 750; font-size: 13px; }
.rail-me i { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #3CCB8B; box-shadow: 0 0 0 2.5px var(--ink); }

.view { min-width: 0; height: 100%; overflow: hidden; }

/* ---------- inbox ---------- */

.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr) 330px; height: 100%; }

.queue { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.queue-head { padding: 16px 16px 10px; }
.queue-head h1 { margin: 0 0 12px; font-size: 18px; letter-spacing: -.02em; display: flex; align-items: center; justify-content: space-between; }
.queue-head h1 small { font-size: 12px; font-weight: 550; color: var(--green); display: flex; align-items: center; gap: 6px; }
.queue-head h1 small::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3CCB8B; }

.tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--bg); }
.tabs button { flex: 1; padding: 6px 4px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 24, 52, .1), 0 0 0 1px var(--line); }
.tabs button em { font-style: normal; color: var(--muted); font-weight: 500; margin-left: 3px; }

.qlist { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }

.qitem {
  position: relative;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 11px 10px;
  border: 0;
  border-radius: 12px;
  background: none;
  text-align: left;
  cursor: pointer;
}

.qitem + .qitem { margin-top: 2px; }
.qitem:hover { background: var(--bg); }
.qitem[aria-current="true"] { background: var(--indigo-soft); }
.qitem .av { grid-row: span 2; }
.qitem b { font-size: 13.5px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.qitem b span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem time { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.qitem p { grid-column: 2 / 4; margin: 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qitem .qmeta { grid-column: 2 / 4; display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }

.av { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: #E6E9F2; color: var(--ink-2); flex: none; position: relative; }
.av.live::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #3CCB8B; box-shadow: 0 0 0 2.5px var(--surface); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  background: var(--line-2);
  color: var(--ink-2);
}

.tag.ai { background: var(--indigo-soft); color: var(--indigo-ink); }
.tag.hu { background: var(--amber-soft); color: var(--amber-ink); }
.tag.rg { background: var(--rose-soft); color: var(--rose); }
.tag.ok { background: var(--green-soft); color: var(--green); }
.tag.vip { background: #1B2442; color: #F2D79B; }
.tag.live { background: var(--ink); color: #fff; }
.tag.live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3CCB8B; animation: blink 1.4s infinite; }
.tag.sla { background: var(--rose-soft); color: var(--rose); font-variant-numeric: tabular-nums; }

/* conversation */

.conv { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 64px; }
.conv-head .who { flex: 1; min-width: 0; }
.conv-head .who b { display: flex; align-items: center; gap: 8px; font-size: 15px; letter-spacing: -.01em; }
.conv-head .who small { color: var(--muted); font-size: 12.5px; }
.conv-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 650;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover { background: var(--bg); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #1D2850; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #2A1A02; }
.btn.amber:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--line-2); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }

.conv-body { flex: 1; overflow-y: auto; padding: 18px 22px 10px; display: flex; flex-direction: column; gap: 12px; }

.banner {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  padding: 12px 14px;
  border: 1px solid var(--amber-line);
  border-radius: 12px;
  background: var(--amber-soft);
  color: #5E3A05;
  font-size: 13px;
}

.banner .bi { grid-row: span 2; width: 30px; height: 30px; border-radius: 9px; background: var(--amber); color: #2A1A02; display: grid; place-items: center; font-weight: 800; font-size: 12px; }
.banner b { color: #3D2603; }
.banner.rg { border-color: #F2C1C9; background: var(--rose-soft); color: #6E1E2A; }
.banner.rg .bi { background: var(--rose); color: #fff; }
.banner.rg b { color: #4A1019; }

.summary { padding: 14px 16px; border: 1px solid var(--indigo-line); border-radius: 12px; background: var(--surface); font-size: 13px; color: var(--ink-2); }
.summary h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--indigo-ink); display: flex; align-items: center; gap: 6px; }
.summary h4 svg { width: 14px; height: 14px; }
.summary p { margin: 0; }

.m { display: flex; gap: 10px; max-width: 78%; }
.m .av { width: 30px; height: 30px; font-size: 11px; margin-top: 18px; }
.m-col { display: flex; flex-direction: column; min-width: 0; }
.m-who { font-size: 11.5px; color: var(--muted); margin: 0 0 3px 2px; display: flex; gap: 6px; align-items: center; }
.m-bubble { padding: 10px 14px; border-radius: 16px 16px 16px 5px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.m-time { font-size: 10.5px; color: var(--muted); margin: 4px 2px 0; }
.m-col .lc-card { min-width: 250px; max-width: 360px; }

.m.ours { margin-left: auto; flex-direction: row-reverse; }
.m.ours .m-col { align-items: flex-end; }
.m.ours .m-who { flex-direction: row-reverse; }
.m.ai .m-bubble { background: var(--indigo-soft); border-color: var(--indigo-line); border-radius: 16px 16px 5px 16px; }
.m.agent .m-bubble { background: var(--amber-soft); border-color: var(--amber-line); border-radius: 16px 16px 5px 16px; }
.m.ai .av { background: var(--indigo); color: #fff; }
.m.agent .av { background: var(--amber); color: #2A1A02; }
.m .av svg { width: 15px; height: 15px; }

.sysline { align-self: center; color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.sysline::before, .sysline::after { content: ""; width: 30px; height: 1px; background: var(--line); }

.why { margin-top: 6px; font-size: 12px; }
.why summary { cursor: pointer; color: var(--indigo-ink); font-weight: 600; list-style: none; display: inline-flex; gap: 6px; align-items: center; }
.why summary::-webkit-details-marker { display: none; }
.why summary::before { content: "+"; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 4px; background: var(--indigo-soft); font-size: 11px; }
.why[open] summary::before { content: "–"; }
.why ol { margin: 8px 0 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-align: left; color: var(--ink-2); }
.why li { margin: 2px 0; }
.why li small { color: var(--muted); display: block; }

.typing-row { color: var(--muted); font-size: 12px; padding: 0 22px 6px; min-height: 20px; }

/* composer */

.composer-wrap { padding: 8px 18px 16px; }

.copilot {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--indigo-line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
}

.copilot .ci { flex: none; width: 24px; height: 24px; border-radius: 7px; background: var(--indigo-soft); color: var(--indigo); display: grid; place-items: center; }
.copilot .ci svg { width: 14px; height: 14px; }
.copilot p { flex: 1; margin: 0; color: var(--ink-2); }
.copilot p b { display: block; color: var(--indigo-ink); font-size: 11.5px; margin-bottom: 1px; }

.canned { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.canned button { flex: none; padding: 4px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); font-size: 12px; color: var(--ink-2); cursor: pointer; }
.canned button:hover { border-color: var(--indigo-line); color: var(--indigo-ink); }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.composer:focus-within { border-color: var(--indigo-line); box-shadow: 0 0 0 3px var(--indigo-soft); }
.composer textarea { flex: 1; min-height: 38px; max-height: 120px; padding: 8px; border: 0; outline: 0; resize: none; background: none; font-size: 14px; }

.locked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--indigo-soft); border: 1px solid var(--indigo-line); color: var(--indigo-ink); font-size: 13px; }
.locked p { flex: 1; margin: 0; }
.locked.wait { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); }

/* player 360 */

.p360 { overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); }
.p360-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 48px 1fr; gap: 2px 12px; align-items: center; }
.p360-head .av { width: 48px; height: 48px; font-size: 16px; grid-row: span 2; }
.p360-head b { font-size: 16px; letter-spacing: -.01em; }
.p360-head small { color: var(--muted); font-size: 12.5px; }
.p360-tags { grid-column: 1 / 3; display: flex; gap: 5px; flex-wrap: wrap; margin-top: 10px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line-2); border-bottom: 1px solid var(--line-2); }
.stats div { padding: 11px 18px; background: var(--surface); }
.stats small { display: block; color: var(--muted); font-size: 11.5px; }
.stats b { font-size: 15px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stats .hl b { color: var(--amber-ink); }

.psec { padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.psec h3 { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); font-weight: 650; display: flex; justify-content: space-between; }
.psec .lc-card { margin-top: 0; }
.psec .lc-card + .lc-card { margin-top: 8px; }
.psec .rgline { padding: 8px 10px; border-radius: 9px; background: var(--rose-soft); color: #7A1F2C; font-size: 12.5px; }
.psec .kv { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.psec .kv span { color: var(--muted); }
.psec textarea { width: 100%; min-height: 64px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; resize: vertical; font-size: 13px; }

.empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; padding: 30px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- page views (rules, ai, analytics) ---------- */

.page { height: 100%; overflow-y: auto; padding: 28px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 640px; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.panel-head small { color: var(--muted); font-size: 12.5px; }
.panel-body { padding: 16px 18px; }

/* rules */

.flow { display: flex; align-items: center; gap: 0; margin-bottom: 18px; padding: 14px 18px; border-radius: var(--radius); background: var(--ink); color: #C9CEE0; font-size: 13px; overflow-x: auto; }
.flow span { flex: none; display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: rgba(255, 255, 255, .08); white-space: nowrap; }
.flow span b { color: #fff; }
.flow i { flex: none; width: 28px; height: 1px; background: rgba(255, 255, 255, .25); }
.flow span.r { background: var(--amber); color: #2A1A02; }
.flow span.r b { color: #2A1A02; }
.flow span.a { background: var(--indigo); color: #fff; }

.rule {
  display: grid;
  grid-template-columns: 26px 44px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}

.rule:last-child { border-bottom: 0; }
.rule.off .rule-main { opacity: .5; }
.rule-n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); color: var(--muted); font-weight: 700; font-size: 12px; margin-top: 2px; }
.rule-main { min-width: 0; }
.rule-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.rule-title small { color: var(--muted); font-weight: 500; font-size: 12px; }
.rule-sent { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.rule-sent select, .rule-sent input, .rule-kw { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink); }
.rule-sent input[type="number"] { width: 110px; }
.rule-kw { width: 100%; margin-top: 8px; font-weight: 450; resize: vertical; min-height: 40px; }
.rule-note { margin-top: 6px; font-size: 12px; color: var(--muted); }
.rule-hits { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rule-hits b { display: block; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.arrow { color: var(--muted); }

.switch { position: relative; width: 40px; height: 24px; margin-top: 1px; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #CBD1DE; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: .2s; }
.switch input:checked + span { background: var(--indigo); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:disabled { cursor: not-allowed; }
.switch input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 2px; }

.tester label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); margin-bottom: 12px; }
.tester select, .tester input, .field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; font-weight: 450; color: var(--ink); width: 100%; }
.tres { padding: 14px; border-radius: 12px; font-size: 13px; }
.tres.ai { background: var(--indigo-soft); color: var(--indigo-ink); }
.tres.hu { background: var(--amber-soft); color: var(--amber-ink); }
.tres b { display: block; font-size: 15px; margin-bottom: 2px; }
.tres ul { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; color: var(--ink-2); }
.tres li { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
.tres li.m { font-weight: 700; color: var(--amber-ink); }

/* ai settings */

.ai-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.prov { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prov label { position: relative; display: block; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.prov label:has(input:checked) { border-color: var(--indigo); background: var(--indigo-soft); }
.prov input { position: absolute; opacity: 0; }
.prov b { display: block; font-size: 14px; }
.prov small { color: var(--muted); font-size: 12px; }
.field { display: grid; gap: 6px; margin-top: 14px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--muted); font-weight: 450; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.toggle-row:first-child { border-top: 0; padding-top: 0; }
.toggle-row small { display: block; color: var(--muted); font-size: 12px; }
.kb-item, .tool-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 2px 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line-2); }
.kb-item:first-child, .tool-item:first-child { border-top: 0; padding-top: 0; }
.kb-ico { grid-row: span 2; width: 34px; height: 34px; border-radius: 9px; background: var(--bg); display: grid; place-items: center; color: var(--muted); font-size: 10.5px; font-weight: 750; }
.kb-item b, .tool-item b { font-size: 13.5px; }
.kb-item small, .tool-item small { grid-column: 2; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-item code { font-family: inherit; font-size: 12px; color: var(--indigo-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips span { padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }
.chips span.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.saved { color: var(--green); font-size: 12.5px; font-weight: 650; opacity: 0; transition: opacity .2s; }
.saved.on { opacity: 1; }

/* analytics */

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi small { display: block; color: var(--muted); font-size: 12.5px; }
.kpi b { display: block; margin: 4px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 26px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi span.up { color: var(--green); }

.charts { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; }
.charts .wide { grid-column: 1 / -1; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--line-2); }
.chart .axis text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .lbl { fill: var(--ink-2); font-size: 12px; font-family: var(--font); }
.chart .val { fill: var(--ink); font-size: 12px; font-weight: 650; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar:hover { opacity: .85; }

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 140px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(15, 24, 52, .14);
  font-size: 12.5px;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 10px));
  white-space: nowrap;
}

.tooltip b { display: block; margin-bottom: 4px; }
.tooltip div { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tooltip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

.compare { display: grid; gap: 14px; }
.compare-row small { display: flex; justify-content: space-between; color: var(--ink-2); font-size: 12.5px; margin-bottom: 6px; }
.compare-row small b { color: var(--ink); font-variant-numeric: tabular-nums; }
.compare-bar { height: 10px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.compare-bar i { display: block; height: 100%; border-radius: 4px; }

/* ---------- brand switcher, queue stats ---------- */

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.brand-sel { position: relative; display: inline-flex; align-items: center; }
.brand-sel i { position: absolute; left: 10px; width: 10px; height: 10px; border-radius: 3px; pointer-events: none; }
.brand-sel select { appearance: none; padding: 7px 28px 7px 27px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%23687089' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center / 14px; font-size: 13px; font-weight: 650; color: var(--ink); cursor: pointer; letter-spacing: 0; }
.queue-head h1 .brand-sel select { font-size: 12.5px; padding-top: 5px; padding-bottom: 5px; }

.qstats { display: flex; gap: 12px; margin: -4px 0 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.qstats b { color: var(--ink); font-variant-numeric: tabular-nums; }

.tag.brand i { width: 7px; height: 7px; border-radius: 2px; }
.tag.watch { background: #EEF0F5; color: var(--ink-2); }
.tag.watch::before { content: ""; width: 12px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
.tag.sla { background: var(--line-2); color: var(--ink-2); }
.tag.sla.warn { background: var(--amber-soft); color: var(--amber-ink); }
.tag.sla.late { background: var(--rose-soft); color: var(--rose); }

/* ---------- internal notes, composer modes ---------- */

.note { align-self: stretch; margin: 0 4%; padding: 10px 14px 8px; border-radius: 12px; background: #FFF8E6; border: 1px dashed #E8C873; color: #5A4200; font-size: 13.5px; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.note-head .av { width: 22px; height: 22px; font-size: 9.5px; background: #F2DB9B; color: #4A3500; }
.note-head b { color: #3D2B00; }
.note-head em { margin-left: auto; font-style: normal; font-weight: 650; color: #8A6A10; }
.note p { margin: 0; white-space: pre-wrap; }
.note small { display: block; margin-top: 4px; font-size: 10.5px; color: #8A6A10; }

.cmodes { display: inline-flex; gap: 2px; margin-bottom: 8px; padding: 3px; border-radius: 10px; background: var(--line-2); }
.cmodes button { padding: 5px 12px; border: 0; border-radius: 8px; background: none; font-size: 12.5px; font-weight: 650; color: var(--muted); cursor: pointer; }
.cmodes button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 24, 52, .1); }
.cmodes button[data-act="mode-note"][aria-selected="true"] { background: #FFF3CF; color: #5A4200; }
.composer.note-mode { background: #FFFBEF; border-color: #EBD493; border-style: dashed; }

/* ---------- menus, toast, dialogs ---------- */

.menu { position: fixed; z-index: 100; width: 300px; max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(15, 24, 52, .2); }
.menu-sec + .menu-sec { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line-2); }
.menu-sec > small { display: block; padding: 6px 10px 4px; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 9px; background: none; text-align: left; cursor: pointer; }
.menu button:hover:not([disabled]), .menu button:focus-visible { background: var(--bg); outline: none; }
.menu button[disabled] { opacity: .45; cursor: not-allowed; }
.menu button span { flex: 1; min-width: 0; }
.menu button b { display: block; font-size: 13.5px; }
.menu button em { display: block; font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu button > small { font-size: 11px; color: var(--rose); font-weight: 650; }
.sdot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: #B6BCCD; }
.sdot.online { background: #2FB879; }
.sdot.busy { background: var(--amber); }
.sdot.break { background: #B6BCCD; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 120; padding: 10px 16px; border-radius: 12px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(15, 24, 52, .18); font-size: 13.5px; font-weight: 600; opacity: 0; transform: translate(-50%, 10px); transition: .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.idlg { width: min(460px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(15, 24, 52, .25); }
.idlg::backdrop { background: rgba(15, 24, 52, .35); }
.idlg form { padding: 22px; }
.idlg h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.015em; }
.idlg p { margin: 0; color: var(--muted); font-size: 13px; }

.rail-me { cursor: pointer; }
.rail-me.busy i { background: var(--amber); }
.rail-me.break i { background: #9AA2BD; }

/* ---------- visitors and team tables ---------- */

.vtable, .ttable { display: grid; }
.vrow { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.4fr) 70px minmax(0, .9fr) 112px; gap: 14px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line-2); font-size: 13px; }
.trow { display: grid; grid-template-columns: minmax(0, 1.5fr) 110px minmax(0, 1fr) 90px 80px 90px; gap: 14px; align-items: center; padding: 11px 18px; border-top: 1px solid var(--line-2); font-size: 13px; }
.vhead, .thead { border-top: 0; padding-top: 10px; padding-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.vrow.hot { background: linear-gradient(90deg, var(--amber-soft), transparent 70%); }
.vwho { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vwho .av { width: 32px; height: 32px; font-size: 11.5px; }
.vwho .av.me { background: var(--amber); color: #2A1A02; }
.vwho div { min-width: 0; }
.vwho b, .vpage b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vwho small, .vpage small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vpage small i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.vtime { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.vact { text-align: right; }
.tload small { display: block; margin-top: 4px; color: var(--muted); font-size: 11.5px; }

.spill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 0; border-radius: 99px; background: var(--line-2); font-size: 12px; font-weight: 650; color: var(--ink-2); }
.spill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #B6BCCD; }
.spill.online { background: var(--green-soft); color: var(--green); }
.spill.online::before { background: #2FB879; }
.spill.busy { background: var(--amber-soft); color: var(--amber-ink); }
.spill.busy::before { background: var(--amber); }
button.spill { cursor: pointer; }
button.spill::after { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }

.slaitem { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line-2); }
.slaitem:first-child { border-top: 0; padding-top: 0; }
.slaitem b { display: block; font-size: 13.5px; }
.slaitem small { color: var(--muted); font-size: 12px; }

/* ---------- translations ---------- */

.m-tr { margin-top: 5px; max-width: 420px; padding: 7px 11px; border-radius: 10px; background: var(--surface); border: 1px dashed var(--line); font-size: 12.5px; color: var(--ink-2); }
.m-tr span { display: inline-block; margin-right: 7px; padding: 1px 6px; border-radius: 5px; background: var(--line-2); font-size: 10.5px; font-weight: 750; color: var(--muted); }
.m-tr.muted { color: var(--muted); font-style: italic; }
.m.ours .m-tr { text-align: left; }
.tag.lang { background: #E8F1FB; color: #1D5D9B; }
.langhint { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: #F1F6FC; color: #24496E; font-size: 12.5px; }
.sug-out { display: block; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; }
.fixit { margin-top: 6px; color: var(--indigo-ink); }

/* ---------- AI training ---------- */

.grid-2.train { grid-template-columns: minmax(0, 1fr) 400px; }
.tchat-panel { display: flex; flex-direction: column; height: min(760px, calc(100vh - 250px)); min-height: 520px; }
.tchat { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; background: var(--bg); }
.tchat-foot { padding: 10px 14px 14px; border-top: 1px solid var(--line-2); }
.mini-sel { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 12.5px; font-weight: 600; }
.rate { display: flex; gap: 6px; margin-top: 8px; justify-content: flex-end; }
.teach { width: min(460px, 100%); padding: 12px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--amber-line); }
.teach .field { margin-top: 0; }
.teach textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 13.5px; width: 100%; resize: vertical; }
.train-side { display: grid; gap: 22px; align-content: start; }
.taught { position: relative; padding: 11px 0; border-top: 1px solid var(--line-2); }
.taught:first-child { border-top: 0; padding-top: 0; }
.taught b { display: block; font-size: 13.5px; padding-right: 50px; }
.taught p { margin: 3px 0 4px; font-size: 13px; color: var(--ink-2); }
.taught small { color: var(--muted); font-size: 11.5px; }
.taught .btn { position: absolute; top: 4px; right: 0; }
.taught:first-child .btn { top: -6px; }
.prompt { margin: 0; max-height: 220px; overflow: auto; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; color: var(--ink-2); }

/* ---------- bubble designer ---------- */

.designer { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 22px; align-items: start; }
.dz .field:first-child { margin-top: 0; }
.dz-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.dz-row:first-child { padding-top: 0; }
.dz-l { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.swatches button { width: 24px; height: 24px; border-radius: 7px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.swatch-custom { position: relative; width: 24px; height: 24px; border-radius: 7px; background: conic-gradient(#E5484D, #F2B544, #1FA36B, #4D9DE0, #8A5CE0, #E5484D); cursor: pointer; overflow: hidden; }
.swatch-custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.segc { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--line-2); }
.segc button { padding: 5px 12px; border: 0; border-radius: 7px; background: none; font-size: 12.5px; font-weight: 650; color: var(--muted); cursor: pointer; }
.segc button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 24, 52, .12); }
.dz input[type="range"] { padding: 0; accent-color: var(--indigo); }
.dz-preview { display: grid; gap: 22px; }
.dz-frame { height: 640px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.dz-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.code { margin: 0; padding: 16px 18px; border-radius: 12px; background: var(--ink); color: #C9CEE0; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; line-height: 1.7; overflow-x: auto; white-space: pre; }
.code .t { color: #8F96FF; }
.code .s { color: #F2D79B; }

/* ---------- responsive ---------- */

.back-mobile { display: none; }

@media (max-width: 1280px) {
  .inbox { grid-template-columns: 290px minmax(0, 1fr) 300px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .vrow { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.3fr) 60px 112px; }
  .vrow > span:nth-child(4) { display: none; }
  .trow { grid-template-columns: minmax(0, 1.4fr) 110px minmax(0, 1fr) 90px; }
  .trow > span:nth-child(n+5) { display: none; }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
  .p360 { display: none; }
  .inbox.show-360 .p360 { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 30; box-shadow: -20px 0 50px rgba(15, 24, 52, .2); }
  .grid-2, .grid-2.train, .ai-grid, .charts, .designer { grid-template-columns: minmax(0, 1fr); }
  .dz-frame { height: 560px; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr 60px; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 0 8px; padding-bottom: env(safe-area-inset-bottom); }
  .rail .rail-logo, .rail .rail-me { display: none; }
  .rail { gap: 0; padding: 0 2px; overflow-x: auto; scrollbar-width: none; }
  .rail a { flex: 1 1 0; min-width: 36px; width: auto; height: 46px; border-radius: 10px; }
  .rail a svg { width: 21px; height: 21px; }
  .rail a .tip { display: none; }
  .rail a[aria-current="page"]::before { left: 12px; right: 12px; top: auto; bottom: -7px; width: auto; height: 3px; border-radius: 3px 3px 0 0; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .conv { display: none; }
  .inbox.show-conv .queue { display: none; }
  .inbox.show-conv .conv { display: flex; }
  .back-mobile { display: inline-flex; }
  .conv-head { padding: 10px 12px; flex-wrap: wrap; }
  .conv-actions { width: 100%; justify-content: flex-start; }
  .conv-body { padding: 14px 12px 8px; }
  .m { max-width: 92%; }
  .m-col .lc-card { min-width: 0; }
  .composer-wrap { padding: 6px 10px 10px; }
  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 22px; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .rule { grid-template-columns: 44px 1fr; }
  .rule-n { display: none; }
  .rule-hits { grid-column: 2; text-align: left; }
  .field-row, .prov { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: minmax(0, 1fr) auto; }
  .vrow .vpage { grid-column: 1 / -1; grid-row: 2; }
  .vrow .vtime, .vrow > span:nth-child(4) { display: none; }
  .vhead { display: none; }
  .trow { grid-template-columns: minmax(0, 1fr) auto; }
  .trow > span:nth-child(n+4), .thead { display: none; }
  .trow .tload { grid-column: 1 / -1; }
}

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