/* Samtale — Skovgaard & Damgaard design system (brand portal tokens). */
@font-face {
  font-family: "Satoshi";
  src: url("/static/satoshi-variable.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --amber: #f5921a;
  --orange: #f06b1d;
  --red-orange: #d93c28;
  --crimson: #c02a50;
  --navy: #1c0f32;
  --brand-gradient: linear-gradient(135deg, #f5921a, #f06b1d, #d93c28, #c02a50);

  --bg: #ffffff;
  --bg-subtle: #faf9f7;
  --bg-muted: #f0efed;
  --bg-inverse: #0c0c0c;
  --fg: #0c0c0c;
  --fg-muted: #5a5a5a;
  --fg-subtle: #767676;
  --fg-inverse: #ffffff;
  --border: #d8d8d8;
  --border-strong: #2e2e2e;
  --success: #10b981;
  --btn-primary-hover: #2e2e2e;

  --rail-bg: var(--navy);
  --rail-fg: #ffffff;
  --rail-muted: rgba(255, 255, 255, 0.62);
  --rail-hover: rgba(255, 255, 255, 0.07);
  --rail-active: rgba(255, 255, 255, 0.12);
  --rail-line: rgba(255, 255, 255, 0.12);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --shadow-md: 0 4px 12px rgba(12, 12, 12, 0.1);
  --shadow-xl: 0 24px 64px rgba(12, 12, 12, 0.14);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --font-display: "Satoshi", "Inter", -apple-system, system-ui, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0c0c;
    --bg-subtle: #141414;
    --bg-muted: #1a1a1a;
    --bg-inverse: #f5f5f5;
    --fg: #eeeeee;
    --fg-muted: #a3a3a3;
    --fg-subtle: #8a8a8a;
    --fg-inverse: #0c0c0c;
    --border: #333333;
    --border-strong: #555555;
    --btn-primary-hover: #d8d8d8;
    --rail-bg: #120a21;
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(245, 146, 26, 0.28); }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius-sm); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
.icon { width: 18px; height: 18px; stroke-width: 1.75; flex: none; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 28px 16px 20px;
  background: var(--rail-bg); color: var(--rail-fg);
}
.rail .logo { display: block; width: 132px; margin: 0 8px; }
.rail .logo img { display: block; width: 100%; height: auto; }
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail .group-label { margin: 0 8px 6px; font-size: 13px; font-weight: 500; color: var(--rail-muted); }
.rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: var(--radius-md);
  color: var(--rail-fg); text-decoration: none; font-size: 15px;
  transition: background 150ms var(--ease-out);
}
.rail-item:hover { background: var(--rail-hover); }
.rail-item[aria-current="page"] { background: var(--rail-active); }
.rail-item .meta { margin-left: auto; font-size: 12.5px; color: var(--rail-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rail-item .live { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; }
.rail-item .glyphs { display: inline-flex; gap: 4px; color: var(--rail-muted); }
.rail-item .glyphs .icon { width: 14px; height: 14px; }
.rail .meetings { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.rail .empty { margin: 2px 8px; font-size: 13.5px; color: var(--rail-muted); line-height: 1.45; }
.rail form.unlock { display: flex; gap: 6px; margin: 4px 8px 0; }
.rail form.unlock input {
  flex: 1; min-width: 0; padding: 7px 10px; border-radius: var(--radius-md);
  border: 1px solid var(--rail-line); background: transparent; color: var(--rail-fg); font-size: 14px;
}
.rail form.unlock input::placeholder { color: var(--rail-muted); }
.rail .foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.rail .new-meeting {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.85); background: transparent; color: var(--rail-fg);
  font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out);
}
.rail .new-meeting:hover { background: #fff; color: var(--navy); }
.rail .settings-link { display: flex; align-items: center; gap: 8px; padding: 8px; color: var(--rail-muted); text-decoration: none; font-size: 14px; border-radius: var(--radius-md); }
.rail .settings-link:hover { color: var(--rail-fg); background: var(--rail-hover); }

/* The main column is exactly one viewport tall so the transcript scrolls inside itself. */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.topbar { display: none; }

/* ---------- room header ---------- */
.room-head {
  display: flex; align-items: flex-start; gap: 24px; flex-wrap: wrap;
  padding: 40px 48px 24px; border-bottom: 1px solid var(--border);
}
.room-head h1 {
  margin: 0; font: 600 36px/1.1 var(--font-display); letter-spacing: -0.02em;
}
.room-head .sub { margin: 8px 0 0; color: var(--fg-muted); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.room-head .sub .icon { width: 15px; height: 15px; }
.model-pill {
  margin-left: auto; display: inline-flex; align-items: stretch; overflow: hidden;
  border: 1px solid var(--border); border-radius: 9999px; font-size: 13px; color: var(--fg-muted);
  background: var(--bg-subtle);
}
.model-pill span { padding: 5px 12px; white-space: nowrap; }
.model-pill span + span { border-left: 1px solid var(--border); }
.model-pill strong { color: var(--fg); font-weight: 500; }

/* ---------- presence ---------- */
.presence {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 20px 48px; border-bottom: 1px solid var(--border); background: var(--bg-subtle);
}
.person { display: inline-flex; align-items: center; gap: 10px; padding: 4px 14px 4px 4px; border-radius: 9999px; background: var(--bg); border: 1px solid var(--border); }
.avatar {
  position: relative; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-muted); font: 600 13px/1 var(--font-display); color: var(--fg);
}
.avatar::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid transparent; transition: border-color 120ms var(--ease-out); }
.person.speaking .avatar::after { border-color: var(--amber); }
.person .who { font-size: 14.5px; font-weight: 500; }
.person .you { color: var(--fg-subtle); font-weight: 400; }

.assistant { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.assistant .orb { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; }
.assistant .orb::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--brand-gradient); opacity: 0; transition: opacity 250ms var(--ease-out);
}
.assistant .orb .core {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy); color: #fff;
}
.assistant .orb .core .icon { width: 17px; height: 17px; }
.assistant[data-state="speaking"] .orb::before { opacity: 1; animation: spin 3.2s linear infinite; }
.assistant[data-state="thinking"] .orb::before { opacity: 0.45; animation: breathe 1.6s var(--ease-out) infinite; }
.assistant[data-state="listening"] .orb::before { opacity: 0.18; }
.assistant .label { display: flex; flex-direction: column; line-height: 1.25; }
.assistant .label strong { font-weight: 600; font-size: 14.5px; }
.assistant .label span { font-size: 13px; color: var(--fg-muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: 0.15; } }

/* ---------- transcript / stage ---------- */
.stage { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.stage.in-call { overflow: hidden; }
.transcript { flex: 1; min-height: 0; overflow-y: auto; padding: 24px 48px 40px; scroll-behavior: smooth; }
.tx-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: 72ch; margin-bottom: 24px; }
.tx-tools .note { color: var(--fg-muted); font-size: 14px; margin-right: auto; }
.jump {
  position: sticky; bottom: 8px; margin-left: auto; display: flex; width: max-content;
  padding: 6px 12px; border-radius: 9999px; border: 1px solid var(--border); background: var(--bg);
  box-shadow: var(--shadow-md); font-size: 13px; cursor: pointer;
}
.controls select.input { width: auto; padding: 9px 10px; font-size: 14px; }
.controls .cost { color: var(--fg-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.summary-text { font-size: 15.5px; line-height: 1.6; }
.summary-text h3 { font: 600 17px/1.3 var(--font-display); margin: 20px 0 6px; }
.summary-text h3:first-child { margin-top: 0; }
.summary-text ul { margin: 0; padding-left: 20px; }
.summary-text p { margin: 0 0 8px; }
.transcript .lines { max-width: 72ch; display: flex; flex-direction: column; gap: 22px; }
.line .speaker { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--fg-muted); margin-bottom: 2px; }
.line .speaker .icon { width: 14px; height: 14px; color: var(--orange); }
.line .text { font-size: 17px; line-height: 1.55; }
.line.partial .text { color: var(--fg-subtle); }
.line.assistant .speaker { color: var(--fg); }
.transcript .quiet { color: var(--fg-subtle); font-size: 15px; max-width: 46ch; }

/* ---------- join panel ---------- */
.join { padding: 56px 48px; display: grid; grid-template-columns: minmax(0, 464px) minmax(0, 340px); gap: 64px; align-items: start; }
.join.solo { grid-template-columns: minmax(0, 464px); }
.waiting {
  margin-top: 6px; padding: 28px; border-radius: var(--radius-lg);
  background: var(--navy); color: #fff; display: flex; flex-direction: column; gap: 18px;
}
.waiting .orb { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; }
.waiting .orb::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--brand-gradient); opacity: 0.9; }
.waiting .orb .core { position: relative; width: 54px; height: 54px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; }
.waiting .orb .core .icon { width: 24px; height: 24px; }
.waiting h3 { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -0.02em; }
.waiting p { margin: 0; color: rgba(255, 255, 255, 0.72); font-size: 15px; }
.waiting .say { padding: 14px 16px; border-radius: var(--radius-md); background: rgba(255, 255, 255, 0.08); font-size: 15px; }
.waiting .say b { color: var(--amber); font-weight: 600; }
.waiting dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; }
.waiting dt { color: rgba(255, 255, 255, 0.6); }
.waiting dd { margin: 0; }
@media (max-width: 1100px) { .join { grid-template-columns: minmax(0, 464px); gap: 32px; } }
.join > div > h2 { margin: 0 0 8px; font: 600 24px/1.2 var(--font-display); letter-spacing: -0.02em; }
.join > div > p { margin: 0 0 28px; color: var(--fg-muted); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 500; }
.field .hint { font-size: 13px; color: var(--fg-muted); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border); background: var(--bg); font-size: 16px;
  transition: border-color 150ms var(--ease-out);
}
.input:focus { outline: none; border-color: var(--amber); }
.input::placeholder { color: var(--fg-subtle); }
textarea.input { min-height: 140px; resize: vertical; line-height: 1.5; }
.form-error { color: var(--crimson); font-size: 14px; margin: 0 0 16px; }
.form-error:empty { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
  transition: background 150ms var(--ease-out), color 150ms var(--ease-out), border-color 150ms var(--ease-out);
}
.btn-primary { background: var(--bg-inverse); color: var(--fg-inverse); }
.btn-primary:hover { background: var(--btn-primary-hover); }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-secondary:hover { border-color: var(--fg); }
.btn-danger { background: transparent; border-color: var(--crimson); color: var(--crimson); }
.btn-danger:hover { background: var(--crimson); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn-quiet { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 0; background: none; color: var(--fg-muted); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 14px; cursor: pointer; }
.btn-quiet:hover { color: var(--fg); }

/* ---------- control bar ---------- */
.controls {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 12px;
  padding: 16px 48px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.controls .timer { margin-left: auto; color: var(--fg-muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.controls .btn[aria-pressed="true"] { background: var(--bg-muted); border-color: var(--border); color: var(--fg); }

/* ---------- slide-over (new meeting) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(12, 12, 12, 0.32); opacity: 0; transition: opacity 250ms var(--ease-out); z-index: 20; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100vw); z-index: 21;
  display: flex; flex-direction: column; background: var(--bg); box-shadow: var(--shadow-xl);
  transform: translateX(100%); transition: transform 280ms var(--ease-out);
}
.sheet.open { transform: none; }
.sheet header { display: flex; align-items: center; padding: 24px 28px; border-bottom: 1px solid var(--border); }
.sheet header h2 { margin: 0; font: 600 22px/1.2 var(--font-display); letter-spacing: -0.02em; }
.sheet header .btn-quiet { margin-left: auto; }
.sheet .body { flex: 1; overflow-y: auto; padding: 24px 28px; }
.sheet .actions { padding: 20px 28px; border-top: 1px solid var(--border); display: flex; gap: 10px; }

.segmented { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 9999px; background: var(--bg-muted); border: 1px solid var(--border); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 12px; border-radius: 9999px; font-size: 14px; color: var(--fg-muted); cursor: pointer; transition: background 150ms var(--ease-out), color 150ms var(--ease-out); }
.segmented input:checked + span { background: var(--bg-inverse); color: var(--fg-inverse); }
.segmented input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 1px; }

.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { appearance: none; flex: none; width: 40px; height: 24px; margin: 0; border-radius: 9999px; background: var(--border); position: relative; cursor: pointer; transition: background 150ms var(--ease-out); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(12, 12, 12, 0.2); transition: transform 180ms var(--ease-out); }
.switch input:checked { background: var(--fg); }
.switch input:checked::after { transform: translateX(16px); }
.switch .txt strong { display: block; font-size: 15px; font-weight: 500; }
.switch .txt span { font-size: 13.5px; color: var(--fg-muted); }

.inline-input { display: flex; gap: 8px; }
.inline-input .input { flex: 1; min-width: 0; }

.result { display: flex; flex-direction: column; gap: 16px; }
.result .link {
  display: flex; align-items: center; gap: 8px; padding: 12px; border-radius: var(--radius-md);
  background: var(--bg-subtle); border: 1px solid var(--border); font-size: 15px; word-break: break-all;
}
.result .done { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.result .done .icon { color: var(--success); }

.notice { padding: 56px 48px; max-width: 560px; }
.notice h2 { margin: 0 0 8px; font: 600 24px/1.2 var(--font-display); letter-spacing: -0.02em; }
.notice p { color: var(--fg-muted); margin: 0 0 24px; }

/* ---------- settings ---------- */
.settings-main { padding: 40px 48px 64px; max-width: 760px; }
.settings-main h1 { margin: 0 0 6px; font: 600 36px/1.1 var(--font-display); letter-spacing: -0.02em; }
.settings-main > p { margin: 0 0 32px; color: var(--fg-muted); }
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-subtle); margin-bottom: 24px; }
.panel h2 { margin: 0; padding: 18px 24px; font: 600 18px/1.3 var(--font-display); border-bottom: 1px solid var(--border); }
.panel .body { padding: 20px 24px 8px; }
.state-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: var(--fg-muted); }
.state-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--crimson); }
.state-dot.on::before { background: var(--success); }
.save-row { display: flex; align-items: center; gap: 16px; }
.save-row .status { color: var(--fg-muted); font-size: 14px; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30;
    transform: translateX(-100%); transition: transform 280ms var(--ease-out);
  }
  .rail.open { transform: none; box-shadow: var(--shadow-xl); }
  .topbar {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    background: var(--rail-bg); color: var(--rail-fg);
  }
  .topbar img { height: 28px; width: auto; }
  .topbar .btn-quiet { color: var(--rail-fg); margin-left: auto; }
  .room-head, .presence, .transcript, .controls, .join, .notice, .settings-main { padding-left: 16px; padding-right: 16px; }
  .room-head { padding-top: 24px; }
  .room-head h1 { font-size: 28px; }
  .model-pill { margin-left: 0; }
  .assistant { margin-left: 0; }
  .controls { padding-bottom: max(16px, env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .controls .timer { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}

/* ---------- usage ---------- */
.usage-total { margin: 0 0 12px; font-size: 15.5px; }
.usage-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.usage-table th { text-align: left; font-weight: 500; color: var(--fg-muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); }
.usage-table td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--border); }
.usage-table td:last-child, .usage-table th:last-child { text-align: right; padding-right: 0; }
