:root {
  --bg: #f9f7f3;
  --surface: #ffffff;
  --border: #ece6dd;
  --divider: #f0ebe4;
  --text: #221d19;
  --text-muted: #6d655d;
  --text-faint: #8a827a;
  --accent: #c3925f;
  --accent-hover: #b6844f;
  --accent-ink: #2b2118;
  --dot: #d9662e;

  --panel-bg: #000000;
  --panel-text: #ffffff;
  --panel-muted: #d4d4d4;
  --teal: #13b39c;
  --teal-hover: #10a08b;
  --wave: #0e8f80;
  --red: #f2414f;
  --red-hover: #e02f3e;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

button { font: inherit; cursor: pointer; }

/* ---------- top bar ---------- */

.topbar {
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px 0 42px;
}

.brand { display: block; height: 36px; width: auto; }

.topbar-actions { display: flex; align-items: center; gap: 14px; }

.bell { position: relative; display: inline-flex; color: var(--text); }
.bell .icon { width: 17px; height: 17px; stroke-width: 1.7; }
.bell-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dot);
  border: 1.5px solid var(--surface);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f4ebe1;
  color: #6b4a2c;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

/* ---------- page ---------- */

/* Content sits left-of-centre in a 930px column, leaving room for the voice panel. */
.page {
  width: min(930px, 100% - 32px);
  margin: 0 auto;
  padding: 26px 0 140px;
}
.page > * { max-width: 768px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
}

.subtitle { margin: 4px 0 0; color: var(--text-muted); font-size: 14.5px; }

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(80, 50, 20, .18);
  margin-bottom: 2px;
  transition: background .15s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(60, 40, 20, .05);
}

.details { margin: 0; overflow: hidden; }

.row {
  display: grid;
  grid-template-columns: 176px 1fr;
  align-items: center;
  min-height: 45px;
  padding: 10px 20px;
  border-top: 1px solid var(--divider);
}
.row:first-child { border-top: 0; }

dt { color: var(--text-muted); font-size: 13px; }
dd { margin: 0; font-size: 14.5px; color: var(--text); overflow-wrap: anywhere; }
dd.empty { color: var(--text-faint); }

.status-note { color: var(--text-muted); font-size: 12px; margin-left: 4px; }
.status-note:not(:empty)::before { content: "· "; }

.details.flash { animation: flash .9s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 3px rgba(195, 146, 95, .55); }
  100% { box-shadow: 0 1px 3px rgba(60, 40, 20, .05); }
}

/* ---------- Voice AI launcher ---------- */

.voice-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(80, 50, 20, .25);
  z-index: 20;
}
.voice-launcher:hover { background: var(--accent-hover); }
.voice-launcher .icon { width: 18px; height: 18px; }
.voice-launcher[hidden] { display: none; }

/* ---------- Voice AI panel ---------- */

.voice-panel {
  position: fixed;
  right: 11px;
  bottom: 11px;
  width: 322px;
  height: 412px;
  max-height: calc(100vh - 70px);
  background: var(--panel-bg);
  color: var(--panel-text);
  border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.voice-panel[hidden] { display: none; }

.voice-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 16px 0 24px;
}

.voice-bars {
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 26px;
  flex: none;
}
.voice-bars i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--wave);
  height: 10px;
  transform-origin: center;
}
.voice-bars i:nth-child(1) { height: 9px; }
.voice-bars i:nth-child(2) { height: 17px; }
.voice-bars i:nth-child(3) { height: 26px; }
.voice-bars i:nth-child(4) { height: 22px; }
.voice-bars i:nth-child(5) { height: 14px; }
.voice-bars i:nth-child(6) { height: 8px; }
.voice-panel.speaking .voice-bars i { animation: bar 0.9s ease-in-out infinite; }
.voice-panel.speaking .voice-bars i:nth-child(2) { animation-delay: -.15s; }
.voice-panel.speaking .voice-bars i:nth-child(3) { animation-delay: -.3s; }
.voice-panel.speaking .voice-bars i:nth-child(4) { animation-delay: -.45s; }
.voice-panel.speaking .voice-bars i:nth-child(5) { animation-delay: -.6s; }
.voice-panel.speaking .voice-bars i:nth-child(6) { animation-delay: -.75s; }
@keyframes bar {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(.45); }
}
@media (prefers-reduced-motion: reduce) {
  .voice-panel.speaking .voice-bars i { animation: none; }
}

.voice-title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.voice-eyebrow {
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.3;
}
.voice-status {
  font-size: 11.5px;
  color: var(--panel-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.voice-icon-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--panel-text);
  flex: none;
}
.voice-icon-btn .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.voice-icon-btn:hover { background: rgba(255, 255, 255, .1); }
.voice-icon-btn:focus-visible,
.mic-btn:focus-visible,
.end-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.voice-error {
  margin: 18px 24px 0;
  font-size: 12px;
  line-height: 1.5;
  color: #fca5a5;
}
.voice-error[hidden] { display: none; }

.voice-log {
  list-style: none;
  margin: 14px 0 10px;
  padding: 0 16px 0 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: #3f3f46 transparent;
}
.voice-log:empty::before {
  content: "The conversation will appear here.";
  margin: auto;
  color: #71717a;
  font-size: 11.5px;
}
.msg {
  max-width: 85%;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.msg-who {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 2px;
}
.msg.assistant {
  align-self: flex-start;
  background: #1c1c1f;
  color: #f4f4f5;
  border-bottom-left-radius: 3px;
}
.msg.user {
  align-self: flex-end;
  background: var(--wave);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.msg.partial { opacity: .65; }

.voice-controls {
  margin-top: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 0 0 11px;
}

.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--teal);
  color: #fff;
  display: grid;
  place-items: center;
  --mic-level: 0;
  box-shadow: 0 0 0 calc(var(--mic-level) * 9px) rgba(19, 179, 156, .35);
  transition: box-shadow .08s linear;
}
.mic-btn:hover { background: var(--teal-hover); }
.mic-btn .icon { width: 15px; height: 15px; }
.mic-btn .mic-off { display: none; }
.mic-btn[aria-pressed="true"] { background: #3f3f46; }
.mic-btn[aria-pressed="true"] .mic-on { display: none; }
.mic-btn[aria-pressed="true"] .mic-off { display: block; }

.end-btn {
  height: 40px;
  min-width: 88px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 8.5px;
  font-weight: 600;
}
.end-btn:hover { background: var(--red-hover); }
.end-square { width: 9px; height: 9px; border-radius: 1.5px; background: #fff; }
.end-btn.start { background: var(--teal); }
.end-btn.start:hover { background: var(--teal-hover); }
.end-btn.start .end-square { display: none; }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  .topbar { padding: 0 16px; }
  .page { padding-top: 20px; }
  .page-head { flex-direction: column; align-items: flex-start; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .voice-panel { left: 8px; right: 8px; width: auto; bottom: 8px; }
}
