/* ═══════════════════════════════════════════════════════════
   PIA SYSTEM — DARK TECH THEME
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg-deep:      #0a1628;
  --bg-main:      #0f1e36;
  --bg-card:      #162236;
  --bg-input:     #0d1a2e;
  --bg-hover:     #1c2e48;
  --accent:       #f5c518;
  --accent-dim:   #c99d10;
  --accent-glow:  rgba(245, 197, 24, 0.15);
  --danger:       #e53e3e;
  --danger-dim:   #9b2c2c;
  --success:      #38a169;
  --warning:      #dd6b20;
  --text-primary: #e8edf5;
  --text-secondary:#8fa3be;
  --text-muted:   #4d6380;
  --border:       #1f3352;
  --border-active:#2a4a72;
  --shadow-sm:    0 2px 8px rgba(0,0,0,0.4);
  --shadow-md:    0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:    0 8px 40px rgba(0,0,0,0.6);
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --font-mono:    'Space Mono', monospace;
  --font-sans:    'DM Sans', sans-serif;
  --transition:   0.2s ease;
}

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

html { scroll-behavior: smooth; }

#pdg-logo {
  width: 30px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(30, 60, 100, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(20, 40, 80, 0.3) 0%, transparent 60%);
}


body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 5%   0%,   rgba(245,197,24,0.10) 0%, transparent 55%),
    radial-gradient(ellipse 60% 50% at 95%  5%,   rgba(192,57,43,0.10)  0%, transparent 55%),
    radial-gradient(ellipse 80% 60% at 50% 100%,  rgba(17,34,64,0.80)   0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(245,197,24,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(245,197,24,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  background-image:
    radial-gradient(ellipse at 10% 0%, rgba(30, 60, 100, 0.4) 0%, transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(20, 40, 80, 0.3) 0%, transparent 60%);
}

/* ── HEADER ───────────────────────────────────────────── */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent);
  line-height: 1;
  filter: drop-shadow(0 0 8px var(--accent));
}

.logo-title {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.gold { color: var(--accent); }

.logo-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 1px;
}

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

.meta-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  background: rgba(229, 62, 62, 0.15);
  color: #fc8181;
  border: 1px solid rgba(229, 62, 62, 0.3);
  padding: 3px 8px;
  border-radius: 4px;
}

.meta-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ── PROGRESS BAR ─────────────────────────────────────── */
.progress-track {
  height: 3px;
  background: var(--bg-deep);
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  width: 0%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px var(--accent);
}

/* ── STEP NAVIGATOR ───────────────────────────────────── */
.step-nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 0;
}

.step-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.step-pill.active {
  background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim), var(--shadow-sm);
}

.step-pill.completed {
  border-color: var(--success);
  background: rgba(56, 161, 105, 0.08);
}

.step-pill.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-pill:hover:not(.locked):not(.active) {
  border-color: var(--border-active);
  background: var(--bg-hover);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  min-width: 22px;
}

.step-pill.active .step-num { color: var(--accent); }
.step-pill.completed .step-num { color: var(--success); }

.step-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.step-pill.active .step-label { color: var(--text-primary); }

.step-check {
  margin-left: auto;
  font-size: 14px;
}

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

/* ── MAIN WRAPPER ─────────────────────────────────────── */
.main-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── PIA SECTIONS ─────────────────────────────────────── */
.pia-section {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  animation: sectionIn 0.35s ease forwards;
}

.pia-section.active { display: block; }

@keyframes sectionIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SECTION HEADER ───────────────────────────────────── */
.section-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.section-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--accent);
  margin-bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.section-tag::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 1px;
  background: var(--accent);
}

.section-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.section-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 650px;
  line-height: 1.7;
}

/* ── SUBSECTIONS ──────────────────────────────────────── */
.subsection {
  margin-bottom: 36px;
  padding: 28px;
  background: rgba(10, 22, 40, 0.5);
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 51, 82, 0.8);
}

.subsection-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.subsection-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--bg-deep);
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 1px;
}

.subsection-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── FORM GRID ────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group.half { grid-column: span 1; }

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
}

.form-label.required::after {
  content: ' *';
  color: var(--accent);
}

/* ── INPUTS ───────────────────────────────────────────── */
.form-input,
.form-textarea,
.form-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: rgba(13, 26, 46, 0.95);
}

.form-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.form-select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238fa3be' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-select option { background: var(--bg-card); }

/* Error state */
.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12) !important;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  min-height: 16px;
  display: block;
}

/* ── RADIO GROUPS ─────────────────────────────────────── */
.radio-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  transition: all var(--transition);
  color: var(--text-secondary);
  user-select: none;
  background: var(--bg-input);
}

.radio-card:hover {
  border-color: var(--accent-dim);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.radio-card input[type="radio"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.radio-group.error-group .radio-card { border-color: var(--danger); }

/* ── CHECKBOXES ───────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.check-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: all var(--transition);
  background: var(--bg-input);
  user-select: none;
}

.check-card:hover {
  border-color: var(--border-active);
  background: var(--bg-hover);
  color: var(--text-primary);
}

.check-card input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.check-card:has(input:checked) {
  border-color: var(--accent-dim);
  background: rgba(245, 197, 24, 0.06);
  color: var(--accent);
}

/* ── THRESHOLD ITEMS ──────────────────────────────────── */
.threshold-list { display: flex; flex-direction: column; gap: 4px; }

.threshold-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  transition: border-color var(--transition);
}

.threshold-item:hover { border-color: var(--border-active); }

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

.q-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  padding-top: 2px;
}

.q-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ── RATIONALE BLOCK ──────────────────────────────────── */
.rationale-block {
  margin-top: 14px;
  padding: 16px;
  background: rgba(245, 197, 24, 0.04);
  border: 1px solid rgba(245, 197, 24, 0.2);
  border-radius: var(--radius-sm);
  animation: ratIn 0.2s ease;
}

@keyframes ratIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rationale-block .form-label {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ── THRESHOLD RESULT ─────────────────────────────────── */
.threshold-result {
  margin: 24px 0;
  padding: 18px 22px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
}

.result-inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.result-icon {
  font-size: 24px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.result-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.result-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.threshold-result.full-pia-required {
  border-color: var(--danger);
  background: rgba(229, 62, 62, 0.07);
}
.threshold-result.full-pia-required .result-label { color: #fc8181; }
.threshold-result.full-pia-required .result-icon { color: var(--danger); }

.threshold-result.no-pia-required {
  border-color: var(--success);
  background: rgba(56, 161, 105, 0.07);
}
.threshold-result.no-pia-required .result-label { color: #68d391; }
.threshold-result.no-pia-required .result-icon { color: var(--success); }

/* ── RISK TABLE ───────────────────────────────────────── */
.risk-table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 28px;
}

.risk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.risk-table thead tr {
  background: rgba(10, 22, 40, 0.8);
}

.risk-table th {
  padding: 13px 14px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.risk-table th small {
  display: block;
  font-family: var(--font-sans);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.7;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.risk-table td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(31, 51, 82, 0.5);
  color: var(--text-secondary);
}

.risk-table tbody tr:last-child td { border-bottom: none; }

.risk-table tbody tr:hover td {
  background: rgba(26, 44, 72, 0.4);
  color: var(--text-primary);
}

.risk-row-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
}

.risk-threat {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  min-width: 200px;
}

.risk-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 6px 10px;
  outline: none;
  width: 100%;
  min-width: 80px;
  transition: border-color var(--transition);
  cursor: pointer;
}

.risk-select:focus { border-color: var(--accent); }
.risk-select.error { border-color: var(--danger); }
.risk-select option { background: var(--bg-card); }

.risk-score-cell {
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  min-width: 60px;
}

.risk-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  white-space: nowrap;
}

.risk-low    { color: #68d391; background: rgba(56,161,105,0.15); border: 1px solid rgba(56,161,105,0.3); }
.risk-medium { color: #f6ad55; background: rgba(221,107,32,0.15); border: 1px solid rgba(221,107,32,0.3); }
.risk-high   { color: #fc8181; background: rgba(229,62,62,0.15);  border: 1px solid rgba(229,62,62,0.3); }
.risk-none   { color: var(--text-muted); }

.risk-mit-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 6px 10px;
  outline: none;
  width: 100%;
  min-width: 160px;
  resize: vertical;
  transition: border-color var(--transition);
}

.risk-mit-input:focus { border-color: var(--accent); }
.risk-mit-input.error { border-color: var(--danger); }

/* ── RISK SUMMARY ─────────────────────────────────────── */
.risk-summary {
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 28px;
  overflow: hidden;
  min-width: 0;
}

.risk-summary-header {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.risk-bars {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-width: 0;
}

.risk-bar-item {
  flex: 1 1 60px;
  min-width: 0;
  max-width: 100%;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  text-align: center;
  overflow: hidden;
}

.risk-bar-label {
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.risk-bar-count {
  font-size: 22px;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.risk-aggregate {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  display: none;
}

.risk-aggregate.visible { display: block; }

/* ── SECTION FOOTER ───────────────────────────────────── */
.section-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  outline: none;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--accent);
  color: #0a1628;
}
.btn-primary:hover:not(:disabled) {
  background: #ffd133;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245, 197, 24, 0.3);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-active);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-arrow { font-size: 16px; transition: transform var(--transition); }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }

/* ── EXPORT BUTTONS ───────────────────────────────────── */
.btn-export {
  padding: 13px 28px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.btn-pdf {
  background: linear-gradient(135deg, #c0392b, #e53e3e);
  color: #fff;
}
.btn-pdf:hover:not(:disabled) {
  background: linear-gradient(135deg, #e53e3e, #fc8181);
  box-shadow: 0 4px 16px rgba(229, 62, 62, 0.35);
  transform: translateY(-1px);
}

.btn-csv {
  background: linear-gradient(135deg, #276749, #38a169);
  color: #fff;
}
.btn-csv:hover:not(:disabled) {
  background: linear-gradient(135deg, #38a169, #68d391);
  box-shadow: 0 4px 16px rgba(56, 161, 105, 0.35);
  transform: translateY(-1px);
}

.btn-export:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.export-icon { font-size: 16px; }

/* ── COMPLETION PANEL ─────────────────────────────────── */
.completion-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: sectionIn 0.4s ease;
  overflow: hidden;
}

.completion-panel.hidden { display: none; }

/* Top bar */
.cp-topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 36px 24px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(56,161,105,0.06) 0%, transparent 60%);
}

.cp-check {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(56, 161, 105, 0.12);
  border: 2px solid var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(56, 161, 105, 0.18);
}

.cp-title-block { flex: 1; text-align: left; }

.completion-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}

.completion-sub {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.cp-timestamp {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
  line-height: 1.6;
}

/* Outcome banner */
.cp-outcome-banner {
  padding: 14px 36px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.cp-outcome-banner .ob-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.cp-outcome-banner .ob-value {
  font-size: 13.5px;
  font-weight: 600;
}

.cp-outcome-banner .ob-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cp-outcome-banner.outcome-approved   { background: rgba(56,161,105,0.07); }
.cp-outcome-banner.outcome-conditions { background: rgba(221,107,32,0.07); }
.cp-outcome-banner.outcome-deferred   { background: rgba(113,128,150,0.07); }
.cp-outcome-banner.outcome-rejected   { background: rgba(229,62,62,0.07); }

/* Summary grid */
.cp-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.cp-card {
  padding: 24px 30px;
}

.cp-card + .cp-card {
  border-left: 1px solid var(--border);
}

.cp-card-header {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.cp-card-icon { color: var(--accent); }

/* Project rows */
.cp-card-rows { display: flex; flex-direction: column; gap: 10px; }

.cp-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.cp-row-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 110px;
  flex-shrink: 0;
}

.cp-row-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

/* Risk comparison */
.cp-risk-comparison { display: flex; flex-direction: column; gap: 14px; }

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

.cp-risk-row-label {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cp-risk-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cp-risk-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 1px solid;
}

.cp-risk-pill.pill-high   { color: #fc8181; background: rgba(229,62,62,0.1);  border-color: rgba(229,62,62,0.25); }
.cp-risk-pill.pill-medium { color: #f6ad55; background: rgba(221,107,32,0.1); border-color: rgba(221,107,32,0.25); }
.cp-risk-pill.pill-low    { color: #68d391; background: rgba(56,161,105,0.1);  border-color: rgba(56,161,105,0.25); }
.cp-risk-pill.pill-none   { color: var(--text-muted); background: transparent; border-color: var(--border); }

.cp-risk-arrow {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 4px;
}

.cp-risk-arrow span { color: var(--accent); font-size: 14px; }

/* Data strip */
.cp-strip {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}

.cp-strip-item {
  flex: 1;
  padding: 14px 20px;
  text-align: center;
  border-right: 1px solid var(--border);
}

.cp-strip-item:last-child { border-right: none; }

.cp-strip-num {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 3px;
}

.cp-strip-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

/* Export section */
.cp-export-section {
  padding: 24px 36px;
  text-align: center;
}

.cp-export-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.export-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ── TOAST ────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  z-index: 9999;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s ease;
  pointer-events: none;
  max-width: 360px;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-error   { background: linear-gradient(135deg, #9b2c2c, #c0392b); border-left: 3px solid #fc8181; }
.toast.toast-success { background: linear-gradient(135deg, #276749, #2f855a); border-left: 3px solid #68d391; }
.toast.toast-info    { background: linear-gradient(135deg, #1e3a5f, #2c5282); border-left: 3px solid var(--accent); }

/* ── HIDDEN UTILITY ───────────────────────────────────── */
.hidden { display: none !important; }

/* ── PIA Q&A BLOCKS (Section III) ────────────────────── */
.subsection-note {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  line-height: 1.6;
  font-style: italic;
}

.pia-qa-block {
  margin-bottom: 20px;
  padding: 18px 20px;
  background: rgba(10, 22, 40, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}
.pia-qa-block:hover { border-color: var(--border-active); }
.pia-qa-block:last-child { margin-bottom: 0; }

.pia-q {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.pia-q .q-num {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  min-width: 30px;
  padding-top: 2px;
  flex-shrink: 0;
}

.q-body { flex: 1; }

.q-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 5px;
}

.q-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  font-style: italic;
}

.opt {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  font-weight: 400;
  margin-left: 3px;
}

.check-card--vuln {
  border-color: rgba(245,197,24,0.2);
  background: rgba(245,197,24,0.04);
}

.other-input-row { margin-top: 8px; }

/* ── RISK TABLE NEW FORMAT ────────────────────────────── */
.risk-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 18px;
  background: rgba(10, 22, 40, 0.5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.legend-title {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  text-transform: uppercase;
  flex-shrink: 0;
}

.legend-items {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.legend-sep { color: var(--text-muted); }

.legend-note {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* Multi-row thead */
.risk-table thead tr:first-child th {
  border-bottom: none;
}
.risk-table thead tr:last-child th {
  border-top: 1px solid rgba(31,51,82,0.6);
}

.th-num { width: 36px; text-align: center; }
.th-obs { min-width: 140px; }
.th-risk { min-width: 140px; }
.th-treat { min-width: 160px; }
.th-del { width: 36px; }
.th-sub { font-size: 9px !important; min-width: 70px; }

.th-group-inherent {
  text-align: center;
  background: rgba(229, 62, 62, 0.06);
  color: #fc8181 !important;
  border-bottom: none;
  border-left: 1px solid rgba(229,62,62,0.2);
  border-right: 1px solid rgba(229,62,62,0.2);
}
.th-group-residual {
  text-align: center;
  background: rgba(56, 161, 105, 0.06);
  color: #68d391 !important;
  border-bottom: none;
  border-left: 1px solid rgba(56,161,105,0.2);
  border-right: 1px solid rgba(56,161,105,0.2);
}

/* Inherent/Residual cell groups */
.td-inherent-group {
  background: rgba(229, 62, 62, 0.03);
  border-left: 1px solid rgba(229,62,62,0.1);
}
.td-inherent-group-end {
  background: rgba(229, 62, 62, 0.03);
  border-right: 1px solid rgba(229,62,62,0.1);
}
.td-residual-group {
  background: rgba(56, 161, 105, 0.03);
  border-left: 1px solid rgba(56,161,105,0.1);
}
.td-residual-group-end {
  background: rgba(56, 161, 105, 0.03);
  border-right: 1px solid rgba(56,161,105,0.1);
}

/* Free-text cell inputs */
.risk-obs-input,
.risk-text-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 5px 4px;
  width: 100%;
  min-width: 120px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  min-height: 56px;
}
.risk-obs-input:focus,
.risk-text-input:focus {
  border-bottom-color: var(--accent);
}
.risk-obs-input.error,
.risk-text-input.error { border-bottom-color: var(--danger); }
.risk-obs-input::placeholder,
.risk-text-input::placeholder { color: var(--text-muted); font-size: 12px; }

/* Treatment plan wide textarea */
.risk-treat-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 12px;
  padding: 5px 4px;
  width: 100%;
  min-width: 150px;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
  min-height: 56px;
}
.risk-treat-input:focus { border-bottom-color: var(--accent); }
.risk-treat-input.error { border-bottom-color: var(--danger); }
.risk-treat-input::placeholder { color: var(--text-muted); font-size: 12px; }

/* Delete row button */
.btn-del-row {
  background: none;
  border: 1px solid rgba(229,62,62,0.3);
  border-radius: 4px;
  color: rgba(229,62,62,0.6);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 7px;
  transition: all var(--transition);
  line-height: 1;
}
.btn-del-row:hover {
  background: rgba(229,62,62,0.1);
  border-color: var(--danger);
  color: var(--danger);
}
.btn-del-row:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Risk table actions bar */
.risk-table-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 20px;
}

.btn-sm { padding: 7px 16px; font-size: 13px; }

.risk-row-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Risk summary grouped bars */
.risk-bars {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  min-width: 0;
}
.risk-bar-group {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 100%;
}
.risk-bars-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.risk-bars-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

/* ── OTHER TAG INPUT SYSTEM ───────────────────────────── */
.form-label-opt {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
  font-style: italic;
}

.other-tag-field {
  margin-top: 12px;
  padding: 14px 16px;
  background: rgba(10, 22, 40, 0.45);
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition);
}

.other-tag-field:focus-within {
  border-color: var(--accent-dim);
  border-style: solid;
}

.other-tag-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 10px;
}

.other-tag-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.other-inline-input {
  font-size: 13px;
  padding: 8px 12px;
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.other-inline-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.other-inline-input::placeholder { color: var(--text-muted); font-size: 12px; }

.other-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.other-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: rgba(245, 197, 24, 0.1);
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  animation: tagIn 0.15s ease;
}

@keyframes tagIn {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

.other-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(245, 197, 24, 0.5);
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: color var(--transition);
  display: flex;
  align-items: center;
}

.other-tag-remove:hover { color: var(--danger); }

/* ── SCROLLBAR ────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-active); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
  .step-nav { overflow-x: auto; padding: 12px 16px; gap: 6px; }
  .step-pill { flex: 0 0 auto; }
  .step-label { display: none; }
  .pia-section { padding: 22px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.half { grid-column: 1; }
  .risk-table-wrapper { overflow-x: auto; max-width: 100%; }
  .risk-table { font-size: 12px; min-width: 600px; }
  .export-buttons { flex-direction: column; align-items: center; }
  .section-footer { flex-direction: column; gap: 12px; }
  .cp-summary-grid { grid-template-columns: 1fr; }
  .cp-card + .cp-card { border-left: none; border-top: 1px solid var(--border); }
  .cp-topbar { flex-wrap: wrap; }
  .cp-timestamp { display: none; }
  .cp-strip { flex-wrap: wrap; }
  .cp-strip-item { min-width: 50%; border-bottom: 1px solid var(--border); }

  /* Risk summary — stack groups, shrink pills */
  .risk-summary { padding: 14px; }
  .risk-bar-group { flex: 1 1 100%; }
  .risk-bars-row { gap: 6px; }
  .risk-bar-item { flex: 1 1 40px; padding: 8px 6px; }
  .risk-bar-count { font-size: 18px; }
  .risk-bar-label { font-size: 9px; letter-spacing: 0; }
  .risk-aggregate { font-size: 12px; }
}
