:root {
  --bg: #0e1220;
  --panel: #161b2e;
  --panel-2: #1d2440;
  --line: #2a3350;
  --text: #e6e9f5;
  --muted: #8b93b4;
  --accent: #6c8cff;
  --accent-2: #9db4ff;
  --ok: #3ecf8e;
  --warn: #f5b84b;
  --danger: #f56b6b;
  --radius: 12px;
  --mono: "Cascadia Code", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2340 0%, var(--bg) 55%);
  color: var(--text);
}

.hidden { display: none !important; }

.screen { min-height: 100vh; }

/* ---------- landing ---------- */
#landing { display: flex; align-items: center; justify-content: center; padding: 40px 16px; }
.landing-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 34px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}
.brand { text-align: center; margin-bottom: 22px; }
.brand .logo { font-size: 44px; }
.brand h1 { margin: 6px 0 2px; font-size: 30px; letter-spacing: .5px; }
.brand .tagline { margin: 0; color: var(--muted); font-size: 13.5px; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
select, input, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 11px 12px;
  font-size: 14.5px;
  font-family: inherit;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #5a6285; }

.start-row { display: flex; gap: 10px; margin-top: 20px; }
button {
  border: none; border-radius: 9px; padding: 11px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
button.primary { background: var(--accent); color: #fff; flex: 1; }
button.primary:hover { background: var(--accent-2); }
button.primary:disabled { background: #3a4470; color: #98a0c5; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { color: var(--text); border-color: var(--muted); }
button.danger { background: transparent; color: #e05f6e; border: 1px solid #e05f6e55; }
button.danger:hover { background: #e05f6e18; border-color: #e05f6e; }
button.small { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
.reset-row { margin-top: 18px; display: flex; justify-content: center; }

/* completed interviews on the home page */
#completedSessions { margin-top: 6px; }
#completedSessions .completed-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#completedSessions .completed-item .view-btn {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 12px; padding: 3px 10px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
}
#completedSessions .completed-item .view-btn:hover { border-color: var(--accent); }

/* report viewer modal */
#reportDialog { width: min(860px, 94vw); max-height: 88vh; padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal-head h3 { margin: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tab {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.report-view {
  white-space: pre-wrap; word-break: break-word; max-height: 66vh; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; font-size: 13px; line-height: 1.5; margin: 0;
}

.mode-note { margin-top: 14px; font-size: 12px; color: var(--warn); text-align: center; min-height: 16px; }
.recent { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.recent h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li { font-size: 13px; padding: 7px 4px; border-bottom: 1px solid #202642; cursor: pointer; }
.recent li:hover { color: var(--accent-2); }
.recent .pill { font-size: 10.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 20px; padding: 2px 8px; margin-left: 6px; }
.pill.done { color: var(--ok); }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; background: rgba(14, 18, 32, .85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar .title { font-size: 17px; font-weight: 700; }
.topbar .subtitle { font-size: 12.5px; color: var(--muted); }
.topbar-right { display: flex; gap: 8px; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line); }
.chip-outline { background: transparent; }
.chip.ok { color: var(--ok); border-color: var(--ok); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; padding: 16px 20px; height: calc(100vh - 64px); }
.chat-col { display: flex; flex-direction: column; min-width: 0; }
.chat { flex: 1; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.chat-form { display: flex; gap: 10px; margin-top: 12px; }
.chat-form input { flex: 1; }

/* talk mode (voice) */
.talk-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); }
.talk-bar .talk-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: talkPulse 1.6s infinite; }
.talk-bar.live .talk-dot { background: #46a758; }
.talk-bar .small { font-size: 12.5px; padding: 6px 10px; }
#talkStatus { font-size: 12.5px; color: var(--muted); flex: 1; }
@keyframes talkPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.msg { margin-bottom: 14px; max-width: 82%; }
.msg .bubble { padding: 11px 14px; border-radius: 14px; font-size: 14.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.msg.user { margin-left: auto; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.system .bubble { background: transparent; color: var(--muted); border: 1px dashed var(--line); font-size: 13px; }
.msg .meta { font-size: 11px; color: var(--muted); margin: 4px 2px 0; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-actions button { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); font-size: 12.5px; padding: 7px 11px; border-radius: 8px; }
.quick-actions button:hover { border-color: var(--accent); }

/* typing / activity indicator */
.chat-col #typing { margin-top: 8px; }
.typing-bubble { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.typing-bubble .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: blink 1.2s infinite;
}
.typing-bubble .dot:nth-child(2) { animation-delay: .2s; }
.typing-bubble .dot:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }


/* ---------- sidebar ---------- */
.side-col { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 2px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.progress-list { display: flex; flex-direction: column; gap: 9px; }
.phase { font-size: 12.5px; }
.phase .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.phase .name { color: var(--text); }
.phase .pct { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 6px; transition: width .3s; }
.bar > div.full { background: var(--ok); }

.mini-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.mini-list li { padding: 6px 0; border-bottom: 1px solid #202642; color: var(--muted); }
.mini-list li:last-child { border-bottom: none; }
.mini-list .tag { font-size: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; margin-right: 6px; text-transform: uppercase; color: var(--accent-2); }
.mini-list a { color: var(--accent-2); text-decoration: none; }
.mini-list a:hover { text-decoration: underline; }

/* ---------- dialog ---------- */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(440px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin: 0 0 10px; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a4470; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .side-col { order: 2; }
}
