:root {
  --bg: #10131b;
  --surface: #171b24;
  --surface-raised: #1d2230;
  --surface-muted: #131824;
  --border: #2d374b;
  --border-strong: #41619b;
  --text: #e7edf8;
  --muted: #99aac8;
  --accent: #73a8ff;
  --accent-strong: #8ab6ff;
  --accent-soft: rgba(115, 168, 255, 0.15);
  --danger: #ff7d7d;
  --success: #6ed7a6;
  --shadow: 0 26px 60px rgba(0, 0, 0, 0.35);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(82, 123, 201, 0.18), transparent 28%),
    linear-gradient(180deg, #0b0e15 0%, #10131b 100%);
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

body {
  padding: 24px;
}

.app-shell {
  max-width: 1440px;
  margin: 0 auto;
}

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

.topbar h1,
.modal-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.6rem, 2vw, 2rem);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
}

.topbar-actions,
.modal-actions,
.field-grid,
.panel-toolbar,
.chat-form,
.suggestion-topline,
.panel-header,
.suggestion-batch-header,
.topbar-status-group,
.connection-pill,
.record-row,
.record-summary,
.metric-strip,
.toolbar-stack {
  display: flex;
  gap: 12px;
}

.topbar-status-group,
.record-summary,
.toolbar-stack {
  flex-direction: column;
}

.topbar-status-group {
  flex: 1;
  min-width: 280px;
}

.connection-pill {
  align-items: center;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(19, 24, 36, 0.86);
  color: var(--muted);
  font-size: 0.9rem;
}

.secondary-pill strong {
  color: var(--text);
}

.connection-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #67758d;
  box-shadow: 0 0 0 6px rgba(103, 117, 141, 0.15);
}

.connection-dot.connected {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(110, 215, 166, 0.18);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 1fr) minmax(320px, 1fr);
  gap: 12px;
}

.panel {
  min-height: 72vh;
  display: flex;
  flex-direction: column;
  background: rgba(16, 19, 27, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header,
.panel-toolbar {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  align-items: center;
  justify-content: space-between;
  color: #b5c4de;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-family: "IBM Plex Mono", monospace;
}

.toolbar-stack {
  align-items: flex-end;
}

.panel-body {
  padding: 14px;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 14px;
}

.transcript-panel {
  align-items: flex-start;
}

.record-row {
  width: 100%;
  align-items: center;
}

.record-summary {
  flex: 1;
}

.record-button {
  width: 64px;
  height: 64px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, #7eb0ff, #5b88dd);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(58, 113, 203, 0.35);
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.record-button:hover,
.ghost-button:hover,
.primary-button:hover,
.suggestion-card:hover {
  transform: translateY(-1px);
}

.record-button.recording {
  animation: pulse 1.8s infinite;
  filter: saturate(1.2);
}

.record-button-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #0e131d;
}

.panel-callout,
.helper-card,
.transcript-item,
.suggestion-batch,
.chat-item {
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(34, 42, 58, 0.95), rgba(24, 29, 40, 0.95));
  border-radius: 12px;
}

.panel-callout,
.helper-card {
  padding: 16px;
  color: #dbe5f5;
  line-height: 1.55;
}

.helper-card {
  color: #bfd0ef;
}

.metric-strip {
  width: 100%;
}

.metric-card {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(115, 168, 255, 0.2);
  background: rgba(19, 25, 37, 0.9);
}

.metric-label,
.field-help {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
}

.transcript-list,
.suggestion-batches,
.chat-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding-right: 4px;
}

.transcript-item,
.chat-item,
.suggestion-batch {
  padding: 14px;
}

.transcript-meta,
.chat-meta,
.suggestion-batch-meta,
.suggestion-kind,
.suggestion-time,
.toolbar-meta {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.transcript-text,
.chat-text,
.suggestion-preview {
  margin: 8px 0 0;
  color: var(--text);
  line-height: 1.58;
  white-space: pre-wrap;
}

.suggestion-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.suggestion-card {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(115, 168, 255, 0.4);
  background: linear-gradient(180deg, rgba(20, 27, 41, 0.98), rgba(16, 21, 33, 0.98));
  border-radius: 14px;
  padding: 14px;
  color: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.suggestion-card:hover {
  border-color: var(--accent-strong);
  background: linear-gradient(180deg, rgba(23, 31, 47, 1), rgba(19, 25, 39, 1));
}

.suggestion-topline,
.suggestion-batch-header {
  justify-content: space-between;
  align-items: center;
}

.suggestion-title {
  margin: 10px 0 0;
  font-size: 1rem;
}

.chat-item.user {
  border-color: rgba(126, 176, 255, 0.65);
}

.chat-item.assistant {
  border-color: rgba(121, 214, 178, 0.5);
}

.chat-form {
  align-items: center;
  margin-top: auto;
}

.chat-input,
.field input,
.field textarea {
  width: 100%;
  color: var(--text);
  background: rgba(24, 29, 41, 0.95);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  outline: none;
}

.chat-input:focus,
.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(115, 168, 255, 0.14);
}

.primary-button,
.ghost-button {
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 160ms ease, filter 160ms ease, background 160ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #75aaff, #6696e8);
  color: #08111f;
  font-weight: 700;
}

.ghost-button {
  background: rgba(27, 34, 48, 0.95);
  color: var(--text);
  border-color: var(--border);
}

.status-chip {
  color: var(--accent-strong);
}

.status-chip.idle {
  color: var(--muted);
}

.status-chip.recording {
  color: var(--danger);
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 24px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  min-height: 160px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 30;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 14, 0.72);
  backdrop-filter: blur(10px);
}

.modal-card {
  position: relative;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  border-radius: 24px;
  padding: 24px;
  background: #0f141e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.modal-header,
.field,
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-header {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.settings-form {
  gap: 16px;
}

.field span {
  color: var(--muted);
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 125, 125, 0.28), 0 14px 30px rgba(58, 113, 203, 0.35);
  }
  50% {
    box-shadow: 0 0 0 18px rgba(255, 125, 125, 0), 0 14px 30px rgba(58, 113, 203, 0.42);
  }
}

@media (max-width: 1080px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: 420px;
  }
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .topbar,
  .topbar-actions,
  .chat-form,
  .field-grid,
  .modal-header,
  .modal-actions,
  .record-row,
  .metric-strip,
  .toolbar-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .record-button {
    width: 58px;
    height: 58px;
  }
}
