/* ============================================================
   DIVCAAS – Competence Management System (CMS)
   Source documents: IMCA C003 Rev.3.3, C001 Rev.3.2, Info Note 1022
   ============================================================ */

:root {
  --navy:      #0a1628;
  --navy-mid:  #0d2244;
  --blue:      #1a56db;
  --blue-light:#3b82f6;
  --cyan:      #06b6d4;
  --gold:      #f59e0b;
  --green:     #10b981;
  --red:       #ef4444;
  --purple:    #7c3aed;
  --bg:        #f0f4f8;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --muted:     #64748b;
  --sidebar-w: 280px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── TOP BAR ─────────────────────────────────────────────── */
.cms-topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: 60px;
  background: var(--navy);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  border-bottom: 2px solid var(--blue);
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.topbar-title { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.3px; }
.topbar-subtitle { color: var(--cyan); font-size: 11px; font-weight: 500; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; text-decoration: none; transition: all 0.2s;
}
.topbar-btn.primary { background: var(--blue); color: #fff; }
.topbar-btn.primary:hover { background: var(--blue-light); }
.topbar-btn.ghost { background: rgba(255,255,255,0.08); color: #cbd5e1; border: 1px solid rgba(255,255,255,0.12); }
.topbar-btn.ghost:hover { background: rgba(255,255,255,0.14); color: #fff; }
.topbar-btn.success { background: var(--green); color: #fff; }
.topbar-btn.success:hover { background: #059669; }
.version-badge {
  background: rgba(6,182,212,0.15); color: var(--cyan);
  border: 1px solid rgba(6,182,212,0.3);
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.cms-layout {
  display: flex;
  margin-top: 60px;
  min-height: calc(100vh - 60px);
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.cms-sidebar {
  width: var(--sidebar-w);
  background: var(--navy-mid);
  position: fixed; top: 60px; left: 0; bottom: 0;
  overflow-y: auto; z-index: 900;
  border-right: 1px solid rgba(255,255,255,0.07);
}
.cms-sidebar::-webkit-scrollbar { width: 4px; }
.cms-sidebar::-webkit-scrollbar-track { background: transparent; }
.cms-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-section-title {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35); text-transform: uppercase;
  padding: 0 8px; margin-bottom: 6px;
}
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500;
  transition: all 0.18s; margin-bottom: 2px; text-decoration: none;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav-item.active { background: var(--blue); color: #fff; }
.sidebar-nav-item .nav-icon { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; }
.sidebar-nav-item .nav-badge {
  margin-left: auto; background: var(--gold); color: var(--navy);
  border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 700;
}
.sidebar-divider { height: 1px; background: rgba(255,255,255,0.07); margin: 8px 12px; }

.sidebar-imca-refs {
  margin: 12px; padding: 12px;
  background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.2);
  border-radius: 8px;
}
.sidebar-imca-refs p { font-size: 10px; color: var(--cyan); font-weight: 700; margin-bottom: 6px; letter-spacing: 0.5px; }
.sidebar-imca-refs span {
  display: block; font-size: 10px; color: rgba(255,255,255,0.5);
  margin-bottom: 3px; line-height: 1.4;
}

/* ── MAIN CONTENT ────────────────────────────────────────── */
.cms-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px;
  max-width: calc(100% - var(--sidebar-w));
}

/* ── SECTIONS ────────────────────────────────────────────── */
.cms-section {
  display: none;
  animation: fadeIn 0.25s ease;
}
.cms-section.active { display: block; }

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

/* ── PAGE HEADER ─────────────────────────────────────────── */
.page-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  border-radius: 14px; padding: 28px 32px; margin-bottom: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  position: relative; overflow: hidden;
}
.page-header::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(26,86,219,0.25) 0%, transparent 70%);
}
.page-header-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(6,182,212,0.12); border: 1px solid rgba(6,182,212,0.3);
  color: var(--cyan); padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.page-header h1 { font-size: 24px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.page-header p { font-size: 13px; color: rgba(255,255,255,0.6); max-width: 620px; line-height: 1.6; }
.page-header-meta {
  display: flex; gap: 16px; margin-top: 14px; flex-wrap: wrap;
}
.meta-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7); padding: 4px 12px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.meta-badge i { color: var(--cyan); }

/* ── CARDS GRID ──────────────────────────────────────────── */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 24px; }
.cards-grid-3 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards-grid-4 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.gloss-term   { font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 4px; font-family: monospace; letter-spacing: 0.5px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; transition: all 0.2s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); border-color: #cbd5e1; transform: translateY(-1px); }
.card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 12px;
}
.card-icon.blue { background: #eff6ff; color: var(--blue); }
.card-icon.green { background: #f0fdf4; color: var(--green); }
.card-icon.gold { background: #fffbeb; color: var(--gold); }
.card-icon.purple { background: #f5f3ff; color: var(--purple); }
.card-icon.red { background: #fef2f2; color: var(--red); }
.card-icon.cyan { background: #ecfeff; color: var(--cyan); }
.card h3 { font-size: 14px; font-weight: 700; margin-bottom: 5px; color: var(--text); }
.card p { font-size: 12px; color: var(--muted); line-height: 1.6; }
.card .card-ref { font-size: 10px; color: var(--blue); font-weight: 600; margin-top: 10px; letter-spacing: 0.3px; }

/* ── STAT CARDS ──────────────────────────────────────────── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 4px; }
.stat-card .stat-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.stat-card .stat-ref { font-size: 10px; color: var(--blue); font-weight: 600; margin-top: 6px; }

/* ── SECTION TITLE ───────────────────────────────────────── */
.section-title {
  font-size: 16px; font-weight: 800; color: var(--navy);
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.section-title i { color: var(--blue); }

/* ── POLICY CARDS ────────────────────────────────────────── */
.policy-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin-bottom: 14px;
  border-left: 4px solid var(--blue); transition: all 0.2s;
}
.policy-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.policy-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.policy-code {
  background: var(--blue); color: #fff;
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; font-weight: 800; white-space: nowrap; flex-shrink: 0;
}
.policy-title { font-size: 15px; font-weight: 700; color: var(--navy); }
.policy-body { font-size: 13px; color: var(--text); line-height: 1.7; }
.policy-body ul { padding-left: 18px; margin-top: 6px; }
.policy-body li { margin-bottom: 4px; }
.policy-ref { margin-top: 10px; font-size: 11px; color: var(--muted); font-style: italic; }
.policy-ref strong { color: var(--blue); }

/* ── POLICY PROCEDURAL STEPS ─────────────────────────────── */
.policy-steps-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 800; color: var(--blue);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 16px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.policy-steps {
  list-style: none;
  padding: 0; margin: 0 0 8px;
  display: flex; flex-direction: column; gap: 8px;
  counter-reset: step-counter;
}
.policy-step {
  display: flex; gap: 12px; align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px 14px;
  counter-increment: step-counter;
  position: relative;
}
.policy-step::before {
  content: counter(step-counter);
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--navy); color: #fff;
  border-radius: 50%;
  font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  margin-top: 1px;
}
.step-title-inline {
  font-size: 13px; font-weight: 700; color: var(--navy);
  margin-bottom: 4px;
}
.step-detail-inline {
  font-size: 12px; color: var(--muted); line-height: 1.6;
}
.step-detail-inline code {
  background: #e2e8f0; color: var(--navy);
  font-family: monospace; font-size: 11px;
  padding: 1px 5px; border-radius: 4px;
}
.policy-step > div { flex: 1; }

/* ── ROLE CARDS ──────────────────────────────────────────── */
.roles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.role-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; cursor: pointer;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.role-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}
.role-card:hover { box-shadow: 0 6px 20px rgba(26,86,219,0.12); border-color: var(--blue-light); transform: translateY(-2px); }
.role-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,0.15); }
.role-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.role-code-badge {
  width: 46px; height: 46px; border-radius: 10px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.role-name { font-size: 14px; font-weight: 700; color: var(--navy); }
.role-standard { font-size: 11px; color: var(--muted); margin-top: 2px; }
.role-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.role-tag {
  background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe;
  border-radius: 6px; padding: 3px 9px; font-size: 11px; font-weight: 600;
}
.role-tag.safety { background: #fef2f2; color: var(--red); border-color: #fecaca; }
.role-tag.green { background: #f0fdf4; color: var(--green); border-color: #bbf7d0; }
.role-view-btn {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 12px; padding: 7px 14px; border-radius: 7px;
  background: var(--blue); color: #fff; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all 0.2s; text-decoration: none;
}
.role-view-btn:hover { background: var(--blue-light); }

/* ── ASSESSMENT PLAN PANEL ───────────────────────────────── */
.assessment-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; margin-bottom: 24px;
}
.assessment-panel-header {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  padding: 20px 24px; display: flex; align-items: center; justify-content: space-between;
}
.assessment-panel-header h2 { color: #fff; font-size: 16px; font-weight: 700; }
.assessment-panel-header p { color: rgba(255,255,255,0.6); font-size: 12px; margin-top: 4px; }

/* ── UNIT ACCORDION ──────────────────────────────────────── */
.unit-accordion { border-bottom: 1px solid var(--border); }
.unit-accordion:last-child { border-bottom: none; }
.unit-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; cursor: pointer; background: #fff;
  transition: background 0.15s; user-select: none;
}
.unit-header:hover { background: #f8fafc; }
.unit-code-pill {
  background: var(--navy); color: #fff;
  border-radius: 6px; padding: 4px 10px;
  font-size: 11px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
}
.unit-title-text { font-size: 13px; font-weight: 700; color: var(--navy); flex: 1; }
.unit-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.unit-chevron {
  color: var(--muted); font-size: 12px; transition: transform 0.2s; flex-shrink: 0;
}
.unit-header.open .unit-chevron { transform: rotate(180deg); }
.unit-body { display: none; padding: 0 24px 20px; background: #f8fafc; }
.unit-body.open { display: block; }

.kna-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 900px) { .kna-grid { grid-template-columns: 1fr; } }

.kna-col { }
.kna-col-title {
  font-size: 11px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 7px 12px; border-radius: 6px; margin-bottom: 10px;
}
.kna-col-title.knowledge { background: #eff6ff; color: var(--blue); }
.kna-col-title.ability { background: #f0fdf4; color: var(--green); }
.kna-col-title.demonstration { background: #fffbeb; color: var(--gold); }

.kna-list { list-style: none; }
.kna-list li {
  font-size: 12px; color: var(--text); line-height: 1.6;
  padding: 5px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
  display: flex; gap: 7px;
}
.kna-list li::before { content: '•'; flex-shrink: 0; margin-top: 1px; }
.kna-col-title.knowledge ~ .kna-list li::before { color: var(--blue); }
.kna-col-title.ability ~ .kna-list li::before { color: var(--green); }
.kna-col-title.demonstration ~ .kna-list li::before { color: var(--gold); }

/* ── ENTRY CRITERIA TABLE ────────────────────────────────── */
.entry-table {
  width: 100%; border-collapse: collapse;
  margin-bottom: 20px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
}
.entry-table th {
  background: var(--navy); color: #fff;
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
}
.entry-table td {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text); vertical-align: top; line-height: 1.6;
}
.entry-table tr:last-child td { border-bottom: none; }
.entry-table tr:hover td { background: #f8fafc; }
.entry-table .group-row td {
  background: #eff6ff; color: var(--blue);
  font-weight: 700; font-size: 11px; letter-spacing: 0.3px; padding: 8px 16px;
}

/* ── ASSESSOR / VERIFIER CARDS ───────────────────────────── */
.av-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; margin-bottom: 16px;
}
.av-card-header { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.av-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.av-icon.assessor { background: linear-gradient(135deg, #3b82f6, #1d4ed8); color: #fff; }
.av-icon.verifier { background: linear-gradient(135deg, #7c3aed, #5b21b6); color: #fff; }
.av-card h3 { font-size: 16px; font-weight: 800; color: var(--navy); }
.av-card .av-ref { font-size: 11px; color: var(--muted); margin-top: 2px; }
.av-requirements { padding-left: 0; list-style: none; }
.av-requirements li {
  display: flex; gap: 10px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); line-height: 1.6;
}
.av-requirements li:last-child { border-bottom: none; }
.av-requirements li i { color: var(--blue); flex-shrink: 0; margin-top: 3px; width: 16px; }
.av-requirements li.purple i { color: var(--purple); }

/* ── PROCESS STEPS ───────────────────────────────────────── */
.process-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.process-step {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; display: flex; gap: 16px; align-items: flex-start;
  position: relative;
}
.process-step::after {
  content: ''; position: absolute; left: 36px; bottom: -14px;
  width: 2px; height: 14px; background: var(--border);
}
.process-step:last-child::after { display: none; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800;
}
.step-content h4 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.step-content p { font-size: 12px; color: var(--muted); line-height: 1.7; }
.step-content ul { padding-left: 16px; margin-top: 6px; }
.step-content ul li { font-size: 12px; color: var(--text); margin-bottom: 3px; }
.step-ref { font-size: 10px; color: var(--blue); font-weight: 700; margin-top: 8px; display: block; }

/* ── EVIDENCE TYPES ──────────────────────────────────────── */
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.evidence-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; transition: all 0.2s;
}
.evidence-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.07); }
.evidence-code {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 800; margin-bottom: 8px;
}
.evidence-label { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.evidence-desc { font-size: 11px; color: var(--muted); line-height: 1.5; }
.evidence-type { font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── UPLOAD ZONE ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 14px;
  padding: 40px; text-align: center; background: var(--card);
  transition: all 0.2s; cursor: pointer; margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--blue); background: #eff6ff;
}
.upload-zone i { font-size: 36px; color: var(--blue); margin-bottom: 12px; display: block; }
.upload-zone h3 { font-size: 15px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.upload-zone p { font-size: 12px; color: var(--muted); }
.upload-zone .upload-limits {
  margin-top: 12px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.upload-limits span {
  background: #f1f5f9; border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 10px; font-size: 11px; font-weight: 600; color: var(--muted);
}
#file-input { display: none; }

.upload-list { margin-bottom: 20px; }
.upload-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 8px;
}
.upload-item-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: #eff6ff; color: var(--blue);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
}
.upload-item-info { flex: 1; }
.upload-item-name { font-size: 13px; font-weight: 600; color: var(--navy); }
.upload-item-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.upload-item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px; padding: 4px;
  transition: color 0.2s;
}
.upload-item-remove:hover { color: var(--red); }

/* ── FORM ELEMENTS ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 9px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; color: var(--text);
  background: var(--card); transition: border 0.2s; outline: none;
  font-family: inherit;
}
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,0.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── REPORT CARDS ────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-bottom: 24px; }
.report-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 22px; transition: all 0.2s;
}
.report-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,0.1); border-color: #cbd5e1; }
.report-card-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 14px;
}
.report-card h3 { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.report-card p { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; }
.report-card .report-ref { font-size: 10px; color: var(--blue); font-weight: 700; margin-bottom: 12px; }
.report-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 7px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all 0.2s; text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-light); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: #d97706; color: #fff; }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #6d28d9; }
.btn-outline { background: transparent; color: var(--blue); border: 1px solid var(--blue); }
.btn-outline:hover { background: #eff6ff; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #dc2626; }

/* ── TRANSFERABILITY MATRIX ──────────────────────────────── */
.matrix-table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; margin-bottom: 24px;
}
.matrix-table th {
  background: var(--navy); color: #fff;
  padding: 12px 16px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
}
.matrix-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: top; line-height: 1.6; }
.matrix-table tr:last-child td { border-bottom: none; }
.matrix-table tr:hover td { background: #f8fafc; }
.status-yes { display: inline-flex; align-items: center; gap: 4px; color: var(--green); font-weight: 700; }
.status-no { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 700; }
.status-partial { display: inline-flex; align-items: center; gap: 4px; color: var(--gold); font-weight: 700; }

/* ── COMPLIANCE BANNER ───────────────────────────────────── */
.compliance-banner {
  background: linear-gradient(135deg, #0a1628, #0d2244);
  border: 1px solid rgba(6,182,212,0.3);
  border-radius: 14px; padding: 24px; margin-bottom: 24px;
}
.compliance-banner h3 { color: var(--cyan); font-size: 14px; font-weight: 800; margin-bottom: 12px; }
.compliance-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.compliance-item {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 10px 12px;
}
.compliance-item i { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.compliance-item span { color: rgba(255,255,255,0.75); font-size: 12px; line-height: 1.5; }

/* ── TABS ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.tab-btn {
  padding: 9px 18px; border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.2s; font-family: inherit;
}
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-btn:hover { color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.2s ease; }

/* ── ROLE SELECTOR ───────────────────────────────────────── */
.role-selector-bar {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.role-selector-bar label { font-size: 12px; font-weight: 700; color: var(--navy); white-space: nowrap; }
.role-selector-bar select {
  flex: 1; min-width: 200px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 7px;
  font-size: 13px; color: var(--text); background: var(--bg);
  outline: none; font-family: inherit;
}
.role-selector-bar select:focus { border-color: var(--blue); }

/* ── LIVE LINK BADGES ────────────────────────────────────── */
.live-links-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 20px; padding: 14px 18px;
  background: linear-gradient(135deg, rgba(26,86,219,0.05), rgba(6,182,212,0.05));
  border: 1px solid rgba(26,86,219,0.15); border-radius: 10px;
}
.live-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px;
  font-size: 12px; font-weight: 600; text-decoration: none;
  transition: all 0.2s; cursor: pointer; border: none; font-family: inherit;
}
.live-link.portfolio { background: #eff6ff; color: var(--blue); border: 1px solid #bfdbfe; }
.live-link.portfolio:hover { background: var(--blue); color: #fff; }
.live-link.assessor { background: #f5f3ff; color: var(--purple); border: 1px solid #ddd6fe; }
.live-link.assessor:hover { background: var(--purple); color: #fff; }
.live-link.admin { background: #fef2f2; color: var(--red); border: 1px solid #fecaca; }
.live-link.admin:hover { background: var(--red); color: #fff; }
.live-link.observer { background: #f0fdf4; color: var(--green); border: 1px solid #bbf7d0; }
.live-link.observer:hover { background: var(--green); color: #fff; }
.live-link.export { background: #fffbeb; color: var(--gold); border: 1px solid #fde68a; }
.live-link.export:hover { background: var(--gold); color: var(--navy); }

/* ── ALERT / INFO BOX ────────────────────────────────────── */
.info-box {
  display: flex; gap: 12px; padding: 14px 18px;
  border-radius: 10px; margin-bottom: 18px; align-items: flex-start;
}
.info-box.blue { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.info-box.gold { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.info-box.green { background: #f0fdf4; border: 1px solid #bbf7d0; color: #065f46; }
.info-box.red { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.info-box i { flex-shrink: 0; margin-top: 1px; font-size: 15px; }
.info-box p { font-size: 12px; line-height: 1.7; }
.info-box strong { font-weight: 700; }

/* ── TOAST ───────────────────────────────────────────────── */
#cms-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--navy); color: #fff;
  padding: 12px 20px; border-radius: 10px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: none; align-items: center; gap: 10px;
  max-width: 360px; border-left: 4px solid var(--green);
}
#cms-toast.show { display: flex; animation: slideUp 0.3s ease; }
#cms-toast.error { border-left-color: var(--red); }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ── MODAL ───────────────────────────────────────────────── */
.cms-modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  align-items: center; justify-content: center;
}
.cms-modal-overlay.open { display: flex; }
.cms-modal {
  background: var(--card); border-radius: 16px;
  padding: 28px; max-width: 700px; width: calc(100% - 40px);
  max-height: calc(100vh - 80px); overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: fadeIn 0.25s ease;
}
.cms-modal h2 { font-size: 18px; font-weight: 800; color: var(--navy); margin-bottom: 16px; }
.modal-close {
  float: right; background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--muted); padding: 0;
  transition: color 0.2s; line-height: 1;
}
.modal-close:hover { color: var(--red); }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.progress-wrap { background: #e2e8f0; border-radius: 999px; height: 8px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width 0.4s ease; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .cms-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .cms-sidebar.open { transform: translateX(0); }
  .cms-main { margin-left: 0; max-width: 100%; padding: 16px; }
  .cards-grid { grid-template-columns: 1fr; }
  .kna-grid { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: 1fr; }
  .topbar-title { font-size: 13px; }
  #mob-menu-btn { display: flex !important; }

  /* Topbar overflow fix — hide labels on small screens */
  .cms-version-badge { display: none; }
  .cms-btn-label { display: none; }
  .cms-topbar-link { padding: 7px 10px !important; }

  /* Assessment plan tables — horizontal scroll */
  .entry-table, .assessment-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Sidebar overlay backdrop */
  .cms-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 99;
    backdrop-filter: blur(2px);
  }
  .cms-sidebar-overlay.active { display: block; }
}

@media (max-width: 480px) {
  .topbar-subtitle { display: none; }
  .cms-topbar { padding: 0 12px; }
}
#mob-menu-btn { display: none; }

/* ── PRINT ───────────────────────────────────────────────── */
@media print {
  .cms-topbar, .cms-sidebar, .live-links-bar, .report-btns { display: none !important; }
  .cms-main { margin-left: 0; padding: 0; }
  .cms-section { display: block !important; }
  .unit-body { display: block !important; }
}
