:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1e40af;
  --brand-2: #4338ca;
  --brand-ink: #ffffff;
  --accent: #2563eb;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg) !important;
  color: var(--ink) !important;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell { max-width: 960px; margin: 0 auto; padding: 20px 20px 60px; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; background: #ffffff;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.topbar .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: white; font-weight: 700; display: grid; place-items: center; font-size: 14px;
  letter-spacing: .5px;
}
.topbar h1 { font-size: 15px; margin: 0; line-height: 1.2; }
.topbar .sub  { font-size: 12px; color: var(--muted); margin: 2px 0 0; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13px; color: var(--ink-2); }
.topbar .who strong { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #1d3fa0; }
.btn-secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: #f1f5f9; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { color: var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px;
}
.card + .card { margin-top: 16px; }

h2.section { font-size: 20px; margin: 0 0 6px; }
.section-sub { font-size: 13px; color: var(--muted); margin: 0 0 18px; }

/* Login */
.login-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 24px 20px; }
.login-card { width: 100%; max-width: 420px; }
.login-card h2 { margin: 0 0 4px; font-size: 22px; }
.login-card p  { margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 10px; font-size: 15px; font-family: inherit; background: #fff;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.alert {
  padding: 10px 12px; border-radius: 10px; font-size: 13px;
  background: #fef2f2; color: var(--bad); border: 1px solid #fecaca;
  margin-bottom: 14px;
}
.alert-ok { background: #f0fdf4; color: var(--good); border-color: #bbf7d0; }

/* Dropdown search */
.dropdown-wrap { position: relative; }
.dropdown-list {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  max-height: 280px; overflow-y: auto; background: #fff; border: 1px solid var(--line);
  border-top: 0; border-radius: 0 0 10px 10px; box-shadow: 0 8px 24px rgba(15,23,42,.12);
}
.dropdown-item { padding: 10px 13px; cursor: pointer; transition: background .1s; }
.dropdown-item:hover { background: #f1f5f9; }
.dropdown-item-name { font-weight: 600; font-size: 14px; }
.dropdown-item-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dropdown-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* Startup detail card */
.startup-detail { margin-top: 16px; padding: 16px; background: #f8fafc; border-radius: 12px; border: 1px solid var(--line); }
.detail-header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail-header h3 { margin: 0; font-size: 18px; }
.detail-loc { font-size: 13px; color: var(--muted); }
.detail-tagline { font-size: 14px; color: var(--ink-2); margin: 8px 0 12px; line-height: 1.5; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-bottom: 12px; }
.detail-cell { font-size: 13px; line-height: 1.4; }
.detail-label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 2px; }
.detail-desc { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.detail-diff { font-size: 13px; color: var(--ink-2); line-height: 1.5; margin-top: 8px; }
.detail-cell a { word-break: break-all; }

/* Dashboard */
.startup-list { display: grid; gap: 12px; }
.startup-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; transition: all .15s;
}
.startup-row:hover { border-color: #cbd5e1; transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.startup-row .order {
  width: 34px; height: 34px; border-radius: 10px; background: #eef2ff;
  color: var(--brand-2); font-weight: 700; display: grid; place-items: center; font-size: 14px;
  flex: 0 0 34px;
}
.startup-row .info { flex: 1; min-width: 0; }
.startup-row .company { font-weight: 600; font-size: 15px; }
.startup-row .one { font-size: 13px; color: var(--muted); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.startup-row .status {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px;
  background: #f1f5f9; color: var(--muted);
}
.startup-row .status.done { background: #dcfce7; color: var(--good); }

/* Interview form */
.interview-header {
  padding: 24px; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: white; border-radius: var(--radius); margin-bottom: 20px;
}
.interview-header .eyebrow { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: .5px; }
.interview-header h1 { margin: 4px 0 6px; font-size: 26px; }
.interview-header p { margin: 0; opacity: .9; font-size: 14px; }

.section-item {
  padding: 16px 0; border-top: 1px solid var(--line);
}
.section-item:first-child { border-top: 0; padding-top: 4px; }
.section-item .row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.section-item .label { font-weight: 600; font-size: 15px; }
.section-item .help  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.section-item .score { font-weight: 700; font-size: 18px; color: var(--brand-2); min-width: 32px; text-align: right; }
.section-item .slider {
  width: 100%; margin-top: 12px; accent-color: var(--brand);
  -webkit-appearance: none; appearance: none; height: 6px; border-radius: 99px;
  background: #e2e8f0; outline: none;
}
.section-item .slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); cursor: pointer; border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,.2);
}
.section-item .slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brand);
  cursor: pointer; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(15,23,42,.2);
}
.section-item .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.section-item .notes-field { margin-top: 10px; }
.section-item .notes-field textarea {
  width: 100%; min-height: 60px; padding: 10px 12px; font-family: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; resize: vertical; background: #fff;
}
.section-item .notes-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.overall-bar {
  display: flex; align-items: center; gap: 14px; margin-top: 18px;
  padding: 16px 18px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px;
}
.overall-bar .lbl { font-weight: 600; }
.overall-bar .val { font-size: 28px; font-weight: 700; color: var(--brand); margin-left: auto; }

.decision-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.decision-btn {
  padding: 8px 16px; border-radius: 99px; border: 2px solid var(--line);
  font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; transition: all .15s;
}
.decision-btn.selected { border-color: currentColor; background: currentColor; color: #fff; }

/* Interview Questions */
.question-item { margin-bottom: 18px; }
.question-item:last-child { margin-bottom: 0; }
.question-label { font-weight: 600; font-size: 14px; color: var(--ink); display: block; margin-bottom: 6px; }
.question-textarea {
  width: 100%; min-height: 80px; padding: 10px 12px; font-family: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; resize: vertical; background: #fff;
}
.question-textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.summary-field { margin-top: 16px; }
.summary-field label { font-weight: 600; font-size: 15px; display: block; margin-bottom: 8px; }
.summary-field textarea {
  width: 100%; min-height: 120px; padding: 12px 14px; font-family: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 10px; resize: vertical; background: #fff;
}
.summary-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.form-footer {
  display: flex; gap: 10px; justify-content: space-between; margin-top: 20px; align-items: center;
  flex-wrap: wrap;
}
.form-footer .status-msg { font-size: 13px; color: var(--muted); }

/* Level toggle */
.level-toggle { display: flex; gap: 4px; margin-bottom: 20px; background: #f1f5f9; border-radius: 10px; padding: 4px; }
.level-toggle button { flex: 1; padding: 10px; border: 0; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; background: transparent; color: var(--muted); }
.level-toggle button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* Admin */
.tabs { display:flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--muted); border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.admin-table th, .admin-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.admin-table th { background: #f1f5f9; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 12px; }
details summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 12px; }
details summary .avg { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--brand); }
.subm { padding: 12px 0; border-top: 1px solid var(--line); }
.subm .meta { font-size: 13px; color: var(--muted); }
.subm .judge { font-weight: 600; color: var(--ink); }
.subm .notes { margin-top: 6px; font-size: 14px; white-space: pre-wrap; color: var(--ink-2); }
.scorecard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.scorecard-grid .cell { background: #f8fafc; padding: 10px; border-radius: 8px; font-size: 12px; }
.scorecard-grid .cell .n { font-size: 18px; font-weight: 700; color: var(--brand); display: block; }

.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius);
}

.badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }

@media (max-width: 560px) {
  .app-shell { padding: 14px 14px 60px; }
  .card { padding: 18px; }
  .interview-header { padding: 20px; }
  .interview-header h1 { font-size: 22px; }
}
