/* ─────────────────────────────────────────────────────────────────────────────
   AEDH Transformation Tracker — Stylesheet
   Design: Modern Strategic Dashboard | Deep Indigo sidebar, warm off-white content
   ───────────────────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-bg:     #0f172a;
    --sidebar-border: rgba(255,255,255,0.08);
    --sidebar-text:   rgba(255,255,255,0.7);
    --sidebar-active: rgba(255,255,255,0.12);
    --accent:         #f59e0b;
    --accent-dark:    #d97706;
    --bg:             #f8f7f4;
    --surface:        #ffffff;
    --border:         #e5e3de;
    --text:           #1c1917;
    --text-muted:     #78716c;
    --success:        #10b981;
    --warning:        #f59e0b;
    --danger:         #ef4444;
    --info:           #3b82f6;
    --radius:         0.75rem;
    --shadow:         0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:      0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
}

body {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

/* ── App Shell ────────────────────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: 256px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--sidebar-border);
}
.logo-mark {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900; color: #0f172a;
    flex-shrink: 0;
}
.logo-mark.large { width: 56px; height: 56px; font-size: 22px; border-radius: 14px; }
.logo-brand { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; }
.logo-sub   { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px; font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.nav-item:hover  { background: var(--sidebar-active); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item.active::before { content: ''; width: 3px; height: 16px; background: var(--accent); border-radius: 2px; margin-right: 8px; }

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--sidebar-border);
}
.footer-sub  { font-size: 10px; color: rgba(255,255,255,0.3); text-transform: uppercase; letter-spacing: 0.1em; }
.footer-desc { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }

/* ── Edit Controls ────────────────────────────────────────────────────────── */
.edit-controls {
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column; gap: 6px;
}
.edit-active-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 10px;
    background: rgba(245,158,11,0.15);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 6px;
    font-size: 10px; font-weight: 700; color: var(--accent);
}
.btn-unlock, .btn-edit-toggle {
    width: 100%; padding: 8px 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    color: var(--sidebar-text); font-size: 12px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
    text-align: left;
}
.btn-unlock:hover, .btn-edit-toggle:hover { background: rgba(255,255,255,0.12); color: #fff; }
.edit-actions { display: flex; gap: 6px; }
.btn-sm {
    flex: 1; padding: 6px 8px;
    border-radius: 6px; font-size: 10px; font-weight: 700;
    cursor: pointer; border: none; transition: background 0.15s;
}
.btn-reset { background: rgba(239,68,68,0.15); color: #fca5a5; }
.btn-reset:hover { background: rgba(239,68,68,0.25); }
.btn-lock  { background: rgba(255,255,255,0.08); color: var(--sidebar-text); }
.btn-lock:hover { background: rgba(255,255,255,0.15); }

/* ── Mobile Sidebar Toggle ────────────────────────────────────────────────── */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1001;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-md);
}
.mobile-menu-toggle:hover { background: #1e293b; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-overlay.active { display: block; opacity: 1; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; }
.page-content { padding: 40px 48px; max-width: 1100px; }
.page-header  { margin-bottom: 32px; position: relative; }
.page-eyebrow { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; margin-bottom: 8px; }
.page-content h1 { font-size: 32px; font-weight: 800; color: var(--text); line-height: 1.2; }
.page-intro { margin-top: 12px; font-size: 14px; color: var(--text-muted); max-width: 760px; line-height: 1.7; }
.section { margin-top: 40px; }
.section h2 { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }

/* ── Progress Card ────────────────────────────────────────────────────────── */
.progress-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    margin-bottom: 8px;
}
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.progress-pct { font-size: 20px; font-weight: 800; color: var(--success); }
.progress-bar-track { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.progress-bar-fill  { height: 100%; background: linear-gradient(90deg, var(--success), #34d399); border-radius: 99px; transition: width 0.6s ease; }
.progress-stats { display: flex; gap: 20px; margin-top: 10px; font-size: 11px; font-weight: 600; }
.stat-complete { color: var(--success); }
.stat-progress { color: var(--warning); }
.stat-risk     { color: var(--danger); }
.stat-total    { color: var(--text-muted); }

/* ── Entity Grid ──────────────────────────────────────────────────────────── */
.entity-grid { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.entity-card {
    flex: 1; min-width: 220px;
    border-radius: var(--radius);
    padding: 20px;
    border: 2px solid var(--border);
    background: var(--surface);
}
.entity-card.current { border-color: #cbd5e1; }
.entity-card.aedh    { border-color: #818cf8; background: #eef2ff; }
.entity-card.success { border-color: #34d399; background: #ecfdf5; }
.entity-label { font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-muted); margin-bottom: 6px; }
.entity-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.entity-card ul { list-style: none; font-size: 12px; color: var(--text-muted); }
.entity-card ul li::before { content: '+ '; color: var(--success); font-weight: 700; }
.entity-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.entity-table td { padding: 3px 0; vertical-align: top; }
.entity-table td:first-child { color: var(--text-muted); width: 80px; font-weight: 600; }
.entity-arrow { text-align: center; font-size: 24px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.entity-arrow small { display: block; font-size: 9px; font-weight: 800; letter-spacing: 0.1em; color: var(--accent); }

/* ── Rules Grid ───────────────────────────────────────────────────────────── */
.rules-grid { display: flex; flex-direction: column; gap: 10px; }
.rule-card {
    display: flex; align-items: flex-start; gap: 14px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 18px;
    box-shadow: var(--shadow);
}
.rule-icon  { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.rule-title { font-size: 13px; font-weight: 700; color: var(--text); }
.rule-desc  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal-box {
    background: var(--surface);
    border-radius: calc(var(--radius) * 1.5);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%; max-width: 420px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.modal-header {
    background: var(--sidebar-bg);
    padding: 20px 24px;
    display: flex; align-items: center; gap: 14px;
    flex-shrink: 0;
}
.modal-icon { font-size: 22px; }
.modal-header h2 { font-size: 15px; font-weight: 700; color: #fff; }
.modal-header p  { font-size: 11px; color: rgba(255,255,255,0.5); }
.modal-close {
    margin-left: auto; background: none; border: none;
    color: rgba(255,255,255,0.5); font-size: 20px; cursor: pointer;
    line-height: 1;
}
.modal-close:hover { color: #fff; }
.modal-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; min-height: 0; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.form-group input, .form-group textarea, .form-group select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--info); }
.form-error { font-size: 11px; color: var(--danger); font-weight: 600; }
.form-hint  { font-size: 11px; color: var(--text-muted); background: var(--bg); border-radius: 8px; padding: 10px 12px; line-height: 1.6; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-primary {
    padding: 10px 20px;
    background: var(--sidebar-bg);
    color: #fff;
    border: none; border-radius: 8px;
    font-size: 13px; font-weight: 700;
    cursor: pointer; transition: background 0.15s, transform 0.1s;
    text-decoration: none; display: inline-block;
}
.btn-primary:hover   { background: #1e293b; }
.btn-primary:active  { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.full-width { width: 100%; text-align: center; }

/* ── Login Page ───────────────────────────────────────────────────────────── */
.login-page {
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    background: var(--sidebar-bg); padding: 24px;
}
.login-card {
    background: var(--surface);
    border-radius: calc(var(--radius) * 2);
    padding: 40px;
    width: 100%; max-width: 400px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; gap: 24px;
}
.login-logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.login-logo h1 { font-size: 18px; font-weight: 800; }
.login-logo p  { font-size: 13px; color: var(--text-muted); }
.login-back { text-align: center; font-size: 12px; }
.login-back a { color: var(--text-muted); text-decoration: none; }
.login-back a:hover { color: var(--text); }

/* ── Edit Mode Indicator ──────────────────────────────────────────────────── */
body.edit-mode-active { outline: 3px solid rgba(245,158,11,0.4); outline-offset: -3px; }
.edit-only { display: none; }

/* Kept below .edit-only on purpose: this class also sets its own `display`
   (flex, for icon centering), and CSS cascade order breaks ties by source
   order when specificity is equal — so this must come after .edit-only to
   win once edit mode clears the inline override. Same reason .icon-btn
   below works; a copy placed above .edit-only would stay hidden forever. */
.btn-icon-edit {
    position: absolute; top: 0; right: 0;
    width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    font-size: 15px; cursor: pointer; box-shadow: var(--shadow);
}
.btn-icon-edit:hover { background: var(--bg); border-color: var(--accent); }

/* Also kept below .edit-only for the same cascade-order reason as
   .btn-icon-edit above (this class sets its own `display` too). */
.week-edit-btn {
    position: absolute; top: 1px; right: 1px;
    width: 15px; height: 15px; display: flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 4px;
    font-size: 8px; line-height: 1; cursor: pointer; padding: 0;
}
.week-edit-btn:hover { background: var(--bg); border-color: var(--accent); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { padding: 10px 14px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); border-bottom: 2px solid var(--border); }
table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data-table tr:hover td { background: var(--bg); }

/* ── Status Badges ────────────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.badge-not-started { background: #f1f5f9; color: #64748b; }
.badge-in-progress { background: #fef3c7; color: #92400e; }
.badge-complete    { background: #d1fae5; color: #065f46; }
.badge-at-risk     { background: #fee2e2; color: #991b1b; }

/* ── Risk Level Badges ────────────────────────────────────────────────────── */
.badge-low     { background: #d1fae5; color: #065f46; }
.badge-medium  { background: #fef3c7; color: #92400e; }
.badge-high    { background: #ffedd5; color: #9a3412; }
.badge-severe  { background: #fee2e2; color: #991b1b; }

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
.page-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
    padding: 6px 14px; border-radius: 99px; font-size: 12px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-muted);
    cursor: pointer; transition: all 0.15s; user-select: none;
}
.chip:hover { border-color: var(--text-muted); color: var(--text); }
.chip.active { background: var(--sidebar-bg); border-color: var(--sidebar-bg); color: #fff; }

/* ── Small Action Buttons (inline CRUD) ──────────────────────────────────── */
.btn-secondary {
    padding: 9px 16px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
    padding: 9px 16px; background: #fef2f2; color: var(--danger);
    border: 1px solid #fecaca; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.btn-danger:hover { background: #fee2e2; }
.icon-btn {
    background: none; border: none; cursor: pointer; font-size: 14px;
    padding: 4px 6px; border-radius: 6px; color: var(--text-muted); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { background: #fee2e2; color: var(--danger); }
.row-actions { display: flex; gap: 2px; align-items: center; white-space: nowrap; }

/* ── Inline Editable Cells (edit mode) ───────────────────────────────────── */
.inline-select, .inline-text {
    padding: 5px 8px; border-radius: 6px; border: 1px solid transparent;
    font-size: 12px; font-family: inherit; background: transparent; color: var(--text);
}
.edit-mode-active .inline-select, .edit-mode-active .inline-text {
    border-color: var(--border); background: var(--surface); cursor: pointer;
}
.inline-owner { width: 120px; }

/* ── Week Bar (timeline visual) ───────────────────────────────────────────── */
.week-bar-track { position: relative; height: 18px; background: var(--bg); border-radius: 4px; width: 160px; }
.week-bar-fill { position: absolute; top: 0; height: 100%; border-radius: 4px; background: var(--accent); opacity: 0.85; }
.week-bar-label { font-size: 10px; color: var(--text-muted); margin-top: 3px; }

/* ── Risk Cards ───────────────────────────────────────────────────────────── */
.risk-grid { display: flex; flex-direction: column; gap: 14px; }
.risk-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px 20px; box-shadow: var(--shadow);
}
.risk-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.risk-card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.risk-card-id { font-size: 10px; color: var(--text-muted); font-weight: 700; }
.risk-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.6; }
.risk-meta-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 12px; }
.risk-meta-item label { display: block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin-bottom: 4px; }
.risk-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.risk-detail-grid h4 { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 4px; }
.risk-detail-grid p { font-size: 12px; color: var(--text); line-height: 1.6; }
@media (max-width: 700px) { .risk-detail-grid { grid-template-columns: 1fr; } }

/* ── Empty State ──────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); font-size: 13px; }

/* ── Category grouping (Execution page) ──────────────────────────────────── */
.category-group { margin-bottom: 28px; }
.category-group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.category-group-count { font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--bg); padding: 2px 8px; border-radius: 99px; }
.task-item {
    display: flex; align-items: flex-start; gap: 14px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px;
}
.task-item-main { flex: 1; min-width: 0; }
.task-item-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.task-item-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 6px; }
.task-item-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--text-muted); align-items: center; }

/* ── Modal wide variant (for full edit forms) ────────────────────────────── */
.modal-box.wide { max-width: 560px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
textarea.form-control-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    outline: none;
    min-height: 80px;
    resize: vertical;
    transition: border-color 0.15s;
}
textarea.form-control-textarea:focus { border-color: var(--info); }

/* ── New Risk-Level Badges (matrix-based) ────────────────────────────────── */
.badge-negligible { background: #d1fae5; color: #065f46; }
.badge-moderate    { background: #fef3c7; color: #92400e; }
.badge-critical    { background: #fecdd3; color: #881337; }

/* ── New Task Status: Stopped ─────────────────────────────────────────────── */
.badge-stopped { background: #fee2e2; color: #991b1b; }

/* ── Stat Cards (Overview: Stakeholder Snapshot) ─────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow); text-align: center;
}
.stat-card .stat-icon { font-size: 20px; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat-card .stat-label { font-size: 11px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-card .stat-desc { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* ── Objective Cards (Overview) ───────────────────────────────────────────── */
.objective-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 24px; }
.objective-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; }
.objective-card .obj-icon { font-size: 22px; margin-bottom: 8px; }
.objective-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.objective-card p { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ── Rule Cards (Overview: Critical Non-Negotiable Rules) ────────────────── */
.rule-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.rule-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rule-card .rule-text h4 { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.rule-card .rule-text p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.rule-card.color-red        { border-left-color: #ef4444; }
.rule-card.color-orange     { border-left-color: #f59e0b; }
.rule-card.color-indigo     { border-left-color: #6366f1; }
.rule-card.color-green      { border-left-color: #10b981; }
.rule-card.color-violet     { border-left-color: #8b5cf6; }

/* ── Roadmap Cards (Overview: 8-Week Roadmap at a Glance) ─────────────────── */
.roadmap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.roadmap-card { border-radius: var(--radius); padding: 16px; color: #fff; }
.roadmap-card .roadmap-eyebrow { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.85; margin-bottom: 4px; }
.roadmap-card h4 { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.roadmap-card ul { list-style: none; padding: 0; margin: 0; font-size: 11.5px; }
.roadmap-card li { padding: 3px 0; opacity: 0.95; }
.roadmap-card li::before { content: '• '; }
.roadmap-card.color-indigo { background: linear-gradient(135deg,#6366f1,#4f46e5); }
.roadmap-card.color-violet { background: linear-gradient(135deg,#8b5cf6,#7c3aed); }
.roadmap-card.color-orange { background: linear-gradient(135deg,#f59e0b,#d97706); }
.roadmap-card.color-green  { background: linear-gradient(135deg,#10b981,#059669); }
.roadmap-card.color-red    { background: linear-gradient(135deg,#ef4444,#dc2626); }
.roadmap-card.color-slate  { background: linear-gradient(135deg,#64748b,#475569); }
.roadmap-card.color-blue   { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.roadmap-card.color-amber  { background: linear-gradient(135deg,#f59e0b,#b45309); }

/* ── Entity Comparison Cards (Overview) ────────────────────────────────────── */
.entity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: stretch; margin-bottom: 24px; }
.entity-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); position: relative; }
.entity-card .entity-badge { display: inline-block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 99px; margin-bottom: 8px; }
.entity-card h4 { font-size: 15px; font-weight: 800; margin-bottom: 12px; }
.entity-card .fact-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 5px 0; border-top: 1px solid var(--border); }
.entity-card .fact-row:first-of-type { border-top: none; }
.entity-card .fact-label { color: var(--text-muted); flex-shrink: 0; }
.entity-card .fact-value { color: var(--text); font-weight: 600; text-align: right; }
.entity-card .fact-bullet { font-size: 12px; padding: 4px 0; color: var(--text); }
.entity-badge.color-slate { background: #f1f5f9; color: #475569; }
.entity-badge.color-indigo { background: #e0e7ff; color: #4338ca; }
.entity-badge.color-green { background: #d1fae5; color: #065f46; }
.entity-badge.color-violet { background: #ede9fe; color: #6d28d9; }
.entity-badge.color-orange { background: #ffedd5; color: #9a3412; }
.entity-badge.color-red { background: #fee2e2; color: #991b1b; }

/* ── Phase Accordion (Execution Guide) ─────────────────────────────────────── */
.phase-block { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; background: var(--surface); }
.phase-header { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; }
.phase-number { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.phase-header-text { flex: 1; min-width: 0; }
.phase-eyebrow { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.phase-header-text h3 { font-size: 15px; font-weight: 800; margin: 2px 0 3px; }
.phase-header-text p { font-size: 12px; color: var(--text-muted); }
.phase-meta { font-size: 11px; color: var(--text-muted); font-weight: 700; white-space: nowrap; }
.phase-chevron { transition: transform 0.2s; color: var(--text-muted); }
.phase-block.open .phase-chevron { transform: rotate(180deg); }
.phase-steps { display: none; padding: 0 18px 16px; }
.phase-block.open .phase-steps { display: block; }
.phase-actions { display: flex; gap: 4px; align-items: center; }

.exec-step { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; background: var(--bg); border-radius: 10px; margin-bottom: 8px; }
.exec-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 1px; }
.exec-step-body { flex: 1; min-width: 0; }
.exec-step-title { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.exec-step-meta { display: flex; gap: 12px; font-size: 11px; color: var(--text-muted); }
.exec-step-desc { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.6; display: none; }
.exec-step.expanded .exec-step-desc { display: block; }

/* ── Communication Plan ────────────────────────────────────────────────────── */
.comm-summary-table { width: 100%; border-collapse: collapse; margin-bottom: 28px; }
.comm-summary-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 8px 12px; border-bottom: 1px solid var(--border); }
.comm-summary-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: top; }
.stakeholder-chip { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.stakeholder-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; flex-shrink: 0; }

.stakeholder-card { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; background: var(--surface); overflow: hidden; }
.stakeholder-card-header { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; }
.stakeholder-card-header .sh-text { flex: 1; min-width: 0; }
.stakeholder-card-header h3 { font-size: 14px; font-weight: 800; }
.stakeholder-card-header p { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.stakeholder-card-body { display: none; padding: 0 18px 18px; }
.stakeholder-card.open .stakeholder-card-body { display: block; }
.stakeholder-card.open .phase-chevron { transform: rotate(180deg); }

.script-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.script-box { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.script-box label { display: block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 5px; }
.script-box p { font-size: 12.5px; color: var(--text); line-height: 1.6; }
.core-message-box { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 10px; padding: 14px; margin-bottom: 14px; }
.core-message-box label { display: block; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #4338ca; margin-bottom: 5px; }
.core-message-box p { font-size: 13px; color: #3730a3; font-weight: 600; line-height: 1.6; }
.script-template-box { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 16px; font-size: 12.5px; line-height: 1.8; white-space: pre-wrap; margin-bottom: 14px; font-family: ui-monospace, monospace; }
.do-dont-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.do-box, .dont-box { border-radius: 10px; padding: 14px; }
.do-box { background: #ecfdf5; border: 1px solid #a7f3d0; }
.dont-box { background: #fef2f2; border: 1px solid #fecaca; }
.do-box label, .dont-box label { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.do-box label { color: #065f46; }
.dont-box label { color: #991b1b; }
.do-item, .dont-item { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; line-height: 1.6; margin-bottom: 6px; }
.do-item span.mark { color: #059669; font-weight: 800; }
.dont-item span.mark { color: #dc2626; font-weight: 800; }
.point-actions { margin-left: auto; display: flex; gap: 2px; flex-shrink: 0; }
@media (max-width: 700px) { .script-grid-2, .do-dont-grid { grid-template-columns: 1fr; } }

/* ── Risk Scoring Matrix ───────────────────────────────────────────────────── */
.matrix-wrap { overflow-x: auto; margin-bottom: 24px; }
.matrix-table { border-collapse: collapse; }
.matrix-table th, .matrix-table td { padding: 10px 16px; text-align: center; font-size: 12px; font-weight: 700; border: 3px solid var(--bg); }
.matrix-table th { background: var(--surface); color: var(--text-muted); font-size: 10px; text-transform: uppercase; }
.matrix-table td.matrix-row-label { background: var(--surface); color: var(--text-muted); font-size: 10px; text-transform: uppercase; text-align: left; }
.matrix-cell { border-radius: 6px; cursor: pointer; color: #fff; min-width: 90px; transition: filter 0.15s; }
.matrix-cell:hover { filter: brightness(1.1); }
.matrix-cell.level-negligible { background: #10b981; }
.matrix-cell.level-low        { background: #22c55e; }
.matrix-cell.level-moderate   { background: #f59e0b; }
.matrix-cell.level-high       { background: #f97316; }
.matrix-cell.level-critical   { background: #dc2626; }

/* ── Timeline inline comments ─────────────────────────────────────────────── */
.timeline-comment-cell { min-width: 190px; max-width: 240px; }
.comment-edit-box { margin-top: 4px; }
.comment-view { display: flex; flex-direction: column; gap: 3px; }
.comment-view .comment-text { font-size: 12px; color: var(--text); line-height: 1.5; }
.comment-view a.comment-edit-link { font-size: 11px; color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.comment-view a.comment-edit-link:hover { text-decoration: underline; }

/* ── Project Timeline: Weekly Gantt Grid ──────────────────────────────────── */
.page-content-wide { max-width: 1500px; }
.gantt-wrap { overflow-x: auto; }
table.gantt-table { width: 100%; min-width: 1180px; border-collapse: collapse; font-size: 13px; }
table.gantt-table th { padding: 8px 10px; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-bottom: 2px solid var(--border); white-space: nowrap; }
table.gantt-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.gantt-table tr:hover td { background: var(--bg); }

.gantt-week-th { width: 52px; text-align: center !important; position: relative; }
.gantt-week-th .w-num { display: block; font-size: 10px; font-weight: 800; color: var(--text); }
.gantt-week-th .w-phase { display: block; font-size: 9px; font-weight: 600; color: var(--text-muted); text-transform: none; letter-spacing: normal; margin-top: 1px; }
.gantt-week-td { width: 52px; text-align: center; vertical-align: middle !important; padding: 10px 4px !important; }
.week-chip { display: block; height: 18px; border-radius: 5px; opacity: 0.92; }

/* ── Timeline: Start/End Duration column (dates + span bar) ─────────────── */
.duration-th { position: relative; min-width: 190px; text-align: left !important; }
.gantt-duration-cell { min-width: 190px; vertical-align: middle !important; }
.duration-cell { display: flex; flex-direction: column; gap: 6px; }
.duration-view { font-size: 12px; font-weight: 700; color: var(--text); }
/* .view-only is the opposite of .edit-only: visible normally, hidden while
   editing — gated on the ancestor class main.php's toggleEditMode() already
   sets, so no extra JS wiring is needed here. */
body.edit-mode-active .view-only { display: none; }
.duration-inputs { display: flex; align-items: center; gap: 6px; }
.duration-date-input {
    font-size: 11px; font-family: inherit; color: var(--text);
    border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px;
    background: var(--surface); width: 118px;
}
.duration-date-input:focus { outline: none; border-color: var(--accent); }
.duration-sep { font-size: 11px; color: var(--text-muted); }
.duration-bar-track { position: relative; height: 8px; border-radius: 99px; background: var(--bg); overflow: hidden; }
.duration-bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 99px; opacity: 0.9; }

.gantt-task-cell { min-width: 200px; max-width: 260px; }
.gantt-task-head { display: flex; align-items: center; gap: 7px; }
.task-status-icon { flex-shrink: 0; font-size: 13px; width: 16px; text-align: center; margin-top: 1px; }
.task-expand-btn {
    width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; margin-left: auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
    cursor: pointer; padding: 0; transition: transform 0.2s ease, background 0.15s, border-color 0.15s;
    transform-origin: center;
}
.task-expand-btn:hover { background: var(--bg); border-color: var(--text-muted); }
.task-expand-btn::before {
    content: ''; width: 6px; height: 6px; margin-top: -2px;
    border-right: 1.5px solid var(--text-muted); border-bottom: 1.5px solid var(--text-muted);
    transform: rotate(45deg);
}
.task-expand-btn.expanded { transform: rotate(180deg); }
.gantt-task-title-wrap { min-width: 0; }
.gantt-task-title-wrap .task-item-title { font-size: 12px; line-height: 1.4; white-space: normal; overflow-wrap: break-word; }
.task-item-owner { font-size: 10.5px; color: var(--text-muted); margin-top: 1px; }
.task-desc-line { font-size: 11.5px; color: var(--text-muted); line-height: 1.6; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }

.gantt-section-row td { background: var(--bg); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; padding: 8px 10px; border-bottom: 1px solid var(--border); }

/* Category chips — colour-coded via --chip-color custom property */
.chip.cat-chip, .chip.cat-chip-static {
    background: color-mix(in srgb, var(--chip-color) 14%, white);
    border-color: color-mix(in srgb, var(--chip-color) 35%, white);
    color: var(--chip-color);
    font-weight: 700;
}
.chip.cat-chip:hover { border-color: var(--chip-color); }
.chip.cat-chip.active { background: var(--chip-color); border-color: var(--chip-color); color: #fff; box-shadow: 0 0 0 2px color-mix(in srgb, var(--chip-color) 30%, white); }
.chip.cat-chip-all.active { background: var(--sidebar-bg); border-color: var(--sidebar-bg); color: #fff; }
.chip.cat-chip-static { cursor: default; padding: 2px 10px; font-size: 10px; white-space: nowrap; display: inline-block; }

/* Status dropdown control */
.status-dropdown { position: relative; }
.status-badge-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 10px; border-radius: 99px; font-size: 11px; font-weight: 700;
    border: none; cursor: default; font-family: inherit;
}
.edit-mode-active .status-badge-btn { cursor: pointer; }
.status-badge-btn .status-opt-icon { font-size: 11px; }
.status-badge-btn.status-not-started { background: #f1f5f9; color: #64748b; }
.status-badge-btn.status-in-progress { background: #fef3c7; color: #92400e; }
.status-badge-btn.status-stopped     { background: #fee2e2; color: #991b1b; }
.status-badge-btn.status-completed   { background: #d1fae5; color: #065f46; }
.status-badge-btn.status-at-risk     { background: #ffedd5; color: #9a3412; }
.status-chevron { font-size: 12px; margin-left: 1px; }

.status-dropdown-menu {
    position: absolute; z-index: 20; top: calc(100% + 4px); left: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: var(--shadow-md); list-style: none; padding: 6px; min-width: 150px;
}
.status-option {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
    color: var(--text); cursor: pointer; white-space: nowrap;
}
.status-option:hover { background: var(--bg); }
.status-option.selected { background: var(--bg); }
.status-opt-icon { width: 16px; text-align: center; font-size: 12px; }
.status-opt-check { margin-left: auto; color: var(--success); font-weight: 800; }

/* Legend */
.gantt-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); font-weight: 600; }
.legend-icon { font-size: 12px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0,0,0,0.25);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .mobile-menu-toggle { display: flex; }
    .page-content { padding: 24px 20px 24px; padding-top: 76px; }
}

/* ── Confirm Modal (replaces the browser confirm box) ─────────────────────── */
.confirm-box { max-width: 440px; padding: 28px; gap: 0; }
.confirm-icon {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
    background: #eef2ff; color: #4338ca;
    margin-bottom: 18px;
}
.confirm-icon.danger { background: #fef2f2; color: var(--danger); }
.confirm-box h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; margin-bottom: 10px; }
.confirm-box p  { font-size: 14px; color: var(--text-muted); line-height: 1.55; }
.confirm-type-wrap { margin-top: 20px; }
.confirm-type-wrap label {
    display: block; font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--text-muted); margin-bottom: 7px;
}
.confirm-type-wrap input {
    width: 100%; padding: 11px 14px; font-size: 14px; font-family: inherit;
    background: var(--bg); border: 1px solid var(--border); border-radius: 9px; color: var(--text);
}
.confirm-type-wrap input:focus { outline: 2px solid var(--sidebar-bg); outline-offset: 1px; background: var(--surface); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.confirm-actions .btn-danger { padding: 10px 20px; font-size: 13px; }
.confirm-actions .btn-danger:disabled { opacity: 0.55; cursor: not-allowed; }
.confirm-actions .btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Trash Page ───────────────────────────────────────────────────────────── */
.trash-count { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.btn-danger-outline {
    padding: 9px 16px; background: var(--surface); color: var(--danger);
    border: 1px solid #fecaca; border-radius: 8px;
    font-size: 12px; font-weight: 700; cursor: pointer; transition: background 0.15s;
}
.btn-danger-outline:hover { background: #fef2f2; }

.trash-panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.trash-panel-head { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.trash-panel-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.trash-panel-head p  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

.trash-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.trash-row:last-child { border-bottom: none; }
.trash-row:hover { background: var(--bg); }
.trash-row-main { min-width: 0; }

.trash-title-line { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.trash-title {
    font-size: 14.5px; font-weight: 700; color: var(--text-muted);
    text-decoration: line-through; font-style: italic;
    overflow-wrap: anywhere;
}
.trash-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; overflow-wrap: anywhere; }

.trash-type-chip {
    flex: none; padding: 3px 9px; border-radius: 99px;
    font-size: 10.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
    background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}
.trash-type-task        { background: #eef2ff; border-color: #c7d2fe; color: #4338ca; }
.trash-type-risk        { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.trash-type-phase       { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.trash-type-stakeholder { background: #fff7ed; border-color: #fed7aa; color: #c2410c; }
.trash-type-event       { background: #fdf4ff; border-color: #f5d0fe; color: #a21caf; }
.trash-type-entity      { background: #ecfeff; border-color: #a5f3fc; color: #0e7490; }
.trash-type-card        { background: #f8fafc; border-color: #e2e8f0; color: #475569; }
.trash-type-user        { background: #fffbeb; border-color: #fde68a; color: #b45309; }

.trash-actions { display: flex; gap: 8px; flex: none; }
.btn-restore, .btn-purge {
    padding: 8px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
    font-family: inherit; cursor: pointer; transition: background 0.15s;
    white-space: nowrap;
}
.btn-restore { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-restore:hover { background: var(--bg); }
.btn-purge   { background: var(--surface); color: var(--danger); border: 1px solid #fecaca; }
.btn-purge:hover { background: #fef2f2; }

@media (max-width: 720px) {
    .trash-row { flex-direction: column; align-items: stretch; }
    .trash-actions { justify-content: flex-end; }
}
