:root {
  color-scheme: light;
  --ink: #111111;
  --paper: #edece9;
  --surface: #ffffff;
  --muted: #6d6a67;
  --line: #d7d3ce;
  --wine: #8b1e2d;
  --wine-dark: #681520;
  --success: #1d6d4b;
  --warning: #946000;
  --danger: #a02631;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.09);
  --radius: 18px;
  --radius-sm: 11px;
  --container: 1120px;
  font-family: Inter, Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(139, 30, 45, 0.08), transparent 27rem),
    linear-gradient(180deg, #f4f2ef 0%, var(--paper) 100%);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; }

.shell { min-height: 100vh; }
.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(17,17,17,0.09);
  background: rgba(244,242,239,0.86);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 800;
  letter-spacing: -0.025em;
  font-size: 18px;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: white;
  background: var(--wine);
  font-size: 15px;
  box-shadow: 0 7px 18px rgba(139,30,45,0.23);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.main { width: min(var(--container), calc(100% - 40px)); margin: 0 auto; padding: 52px 0 80px; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  gap: 48px;
  align-items: center;
  min-height: 500px;
}
.hero-copy h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(44px, 6.2vw, 82px);
  line-height: 0.94;
  letter-spacing: -0.065em;
  font-weight: 820;
}
.hero-copy p {
  max-width: 650px;
  margin: 28px 0 0;
  font-size: clamp(18px, 2vw, 23px);
  line-height: 1.5;
  color: var(--muted);
}
.hero-proof {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  color: #4c4946;
  font-size: 14px;
}
.hero-proof span::before { content: "✓"; color: var(--success); margin-right: 7px; font-weight: 800; }
.server-health { margin-top: 18px; display: inline-flex; align-items: center; gap: 8px; color: #4c4946; font-size: 13px; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; background: #b8b2aa; }
.health-dot.online { background: var(--success); box-shadow: 0 0 0 4px rgba(46,125,87,.12); }
.health-dot.offline { background: var(--danger); }

.panel {
  background: rgba(255,255,255,0.93);
  border: 1px solid rgba(17,17,17,0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.panel h2, .panel h3 { margin: 0; letter-spacing: -0.025em; }
.panel-subtitle { margin: 9px 0 24px; color: var(--muted); line-height: 1.45; }
.stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; font-weight: 750; color: #4e4b47; }
.input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  color: var(--ink);
  background: #fbfbfa;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.input:focus { border-color: var(--wine); box-shadow: 0 0 0 4px rgba(139,30,45,0.10); background: white; }
.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-weight: 760;
  color: white;
  background: var(--wine);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}
.button:hover:not(:disabled) { background: var(--wine-dark); transform: translateY(-1px); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line); }
.button.secondary:hover:not(:disabled) { background: #f6f5f3; border-color: #bbb6b0; }
.button.ghost { color: var(--ink); background: transparent; border-color: transparent; }
.button.danger { background: var(--danger); }
.button.compact { min-height: 38px; padding: 7px 12px; font-size: 14px; }
.button.full { width: 100%; }
.button .icon { font-size: 17px; line-height: 1; }
.divider { display: flex; align-items: center; gap: 12px; margin: 4px 0; color: #8a8580; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }

.section { margin-top: 64px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-head h2 { margin: 0; font-size: 30px; letter-spacing: -0.04em; }
.section-head p { margin: 0; color: var(--muted); }
.call-list { border-top: 1px solid var(--line); }
.call-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 24px;
  align-items: center;
  padding: 18px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: inherit;
}
.call-row:hover { background: rgba(255,255,255,0.44); }
.call-title { font-weight: 770; }
.call-meta { margin-top: 5px; color: var(--muted); font-size: 13px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border-radius: 99px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  background: #e7e4df;
  color: #4d4945;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.active { color: var(--success); background: #e1f1e9; }
.status.processing, .status.ended { color: var(--warning); background: #f7ecd3; }
.status.completed { color: var(--success); background: #e1f1e9; }
.status.failed { color: var(--danger); background: #f8e1e3; }
.empty { padding: 32px 0; color: var(--muted); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.lobby { max-width: 820px; margin: 10px auto 0; }
.back-link { border: 0; background: transparent; padding: 0; color: var(--muted); font-weight: 700; margin-bottom: 24px; }
.back-link:hover { color: var(--ink); }
.lobby-card { padding: 36px; }
.lobby-title { font-size: clamp(34px, 5vw, 56px); line-height: 1; letter-spacing: -0.055em; margin: 0; }
.lobby-meta { display: flex; flex-wrap: wrap; gap: 10px 20px; margin: 18px 0 30px; color: var(--muted); }
.info-box {
  border: 1px solid #d9d0c0;
  background: #fbf5e8;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: #5e4a26;
  font-size: 14px;
  line-height: 1.45;
}
.action-row { display: flex; gap: 10px; flex-wrap: wrap; }

.call-stage {
  min-height: calc(100vh - 72px);
  background: #0f0f10;
  color: white;
  display: flex;
  flex-direction: column;
}
.call-stage .topbar { position: static; background: #151516; border-color: rgba(255,255,255,0.09); color: white; }
.call-stage .brand { color: white; }
.call-stage .button.secondary { color: white; background: #232325; border-color: #343438; }
.call-content { width: min(1050px, calc(100% - 36px)); margin: auto; padding: 36px 0 120px; }
.call-topic { text-align: center; }
.call-topic h1 { margin: 0; font-size: clamp(26px, 4vw, 42px); letter-spacing: -0.04em; }
.call-clock { margin-top: 10px; color: #aaa8ac; font-variant-numeric: tabular-nums; font-size: 19px; }
.call-status-line { margin: 10px auto 0; color: #aaa8ac; font-size: 13px; }
.call-meta-line { margin-top: 8px; }
.participant-count { color: #7d7b80; font-variant-numeric: tabular-nums; }
.participant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 48px;
}
.participant-card {
  min-height: 230px;
  border: 1px solid #303033;
  background: #1a1a1c;
  border-radius: 22px;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.participant-card.speaking { border-color: #ad4b59; box-shadow: inset 0 0 0 1px #ad4b59, 0 0 0 5px rgba(139,30,45,0.17); }
.avatar {
  width: 94px;
  height: 94px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  font-weight: 820;
  background: linear-gradient(145deg, #8b1e2d, #53111b);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.participant-name { margin-top: 18px; text-align: center; font-size: 17px; font-weight: 750; }
.participant-role { margin-top: 5px; text-align: center; color: #969499; font-size: 13px; }
.mic-state { position: absolute; right: 15px; top: 15px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2a2a2d; font-size: 15px; }
.call-controls {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: 20px;
  background: rgba(29,29,31,0.92);
  border: 1px solid #38383c;
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.control-button {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 16px;
  color: white;
  background: #333336;
  font-size: 21px;
}
.control-button:hover { background: #414146; }
.control-button.off { background: #5b5b61; }
.control-button.end { width: 72px; background: var(--danger); }
.record-indicator { display: inline-flex; align-items: center; gap: 8px; }
.record-indicator::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e54555; animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.processing { max-width: 760px; margin: 12vh auto 0; text-align: center; }
.processing-spinner { width: 54px; height: 54px; margin: 0 auto 24px; border: 5px solid #ddd7d0; border-top-color: var(--wine); border-radius: 50%; animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing h1 { margin: 0; letter-spacing: -0.045em; font-size: clamp(34px, 5vw, 58px); }
.processing p { margin: 16px auto 0; max-width: 600px; color: var(--muted); line-height: 1.55; }
.processing-steps { margin: 30px auto 0; max-width: 450px; text-align: left; display: grid; gap: 12px; }
.processing-step { display: flex; gap: 12px; align-items: center; padding: 13px 15px; background: rgba(255,255,255,.58); border: 1px solid var(--line); border-radius: 12px; }
.processing-step.done { color: var(--success); }

.report { display: grid; gap: 24px; }
.report-header { display: flex; align-items: start; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.report-header h1 { margin: 0; font-size: clamp(36px, 5vw, 64px); line-height: 0.98; letter-spacing: -0.055em; }
.report-kicker { color: var(--wine); font-weight: 800; margin-bottom: 10px; }
.report-meta { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 9px 18px; color: var(--muted); font-size: 14px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(290px, .8fr); gap: 24px; align-items: start; }
.report-main, .report-side { display: grid; gap: 24px; }
.report-card { background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.report-card h2 { margin: 0 0 18px; font-size: 23px; letter-spacing: -0.035em; }
.report-card h3 { margin: 0 0 12px; font-size: 16px; }
.summary-text { font-size: 18px; line-height: 1.62; margin: 0; }
.clean-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.5; }
.insight-list { display: grid; gap: 12px; }
.insight {
  padding: 14px 15px;
  border-left: 3px solid var(--wine);
  border-radius: 0 10px 10px 0;
  background: #f6f4f1;
}
.insight.task { border-color: #2d6487; }
.insight.risk.high { border-color: var(--danger); }
.insight.risk.medium { border-color: var(--warning); }
.insight-title { font-weight: 740; line-height: 1.42; }
.insight-meta { margin-top: 7px; color: var(--muted); font-size: 13px; }
.evidence { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.evidence button { border: 1px solid #d4cfca; border-radius: 99px; background: white; color: #595550; padding: 4px 8px; font-size: 11px; }
.recording { padding: 13px 0; border-top: 1px solid var(--line); }
.recording:first-of-type { border-top: 0; padding-top: 0; }
.recording-name { font-weight: 740; margin-bottom: 8px; }
audio { width: 100%; height: 40px; }
.transcript { display: grid; gap: 4px; max-height: 650px; overflow: auto; padding-right: 5px; }
.transcript-row {
  width: 100%;
  border: 0;
  border-radius: 11px;
  background: transparent;
  padding: 10px 11px;
  display: grid;
  grid-template-columns: 62px 120px minmax(0,1fr);
  gap: 12px;
  text-align: left;
  color: inherit;
  line-height: 1.48;
}
.transcript-row:hover, .transcript-row.highlight { background: #f2efeb; }
.transcript-time { color: var(--wine); font-variant-numeric: tabular-nums; font-weight: 720; font-size: 12px; padding-top: 2px; }
.transcript-speaker { font-weight: 760; font-size: 13px; padding-top: 1px; }
.transcript-text { font-size: 14px; }
.error-card { border: 1px solid #e0afb4; background: #fff0f1; color: #781c26; border-radius: var(--radius); padding: 24px; }
.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-word; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #111; color: white; padding: 11px 15px; border-radius: 10px; opacity: 0; pointer-events: none; transition: opacity 180ms ease, transform 180ms ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 36px; }
  .hero-copy h1 { font-size: clamp(45px, 13vw, 72px); }
  .report-grid { grid-template-columns: 1fr; }
  .report-header { display: grid; }
  .call-row { grid-template-columns: 1fr auto; }
  .call-row > :last-child { display: none; }
}
@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 16px; }
  .topbar .hide-mobile { display: none; }
  .main { width: min(100% - 24px, var(--container)); padding-top: 30px; }
  .hero { gap: 28px; }
  .hero-copy p { margin-top: 20px; }
  .panel, .lobby-card { padding: 21px; }
  .section { margin-top: 46px; }
  .action-row .button { flex: 1; }
  .participant-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
  .participant-card { min-height: 180px; padding: 15px; }
  .avatar { width: 70px; height: 70px; font-size: 24px; }
  .participant-name { font-size: 14px; }
  .transcript-row { grid-template-columns: 52px 1fr; gap: 7px 9px; }
  .transcript-speaker { grid-column: 2; grid-row: 1; }
  .transcript-text { grid-column: 1 / -1; }
  .report-card { padding: 18px; }
}
