:root {
  color-scheme: light;
  --bg: #eef1f4;
  --ink: #172026;
  --muted: #62707c;
  --panel: #ffffff;
  --line: #d9e0e6;
  --accent: #0f7b6c;
  --accent-strong: #095d52;
  --danger: #b5413d;
  --warn: #9b6b11;
  --ok: #126c45;
  --shadow: 0 18px 45px rgba(31, 45, 55, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(238, 241, 244, 0.96), rgba(231, 236, 239, 0.96)),
    radial-gradient(circle at top left, rgba(15, 123, 108, 0.16), transparent 34%),
    radial-gradient(circle at bottom right, rgba(176, 71, 60, 0.12), transparent 30%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #b8c4cc;
  background: #f8fafb;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button.primary {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

button.primary:hover:not(:disabled) {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(27px, 4vw, 44px);
  line-height: 1.04;
}

h2 {
  font-size: 16px;
  line-height: 1.2;
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 220px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 760;
}

.status-pill[data-tone="ok"] {
  color: var(--ok);
  border-color: rgba(18, 108, 69, 0.28);
  background: #edf8f2;
}

.status-pill[data-tone="warn"] {
  color: var(--warn);
  border-color: rgba(155, 107, 17, 0.28);
  background: #fff7e4;
}

.status-pill[data-tone="bad"] {
  color: var(--danger);
  border-color: rgba(181, 65, 61, 0.28);
  background: #fff0ee;
}

.control-band {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 190px) minmax(280px, 1.45fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid rgba(217, 224, 230, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select,
input {
  min-height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 170px;
  resize: vertical;
  padding: 12px;
  line-height: 1.48;
}

select:focus,
input:focus,
textarea:focus {
  border-color: rgba(15, 123, 108, 0.58);
  box-shadow: 0 0 0 3px rgba(15, 123, 108, 0.12);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.control-band .button-row {
  justify-content: flex-end;
}

.workgrid {
  display: grid;
  grid-template-columns: minmax(330px, 0.95fr) minmax(300px, 1fr) minmax(300px, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  min-width: 0;
  min-height: 360px;
  border: 1px solid rgba(217, 224, 230, 0.92);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 12px 30px rgba(31, 45, 55, 0.08);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 12px;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.talk-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-self: end;
}

.meters div {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  background: #f8fafb;
}

.meters b {
  display: block;
  margin-bottom: 4px;
  font-size: 21px;
  line-height: 1.1;
}

.meters span {
  color: var(--muted);
  font-size: 12px;
}

.transcript,
.event-log {
  height: 292px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
}

.transcript {
  padding: 10px;
}

.line {
  max-width: 100%;
  margin-bottom: 8px;
  padding: 9px 10px;
  border-left: 3px solid #aebbc5;
  border-radius: 6px;
  background: #fff;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.line.local {
  border-left-color: #47768a;
}

.line.assistant {
  border-left-color: var(--accent);
}

.event-log {
  padding: 8px;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.event {
  padding: 7px 8px;
  border-bottom: 1px solid #e8edf1;
  overflow-wrap: anywhere;
}

.event.ok {
  color: var(--ok);
}

.event.warn {
  color: var(--warn);
}

.event.bad {
  color: var(--danger);
}

.log-panel {
  grid-column: 1 / -1;
  min-height: 280px;
}

.log-panel .event-log {
  height: 210px;
}

@media (max-width: 1040px) {
  .control-band {
    grid-template-columns: 1fr 1fr;
  }

  .control-band .wide,
  .control-band .button-row {
    grid-column: 1 / -1;
  }

  .control-band .button-row {
    justify-content: flex-start;
  }

  .workgrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 20px, 1360px);
    padding-top: 16px;
  }

  .topbar {
    display: grid;
  }

  .status-stack {
    justify-content: flex-start;
    min-width: 0;
  }

  .control-band {
    grid-template-columns: 1fr;
  }

  .control-band .wide,
  .control-band .button-row {
    grid-column: auto;
  }

  .button-row button {
    flex: 1 1 130px;
  }

  .meters {
    grid-template-columns: 1fr;
  }
}
