/* ─────────────────────────────────────────────────────────────────
   ROB2 PWA — styles.css
   Design: Clinical precision meets accessible research UI
   Palette: Deep navy + clinical white + traffic light signals
───────────────────────────────────────────────────────────────── */

/* IBM Plex Sans — served locally, works offline */
@font-face { font-family:'IBM Plex Sans'; font-style:normal; font-weight:300; font-display:swap; src:url('/ROB/fonts/ibm-plex-sans-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Sans'; font-style:normal; font-weight:400; font-display:swap; src:url('/ROB/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Sans'; font-style:normal; font-weight:500; font-display:swap; src:url('/ROB/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Sans'; font-style:normal; font-weight:600; font-display:swap; src:url('/ROB/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Sans'; font-style:normal; font-weight:700; font-display:swap; src:url('/ROB/fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Mono'; font-style:normal; font-weight:400; font-display:swap; src:url('/ROB/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family:'IBM Plex Mono'; font-style:normal; font-weight:500; font-display:swap; src:url('/ROB/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }

/* ── DESIGN TOKENS ─────────────────────────────────────── */
:root {
  --navy:      #0f2040;
  --navy-mid:  #1a3360;
  --navy-soft: #2a4a80;
  --blue:      #2563eb;
  --blue-lt:   #3b82f6;
  --cloud:     #f0f4fb;
  --white:     #ffffff;
  --ink:       #0d1b2e;
  --muted:     #6b7fa3;
  --border:    #dce6f5;
  --border-dk: #b0c2e0;

  /* Traffic lights */
  --low:   #16a34a;
  --low-bg:#dcfce7;
  --some:  #ca8a04;
  --some-bg:#fef9c3;
  --high:  #dc2626;
  --high-bg:#fee2e2;

  --radius:    8px;
  --radius-lg: 14px;
  --shadow:    0 2px 16px rgba(15,32,64,0.10);
  --shadow-lg: 0 8px 40px rgba(15,32,64,0.16);
  --ff:        'IBM Plex Sans', system-ui, sans-serif;
  --ff-mono:   'IBM Plex Mono', monospace;
}

/* ── RESET ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff);
  background: var(--cloud);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--ff); cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: var(--ff); font-size: 1rem; }

/* ── LAYOUT ─────────────────────────────────────────────── */
#app { min-height: 100vh; }

.page-container {
  max-width: 800px; margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2.5rem;
}
.page-card.wide-card { max-width: 960px; }

.page-title {
  font-size: 1.6rem; font-weight: 700;
  color: var(--navy); margin: 0.5rem 0 0.75rem;
}
.page-desc { color: var(--muted); margin-bottom: 2rem; }

/* ── AUTH PAGE ──────────────────────────────────────────── */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.5rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
}
.auth-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2.5rem 2.5rem 2rem;
  width: 100%; max-width: 440px;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-mark {
  display: inline-block;
  font-size: 2.4rem; font-weight: 700; letter-spacing: -1px;
  color: var(--navy);
}
.logo-mark span { color: var(--blue); }
.logo-inline { font-size: 1.1rem; font-weight: 700; color: white; letter-spacing: -0.5px; }
.logo-inline b { color: rgba(255,255,255,0.6); }
.auth-subtitle { color: var(--muted); font-size: 0.9rem; margin-top: 0.25rem; }

.auth-form { display: flex; flex-direction: column; gap: 1.25rem; }
.offline-note {
  text-align: center; font-size: 0.8rem; color: var(--muted);
  margin-top: 1.5rem;
}

/* ── FORMS ─────────────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 0.4rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-group label { font-size: 0.85rem; font-weight: 600; color: var(--navy-mid); }
.field-group input,
.field-group select,
.field-group textarea {
  padding: 0.65rem 0.9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius); background: var(--white);
  color: var(--ink); transition: border-color 0.15s;
  font-size: 0.95rem;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.meta-form { display: flex; flex-direction: column; gap: 1.25rem; }
.radio-group { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.25rem; }
.radio-label {
  display: flex; align-items: flex-start; gap: 0.6rem;
  cursor: pointer; font-size: 0.9rem; color: var(--ink);
}
.radio-label input { margin-top: 3px; accent-color: var(--blue); }
.form-actions { padding-top: 0.5rem; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.6rem 1.4rem;
  border-radius: var(--radius); font-size: 0.9rem; font-weight: 600;
  transition: all 0.15s; border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary  { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover  { background: #1d4ed8; border-color: #1d4ed8; }
.btn-outline  { background: transparent; color: var(--navy); border-color: var(--border-dk); }
.btn-outline:hover  { background: var(--cloud); }
.btn-outline-light { background: transparent; color: white; border-color: rgba(255,255,255,0.5); }
.btn-outline-light:hover { background: rgba(255,255,255,0.12); border-color: white; }
.btn-ghost    { background: transparent; color: var(--muted); }
.btn-ghost:hover    { color: var(--navy); background: var(--cloud); }
.btn-ghost-light { background: transparent; color: rgba(255,255,255,0.75); border-color: transparent; }
.btn-ghost-light:hover { color: white; background: rgba(255,255,255,0.1); }
.btn-secondary { background: var(--navy-soft); color: white; }
.btn-secondary:hover { background: var(--navy-mid); }
.btn-full  { width: 100%; }
.btn-lg    { padding: 0.8rem 2rem; font-size: 1rem; }
.btn-sm    { padding: 0.35rem 0.85rem; font-size: 0.82rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.mt-4 { margin-top: 1.5rem; }

.btn-icon {
  width: 34px; height: 34px; border-radius: 6px;
  font-size: 1rem; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s;
}
.btn-icon:hover { background: var(--cloud); }

/* ── DASHBOARD ──────────────────────────────────────────── */
.dashboard { background: var(--cloud); min-height: 100vh; }

.dash-header {
  background: var(--navy);
  padding: 1rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
}
.dash-title { display: flex; align-items: center; gap: 0.75rem; color: white; }
.dash-label { font-size: 0.9rem; color: rgba(255,255,255,0.65); font-weight: 400; }
.dash-controls { display: flex; align-items: center; gap: 0.75rem; }
.user-chip {
  background: rgba(255,255,255,0.12);
  color: white; padding: 0.3rem 0.75rem;
  border-radius: 20px; font-size: 0.82rem;
  text-decoration: none; transition: background 0.15s;
}
.user-chip:hover { background: rgba(255,255,255,0.22); color: white; }
.dash-toolbar {
  padding: 1.25rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: white;
}
.sync-status { font-size: 0.82rem; color: var(--muted); }
.sync-badge { font-size: 0.78rem; color: var(--some); }

.table-wrapper { padding: 1.5rem 2rem; overflow-x: auto; }
.reviews-table {
  width: 100%; border-collapse: collapse; background: white;
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  overflow: hidden;
}
.reviews-table thead { background: var(--navy); color: white; }
.reviews-table thead th { padding: 0.9rem 1.2rem; text-align: left; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.02em; }
.reviews-table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.reviews-table tbody tr:last-child { border-bottom: none; }
.reviews-table tbody tr:hover { background: var(--cloud); }
.reviews-table td { padding: 0.85rem 1.2rem; font-size: 0.9rem; vertical-align: middle; }
.ref-cell { font-family: var(--ff-mono); font-size: 0.82rem; color: var(--muted); }
.title-cell { font-weight: 500; max-width: 280px; }
.actions-cell { display: flex; gap: 0.3rem; align-items: center; }
.empty-state { text-align: center; padding: 3rem 1rem !important; color: var(--muted); }

/* ── TRAFFIC LIGHTS ─────────────────────────────────────── */
.traffic-light {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.7rem; border-radius: 20px;
  font-size: 0.82rem; font-weight: 600;
}
.tl-low  { background: var(--low-bg);  color: var(--low); }
.tl-some { background: var(--some-bg); color: var(--some); }
.tl-high { background: var(--high-bg); color: var(--high); }
.tl-empty { color: var(--muted); font-style: italic; font-size: 0.82rem; }

/* ── ASSESSMENT PAGE ─────────────────────────────────────── */
.assessment-page {
  display: flex; flex-direction: column; min-height: 100vh;
  background: var(--cloud);
}
.assess-header {
  background: var(--navy); color: white;
  padding: 0.85rem 2rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.assess-header .back-link { margin-bottom: 0; color: rgba(255,255,255,0.7); }
.assess-header .back-link:hover { color: white; }
.assess-paper-info {
  flex: 1; font-size: 0.88rem; color: rgba(255,255,255,0.85);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--muted); font-size: 0.85rem; margin-bottom: 1.25rem; }
.back-link:hover { color: var(--navy); }

/* Domain nav */
.domain-navigator {
  background: var(--navy-mid); padding: 0.6rem 2rem;
  display: flex; gap: 0.5rem; overflow-x: auto;
}
.domain-nav-btn {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 1rem; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.65);
  transition: all 0.15s; white-space: nowrap;
}
.domain-nav-btn:hover { background: rgba(255,255,255,0.12); color: white; }
.domain-nav-btn.active { background: rgba(255,255,255,0.2); color: white; }

/* Domain slide */
.domain-slide {
  max-width: 860px; margin: 1.5rem auto; width: 100%;
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2rem;
}
.domain-slide-header {
  display: flex; align-items: flex-start; gap: 1rem;
  padding-bottom: 1.5rem; border-bottom: 2px solid var(--cloud);
  margin-bottom: 1.5rem;
}
.domain-icon { font-size: 2rem; line-height: 1; }
.domain-title { font-size: 1.25rem; font-weight: 700; color: var(--navy); }
.domain-subtitle { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }
.domain-score-live { margin-left: auto; }

/* Questions */
.questions-container { display: flex; flex-direction: column; gap: 1.5rem; }
.question-block {
  border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem;
  transition: all 0.2s;
}
.question-block.hidden-q { display: none; }
.question-header { display: flex; gap: 0.75rem; align-items: flex-start; margin-bottom: 0.75rem; }
.q-number {
  font-family: var(--ff-mono); font-size: 0.75rem; font-weight: 600;
  background: var(--navy); color: white;
  padding: 0.2rem 0.5rem; border-radius: 4px; white-space: nowrap;
  margin-top: 2px;
}
.q-text { font-size: 0.95rem; font-weight: 500; color: var(--ink); line-height: 1.5; }
.q-hint {
  margin-bottom: 1rem; font-size: 0.82rem; color: var(--muted);
}
.q-hint summary {
  cursor: pointer; color: var(--blue); font-weight: 500;
  user-select: none;
}
.q-hint p { margin-top: 0.5rem; line-height: 1.6; }

.response-grid {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.resp-btn {
  padding: 0.45rem 1rem; border-radius: 20px;
  font-size: 0.82rem; font-weight: 500;
  border: 1.5px solid var(--border-dk); color: var(--ink);
  background: var(--white); transition: all 0.15s;
}
.resp-btn:hover { border-color: var(--blue); color: var(--blue); background: rgba(37,99,235,0.05); }
.resp-btn.active { background: var(--blue); color: white; border-color: var(--blue); }

/* Comment area */
.domain-comment-section { margin-top: 1.75rem; }
.comment-label {
  display: block; font-size: 0.85rem; font-weight: 600;
  color: var(--navy-mid); margin-bottom: 0.5rem;
}
.comment-textarea {
  width: 100%; padding: 0.75rem 1rem;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  resize: vertical; font-size: 0.9rem; color: var(--ink);
  line-height: 1.6; background: var(--white);
}
.comment-textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Slide navigation */
.slide-navigation {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1.5px solid var(--border);
}
.slide-counter { font-size: 0.85rem; color: var(--muted); font-weight: 500; }

/* ── SUMMARY PAGE ─────────────────────────────────────────── */
.summary-page { background: var(--cloud); min-height: 100vh; }
.summary-card {
  max-width: 880px; margin: 1.5rem auto;
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2.5rem;
}
.summary-title {
  font-size: 1.5rem; font-weight: 700; color: var(--navy);
  margin-bottom: 1.5rem;
}
.paper-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem 2rem; background: var(--cloud); border-radius: var(--radius);
  padding: 1.25rem; margin-bottom: 2rem;
}
.paper-meta-grid > div { display: flex; flex-direction: column; gap: 0.15rem; }
.meta-label { font-size: 0.75rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.meta-val { font-size: 0.9rem; color: var(--ink); }
.domain-table-title { font-size: 1.05rem; font-weight: 700; color: var(--navy); margin-bottom: 1rem; }

.summary-table {
  width: 100%; border-collapse: collapse;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; margin-bottom: 2rem;
}
.summary-table thead { background: var(--cloud); }
.summary-table thead th { padding: 0.7rem 1rem; text-align: left; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.summary-table tbody tr { border-top: 1px solid var(--border); }
.summary-table td { padding: 0.85rem 1rem; vertical-align: top; font-size: 0.88rem; }
.domain-row.score-HIGH { background: rgba(220,38,38,0.04); }
.domain-row.score-SOME { background: rgba(202,138,4,0.04); }
.domain-row.score-LOW  { background: rgba(22,163,74,0.04); }
.d-icon { font-size: 1.1rem; text-align: center; width: 40px; }
.d-name { font-weight: 500; }
.d-comment { color: var(--muted); font-size: 0.84rem; max-width: 280px; }
.no-comment { color: #c4cfe0; }

.overall-section {
  border-radius: var(--radius-lg); padding: 1.5rem 2rem;
  border: 2px solid var(--border); margin-bottom: 2rem;
  display: flex; align-items: center; gap: 2rem;
}
.overall-section.overall-low  { background: var(--low-bg);  border-color: var(--low); }
.overall-section.overall-some { background: var(--some-bg); border-color: var(--some); }
.overall-section.overall-high { background: var(--high-bg); border-color: var(--high); }
.overall-label { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--navy-mid); min-width: 140px; }
.overall-score .traffic-light { font-size: 1rem; padding: 0.4rem 1rem; }
.overall-rule { font-size: 0.85rem; color: var(--muted); flex: 1; }

.summary-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ── CONSENSUS PAGE ─────────────────────────────────────── */
.compare-selector { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.compare-selector label { font-weight: 600; color: var(--navy-mid); }
.compare-selector select { padding: 0.5rem 0.9rem; border: 1.5px solid var(--border); border-radius: var(--radius); }
.consensus-actions { display: flex; gap: 1rem; margin-top: 1.5rem; }

.consensus-table { width: 100%; border-collapse: collapse; }
.consensus-table thead { background: var(--cloud); }
.consensus-table thead th { padding: 0.75rem 1rem; text-align: left; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 2px solid var(--border); }
.consensus-table tbody tr { border-bottom: 1px solid var(--border); }
.consensus-table td { padding: 0.85rem 1rem; font-size: 0.9rem; vertical-align: middle; }
.row-mismatch { background: rgba(220,38,38,0.05) !important; }
.row-mismatch td:first-child { border-left: 3px solid var(--high); }
.overall-row { background: var(--cloud) !important; font-weight: 600; }
.mismatch-flag { color: var(--high); font-size: 0.82rem; font-weight: 600; }
.agree-flag   { color: var(--low);  font-size: 0.82rem; font-weight: 600; }
.no-consensus { text-align: center; padding: 2.5rem; color: var(--muted); }
.no-consensus .hint { font-size: 0.85rem; margin-top: 0.5rem; }
.no-consensus .warn { color: var(--high); font-size: 0.82rem; margin-top: 0.75rem; }

/* ── TOAST ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  padding: 0.75rem 1.25rem; border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; color: white;
  box-shadow: var(--shadow-lg); z-index: 9999;
  animation: toastIn 0.3s ease;
}
.toast-success { background: var(--low); }
.toast-info    { background: var(--blue); }
.toast-error   { background: var(--high); }
@keyframes toastIn { from { transform: translateY(1rem); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── UTILITIES ───────────────────────────────────────────── */
.hidden { display: none; }
.error-msg { color: var(--high); font-size: 0.85rem; text-align: center; padding: 0.25rem 0; }

/* ── USER MANAGEMENT ─────────────────────────────────────── */
.admin-toolbar-right {
  display: flex; align-items: center; gap: 1rem;
}
.role-badge {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  padding: 0.15rem 0.55rem; border-radius: 20px; letter-spacing: 0.03em;
}
.role-admin    { background: #e0e7ff; color: #3730a3; }
.role-reviewer { background: var(--cloud); color: var(--muted); }
.role-supreme  { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-weight: 700; border: 1px solid #f59e0b; }
.btn-supreme {
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e;
  font-weight: 700; border: 1px solid #f59e0b;
}
.btn-supreme:hover { background: linear-gradient(135deg, #fde68a, #fbbf24); }
.self-badge {
  font-size: 0.72rem; font-weight: 600; color: var(--blue);
  background: #eff6ff; padding: 0.1rem 0.45rem; border-radius: 20px;
  margin-left: 0.35rem;
}
.um-toast {
  margin: 0 2rem 0; padding: 0.7rem 1.25rem;
  border-radius: var(--radius); font-size: 0.88rem; font-weight: 500;
}
.um-toast-success { background: var(--low-bg);  color: var(--low); }
.um-toast-error   { background: var(--high-bg); color: var(--high); }

.um-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.um-modal {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 2rem;
  width: 100%; max-width: 420px;
  display: flex; flex-direction: column; gap: 1rem;
}
.um-modal-title  { font-size: 1.1rem; font-weight: 700; color: var(--navy); margin: 0; }
.um-modal-subtitle { font-size: 0.88rem; color: var(--muted); margin: -0.5rem 0 0; }
.um-field { display: flex; flex-direction: column; gap: 0.35rem; }
.um-field label { font-size: 0.85rem; font-weight: 600; color: var(--navy); }
.um-error {
  font-size: 0.85rem; color: var(--high);
  min-height: 1.2em;
}
.um-modal-actions {
  display: flex; justify-content: flex-end; gap: 0.75rem; margin-top: 0.25rem;
}

/* ── ADMIN PAGE ───────────────────────────────────────────── */
.admin-filter-row {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
}
.admin-search {
  width: 280px; padding: 0.4rem 0.75rem;
  border: 1px solid var(--border-dk); border-radius: var(--radius);
  font-size: 0.88rem; font-family: var(--ff);
}
.admin-filter-select {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border-dk); border-radius: var(--radius);
  font-size: 0.88rem; font-family: var(--ff); background: white;
}
.admin-loading {
  text-align: center; padding: 3rem 1rem;
  color: var(--muted); font-size: 0.95rem;
}
.admin-count {
  padding: 0.75rem 1.2rem;
  font-size: 0.82rem; color: var(--muted);
  border-top: 1px solid var(--border);
  background: white;
}

/* ── PROFILE PAGE ─────────────────────────────────────────── */
.profile-wrap {
  max-width: 560px; margin: 2rem auto; padding: 0 1.5rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}
.profile-card {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.5rem;
  display: flex; align-items: center; gap: 1.25rem;
}
.profile-avatar {
  font-size: 2.5rem; background: var(--cloud);
  border-radius: 50%; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.profile-username { font-size: 1.2rem; font-weight: 700; color: var(--navy); }
.profile-role {
  font-size: 0.82rem; color: white; background: var(--blue);
  display: inline-block; padding: 0.15rem 0.6rem;
  border-radius: 20px; margin-top: 0.3rem; font-weight: 600;
  text-transform: capitalize;
}
.profile-form-card {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 1.75rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.profile-section-title {
  font-size: 1rem; font-weight: 700; color: var(--navy);
  margin: 0 0 0.25rem;
}
.profile-form-group {
  display: flex; flex-direction: column; gap: 0.35rem;
}
.profile-form-group label {
  font-size: 0.85rem; font-weight: 600; color: var(--navy);
}
.required { color: var(--high); }
.profile-msg {
  font-size: 0.85rem; min-height: 1.2em;
  padding: 0.4rem 0.75rem; border-radius: var(--radius);
  display: none;
}
.profile-msg:not(:empty) { display: block; }
.profile-msg-error   { color: var(--high);  background: var(--high-bg); }
.profile-msg-success { color: var(--low);   background: var(--low-bg);  }

/* ── AUTH LINKS & MESSAGES ──────────────────────────────────── */
.ref-lookup-msg {
  font-size: 0.88rem; line-height: 1.5; padding: 0.75rem 1rem;
  border-radius: var(--radius); margin-bottom: 1rem;
}
.ref-lookup-msg.hidden { display: none; }
.ref-lookup-msg--info {
  background: var(--low-bg); color: #15803d;
  border-left: 3px solid var(--low);
}
.ref-lookup-msg--error {
  background: var(--high-bg); color: #b91c1c;
  border-left: 3px solid var(--high);
}
.consensus-blocked-msg {
  font-size: 0.85rem; line-height: 1.5; padding: 0.7rem 1rem;
  border-radius: var(--radius); margin-bottom: 1rem;
  background: var(--some-bg); color: #92400e;
  border-left: 3px solid var(--some);
}
.btn-edit-details {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; font-size: 0.85rem;
  padding: 0.15rem 0.35rem; border-radius: 4px; vertical-align: middle;
  margin-left: 0.35rem; opacity: 0.7; transition: opacity 0.15s;
}
.btn-edit-details:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.auth-links {
  text-align: center; margin-top: 1.25rem;
}
.auth-link {
  font-size: 0.88rem; color: var(--blue); font-weight: 500;
  text-decoration: none;
}
.auth-link:hover { text-decoration: underline; }
.auth-desc {
  font-size: 0.88rem; color: var(--muted); line-height: 1.6;
  margin-bottom: 1.25rem; text-align: center;
}
.success-msg {
  font-size: 0.88rem; color: var(--low); background: var(--low-bg);
  padding: 0.65rem 0.9rem; border-radius: var(--radius);
  text-align: center; margin-top: 0.25rem;
}
.success-msg.hidden { display: none; }
.um-invite-note {
  font-size: 0.82rem; color: var(--muted); line-height: 1.5;
  background: var(--cloud); padding: 0.75rem 0.9rem;
  border-radius: var(--radius); border-left: 3px solid var(--blue);
}

/* ── POWERED-BY FOOTER ───────────────────────────────────── */
.login-powered-by {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.35rem; margin-top: 1.25rem;
  font-size: 0.72rem; font-weight: 500;
  color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.powered-by-footer {
  display: flex; flex-direction: column; align-items: center;
  gap: 0.4rem; padding: 1.5rem 1rem 2rem;
}
.powered-by-footer--dashboard {
  border-top: 1px solid var(--border);
  margin-top: 1rem;
  background: white;
}
.powered-by-text {
  font-size: 0.72rem; font-weight: 500;
  color: var(--muted); letter-spacing: 0.06em;
  text-transform: uppercase;
}
.powered-by-logo {
  height: 96px; width: auto;
  opacity: 0.85;
}

/* ── DECISION TREE DIAGRAM ────────────────────────────────── */
.domain-tree-section {
  margin-top: 1.5rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.domain-tree-title {
  padding: 0.65rem 1.25rem;
  background: #f1f5fb;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.domain-tree-container {
  padding: 0;
  overflow-x: auto;
}

.decision-tree-svg {
  display: block;
  width: 100%;
  height: auto;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── DOMAIN DOTS ROW (dashboard) ──────────────────────────── */
.domain-dots-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.domain-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.domain-dot::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform 0.15s;
}

.domain-dot:hover::before {
  transform: scale(1.2);
}

.domain-dot.dot-low::before    { background: #16a34a; border-color: #86efac; }
.domain-dot.dot-some::before   { background: #d97706; border-color: #fcd34d; }
.domain-dot.dot-high::before   { background: #dc2626; border-color: #fca5a5; }
.domain-dot.dot-empty::before  { background: #e2e8f0; border-color: #cbd5e1; }

.domain-dot-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ── DOMAIN CONFIRMATION PANEL ───────────────────────────── */
.domain-confirmation {
  margin-top: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}

.domain-confirmation--locked {
  opacity: 0.5;
  pointer-events: none;
}

.domain-confirmation-algo {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: #f1f5fb;
  border-bottom: 1px solid var(--border);
}

.domain-confirmation-algo-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.domain-confirmation-algo-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.domain-confirmation-select-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  flex-wrap: wrap;
}

.domain-confirmation-select-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.domain-confirmation-select {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.domain-confirmation-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.domain-confirmation-select:disabled {
  background: #f8f9fa;
  color: var(--muted);
  cursor: not-allowed;
}

.domain-confirmation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.domain-confirmation-badge--agrees {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.domain-confirmation-badge--override {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
}

/* ── SUMMARY TABLE JUDGEMENT COLUMN ──────────────────────── */
.d-judgement {
  white-space: nowrap;
}

.summary-override-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.5rem;
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde68a;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  vertical-align: middle;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .domain-slide { margin: 0.75rem; padding: 1.25rem; }
  .assess-header { padding: 0.75rem 1rem; }
  .dash-header { padding: 0.85rem 1rem; }
  .table-wrapper { padding: 1rem; }
  .field-row { grid-template-columns: 1fr; }
  .summary-actions { flex-direction: column; }
  .overall-section { flex-direction: column; gap: 0.75rem; }
  .paper-meta-grid { grid-template-columns: 1fr 1fr; }
}

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
  .assess-header, .domain-navigator, .slide-navigation,
  .dash-toolbar, .summary-actions, .dash-controls { display: none !important; }
  .domain-slide, .summary-card { box-shadow: none; border: 1px solid #ccc; }
}
