/* ===========================================================
   RFP Compare — component stylesheet
   Consumes design-tokens.css variables (inlined in SPA shell)
   Project Carbonara · 2026-09-15
   =========================================================== */

/* ─── Reset + base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; }

body {
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

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

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }
textarea { resize: vertical; }

/* ─── Loading / error ───────────────────────────────────────────────────────── */
.app-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100vh;
  color: var(--text-2);
  font-size: var(--fs-small);
}

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100vh;
  color: var(--text-2);
  text-align: center;
  padding: 24px;
}
.error-screen pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 10px 14px;
  max-width: 560px;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: left;
}

/* ─── Top bar ───────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--bar1-h);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--wrap-pad);
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.topbar-logo {
  font-size: 20px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-shrink: 0;
  margin-left: var(--sp-6);
}

.topbar-actor {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-small);
  color: var(--text-2);
}

/* ─── Avatar ────────────────────────────────────────────────────────────────── */
.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: var(--fw-bold);
  letter-spacing: -.5px;
  flex-shrink: 0;
  user-select: none;
}

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-s);
  font-size: var(--fs-body);
  font-weight: var(--fw-med);
  line-height: 1;
  transition: background .15s;
  cursor: pointer;
  border: none;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  font-size: var(--fs-body);
  font-weight: var(--fw-med);
  line-height: 1;
  transition: border-color .15s, color .15s;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

.btn-small {
  padding: 5px 11px;
  font-size: var(--fs-small);
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: transparent;
  color: var(--stop);
  border: 1px solid var(--stop-line);
  border-radius: var(--r-s);
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  cursor: pointer;
  transition: background .15s;
}
.btn-danger:hover { background: var(--stop-soft); }

/* ─── Form fields ───────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-2);
  margin-bottom: var(--sp-2);
}

.field-input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  font-size: var(--fs-body);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-input::placeholder { color: var(--text-3); }

.field-error {
  font-size: var(--fs-small);
  color: var(--stop);
  margin-top: var(--sp-2);
}

.field-hint {
  font-size: var(--fs-hint);
  color: var(--text-3);
  margin-top: var(--sp-1);
  line-height: 1.45;
}

/* ─── Tags / badges ─────────────────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: var(--fw-semi);
  white-space: nowrap;
  line-height: 1.5;
}

.t-ok       { background: #eaf6ec; color: var(--ok); }
.t-bad      { background: var(--stop-soft); color: var(--stop); }
.t-warn     { background: var(--warn-soft); color: var(--warn); }
.t-crit     { background: var(--stop-soft); color: var(--stop); border: 1px solid var(--stop-line); }
.t-out      { background: var(--out-soft); color: var(--out); }
.t-num      { background: var(--num-soft); color: var(--num); }
.t-narrative{ background: var(--narrative-soft); color: var(--narrative); }
.t-evi      { background: var(--evi-soft); color: var(--evi); }
.t-draft    { background: #f0f1ee; color: var(--text-2); }
.t-open     { background: var(--accent-soft); color: var(--accent); }
.t-closed   { background: var(--out-soft); color: var(--out); }

/* Gate flag badges */
.t-ptl { background: var(--stop-soft);  color: var(--stop);  border: 1px solid var(--stop-line); }
.t-scr { background: var(--warn-soft);  color: var(--warn);  border: 1px solid var(--warn-line); }
.t-flg { background: var(--num-soft);   color: var(--num); }

/* ─── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card.pad { padding: var(--sp-6); }

/* ─── Hint text ─────────────────────────────────────────────────────────────── */
.hint {
  font-size: var(--fs-hint);
  color: var(--text-3);
  line-height: 1.45;
}

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  padding: 10px 18px;
  border-radius: var(--r-s);
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  animation: slide-up .2s ease;
  max-width: 340px;
}
@keyframes slide-up { from { transform: translateY(8px); opacity: 0; } }
.toast-ok   { background: var(--accent); color: #fff; }
.toast-warn { background: var(--warn); color: #fff; }
.toast-err  { background: var(--stop); color: #fff; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(20,25,30,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade-in .15s ease;
}
@keyframes fade-in { from { opacity: 0; } }

.modal {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: 0 8px 40px rgba(20,25,30,.18);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
}
.modal-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-s);
  color: var(--text-3);
  cursor: pointer;
  font-size: 18px;
  transition: background .15s;
}
.modal-close:hover { background: var(--sunken); color: var(--text); }

.modal-body {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     SCREEN 1: Login                                                           */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

/* ─── Login — internal MMC centred card ─────────────────────────────────── */

.login-root {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 24px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lift);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 36px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 36px;
  margin-bottom: 10px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: var(--fw-semi);
  color: var(--text);
}

.login-sub {
  font-size: var(--fs-small);
  color: var(--text-3);
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.login-divider {
  text-align: center;
  position: relative;
  color: var(--text-3);
  font-size: var(--fs-small);
  margin: 18px 0;
}
.login-divider::before,
.login-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 20px);
  height: 1px;
  background: var(--line);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-2);
  font-size: var(--fs-small);
  cursor: pointer;
  margin-bottom: 18px;
  padding: 4px 0;
  background: none;
  border: none;
}
.back-btn:hover { color: var(--accent); }


/* ─── Login — supplier split-screen (D'Artagnan exact) ──────────────────── */

.ls {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.ls-left {
  background: linear-gradient(150deg, #0d3a33, #14544a 55%, #1b6b5e);
  color: #fff;
  padding: 54px 52px;
  display: flex;
  flex-direction: column;
}

.ls-mk {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255,255,255,.16);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 30px;
  color: #fff;
  flex-shrink: 0;
}

.ls-title {
  font-family: var(--font-display);
  font-size: 29px;
  line-height: 1.25;
  letter-spacing: -.015em;
  max-width: 22ch;
  color: #fff;
  font-weight: 700;
}

.ls-meta {
  margin-top: 20px;
  color: #a8c2bd;
  font-size: 13.5px;
  line-height: 1.7;
  max-width: 44ch;
}
.ls-meta strong { color: rgba(255,255,255,.88); font-weight: 600; }

.ls-facts {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 18px;
  display: grid;
  gap: 10px;
}

.ls-fact {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  color: #bcd1cd;
}
.ls-fact b { color: #fff; font-weight: 600; }

.ls-right {
  background: #fff;
  padding: 54px 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lbox {
  max-width: 380px;
  width: 100%;
  margin: 0 auto;
}

/* Large monospace code input */
.ls-code-in {
  font-family: var(--font-mono);
  font-size: 19px;
  letter-spacing: .22em;
  text-align: center;
  text-transform: uppercase;
  padding: 12px 9px;
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: #fff;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.ls-code-in:focus { outline: none; border-color: var(--accent); }
.ls-code-in.err  { border-color: var(--stop);  background: var(--stop-soft); }
.ls-code-in.good { border-color: var(--accent); background: var(--accent-soft); }

/* Inline message banners — shared with design .msg */
.msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12.5px;
  border-radius: var(--r-s);
  padding: 9px 11px;
  margin: 6px 0 10px;
}
.msg.err  { background: var(--stop-soft);   border: 1px solid var(--stop-line);   color: #6b2a25; }
.msg.warn { background: var(--warn-soft);   border: 1px solid var(--warn-line);   color: #59410f; }
.msg.ok   { background: var(--accent-soft); border: 1px solid var(--accent-line); color: #204a44; }

.ls-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.ls-field label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.ls-team {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 4px;
}
.ls-team-add {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px dashed var(--line-2);
  background: none;
  color: var(--text-3);
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: default;
}

.ls-codestates {
  margin-top: 22px;
  border-top: 1px dashed var(--line);
  padding-top: 14px;
}
.ls-codestates .lbl {
  display: block;
  margin-bottom: 8px;
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 700;
}
.ls-codestates .btn { margin: 0 5px 5px 0; }

/* btn.p (primary) and btn.lg (full-width large) — design system */
.btn { background: #fff; color: var(--text); border: 1px solid var(--line-2); padding: 6px 12px; border-radius: var(--r-s); font-size: 13px; cursor: pointer; }
.btn:hover { border-color: #b6bcb4; }
.btn.p { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.p:hover { background: var(--accent-2); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.lg { padding: 10px 16px; font-size: 14px; width: 100%; display: flex; justify-content: center; margin-top: 14px; }

@media (max-width: 1200px) {
  .ls { grid-template-columns: 1fr; }
  .ls-left { display: none; }
  .ls-right { padding: 40px 24px; }
}
@media (max-width: 480px) {
  .ls-right { padding: 32px 16px; }
}


/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     SCREEN 2: Supplier Portal                                                 */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

/* Portal banner — dark world, separate from MMC admin chrome */
.portal-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1a2634;
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
}

.portal-bar-inner {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 0 var(--wrap-pad);
  height: var(--bar1-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.portal-rfp-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-rfp-meta {
  font-size: var(--fs-small);
  color: rgba(255,255,255,.55);
  margin-top: 1px;
}

.portal-actor {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.portal-actor .av {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.8);
}

.portal-actor-name {
  font-size: var(--fs-small);
  color: rgba(255,255,255,.7);
}

.portal-signout {
  font-size: var(--fs-small);
  color: rgba(255,255,255,.45);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--r-s);
  transition: color .15s, background .15s;
}
.portal-signout:hover { color: #fff; background: rgba(255,255,255,.08); }

/* Section tabs */
.portal-sectabs {
  background: #1f2e3e;
  border-bottom: 1px solid rgba(255,255,255,.06);
  position: sticky;
  top: var(--bar1-h);
  z-index: 99;
  overflow-x: auto;
  scrollbar-width: none;
}
.portal-sectabs::-webkit-scrollbar { display: none; }

.portal-sectab-row {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 0 var(--wrap-pad);
  display: flex;
  align-items: stretch;
  gap: 0;
}

.portal-sectab {
  padding: 0 18px;
  height: var(--bar2-h);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: rgba(255,255,255,.5);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.portal-sectab:hover { color: rgba(255,255,255,.85); }
.portal-sectab.active {
  color: #fff;
  border-bottom-color: var(--accent);
}

.sectab-progress {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: rgba(255,255,255,.35);
}
.portal-sectab.active .sectab-progress { color: rgba(255,255,255,.6); }

/* Portal content area */
.portal-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px var(--wrap-pad) 80px;
}

/* Save bar — persistent status at top of content */
.save-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: var(--r-s);
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  margin-bottom: 20px;
  transition: all .2s;
}
.save-bar::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  flex-shrink: 0;
}
.save-bar.saving::before  { background: var(--warn); animation: pulse 1s infinite; }
.save-bar.saved::before   { background: var(--ok); }
.save-bar.failed { background: var(--stop-soft); border-color: var(--stop-line); color: var(--stop); }
.save-bar.failed::before  { background: var(--stop); }
.save-bar.conflict { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.save-bar.conflict::before { background: var(--warn); }

@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* Submit area */
.portal-submit-area {
  margin-top: 32px;
  padding: 20px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.portal-submit-info {
  font-size: var(--fs-small);
  color: var(--text-2);
}

.portal-submit-info strong {
  display: block;
  font-size: var(--fs-body);
  color: var(--text);
  font-weight: var(--fw-semi);
  margin-bottom: 2px;
}

/* ─── Question cards (portal) ───────────────────────────────────────────────── */
.question-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 14px;
  transition: border-color .2s;
}
.question-card.answered { border-left: 3px solid var(--ok); }
.question-card.unanswered { border-left: 3px solid var(--line-2); }
.question-card.required { border-left: 3px solid var(--warn); }
.question-card.out-of-scope { opacity: .65; }

.q-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.q-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--text-3);
  padding: 2px 6px;
  background: var(--sunken);
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 2px;
}

.q-prompt {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-med);
  line-height: var(--lh-display);
  color: var(--text);
  max-width: var(--measure);
}

.q-guidance {
  font-size: var(--fs-small);
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--sunken);
  border-radius: var(--r-s);
  border-left: 2px solid var(--line-2);
}

.q-gate-flags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.q-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

/* Answer inputs */
.answer-input {
  margin-top: 14px;
}

.bool-row {
  display: flex;
  gap: 8px;
}

.bool-btn {
  flex: 1;
  padding: 10px 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: var(--card);
  font-size: var(--fs-body);
  font-weight: var(--fw-med);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.bool-btn:hover { border-color: var(--accent); color: var(--accent); }
.bool-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: var(--fw-semi);
}
.bool-btn.selected.no {
  background: var(--stop-soft);
  border-color: var(--stop-line);
  color: var(--stop);
}

.text-answer {
  width: 100%;
  min-height: 120px;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  background: var(--card);
  font-family: var(--font-read);
  font-size: var(--fs-read);
  line-height: var(--lh-read);
  color: var(--read-ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}
.text-answer:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.word-count {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-align: right;
  margin-top: 4px;
}
.word-count.over-limit { color: var(--stop); font-weight: var(--fw-semi); }

.enum-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.enum-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  cursor: pointer;
  transition: all .15s;
}
.enum-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.enum-opt.selected { background: var(--accent-soft); border-color: var(--accent); }
.enum-opt input[type="radio"],
.enum-opt input[type="checkbox"] { accent-color: var(--accent); }
.enum-opt label { cursor: pointer; font-size: var(--fs-body); flex: 1; }

.artefact-area {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-s);
  background: var(--sunken);
}
.artefact-filename {
  font-size: var(--fs-small);
  font-family: var(--font-mono);
  color: var(--text-2);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     SCREEN 3: Scoring / Evaluator                                             */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

/* Section tabs — admin world, white topbar already covers bar1-h */
.sectabs {
  position: sticky;
  top: var(--bar1-h);
  z-index: 99;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
}
.sectabs::-webkit-scrollbar { display: none; }

.sectab {
  padding: 0 18px;
  height: var(--bar2-h);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  flex-shrink: 0;
}
.sectab:hover { color: var(--text); }
.sectab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: var(--fw-semi); }

.sectab-pct {
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: var(--sunken);
  padding: 1px 5px;
  border-radius: 3px;
}
.sectab.active .sectab-pct { color: var(--accent); background: var(--accent-soft); }

/* Scoring view toggle bar */
.score-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px var(--wrap-pad);
  max-width: var(--wrap-max);
  margin: 0 auto;
}

.view-toggles {
  display: flex;
  gap: 4px;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 3px;
}
.view-toggle {
  padding: 5px 13px;
  border-radius: 4px;
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.view-toggle.active {
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ── Grid view ─────────────────────────────────────────── */
.grid-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  margin: 0 var(--wrap-pad);
  box-shadow: var(--shadow);
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.grid-header {
  position: sticky;
  top: calc(var(--bar1-h) + var(--bar2-h));
  background: var(--card-alt);
  z-index: 50;
}

.grid-row {
  display: contents;
}

/* Grid uses CSS grid within a table-like structure */
.grid-head-row,
.grid-data-row {
  display: grid;
  grid-template-columns: 320px repeat(var(--bid-count, 3), 1fr);
  min-width: 0;
}

.grid-head-row {
  background: var(--card-alt);
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: calc(var(--bar1-h) + var(--bar2-h));
  z-index: 50;
}

.grid-data-row {
  border-bottom: 1px solid var(--line);
  transition: background .1s;
}
.grid-data-row:hover { background: var(--sunken); }
.grid-data-row:last-child { border-bottom: none; }
.grid-data-row.oos { opacity: .55; }

.grid-cell {
  padding: 11px 13px;
  border-right: 1px solid var(--line);
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.grid-cell:last-child { border-right: none; }

.grid-q-col {
  flex-direction: column;
  gap: 4px;
}

.grid-q-label {
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text);
  line-height: 1.4;
}

.grid-q-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.grid-bid-col {
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.grid-bid-col.oos { background: var(--out-soft); }

.grid-bid-head {
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  color: var(--text);
  text-align: center;
  padding: 12px 10px;
  border-right: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.grid-q-head {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-2);
  padding: 12px 13px;
  border-right: 1px solid var(--line);
}

/* Score pips */
.score-pips {
  display: flex;
  gap: 3px;
  align-items: center;
}
.score-pips.unscored .pip {
  background: var(--sunken);
  border-color: var(--line-2);
}

.pip {
  width: 26px; height: 26px;
  border-radius: var(--r-s);
  border: 1px solid var(--line-2);
  background: var(--sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--fw-bold);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all .12s;
  color: var(--text-3);
  flex-shrink: 0;
}
.pip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  transform: scale(1.08);
}
.pip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.pip.selected[data-v="1"] { background: var(--stop); border-color: var(--stop); }
.pip.selected[data-v="2"] { background: #c1440e; border-color: #c1440e; }
.pip.selected[data-v="3"] { background: var(--warn); border-color: var(--warn); }
.pip.selected[data-v="4"] { background: #2d7a3e; border-color: #2d7a3e; }
.pip.selected[data-v="5"] { background: var(--ok); border-color: var(--ok); }
.pip.needcomment { box-shadow: 0 0 0 2px var(--warn); }

.pip-clear {
  font-size: 11px;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}
.pip-clear:hover { color: var(--stop); background: var(--stop-soft); }

.score-comment {
  width: 100%;
  min-height: 54px;
  padding: 7px 9px;
  border: 1px solid var(--warn-line);
  border-radius: var(--r-s);
  background: var(--warn-soft);
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color .15s;
}
.score-comment:focus { border-color: var(--accent); background: var(--card); }
.score-comment::placeholder { color: var(--text-3); }

.needcomment-msg {
  font-size: 11px;
  color: var(--warn);
  font-weight: var(--fw-semi);
}

/* ── Text tile view ───────────────────────────────────────── */
.text-view {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: var(--wrap-pad);
  max-width: var(--wrap-max);
  margin: 0 auto;
}

.text-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.text-tile-head {
  padding: 14px 18px 12px;
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.text-tile-prompt {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: var(--fw-med);
  color: var(--text);
  flex: 1;
}

.text-tile-body {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0;
}

.text-tile-col {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}
.text-tile-col:last-child { border-right: none; }

.text-tile-bid {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-2);
  margin-bottom: 10px;
}

.text-tile-answer {
  font-family: var(--font-read);
  font-size: var(--fs-read);
  line-height: var(--lh-read);
  color: var(--read-ink);
  max-height: var(--answer-max-h);
  overflow: hidden;
  mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}
.text-tile-answer.expanded {
  max-height: none;
  mask-image: none;
  -webkit-mask-image: none;
}
.text-tile-expand {
  font-size: var(--fs-small);
  color: var(--accent);
  cursor: pointer;
  margin-top: 6px;
  display: inline-block;
}
.text-tile-expand:hover { text-decoration: underline; }

.text-tile-score { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* ── Reveal / totals view ─────────────────────────────────── */
.reveal-wrap {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: var(--wrap-pad);
}

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

.reveal-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: var(--fw-semi);
}

.prov {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: var(--fw-med);
  color: var(--warn);
}

/* KPI strip */
.kpis {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.kpi {
  flex: 1;
  min-width: 140px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.kpi-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-3);
  margin-bottom: 4px;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: var(--fw-bold);
  color: var(--text);
  line-height: 1.1;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 3px;
}

/* Bid rank bars */
.rank-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rank-row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.rank-row.non-compliant { border-left: 3px solid var(--stop); opacity: .85; }
.rank-row.rank-1 { border-left: 3px solid var(--ok); }

.rank-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.rank-bid-name {
  font-weight: var(--fw-semi);
  font-size: var(--fs-h3);
}

.rank-badge {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: var(--fw-bold);
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--text-2);
}
.rank-row.rank-1 .rank-badge { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.rank-score {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: var(--fw-bold);
  color: var(--text);
}
.rank-score-denom {
  font-size: 13px;
  color: var(--text-3);
  font-weight: var(--fw-reg);
}

/* Bar track */
.brow {
  margin-bottom: 8px;
}
.brow-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-small);
  color: var(--text-2);
  margin-bottom: 4px;
}

.track {
  height: 8px;
  background: var(--sunken);
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  overflow: visible;
  position: relative;
}

.fill {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-pill);
  transition: width .5s ease;
  min-width: 0;
}

.band {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  opacity: .15;
  background: var(--warn);
  pointer-events: none;
}

/* Per-scorer dots on reveal bars */
.dots-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--sunken);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: var(--fw-bold);
  cursor: default;
  position: relative;
  flex-shrink: 0;
}
.dot[data-v="1"] { background: var(--stop-soft);  color: var(--stop); border-color: var(--stop-line); }
.dot[data-v="2"] { background: #fdeee9;            color: #c1440e; border-color: #f0c0a0; }
.dot[data-v="3"] { background: var(--warn-soft);   color: var(--warn); border-color: var(--warn-line); }
.dot[data-v="4"] { background: #eaf4ec;            color: #2d7a3e; border-color: #b8dfc0; }
.dot[data-v="5"] { background: #d9f0dc;            color: var(--ok); border-color: #a8d8b0; }
.dot.ai-dot { background: var(--evi-soft); color: var(--evi); border-color: #c8b8e8; font-style: italic; }

/* AI score row */
.ai-score-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--evi-soft);
  border: 1px solid #c8b8e8;
  border-radius: var(--r-s);
  margin-top: 10px;
  font-size: var(--fs-small);
  color: var(--evi);
}
.ai-score-label {
  font-weight: var(--fw-semi);
}
.ai-score-note {
  font-size: 11px;
  color: #7a5a98;
  margin-left: auto;
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     SCREEN 4: Admin Builder                                                   */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

.admin-nav {
  display: flex;
  gap: 4px;
  padding: 10px var(--wrap-pad);
  background: var(--card);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-nav::-webkit-scrollbar { display: none; }

.admin-tab {
  padding: 6px 14px;
  border-radius: var(--r-s);
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.admin-tab:hover { background: var(--sunken); color: var(--text); }
.admin-tab.active { background: var(--accent-soft); color: var(--accent); font-weight: var(--fw-semi); }

.admin-main {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 24px var(--wrap-pad);
}

/* Builder layout — sidebar + content */
.builder-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .builder-layout { grid-template-columns: 1fr; }
}

.builder-sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: calc(var(--bar1-h) + 12px);
}

.sidebar-head {
  padding: 12px 14px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-3);
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
}

.sidebar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background .1s;
  gap: 8px;
}
.sidebar-row:last-child { border-bottom: none; }
.sidebar-row:hover { background: var(--sunken); }
.sidebar-row.active { background: var(--accent-soft); }

.sidebar-row-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--text-3);
  flex-shrink: 0;
}
.sidebar-row.active .sidebar-row-code { color: var(--accent); }

.sidebar-row-name {
  font-size: var(--fs-small);
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-row-weight {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

.sidebar-total {
  padding: 10px 14px;
  background: var(--sunken);
  border-top: 2px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: var(--fs-small);
}
.sidebar-total.over { color: var(--stop); }
.sidebar-total.ok { color: var(--ok); }

/* Question table */
.q-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.q-table-head {
  padding: 14px 18px 10px;
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.q-table-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
}

table.q-table {
  width: 100%;
  border-collapse: collapse;
}

table.q-table th {
  padding: 9px 13px;
  text-align: left;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-3);
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.q-table td {
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: var(--fs-small);
  color: var(--text);
}

table.q-table tr:last-child td { border-bottom: none; }
table.q-table tr:hover td { background: var(--sunken); }
table.q-table tr.withdrawn td { color: var(--text-3); text-decoration: line-through; }

.q-table-code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--text-3);
}

.q-table-prompt {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.q-table-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* Weight input */
.weight-input {
  width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  text-align: right;
  color: var(--text);
  outline: none;
}
.weight-input:focus { border-color: var(--accent); }

.weight-pct {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  min-width: 36px;
  text-align: right;
}

/* Gate flag toggles (builder) */
.gate-toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.gate-toggle {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
  font-weight: var(--fw-med);
  cursor: pointer;
  color: var(--text-3);
  background: var(--sunken);
  transition: all .12s;
  user-select: none;
}
.gate-toggle:hover { border-color: var(--line); color: var(--text-2); }
.gate-toggle.on-ptl { background: var(--stop-soft); border-color: var(--stop-line); color: var(--stop); }
.gate-toggle.on-scr { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.gate-toggle.on-flg { background: var(--num-soft); border-color: #b8c8e8; color: var(--num); }
.gate-toggle.disabled { opacity: .4; cursor: not-allowed; }

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     SCREEN 5: Codes & Users / People                                          */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

.people-section {
  margin-bottom: 36px;
}

.people-section-title {
  font-size: 15px;
  font-weight: var(--fw-semi);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* Bid cards */
.bid-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.bid-card-head {
  padding: 14px 18px;
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.bid-card-name {
  font-weight: var(--fw-semi);
  font-size: var(--fs-h3);
}

.bid-card-members {
  font-size: var(--fs-small);
  color: var(--text-2);
}

.bid-card-body {
  padding: 14px 18px;
}

/* Invitation rows */
.inv-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.inv-row:last-child { border-bottom: none; }

.inv-code {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: var(--fw-bold);
  letter-spacing: .04em;
  color: var(--text);
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 4px 10px;
  flex-shrink: 0;
}
.inv-code.revoked { color: var(--text-3); text-decoration: line-through; }

.inv-meta {
  flex: 1;
  min-width: 0;
}

.inv-target {
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-details {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.inv-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Users table */
table.users-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.users-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-3);
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.users-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-small);
}
table.users-table tr:last-child td { border-bottom: none; }
table.users-table tr:hover td { background: var(--sunken); }

.user-name {
  display: flex;
  align-items: center;
  gap: 9px;
}

.role-badge {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: var(--fw-semi);
  background: var(--sunken);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}
.role-badge.superuser { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.role-badge.evaluator { background: var(--num-soft); border-color: #b8c8e8; color: var(--num); }
.role-badge.panel-reader { background: var(--evi-soft); border-color: #c8b8e8; color: var(--evi); }

/* Access attempt log */
.attempt-table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table.attempt-table {
  width: 100%;
  border-collapse: collapse;
}

table.attempt-table th {
  padding: 8px 12px;
  text-align: left;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: var(--ls-label);
  color: var(--text-3);
  background: var(--sunken);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.attempt-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-family: var(--font-mono);
}
table.attempt-table tr:last-child td { border-bottom: none; }

.attempt-ok { color: var(--ok); }
.attempt-fail { color: var(--stop); }

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     Dashboard                                                                 */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

.dashboard {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 28px var(--wrap-pad);
}

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

.dashboard-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: var(--fw-semi);
}

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

.rfp-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.rfp-card:hover { box-shadow: var(--shadow-lift); border-color: var(--accent-line); }

.rfp-card-left { flex: 1; min-width: 0; }

.rfp-card-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-semi);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.rfp-card-meta {
  font-size: var(--fs-small);
  color: var(--text-2);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.rfp-card-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.rfp-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-3);
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     Clarifications                                                            */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

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

.clari-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.clari-head {
  padding: 12px 16px;
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.clari-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: var(--fw-bold);
  color: var(--text-3);
  background: var(--sunken);
  border-radius: 3px;
  padding: 2px 6px;
}

.clari-q {
  font-size: var(--fs-small);
  font-weight: var(--fw-med);
  color: var(--text);
  flex: 1;
}

.clari-body {
  padding: 14px 16px;
}

.clari-answer {
  font-size: var(--fs-body);
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

.clari-answer.draft {
  color: var(--text-2);
  font-style: italic;
  background: var(--sunken);
  border-radius: var(--r-s);
  padding: 10px 12px;
}

.clari-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.clari-timestamp {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     Attachments / evidence panel                                              */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: var(--fs-small);
}

.attachment-icon {
  width: 32px; height: 32px;
  background: var(--evi-soft);
  border-radius: var(--r-s);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--evi);
  font-size: 16px;
  flex-shrink: 0;
}

.attachment-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attachment-size {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ─── ════════════════════════════════════════════════════════════════════════ ─ */
/*     Utility / layout helpers                                                  */
/* ─── ════════════════════════════════════════════════════════════════════════ ─ */

.page-content {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 24px var(--wrap-pad);
}

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

.col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.spacer { flex: 1; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}

.empty-state-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: .6;
}

.empty-state-title {
  font-size: var(--fs-h3);
  font-weight: var(--fw-med);
  color: var(--text-2);
  margin-bottom: 6px;
}

/* Conditional visibility for not-applicable state */
.q-not-applicable {
  opacity: .5;
  pointer-events: none;
  filter: grayscale(.3);
}

/* Status dot for live submission status */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line-2);
  flex-shrink: 0;
}
.status-dot.submitted { background: var(--ok); }
.status-dot.in-progress { background: var(--warn); }

/* Print / export */
@media print {
  .topbar, .sectabs, .portal-bar, .save-bar,
  .admin-nav, .btn-primary, .btn-ghost, .modal-overlay { display: none !important; }
  body { background: white; font-size: 12px; }
  .grid-wrap { overflow: visible; border: none; }
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --wrap-pad: 14px; }
  .login-card { padding: 28px 20px 24px; }
  .kpis { gap: 8px; }
  .kpi { min-width: 120px; }
  .q-table-wrap { overflow-x: auto; }
  table.q-table { min-width: 560px; }
  .portal-submit-area { flex-direction: column; align-items: stretch; }
  .rank-row-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 900px) {
  .builder-layout { grid-template-columns: 1fr; }
  .builder-sidebar { position: static; }
  .text-tile-body { grid-template-columns: 1fr; }
}

/* ─── Login: MV logo (img element, served from /static/) ───────────────────── */
/* Logo sits on white right panel — no filter needed, natural dark green colours */

/* ─── Admin nav spacer + back button ─────────────────────────────────────────── */
.admin-nav-spacer { flex: 1; }
.admin-tab-back {
  color: var(--text-2);
  font-size: 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  background: #fff;
}
.admin-tab-back:hover { background: var(--paper); }

/* ─── Question table: guidance hint ─────────────────────────────────────────── */
.q-guidance-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

/* ─── Empty state ────────────────────────────────────────────────────────────── */
.empty-state {
  padding: 48px 32px;
  text-align: center;
  color: var(--text-3);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  margin: 16px;
}
.empty-state p { margin: 0 0 16px; font-size: 14px; }

/* ─── Form action buttons row ────────────────────────────────────────────────── */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
}

/* ─── Redesigned question form ───────────────────────────────────────────────── */
.q-form-v2 { display: flex; flex-direction: column; gap: 14px; }
.qf-section-badge { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.qf-row { display: grid; grid-template-columns: auto 1fr; gap: 14px; }
.qf-col { display: flex; flex-direction: column; gap: 4px; }
.qf-col-sm { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.qf-code { width: 90px !important; }
.qf-flags { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.qf-flag-row { display: flex; flex-direction: column; gap: 8px; }

/* ─── Import screen ──────────────────────────────────────────────────────────── */
.import-wrap { max-width: 900px; padding: 24px; }
.import-header { margin-bottom: 20px; }
.import-header h2 { font-size: 20px; margin-bottom: 4px; }
.import-or {
  display: flex; align-items: center; gap: 12px; color: var(--text-3);
  font-size: 12.5px; margin: 14px 0 8px;
}
.import-or::before, .import-or::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}
.import-file-input { font-size: 13px; }

/* ─── Bid card redesign ──────────────────────────────────────────────────────── */
.bid-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.bid-card-actions .btn-ghost { font-size: 12px; }

/* ─── Scoring screen v2 (D'Artagnan concept) ────────────────────────────────── */

/* Two-bar sticky chrome */
.sc-bar1 {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  height: 50px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.sc-logo { display: flex; align-items: center; gap: 9px; }
.sc-mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(150deg, var(--accent), #0a4a40);
  color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
.sc-sep { width: 1px; height: 22px; background: var(--line); }
.sc-rfp-pill {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 99px; padding: 4px 12px 4px 10px;
  font-size: 13px;
}
.sc-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.sc-scorer-chips { display: flex; align-items: center; }
.sc-me { display: flex; align-items: center; gap: 8px; font-size: 13px; }

.sc-bar2 {
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 22px;
  height: 44px;
  position: sticky;
  top: 50px;
  z-index: 19;
  overflow-x: auto;
}
.sc-tab {
  border: 0; background: none;
  padding: 0 13px; height: 43px;
  font-size: 13.5px; color: var(--text-2);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
  cursor: pointer;
}
.sc-tab:hover { color: var(--text); background: #fafbf9; }
.sc-tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.sc-tab-c {
  font-size: 11px; background: #f0f1ee; color: var(--text-2);
  border-radius: 99px; padding: 1px 6px; font-family: var(--font-mono);
}
.sc-tab.on .sc-tab-c { background: var(--accent-soft); color: var(--accent); }

.sc-wrap { max-width: 1680px; margin: 0 auto; padding: 20px 22px 90px; }

/* Blind scoring banner */
.sc-blind {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: #204a44;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 14px;
}

/* Progress strip */
.sc-qstrip {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.sc-dots { display: flex; gap: 4px; }
.sc-dots i {
  width: 16px; height: 5px; border-radius: 99px;
  background: var(--line); display: block;
}
.sc-dots i.done { background: var(--accent); }
.sc-dots i.now { background: var(--text); width: 24px; }

/* Pill toggle */
.sc-pill {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.sc-pill button {
  border: 0; background: none;
  padding: 4px 11px; font-size: 12px; color: var(--text-2);
  cursor: pointer;
}
.sc-pill button.on { background: var(--text); color: #fff; font-weight: 500; }

/* Small action button */
.sc-btn {
  background: #fff; color: var(--text);
  border: 1px solid var(--line-2);
  padding: 5px 12px; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
  box-shadow: var(--shadow);
}
.sc-btn:hover { border-color: #b6bcb4; }
.sc-btn.p { background: var(--accent); border-color: var(--accent); color: #fff; }
.sc-btn.p:hover { background: var(--accent-2, #0d5a4e); }
.sc-btn:disabled { opacity: .4; cursor: default; }

/* Question chip strip */
.sc-qchips {
  display: flex; gap: 5px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 11px;
  margin-bottom: 12px; box-shadow: var(--shadow);
  align-items: center;
}
.sc-qc {
  width: 30px; height: 26px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: #fff;
  font-size: 12px; color: var(--text-3); cursor: pointer;
  font-family: var(--font-mono);
}
.sc-qc:hover { border-color: var(--accent); color: var(--accent); }
.sc-qc.done { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); font-weight: 700; }
.sc-qc.now { background: var(--text); border-color: var(--text); color: #fff; font-weight: 700; }
.sc-qkey { display: flex; gap: 12px; margin-left: auto; font-size: 11.5px; color: var(--text-3); align-items: center; }
.sc-qkey span { display: flex; gap: 5px; align-items: center; }
.sc-qkey-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border: 1px solid var(--line-2); }
.sc-qkey-dot.done { background: var(--accent-soft); border-color: var(--accent-line); }

/* Question header card */
.sc-qhead {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  margin-bottom: 14px; box-shadow: var(--shadow);
}
.sc-qhead h2 { font-size: 19px; line-height: 1.35; max-width: 112ch; }
.sc-qhead-meta { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.sc-guide {
  font-size: 12.5px; color: var(--text-2);
  margin-top: 10px; padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* vcard grid */
.sc-cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 80px;
}
.sc-vcard {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow);
}
.sc-vcard.out { background: #fafbf9; opacity: .72; }
.sc-vcard.scored { border-color: var(--accent-line); }
.sc-vcard > header {
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  background: #fdfdfc;
}
.sc-vcard > header b { font-size: 13px; }
.sc-ans {
  padding: 14px;
  font-family: var(--font-read, Georgia, serif);
  font-size: 14px; line-height: 1.65;
  color: #252c33; flex: 1;
  max-height: 250px; overflow: auto;
}
.sc-ans p { margin: 0 0 10px; }
.sc-more {
  font-family: var(--font-sans); font-size: 12px;
  color: var(--accent); cursor: pointer; font-weight: 500;
  display: block; margin-top: 4px;
}
.sc-sc {
  border-top: 1px solid var(--line);
  padding: 11px 13px; background: #fdfdfc;
}
.sc-pips { display: flex; gap: 5px; margin: 6px 0 8px; }
.sc-pip {
  flex: 1; height: 29px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; font-size: 12.5px; color: var(--text-2);
  cursor: pointer;
}
.sc-pip:hover { border-color: var(--accent); color: var(--accent); }
.sc-pip.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.sc-pip.none { flex: 0 0 auto; width: auto; padding: 0 9px; color: var(--text-3); font-size: 11.5px; }
.sc-vcard.scored .sc-pip.none { color: var(--accent); }
.sc-needcomment { font-size: 11.5px; color: var(--warn); margin-top: 5px; display: none; }
.sc-needcomment.show { display: block; }

/* Sticky action bar */
.sc-actionbar {
  position: sticky; bottom: 0;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  margin: 16px -22px -90px;
  padding: 11px 22px;
  display: flex; align-items: center; gap: 12px;
  z-index: 15;
}
.sc-actionbar-count { font-size: 13px; }
.sc-actionbar-count b { color: var(--warn); }

/* Reveal & compare */
.sc-kpi {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px; margin-bottom: 16px;
}
.sc-kpi-card { padding: 13px 15px; }
.sc-kpi-card b { font-size: 23px; font-family: var(--font-mono); display: block; letter-spacing: -.02em; }
.sc-kpi-card span { font-size: 12px; color: var(--text-3); }
.sc-rg { display: grid; grid-template-columns: 1.05fr .95fr; gap: 14px; }
.sc-bar-row {
  display: grid;
  grid-template-columns: 130px 1fr 42px;
  gap: 10px; align-items: center; margin-bottom: 9px;
}
.sc-bar {
  height: 20px; background: #f0f1ee;
  border-radius: 4px; position: relative; overflow: hidden;
}
.sc-bar i {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, var(--accent), #188a78);
}

/* Shared tag classes (from concept) */
.tag.t-nar { background: #eef0f4; color: #414b5c; }
.tag.t-gate { background: var(--stop-soft); color: var(--stop); }
.tag.t-ok { background: var(--accent-soft); color: var(--accent); }
.tag.t-wait { background: var(--warn-soft); color: var(--warn); }
.tag.t-out { background: #f0f1ee; color: var(--text-2); }

@media (max-width: 1300px) {
  .sc-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-rg { grid-template-columns: 1fr; }
  .sc-kpi { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sc-bar1 .sc-rfp-pill small { display: none; }
  .sc-cols { grid-template-columns: 1fr; }
  .sc-kpi { grid-template-columns: 1fr 1fr; }
}
