/* ============================================================
   RAMPART NEXUS — Essential Eight Maturity Platform
   Layout: Fixed left scorecard sidebar + scrollable right content
   Modal: Centred rectangular dialog (not slide-in)
   Palette: Charcoal slate base · Emerald green brand
   Typography: Plus Jakarta Sans + JetBrains Mono
   WCAG AAA · Keyboard nav · 44px touch targets
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
  --bg-base:    #0C0F0E;
  --bg-surface: #141918;
  --bg-raised:  #1C2320;
  --bg-overlay: #232C29;
  --bg-hover:   #2A3530;

  --brand:        #10B981;
  --brand-dim:    #059669;
  --brand-glow:   rgba(16,185,129,.14);
  --brand-border: rgba(16,185,129,.35);

  --green:    #34D399;
  --green-bg: rgba(52,211,153,.10);
  --amber:    #FBBF24;
  --amber-bg: rgba(251,191,36,.10);
  --red:      #F87171;
  --red-bg:   rgba(248,113,113,.10);
  --cyan:     #22D3EE;
  --cyan-bg:  rgba(34,211,238,.10);
  --purple:   #C084FC;
  --purple-bg:rgba(192,132,252,.10);
  --slate:    #6B7280;
  --slate-bg: rgba(107,114,128,.10);

  --text-primary:   #F0FDF4;
  --text-secondary: #9CA3AF;
  --text-muted:     #6B7280;
  --text-inverse:   #0C0F0E;

  --border:        rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.16);
  --border-brand:  rgba(16,185,129,.35);

  --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.5);
  --shadow-md:   0 4px 16px rgba(0,0,0,.6);
  --shadow-lg:   0 8px 40px rgba(0,0,0,.8);
  --shadow-glow: 0 0 0 1px var(--border-brand), 0 4px 20px var(--brand-glow);

  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 300ms ease;

  --nav-h:      60px;
  --filter-h:   44px;
  --sidebar-w:  256px;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--bg-overlay); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--slate); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

h1, h2, h3, h4 { font-weight: 700; line-height: 1.25; }
.mono { font-family: var(--font-mono); }

/* ═══════════════════════════════════════
   HEADER
═══════════════════════════════════════ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(12,15,14,.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}

.brand-icon {
  width: 34px;
  height: 34px;
  background: var(--brand);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #0C0F0E;
  box-shadow: 0 0 16px var(--brand-glow);
}

.brand-icon svg { width: 20px; height: 20px; }

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -.02em;
}

.brand-sub {
  font-size: .6rem;
  color: var(--text-muted);
  letter-spacing: .05em;
  text-transform: uppercase;
  font-weight: 500;
}

.header-divider {
  width: 1px;
  height: 26px;
  background: var(--border);
  flex-shrink: 0;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.meta-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-label {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
}

.meta-input {
  font-family: var(--font-mono);
  font-size: .75rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  outline: none;
  transition: border-color var(--t-fast);
  min-height: 32px;
}
.meta-input:focus { border-color: var(--brand); }
.meta-input[type="text"] { width: 190px; }
.meta-input[type="date"] { width: 144px; }

.header-actions { display: flex; gap: 6px; margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: .73rem;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 32px;
  letter-spacing: .01em;
}
.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-ghost {
  background: var(--bg-raised);
  border-color: var(--border);
  color: var(--text-secondary);
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-overlay); }

.btn-danger {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }

/* ═══════════════════════════════════════
   FILTERS BAR
═══════════════════════════════════════ */
.filters-bar {
  position: fixed;
  top: var(--nav-h);
  left: 0; right: 0;
  z-index: 90;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: var(--filter-h);
}

.filters-inner {
  height: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.filter-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 2px;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: .66rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  min-height: 26px;
}
.filter-pill:hover { border-color: var(--border-strong); color: var(--text-primary); background: var(--bg-raised); }
.filter-pill.active { background: var(--brand); border-color: var(--brand); color: #0C0F0E; font-weight: 700; }

.filter-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   BODY LAYOUT — sidebar + content
═══════════════════════════════════════ */
.body-layout {
  display: flex;
  padding-top: calc(var(--nav-h) + var(--filter-h));
  min-height: 100vh;
}

/* ── LEFT SIDEBAR ── */
.score-sidebar {
  position: fixed;
  top: calc(var(--nav-h) + var(--filter-h));
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--nav-h) - var(--filter-h));
  overflow-y: auto;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

/* Overall score card */
.overall-card {
  background: var(--bg-raised);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-lg);
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
}

.overall-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
  pointer-events: none;
}

.overall-eyebrow {
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--brand);
  margin-bottom: 10px;
}

.overall-score-num {
  font-family: var(--font-mono);
  font-size: 2.8rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.overall-pct {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.overall-ml {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  margin-top: 10px;
}

.overall-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0 8px;
}

.overall-hint {
  font-size: .62rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Control mini cards — stacked column */
.ctrl-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ctrl-mini-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 11px 13px;
  cursor: pointer;
  transition: all var(--t-base);
  position: relative;
  overflow: hidden;
  border-left-width: 3px;
  border-left-color: transparent;
}

.ctrl-mini-card:hover {
  border-color: var(--border-brand);
  border-left-color: var(--brand);
  background: var(--bg-overlay);
}

.ctrl-mini-card.has-incomplete {
  border-left-color: var(--amber);
}

.ctrl-mini-card.has-incomplete::after {
  content: '';
  position: absolute;
  top: 10px; right: 10px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.ctrl-mini-name {
  font-size: .6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
  line-height: 1.3;
  padding-right: 12px;
}

.ctrl-mini-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ctrl-mini-score {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}

.ctrl-mini-ml {
  font-family: var(--font-mono);
  font-size: .58rem;
  color: var(--text-muted);
}

.ctrl-mini-bar {
  height: 2px;
  background: var(--bg-overlay);
  border-radius: 1px;
  margin-top: 8px;
  overflow: hidden;
}

.ctrl-mini-fill {
  height: 100%;
  border-radius: 1px;
  background: var(--brand);
  transition: width var(--t-slow);
}

/* Sidebar info block */
.sidebar-info {
  margin-top: 4px;
}

.info-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-fast);
  list-style: none;
  width: 100%;
}
.info-toggle:hover { border-color: var(--border-strong); color: var(--text-secondary); }
details[open] .info-toggle { border-radius: var(--r-sm) var(--r-sm) 0 0; }

.info-body {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.info-body h3 {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--brand);
  margin-bottom: 5px;
}

.info-body p {
  font-size: .72rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .58rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 3px;
  margin-bottom: 3px;
}

/* ── RIGHT CONTENT AREA ── */
.content-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.controls-main {
  padding: 16px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ═══════════════════════════════════════
   CONTROL BLOCKS
═══════════════════════════════════════ */
.control-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t-base);
}
.control-block:hover { border-color: var(--border-strong); }
.control-block.is-open { border-color: rgba(16,185,129,.3); }

.control-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast);
}
.control-header:hover { background: var(--bg-raised); }

.ctrl-num {
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 700;
  color: var(--brand);
  width: 20px;
  flex-shrink: 0;
}

.ctrl-title-wrap { flex: 1; min-width: 0; }

.ctrl-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.01em;
}

.ctrl-desc {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.incomplete-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: .58rem;
  font-weight: 700;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid rgba(251,191,36,.25);
  border-radius: var(--r-sm);
  padding: 3px 8px;
}

.ctrl-pct {
  font-family: var(--font-mono);
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 44px;
  text-align: right;
}

.ml-badge {
  font-family: var(--font-mono);
  font-size: .65rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  border: 1px solid;
  min-width: 42px;
  text-align: center;
}

.ml-badge.ml0 { color: var(--red);   border-color: rgba(248,113,113,.35); background: var(--red-bg); }
.ml-badge.ml1 { color: var(--amber); border-color: rgba(251,191,36,.35);  background: var(--amber-bg); }
.ml-badge.ml2 { color: #60A5FA;      border-color: rgba(96,165,250,.35);  background: rgba(96,165,250,.08); }
.ml-badge.ml3 { color: var(--green); border-color: rgba(52,211,153,.35);  background: var(--green-bg); }

.chevron-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--t-base);
}
.control-block.is-open .chevron-icon { transform: rotate(90deg); }

.ctrl-progress-strip { height: 2px; background: var(--bg-raised); overflow: hidden; }
.ctrl-progress-strip-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-dim), var(--brand));
  transition: width var(--t-slow);
}

.control-body { display: none; }
.control-block.is-open .control-body { display: block; }
.control-body-inner { padding: 0 18px 18px; }

.score-detail-row {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  margin: 12px 0;
}

.score-detail-cell {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-right: 1px solid var(--border);
  background: var(--bg-raised);
}
.score-detail-cell:last-child { border-right: none; }

.score-detail-val {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.score-detail-lbl {
  font-size: .57rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-top: 3px;
}

.ctrl-progress-bar { height: 4px; background: var(--bg-overlay); border-radius: 2px; overflow: hidden; margin-bottom: 16px; }
.ctrl-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-dim), var(--brand));
  border-radius: 2px;
  transition: width var(--t-slow);
}

/* ── LEVEL SECTION ── */
.level-section { margin-bottom: 16px; }

.level-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.level-badge-pill {
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  border: 1px solid;
}

.level-badge-pill.lv1 { color: var(--amber); border-color: rgba(251,191,36,.35); background: var(--amber-bg); }
.level-badge-pill.lv2 { color: #60A5FA;      border-color: rgba(96,165,250,.35);  background: rgba(96,165,250,.08); }
.level-badge-pill.lv3 { color: var(--green); border-color: rgba(52,211,153,.35);  background: var(--green-bg); }

.level-stats {
  font-family: var(--font-mono);
  font-size: .62rem;
  color: var(--text-muted);
  margin-left: auto;
}

.all-met-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .6rem;
  font-weight: 700;
  color: var(--green);
}

/* ── REQUIREMENT ROW ── */
.req-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 1px 0;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all var(--t-fast);
}
.req-row:hover { background: var(--bg-raised); border-color: var(--border); }
.req-row.filtered-out { display: none; }

.req-id-btn {
  font-family: var(--font-mono);
  font-size: .63rem;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-glow);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-sm);
  padding: 4px 8px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 74px;
  text-align: center;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.req-id-btn:hover { background: var(--brand); color: #0C0F0E; border-color: var(--brand); }

.req-status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.req-text-area { flex: 1; min-width: 0; }

.req-text {
  font-size: .8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.alt-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .56rem;
  font-weight: 700;
  background: var(--cyan);
  color: var(--text-inverse);
  border-radius: 3px;
  padding: 1px 5px;
  margin-right: 5px;
  vertical-align: middle;
}

.req-status-wrap { flex-shrink: 0; width: 170px; }

.status-select {
  font-family: var(--font-mono);
  font-size: .68rem;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  cursor: pointer;
  outline: none;
  width: 100%;
  transition: border-color var(--t-fast);
  min-height: 34px;
  border-left-width: 3px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}
.status-select:focus { border-color: var(--brand); }
.status-select.s-not_assessed    { border-left-color: var(--slate); }
.status-select.s-effective       { border-left-color: var(--green); }
.status-select.s-alternate       { border-left-color: var(--cyan); }
.status-select.s-ineffective     { border-left-color: var(--red); }
.status-select.s-no_visibility   { border-left-color: var(--amber); }
.status-select.s-not_implemented { border-left-color: var(--purple); }
.status-select.s-not_applicable  { border-left-color: var(--slate); }

.req-notes-pill {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  color: var(--text-muted);
}
.req-notes-pill:hover { background: var(--brand-glow); border-color: var(--brand); color: var(--brand); }
.req-notes-pill.has-notes { background: var(--brand-glow); border-color: var(--brand); color: var(--brand); }
.req-notes-pill svg { width: 12px; height: 12px; }

/* ═══════════════════════════════════════
   FRAMEWORK CHECKLIST — used in license-create
   and client-org-create forms (module selection)
═══════════════════════════════════════ */
.fw-checklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
  margin-bottom: 4px;
}
.fw-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.fw-checklist-item:hover { background: var(--bg-raised); }
.fw-checklist-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}
.fw-checklist-item-name { color: var(--text-primary); font-size: .88rem; }
.fw-checklist-item-locked {
  opacity: .5;
  cursor: not-allowed;
}
.fw-checklist-empty { color: var(--text-muted); font-size: .85rem; padding: 4px; }

/* Small framework badges — license detail, org rows */
.fw-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .7rem;
  font-weight: 600;
  border: 1px solid var(--border-brand);
  color: var(--brand);
  background: var(--brand-glow);
  margin: 0 4px 4px 0;
}

/* ═══════════════════════════════════════
   FRAMEWORK POPOUT — org picker → module
   choice, shown when an org has more than
   one entitled framework
═══════════════════════════════════════ */
.fw-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  backdrop-filter: blur(4px);
}
.fw-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-xl);
  z-index: 310;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-brand), 0 0 60px var(--brand-glow);
}
.fw-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.fw-modal-title { font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.fw-modal-sub   { font-size: .82rem; color: var(--text-secondary); margin-top: 2px; }
.fw-modal-body  { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.fw-option {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.fw-option:hover { background: var(--bg-raised); border-color: var(--border-brand); }
.fw-option-name { color: var(--text-primary); font-weight: 600; font-size: .95rem; }
.fw-option-desc { color: var(--text-muted); font-size: .8rem; }


.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow);
  backdrop-filter: blur(4px);
}
.panel-overlay.open { opacity: 1; pointer-events: all; }

.detail-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  width: min(900px, 92vw);
  height: min(680px, 88vh);
  background: var(--bg-surface);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-xl);
  z-index: 210;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow), transform var(--t-slow);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-brand), 0 0 60px var(--brand-glow);
}
.detail-modal.open {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

/* Modal header */
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-raised);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  flex-shrink: 0;
}

.modal-header-left { display: flex; flex-direction: column; gap: 2px; }

.panel-req-id {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  color: var(--brand);
}

.panel-ctrl-name {
  font-size: .65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

.modal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inline nav (in modal header) */
.panel-nav-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-nav-counter {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

.panel-nav-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 12px;
  cursor: pointer;
  transition: all var(--t-fast);
  min-height: 32px;
}
.panel-nav-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.panel-nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.panel-nav-btn svg { width: 12px; height: 12px; }

.panel-close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--bg-overlay);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.panel-close:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.panel-close svg { width: 14px; height: 14px; }

/* Modal body — two-column layout inside */
.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-radius: 0 0 var(--r-xl) var(--r-xl);
}

/* Panel sections (JS-rendered) */
.panel-section-label {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.panel-req-text {
  font-size: .88rem;
  color: var(--text-primary);
  line-height: 1.65;
}

.panel-explanation {
  font-size: .82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 15px;
  border-left: 3px solid var(--brand);
}

.panel-level-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: .68rem;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid;
  font-weight: 600;
}

.panel-status-select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: .8rem;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 14px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--t-fast);
  min-height: 44px;
  border-left-width: 4px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.panel-status-select:focus { border-color: var(--brand); }
.panel-status-select.s-not_assessed    { border-left-color: var(--slate); }
.panel-status-select.s-effective       { border-left-color: var(--green); }
.panel-status-select.s-alternate       { border-left-color: var(--cyan); }
.panel-status-select.s-ineffective     { border-left-color: var(--red); }
.panel-status-select.s-no_visibility   { border-left-color: var(--amber); }
.panel-status-select.s-not_implemented { border-left-color: var(--purple); }
.panel-status-select.s-not_applicable  { border-left-color: var(--slate); }

/* Notes textarea */
.notes-textarea {
  width: 100%;
  min-height: 200px;
  font-family: var(--font-sans);
  font-size: .82rem;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  line-height: 1.7;
  transition: border-color var(--t-fast);
}
.notes-textarea::placeholder { color: var(--text-muted); }
.notes-textarea:focus { border-color: var(--brand); }

.notes-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 5px;
}

.notes-count {
  font-family: var(--font-mono);
  font-size: .6rem;
  color: var(--text-muted);
}

.evidence-input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: .74rem;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--t-fast);
  min-height: 36px;
  margin-bottom: 6px;
}
.evidence-input:focus { border-color: var(--brand); }
.evidence-input::placeholder { color: var(--text-muted); }

.add-evidence-btn {
  font-size: .72rem;
  font-weight: 600;
  color: var(--brand);
  background: none;
  border: 1px dashed var(--border-brand);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  cursor: pointer;
  width: 100%;
  transition: all var(--t-fast);
}
.add-evidence-btn:hover { background: var(--brand-glow); }

.evidence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: .74rem;
  color: var(--text-secondary);
}

.evidence-remove {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  transition: color var(--t-fast);
}
.evidence-remove:hover { color: var(--red); }
.evidence-remove svg { width: 13px; height: 13px; }

/* ── NOTES FIELDS ── */
.notes-field-group { margin-bottom: 14px; }

.notes-field-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 5px;
  letter-spacing: .02em;
}

.notes-textarea-sm {
  min-height: 76px;
  font-size: .8rem;
}

/* ── TOAST ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-raised);
  border: 1px solid var(--border-brand);
  color: var(--text-primary);
  font-size: .77rem;
  font-weight: 500;
  padding: 11px 16px;
  border-radius: var(--r-md);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-base), transform var(--t-base);
  transform: translateY(8px);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 300px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--green); }

/* ── RESPONSIVE ── */
@media (max-width: 840px) {
  :root { --sidebar-w: 0px; }

  .score-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    overflow-x: auto;
  }

  .overall-card { min-width: 200px; flex: 1; }

  .ctrl-grid {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
    flex: 2;
  }

  .ctrl-mini-card { min-width: 120px; flex: 1; }

  .content-area { margin-left: 0; }

  .body-layout { flex-direction: column; }

  .detail-modal { width: 96vw; height: 90vh; border-radius: var(--r-lg); }

  .header-inner { flex-wrap: wrap; height: auto; padding: 10px 14px; }
  .header-meta  { flex-wrap: wrap; gap: 8px; }
  .meta-input[type="text"] { width: 140px; }
  .req-row { flex-wrap: wrap; }
  .req-status-wrap { width: 100%; }
  .controls-main { padding: 12px 12px 40px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ═══════════════════════════════════════
   AUTH SCREEN
═══════════════════════════════════════ */

.screen { min-height: 100vh; }

.screen-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  padding: 24px;
}

.auth-wrap {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-card {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  flex: 1;
  padding: 14px;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.auth-tab:hover { color: var(--text-primary); }
.auth-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

#formLogin, #formRegister { padding: 24px; display: flex; flex-direction: column; gap: 16px; }

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

.auth-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .02em;
}

.auth-hint { font-weight: 400; color: var(--text-muted); }

.auth-input {
  font-family: var(--font-sans);
  font-size: .88rem;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: var(--r-md);
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--t-fast);
  min-height: 44px;
  width: 100%;
}
.auth-input:focus { border-color: var(--brand); }
.auth-input::placeholder { color: var(--text-muted); }

.auth-error {
  font-size: .78rem;
  color: var(--red);
  min-height: 18px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: .88rem;
  margin-top: 4px;
}

.auth-footer {
  font-size: .68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ═══════════════════════════════════════
   PICKER SCREEN
═══════════════════════════════════════ */

.picker-body {
  max-width: 1000px;
  margin: calc(var(--nav-h) + 32px) auto 60px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.picker-section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.picker-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}

.picker-section-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-section-sub {
  font-size: .72rem;
  font-weight: 400;
  color: var(--text-muted);
}

.picker-create-form {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-overlay);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.picker-create-actions { display: flex; gap: 8px; }

.picker-list { padding: 8px; min-height: 80px; }

.picker-item {
  padding: 12px 14px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1px solid transparent;
}

.picker-item:hover { background: var(--bg-raised); border-color: var(--border); }
.picker-item.active { background: var(--brand-glow); border-color: var(--border-brand); }

.picker-item-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.picker-item-meta {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.picker-empty {
  padding: 20px 14px;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PARTNER / LICENSING ADMIN CONSOLE
════════════════════════════════════════════════════════════════════════════ */

.admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all var(--t-fast);
}

.admin-row:hover { background: var(--bg-raised); border-color: var(--border); }

.admin-row-main {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.admin-row-name {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.admin-row-meta {
  font-family: var(--font-mono);
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Status toggle — reuses the filter-pill visual language rather than
   inventing a new switch component, so it stays visually consistent. */
.status-toggle {
  font-family: var(--font-mono);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  cursor: pointer;
  transition: all var(--t-fast);
  background: none;
}

.status-toggle.is-active {
  color: var(--green);
  border-color: rgba(52,211,153,.3);
  background: var(--green-bg);
}

.status-toggle.is-inactive {
  color: var(--red);
  border-color: rgba(248,113,113,.3);
  background: var(--red-bg);
}

.status-toggle:disabled { opacity: .5; cursor: not-allowed; }

@media (max-width: 640px) {
  .picker-body { grid-template-columns: 1fr; }
}
/* ═══════════════════════════════════════════════════════════════════════════
   SIGN-OFF WORKFLOW STYLES
   Append these to the bottom of style.css
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Sign-off banner (below dashboard header) ──────────────────────────── */
.signoff-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  border-bottom: 1px solid transparent;
}

.signoff-banner.signoff-pending {
  background: color-mix(in srgb, #F59E0B 8%, var(--bg-surface));
  border-bottom-color: color-mix(in srgb, #F59E0B 25%, transparent);
}

.signoff-banner.signoff-locked {
  background: color-mix(in srgb, #10B981 8%, var(--bg-surface));
  border-bottom-color: color-mix(in srgb, #10B981 25%, transparent);
}

.signoff-banner .signoff-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.signoff-banner .signoff-msg {
  flex: 1;
  color: var(--text-secondary);
  line-height: 1.5;
}

.signoff-banner .signoff-msg strong {
  color: var(--text-primary);
}

/* ── Sign-off action buttons injected into header ──────────────────────── */
.signoff-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-signoff {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn-signoff:active  { transform: scale(0.97); }
.btn-signoff:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-submit-review {
  background: color-mix(in srgb, #F59E0B 15%, var(--bg-raised));
  color: #F59E0B;
  border-color: color-mix(in srgb, #F59E0B 30%, transparent);
}
.btn-submit-review:hover:not(:disabled) { filter: brightness(1.15); }

.btn-revert-draft {
  background: color-mix(in srgb, #6B7280 15%, var(--bg-raised));
  color: #9CA3AF;
  border-color: color-mix(in srgb, #6B7280 30%, transparent);
}
.btn-revert-draft:hover:not(:disabled) { filter: brightness(1.15); }

.btn-do-signoff {
  background: color-mix(in srgb, #10B981 15%, var(--bg-raised));
  color: #10B981;
  border-color: color-mix(in srgb, #10B981 30%, transparent);
}
.btn-do-signoff:hover:not(:disabled) { filter: brightness(1.15); }

/* ── Locked dashboard state ─────────────────────────────────────────────── */
.dashboard-locked .req-row select,
.dashboard-locked .req-row input:not([readonly]),
.dashboard-locked .req-row textarea {
  pointer-events: none;
  opacity: 0.65;
}

/* ── Assessment status badges in picker ─────────────────────────────────── */
.assessment-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.badge-draft {
  background: color-mix(in srgb, #6B7280 18%, transparent);
  color: #9CA3AF;
}

.badge-in-review {
  background: color-mix(in srgb, #F59E0B 16%, transparent);
  color: #F59E0B;
}

.badge-signed-off {
  background: color-mix(in srgb, #10B981 16%, transparent);
  color: #10B981;
}

/* ── Sign-off confirmation dialog ───────────────────────────────────────── */
.signoff-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.signoff-dialog {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.signoff-dialog h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.signoff-dialog p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.signoff-dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.btn-dialog-cancel {
  padding: 7px 16px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.btn-dialog-cancel:hover { background: var(--bg-surface); }

.btn-dialog-confirm {
  padding: 7px 16px;
  border-radius: 6px;
  background: #10B981;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}
.btn-dialog-confirm:hover { filter: brightness(1.1); }
.btn-dialog-confirm:focus { outline: 2px solid #10B981; outline-offset: 2px; }

/* ── Picker item meta — flex for badge alignment ────────────────────────── */
.picker-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
/* ═══════════════════════════════════════════════════════════════════════════
   USER MANAGEMENT STYLES
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Org row wrap (positions Users button alongside picker item) ─────────── */
.picker-item-wrap {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 4px;
}

.picker-item-wrap .picker-item {
  flex: 1;
  margin-bottom: 0;
}

.picker-users-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  color: var(--text-muted);
  white-space: nowrap;
  border: 1px solid var(--border);
}
.picker-users-btn:hover {
  color: var(--brand);
  border-color: color-mix(in srgb, var(--brand) 40%, transparent);
  background: color-mix(in srgb, var(--brand) 8%, transparent);
}

/* ── Users panel backdrop ───────────────────────────────────────────────── */
.users-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
}

/* ── Users panel ────────────────────────────────────────────────────────── */
.users-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 501;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.users-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.users-panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.users-panel-org {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Add user section ───────────────────────────────────────────────────── */
.users-add-section {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.users-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.users-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.users-add-row {
  display: flex;
  gap: 12px;
}

.users-add-row .auth-field {
  margin-bottom: 0;
}

.users-add-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Member list section ────────────────────────────────────────────────── */
.users-list-section {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}

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

/* ── Member row ─────────────────────────────────────────────────────────── */
.users-member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.users-member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 20%, var(--bg-surface));
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.users-member-info {
  flex: 1;
  min-width: 0;
}

.users-member-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.users-member-email {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Settings panel sub-tabs ─────────────────────────────────────────────── */
.settings-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: -1px;
  white-space: nowrap;
}
.settings-tab:hover { color: var(--text-primary); }
.settings-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.settings-subtab {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Logo upload ─────────────────────────────────────────────────────────── */
.logo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 4px;
}

.logo-preview-img {
  max-height: 64px;
  max-width: 180px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  padding: 6px;
}

.logo-empty-state {
  padding: 18px 14px;
  background: var(--bg-raised);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

/* ── Report history rows ─────────────────────────────────────────────────── */
.report-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.report-row-info { flex: 1; min-width: 0; }

.report-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.report-row-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.users-you-badge {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--brand) 15%, transparent);
  color: var(--brand);
  padding: 1px 5px;
  border-radius: 3px;
}

.users-member-role {
  flex-shrink: 0;
}

.users-role-select {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  font-family: inherit;
  padding: 4px 6px;
  cursor: pointer;
}
.users-role-select:focus { outline: 1px solid var(--brand); }

.users-role-static {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 6px;
}

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

.users-action-btn {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FINDINGS REGISTER STYLES
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Dashboard tab bar ──────────────────────────────────────────────────── */
.dashboard-tabs {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 91;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  height: 40px;
}

.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 40px;
  font-family: var(--font-sans);
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast);
  margin-bottom: -1px;
  white-space: nowrap;
}
.dash-tab svg { width: 13px; height: 13px; flex-shrink: 0; }
.dash-tab:hover { color: var(--text-primary); }
.dash-tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.findings-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

/* ── Tab panels ─────────────────────────────────────────────────────────── */
/* Requirements tab: push down for tabs bar + filters bar */
#tab-requirements .body-layout {
  padding-top: calc(var(--nav-h) + 40px + var(--filter-h));
}

/* Findings tab: push down for tabs bar only (no filters bar) */
#tab-findings {
  padding-top: calc(var(--nav-h) + 40px);
  min-height: 100vh;
}

/* Filters bar sits below tabs */
.filters-bar {
  top: calc(var(--nav-h) + 40px);
}

/* Score sidebar also adjusts */
.score-sidebar {
  top: calc(var(--nav-h) + 40px + var(--filter-h));
  height: calc(100vh - var(--nav-h) - 40px - var(--filter-h));
}

/* ── Findings layout: sidebar + main ────────────────────────────────────── */
.findings-layout {
  display: flex;
  gap: 0;
  min-height: calc(100vh - var(--nav-h) - 40px);
}

.findings-sidebar {
  width: 340px;
  flex-shrink: 0;
  padding: 20px 16px;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  position: sticky;
  top: calc(var(--nav-h) + 40px);
  height: calc(100vh - var(--nav-h) - 40px);
  overflow-y: auto;
}

.findings-main {
  flex: 1;
  padding: 20px 24px;
  min-width: 0;
}

/* ── Finding form card ──────────────────────────────────────────────────── */
.findings-form-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.findings-form-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.findings-form-row {
  display: flex;
  gap: 10px;
}

.findings-form-row .auth-field {
  min-width: 0;
}

.findings-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}

/* ── Findings list header ───────────────────────────────────────────────── */
.findings-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.findings-list-title {
  font-size: .92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.findings-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Finding card ───────────────────────────────────────────────────────── */
.findings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finding-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--t-fast);
}
.finding-card:hover { border-color: var(--border-strong); }

.finding-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.finding-card-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

.finding-action-btn {
  font-size: 11px;
  padding: 3px 9px;
  min-height: 26px;
}

.finding-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.finding-recommendation {
  font-size: .8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  background: var(--bg-raised);
  border-left: 3px solid var(--border-brand);
  padding: 8px 12px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.finding-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: .72rem;
  color: var(--text-muted);
}

.finding-overdue { color: var(--red); }
.finding-created-by { margin-left: auto; font-size: .68rem; }

/* ── Severity badges ────────────────────────────────────────────────────── */
.finding-severity-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  border: 1px solid;
}

.sev-critical { background: rgba(248,113,113,.15); color: #F87171; border-color: rgba(248,113,113,.35); }
.sev-high     { background: rgba(251,146,60,.15);  color: #FB923C; border-color: rgba(251,146,60,.35); }
.sev-medium   { background: rgba(251,191,36,.15);  color: #FBBF24; border-color: rgba(251,191,36,.35); }
.sev-low      { background: rgba(52,211,153,.12);  color: #34D399; border-color: rgba(52,211,153,.3); }

/* ── Status badges ──────────────────────────────────────────────────────── */
.finding-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.fstatus-open       { background: var(--red-bg);    color: var(--red);    }
.fstatus-inprogress { background: var(--amber-bg);  color: var(--amber);  }
.fstatus-resolved   { background: var(--green-bg);  color: var(--green);  }
.fstatus-accepted   { background: var(--slate-bg);  color: var(--slate);  }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 840px) {
  .findings-layout { flex-direction: column; }
  .findings-sidebar {
    width: 100%;
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

/* ── Findings form — read-only state for non-AUDITOR roles ─────────────── */
.findings-form-notice {
  background: color-mix(in srgb, #F59E0B 12%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, #F59E0B 30%, transparent);
  color: #F59E0B;
  font-size: 11.5px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  margin-bottom: 4px;
}

.findings-form-readonly {
  opacity: 0.6;
}

.findings-form-readonly input,
.findings-form-readonly select,
.findings-form-readonly textarea {
  cursor: not-allowed;
  background: var(--bg-surface);
}

.findings-form-readonly button:disabled {
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EVIDENCE FILES — requirement detail modal
   ══════════════════════════════════════════════════════════════════════════ */

/* Container that wraps the whole evidence section inside the panel */
.evidence-files-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

/* "No files yet" / "No finding linked" placeholder text */
.evidence-files-empty {
  font-size: .78rem;
  color: var(--text-muted);
  padding: 8px 0;
}

/* Stacked list of uploaded evidence files */
.evidence-files-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Single evidence file row */
.evidence-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  transition: border-color var(--t-fast);
}
.evidence-file-item:hover { border-color: var(--border-strong); }

/* File icon inside the row — inherits stroke from parent */
.evidence-file-item > svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

/* Filename — truncates gracefully, not clickable anymore (download button handles that) */
.evidence-file-name {
  flex: 1;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Size + uploader metadata */
.evidence-file-meta {
  font-size: .68rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Shared base for the download and delete icon buttons */
.evidence-download,
.evidence-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--t-fast);
  color: var(--text-muted);
  padding: 0;
}
.evidence-download svg,
.evidence-remove svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
}

/* Download button — brand-tinted hover */
.evidence-download:hover {
  border-color: var(--brand-border);
  color: var(--brand);
  background: var(--brand-glow);
}

/* Delete/remove button — red-tinted hover, matching other destructive actions */
.evidence-remove:hover {
  border-color: rgba(248,113,113,.35);
  color: var(--red);
  background: var(--red-bg);
}

/* "Evidence Required" warning badge — amber, matching the findings-form-notice pattern */
.evidence-required-badge {
  font-size: .73rem;
  line-height: 1.5;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, #F59E0B 12%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, #F59E0B 30%, transparent);
  color: #F59E0B;
}

/* Upload button — dashed border style, distinct from the brand CTA buttons */
.add-evidence-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-sm);
  padding: 7px 13px;
  margin-top: 4px;
  transition: all var(--t-fast);
  cursor: pointer;
  width: 100%;
  justify-content: center;
}
.add-evidence-btn:hover {
  border-color: var(--brand-border);
  color: var(--brand);
  background: var(--brand-glow);
}

/* ── Not Specified severity badge (auto-created findings) ───────────────── */
/* Sits alongside .sev-critical / .sev-high / etc. in the findings list */
.sev-unspecified {
  background: var(--slate-bg);
  color: var(--slate);
  border-color: rgba(107,114,128,.3);
}
