/* ============================================================
   Sales Voice Coach — design system
   Dark, professional, mobile-first. One accent, semantic score colors.
   ============================================================ */
:root {
  --bg:        #0a0e1a;
  --bg-2:      #0e1424;
  --surface:   #141b2e;
  --surface-2: #1a2338;
  --line:      #263049;
  --line-2:    #313d5c;

  --text:      #eef2fb;
  --text-2:    #a9b4cf;
  --text-3:    #6b7799;

  --accent:    #6366f1;
  --accent-2:  #8b5cf6;
  --accent-ink:#c7d0ff;
  --accent-glow: rgba(99,102,241,.45);

  --good:  #34d399;
  --mid:   #fbbf24;
  --bad:   #fb7185;
  --danger:#f43f5e;

  --radius:   18px;
  --radius-sm:12px;
  --radius-lg:24px;

  --shadow:   0 10px 30px -10px rgba(0,0,0,.6);
  --shadow-lg:0 24px 60px -20px rgba(0,0,0,.75);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(99,102,241,.16), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(139,92,246,.10), transparent 55%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
#app { height: 100dvh; max-width: 560px; margin: 0 auto; position: relative; overflow: hidden; }

/* ── Screens ────────────────────────────────────────────── */
.screen {
  position: absolute; inset: 0;
  display: none; flex-direction: column;
  opacity: 0; transform: translateY(8px);
  transition: opacity .28s var(--ease), transform .28s var(--ease);
}
.screen.active { display: flex; opacity: 1; transform: none; }

.scroll { flex: 1; overflow-y: auto; padding: 18px 18px 28px; -webkit-overflow-scrolling: touch; }
.spacer { height: 40px; }
.muted { color: var(--text-2); }
.center { text-align: center; }

/* ── Top bar ────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(10,14,26,.72); backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 5;
}
.topbar-brand { font-weight: 700; font-size: 15px; letter-spacing: .2px; display: flex; align-items: center; gap: 8px; }
.topbar-brand .dot, .dot { width: 9px; height: 9px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 0 10px var(--accent-glow); }
.ghost-spacer { visibility: hidden; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  appearance: none; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 15px; color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s var(--ease), background .2s, border-color .2s, opacity .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 8px 24px -8px var(--accent-glow);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: rgba(255,255,255,.04); border-color: var(--line); color: var(--text-2); }
.btn-ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn-danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.4); color: #ffd9df; }
.btn-danger:hover { background: rgba(244,63,94,.2); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 15px 20px; font-size: 16px; border-radius: var(--radius); }
.btn-block { width: 100%; margin-top: 6px; }

/* ── Login ──────────────────────────────────────────────── */
.login-screen { align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 30px 26px; box-shadow: var(--shadow-lg);
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand-mark {
  width: 52px; height: 52px; border-radius: 15px; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 19px; letter-spacing: .5px; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 24px -8px var(--accent-glow);
}
.brand-text h1 { margin: 0; font-size: 19px; font-weight: 700; }
.brand-text p { margin: 3px 0 0; font-size: 13px; color: var(--text-2); }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-foot { margin-top: 22px; color: var(--text-3); font-size: 12px; }

/* ── Fields ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 16px; }
.field-label, .field > span { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field-label em, .field span em { font-weight: 400; color: var(--text-3); font-style: normal; font-size: 12.5px; }
input, textarea, select {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; outline: none; transition: border-color .18s, box-shadow .18s;
  resize: none;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.form-err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0 0; }

/* ── Cards / hero ───────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 18px; box-shadow: var(--shadow);
}
.hero { margin: 6px 2px 16px; }
.hero h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.4px; }
.hero p { margin: 6px 0 0; font-size: 14px; }

.last-strip {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(99,102,241,.12), rgba(139,92,246,.08));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.last-strip .ls-score { font-size: 26px; font-weight: 800; }
.last-strip .ls-text { font-size: 13px; color: var(--text-2); line-height: 1.4; }

/* ── Chips (presets) ────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 13px; font-size: 13.5px; font-weight: 500; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; color: var(--text-2);
  transition: all .16s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip.on { background: rgba(99,102,241,.16); border-color: var(--accent); color: var(--accent-ink); }

/* ── Segmented control (difficulty) ─────────────────────── */
.segment { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px; }
.segment button {
  appearance: none; border: none; cursor: pointer; font-family: inherit; font-weight: 600; font-size: 14px;
  color: var(--text-2); background: transparent; padding: 10px 8px; border-radius: 9px; text-transform: capitalize;
  transition: all .18s var(--ease);
}
.segment button.on { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 6px 16px -8px var(--accent-glow); }

/* ── Call screen ────────────────────────────────────────── */
.call-screen { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.callbar { border-bottom: 1px solid var(--line); }
.prospect-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
  font-weight: 700; font-size: 16px; color: #fff; background: linear-gradient(135deg, #475569, #64748b);
}
.prospect-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.prospect-meta { font-size: 12px; color: var(--text-3); }

.log { flex: 1; overflow-y: auto; padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.bubble {
  max-width: 82%; padding: 12px 15px; border-radius: 16px; font-size: 15px; line-height: 1.5;
  animation: pop .26s var(--ease); word-wrap: break-word;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.bubble.prospect { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble.you { align-self: flex-end; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-bottom-right-radius: 5px; }
.bubble.speaking { box-shadow: 0 0 0 2px var(--accent-glow); }
.bubble .who { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; opacity: .6; margin-bottom: 3px; }

.talkzone { padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(10,14,26,.75); backdrop-filter: blur(12px); text-align: center; }
.status { margin: 0 0 12px; font-size: 13.5px; color: var(--text-2); min-height: 18px; }
.talk { position: relative; width: 88px; height: 88px; margin: 0 auto; border: none; background: none; cursor: pointer; display: grid; place-items: center; }
.talk-core {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 30px -8px var(--accent-glow); transition: transform .16s var(--ease), background .2s; z-index: 2;
}
.talk:active .talk-core { transform: scale(.94); }
.talk:disabled { opacity: .55; cursor: default; }
.talk-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; }
.talk.recording .talk-core { background: linear-gradient(135deg, var(--danger), #fb7185); }
.talk.recording .talk-ring { animation: ripple 1.4s var(--ease) infinite; }
@keyframes ripple { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(1.55); } }
.talk-label { margin: 12px 0 0; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* mic icon (pure CSS) */
.mic-ico { width: 15px; height: 22px; position: relative; display: inline-block; vertical-align: middle; }
.mic-ico::before { content: ""; position: absolute; top: 0; left: 2px; width: 11px; height: 15px; border-radius: 6px; background: currentColor; }
.mic-ico::after { content: ""; position: absolute; bottom: 0; left: 6px; width: 3px; height: 6px; background: currentColor; box-shadow: -4px -3px 0 -1px currentColor, 4px -3px 0 -1px currentColor; }
.mic-ico.big { width: 24px; height: 34px; color: #fff; }
.mic-ico.big::before { width: 18px; height: 24px; left: 3px; border-radius: 9px; }
.mic-ico.big::after { width: 4px; height: 9px; left: 10px; box-shadow: -7px -5px 0 -1px #fff, 7px -5px 0 -1px #fff; }

/* ── Report ─────────────────────────────────────────────── */
.score-hero { display: flex; align-items: center; gap: 20px; margin: 4px 0 20px; }
.gauge { --deg: 0deg; --ring: var(--accent); position: relative; width: 132px; height: 132px; flex: none; }
.gauge svg { transform: rotate(-90deg); }
.gauge .g-track { stroke: var(--line); }
.gauge .g-fill { stroke: var(--ring); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.gauge .g-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .g-num { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -1px; }
.gauge .g-den { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.score-meta { min-width: 0; }
.score-headline { font-size: 17px; font-weight: 700; line-height: 1.35; }
.delta { display: inline-flex; align-items: center; gap: 5px; margin-top: 10px; font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; }
.delta.up { background: rgba(52,211,153,.14); color: var(--good); }
.delta.down { background: rgba(251,113,133,.14); color: var(--bad); }
.delta.flat { background: rgba(255,255,255,.06); color: var(--text-2); }

.rationale { font-size: 14.5px; color: var(--text-2); line-height: 1.55; margin: 0 0 18px; }

.subs { display: flex; flex-direction: column; gap: 11px; margin: 0 0 20px; }
.sub-row { display: grid; grid-template-columns: 116px 1fr 34px; align-items: center; gap: 10px; }
.sub-row .sub-name { font-size: 13px; color: var(--text-2); font-weight: 500; }
.sub-bar { height: 8px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.sub-bar i { display: block; height: 100%; width: 0; border-radius: 999px; transition: width .9s var(--ease); }
.sub-row .sub-val { font-size: 13px; font-weight: 700; text-align: right; }
.fill-good { background: linear-gradient(90deg, #10b981, var(--good)); }
.fill-mid  { background: linear-gradient(90deg, #f59e0b, var(--mid)); }
.fill-bad  { background: linear-gradient(90deg, #e11d48, var(--bad)); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 0 0 22px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.tile b { display: block; font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.tile span { font-size: 12px; color: var(--text-3); }
.tile.good b { color: var(--good); }
.tile.warn b { color: var(--mid); }

.block { margin: 0 0 22px; }
.block h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin: 0 0 10px; font-weight: 700; }
.block ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.block li { position: relative; padding-left: 20px; font-size: 14.5px; color: var(--text); line-height: 1.5; }
.block li::before { content: ""; position: absolute; left: 4px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.fix { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 14px 15px; margin-bottom: 10px; }
.fix .fix-head { font-weight: 700; font-size: 15px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.fix .turn-tag { font-size: 11px; font-weight: 600; color: var(--accent-ink); background: rgba(99,102,241,.14); padding: 2px 8px; border-radius: 999px; }
.fix .fix-why { font-size: 13.5px; color: var(--text-2); margin: 7px 0 0; line-height: 1.5; }
.fix .fix-instead { font-size: 13.5px; margin: 8px 0 0; line-height: 1.5; }
.fix .fix-instead b { color: var(--good); }

.warnblock { background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.28); border-radius: var(--radius-sm); padding: 14px 16px; }
.warnblock h3 { color: var(--mid); }
.warnblock li::before { background: var(--mid); }

.onething { margin: 6px 0 20px; padding: 18px 18px 18px 20px; border-radius: var(--radius); background: linear-gradient(135deg, rgba(99,102,241,.16), rgba(139,92,246,.10)); border: 1px solid var(--line-2); position: relative; }
.onething .ot-tag { font-size: 12px; font-weight: 700; letter-spacing: .4px; color: var(--accent-ink); text-transform: uppercase; }
.onething .ot-text { font-size: 16px; font-weight: 600; line-height: 1.5; margin-top: 6px; }

/* ── History ────────────────────────────────────────────── */
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 18px 0; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 8px; text-align: center; }
.stat b { display: block; font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.stat span { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .4px; }

.chart-card { margin: 16px 18px 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px 10px; }
.chart-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin: 0 0 12px; font-weight: 700; }
.trend { width: 100%; height: 120px; display: block; }

.focus-wrap { margin: 16px 18px 0; }
.focus-wrap h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-3); margin: 0 0 10px; font-weight: 700; }
.focus-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.focus-chip { font-size: 13px; padding: 7px 12px; border-radius: 999px; background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: var(--mid); font-weight: 500; }

.sess-list { margin: 16px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
.sess { display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 14px; cursor: pointer; transition: border-color .16s, transform .12s var(--ease); }
.sess:active { transform: scale(.99); }
.sess:hover { border-color: var(--line-2); }
.sess-score { width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 17px; font-weight: 800; }
.sess-score.good { background: rgba(52,211,153,.14); color: var(--good); }
.sess-score.mid { background: rgba(251,191,36,.14); color: var(--mid); }
.sess-score.bad { background: rgba(251,113,133,.14); color: var(--bad); }
.sess-body { min-width: 0; flex: 1; }
.sess-title { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sess-chev { color: var(--text-3); font-size: 20px; }

.empty { text-align: center; color: var(--text-3); padding: 60px 24px; font-size: 14px; line-height: 1.6; }

/* ── Toast + overlay ────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 20px);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2);
  padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: all .3s var(--ease); z-index: 50; max-width: 90%;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: rgba(244,63,94,.5); }
.overlay {
  position: fixed; inset: 0; background: rgba(6,9,17,.72); backdrop-filter: blur(4px);
  display: grid; place-items: center; gap: 16px; z-index: 60; grid-auto-flow: row;
}
.overlay p { color: var(--text-2); font-size: 14px; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 380px) {
  .hero h2 { font-size: 21px; }
  .prospect-name { max-width: 44vw; }
  .gauge { width: 116px; height: 116px; }
  .gauge .g-num { font-size: 34px; }
}
