/* Phone Agent dashboard - light, Retell-style layout */
:root {
  --bg: #f5f5fa;          /* app background + sidebar */
  --panel: #ffffff;       /* main content surface */
  --ink: #0a0a0a;
  --ink-2: #5b6170;
  --ink-3: #8b909c;
  --line: #e7e8ee;
  --line-2: #f0f1f5;
  --head: #f1f3f9;        /* table header */
  --hover: #f7f8fb;
  --active: #e9e9f1;      /* active nav item */
  --dark: #262e3b;        /* primary buttons */
  --dark-2: #374151;
  --blue: #3b6fd8;
  --green: #22a06b;
  --red: #e5484d;
  --amber: #c98a00;
  --amber-bg: #fff6dc;
  --brand: #f2b705;       /* tire-yellow, used only in the logo */
  --r-s: 6px;
  --r-m: 8px;
  --r-l: 12px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }
:focus-visible { outline: 2px solid rgba(59, 111, 216, 0.55); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ico svg { display: block; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; height: 100vh; }
.side { padding: 14px 10px 10px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; }
.brand-mark { width: 24px; height: 24px; border-radius: 50%; background: radial-gradient(circle, var(--brand) 0 28%, #11181c 29% 46%, #3c4d56 47% 58%, #11181c 59% 100%); flex: none; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--ink-3); }
.workspace { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 8px 10px; margin: 0 2px 14px; }
.ws-avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 600; background: linear-gradient(135deg, #3b6fd8, #7c5ce0 60%, #4cc3e8); flex: none; }
.ws-k { font-size: 11.5px; color: var(--ink-3); }
.ws-v { font-size: 13.5px; font-weight: 500; line-height: 1.2; }
.nav-group { display: grid; gap: 1px; margin-bottom: 10px; }
.nav-label { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); padding: 6px 10px 4px; }
.nav-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; color: #2b2f38; padding: 7px 10px; border-radius: var(--r-m); cursor: pointer; font-size: 14px; }
.nav-btn .ico { color: #6b7080; }
.nav-btn:hover { background: #ececf3; }
.nav-btn[aria-current="page"] { background: var(--active); color: var(--ink); font-weight: 500; }
.nav-btn[aria-current="page"] .ico { color: var(--blue); }
.side-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 10px; }
.conn { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 9px 12px; font-size: 12.5px; color: var(--ink-2); display: grid; gap: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--ink-3); vertical-align: 1px; }
.dot.ok { background: var(--green); }
.dot.bad { background: var(--red); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

/* The white content surface floats on the grey background, like Retell */
.main { margin: 6px 6px 6px 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 22px 40px; overflow-y: auto; min-width: 0; position: relative; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; min-height: 36px; }
.page-head h1 .ico { color: var(--ink-2); }
.page-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.crumbs { margin-bottom: 8px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 2px 0; color: var(--ink-2); cursor: pointer; font-size: 13px; }
.link-btn:hover { color: var(--ink); }

/* ---------- Controls ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r-m); padding: 7px 12px; cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap; box-shadow: 0 1px 1px rgba(16, 24, 40, 0.04); }
.btn:hover { background: var(--hover); border-color: #d9dbe3; }
.btn.primary, .btn.accent { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn.primary:hover, .btn.accent:hover { background: var(--dark-2); }
.btn.danger { color: var(--red); }
.btn.ghost { background: none; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); }
.btn:disabled { opacity: 0.45; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

label.field { display: grid; gap: 5px; align-content: start; font-size: 13px; font-weight: 500; color: #2b2f38; }
label.field .hint { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
input[type=text], input[type=number], input[type=password], input[type=url], input[type=search], select, textarea {
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); padding: 7px 10px; width: 100%; min-width: 0; font-size: 13.5px;
}
select { padding-right: 28px; }
textarea { resize: vertical; line-height: 1.55; }
textarea.code, .code { font-family: var(--mono); font-size: 12.5px; }
textarea.prompt { min-height: 340px; }
input:focus, select:focus, textarea:focus { border-color: #b9c6ee; outline: none; box-shadow: 0 0 0 3px rgba(59, 111, 216, 0.14); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--dark); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.search-box { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--r-m); padding: 0 10px; background: var(--panel); color: var(--ink-3); min-width: 240px; }
.search-box input { border: 0; padding: 7px 0; box-shadow: none !important; }

/* ---------- Surfaces ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); }
.panel-pad { padding: 16px 18px; }
.section { padding: 18px 20px; border-top: 1px solid var(--line-2); display: grid; gap: 14px; }
.section:first-child { border-top: 0; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-3); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { border: 1px solid var(--line); border-radius: var(--r-l); padding: 12px 14px; }
.stat .k { font-size: 12.5px; color: var(--ink-2); }
.stat .v { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar select { width: auto; min-width: 180px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-m); }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13px; padding: 10px 12px; background: var(--head); white-space: nowrap; }
table.t th:first-child { border-radius: var(--r-m) 0 0 var(--r-m); }
table.t th:last-child { border-radius: 0 var(--r-m) var(--r-m) 0; }
table.t td { padding: 12px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--hover); }
table.t tr[aria-selected] td { background: #eef2fc; }
.dotted { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.dotted::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.dotted.ok::before { background: var(--green); }
.dotted.bad::before { background: var(--red); }
.dotted.info::before { background: var(--blue); }
.dotted.warn::before { display: none; }
.pill { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 99px; background: #f1f2f6; color: #2b2f38; white-space: nowrap; }
.pill.outline { background: var(--panel); border: 1px solid var(--line); }
.name-cell { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.agent-ico { width: 30px; height: 30px; border-radius: var(--r-m); border: 1px solid var(--line); display: grid; place-items: center; color: var(--green); flex: none; }
.voice-cell { display: inline-flex; align-items: center; gap: 8px; }
.voice-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #d08b68, #8f5b46); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 14px 2px 0; font-size: 13px; color: var(--ink-2); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 99px; background: #f1f2f6; color: var(--ink); white-space: nowrap; }
.badge.ok { background: #e3f5ec; color: #12784c; }
.badge.bad { background: #fde8e8; color: #b42318; }
.badge.warn { background: var(--amber-bg); color: #8a5a00; }
.sent { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--ink-3); }
.sent.positive { background: var(--green); }
.sent.negative { background: var(--red); }

/* ---------- Call details drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 18, 25, 0.18); opacity: 0; pointer-events: none; transition: opacity 0.18s; z-index: 30; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 6px; right: 6px; bottom: 6px; width: min(620px, calc(100vw - 12px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: -12px 0 40px rgba(15, 18, 25, 0.12); transform: translateX(105%); transition: transform 0.22s ease; z-index: 31; display: flex; flex-direction: column; }
.drawer.open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { transition: none; } }
.drawer-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
.drawer-body { overflow-y: auto; flex: 1; }
.detail-head { padding: 16px 20px; border-bottom: 1px solid var(--line-2); display: grid; gap: 10px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ink-2); }
.facts b { color: var(--ink); font-weight: 500; }
.summary { padding: 14px 20px; background: #fafbfd; border-bottom: 1px solid var(--line-2); }
.summary p { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; margin-top: 10px; }
.kv dt { color: var(--ink-2); text-transform: capitalize; }
.kv dd { margin: 0; }
audio { width: 100%; height: 36px; }

/* Transcript: caller left, agent right, function calls in between */
.transcript { padding: 16px 20px; display: grid; gap: 8px; }
.turn { max-width: 84%; padding: 8px 12px; border-radius: 12px; font-size: 13.5px; }
.turn .who { font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
.turn.user { justify-self: start; background: #f3f4f7; border-bottom-left-radius: 3px; }
.turn.agent { justify-self: end; background: #eaf0fd; border-bottom-right-radius: 3px; }
.turn.agent.cut { box-shadow: inset -3px 0 0 var(--amber); }
.tool { justify-self: center; width: 94%; border: 1px solid var(--line); border-radius: var(--r-m); font-size: 12.5px; background: #fcfcfd; }
.tool summary { cursor: pointer; padding: 6px 10px; display: flex; gap: 8px; align-items: center; list-style: none; }
.tool summary::-webkit-details-marker { display: none; }
.tool .fn { font-family: var(--mono); font-weight: 600; }
.tool pre { margin: 0; padding: 8px 10px; border-top: 1px solid var(--line-2); white-space: pre-wrap; word-break: break-word; font-size: 12px; max-height: 240px; overflow: auto; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.metric { border: 1px solid var(--line); border-radius: var(--r-m); padding: 8px 10px; }
.metric .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric .k { font-size: 11.5px; color: var(--ink-2); }
details.raw summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }
details.raw pre { font-size: 12px; background: #f6f7f9; padding: 10px; border-radius: var(--r-m); overflow: auto; max-height: 400px; }

.empty { padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

/* ---------- Editors (agents / functions) ---------- */
.editor-layout { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.list-nav { list-style: none; margin: 0; padding: 6px; }
.list-nav li button { width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--r-m); cursor: pointer; display: grid; gap: 1px; }
.list-nav li button:hover { background: var(--hover); }
.list-nav li button[aria-current="true"] { background: var(--active); }
.list-nav .sub { font-size: 12px; color: var(--ink-3); }
.save-bar { position: sticky; bottom: 0; background: #fff; z-index: 2; border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 8px; justify-content: flex-end; align-items: center; border-radius: 0 0 var(--r-l) var(--r-l); }
.dirty { color: var(--amber); font-size: 12.5px; margin-right: auto; }
.fn-pick { display: grid; gap: 6px; }
.fn-pick .check { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-m); }
.fn-pick .check small { display: block; color: var(--ink-3); }
.analysis-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; }

/* Test chat */
.chat { display: grid; grid-template-rows: auto 1fr auto; height: 560px; }
.chat-log { overflow: auto; padding: 14px; display: grid; gap: 8px; align-content: start; background: #fafbfd; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line-2); }

.copy { display: flex; gap: 8px; align-items: center; background: #f6f7f9; border: 1px solid var(--line); border-radius: var(--r-m); padding: 5px 5px 5px 10px; }
.copy code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: 12.5px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--bg); }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l); padding: 28px; width: min(380px, 100%); display: grid; gap: 16px; box-shadow: 0 8px 30px rgba(15, 18, 25, 0.06); }
.login .brand { padding: 0; }
.error { color: var(--red); font-size: 13px; margin: 0; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--dark); color: #fff; padding: 9px 16px; border-radius: var(--r-m); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50; font-size: 13.5px; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--red); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; height: auto; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px; }
  .brand { padding: 0 8px; }
  .workspace, .nav-label, .side-foot .conn { display: none; }
  .nav-group { display: flex; margin: 0; }
  .nav-btn { padding: 6px 9px; font-size: 13px; width: auto; }
  .side-foot { margin: 0; padding: 0; }
  .main { margin: 0 6px 6px; padding: 14px 14px 40px; overflow: visible; }
  .editor-layout, .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .analysis-row { grid-template-columns: 1fr; }
  .search-box { min-width: 0; flex: 1; }
}

/* Cartesia voice browser */
.voice-browser { display: grid; gap: 10px; }
.vb-rows { max-height: 380px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--panel); }
.vb-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.vb-row:last-child { border-bottom: 0; }
.vb-row:hover { background: var(--hover); }
.vb-row.on { background: var(--head); }
.vb-name { flex: 1; min-width: 0; }
.vb-name .pill { margin-left: 6px; }
@media (max-width: 640px) { .vb-row { flex-wrap: wrap; } .vb-name { flex-basis: 100%; } }

/* Voice test panel */
.vt { margin-bottom: 18px; }
.vt-status { font-size: 13px; color: var(--ink-2); padding: 3px 10px; border-radius: 99px; background: #f1f2f6; white-space: nowrap; }
.vt-status.ok { background: #e3f6ec; color: #15774a; }
.vt-status.bad { background: #fdecec; color: #b3261e; }
.vt-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); }
.vt-col { display: flex; flex-direction: column; min-width: 0; height: 380px; }
.vt-col + .vt-col { border-left: 1px solid var(--line); }
.vt-head { padding: 8px 14px; font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line-2); background: var(--head); }
.vt-col .chat-log { flex: 1; }
.vt-log { flex: 1; overflow: auto; padding: 8px 12px; font-family: var(--mono); font-size: 12px; line-height: 1.5; background: #fafbfd; }
.vt-line { display: flex; gap: 10px; padding: 2px 0; border-bottom: 1px dotted var(--line-2); }
.vt-line .vt-t { color: var(--ink-3); flex: 0 0 56px; white-space: pre; }
.vt-line.warn { color: #b3261e; }
.vt-line.talk { color: #15774a; }
.vt-meter { width: 70px; height: 8px; border-radius: 4px; background: #e7e8ee; overflow: hidden; }
.vt-meter-bar { height: 100%; width: 0; background: var(--green); transition: width .1s; }
@media (max-width: 800px) { .vt-body { grid-template-columns: 1fr; } .vt-col + .vt-col { border-left: 0; border-top: 1px solid var(--line); } .vt-col { height: 280px; } }

/* =====================================================================
   Agent workspace - Retell-style 3-column editor (no long page)
   ===================================================================== */
body.ws-mode .shell { grid-template-columns: 1fr; }
body.ws-mode .side { display: none; }
body.ws-mode .main { margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); overflow: hidden; height: 100vh; }
.ws { display: grid; grid-template-columns: 64px 1fr; height: 100vh; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; background: #fff; border-right: 1px solid var(--line); }
.rail-home { background: none; border: 0; padding: 4px; margin-bottom: 10px; cursor: pointer; border-radius: 50%; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 56px; padding: 7px 2px; background: none; border: 0; border-radius: var(--r-m); color: var(--ink-2); font-size: 11px; cursor: pointer; }
.rail-btn:hover { background: var(--hover); color: var(--ink); }
.rail-btn[aria-current="page"] { color: var(--blue); }
.rail-btn[aria-current="page"] .ico { background: #e8eefc; border-radius: 7px; }
.rail-btn .ico { width: 30px; height: 26px; }
.ws-main { display: grid; grid-template-rows: auto 1fr; min-width: 0; min-height: 0; }
.ws-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); min-width: 0; }
.ws-name { font-size: 16px !important; font-weight: 600; border: 1px solid transparent !important; background: transparent !important; padding: 4px 6px !important; width: auto !important; max-width: 420px; box-shadow: none !important; }
.ws-name:hover { border-color: var(--line) !important; }
.ws-name:focus { border-color: #b9c6ee !important; background: #fff !important; }
.ws-top .dirty { margin: 0 4px 0 0; }
.btn.icon-only { padding: 7px 8px; }
.btn.on { background: var(--active); }
.pop-anchor { position: relative; }
.ws-menu, .pop { position: absolute; z-index: 30; background: #fff; border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: 0 10px 30px rgba(16, 24, 40, .12); }
.ws-menu { right: 0; top: calc(100% + 6px); min-width: 180px; padding: 5px; display: grid; }
.ws-menu[hidden], .pop[hidden] { display: none; }
.ws-menu button { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--r-s); cursor: pointer; font-size: 13.5px; }
.ws-menu button:hover { background: var(--hover); }
.ws-menu button.danger { color: var(--red); }
.pop { left: 0; top: calc(100% + 6px); width: 260px; padding: 14px; display: grid; gap: 12px; }

.ws-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.95fr) minmax(300px, 0.95fr); gap: 6px; padding: 6px; min-height: 0; }
.ws-grid.no-test { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); }
.ws-grid.no-test .ws-test { display: none; }
.left-slot { display: grid; min-height: 0; min-width: 0; }
.ws-col { background: #fff; border: 1px solid var(--line); border-radius: var(--r-l); min-height: 0; min-width: 0; overflow: auto; }

/* left column */
.ws-left { display: flex; flex-direction: column; overflow: hidden; padding: 0 12px 12px; }
.ws-details { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 12.5px; padding: 10px 2px 8px; border-bottom: 1px solid var(--line-2); }
.id-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-3); background: none; border: 1px solid var(--line); border-radius: var(--r-s); padding: 1px 6px; cursor: pointer; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 0; }
.chip-row .chip { padding: 6px 9px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: var(--r-m); padding: 6px 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; white-space: nowrap; max-width: 100%; }
.chip:hover { background: var(--hover); }
.chip.icon-only { padding: 7px 8px; }
.chip .ico:last-child { color: var(--ink-3); }
.chip-dot { width: 18px; height: 18px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd27a, #c9772b); flex: none; }
.chip-wrap { padding: 0 0 0 10px; cursor: default; }
select.chip-select { border: 0 !important; box-shadow: none !important; background-color: transparent !important; font-weight: 500; padding: 6px 28px 6px 2px !important; width: auto; max-width: 170px; text-overflow: ellipsis; }
.prompt-box { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.prompt-box textarea.prompt { flex: 1; min-height: 0; height: 100%; border: 0 !important; border-radius: 0; resize: none; box-shadow: none !important; padding: 10px 12px; font-size: 13.5px; line-height: 1.5; }
.prompt-foot { padding: 5px 12px; border-top: 1px solid var(--line-2); background: #fafbfd; }
.welcome { display: grid; gap: 6px; padding-top: 10px; }
.welcome-head { font-size: 14px; }
.sel-box { position: relative; display: block; }
.sel-box select { appearance: none; -webkit-appearance: none; width: 100%; padding-right: 32px; }
.sel-box .ico { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.in-box input { width: 100%; }
.flow-body { overflow: auto; flex: 1; min-height: 0; padding: 12px 2px 4px; }
.flow-body .tool { width: 100%; }

/* middle column: accordions */
.ws-mid { padding: 4px 12px; }
.acc { border-bottom: 1px solid var(--line); }
.acc:last-child { border-bottom: 0; }
.acc summary { display: flex; align-items: center; gap: 10px; padding: 13px 2px; cursor: pointer; list-style: none; font-weight: 500; font-size: 14.5px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary .ico { color: var(--ink-2); }
.acc-chev { transition: transform .15s; display: inline-flex; }
.acc[open] .acc-chev { transform: rotate(180deg); }
.acc-body { display: grid; gap: 12px; padding: 2px 2px 16px; }
.acc-body .field { display: grid; gap: 5px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acc-body .analysis-row { grid-template-columns: 1fr; }
.acc-body .vb-rows { max-height: 300px; }
.acc-body .vb-row { flex-wrap: wrap; }

/* right column: test panel */
.ws-test { display: flex; flex-direction: column; overflow: hidden; }
.test-tabs { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.seg { display: inline-flex; background: #f1f2f6; border-radius: var(--r-m); padding: 3px; }
.seg-btn { background: none; border: 0; padding: 5px 10px; border-radius: var(--r-s); font-size: 13px; color: var(--ink-3); cursor: pointer; font-weight: 500; }
.seg-btn.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.test-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.test-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; }
.test-mic { color: #c4c7d0; }
.test-empty .note { margin: 0; font-size: 12.5px; color: var(--ink-2); background: #f5f6f9; border-radius: var(--r-m); padding: 7px 10px; max-width: 300px; }
/* the existing voice/text testers, squeezed into the narrow column */
.test-body > .panel { flex: 1; min-height: 0; border: 0; border-radius: 0; margin: 0 !important; height: auto; display: flex; flex-direction: column; }
.test-body .panel-pad { padding: 10px 12px; }
.test-body .panel-pad h3 { display: none; }
.test-body .panel-pad input { max-width: none !important; flex: 1 1 100%; order: 9; }
.test-body .chat-log { flex: 1; min-height: 0; }
.test-body .vt-body { grid-template-columns: 1fr; grid-template-rows: 1.4fr 1fr; flex: 1; min-height: 0; }
.test-body .vt-col { height: auto; min-height: 0; }
.test-body .vt-col + .vt-col { border-left: 0; border-top: 1px solid var(--line); }
.test-body .chat-form.muted { font-size: 11.5px; }

/* smaller screens: drop the test column to an overlay, then stack */
@media (max-width: 1180px) {
  .ws-grid { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); position: relative; }
  .ws-test { position: absolute; right: 6px; top: 6px; bottom: 6px; width: min(380px, 92%); z-index: 20; box-shadow: -10px 0 30px rgba(16, 24, 40, .12); }
}
@media (max-width: 760px) {
  body.ws-mode .main { overflow: auto; height: auto; min-height: 100vh; }
  .ws { grid-template-columns: 1fr; height: auto; }
  .rail { flex-direction: row; justify-content: flex-start; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .rail-home { margin: 0 6px 0 0; }
  .rail .grow { display: none; }
  .ws-top { flex-wrap: wrap; position: sticky; top: 0; z-index: 25; }
  .ws-grid, .ws-grid.no-test { grid-template-columns: 1fr; padding: 6px; }
  .ws-left { overflow: visible; }
  .prompt-box { min-height: 60vh; }
  .ws-col { overflow: visible; }
  .ws-test { position: fixed; inset: 0; width: auto; border-radius: 0; }
  .two { grid-template-columns: 1fr; }
}

/* popover lists: model picker, version history */
.pop-list { width: 340px; padding: 6px; gap: 0; }
.pop-right { left: auto; right: 0; }
.pop-title { font-weight: 600; font-size: 13px; padding: 6px 10px 8px; }
.pop-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: var(--r-m); cursor: pointer; font-size: 13.5px; }
.pop-row:hover { background: var(--hover); }
.pop-row.on { background: var(--head); }
.pop-row b { display: block; font-weight: 500; }
.pop-row small { display: block; color: var(--ink-3); font-size: 12px; }
.pop-check { color: var(--blue); font-weight: 600; }
.brand-ico { color: #0f0f0f; }
.ver-row { cursor: default; }
.ver-row.viewing { outline: 1px solid #b9c6ee; }
.ver-num { font-family: var(--mono); font-size: 12px; background: #f1f2f6; border-radius: var(--r-s); padding: 2px 6px; min-width: 36px; text-align: center; }
.btn.small { padding: 4px 8px; font-size: 12.5px; }
.ws-top.previewing { background: #fff8e6; border-bottom-color: #f1dca3; }
.ver-banner { display: flex; align-items: center; gap: 8px; margin: 6px 6px 0; padding: 8px 12px; background: var(--amber-bg); border: 1px solid #f1dca3; border-radius: var(--r-m); font-size: 13px; color: #6b4a00; }
.ws-main { grid-template-rows: auto auto 1fr; }
.ws-main > .ws-grid:nth-child(2) { grid-row: 2 / span 2; }

/* Retell-style option controls */
.ws-stat { font-weight: 500; }
.lang-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-bottom: 10px; }
.opt-group { display: grid; gap: 8px; }
.opt-title { font-weight: 600; font-size: 13.5px; }
.opt-title small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.radios { display: grid; gap: 6px; }
.radios.inline { display: flex; gap: 12px; }
.radio { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.radio input { margin-top: 3px; accent-color: var(--dark); }
.radio small { display: block; color: var(--ink-3); font-size: 12px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; background: #d6d8e0; border-radius: 99px; transition: background .15s; }
.switch .track::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .track { background: var(--dark); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid rgba(59,111,216,.55); outline-offset: 2px; }
.toggle-row { display: grid; gap: 10px; }
.toggle-head { display: flex; align-items: flex-start; gap: 12px; }
.toggle-head b { display: block; font-weight: 600; font-size: 13.5px; }
.toggle-head small { color: var(--ink-3); font-size: 12px; display: block; }
.toggle-body .sub { display: grid; gap: 10px; padding: 10px 12px; background: #fafbfd; border: 1px solid var(--line-2); border-radius: var(--r-m); }
.toggle-body .sub.three { grid-template-columns: 1fr 1fr 1fr; }
.ex-list { display: grid; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.ex-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line-2); }
.ex-row:first-child { border-top: 0; }
.ex-row b { display: block; font-size: 13.5px; font-weight: 500; }
.ex-row small { color: var(--ink-3); font-size: 12px; }
.ok { color: var(--green); }

/* Build with AI */
.build { display: flex; flex-direction: column; gap: 10px; padding: 12px; overflow: auto; flex: 1; min-height: 0; }
.build textarea { width: 100%; resize: vertical; }
.build-result { display: grid; gap: 12px; }
.build-sum { background: #f5f6f9; border-radius: var(--r-m); padding: 10px 12px; font-size: 13px; }
.build-sum p { margin: 4px 0 0; }
.build-sum ul { margin: 6px 0 0; padding-left: 18px; }
.build-q { margin-top: 8px; color: #6b4a00; background: var(--amber-bg); border-radius: var(--r-s); padding: 8px 10px; }
.diff { font-family: var(--mono); font-size: 12px; line-height: 1.45; border: 1px solid var(--line); border-radius: var(--r-m); overflow: auto; max-height: 420px; background: #fff; }
.d-line { padding: 1px 10px; white-space: pre-wrap; word-break: break-word; }
.d-line.da { background: #e6f7ee; color: #0d5a35; }
.d-line.dr { background: #fdecec; color: #8f1d1d; text-decoration: line-through; text-decoration-color: rgba(143,29,29,.35); }
.d-line.dc { color: var(--ink-2); }
.d-skip { padding: 2px 10px; color: var(--ink-3); background: #fafbfd; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); font-size: 11.5px; }
@media (max-width: 760px) { .toggle-body .sub.three { grid-template-columns: 1fr; } .lang-grid { grid-template-columns: 1fr; } }
.gbox { display: grid; gap: 12px; justify-items: center; margin: 4px 0 6px; }
.or { width: 100%; text-align: center; position: relative; color: var(--ink-3); font-size: 12px; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: #fff; padding: 0 8px; position: relative; }
.cost-box { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; }
.cost-t td { padding: 6px 8px; vertical-align: top; }
.cost-t td.num { white-space: nowrap; font-variant-numeric: tabular-nums; width: 90px; text-align: right; }
