:root {
  --bg: #0d1015;
  --surface: #151a22;
  --surface-2: #1c232e;
  --border: #2a3444;
  --text: #e6edf5;
  --muted: #8b9bb4;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --warn: #f59e0b;
  --ok: #10b981;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

.badge-live {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--accent);
  color: #fff;
  padding: 3px 7px;
  border-radius: 4px;
}

.metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pill.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.pill.ok {
  border-color: var(--ok);
  color: var(--ok);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.container {
  max-width: 1040px;
  margin: 20px auto;
  padding: 0 16px 60px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
}

.tab-panel.active {
  display: flex;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card h2, .card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.daily-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border-left: 4px solid var(--warn);
}

.daily-banner.done {
  border-left-color: var(--ok);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--warn);
  margin-bottom: 4px;
}

.daily-banner.done .eyebrow {
  color: var(--ok);
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

select, input[type="text"], input[type="password"], textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 0.95rem;
  font-family: inherit;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  background: var(--surface-2);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.btn.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn.danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn.danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.btn.record {
  background: #1f2937;
  border-color: var(--accent);
  padding: 14px 18px;
  width: 100%;
}

.btn.record.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.recorder-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.text-fallback {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.muted {
  color: var(--muted);
  margin: 0;
}

.small-mt {
  margin-top: 8px;
  font-size: 0.88rem;
}

.feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.turn {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.turn.assistant {
  border-left: 3px solid var(--accent);
}

.turn.user {
  border-left: 3px solid #94a3b8;
}

.turn-role {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.critique-box {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.88rem;
}

.critique-box strong {
  color: var(--warn);
}

.rewrite {
  margin-top: 6px;
  color: var(--ok);
}

.scorecard {
  border: 1px solid var(--accent);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.score-cell {
  background: var(--surface-2);
  padding: 10px;
  border-radius: 6px;
  text-align: center;
}

.score-cell .val {
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0;
}

.script-block {
  max-height: 260px;
  overflow-y: auto;
  background: var(--surface-2);
  padding: 12px;
  border-radius: 6px;
  margin: 10px 0;
  font-size: 0.9rem;
}

.script-line {
  margin-bottom: 8px;
}

.challenge-box {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
}
