*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #0077BC; --brand-dark: #004268; --brand-teal: #39D6B2; --brand-teal-dark: #2ab89a;
  --bg: #f6f6fb; --sidebar-bg: #004268; --sidebar-text: #a8c4d8; --sidebar-active: #fff;
  --card: #fff; --border: #e2e6ec; --text: #333; --text-muted: #6b7280;
  --green: #39D6B2; --yellow: #f59e0b; --red: #e53e3e; --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.07);
}
body { font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; background:var(--bg); color:var(--text); height:100vh; overflow:hidden; font-size:14px; }

/* SIDEBAR */
.sidebar { width:230px; background:var(--sidebar-bg); display:flex; flex-direction:column; flex-shrink:0; }
.sidebar-logo { padding:18px 20px 16px; border-bottom:1px solid rgba(255,255,255,.1); display:flex; flex-direction:column; gap:8px; }
.sidebar-logo img { height:32px; width:auto; object-fit:contain; object-position:left; filter:brightness(0) invert(1); }
.sidebar-logo .logo-sub { font-size:10px; color:var(--brand-teal); letter-spacing:1px; text-transform:uppercase; font-weight:600; }
.sidebar nav { flex:1; padding:12px 0; overflow-y:auto; }
.nav-section { padding:8px 16px 4px; font-size:10px; text-transform:uppercase; letter-spacing:.8px; color:rgba(168,196,216,.4); }
.nav-item { display:flex; align-items:center; gap:10px; padding:9px 16px; color:var(--sidebar-text); cursor:pointer; border-left:3px solid transparent; transition:all .15s; font-size:13.5px; }
.nav-item:hover { background:rgba(255,255,255,.05); color:var(--sidebar-active); }
.nav-item.active { background:rgba(57,214,178,.12); color:var(--sidebar-active); border-left-color:var(--brand-teal); }
.nav-item svg { width:16px; height:16px; flex-shrink:0; }
.sidebar-footer { padding:12px 16px 16px; border-top:1px solid rgba(255,255,255,.07); display:flex; flex-direction:column; gap:12px; }
.lang-switcher { display:flex; gap:6px; }
.lang-btn { background:none; border:1px solid rgba(255,255,255,.15); border-radius:4px; cursor:pointer; padding:4px 7px; font-size:16px; line-height:1; transition:all .15s; opacity:.55; }
.lang-btn:hover { opacity:.85; border-color:rgba(255,255,255,.35); }
.lang-btn.active { opacity:1; border-color:var(--brand-teal); background:rgba(57,214,178,.12); }
.user-chip { display:flex; align-items:center; gap:10px; }
.user-avatar { width:30px; height:30px; border-radius:50%; background:var(--brand-teal); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:700; color:#fff; flex-shrink:0; }
.user-name { font-size:12px; color:var(--sidebar-active); font-weight:500; }
.user-role { font-size:11px; color:var(--sidebar-text); }

/* MAIN */
.main { flex:1; display:flex; flex-direction:column; overflow:hidden; }
.topbar { height:56px; background:var(--card); border-bottom:2px solid var(--brand); display:flex; align-items:center; justify-content:space-between; padding:0 24px; flex-shrink:0; }
.topbar-title { font-size:16px; font-weight:700; color:var(--brand-dark); }
.topbar-actions { display:flex; gap:10px; align-items:center; }
/* BREADCRUMB */
.topbar-breadcrumb { display:flex; align-items:center; gap:8px; }
.bc-back { background:none; border:none; cursor:pointer; font-family:inherit; font-size:13px; color:var(--brand); font-weight:600; padding:4px 0; }
.bc-back:hover { opacity:.7; }
.bc-sep { color:var(--text-muted); font-size:14px; }
.bc-current { font-size:14px; font-weight:700; color:var(--brand-dark); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:500px; }
/* PROJECT DETAIL VIEW */
.pd-mid-row { display:grid; grid-template-columns:3fr 2fr; gap:16px; margin-bottom:16px; }
.pd-mid-row > .card { margin-bottom:0; }
#project-detail-map { height:260px; }
.pd-team-row { display:flex; align-items:center; gap:12px; padding:10px 16px; border-bottom:1px solid var(--border); }
.pd-team-row:last-child { border-bottom:none; }
.btn { display:inline-flex; align-items:center; gap:6px; padding:7px 14px; border-radius:var(--radius); font-size:13px; font-weight:500; cursor:pointer; border:none; transition:all .15s; }
.btn-primary { background:var(--brand-teal); color:#fff; font-weight:600; }
.btn-primary:hover { background:var(--brand-teal-dark); }
.btn-secondary { background:var(--bg); color:var(--text); border:1px solid var(--border); }
.btn-secondary:hover { background:#eaedf1; }
.btn-ghost { background:transparent; color:var(--text-muted); border:1px solid var(--border); }
.btn-ghost:hover { background:var(--bg); }
.btn-danger { background:#fee2e2; color:#b91c1c; border:1px solid #fca5a5; }
.btn-danger:hover { background:#fecaca; }
.btn-warning { background:#fef3c7; color:#92400e; border:1px solid #fde68a; }
.btn-warning:hover { background:#fde68a; }
.content { flex:1; overflow-y:auto; padding:24px; }
.content:has(#view-map.active) { padding:0; overflow:hidden; display:flex; flex-direction:column; }

/* VIEWS */
.view { display:none; }
.view.active { display:block; }

/* STATS ROW */
.stats-row { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:16px; }
.stat-card { background:var(--card); border-radius:var(--radius); padding:18px 20px; border:1px solid var(--border); box-shadow:var(--shadow); }
/* DASHBOARD SPLIT ROW */
.dash-row2 { display:grid; grid-template-columns:1fr 360px; gap:16px; margin-bottom:16px; }
.dash-row2 > .card { margin-bottom:0; }
.dash-map-card { display:flex; flex-direction:column; }
#dashboard-map { flex:1; min-height:260px; }
/* DASHBOARD AT-RISK ROW */
.dash-risk-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px; padding:16px; }
.dash-risk-card { background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:12px; display:flex; flex-direction:column; gap:8px; cursor:pointer; transition:box-shadow .15s; }
.dash-risk-card:hover { box-shadow:0 4px 12px rgba(0,0,0,.1); }
.dash-risk-card.over { border-left:3px solid var(--red); }
.dash-risk-card.warn { border-left:3px solid var(--yellow); }
.dash-risk-top { display:flex; align-items:center; gap:10px; }
.dash-risk-name { font-size:12px; font-weight:600; color:var(--brand-dark); line-height:1.2; }
.dash-risk-role { font-size:11px; color:var(--text-muted); margin-top:1px; }
.dash-risk-util-row { display:flex; align-items:center; gap:8px; }
.dash-risk-util-pct { font-size:13px; font-weight:700; min-width:38px; }
.dash-risk-bar-track { flex:1; height:5px; background:#e9ecf0; border-radius:3px; overflow:hidden; }
.dash-risk-bar-fill { height:100%; border-radius:3px; }
.dash-risk-projects { font-size:10px; color:var(--text-muted); }
.stat-label { font-size:12px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; margin-bottom:6px; }
.stat-value { font-size:26px; font-weight:700; line-height:1; }
.stat-delta { font-size:12px; color:var(--text-muted); margin-top:4px; }
.stat-delta.up { color:var(--green); }
.stat-delta.down { color:var(--red); }

/* CARDS & TABLES */
.card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); box-shadow:var(--shadow); overflow:hidden; margin-bottom:16px; }
.card-header { padding:16px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:10px; }
.card-title { font-size:14px; font-weight:600; }
table { width:100%; border-collapse:collapse; }
th { padding:10px 16px; text-align:left; font-size:11.5px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); background:#fafbfc; border-bottom:1px solid var(--border); }
td { padding:12px 16px; border-bottom:1px solid #f0f2f5; font-size:13.5px; vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:#fafbfc; }
.project-name { font-weight:500; color:var(--text); }
.project-id { font-size:11.5px; color:var(--text-muted); margin-top:1px; }

/* BADGES */
.badge { display:inline-flex; align-items:center; padding:3px 9px; border-radius:20px; font-size:11.5px; font-weight:500; }
.badge-green  { background:#d1faf0; color:#0e7a5f; }
.badge-yellow { background:#fef9c3; color:#a16207; }
.badge-red    { background:#fee2e2; color:#b91c1c; }
.badge-blue   { background:#dbeafe; color:#1d4ed8; }
.badge-gray   { background:#f1f5f9; color:#475569; }
.badge-teal   { background:#ccfbf1; color:#0f766e; }
.badge-orange { background:#ffedd5; color:#c2410c; }
.badge-purple { background:#f3e8ff; color:#6b21a8; }

/* PROGRESS BAR */
.progress-wrap { display:flex; align-items:center; gap:8px; }
.progress-bar { flex:1; height:6px; background:#e9ecf0; border-radius:3px; overflow:hidden; min-width:80px; }
.progress-fill { height:100%; border-radius:3px; transition:width .3s; }
.progress-pct { font-size:12px; color:var(--text-muted); width:32px; text-align:right; }

/* TWO TRUTHS */
.afas-banner { display:flex; align-items:center; gap:10px; background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:10px 16px; margin-bottom:14px; box-shadow:var(--shadow); }
.afas-dot { width:8px; height:8px; border-radius:50%; background:var(--green); flex-shrink:0; box-shadow:0 0 0 3px rgba(57,214,178,.2); }
.afas-label { font-size:12px; font-weight:600; color:var(--brand-dark); }
.afas-meta { font-size:11.5px; color:var(--text-muted); }
.afas-source { font-size:11px; font-weight:600; color:#0e7a5f; background:#d1faf0; border-radius:4px; padding:1px 7px; }
.afas-sync-btn { margin-left:auto; display:flex; align-items:center; gap:5px; background:none; border:1px solid var(--border); border-radius:var(--radius); padding:5px 12px; font-size:12px; font-weight:500; color:var(--text-muted); cursor:pointer; transition:all .15s; }
.afas-sync-btn:hover { border-color:var(--brand-teal); color:var(--brand-teal); }
.afas-sync-btn svg { transition:transform .6s; }
.afas-sync-btn.spinning svg { animation:spin .7s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.two-truths-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:16px; }
.truth-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); box-shadow:var(--shadow); padding:20px; }
.truth-label { font-size:11px; text-transform:uppercase; letter-spacing:.6px; color:var(--text-muted); margin-bottom:4px; }
.truth-title { font-size:15px; font-weight:600; margin-bottom:16px; }
.truth-row { display:flex; justify-content:space-between; align-items:center; padding:8px 0; border-bottom:1px solid #f0f2f5; font-size:13px; }
.truth-row:last-child { border-bottom:none; }
.truth-key { color:var(--text-muted); }
.truth-val { font-weight:600; }
.truth-val.over { color:var(--red); }
.truth-val.under { color:var(--green); }
.delta-row { display:flex; align-items:center; gap:6px; padding:10px 16px; border-radius:var(--radius); font-size:13px; font-weight:500; margin-top:12px; }
.delta-row.positive { background:#d1faf0; color:#0e7a5f; }
.delta-row.negative { background:#fee2e2; color:#b91c1c; }
.delta-row.neutral  { background:#f1f5f9; color:#475569; }

/* GANTT */
.gantt-container { overflow-x:auto; }
.gantt-table { width:100%; border-collapse:collapse; min-width:900px; }
.gantt-table th { padding:8px 12px; font-size:11px; background:#fafbfc; border-bottom:1px solid var(--border); color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; }
.gantt-table td { padding:6px 12px; border-bottom:1px solid #f0f2f5; font-size:13px; vertical-align:middle; transition:background .2s; }
.gantt-table tr.scenario-affected td { background:#fff8e1; }
.gantt-table tr.scenario-affected td:first-child::before { content:'⚠️ '; }
.gantt-table tr:hover td { background:#fafbfc; }
.gantt-table tr.scenario-affected:hover td { background:#fef3c7; }
.gantt-header-months { display:flex; }
.gantt-month { flex:1; text-align:center; font-size:11px; color:var(--text-muted); padding:4px 0; border-left:1px solid var(--border); }
.gantt-cell { position:relative; height:36px; }
.gantt-bar { position:absolute; height:22px; top:7px; border-radius:4px; display:flex; align-items:center; padding:0 8px; font-size:11px; font-weight:500; color:#fff; white-space:nowrap; overflow:hidden; transition:opacity .2s; }
.gantt-bar-planned { background:var(--brand); opacity:.8; }
.gantt-bar-actual  { background:var(--brand-teal); }
.gantt-bar-scenario { background:#f59e0b !important; opacity:1 !important; }
.gantt-legend { display:flex; gap:16px; flex-wrap:wrap; }
.gantt-legend-item { display:flex; align-items:center; gap:6px; font-size:12px; color:var(--text-muted); }
.gantt-legend-dot { width:12px; height:12px; border-radius:3px; }

/* GANTT OVERVIEW */
.gantt-overview { padding:0 0 8px; }
.go-header { display:flex; align-items:center; padding:4px 0 2px; border-bottom:2px solid var(--border); margin-bottom:4px; }
.go-name-col { flex:0 0 280px; min-width:0; padding:0 12px; display:flex; align-items:center; gap:8px; cursor:pointer; }
.go-timeline-col { flex:1; position:relative; min-width:0; padding:0 0 0 0; min-height:36px; }
.go-header .go-timeline-col { min-height:24px; }

/* Year tick marks in header */
.go-year-tick { position:absolute; top:0; transform:translateX(-50%); font-size:10px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; white-space:nowrap; padding-top:4px; }
.go-year-tick::before { content:''; position:absolute; top:0; left:50%; width:1px; height:100%; background:var(--border); }

/* Today marker in header */
.go-today-marker { position:absolute; top:0; bottom:0; transform:translateX(-50%); display:flex; flex-direction:column; align-items:center; pointer-events:none; z-index:2; }
.go-today-label { font-size:10px; font-weight:700; color:var(--brand-teal); white-space:nowrap; background:var(--card); padding:2px 4px; border-radius:3px; }
.go-today-marker::after { content:''; flex:1; width:2px; background:var(--brand-teal); opacity:.6; }

/* Today line inside timeline cells */
.go-today-line { position:absolute; top:0; bottom:0; width:1px; background:var(--brand-teal); opacity:.4; pointer-events:none; z-index:1; transform:translateX(-50%); }

/* Project rows */
.go-row { display:flex; align-items:center; border-bottom:1px solid #f0f2f5; transition:background .15s; }
.go-row:hover { background:#fafbfc; }
.go-row.go-row-scenario { background:#fff8e1; }
.go-row.go-row-scenario:hover { background:#fef3c7; }
.go-row .go-name-col { padding:10px 12px; align-items:flex-start; gap:8px; }
.go-row .go-timeline-col { padding:8px 8px 8px 0; cursor:pointer; }

.go-expand-btn { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:11px; padding:2px 4px; line-height:1; border-radius:3px; transition:transform .2s, color .15s; flex-shrink:0; margin-top:3px; }
.go-expand-btn:hover { color:var(--brand); }
.go-expand-btn.expanded { transform:rotate(90deg); color:var(--brand); }

.go-name-info { display:flex; flex-direction:column; gap:3px; min-width:0; }
.go-name-text { font-size:13px; font-weight:500; color:var(--text); line-height:1.3; }
.go-name-meta { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.go-dates { font-size:11px; color:var(--text-muted); }

/* Bars */
.go-bar { position:absolute; height:22px; top:50%; transform:translateY(-50%); border-radius:4px; display:flex; align-items:center; padding:0 8px; min-width:4px; overflow:hidden; transition:opacity .2s; z-index:2; }
.go-bar-label { font-size:11px; font-weight:500; color:#fff; white-space:nowrap; text-overflow:ellipsis; overflow:hidden; }
.go-bar-planned  { background:var(--brand); opacity:.75; }
.go-bar-active   { background:var(--brand-teal); }
.go-bar-overdue  { background:var(--red); }
.go-bar-scenario { background:#f59e0b !important; opacity:1 !important; }

.go-overdue-dot { display:inline-flex; align-items:center; justify-content:center; width:16px; height:16px; background:var(--red); color:#fff; border-radius:50%; font-size:10px; font-weight:700; line-height:1; }

/* Expanded phase rows */
.go-phases-row { background:#f8fafc; border-bottom:2px solid var(--border); }
.go-phase-row { display:flex; align-items:center; border-bottom:1px dashed #e8ecf0; }
.go-phase-row:last-child { border-bottom:none; }
.go-phase-name-col { flex:0 0 280px; padding:6px 12px 6px 44px; }
.go-phase-label { font-size:12px; color:var(--text-muted); }
.go-phase-label.current { font-weight:700; color:var(--brand-teal); }
.go-phase-timeline { flex:1; position:relative; min-height:28px; padding:4px 8px 4px 0; }

.go-phase-bar { position:absolute; height:14px; top:50%; transform:translateY(-50%); border-radius:3px; display:flex; align-items:center; padding:0 6px; min-width:4px; overflow:hidden; z-index:2; }
.go-phase-bar-done   { background:var(--brand); opacity:.5; }
.go-phase-bar-active { background:var(--brand-teal); opacity:.9; }
.go-phase-bar-future { background:#cbd5e1; }

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

/* SCENARIO PLANNER */
.scenario-card { background:var(--card); border-radius:var(--radius); border:1px solid var(--border); box-shadow:var(--shadow); overflow:hidden; margin-top:16px; }
.scenario-header { padding:14px 20px; background:#fafbfc; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; cursor:pointer; user-select:none; }
.scenario-header-title { font-size:13.5px; font-weight:600; display:flex; align-items:center; gap:8px; }
.scenario-toggle-icon { font-size:12px; color:var(--text-muted); transition:transform .2s; }
.scenario-toggle-icon.open { transform:rotate(180deg); }
.scenario-body { padding:20px; display:none; }
.scenario-body.open { display:block; }
.scenario-controls { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.scenario-field { display:flex; flex-direction:column; gap:5px; }
.scenario-field label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px; }
.scenario-field select { padding:8px 12px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; font-family:inherit; color:var(--text); background:var(--card); outline:none; min-width:200px; }
.scenario-field select:focus { border-color:var(--brand); }
.scenario-result { background:#fff8e1; border:1px solid #fde68a; border-left:4px solid #f59e0b; border-radius:var(--radius); padding:16px 20px; }
.scenario-result-title { font-size:13px; font-weight:700; color:#92400e; margin-bottom:12px; display:flex; align-items:center; gap:8px; }
.scenario-kpis { display:flex; gap:24px; margin-bottom:14px; flex-wrap:wrap; }
.scenario-kpi { text-align:center; }
.scenario-kpi-val { font-size:22px; font-weight:700; color:#92400e; }
.scenario-kpi-label { font-size:11px; color:#a16207; text-transform:uppercase; letter-spacing:.4px; }
.scenario-project-list { display:flex; flex-direction:column; gap:6px; }
.scenario-project-row { display:flex; align-items:center; justify-content:space-between; padding:8px 12px; background:#fffbeb; border:1px solid #fde68a; border-radius:var(--radius); font-size:13px; }
.scenario-project-name { font-weight:500; flex:1; }
.scenario-project-impact { display:flex; gap:16px; color:#a16207; font-size:12px; font-weight:500; }

/* RESOURCE FILTERS */
.filter-bar { padding:12px 20px; border-bottom:1px solid var(--border); background:#fafbfc; display:flex; flex-direction:column; gap:10px; }
.filter-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.filter-label { font-size:11px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.5px; min-width:80px; }
.filter-chip { padding:4px 12px; border-radius:20px; font-size:12px; font-weight:500; cursor:pointer; border:1px solid var(--border); background:var(--card); color:var(--text-muted); transition:all .15s; white-space:nowrap; }
.filter-chip:hover { border-color:var(--brand); color:var(--brand); }
.filter-chip.active { background:var(--brand); color:#fff; border-color:var(--brand); }
.filter-chip.active-teal { background:var(--brand-teal); color:#fff; border-color:var(--brand-teal); }
.filter-chip.active-red { background:#fee2e2; color:#b91c1c; border-color:#fca5a5; }

/* RESOURCE CARDS */
.resource-grid { padding:20px; display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.resource-card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); padding:16px; box-shadow:var(--shadow); transition:box-shadow .15s; }
.resource-card:hover { box-shadow:0 4px 12px rgba(0,0,0,.1); }
.resource-card.at-risk { border-color:#fca5a5; background:#fff8f8; }
.resource-card.available { border-color:#a7f3d0; background:#f0fdf9; }
.resource-card-header { display:flex; align-items:flex-start; gap:12px; margin-bottom:12px; }
.resource-avatar { width:40px; height:40px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:14px; font-weight:700; color:#fff; flex-shrink:0; }
.resource-meta { flex:1; }
.resource-name { font-weight:600; font-size:13.5px; line-height:1.2; }
.resource-role { font-size:12px; color:var(--text-muted); margin-top:2px; }
.resource-util-row { display:flex; align-items:center; gap:8px; margin-bottom:10px; }
.resource-util-label { font-size:13px; font-weight:700; min-width:38px; }
.resource-avail { font-size:11.5px; color:var(--text-muted); margin-left:auto; }
.resource-specialties { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:10px; }
.resource-specialty { padding:2px 8px; background:#f1f5f9; color:#475569; border-radius:20px; font-size:11px; font-weight:500; }
.resource-projects { font-size:12px; color:var(--text-muted); display:flex; align-items:center; gap:4px; }
.resource-projects strong { color:var(--brand); }
.no-results { padding:40px 20px; text-align:center; color:var(--text-muted); font-size:13px; }

/* DETAIL PANEL */
.detail-panel { display:none; position:fixed; right:0; top:0; bottom:0; width:440px; background:var(--card); border-left:1px solid var(--border); box-shadow:-4px 0 24px rgba(0,0,0,.1); z-index:100; overflow-y:auto; }
.detail-panel.open { display:block; }
.detail-header { padding:20px 24px; border-bottom:2px solid var(--brand); display:flex; justify-content:space-between; align-items:flex-start; }
.detail-close { cursor:pointer; color:var(--text-muted); font-size:20px; line-height:1; background:none; border:none; }
.detail-body { padding:24px; }
.detail-section { margin-bottom:24px; }
.detail-section-title { font-size:11px; text-transform:uppercase; letter-spacing:.6px; color:var(--brand); margin-bottom:12px; font-weight:600; }
.detail-kv { display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px solid #f0f2f5; font-size:13px; }
.detail-kv:last-child { border-bottom:none; }
.detail-k { color:var(--text-muted); }
.detail-v { font-weight:500; }

/* MODAL */
.modal-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:200; align-items:center; justify-content:center; padding:20px; }
.modal-overlay.open { display:flex; }
.modal { background:var(--card); border-radius:12px; width:520px; max-width:95vw; box-shadow:0 12px 48px rgba(0,0,0,.22); display:flex; flex-direction:column; max-height:90vh; }
.modal-wide { width:740px; }
.modal-header { padding:18px 24px; border-bottom:2px solid var(--brand); display:flex; justify-content:space-between; align-items:center; flex-shrink:0; }
.modal-title { font-size:15px; font-weight:700; color:var(--brand-dark); display:flex; align-items:center; }
.modal-close { cursor:pointer; color:var(--text-muted); font-size:22px; background:none; border:none; line-height:1; padding:0 2px; }
.modal-close:hover { color:var(--text); }
.modal-body { padding:0 24px; overflow-y:auto; flex:1; }
.modal-scroll { padding-top:6px; }
.modal-footer { padding:14px 24px; border-top:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; flex-shrink:0; gap:10px; }
.modal-footer-info { font-size:12px; color:var(--text-muted); font-style:italic; }
.modal-footer-actions { display:flex; gap:10px; }
.form-group { margin-bottom:14px; }
.form-group:last-child { margin-bottom:0; }
label { display:block; font-size:11.5px; font-weight:600; color:var(--text-muted); text-transform:uppercase; letter-spacing:.45px; margin-bottom:5px; }
.field-required { color:var(--red); font-weight:700; }
input,select,textarea { width:100%; padding:8px 11px; border:1px solid var(--border); border-radius:var(--radius); font-size:13.5px; font-family:inherit; color:var(--text); background:var(--card); outline:none; transition:border-color .15s, box-shadow .15s; box-sizing:border-box; }
input:focus,select:focus,textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,119,188,.1); }
input.input-lg { font-size:14.5px; padding:10px 12px; font-weight:500; }
textarea { resize:vertical; line-height:1.5; }
select { appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 10px center; padding-right:30px; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.form-section { padding:18px 0 6px; border-bottom:1px solid var(--border); }
.form-section-last { border-bottom:none; padding-bottom:20px; }
.form-section-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.08em; color:var(--brand); margin-bottom:14px; display:flex; align-items:center; gap:6px; }
.form-section-title::after { content:''; flex:1; height:1px; background:var(--border); }

/* MOCK BANNER */
.mock-banner { background:#fff8e1; border:1px solid #ffe082; border-left:4px solid var(--yellow); border-radius:var(--radius); padding:10px 14px; font-size:12.5px; color:#7a5800; margin-bottom:16px; display:flex; align-items:center; gap:8px; }

/* MAP VIEW */
#view-map { display:none; flex-direction:column; height:100%; }
#view-map.active { display:flex; }
.map-toolbar { padding:10px 16px; background:var(--card); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:8px; flex-shrink:0; flex-wrap:wrap; }
.map-legend { display:flex; gap:14px; margin-left:auto; align-items:center; }
.map-legend-item { display:flex; align-items:center; gap:5px; font-size:12px; color:var(--text-muted); }
.map-legend-dot { width:11px; height:11px; border-radius:50%; border:2px solid rgba(0,0,0,.15); }
.map-body { display:flex; flex:1; min-height:0; overflow:hidden; }
#map { flex:1; min-height:0; }
.leaflet-popup-content-wrapper { border-radius:8px !important; box-shadow:0 4px 20px rgba(0,0,0,.15) !important; border:1px solid var(--border); padding:0 !important; overflow:hidden; }
.leaflet-popup-content { margin:0 !important; width:260px !important; }
.map-popup { padding:14px 16px; }
.map-popup-title { font-weight:700; font-size:13px; color:var(--brand-dark); line-height:1.3; margin-bottom:6px; }
.map-popup-meta { font-size:12px; color:var(--text-muted); margin-bottom:8px; display:flex; flex-direction:column; gap:3px; }
.map-popup-footer { display:flex; align-items:center; justify-content:space-between; padding-top:8px; border-top:1px solid var(--border); }
.map-popup-btn { background:var(--brand-teal); color:#fff; border:none; border-radius:4px; padding:5px 10px; font-size:12px; font-weight:600; cursor:pointer; font-family:inherit; }
.map-popup-btn:hover { background:var(--brand-teal-dark); }
/* map sidebar */
.map-sidebar { width:300px; flex-shrink:0; display:flex; flex-direction:column; background:var(--card); border-left:1px solid var(--border); overflow:hidden; }
.map-sidebar-hd { padding:10px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.map-sidebar-hd-title { font-weight:700; font-size:13px; color:var(--brand-dark); }
.map-sidebar-count { font-size:11px; color:var(--text-muted); background:#f1f5f9; padding:2px 8px; border-radius:10px; font-weight:600; }
.map-sidebar-list { overflow-y:auto; flex:1; }
.map-acc-item { border-bottom:1px solid var(--border); }
.map-acc-hd { padding:10px 14px; cursor:pointer; transition:background .15s; user-select:none; border-left:3px solid transparent; }
.map-acc-hd:hover { background:#f6f6fb; }
.map-acc-hd.open { background:#eef6fd; border-left-color:var(--brand); }
.map-acc-row1 { display:flex; align-items:flex-start; gap:6px; margin-bottom:6px; }
.map-acc-id { font-size:10px; color:var(--text-muted); font-weight:700; flex-shrink:0; padding-top:2px; letter-spacing:.3px; }
.map-acc-name { font-size:12px; font-weight:600; color:var(--brand-dark); line-height:1.35; flex:1; }
.map-acc-chevron { font-size:10px; color:var(--text-muted); flex-shrink:0; transition:transform .2s; padding-top:2px; }
.map-acc-hd.open .map-acc-chevron { transform:rotate(180deg); }
.map-acc-row2 { display:flex; align-items:center; gap:8px; }
.map-acc-prog-track { flex:1; height:4px; background:#e9ecf0; border-radius:2px; overflow:hidden; }
.map-acc-prog-fill { height:100%; border-radius:2px; transition:width .3s; }
.map-acc-prog-pct { font-size:10px; color:var(--text-muted); flex-shrink:0; min-width:26px; text-align:right; }
.map-acc-body { display:none; padding:8px 14px 12px; background:#fafbfc; border-top:1px solid var(--border); }
.map-acc-body.open { display:block; }
.map-acc-kv { display:grid; grid-template-columns:auto 1fr; gap:4px 10px; font-size:11px; margin-bottom:10px; }
.map-acc-kv dt { color:var(--text-muted); margin:0; }
.map-acc-kv dd { color:var(--text-body); font-weight:500; margin:0; }
.map-acc-variance { font-weight:600; }
.map-acc-variance.over { color:#e53e3e; }
.map-acc-variance.under { color:#0e7a5f; }
.map-acc-open-btn { display:block; width:100%; padding:5px 8px; background:var(--brand-teal); color:#fff; border:none; border-radius:4px; font-size:11px; font-weight:600; cursor:pointer; font-family:inherit; text-align:center; }
.map-acc-open-btn:hover { opacity:.88; }

/* TOAST */
.toast { position:fixed; bottom:24px; right:24px; background:var(--brand-dark); color:#fff; padding:12px 18px; border-radius:var(--radius); font-size:13px; box-shadow:0 4px 16px rgba(0,0,0,.2); z-index:999; opacity:0; transform:translateY(8px); transition:all .25s; pointer-events:none; }
.toast.show { opacity:1; transform:translateY(0); }

/* AUTH GATE */
.auth-gate { position:fixed; inset:0; background:linear-gradient(135deg, var(--brand-dark) 0%, #002a44 100%); display:flex; align-items:center; justify-content:center; z-index:1000; padding:24px; }
.auth-card { background:#fff; border-radius:14px; padding:40px 44px; width:100%; max-width:400px; box-shadow:0 24px 64px rgba(0,0,0,.35); text-align:center; }
.auth-logo { width:180px; margin-bottom:10px; filter:none; }
.auth-subtitle { font-size:13px; color:var(--text-muted); margin-bottom:28px; font-weight:500; letter-spacing:.02em; }
.auth-form { text-align:left; }
.auth-form .form-group { margin-bottom:16px; }
.auth-submit { width:100%; justify-content:center; padding:11px; font-size:14px; margin-top:8px; }
.auth-error { background:#fee2e2; color:#b91c1c; border:1px solid #fca5a5; border-radius:var(--radius); padding:9px 12px; font-size:12.5px; margin-bottom:12px; text-align:left; }
.auth-brand { font-size:11px; color:var(--text-muted); margin-top:22px; }

/* SIDEBAR LOGOUT BUTTON */
.logout-btn { background:none; border:none; cursor:pointer; color:var(--text-muted); padding:4px; border-radius:4px; display:flex; align-items:center; flex-shrink:0; }
.logout-btn:hover { color:var(--red); background:rgba(229,62,62,.08); }
#app-shell { display:flex; height:100vh; width:100vw; overflow:hidden; }

/* ADMIN VIEW */
.admin-header { display:flex; justify-content:space-between; align-items:flex-start; margin-bottom:16px; }
.page-section-title { font-size:18px; font-weight:700; color:var(--text); }
.page-section-sub { font-size:13px; color:var(--text-muted); margin-top:2px; }
.card-inner { padding:20px; }
.user-email-cell { font-size:12.5px; color:var(--text-muted); }
.badge-blue { background:#dbeafe; color:#1e40af; }
.btn-xs { padding:4px 10px; font-size:11.5px; }
.password-reveal { background:#f0fdf4; border:1px solid #86efac; border-radius:var(--radius); padding:14px 16px; margin-top:12px; }
.password-reveal-label { font-size:12px; color:#166534; font-weight:500; margin-bottom:8px; }
.password-reveal-value { display:flex; align-items:center; gap:10px; }
.password-reveal-value code { background:#dcfce7; padding:6px 12px; border-radius:4px; font-size:15px; font-weight:700; color:#15803d; letter-spacing:.05em; flex:1; font-family:monospace; }
.password-reveal-note { font-size:11px; color:#166534; margin-top:8px; opacity:.8; }

/* PROJECT FORM PAGE */
#view-project-form { display:none; }
#view-project-form.active { display:block; }
.pf-page { display:flex; flex-direction:column; height:100%; }
.pf-page-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:24px; gap:16px; flex-wrap:wrap; }
.pf-page-header-left { display:flex; align-items:center; gap:14px; }
.pf-page-title { font-size:20px; font-weight:700; color:var(--brand-dark); margin:0; }
.pf-page-header-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.pf-form-body { flex:1; overflow-y:auto; }
.bc-edit-action { display:none; }

/* ── Phase form grid ─────────────────────────────────────────────────────── */
.pf-phases-grid { width:100%; }
.pf-phases-header { display:grid; grid-template-columns:130px 1fr 1fr 2fr; gap:8px; padding:0 0 6px; border-bottom:1px solid var(--border); margin-bottom:8px; }
.pf-phases-col-name,.pf-phases-col-date,.pf-phases-col-req { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); }
.pf-phase-row { display:grid; grid-template-columns:130px 1fr 1fr 2fr; gap:8px; align-items:start; padding:8px 0; border-bottom:1px dashed #edf0f4; }
.pf-phase-row:last-child { border-bottom:none; }
.pf-phase-name { font-size:13px; font-weight:600; color:var(--brand-dark); padding-top:7px; }
.pf-phase-date { width:100%; font-size:13px; }
.pf-phase-req { width:100%; font-size:12px; resize:vertical; min-height:48px; }

/* ── NOTES & DOCUMENTS ───────────────────────────────────────────────────── */
.btn-sm { padding:5px 12px; font-size:12px; }
.note-textarea { width:100%; padding:8px 11px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; font-family:inherit; color:var(--text); background:var(--card); outline:none; transition:border-color .15s, box-shadow .15s; box-sizing:border-box; resize:vertical; line-height:1.5; }
.note-textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,119,188,.1); }
.note-edit-textarea { width:100%; padding:8px 11px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; font-family:inherit; color:var(--text); background:var(--card); outline:none; transition:border-color .15s; box-sizing:border-box; resize:vertical; line-height:1.5; }
.note-edit-textarea:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,119,188,.1); }

.add-note-form { margin-bottom:16px; }
.notes-empty { font-size:13px; color:var(--text-muted); padding:8px 0; }

.notes-list { display:flex; flex-direction:column; gap:0; }
.note-item { display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid #f0f2f5; }
.note-item:last-child { border-bottom:none; }
.note-content-wrap { flex:1; min-width:0; }
.note-content { font-size:13.5px; color:var(--text); line-height:1.55; white-space:pre-wrap; word-break:break-word; }
.note-meta { font-size:11.5px; color:var(--text-muted); margin-top:5px; }
.note-actions { display:flex; gap:4px; flex-shrink:0; margin-top:2px; }
.note-action-btn { background:none; border:1px solid transparent; border-radius:4px; cursor:pointer; padding:5px 6px; color:var(--text-muted); display:flex; align-items:center; transition:all .15s; }
.note-action-btn:hover { border-color:var(--border); color:var(--brand); background:#f6f8fa; }
.note-action-delete:hover { color:var(--red); border-color:#fca5a5; background:#fff5f5; }

/* Documents */
.add-doc-form { margin-bottom:16px; }
.add-doc-row { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:center; }
.add-doc-input { padding:8px 11px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; font-family:inherit; color:var(--text); background:var(--card); outline:none; transition:border-color .15s; box-sizing:border-box; width:100%; }
.add-doc-input:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,119,188,.1); }
.add-doc-select { padding:8px 30px 8px 11px; border:1px solid var(--border); border-radius:var(--radius); font-size:13px; font-family:inherit; color:var(--text); background:var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; outline:none; appearance:none; transition:border-color .15s; cursor:pointer; }
.add-doc-select:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(0,119,188,.1); }

.docs-list { display:flex; flex-direction:column; gap:0; }
.doc-item { display:flex; align-items:flex-start; gap:12px; padding:12px 0; border-bottom:1px solid #f0f2f5; }
.doc-item:last-child { border-bottom:none; }
.doc-main { flex:1; min-width:0; }
.doc-title-row { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:4px; }
.doc-title { font-size:13.5px; font-weight:600; color:var(--text); }
.doc-description { font-size:13px; color:var(--text-muted); margin-bottom:4px; line-height:1.5; }
.doc-meta { font-size:11.5px; color:var(--text-muted); margin-top:4px; }
