@import url("https://fonts.googleapis.com/css2?family=Onest:wght@400;500;600;700&display=swap");

:root {
  --bg: #ffffff;
  --surface: #f7f9fc;
  --ink: #0f1729;
  --muted: #5b6577;
  --line: #e4e9f2;
  --cobalt: #2563eb;
  --cobalt-dark: #1d4ed8;
  --cobalt-soft: #eaf1ff;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --danger: #dc2626;
  --ok: #047857;
  --ok-soft: #e7f6ef;
  --radius-sm: 8px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.04), 0 8px 24px rgba(15, 23, 41, 0.06);
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; color: inherit; }

a { color: var(--cobalt); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }

.num { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */

.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--line); }

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px clamp(16px, 4vw, 40px);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.wordmark:hover { text-decoration: none; }
.wordmark small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.account { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }

.link-button {
  background: none;
  border: 0;
  padding: 4px 0;
  color: var(--cobalt);
  cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

/* ---------- Layout ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 64px;
}

.console {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

@media (max-width: 860px) {
  .console { grid-template-columns: 1fr; gap: 32px; }
}

h1, h2 { margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 700; }
h2 { font-size: 18px; font-weight: 600; }

/* ---------- Forms ---------- */

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.new-call { position: sticky; top: 20px; }
.new-call h2 { margin-bottom: 18px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label, .field legend { font-size: 14px; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); }

.input {
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.input { transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--cobalt); outline: none; box-shadow: 0 0 0 4px var(--cobalt-soft); }

fieldset { border: 0; padding: 0; margin: 0 0 20px; }
legend { padding: 0; }

.models { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 6px; }

.model {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.model input { position: absolute; opacity: 0; pointer-events: none; }
.model strong { font-weight: 600; }
.model span { font-size: 12px; color: var(--muted); }
.model { transition: border-color .15s, background .15s; }
.model:hover:not(:has(input:disabled)) { border-color: #c7d4ea; }
.model:has(input:checked) { border-color: var(--cobalt); background: var(--cobalt-soft);
  box-shadow: inset 0 0 0 1px var(--cobalt); }
.model:has(input:focus-visible) { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.model:has(input:disabled) { cursor: not-allowed; color: var(--muted); background: transparent; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--cobalt);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.button { transition: background .15s, box-shadow .15s; box-shadow: 0 1px 2px rgba(37, 99, 235, .25); }
.button:hover { background: var(--cobalt-dark); }
.button:disabled { opacity: 0.6; cursor: progress; }
.button.full { width: 100%; }
.button.danger { background: var(--danger); }
.button.danger:hover { background: #b91c1c; }

.form-error { margin: 12px 0 0; color: var(--danger); font-size: 14px; }

/* ---------- Calls list ---------- */

.list-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.list-head p { margin: 0; color: var(--muted); font-size: 14px; }

.calls { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }

.call-row a {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.call-row a { border-radius: var(--radius-sm); transition: background .15s; }
.call-row a:hover { background: var(--cobalt-soft); text-decoration: none; }

.who strong { display: block; font-weight: 600; }

.user-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  vertical-align: 1px;
}
.user-tag.mine { background: var(--cobalt-soft); border-color: #cddcfb; color: var(--cobalt-dark); }
.who span, .when span { color: var(--muted); font-size: 14px; }
.when { font-size: 14px; }
.when span { display: block; }

.who .booking-tag { display: block; margin-top: 2px; font-size: 13px; color: var(--ok); font-weight: 500; }

@media (max-width: 560px) {
  .call-row a { grid-template-columns: 1fr auto; }
  .call-row .when { grid-column: 1 / -1; grid-row: 2; }
}

.empty {
  padding: 40px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- Status ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}
.status.live { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }
.status.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.4s ease-in-out infinite;
}
.status.done { background: var(--ok-soft); color: var(--ok); border-color: #c8ebdb; }
.status.bad { background: #fdeceb; color: var(--danger); border-color: #f8d4d2; }

@keyframes pulse { 50% { opacity: 0.3; } }

@media (prefers-reduced-motion: reduce) {
  .status.live::before { animation: none; }
}

/* ---------- Call detail ---------- */

.back { display: inline-block; margin-bottom: 18px; font-size: 14px; }

.call-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.call-head p { margin: 6px 0 0; color: var(--muted); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  margin: 28px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.facts div { padding: 16px 20px 16px 0; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 600; }
.facts dd small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }

/* Player + transcript: the transcript is the scrubber. */

.player {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.play {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--cobalt);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.play svg { width: 18px; height: 18px; fill: currentColor; }

.seek { width: 100%; accent-color: var(--cobalt); }
.time { font-size: 14px; color: var(--muted); min-width: 92px; text-align: right; }

.no-recording { margin: 0; padding: 14px 0; color: var(--muted); border-bottom: 1px solid var(--line); }

.transcript { list-style: none; margin: 0; padding: 8px 0 0; }

.line {
  display: grid;
  grid-template-columns: 56px 88px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
}
.line.seekable { cursor: pointer; }
.line.seekable:hover { background: var(--surface); }
.line .t { color: var(--muted); font-size: 13px; padding-top: 2px; }
.line .speaker { font-size: 14px; font-weight: 600; padding-top: 1px; }
.line .text { max-width: 68ch; }

.line.agent .speaker { color: var(--cobalt); }
.line.current { background: var(--cobalt-soft); box-shadow: inset 2px 0 0 var(--cobalt); }
.line.current:hover { background: var(--cobalt-soft); }

.line.tool { padding-top: 4px; padding-bottom: 4px; }
.line.tool .text { font-size: 14px; color: var(--muted); }
.line.tool .text strong { color: var(--ok); font-weight: 600; }

@media (max-width: 560px) {
  .line { grid-template-columns: 44px minmax(0, 1fr); }
  .line .speaker { grid-column: 2; }
  .line .text { grid-column: 2; }
}

.live-note { margin: 14px 8px 0; color: var(--muted); font-size: 14px; }

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login .panel { width: min(380px, 100%); padding: 28px; }
.login .wordmark { margin-bottom: 6px; font-size: 34px; }
.login p.lead { margin: 0 0 24px; color: var(--muted); }

/* ---------- Billing ---------- */

.lede { margin: 8px 0 0; color: var(--muted); max-width: 68ch; }

.summary {
  display: grid;
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin: 28px 0 8px;
  padding: 26px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
@media (max-width: 700px) { .summary { grid-template-columns: 1fr; gap: 22px; } }

.summary .headline { font-size: 40px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.summary .headline span { display: block; margin-top: 6px; font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; }

/* One bar: how the money splits between telephony and the voice models. */
.split { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line); }
.split i { display: block; }
.split .telephony { background: var(--cobalt); }
.split .ai { background: #93b4fb; }

.legend { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 14px; }
.legend div { display: grid; gap: 2px; }
.legend dt { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.legend dt::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--cobalt); }
.legend .ai dt::before { background: #93b4fb; }
.legend dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.legend dd small { margin-left: 6px; font-weight: 400; color: var(--muted); }

.billing-section { margin-top: 40px; }
.billing-section h2 { margin-bottom: 4px; }
.billing-section .hint { display: block; margin-bottom: 10px; }

.table-wrap { overflow-x: auto; }

.table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 18px 10px 0;
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 18px 12px 0; border-bottom: 1px solid var(--line); }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table tbody tr:hover { background: var(--cobalt-soft); }
.table .r { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .strong { font-weight: 600; }
.table .who { min-width: 190px; }
.table .who a { font-weight: 500; }
.table .sub { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.table .muted { color: var(--muted); }
.table [hidden] { display: none; }
.table tfoot tr { border-top: 2px solid var(--cobalt); }
.table tfoot td { padding-top: 14px; font-weight: 600; border-bottom: 0; }
