/* ============================================================
   Biotech Intelligence — Review Site Design System
   Shares design tokens with the main site (biotechiq.io)
   ============================================================ */

:root {
  --bg:           #F4F7FA;
  --surface:      #FFFFFF;
  --border:       #dce4ec;
  --text:         #1A1F2E;
  --text-muted:   #5a6a7e;
  --text-light:   #8fa0b4;
  --header-bg:    #1A1F2E;
  --header-text:  #f8fafc;
  --accent:       #1D6FA4;
  --accent-hover: #165d8a;
  --red:          #C53030;
  --red-bg:       #fff5f5;
  --red-border:   #fc8181;
  --amber:        #D97706;
  --amber-bg:     #fffbeb;
  --amber-border: #f6ad55;
  --green:        #276749;
  --green-bg:     #f0fff4;
  --green-border: #9ae6b4;
  --gray-bg:      #f8fafc;
  --gray-border:  #e2e8f0;
  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.1);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── Spinner ── */
.spinner {
  display: inline-block; width: 28px; height: 28px;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 0; color: var(--text-muted);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--header-bg); color: var(--header-text);
  padding: 0 24px; display: flex; align-items: center; gap: 24px;
  height: 52px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.site-logo {
  font-size: 1.05rem; font-weight: 700; letter-spacing: -.3px;
  color: #fff; white-space: nowrap; margin-right: 8px;
}
.site-logo span { color: #60a5fa; }
.site-badge {
  font-size: .68rem; font-weight: 600; background: #f59e0b; color: #1c1917;
  border-radius: 4px; padding: 2px 7px; letter-spacing: .4px;
  text-transform: uppercase;
}
.header-nav { display: flex; gap: 0; height: 100%; }
.header-nav__tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 0 14px; font-size: .83rem; font-weight: 500; color: #94a3b8;
  cursor: pointer; transition: color .15s, border-color .15s;
  height: 100%; display: flex; align-items: center; gap: 6px; white-space: nowrap;
}
.header-nav__tab:hover { color: #e2e8f0; }
.header-nav__tab.active { color: #fff; border-bottom-color: #60a5fa; }
.header-nav__tab .badge-count {
  background: var(--accent); color: #fff; border-radius: 10px;
  font-size: .7rem; font-weight: 700; padding: 1px 6px; min-width: 18px;
  text-align: center;
}
.header-nav__tab .badge-count.warn { background: var(--amber); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.header-actions__status { font-size: .78rem; color: #64748b; }
.btn-logout {
  background: none; border: 1px solid #475569; color: #94a3b8;
  font-size: .75rem; padding: 4px 10px; border-radius: 4px;
  cursor: pointer; transition: all .15s;
}
.btn-logout:hover { border-color: #94a3b8; color: #e2e8f0; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 40px 36px; width: 360px;
  box-shadow: var(--shadow); text-align: center;
}
.login-card h1 { font-size: 1.3rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.login-card p { font-size: .85rem; color: var(--text-muted); margin-bottom: 28px; }
.login-card input[type="password"] {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: .95rem; color: var(--text); background: var(--bg);
  outline: none; transition: border-color .15s; margin-bottom: 12px;
}
.login-card input[type="password"]:focus { border-color: var(--accent); }
.login-card .error { color: var(--red); font-size: .82rem; margin-bottom: 10px; min-height: 20px; }

/* ============================================================
   LAYOUT
   ============================================================ */
.page { max-width: 1800px; margin: 0 auto; padding: 20px 2%; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  border: none; border-radius: var(--radius-sm); padding: 7px 16px;
  font-size: .85rem; font-weight: 600; cursor: pointer; transition: background .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #9b2c2c; }
.btn-sm { padding: 4px 10px; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 20px;
  flex: 1 1 120px; box-shadow: var(--shadow-sm);
}
.stat-card .stat-value {
  font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1;
}
.stat-card .stat-label {
  font-size: .72rem; color: var(--text-muted); margin-top: 4px;
  font-weight: 500; text-transform: uppercase; letter-spacing: .4px;
}
.stat-card.accent .stat-value { color: var(--accent); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.amber  .stat-value { color: var(--amber); }
.stat-card.green  .stat-value { color: var(--green); }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.filter-bar label { font-size: .78rem; color: var(--text-muted); font-weight: 500; }
.filter-bar select,
.filter-bar input[type="text"] {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: .83rem; color: var(--text);
  background: var(--bg); outline: none; transition: border-color .15s;
}
.filter-bar select:focus,
.filter-bar input[type="text"]:focus { border-color: var(--accent); }
.filter-bar input[type="text"] { min-width: 140px; }
.filter-sep { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

/* ============================================================
   TABLES (review-specific editable)
   ============================================================ */
.review-table-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow-x: auto; margin-bottom: 16px;
}
.review-table {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.review-table th {
  background: var(--bg); color: var(--text-muted); font-size: .72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.review-table td {
  padding: 7px 10px; border-bottom: 1px solid var(--gray-border);
  vertical-align: middle;
}
.review-table tr:last-child td { border-bottom: none; }
.review-table tr:hover td { background: var(--bg); }
.review-table tr.approved td { background: #f0fff4; }
.review-table tr.rejected td { background: #fff5f5; }
.review-table tr.inactive td { opacity: .55; }

/* Editable cell inputs */
.cell-input {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 4px 7px; font-size: .82rem; color: var(--text);
  background: transparent; width: 100%; outline: none;
  transition: border-color .15s, background .15s;
  font-family: var(--font);
}
.cell-input:hover { border-color: var(--border); background: var(--bg); }
.cell-input:focus { border-color: var(--accent); background: var(--surface); }
.cell-select {
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 4px 7px; font-size: .82rem; color: var(--text);
  background: transparent; outline: none; cursor: pointer;
  transition: border-color .15s, background .15s;
  font-family: var(--font);
}
.cell-select:hover { border-color: var(--border); background: var(--bg); }
.cell-select:focus { border-color: var(--accent); background: var(--surface); }

/* Row action select */
.action-select {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px 8px; font-size: .8rem; font-weight: 600;
  background: var(--bg); cursor: pointer; outline: none; width: 100%;
  font-family: var(--font);
}
.action-select.approve { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.action-select.reject  { border-color: var(--red);   color: var(--red);   background: var(--red-bg); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block; border-radius: 4px; padding: 2px 7px;
  font-size: .72rem; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap;
}
.badge-ticker {
  background: #1e293b; color: #fff; border-radius: 4px;
  padding: 2px 7px; font-size: .72rem; font-weight: 700;
}
.badge-new    { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-update { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-conf-high { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-conf-med  { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-conf-low  { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }

/* Stage badges — matching main site STAGE_CLASS */
.stage-badge {
  display: inline-block; border-radius: 4px; padding: 2px 8px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.badge-preclinical  { background:#ecf0f1; color:#7f8c8d; }
.badge-ind          { background:#ecf0f1; color:#7f8c8d; }
.badge-phase1       { background:#f0f4f8; color:#95a5a6; }
.badge-phase12      { background:#f0f4f8; color:#95a5a6; }
.badge-phase2       { background:#fef9e7; color:#d68910; }
.badge-phase23      { background:#fef5e4; color:#ca6f1e; }
.badge-phase3       { background:#eaf4fb; color:#2980b9; }
.badge-nda          { background:#eaf4fb; color:#2980b9; }
.badge-pdufa        { background:#e8f8f5; color:#1a9c7e; }
.badge-approved     { background:#e9f7ef; color:#27ae60; }
.badge-commercial   { background:#eafaf1; color:#2ecc71; }
.badge-discontinued { background:#fdedec; color:#c0392b; }
.badge-onhold       { background:#fdedec; color:#c0392b; }
.badge-partnered    { background:#f5eef8; color:#8e44ad; }

/* Source badges */
.badge-8k       { background:#eff6ff; color:#1d4ed8; }
.badge-openfda  { background:#fffbeb; color:#b45309; }

/* Status badges (news alerts) */
.badge-status-produced { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.badge-status-noop     { background: var(--gray-bg);  color: var(--text-muted); border: 1px solid var(--gray-border); }
.badge-status-skipped  { background: var(--gray-bg);  color: var(--text-muted); border: 1px solid var(--gray-border); }

/* ============================================================
   ALERT / NOTICE BANNERS
   ============================================================ */
.alert {
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px;
  font-size: .85rem; border: 1px solid;
}
.alert-warn { background: var(--amber-bg); border-color: var(--amber-border); color: #92400e; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.alert-success { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.alert-error { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }

/* ============================================================
   TOAST NOTIFICATION
   ============================================================ */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  background: #1e293b; color: #f8fafc; border-radius: var(--radius);
  padding: 12px 18px; font-size: .85rem; font-weight: 500;
  box-shadow: var(--shadow); pointer-events: auto;
  animation: slide-in .2s ease; max-width: 380px;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error   { border-left: 4px solid var(--red); }
.toast.info    { border-left: 4px solid var(--accent); }
@keyframes slide-in { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   SIDEBAR (quick stats)
   ============================================================ */
.layout-with-sidebar {
  display: grid; grid-template-columns: 1fr 220px; gap: 20px; align-items: start;
}
@media (max-width: 900px) { .layout-with-sidebar { grid-template-columns: 1fr; } }
.sidebar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
  position: sticky; top: 72px;
}
.sidebar h3 { font-size: .8rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-muted); margin-bottom: 14px; }
.sidebar-stat { margin-bottom: 12px; }
.sidebar-stat .value { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1; }
.sidebar-stat .value.warn { color: var(--amber); }
.sidebar-stat .label { font-size: .73rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   EXPANDABLE (run history column defs)
   ============================================================ */
.expandable-header {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: .82rem; color: var(--text-muted); padding: 8px 0; user-select: none;
}
.expandable-header:hover { color: var(--accent); }
.expandable-body { font-size: .82rem; color: var(--text-muted); line-height: 1.7; padding: 6px 0 10px; }
.expandable-body code { background: var(--bg); border-radius: 3px; padding: 1px 5px; font-size: .8rem; }

/* ============================================================
   MISC
   ============================================================ */
.caption { font-size: .78rem; color: var(--text-muted); margin-bottom: 10px; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.text-muted { color: var(--text-muted); }
.monospace { font-family: 'SF Mono', 'Fira Code', monospace; font-size: .8rem; }
.no-results {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
  font-size: .9rem; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.actions-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  flex-wrap: wrap;
}
.actions-bar .result-count { font-size: .8rem; color: var(--text-muted); margin-left: auto; }

/* Checkbox cell */
.cell-checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
