:root {
  --bg: #090b09;
  --panel: #101310;
  --panel-2: #151915;
  --line: #293029;
  --text: #f4f6f1;
  --muted: #899187;
  --accent: #76b900;
  --accent-bright: #8fd400;
  --danger: #ff685f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 50% -20%, rgba(118,185,0,.08), transparent 38%), var(--bg); }
button { font: inherit; }
[hidden] { display: none !important; }

.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(440px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 18px; text-align: center; background: rgba(16,19,16,.94); box-shadow: 0 30px 90px rgba(0,0,0,.45); }
.auth-card .mark { margin: 0 auto 24px; }
.auth-card .mark-auth { width: 116px; height: 98px; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .2em; }
.auth-card h1 { margin: 12px 0; font-size: 27px; font-weight: 570; }
.auth-card p { color: var(--muted); line-height: 1.6; }
.auth-card button, .call { border: 0; color: #11150d; background: var(--accent); cursor: pointer; }
.auth-card button { min-width: 150px; padding: 12px 20px; border-radius: 8px; font-weight: 750; }

.app { min-height: 100vh; display: grid; grid-template-rows: 72px minmax(0, 1fr) auto; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 clamp(20px, 5vw, 70px); border-bottom: 1px solid var(--line); background: rgba(9,11,9,.9); }
.brand, .topbar-actions { display: flex; align-items: center; gap: 13px; }
.topbar-actions { align-self: stretch; margin-left: auto; }
.topbar > .view-tabs { align-self: stretch; min-height: 0; margin-left: 18px; padding: 0 12px; border: 0; }
.topbar .view-tab { height: 72px; white-space: nowrap; }
.panel-toggle { order: 11; min-width: 104px; min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: var(--panel); cursor: pointer; font-size: 9px; font-weight: 750; }
.panel-toggle:hover { color: var(--accent-bright); border-color: rgba(118,185,0,.45); }
.input-language { display: grid; gap: 3px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .12em; }
.input-language select { width: 154px; min-height: 32px; padding: 0 26px 0 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--panel); font: 650 10px Inter, ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; cursor: pointer; }
.input-language select:disabled { opacity: .6; cursor: not-allowed; }
.brand strong { display: block; font-size: 14px; }
.mark { display: grid; place-items: center; width: 54px; height: 45px; overflow: hidden; }
.mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.status { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.status i, .conversation-header i { width: 7px; height: 7px; border-radius: 50%; background: #596058; }
.status[data-state="active"] i, .status[data-state="speaking"] i, .conversation-header i { background: var(--accent); box-shadow: 0 0 10px rgba(118,185,0,.65); }
.status[data-state="error"] { color: #ffaaa5; }
.status[data-state="error"] i { background: var(--danger); }
.quiet { border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.quiet:hover { color: var(--accent-bright); }
#auth-user { color: var(--muted); font-size: 10px; }

.workspace { --discovery-width: min(42vw, 620px); min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 7px minmax(300px, var(--discovery-width)); }
.workspace.panel-hidden { grid-template-columns: minmax(0, 1fr) 0 0; }
.workspace.panel-hidden .discovery, .workspace.panel-hidden .panel-resizer { visibility: hidden; overflow: hidden; }
.conversation { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.panel-resizer { position: relative; z-index: 3; width: 7px; cursor: col-resize; background: var(--line); touch-action: none; }
.panel-resizer::after { content: ""; position: absolute; inset: 0 2px; background: transparent; transition: background .15s ease; }
.panel-resizer:hover::after, .panel-resizer:focus-visible::after, body.resizing-panel .panel-resizer::after { background: var(--accent); }
.panel-resizer:focus-visible { outline: 1px solid var(--accent); outline-offset: -1px; }
body.resizing-panel { cursor: col-resize; user-select: none; }
.view-tabs { display: flex; align-items: end; gap: 22px; }
.view-tab { position: relative; height: 54px; padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 10px; font-weight: 760; }
.view-tab::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: transparent; }
.view-tab.is-active { color: var(--text); }
.view-tab.is-active::after { background: var(--accent); }
.transcript { flex: 1; min-height: 0; max-height: calc(100vh - 214px); padding: 38px clamp(22px, 7vw, 110px) 120px; overflow-y: auto; }
.empty-state { min-height: 56vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state h2 { margin: 22px 0 7px; font-size: 19px; font-weight: 560; }
.empty-state p { margin: 0; color: var(--muted); font-size: 11px; }
.orb { display: flex; align-items: center; justify-content: center; gap: 4px; width: 76px; height: 76px; border: 1px solid rgba(118,185,0,.25); border-radius: 50%; background: radial-gradient(circle, rgba(118,185,0,.15), transparent 70%); }
.orb i { width: 2px; height: 13px; border-radius: 4px; background: var(--accent); }
.orb i:nth-child(2), .orb i:nth-child(4) { height: 25px; }
.orb i:nth-child(3) { height: 36px; }
.message { display: flex; gap: 12px; max-width: min(820px, 88%); margin: 0 0 27px; animation: message-in .22s ease-out; }
.message.user { flex-direction: row-reverse; margin-left: auto; }
.avatar { flex: 0 0 auto; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(118,185,0,.3); border-radius: 6px; color: var(--accent-bright); font-size: 8px; font-weight: 800; }
.message.user .avatar { color: #10140d; border-color: var(--accent); background: var(--accent); }
.message-content { min-width: 0; }
.message-meta { margin: 0 0 6px; color: #717970; font-size: 8px; font-weight: 750; letter-spacing: .1em; }
.message.user .message-meta { text-align: right; }
.bubble { padding: 15px 18px; border: 1px solid var(--line); border-radius: 4px 16px 16px; color: #e5e9e1; background: var(--panel-2); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.message.user .bubble { color: #10140d; border-color: var(--accent); border-radius: 16px 4px 16px 16px; background: var(--accent); }
.message.pending .bubble::after { content: "|"; margin-left: 2px; animation: blink .8s steps(1) infinite; }

.discovery { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: linear-gradient(180deg, rgba(15,19,15,.93), rgba(9,11,9,.98)); }
.discovery-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 28px clamp(22px, 4vw, 54px) 24px; border-bottom: 1px solid var(--line); }
.discovery-eyebrow { display: flex; align-items: center; gap: 9px; color: var(--accent-bright); font-size: 9px; font-weight: 850; letter-spacing: .18em; }
.discovery-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px rgba(118,185,0,.68); }
.discovery-header h2 { margin: 12px 0 6px; font-size: clamp(24px, 2.4vw, 38px); font-weight: 570; letter-spacing: -.035em; }
.discovery-header p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.capture-state { flex: 0 0 auto; padding: 9px 12px; border: 1px solid rgba(118,185,0,.25); border-radius: 8px; color: var(--accent-bright); background: rgba(118,185,0,.08); font-size: 8px; font-weight: 850; letter-spacing: .15em; }
.discovery-content { min-height: 0; overflow-y: auto; padding: 28px clamp(22px, 4vw, 54px) 120px; }
.discovery-empty { min-height: 240px; display: grid; place-content: center; gap: 8px; text-align: center; color: var(--muted); }
.discovery-empty strong { color: #c7cec3; font-size: 14px; font-weight: 600; }
.discovery-empty span { font-size: 10px; }
.discovery-section { margin: 0 0 22px; }
.discovery-section h3 { margin: 0 0 10px; color: var(--accent-bright); font-size: 9px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.discovery-cards { display: grid; gap: 9px; }
.discovery-card { position: relative; overflow: hidden; display: grid; gap: 5px; padding: 14px 15px 14px 17px; border: 1px solid var(--line); border-radius: 11px; background: rgba(20,24,20,.78); }
.discovery-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 2px; background: rgba(118,185,0,.7); }
.discovery-card.is-new { animation: discovery-in .55s ease-out, discovery-glow 1.6s ease-out; }
.discovery-label { color: var(--muted); font-size: 9px; font-weight: 700; }
.discovery-value { color: #edf1e9; font-size: 13px; font-weight: 560; line-height: 1.45; overflow-wrap: anywhere; }
.discovery-footer { min-height: 42px; display: flex; align-items: center; padding: 0 clamp(22px, 4vw, 54px); border-top: 1px solid var(--line); color: #687067; font-size: 9px; }
.workspace.dashboard-mode { display: block; overflow-y: auto; }
.workspace.dashboard-mode .panel-resizer { display: none; }
.customer-dashboard { min-height: 100%; padding: 48px clamp(22px, 7vw, 110px) 130px; }
.dashboard-header { max-width: 760px; margin-bottom: 30px; }
.dashboard-header h1 { margin: 12px 0 7px; font-size: clamp(30px, 4vw, 52px); font-weight: 570; letter-spacing: -.04em; }
.dashboard-header > p:last-child { margin: 0; color: var(--muted); font-size: 12px; }
.customer-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; }
.customer-card { width: 100%; padding: 20px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); text-align: left; background: var(--panel-2); cursor: pointer; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.customer-card:hover, .customer-card:focus-visible { border-color: rgba(118,185,0,.55); background: #181d18; transform: translateY(-2px); outline: none; }
.customer-card-heading { display: flex; justify-content: space-between; gap: 16px; }
.customer-card h2 { margin: 0 0 5px; font-size: 17px; font-weight: 620; }
.customer-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.customer-card time { flex: 0 0 auto; color: #687067; font-size: 8px; }
.customer-card .customer-use-case { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: #dce2d8; font-size: 12px; }
.customer-detail { max-width: 1050px; }
.customer-back { margin: 0 0 24px; padding: 0; color: var(--accent-bright); background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.customer-detail-header { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.customer-detail-header h1 { margin: 0 0 7px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.04em; }
.customer-detail-header p, .customer-detail-header time { margin: 0; color: var(--muted); font-size: 11px; }
.customer-detail-content { display: grid; gap: 28px; padding-top: 30px; }
.customer-detail-section h2 { margin: 0 0 12px; color: var(--accent-bright); font-size: 10px; letter-spacing: .13em; text-transform: uppercase; }
.customer-detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.customer-detail-section ul { margin: 0; padding-left: 20px; color: #e5eae1; font-size: 13px; line-height: 1.7; }

.controls { position: fixed; z-index: 5; left: calc((100vw - var(--discovery-width, min(42vw, 620px)) - 7px) / 2); bottom: 18px; transform: translateX(-50%); width: min(600px, calc(100vw - var(--discovery-width, min(42vw, 620px)) - 35px)); min-height: 76px; display: grid; grid-template-columns: 54px 1fr 60px; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 15px; background: rgba(17,21,17,.96); box-shadow: 0 18px 60px rgba(0,0,0,.45); transition: left .18s ease, width .18s ease; }
.app.panel-hidden .controls, .app.dashboard-view .controls { left: 50%; width: min(600px, calc(100% - 28px)); }
body.resizing-panel .controls { transition: none; }
.mute { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; font-weight: 800; }
.mute.is-muted { color: #ffaaa5; border-color: rgba(255,104,95,.35); }
.call { height: 52px; display: flex; align-items: center; justify-content: center; gap: 12px; border-radius: 10px; }
.call:disabled { opacity: .6; cursor: wait; }
.call strong, .call small { display: block; }
.call strong { font-size: 12px; }
.call small { margin-top: 2px; opacity: .68; font-size: 8px; }
.call.is-active { color: var(--text); background: #252b25; }
.call-icon { font-size: 10px; }
#session-timer { color: var(--muted); text-align: center; font: 600 10px ui-monospace, monospace; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 110px; max-width: min(460px, calc(100% - 36px)); padding: 12px 16px; border: 1px solid rgba(255,104,95,.35); border-radius: 9px; color: #ffd3d0; background: rgba(44,15,13,.97); opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: .18s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

@keyframes blink { 50% { opacity: 0; } }
@keyframes message-in { from { opacity: 0; transform: translateY(7px); } }
@keyframes discovery-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes discovery-glow { 0%, 22% { border-color: rgba(143,212,0,.75); box-shadow: 0 0 0 1px rgba(118,185,0,.15), 0 0 28px rgba(118,185,0,.14); } 100% { border-color: var(--line); box-shadow: none; } }
@media (max-width: 980px) {
  .workspace, .workspace.panel-hidden { grid-template-columns: 1fr; overflow-y: auto; }
  .controls { left: 50%; width: min(600px, calc(100% - 28px)); }
  .panel-resizer { display: none; }
  .workspace.panel-hidden .discovery { display: none; }
  .conversation { min-height: 62vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .transcript { max-height: none; }
  .discovery { min-height: 48vh; }
  .discovery-content { padding-bottom: 110px; }
}
@media (max-width: 680px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .topbar-actions { gap: 7px; }
  #auth-user, #logout-button, .input-language { display: none; }
  .topbar .view-tabs { gap: 12px; margin-left: 0; padding: 0; }
  .topbar .view-tab { height: 72px; font-size: 9px; }
  .panel-toggle { min-width: 45px; padding: 0 7px; font-size: 0; }
  .panel-toggle::after { content: "Panel"; font-size: 9px; }
  .input-language select { width: 136px; }
  .brand strong { max-width: 150px; line-height: 1.2; }
  .transcript { padding-left: 17px; padding-right: 17px; }
  .message { max-width: 96%; }
  .discovery-header { padding: 22px 17px 18px; }
  .discovery-content { padding: 20px 17px 110px; }
  .capture-state { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
