/* =====================================================================
   Hospital Commissioning App — Control Tower
   Redesigned navigation: sidebar (views + grouped focus areas), breadcrumb,
   section sub-tabs, collapsible sidebar, mobile drawer, RTL & dark mode.
   ===================================================================== */

:root {
  --bg: #f6f4fb;
  --surface: #ffffff;
  --surface-alt: #f9f7fe;
  --border: #e5e0f4;
  --text: #141124;
  --text-muted: #645e7d;
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-soft: #f3e8ff;
  --accent: #8b5cf6;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(76, 29, 149, 0.08);
  --topbar-h: 58px;
  --sidebar-w: 288px;
  --sidebar-w-collapsed: 64px;
}

[data-theme="dark"] {
  --bg: #0e0b1a;
  --surface: #171329;
  --surface-alt: #201a38;
  --border: #312852;
  --text: #f3f0ff;
  --text-muted: #a69ec4;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-soft: rgba(139, 92, 246, 0.18);
  --accent: #a78bfa;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.15);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.15);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.15);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Noto Sans Arabic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.section-hidden { display: none !important; }
.muted { color: var(--text-muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ */
/* Topbar                                                              */
/* ------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  display: block;
  border-radius: 8px;
}

.brand-text { min-width: 0; }
.brand h1 { margin: 0; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { margin: 0; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.topbar-divider { width: 1px; height: 24px; background: var(--border); margin: 0 2px; }

.facility-select {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  max-width: 230px;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--surface-alt); }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }

.icon-btn {
  border: none; background: transparent;
  font-size: 18px; line-height: 1; cursor: pointer; color: var(--text-muted);
}
.icon-btn-round {
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 17px; line-height: 1;
  cursor: pointer;
  display: inline-grid; place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn-round:hover { background: var(--primary-soft); border-color: var(--accent); color: var(--primary); }

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.main-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
  transition: grid-template-columns 0.2s ease;
}
body.sidebar-collapsed .main-layout { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }

/* ------------------------------------------------------------------ */
/* Sidebar                                                             */
/* ------------------------------------------------------------------ */
.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section { padding: 10px 10px 8px; }
.sidebar-nav { padding: 8px 8px 8px; }
.sidebar-section + .sidebar-section { border-top: 1px solid var(--border); }
.sidebar-areas { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 8px;
}
.sidebar-header h2 {
  margin: 0; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted);
}

/* Main navigation */
/* Compact two-column tiles so the focus areas get the space */
.nav-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; min-width: 0;
  padding: 5px 7px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12px; font-weight: 600; line-height: 1.25;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.nav-btn:hover { background: var(--surface-alt); }
.nav-btn.active { background: var(--primary); color: #fff; }
.nav-icon { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; opacity: 0.9; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-pill {
  background: var(--surface-alt); border: 1px solid var(--border);
  padding: 0 5px; border-radius: 999px; font-size: 10px; color: var(--text-muted); flex-shrink: 0;
}
.nav-btn.active .tab-pill { background: rgba(255, 255, 255, 0.22); border-color: transparent; color: #fff; }

/* Area search */
.area-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: 7px; padding: 1px 8px; margin-bottom: 6px;
}
.area-search .search-icon { font-size: 12px; opacity: 0.7; }
.area-search input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 12.5px; color: var(--text); font-family: inherit; padding: 3px 0;
}
.area-search input::-webkit-search-cancel-button { cursor: pointer; }

/* Area list (grouped) */
.area-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding-inline-end: 2px;
  scrollbar-width: thin;
}
.area-group { display: flex; flex-direction: column; gap: 1px; }
.area-group-items { display: flex; flex-direction: column; gap: 1px; }
.area-group.is-collapsed .area-group-items { display: none; }
.area-group-title {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  display: flex; align-items: center; gap: 6px; width: 100%;
  padding: 3px 6px; border: 0; border-radius: 6px; cursor: pointer; font-family: inherit;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); text-align: start;
}
.area-group-title:hover { color: var(--primary); }
.area-group-chevron { font-size: 9px; transition: transform 0.15s; }
.area-group.is-collapsed .area-group-chevron { transform: rotate(-90deg); }
[dir="rtl"] .area-group.is-collapsed .area-group-chevron { transform: rotate(90deg); }
.area-group-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-group-count { font-weight: 600; opacity: 0.75; letter-spacing: 0; }

/* One-line area rows with a hairline progress bar */
.area-item {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  width: 100%; min-height: 27px;
  padding: 3px 8px 5px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: start;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.area-item:hover { background: var(--surface-alt); }
.area-item.active { background: var(--primary-soft); border-color: var(--accent); color: var(--primary); font-weight: 600; }
.area-icon { width: 20px; text-align: center; font-size: 13px; flex-shrink: 0; opacity: 0.85; }
.area-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0; }
.area-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.area-bar { position: absolute; inset-inline: 34px 10px; bottom: 2px; height: 2px; border-radius: 999px; background: var(--border); overflow: hidden; }
.area-bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; }
.area-item.active .area-bar { background: rgba(124, 58, 237, 0.2); }
.area-meta {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}
.area-crit {
  display: inline-grid; place-items: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  background: var(--danger-soft); color: var(--danger);
}

.sidebar-footer { padding: 6px 8px; border-top: 1px solid var(--border); }
.opening-rule-box {
  background: var(--warn-soft);
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 11.5px;
  color: #92400e;
}
.opening-rule-box summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.opening-rule-box summary::-webkit-details-marker { display: none; }
.opening-rule-box summary::after { content: "\25B8"; margin-inline-start: auto; font-size: 10px; transition: transform 0.15s; }
.opening-rule-box[open] summary::after { transform: rotate(90deg); }
.opening-rule-box p { margin: 4px 0 2px; }

/* Collapsed sidebar (desktop): icons only */
body.sidebar-collapsed .sidebar-header,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .tab-pill,
body.sidebar-collapsed .area-search,
body.sidebar-collapsed .area-group-title,
body.sidebar-collapsed .area-body,
body.sidebar-collapsed .area-meta,
body.sidebar-collapsed .sidebar-footer { display: none; }
body.sidebar-collapsed .sidebar-section { padding: 10px 8px; }
body.sidebar-collapsed .nav-list { grid-template-columns: 1fr; }
body.sidebar-collapsed .area-group-items { display: flex !important; }
body.sidebar-collapsed .nav-btn,
body.sidebar-collapsed .area-item { justify-content: center; padding: 9px 0; }
body.sidebar-collapsed .area-icon,
body.sidebar-collapsed .nav-icon { width: auto; font-size: 17px; }

.sidebar-backdrop { display: none; }

/* ------------------------------------------------------------------ */
/* Workspace                                                           */
/* ------------------------------------------------------------------ */
.workspace { padding: 14px 22px 0; min-width: 0; overflow-x: hidden; display: flex; flex-direction: column; }
.workspace > * { min-width: 0; }

.breadcrumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 10px;
}
.breadcrumb strong { color: var(--text); }
.crumb-sep { opacity: 0.6; }

/* Hero AI & Document Search Bar */
.hero-search-wrap { margin-bottom: 14px; }
.hero-search-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 7px 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hero-search-bar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.hero-search-bar input[type="text"] {
  flex: 1; min-width: 240px;
  border: none; background: transparent; outline: none;
  font-size: 14px; color: var(--text); padding: 6px 4px; font-family: inherit;
}
.hero-search-bar select {
  border: 1px solid var(--border); background: var(--surface-alt);
  border-radius: 7px; padding: 6px 8px; font-size: 12.5px; color: var(--text);
}
.web-ground-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  padding: 4px 6px; border-radius: 6px; user-select: none;
}

.ai-answer-card {
  margin-top: 10px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.ai-answer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; color: var(--primary); }
.ai-answer-body { font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.ai-answer-sources { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-source-chip {
  display: inline-block; font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); text-decoration: none; border: 1px solid var(--border);
}
.ai-answer-body p { margin: 0 0 8px; }
.ai-answer-body h3, .ai-answer-body h4, .ai-answer-body h5, .ai-answer-body h6 { margin: 12px 0 6px; font-size: 14px; color: var(--primary); }
.ai-answer-body ul, .ai-answer-body ol { margin: 4px 0 10px; padding-inline-start: 22px; }
.ai-answer-body li { margin-bottom: 4px; }
.ai-answer-body code { background: var(--surface-alt); border: 1px solid var(--border); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.ai-answer-body a { color: var(--primary); }
.ai-answer-body .md-table-wrap { overflow-x: auto; margin: 6px 0 12px; border: 1px solid var(--border); border-radius: 8px; }
.ai-answer-body .md-table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.5; white-space: normal; }
.ai-answer-body .md-table th, .ai-answer-body .md-table td { padding: 7px 10px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--border); }
.ai-answer-body .md-table th { background: var(--surface-alt); color: var(--primary); font-weight: 600; white-space: nowrap; }
.ai-answer-body .md-table tbody tr:last-child td { border-bottom: none; }
.ai-answer-body .md-table tbody tr:nth-child(even) td { background: var(--surface-alt); }

.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* Focus Banner */
.focus-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: var(--shadow);
}
.focus-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.focus-nav { display: flex; gap: 4px; flex-shrink: 0; }
.focus-banner h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.focus-icon { font-size: 16px; opacity: 0.8; }
.focus-banner p { margin: 3px 0 0; color: var(--text-muted); font-size: 12.5px; }
.focus-stats { display: flex; gap: 18px; }
.focus-stat { text-align: end; }
.focus-stat .val { font-size: 18px; font-weight: 700; display: block; line-height: 1.1; }
.focus-stat .lbl { font-size: 11px; color: var(--text-muted); }

/* Section sub-tabs (Area Workspace) */
.section-tabs {
  position: sticky;
  top: var(--topbar-h);
  z-index: 20;
  display: flex; flex-wrap: wrap; gap: 4px;
  background: var(--bg);
  padding: 6px 0 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.section-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12.5px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.section-tab:hover { border-color: var(--accent); color: var(--primary); }
.section-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.section-count {
  display: inline-grid; place-items: center;
  min-width: 20px; height: 18px; padding: 0 6px;
  border-radius: 999px; font-size: 11px;
  background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted);
}
.section-tab.active .section-count { background: rgba(255, 255, 255, 0.22); border-color: transparent; color: #fff; }
.section-tab-all { margin-inline-start: auto; }

/* Toolbar */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}
.filter-group { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-group label { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; }
.filter-group select {
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 6px; padding: 5px 8px; font-size: 12px; color: var(--text);
}
.check-label { cursor: pointer; }

/* Cards & Tables */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-header h3 { margin: 0; font-size: 14.5px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: start; padding: 8px 10px;
  background: var(--surface-alt); border-bottom: 1px solid var(--border);
  color: var(--text-muted); font-weight: 600; white-space: nowrap;
  position: sticky; top: 0;
}
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tr:hover td { background: var(--surface-alt); }

.task-title { font-weight: 600; color: var(--text); cursor: pointer; }
.task-title:hover { color: var(--primary); text-decoration: underline; }
.task-evidence { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

.inline-select, .inline-input {
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 6px;
  font-size: 12px; background: var(--surface); color: var(--text); width: 100%;
}
.data-table .inline-select { min-width: 110px; }
.data-table td input[type="date"].inline-input { min-width: 125px; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-neutral { background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }
.badge-critical { background: var(--danger-soft); color: var(--danger); }
.badge-high { background: var(--warn-soft); color: var(--warn); }
.badge-medium { background: var(--primary-soft); color: var(--primary); }
.badge-reg { background: rgba(124, 58, 237, 0.14); color: var(--primary); }
.badge-success { background: var(--success-soft); color: var(--success); }

/* Split Grid & KPIs */
.split-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow);
}
.kpi-card .kpi-label { font-size: 11.5px; color: var(--text-muted); }
.kpi-card .kpi-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
/* Clickable Control Tower cards and phase rows */
.kpi-link { display: block; width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi-link:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(0,0,0,.08); transform: translateY(-1px); }
.kpi-link:focus-visible, .phase-row-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.kpi-card .kpi-hint { font-size: 11px; color: var(--primary); margin-top: 6px; opacity: 0; transition: opacity .15s; }
.kpi-link:hover .kpi-hint, .kpi-link:focus-visible .kpi-hint { opacity: 1; }
.phase-row-link { cursor: pointer; border-radius: 8px; padding: 4px 6px; margin: 0 -6px; }
.phase-row-link:hover { background: var(--primary-soft); }
/* Drill-down list */
.drill-card { max-width: 860px; }
.drill-card .modal-body { max-height: 70vh; overflow-y: auto; }
.drill-summary { margin: 0 0 10px; }
.drill-group { margin-bottom: 14px; }
.drill-area { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2, var(--surface)); font: inherit; color: inherit; cursor: pointer; text-align: start; }
.drill-area:hover { border-color: var(--primary); }
.drill-count { font-size: 11px; background: var(--primary-soft); color: var(--primary); border-radius: 999px; padding: 1px 8px; }
.drill-open { margin-inline-start: auto; font-size: 11.5px; color: var(--primary); }
.drill-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-bottom: 1px solid var(--border); background: transparent; font: inherit; color: inherit; cursor: pointer; text-align: start; }
.drill-row:hover { background: var(--primary-soft); }
.drill-id { font-weight: 700; min-width: 44px; }
.drill-action { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-pct { min-width: 40px; text-align: end; font-variant-numeric: tabular-nums; }
.drill-month { min-width: 40px; text-align: end; font-size: 12px; }
.drill-bar { width: 140px; height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.drill-bar span { display: block; height: 100%; background: var(--primary); }
@media (max-width: 640px) { .drill-bar { width: 70px; } .drill-month { display: none; } }

.phase-progress-list { display: flex; flex-direction: column; gap: 10px; }
.phase-row-header { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.progress-track { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.25s; }

.action-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 6px; }
.caution-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: var(--primary-soft); border: 1px solid var(--accent); font-size: 12px;
}

.compact-list { display: flex; flex-direction: column; gap: 8px; }
.compact-item { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; background: var(--surface-alt); }

/* Gantt */
.gantt-wrap { overflow-x: auto; }
.gantt-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.gantt-table th, .gantt-table td { border: 1px solid var(--border); padding: 4px 5px; }
.gantt-table th { background: var(--surface-alt); text-align: center; position: sticky; top: 0; }
.gantt-cell-active { background: var(--primary); }
.gantt-cell-done { background: var(--success); }
/* Gantt: Go / No-Go gate milestones */
.gantt-table th.gantt-gate-month,
.gantt-table td.gantt-gate-month { border-inline-start: 2px dashed var(--accent); }
.gantt-gate-row td { background: var(--surface-alt); vertical-align: middle; }
.gantt-gate-row td.gantt-gate-label { font-weight: 600; color: var(--primary); }
.gantt-gate-cell { text-align: center; padding: 2px !important; }
.gantt-gate-marker {
  display: block; margin: 1px auto; padding: 1px 3px; border: 0; border-radius: 4px;
  font: inherit; font-size: 10px; font-weight: 700; line-height: 1.35; white-space: nowrap;
  color: var(--surface); background: var(--text-muted); cursor: pointer;
}
.gantt-gate-marker.gate-review { background: var(--warn); }
.gantt-gate-marker.gate-approved { background: var(--success); }
.gantt-gate-marker.gate-blocked { background: var(--danger); }
.gantt-gate-marker:hover { filter: brightness(1.1); }
.gantt-gate-marker:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.gantt-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--text-muted); }
.gantt-legend .gantt-gate-marker { display: inline-block; margin: 0; margin-inline-end: 4px; cursor: default; }
.gantt-legend-title { font-weight: 600; color: var(--text); }
.gantt-legend-hint { font-style: italic; }

/* Docs & Web Search */
.paste-doc-box { display: flex; flex-direction: column; gap: 8px; }
.paste-doc-box input, .paste-doc-box textarea, .web-search-row input, .web-search-row select {
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px;
  font-size: 12.5px; font-family: inherit; background: var(--surface); color: var(--text);
}
.web-search-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.web-search-row input { flex: 1; min-width: 180px; }
.upload-label { display: inline-flex; align-items: center; gap: 6px; }

/* Modals */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: grid; place-items: center;
  z-index: 50; padding: 16px;
}
.modal-card {
  background: var(--surface); border-radius: 12px;
  width: 100%; max-width: 640px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}
.modal-header, .modal-footer {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-footer { border-bottom: none; border-top: 1px solid var(--border); justify-content: flex-end; }
.modal-header h3 { margin: 0; font-size: 15px; }
.modal-body { padding: 16px; overflow-y: auto; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-grid input, .form-grid select, .form-grid textarea {
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--surface);
}
select, option { color: var(--text); background: var(--surface); }

.setup-actions-row { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.highlight { background: #fef08a; padding: 0 2px; border-radius: 2px; }

/* Citation Chips & Confidence Dot */
.citation-chips-wrap { display: flex; flex-wrap: wrap; gap: 4px; }
.citation-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(124, 58, 237, 0.25);
  cursor: pointer; white-space: nowrap; font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.citation-chip:hover { background: rgba(124, 58, 237, 0.22); border-color: var(--primary); }
.confidence-dot { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; flex-shrink: 0; display: inline-block; }

/* Citation Side Drawer */
.citation-drawer-backdrop { position: fixed; inset: 0; background: rgba(14, 11, 26, 0.45); z-index: 90; }
.citation-drawer {
  position: fixed; top: 0; bottom: 0; right: 0;
  width: 460px; max-width: 94vw;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18);
  z-index: 100; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.22s ease;
}
.citation-drawer.open { transform: translateX(0); }
.citation-drawer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.citation-drawer-body { padding: 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.citation-meta-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12.5px;
  background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
}
.citation-meta-label { color: var(--text-muted); font-weight: 600; }
.citation-quote-box {
  background: var(--surface-alt); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  border-radius: 8px; padding: 12px 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap;
}
.citation-drawer-footer { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.chunk-snippet {
  margin-top: 4px; font-size: 12.5px; color: var(--text-muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.find-source-panel { grid-column: 1 / -1; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.find-source-results { margin-top: 8px; max-height: 200px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.find-source-option {
  text-align: start; padding: 8px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 12px; font-family: inherit;
}
.find-source-option:hover { border-color: var(--primary); background: var(--primary-soft); }

/* Export Dropdown */
.export-wrap { position: relative; display: inline-block; }
.export-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  z-index: 60; display: flex; flex-direction: column; padding: 4px;
}
.export-menu button {
  background: transparent; border: none; color: var(--text);
  text-align: start; padding: 8px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12.5px; font-family: inherit;
}
.export-menu button:hover { background: var(--primary-soft); color: var(--primary); }
.export-menu-divider { height: 1px; margin: 4px 0; background: var(--border); }

/* ------------------------------------------------------------------ */
/* Dark-mode specifics                                                 */
/* ------------------------------------------------------------------ */
[data-theme="dark"] .opening-rule-box { background: var(--warn-soft); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
[data-theme="dark"] .highlight { background: rgba(167, 139, 250, 0.35); color: #fff; }
[data-theme="dark"] a { color: var(--accent); }

/* ------------------------------------------------------------------ */
/* RTL (Arabic)                                                        */
/* ------------------------------------------------------------------ */
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border); }
[dir="rtl"] .focus-banner { border-left: 1px solid var(--border); border-right: 4px solid var(--primary); }
[dir="rtl"] .ai-answer-card { border-left: 1px solid var(--accent); border-right: 4px solid var(--primary); }
[dir="rtl"] .citation-quote-box { border-left: 1px solid var(--border); border-right: 4px solid var(--primary); }
[dir="rtl"] .export-menu { right: auto; left: 0; }
[dir="rtl"] .citation-drawer {
  right: auto; left: 0; border-left: none; border-right: 1px solid var(--border);
  box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18); transform: translateX(-100%);
}
[dir="rtl"] .citation-drawer.open { transform: translateX(0); }
[dir="rtl"] .focus-nav { flex-direction: row-reverse; }

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 1200px) {
  .subtitle { display: none; }
  .facility-select { max-width: 170px; }
}

@media (max-width: 960px) {
  .main-layout { grid-template-columns: 1fr !important; }
  .sidebar {
    position: fixed; top: var(--topbar-h); bottom: 0; left: 0;
    width: min(86vw, 320px); height: auto;
    z-index: 45;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.18);
  }
  [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(100%); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(14, 11, 26, 0.4); z-index: 44; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  /* collapsed state is a desktop-only concept */
  body.sidebar-collapsed .sidebar-header, body.sidebar-collapsed .nav-label, body.sidebar-collapsed .tab-pill,
  body.sidebar-collapsed .area-search, body.sidebar-collapsed .area-group-title, body.sidebar-collapsed .area-body,
  body.sidebar-collapsed .area-meta, body.sidebar-collapsed .sidebar-footer { display: revert; }
  body.sidebar-collapsed .nav-btn, body.sidebar-collapsed .area-item { justify-content: flex-start; padding: 8px 10px; }
  body.sidebar-collapsed .sidebar-header { display: flex; }
  body.sidebar-collapsed .area-search { display: flex; }
  body.sidebar-collapsed .area-body { display: flex; }

  .topbar { padding: 0 10px; gap: 8px; }
  .topbar-right { gap: 6px; overflow-x: auto; }
  .brand h1 { font-size: 14px; max-width: 42vw; }
  .workspace { padding: 12px 12px 0; }
  .focus-stats { gap: 12px; }
  .section-tab-all { margin-inline-start: 0; }
}

@media (max-width: 600px) {
  .facility-select, .topbar-divider { display: none; }
  .hero-search-bar input[type="text"] { min-width: 160px; }
  .focus-banner h2 { font-size: 15px; }
}

@media print {
  .topbar, .sidebar, .hero-search-wrap, .section-tabs, .toolbar, .breadcrumb { display: none !important; }
  .site-footer { border-top: none; padding-top: 8px; }
  .main-layout { grid-template-columns: 1fr !important; }
  .section-hidden { display: block !important; }
}

/* ===================== Cover page + sign-in (auth.js) ===================== */
html.auth-locked, html.auth-locked body { overflow: hidden; }
.auth-gate {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: opacity 0.35s ease;
}
.auth-gate.leaving { opacity: 0; pointer-events: none; }
.auth-gate[hidden] { display: none; }
.auth-top { display: flex; justify-content: flex-end; padding: 14px 18px; }
.auth-stage {
  flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 8px 16px 48px;
}
.auth-cover { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; transition: gap 0.45s ease; }
.auth-logo { width: 132px; height: 132px; display: block; transition: width 0.45s ease, height 0.45s ease; filter: drop-shadow(0 10px 24px rgba(124, 58, 237, 0.28)); }
.auth-brand { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); transition: font-size 0.45s ease; text-wrap: balance; }
.auth-tagline { margin: 0; font-size: 15px; color: var(--text-muted); }
.auth-gate.ready .auth-logo { width: 72px; height: 72px; }
.auth-gate.ready .auth-brand { font-size: 26px; }
.auth-gate.ready .auth-cover { gap: 8px; }

/* Intro animation: tile pops in, the 9 phase segments appear one by one, the check draws, then the name rises */
.auth-logo .logo-tile { transform-box: fill-box; transform-origin: center; animation: authPop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1.15) both; }
.auth-logo .seg { --final: 0.32; opacity: 0; animation: authSeg 0.3s ease-out forwards; animation-delay: calc(var(--i) * 90ms + 250ms); }
.auth-logo .seg.seg-done { --final: 1; }
.auth-logo .logo-check { stroke-dasharray: 206; stroke-dashoffset: 206; animation: authDraw 0.45s ease-out 1.1s forwards; }
.auth-brand { opacity: 0; transform: translateY(10px); animation: authRise 0.5s ease-out 1.4s forwards; }
.auth-tagline { opacity: 0; transform: translateY(10px); animation: authRise 0.5s ease-out 1.6s forwards; }
@keyframes authPop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes authSeg { from { opacity: 0; } to { opacity: var(--final); } }
@keyframes authDraw { to { stroke-dashoffset: 0; } }
@keyframes authRise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .auth-logo .logo-tile, .auth-logo .seg, .auth-logo .logo-check, .auth-brand, .auth-tagline { animation: none; opacity: 1; transform: none; }
  .auth-logo .seg:not(.seg-done) { opacity: 0.32; }
  .auth-logo .logo-check { stroke-dashoffset: 0; }
  .auth-gate, .auth-logo, .auth-brand, .auth-cover { transition: none; }
}

.auth-card {
  width: 100%; max-width: 420px; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 12px 32px rgba(76, 29, 149, 0.10);
  padding: 24px; animation: authRise 0.4s ease-out both;
}
.auth-card[hidden], .auth-card [hidden] { display: none !important; }
.auth-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-alt); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 18px; }
.auth-tab { min-height: 40px; border: 0; border-radius: 7px; background: transparent; color: var(--text-muted); font: inherit; font-weight: 600; cursor: pointer; }
.auth-tab.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form h2 { margin: 0 0 2px; font-size: 20px; }
.auth-sub { margin: 0 0 10px; font-size: 13.5px; color: var(--text-muted); line-height: 1.5; }
.auth-form label { font-size: 13px; font-weight: 600; margin-top: 6px; }
.auth-form input {
  min-height: 44px; box-sizing: border-box; padding: 10px 12px; font: inherit; font-size: 15px;
  color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
}
.auth-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.auth-form .auth-code { font-size: 26px; font-weight: 700; letter-spacing: 0.5em; text-align: center; padding-inline-start: 0.5em; }
.auth-hint { margin: 0; font-size: 12px; color: var(--text-muted); }
.auth-error { margin: 6px 0 0; font-size: 13px; color: var(--danger); background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; }
.auth-ok { margin: 6px 0 0; font-size: 13px; color: var(--success); background: var(--success-soft); border-radius: 8px; padding: 8px 10px; }
.auth-submit { min-height: 44px; margin-top: 12px; font-size: 15px; justify-content: center; }
.auth-submit[disabled] { opacity: 0.65; cursor: progress; }
.auth-link { align-self: center; min-height: 44px; border: 0; background: none; color: var(--primary); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0 8px; }
.auth-link:hover { text-decoration: underline; }
.auth-link[disabled] { color: var(--text-muted); cursor: default; text-decoration: none; }
.auth-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; }
.auth-user-btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Project Setup: services in scope, hints; hidden-reference note */
.setup-hint { display: block; margin-top: 4px; font-size: 12px; line-height: 1.4; }
.setup-scope { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 12px; margin: 14px 0 0; }
.setup-scope legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.scope-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin-top: 8px; }
@media (max-width: 560px) { .scope-grid { grid-template-columns: minmax(0, 1fr); } }
.scope-item { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 32px; cursor: pointer; }
.scope-item input { width: 16px; height: 16px; accent-color: var(--primary); }
.scope-item.is-off { color: var(--text-muted); cursor: not-allowed; }
.refs-hidden-note { display: inline-block; font-size: 11px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: 999px; padding: 2px 8px; margin: 2px; }
.cloud-status { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.cloud-status.is-error { color: var(--danger); }
.setup-specialty[hidden] { display: none !important; }
.setup-error { display: block; margin-top: 4px; font-size: 12px; color: var(--danger); }
.setup-error[hidden] { display: none; }

/* Risks & obligations: add / edit */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.form-error { margin: 0 20px 8px; font-size: 12.5px; color: var(--danger); }
.form-error[hidden] { display: none; }
.link-btn { background: none; border: 0; padding: 0; margin-top: 4px; font: inherit; font-size: 12px; color: var(--primary); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.rec-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.rec-meta a { color: var(--primary); }
.rec-notes { font-size: 12px; margin-top: 3px; padding: 4px 8px; border-inline-start: 3px solid var(--primary-soft); background: var(--surface-alt); border-radius: 4px; white-space: pre-wrap; }
#recordModal .modal-footer { display: flex; justify-content: space-between; }
#recordModal .modal-footer #deleteRecordBtn[hidden] + #saveRecordBtn { margin-inline-start: auto; }
#recordModal .form-grid textarea { resize: vertical; }
#deleteRecordBtn[hidden] { display: none; }
/* ---- Sidebar fit: all focus areas on one screen ---- */
.sidebar-areas { padding-top: 8px; }
.area-head { gap: 6px; padding: 0 2px 6px; }
.area-head h2 { white-space: nowrap; }
.area-head .area-search { flex: 1; min-width: 0; margin: 0; }
.area-head .badge { white-space: nowrap; font-size: 10.5px; }
.nav-btn { padding: 4px 7px; }
.area-list { gap: 2px; }
.area-group-title { padding: 2px 6px; font-size: 10px; }
.area-item { min-height: 24px; padding: 2px 8px 4px; }
.area-item .area-name { font-size: 12.5px; }
.area-crit { min-width: 16px; height: 16px; font-size: 9.5px; }
.sidebar-footer { padding: 5px 8px; }
/* Shorter laptop screens: navigation becomes one row of icons (names on hover) */
@media (max-height: 880px) and (min-width: 901px) {
  .area-item { min-height: 23px; padding: 2px 8px 3px; }
  .area-bar { bottom: 1px; }
}
@media (max-height: 800px) and (min-width: 901px) {
  .area-item { min-height: 22px; padding: 1px 8px 3px; }
  .area-group-title { padding: 1px 6px; }
  .sidebar-areas { padding-top: 6px; }
  .area-head { padding-bottom: 4px; }
}


/* Page title of the selected view (large, violet) */
.breadcrumb { align-items: center; }
.breadcrumb .crumb-icon { font-size: 20px; color: var(--primary); line-height: 1; }
.breadcrumb .view-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--primary); line-height: 1.2; }
.breadcrumb .crumb-sep { font-size: 20px; color: var(--primary); opacity: 0.45; }
.breadcrumb #crumbArea { font-size: 16px; font-weight: 700; color: var(--text); }
[data-theme="dark"] .breadcrumb .view-title, [data-theme="dark"] .breadcrumb .crumb-icon { color: #c4b5fd; }
@media (max-width: 640px) { .breadcrumb .view-title { font-size: 18px; } .breadcrumb #crumbArea { font-size: 14px; } }
[dir="rtl"] .breadcrumb .crumb-sep { display: inline-block; transform: scaleX(-1); }

/* Sidebar rows: number of steps and red critical badge only (details on hover) */
.area-item { padding-bottom: 3px; }
.area-steps { min-width: 18px; text-align: end; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text-muted); }
.area-item.active .area-steps { color: var(--primary); }

/* Sidebar group headers: violet bars so the three main parts stand out */
.area-group { gap: 1px; }
.area-list { gap: 4px; }
.area-item { min-height: 23px; padding: 2px 8px 3px; }
.area-group-title {
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  color: #fff; padding: 3px 8px; border-radius: 7px;
  font-size: 10.5px; letter-spacing: 0.05em;
  box-shadow: 0 1px 2px rgba(91, 33, 182, 0.25);
}
[dir="rtl"] .area-group-title { background: linear-gradient(270deg, var(--primary), #8b5cf6); }
.area-group-title:hover { color: #fff; filter: brightness(1.08); }
.area-group-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.area-group-chevron { font-size: 10px; }
.area-group-count { background: rgba(255, 255, 255, 0.22); border-radius: 999px; padding: 0 6px; opacity: 1; }
.area-group.is-collapsed .area-group-title { opacity: 0.92; }
@media (max-height: 800px) and (min-width: 901px) { .area-group-title { padding: 2px 8px; } .area-item { min-height: 22px; padding: 1px 8px 3px; } .area-group, .area-group-items { gap: 0; } .area-list { gap: 3px; } }

/* Opening Rule: always shown in full, compact */
.opening-rule-box { padding: 5px 9px; font-size: 11px; line-height: 1.4; }
.opening-rule-box p { margin: 0; }
.opening-rule-box .rule-sep { margin-inline-end: 2px; }
/* Room for the full Opening Rule: rows 1px slimmer on laptop heights */
@media (max-height: 920px) and (min-width: 901px) { .area-item { min-height: 22px; padding: 1px 8px 3px; } }
@media (max-height: 800px) and (min-width: 901px) { .area-item { min-height: 21px; padding: 1px 8px 2px; } .sidebar-areas { padding-top: 4px; } }

/* ---- Navigation tiles: icon + name, always (professional menu) ---- */
.sidebar-nav { padding: 6px 10px 7px; background: linear-gradient(180deg, var(--surface-alt), var(--surface)); }
.nav-list { grid-template-columns: 1fr 1fr; gap: 4px; }
.nav-btn {
  gap: 7px; min-height: 27px; padding: 2px 7px 2px 3px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); box-shadow: 0 1px 1px rgba(17, 12, 34, 0.04);
  font-size: 12px; font-weight: 600; color: var(--text);
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.nav-btn .nav-icon {
  width: 21px; height: 21px; flex-shrink: 0; display: grid; place-items: center;
  border-radius: 6px; background: var(--primary-soft); color: var(--primary);
  font-size: 13px; opacity: 1;
}
.nav-btn:hover { border-color: var(--accent); background: var(--surface); box-shadow: 0 3px 10px rgba(124, 58, 237, 0.12); }
.nav-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-btn.active { background: linear-gradient(135deg, var(--primary), #8b5cf6); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }
.nav-btn.active .nav-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
.nav-btn .tab-pill { margin-inline-start: auto; }
[data-theme="dark"] .nav-btn { background: var(--surface-alt); }
[data-theme="dark"] .nav-btn .nav-icon { color: #c4b5fd; }
[data-theme="dark"] .nav-btn.active .nav-icon { color: #fff; }
/* Shorter laptop screens: same tiles, slightly tighter */
@media (max-height: 880px) and (min-width: 901px) {
  .sidebar-nav { padding: 5px 10px 6px; }
  .nav-list { gap: 3px; }
  .nav-btn { min-height: 25px; }
  .nav-btn .nav-icon { width: 19px; height: 19px; font-size: 11.5px; }
}
/* Icons-only (collapsed) sidebar keeps a single column of icon squares */
body.sidebar-collapsed .nav-btn { border-color: transparent; background: transparent; box-shadow: none; padding: 4px 0; justify-content: center; }
body.sidebar-collapsed .nav-btn.active { background: transparent; box-shadow: none; }
body.sidebar-collapsed .nav-btn.active .nav-icon { background: var(--primary); color: #fff; }
body.sidebar-collapsed .nav-btn .nav-icon { width: 34px; height: 34px; font-size: 16px; }
[dir="rtl"] .nav-btn { padding: 2px 3px 2px 7px; }
.sidebar-areas { padding-top: 6px; }
/* Count as a slim pill at the end of the tile; the name keeps its full width */
.nav-btn { font-size: 11.5px; }
.nav-btn .nav-label { overflow: visible; text-overflow: clip; }
.nav-btn .tab-pill {
  margin-inline-start: auto; min-width: 18px; height: 16px; padding: 0 5px;
  display: inline-grid; place-items: center; border: 0; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); font-size: 9.5px; font-weight: 700; line-height: 1;
}
.nav-btn.active .tab-pill { background: rgba(255, 255, 255, 0.25); color: #fff; }
[data-theme="dark"] .nav-btn .tab-pill { color: #c4b5fd; }
[data-theme="dark"] .nav-btn.active .tab-pill { color: #fff; }
[data-theme="dark"] .nav-btn.active { background: linear-gradient(135deg, var(--primary), #8b5cf6); }
body.sidebar-collapsed .nav-btn .tab-pill { display: none; }

/* Sources: always shown; unverified ones marked with an amber dot */
.source-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.citation-chip.is-unverified { border-style: dashed; }

/* Best-source suggestions */
.toolbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suggest-src-btn { border: 1px dashed var(--accent); background: transparent; color: var(--primary); border-radius: 999px; width: 24px; height: 22px; cursor: pointer; font-size: 12px; line-height: 1; }
.suggest-src-btn:hover { background: var(--primary-soft); }
.suggest-card { max-width: 980px; }
.suggest-card .modal-body { max-height: 68vh; overflow-y: auto; }
.suggest-loading { display: flex; align-items: center; gap: 10px; padding: 18px 4px; color: var(--text-muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.suggest-summary { margin: 0 0 10px; }
.suggest-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1.25fr); gap: 10px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.suggest-row.is-same { opacity: 0.7; }
.suggest-accept { padding-top: 2px; }
.suggest-step { font-size: 12.5px; }
.suggest-current { margin-top: 5px; font-size: 11.5px; }
.src-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--border); color: var(--text-muted); }
.src-tag-new { background: var(--primary-soft); border-color: var(--accent); color: var(--primary); }
.src-pick + .src-pick { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.src-title { font-size: 12px; font-weight: 600; margin-inline-start: 4px; }
.src-why { font-size: 12px; margin-top: 3px; }
.src-text { font-size: 11.5px; margin-top: 2px; }
.drawer-reason { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--primary-soft); font-size: 12.5px; }
.drawer-reason[hidden] { display: none; }
@media (max-width: 700px) { .suggest-row { grid-template-columns: 26px 1fr; } .suggest-new { grid-column: 2; } }

/* Automatic source verification */
.suggest-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.suggest-new .src-pick { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; }
.suggest-evidence { font-size: 11.5px; margin-top: 3px; }
.suggest-progress { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--primary); margin: 0 0 8px; }
.suggest-note { font-size: 12px; margin: 0 0 6px; }
.suggest-legend { font-size: 11.5px; margin: -4px 0 8px; }
.src-origin { font-size: 11px; color: var(--text-muted); }
.src-tag-web { background: rgba(16, 185, 129, 0.12); border-color: rgba(16, 185, 129, 0.45); color: #047857; }
.vbadge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; border: 1px solid transparent; }
.vb-ok { background: rgba(16, 185, 129, 0.12); color: #047857; border-color: rgba(16, 185, 129, 0.4); }
.vb-warn { background: rgba(245, 158, 11, 0.12); color: #b45309; border-color: rgba(245, 158, 11, 0.4); }
.vb-bad { background: rgba(239, 68, 68, 0.1); color: #b91c1c; border-color: rgba(239, 68, 68, 0.35); }
.vb-wait { background: var(--surface-alt); color: var(--text-muted); border-color: var(--border); }
.spinner-xs { width: 11px; height: 11px; border-width: 2px; }
.drawer-auto-msg { font-size: 12px; color: #b45309; margin: 8px 0 0; }
[data-theme="dark"] .vb-ok, [data-theme="dark"] .src-tag-web { color: #6ee7b7; }
[data-theme="dark"] .vb-warn, [data-theme="dark"] .drawer-auto-msg { color: #fcd34d; }
[data-theme="dark"] .vb-bad { color: #fca5a5; }
@media (max-width: 700px) { .suggest-row { grid-template-columns: 1fr; } .suggest-new { grid-column: 1; } }

/* Assistant column and proposals */
.assist-td { min-width: 210px; }
.assist-cell { display: flex; flex-direction: column; gap: 4px; }
.assist-sugg { font-size: 12px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.assist-deliv { font-size: 11px; }
.assist-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.btn-xs { padding: 2px 9px; font-size: 11.5px; border-radius: 999px; }
.assist-card { max-width: 920px; }
.assist-card .modal-body { max-height: 70vh; overflow-y: auto; }
.assist-step { font-size: 13px; margin-bottom: 10px; }
.assist-block { margin: 12px 0; }
.assist-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--primary); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assist-draft { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-alt); white-space: normal; }
.assist-draft h1, .assist-draft h2, .assist-draft h3 { font-size: 14.5px; margin: 10px 0 6px; }
.assist-edit { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; border: 1px solid var(--border); border-radius: 10px; padding: 10px; background: var(--surface); color: var(--text); }
.assist-adjust { display: flex; gap: 8px; margin-top: 10px; }
.assist-adjust input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
/* Assistant suggestions tray (below the steps table) */
.assist-tray { margin-top: 12px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--primary-soft); overflow: hidden; }
.assist-tray.is-open { background: var(--surface); }
.assist-tray-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: none; border: 0; cursor: pointer; color: var(--text); font: inherit; text-align: start; }
.assist-tray-head:hover { background: var(--primary-soft); }
.assist-tray-title { font-weight: 700; font-size: 13px; color: var(--primary); }
.assist-tray-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.assist-tray-sub { font-size: 12px; flex: 1; }
.assist-tray-chev { color: var(--primary); transition: transform .15s; }
.assist-tray.is-open .assist-tray-chev { transform: rotate(180deg); }
.assist-tray-body { padding: 0 14px 10px; }
.assist-tray-hint { font-size: 11.5px; padding-bottom: 6px; }
.assist-gap { border-top: 1px solid var(--border); padding: 6px 0; }
.assist-gap-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.assist-gap-type { flex: none; font-size: 10.5px; }
.assist-gap-text { flex: 1; min-width: 0; background: none; border: 0; padding: 2px 0; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text); text-align: start; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assist-gap-text:hover { color: var(--primary); }
.assist-gap.is-open .assist-gap-text { white-space: normal; }
.assist-gap-btns { display: flex; gap: 6px; flex: none; }
.assist-gap-x { padding: 2px 7px; }
.assist-gap-detail { margin: 6px 0 2px; padding: 8px 10px; border-radius: 8px; background: var(--surface-alt); font-size: 12px; color: var(--text-muted); display: grid; gap: 4px; }
.assist-gap-detail strong { color: var(--text); font-weight: 600; }
@media (max-width: 640px) { .assist-gap-row { flex-wrap: wrap; } .assist-gap-text { white-space: normal; } .assist-tray-sub { display: none; } }

/* Project Setup — bed plan (bed_mix.js) */
.setup-bedmix[hidden] { display: none; }
.bm-set { min-width: 0; } /* fieldsets default to min-content width; let the tables scroll inside */
.bm-set .setup-hint { margin: 0 0 8px; }
.bm-scroll { overflow-x: auto; }
.bm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bm-table th, .bm-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
.bm-table th { font-weight: 600; background: var(--primary-soft); white-space: nowrap; }
.bm-num { text-align: end; white-space: nowrap; }
.bm-in { width: 70px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); }
.bm-sub td { font-weight: 600; background: var(--surface-alt); }
.bm-sub.bm-dev td { color: var(--warn); }
.bm-total td { font-weight: 700; border-top: 2px solid var(--primary); }
.bm-total.bm-bad td { color: var(--danger); }
.bm-warn td { background: var(--warn-soft); }
.bm-basis { font-size: 11.5px; color: var(--text-muted); min-width: 180px; }
.bm-status { margin: 10px 0; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; }
.bm-status-ok { background: var(--success-soft); color: var(--success); }
.bm-status-note { background: var(--warn-soft); color: var(--warn); }
.bm-status-bad { background: var(--danger-soft); color: var(--danger); }
.bm-actions { display: flex; justify-content: flex-end; }
.bm-check { display: flex; gap: 8px; align-items: center; font-size: 12.5px; margin-bottom: 8px; }

/* Workforce — calculated staffing plan (staffing.js) */
.staff-plan-card[hidden] { display: none; }
.staff-plan-card { margin-bottom: 16px; }
.sp-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 12px 0; }
.sp-kpi { background: var(--primary-soft); border-radius: var(--radius); padding: 10px 12px; }
.sp-kpi-v { font-size: 22px; font-weight: 700; color: var(--primary); }
.sp-kpi-l { font-size: 12px; color: var(--text-muted); }
.sp-checks { list-style: none; padding: 0; margin: 0 0 12px; font-size: 12.5px; display: grid; gap: 4px; }
.sp-checks li.ok { color: var(--success); }
.sp-checks li.warn { color: var(--warn); background: var(--warn-soft); padding: 4px 8px; border-radius: 6px; }
.sp-sec { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0; padding: 8px 12px; }
.sp-sec summary { cursor: pointer; }
.sp-table td { vertical-align: top; }
.sp-table .sp-num { text-align: end; font-weight: 600; white-space: nowrap; }
.sp-grp td { font-weight: 600; background: var(--surface-alt); }
.sp-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

/* MOH checks: when they are verified (finding #18) */
.moh-verify-note {
  margin-bottom: 8px; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; line-height: 1.5;
  background: var(--warn-soft); color: var(--text); border-inline-start: 3px solid var(--warn);
}
.badge-moh-verify { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
/* Assistant suggestions that repeat an existing step (finding #19) */
.assist-gap-similar { white-space: nowrap; }
/* Risk register opened from the Control Tower card (finding #21) */
.risk-filter-row td { background: var(--danger-soft); font-weight: 600; }

/* ===================== Footer: developer credit (every page) ===================== */
.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  gap: 4px 8px; margin-top: auto;
  padding: 14px 16px 16px; border-top: 1px solid var(--border);
  font-size: 11.5px; line-height: 1.5; color: var(--text-muted);
  letter-spacing: 0.01em; text-align: center;
}
.site-footer strong { font-weight: 600; color: var(--text); opacity: 0.85; }
.site-footer-sep { opacity: 0.6; }
.app-footer { margin-inline: -22px; margin-top: auto; padding-top: 14px; }
.workspace > .view-panel.active { margin-bottom: 32px; }
.auth-footer { border-top-color: transparent; padding-bottom: 18px; }
@media (max-width: 960px) { .app-footer { margin-inline: -12px; } }
@media (max-width: 480px) { .site-footer-sep { display: none; } .site-footer { flex-direction: column; gap: 2px; } }

/* ---- Navigation (monitoring) panel: its own tinted card, distinct from the focus-area list ---- */
.sidebar-nav {
  margin: 8px 8px 2px; padding: 8px; border-radius: 14px;
  background: linear-gradient(160deg, #faf8ff 0%, #f3efff 100%);
  border: 1px solid #e9e2fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(76, 29, 149, 0.06);
}
.sidebar-nav + .sidebar-section { border-top: 0; }
.sidebar-nav .nav-btn { background: #fff; border-color: #e2d9fb; }
.sidebar-nav .nav-btn:hover { border-color: var(--accent); }
.sidebar-nav .nav-btn.active { background: linear-gradient(135deg, var(--primary), #8b5cf6); border-color: transparent; color: #fff; }
[data-theme="dark"] .sidebar-nav {
  background: linear-gradient(160deg, #241b47 0%, #1c1538 100%);
  border-color: #3b3068; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .sidebar-nav .nav-btn { background: #2c2356; border-color: #3d3270; }
[data-theme="dark"] .sidebar-nav .nav-btn.active { background: linear-gradient(135deg, var(--primary), #8b5cf6); border-color: transparent; }
/* ---- Focus-area panel: the same tinted violet card as the monitoring panel above ---- */
.sidebar-areas {
  margin: 6px 8px 8px; padding: 8px; border-radius: 14px;
  background: linear-gradient(160deg, #faf8ff 0%, #f3efff 100%);
  border: 1px solid #e9e2fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 1px 2px rgba(76, 29, 149, 0.06);
}
.sidebar-areas .area-search { background: #fff; border-color: #e2d9fb; }
.sidebar-areas .area-item:hover { background: rgba(255, 255, 255, 0.7); }
.sidebar-areas .area-item.active { background: #fff; border-color: var(--accent); box-shadow: 0 1px 2px rgba(76, 29, 149, 0.08); }
.sidebar-areas .area-bar { background: rgba(124, 58, 237, 0.16); }
[data-theme="dark"] .sidebar-areas {
  background: linear-gradient(160deg, #241b47 0%, #1c1538 100%);
  border-color: #3b3068; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
[data-theme="dark"] .sidebar-areas .area-search { background: #2c2356; border-color: #3d3270; }
[data-theme="dark"] .sidebar-areas .area-item:hover { background: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .sidebar-areas .area-item.active { background: #2c2356; border-color: var(--accent); box-shadow: none; }
body.sidebar-collapsed .sidebar-areas { margin: 6px 4px 6px; padding: 6px 2px; }
body.sidebar-collapsed .sidebar-nav { margin: 6px 4px 2px; padding: 6px 2px; }
body.sidebar-collapsed .sidebar-nav .nav-btn,
body.sidebar-collapsed .sidebar-nav .nav-btn.active { background: transparent; border-color: transparent; }

/* ---- Top bar: deep violet brand bar; controls switch to light "glass" styles ---- */
.topbar { background: linear-gradient(100deg, #2e1065 0%, #4c1d95 55%, #5b21b6 100%); border-bottom: 1px solid #2e1065; box-shadow: 0 2px 10px rgba(46, 16, 101, 0.25); }
.topbar .brand h1 { color: #fff; }
.topbar .subtitle { color: rgba(255, 255, 255, 0.72); }
.topbar .brand-icon { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25); }
.topbar .icon-btn-round { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.22); color: #fff; }
.topbar .icon-btn-round:hover { background: rgba(255, 255, 255, 0.22); border-color: rgba(255, 255, 255, 0.4); color: #fff; }
.topbar .facility-select { background-color: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.topbar .facility-select option { color: #141124; background: #fff; }
.topbar .btn-secondary { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.25); color: #fff; }
.topbar .btn-secondary:hover { background: rgba(255, 255, 255, 0.22); }
.topbar #exportBtn { background: #fff; color: #5b21b6; border-color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.topbar #exportBtn:hover { background: #f3e8ff; }
.topbar .btn-ghost { color: rgba(255, 255, 255, 0.85); }
.topbar .btn-ghost:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.topbar .cloud-status { color: rgba(255, 255, 255, 0.75); }
.topbar .cloud-status.is-error { color: #fecaca; }
.topbar .topbar-divider { background: rgba(255, 255, 255, 0.25); }
.topbar :focus-visible { outline-color: #fff; }
[data-theme="dark"] .topbar { background: linear-gradient(100deg, #160f30 0%, #241650 55%, #2f1a66 100%); border-bottom-color: #3b3068; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }
[data-theme="dark"] .topbar #exportBtn { background: #ede9fe; color: #4c1d95; border-color: #ede9fe; }

/* Step form: Delete (user-added steps only) on the left, Save on the right */
#taskModal .modal-footer { display: flex; }
#taskModal #saveTaskModalBtn { margin-inline-start: auto; }

/* Obligations added to the baseline after the project started (finding #29) */
.badge-new { background: #ede9fe; border: 1px solid #c4b5fd; color: #5b21b6; font-weight: 700; }
[data-theme="dark"] .badge-new { background: rgba(139, 92, 246, 0.2); border-color: #6d28d9; color: #ddd6fe; }
.notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; padding: 9px 12px; border-radius: 10px; font-size: 12.5px; }
.notice-info { background: var(--primary-soft); border: 1px solid #ddd6fe; color: var(--text); }
[data-theme="dark"] .notice-info { border-color: #3b3068; }
/* Gates: steps not yet completed up to the gate's phase (finding #30) */
.gate-open-steps { margin-bottom: 4px; font-size: 11px; font-weight: 600; color: var(--warn); white-space: nowrap; }

/* ---- Project Setup: MOH licence activity + licensing requirements guide ---- */
.setup-lic-row { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; }
.setup-lic-row > label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.setup-lic-controls { display: flex; gap: 8px; align-items: center; }
.setup-lic-controls select { flex: 1; min-width: 0; }
.setup-lic-controls .btn { white-space: nowrap; }
@media (max-width: 560px) { .setup-lic-controls { flex-direction: column; align-items: stretch; } }

.lic-guide-modal { z-index: 120; }
.lic-guide-card { max-width: 1080px; width: calc(100vw - 32px); }
.lic-guide-card .modal-body { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.lic-tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.lic-tab { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 14px; font: inherit; font-size: 12.5px; cursor: pointer; }
.lic-tab:hover { border-color: var(--accent); }
.lic-tab.active { background: linear-gradient(135deg, var(--primary), #8b5cf6); border-color: transparent; color: #fff; font-weight: 600; }
.lic-guide-body { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.lic-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.lic-controls label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.lic-controls select { min-width: 220px; max-width: 420px; }
.lic-controls .lic-search { flex: 1; min-width: 200px; }
.lic-summary { border: 1px solid #e9e2fc; border-radius: 12px; padding: 10px 12px; background: linear-gradient(160deg, #faf8ff 0%, #f3efff 100%); }
.lic-sum-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.lic-sum-head strong { font-size: 14px; color: var(--primary); margin-inline-end: 4px; }
.lic-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #fff; border: 1px solid #e2d9fb; color: var(--text); }
.lic-chip-current { background: var(--primary); color: #fff; border-color: transparent; font-weight: 600; }
.lic-sum-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px 14px; margin: 0; }
.lic-sum-grid dt { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
.lic-sum-grid dd { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; }
.lic-table-wrap { overflow: auto; max-height: 46vh; border: 1px solid var(--border); border-radius: 10px; }
.lic-table th { position: sticky; top: 0; z-index: 1; }
.lic-table td { vertical-align: top; line-height: 1.45; }
.lic-table .lic-n { color: var(--text-muted); width: 34px; }
.lic-cat { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.lic-src { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.lic-sub { font-size: 11px; }
.lic-row-link { cursor: pointer; }
.lic-row-link:hover td, .lic-row-link:focus td { background: var(--surface-alt); }
.lic-count { margin: 0; font-size: 11.5px; }
.lic-guide-footer { justify-content: space-between; gap: 12px; }
.lic-guide-footer small { flex: 1; }
[data-theme="dark"] .lic-summary { background: linear-gradient(160deg, #241b47 0%, #1c1538 100%); border-color: #3b3068; }
[data-theme="dark"] .lic-chip { background: #2c2356; border-color: #3d3270; }
[data-theme="dark"] .lic-chip-current { background: var(--primary); }
.lic-controls select, .lic-controls input, .setup-lic-controls select {
  border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px;
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--surface);
}
.lic-controls select:focus, .lic-controls input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.setup-lic-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.setup-lic-value { flex: 1; min-width: 0; padding: 7px 10px; border: 1px dashed #d9cefa; border-radius: 7px; background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 600; }
.facility-select optgroup, #setupType optgroup { font-weight: 700; color: var(--text-muted); }
