/* Carnegie Score — Main stylesheet */

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3250;
  --accent: #6c8ef5;
  --accent2: #a78bfa;
  --text: #e2e4f0;
  --muted: #7a7f9d;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
nav { display: flex; gap: 1.5rem; }
nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.25rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
nav a:hover, nav a.active {
  color: var(--text);
  border-color: var(--accent);
}

/* ── Main ─────────────────────────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 2rem 1.5rem;
}
h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin: 1.5rem 0 0.75rem; color: var(--accent2); }

/* ── Page header ─────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.badge {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Calls table ─────────────────────────────────────────────────────── */
.calls-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.calls-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.calls-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.calls-table tr:hover td { background: var(--surface2); }
.calls-table tr.row-error td { color: var(--red); }
.file-name { font-weight: 500; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Score pills ─────────────────────────────────────────────────────── */
.score-pill {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}
.score-high { background: rgba(52,211,153,0.15); color: var(--green); }
.score-mid  { background: rgba(251,191,36,0.15); color: var(--yellow); }
.score-low  { background: rgba(248,113,113,0.15); color: var(--red); }
.score-none { background: var(--surface2); color: var(--muted); }

/* Grade colors */
.grade.A\+, .grade.A { color: var(--green); font-weight: 700; }
.grade.B { color: #86efac; font-weight: 700; }
.grade.C { color: var(--yellow); font-weight: 700; }
.grade.D { color: #fb923c; font-weight: 700; }
.grade.F { color: var(--red); font-weight: 700; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-sm {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  transition: background 0.15s;
}
.btn-sm:hover { background: var(--border); }

.btn-primary {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  display: inline-block;
  padding: 0.45rem 1rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--border); }

/* ── Empty state ─────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}
.empty-state p { margin-bottom: 0.5rem; }
.empty-state code { color: var(--accent); background: var(--surface2); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* ── Call detail ─────────────────────────────────────────────────────── */
.breadcrumb { margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.breadcrumb a:hover { color: var(--text); }

.call-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.call-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.3rem; }
.call-meta { color: var(--muted); font-size: 0.85rem; }
.call-meta code { color: var(--accent); }

.overall-score-box {
  flex-shrink: 0;
  text-align: center;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  min-width: 110px;
  border: 2px solid;
}
.overall-score-box.score-high { border-color: var(--green); background: rgba(52,211,153,0.08); }
.overall-score-box.score-mid  { border-color: var(--yellow); background: rgba(251,191,36,0.08); }
.overall-score-box.score-low  { border-color: var(--red); background: rgba(248,113,113,0.08); }
.big-score { font-size: 2.5rem; font-weight: 800; line-height: 1; }
.big-grade { font-size: 1.4rem; font-weight: 700; }
.score-label { font-size: 0.75rem; color: var(--muted); }

.summary-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
.summary-box p { line-height: 1.6; margin-bottom: 0.5rem; }
.meta-line { font-size: 0.8rem; color: var(--muted); }
.meta-line code { color: var(--accent); }

/* ── Principle cards ─────────────────────────────────────────────────── */
.part-section { margin-bottom: 2rem; }
.part-title { font-size: 1rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }

.principles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.principle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--border);
}
.principle-card.good { border-left-color: var(--green); }
.principle-card.mid  { border-left-color: var(--yellow); }
.principle-card.low  { border-left-color: var(--red); }

.principle-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.principle-num {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface2);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  flex-shrink: 0;
}
.principle-title {
  font-size: 0.88rem;
  font-weight: 600;
  flex: 1;
}
.principle-score {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
}

.score-bar {
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}
.score-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

.evidence {
  font-size: 0.83rem;
  color: var(--text);
  line-height: 1.5;
  font-style: italic;
  margin-bottom: 0.4rem;
}
.principle-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.bottom-actions { display: flex; gap: 0.75rem; margin: 1.5rem 0; }

.transcript-raw {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
}
.transcript-raw summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  user-select: none;
}
.transcript-raw pre {
  margin-top: 0.75rem;
  font-size: 0.78rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  max-height: 400px;
  overflow-y: auto;
}

/* ── Status page ─────────────────────────────────────────────────────── */
.status-grid {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  text-align: center;
  min-width: 100px;
}
.stat-num { font-size: 2rem; font-weight: 800; color: var(--accent); margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.worker-ok  .stat-num { color: var(--green); }
.worker-dead .stat-num { color: var(--red); }

.config-table { border-collapse: collapse; width: 100%; max-width: 600px; font-size: 0.88rem; }
.config-table th { text-align: left; padding: 0.4rem 0.75rem; color: var(--muted); width: 160px; }
.config-table td { padding: 0.4rem 0.75rem; }
.config-table tr { border-bottom: 1px solid var(--border); }

.checklist { list-style: none; padding: 0; }
.checklist li { padding: 0.35rem 0; font-size: 0.88rem; color: var(--muted); }
.checklist code { color: var(--accent); background: var(--surface2); padding: 0.1rem 0.4rem; border-radius: 4px; }

/* ── Footer ─────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
footer a { color: var(--accent); text-decoration: none; }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .call-header { flex-direction: column; }
  .principles-grid { grid-template-columns: 1fr; }
  .status-grid { flex-direction: column; }
  main { padding: 1.25rem 1rem; }
}

/* ── Auth / sign-in pages ─────────────────────────────────────────────────── */
.auth-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem;
  max-width: 420px;
  text-align: center;
}
.auth-card-wide { max-width: 640px; text-align: left; }
.auth-card h1 { color: var(--accent); font-size: 1.6rem; margin-bottom: 0.75rem; }
.auth-sub { color: var(--text); font-size: 1.05rem; margin-bottom: 1.5rem; }
.auth-note { color: var(--muted); font-size: 0.85rem; margin-top: 1.25rem; line-height: 1.5; }
.btn-google {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.btn-google:hover { background: var(--accent2); }
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  color: var(--green);
  overflow-x: auto;
  margin: 0.5rem 0;
}

/* ── Nav user chip ────────────────────────────────────────────────────────── */
.user-chip {
  color: var(--muted);
  font-size: 0.8rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ── Pills, flash, buttons, forms ─────────────────────────────────────────── */
.ok-pill, .bad-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
}
.ok-pill { background: rgba(52,211,153,0.15); color: var(--green); }
.bad-pill { background: rgba(248,113,113,0.15); color: var(--red); }
.flash {
  border-radius: 6px;
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}
.flash-ok { background: rgba(52,211,153,0.12); color: var(--green); border: 1px solid rgba(52,211,153,0.3); }
.flash-error { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.3); }
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent2); }
.btn-small { padding: 0.3rem 0.7rem; font-size: 0.78rem; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #e05858; }
.folder-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1.5rem;
}
.folder-form input[type=text] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  font-size: 0.9rem;
  min-width: 320px;
}
.folder-form input[type=text]:focus { outline: none; border-color: var(--accent); }
.row-actions { display: flex; gap: 0.5rem; }

/* ── Coaching suggestions panel ─────────────────────────────────────────── */
.suggestions-card {
  margin-bottom: 2rem;
  padding: 1.1rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.suggestions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.suggestions-head h2 { margin: 0; }
.suggestions-list {
  list-style: none;
  padding: 0;
  margin: 0.6rem 0 0;
}
.suggestions-list li {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}
.suggestions-list li:last-child { border-bottom: none; }
.sugg-check {
  cursor: pointer;
  background: var(--surface2);
  border: 1.5px solid var(--accent);
  border-radius: 5px;
  width: 1.25rem;
  height: 1.25rem;
  min-width: 1.25rem;
  line-height: 1;
  color: var(--green);
  font-size: 0.85rem;
  padding: 0;
}
.sugg-check:hover { background: var(--border); }
.sugg-check.checked { border-color: var(--green); }
.sugg-text { color: var(--text); }
.sugg-text.struck { color: var(--muted); text-decoration: line-through; }
.sugg-badge { margin-left: 0.45rem; white-space: nowrap; }
.suggestions-done { margin-top: 0.8rem; }
.suggestions-done summary { cursor: pointer; }
.suggestions-list.done li { border-bottom: none; padding: 0.3rem 0; }
