:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1f2933;
  background-color: #f8fafc;
}

body {
  margin: 0;
  padding: 0;
}

.is-hidden {
  display: none !important;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: grid;
  gap: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

.dashboard-column {
  display: grid;
  gap: 1.5rem;
  align-content: start;
}

@media (min-width: 960px) {
  .dashboard-grid {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    align-items: start;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
}

header p {
  margin: 0;
  color: #52606d;
}

.recordings-link {
  align-self: flex-start;
  text-decoration: none;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.recordings-link:hover,
.recordings-link:focus-visible {
  background: #ffffff;
  color: #0f172a;
}

.controls,
.status,
.audio {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d2d6dc;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.controls,
.transcripts {
  display: grid;
  gap: 1.2rem;
}

.metric-notes {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d2d6dc;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 1rem;
}

.metric-note-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.metric-note {
  border-left: 4px solid #2563eb;
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.04);
}

.metric-note h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.metric-note p {
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.35;
}

.metric-note.highlight {
  border-left-color: #f97316;
  background: #fff7ed;
}

.metric-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-weight: 600;
}

.field small {
  color: #7b8794;
}

input,
select,
textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid #cbd2d9;
  border-radius: 8px;
  background-color: #f1f5f9;
  transition: border-color 0.2s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #2563eb;
  background-color: #ffffff;
}

.buttons {
  display: flex;
  gap: 0.75rem;
}

button {
  padding: 0.7rem 1.2rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

button[disabled] {
  cursor: not-allowed;
  background-color: #93c5fd;
}

.status h2,
.audio h2,
.transcripts h2 {
  margin: 0 0 1rem;
}

.log {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  padding-right: 0.5rem;
}

.log-entry {
  border-left: 4px solid #2563eb;
  background-color: #f1f5f9;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  word-break: break-word;
}

.log-entry.error {
  border-color: #dc2626;
  background-color: #fee2e2;
}

.log-entry.warn {
  border-color: #d97706;
  background-color: #fef3c7;
}

.log-entry.success {
  border-color: #16a34a;
  background-color: #dcfce7;
}

.log-entry pre {
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 100%;
}

.timestamp {
  color: #334155;
  font-weight: 600;
  margin-right: 0.5rem;
}

audio {
  width: 100%;
}

.transcript-columns {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.transcript-column h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.transcript-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
  max-height: 500px;
  overflow-y: auto;
}

.transcript-list li {
  background: #f8fafc;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  border-left: 4px solid #2563eb;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.transcript-list li.agent {
  border-left-color: #16a34a;
}

.transcript-text {
  color: #1f2933;
  line-height: 1.35;
}

.transcript-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.transcript-metrics.empty {
  display: none;
}

.metric-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background-color: #e0f2fe;
  color: #0f172a;
}

.metric-pill.user {
  background-color: #dcfce7;
  border-color: #bbf7d0;
}

.metric-pill.assistant {
  background-color: #ede9fe;
  border-color: #ddd6fe;
}

.metric-pill.metric-pill-highlight {
  background-color: #fde68a;
  border-color: #fbbf24;
  color: #92400e;
}

.transcript-meta {
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .buttons {
    flex-direction: column;
  }
  .transcript-columns {
    grid-template-columns: 1fr;
  }
}

.recordings-app {
  max-width: 1000px;
}

.recordings-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.back-link {
  text-decoration: none;
  font-weight: 600;
  color: #2563eb;
}

.recordings-panel {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d2d6dc;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 1rem;
}

.recordings-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.recordings-control-actions {
  display: flex;
  gap: 0.5rem;
}

.recordings-status {
  font-weight: 600;
  color: #475569;
}

.recordings-status[data-tone='error'] {
  color: #b91c1c;
}

.recordings-status[data-tone='success'] {
  color: #15803d;
}

.recordings-table-wrapper {
  overflow-x: auto;
}

.recordings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.recordings-table th,
.recordings-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.recordings-table th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.recording-primary {
  font-weight: 600;
  color: #0f172a;
}

.recording-secondary {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.15rem;
  word-break: break-all;
}

.recording-missing {
  color: #cbd5f5;
}

.file-size {
  color: #475569;
  font-size: 0.85rem;
}

.recordings-empty {
  text-align: center;
  padding: 1rem;
  color: #94a3b8;
  font-style: italic;
}
