:root {
    --navy: #0B1F3A;
    --navy-light: #132d52;
    --teal: #0D9488;
    --teal-dark: #0a7a70;
    --gold: #C9A227;
    --gold-light: #e0bc4a;
    --surface: #f4f7fb;
    --text-muted: #6b7a90;
}

* { font-family: 'Plus Jakarta Sans', sans-serif; }

.text-navy { color: var(--navy) !important; }
.text-gold { color: var(--gold) !important; }
.bg-teal { background-color: var(--teal) !important; }
.bg-navy { background-color: var(--navy) !important; }

.btn-teal {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--navy);
    font-weight: 600;
}
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy); }
.bg-gold { background-color: var(--gold) !important; }

/* Public landing */
.public-body { background: var(--surface); }
.navbar-public {
    background: rgba(11, 31, 58, 0.92) !important;
    backdrop-filter: blur(12px);
    padding: 1rem 0;
}
.hero-section {
    background: linear-gradient(135deg, var(--navy) 0%, #0a3d56 50%, var(--teal-dark) 100%);
    color: #fff;
    padding: 8rem 0 5rem;
    position: relative;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; z-index: 1; }
.hero-title { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; line-height: 1.15; }
.hero-subtitle { font-size: 1.15rem; opacity: 0.9; max-width: 600px; }

.stat-card {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 1rem;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-4px); }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--gold); }
.stat-card .stat-label { font-size: 0.875rem; opacity: 0.85; }

.section-padding { padding: 5rem 0; }
.section-title { font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; }
.section-subtitle { color: var(--text-muted); margin-bottom: 3rem; }

.feature-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    height: 100%;
    border: 1px solid #e8edf3;
    transition: box-shadow 0.2s, transform 0.2s;
}
.feature-card:hover { box-shadow: 0 12px 40px rgba(11,31,58,0.08); transform: translateY(-2px); }
.feature-icon {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--teal), var(--navy));
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.5rem; margin-bottom: 1rem;
}

.workflow-step {
    text-align: center;
    position: relative;
}
.workflow-step .step-num {
    width: 48px; height: 48px;
    background: var(--gold);
    color: var(--navy);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; margin-bottom: 1rem;
}

.flow-diagram {
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 1rem;
    padding: 1.5rem;
}
.flow-track {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0;
}
.flow-node {
    display: flex;
    align-items: center;
}
.flow-node-box {
    background: #fff;
    border: 2px solid var(--teal);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    min-width: 118px;
    text-align: center;
    box-shadow: 0 4px 14px rgba(11,31,58,0.06);
}
.flow-node-box i {
    display: block;
    font-size: 1.25rem;
    color: var(--teal);
    margin-bottom: 0.35rem;
}
.flow-node-box strong {
    display: block;
    font-size: 0.8rem;
    color: var(--navy);
    line-height: 1.3;
}
.flow-node-box span {
    display: block;
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.2rem;
}
.flow-arrow {
    color: var(--gold);
    font-size: 1.1rem;
    padding: 0 0.35rem;
}
.flow-branches {
    display: grid;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px dashed #d1d9e6;
}
.flow-branch {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.875rem;
    color: #475569;
    background: #fff;
    border-radius: 0.65rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e8edf3;
}
.flow-branch i {
    color: var(--teal);
    font-size: 1.1rem;
    margin-top: 0.1rem;
    flex-shrink: 0;
}
.flow-branch-revise { border-left: 4px solid #f59e0b; }
.flow-branch-progress { border-left: 4px solid #10b981; }

.role-flow-overview {
    background: linear-gradient(135deg, #f8fafc 0%, #eef6ff 100%);
    border: 1px solid #e8edf3;
    border-radius: 1rem;
    padding: 1.5rem;
}
.role-flow-lane + .role-flow-lane {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px dashed #d1d9e6;
}
.role-flow-lane-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.65rem;
}
.role-flow-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.role-chip {
    background: var(--role-color, var(--navy));
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
}
.role-flow-arrow {
    color: var(--gold);
    font-weight: 700;
}

.role-card {
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 1rem;
    padding: 1.5rem;
    height: 100%;
    transition: box-shadow 0.2s, transform 0.2s;
}
.role-card:hover {
    box-shadow: 0 10px 30px rgba(11,31,58,0.08);
    transform: translateY(-2px);
}
.role-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.35rem;
    margin-bottom: 1rem;
}
.role-card-summary {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.85rem;
}
.role-card-tasks {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.82rem;
    color: #475569;
}
.role-card-tasks li { margin-bottom: 0.35rem; }

@media (max-width: 991.98px) {
    .flow-node {
        flex: 1 1 45%;
        justify-content: center;
    }
    .flow-arrow { display: none; }
}
@media (max-width: 575.98px) {
    .flow-node { flex: 1 1 100%; }
}
.discipline-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #e8edf3;
}
.discipline-card i { font-size: 2rem; color: var(--teal); }

.project-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e8edf3;
    height: 100%;
}
.project-card .progress { height: 8px; border-radius: 4px; }

.site-footer {
    background: var(--navy);
    color: #fff;
    padding: 3rem 0 2rem;
}
.site-footer .text-light-emphasis {
    color: rgba(255, 255, 255, 0.92) !important;
}
.site-footer a.text-reset {
    color: rgba(255, 255, 255, 0.92) !important;
}
.site-footer a.text-reset:hover {
    color: #fff !important;
    text-decoration: underline !important;
}
.site-footer h6 {
    color: #fff;
}
.site-footer hr {
    border-color: rgba(255, 255, 255, 0.25);
    opacity: 1;
}

/* Auth */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--navy), #0a3d56);
    display: flex; align-items: center; justify-content: center;
}
.auth-wrapper { width: 100%; max-width: 460px; padding: 1.5rem; }
.auth-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

/* Demo accounts */
.demo-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e8edf3;
    border-radius: 0.5rem;
}
.demo-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    text-align: left;
    background: #fff;
    border: none;
    border-bottom: 1px solid #eef2f7;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}
.demo-item:last-child { border-bottom: none; }
.demo-item:hover { background: #f4f7fb; }
.demo-item .demo-role {
    flex-shrink: 0;
    width: 120px;
    font-size: 0.7rem;
    white-space: normal;
    text-align: center;
}
.demo-item .demo-info { flex: 1; min-width: 0; line-height: 1.2; }
.demo-item .demo-name { display: block; font-weight: 600; font-size: 0.82rem; color: var(--navy); }
.demo-item .demo-email { display: block; font-size: 0.72rem; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* SD progress */
.sd-donut {
    --pct: 0;
    --color: var(--teal);
    --size: 48px;
    position: relative;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: conic-gradient(var(--color) calc(var(--pct) * 1%), #e8edf3 0);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sd-donut::before {
    content: '';
    position: absolute;
    width: 72%;
    height: 72%;
    background: #fff;
    border-radius: 50%;
}
.sd-donut-label {
    position: relative;
    z-index: 1;
    font-size: calc(var(--size) * 0.22);
    font-weight: 800;
    color: var(--navy);
    line-height: 1;
}
.sd-donut-lg { --size: 96px; }
.sd-donut-lg .sd-donut-label { font-size: 1.25rem; }

.sd-status-progress {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.sd-status-progress-col {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 140px;
}
.sd-progress-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem 0;
}
.sd-progress-card-info { flex: 1; }

/* App shell */
.app-body { background: var(--surface); }
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
    width: 260px;
    background: var(--navy);
    color: #fff;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1040;
    transition: transform 0.3s;
}
.sidebar-brand { padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-link {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.2s;
}
.sidebar-link:hover, .sidebar-link.active {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.sidebar-link.active { border-left: 3px solid var(--gold); }
.sidebar-footer { padding: 1rem 0; border-top: 1px solid rgba(255,255,255,0.1); }

.app-main { flex: 1; margin-left: 260px; min-width: 0; }
.app-navbar {
    background: #fff;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e8edf3;
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; z-index: 1030;
}
.app-content { max-width: 1400px; }

.kpi-card {
    background: #fff;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid #e8edf3;
    border-left: 4px solid var(--teal);
}
.kpi-card.warning { border-left-color: #f59e0b; }
.kpi-card.success { border-left-color: #10b981; }
.kpi-card.danger { border-left-color: #ef4444; }
.kpi-card.info { border-left-color: #3b82f6; }
.kpi-value { font-size: 1.75rem; font-weight: 800; color: var(--navy); }

.report-scope-meta {
    display: grid;
    gap: 0.35rem;
    min-width: 260px;
    font-size: 0.875rem;
}
.report-scope-meta span {
    display: inline-block;
    width: 72px;
    color: #6b7280;
}
.report-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}
.report-nav a {
    color: var(--teal);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}
.report-nav a:hover { text-decoration: underline; }
.report-section-title {
    font-weight: 700;
    color: var(--navy);
    border-bottom: 3px solid var(--teal);
}
.report-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.75rem;
}
.report-bar-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.report-bar-name { width: 140px; flex-shrink: 0; }
.report-bar-track {
    flex: 1;
    background: #eef2f7;
    border-radius: 4px;
    height: 18px;
    overflow: hidden;
    margin: 0 0.75rem;
}
.report-bar-fill { height: 100%; border-radius: 4px; }
.report-bar-val {
    width: 36px;
    text-align: right;
    font-weight: 700;
    color: var(--navy);
}
.report-status-block { margin-bottom: 1.25rem; }
.report-status-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.report-status-count { color: #6b7280; font-weight: 400; font-size: 0.875rem; }
.report-empty { color: #6b7280; font-style: italic; padding: 0.25rem 0; }
.report-concl-card {
    border: 1px solid #e8edf3;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    background: #f8fafc;
}
.report-concl-card h3 {
    font-size: 1rem;
    color: var(--navy);
    margin-bottom: 0.5rem;
}
.report-concl {
    margin: 0;
    padding-left: 1.25rem;
}
.report-concl li { margin-bottom: 0.35rem; }
.report-section .text-muted { color: #6b7280 !important; }

@media print {
    .app-sidebar, .app-navbar, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    .report-nav { display: none !important; }
    .report-section { break-inside: avoid; box-shadow: none; }
}

.card-app {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e8edf3;
    box-shadow: 0 2px 8px rgba(11,31,58,0.04);
}
.card-app .card-header {
    background: transparent;
    border-bottom: 1px solid #e8edf3;
    font-weight: 600;
    color: var(--navy);
}

.table-app th { font-weight: 600; color: var(--navy); font-size: 0.875rem; }
.timeline-item {
    border-left: 2px solid var(--teal);
    padding-left: 1.25rem;
    margin-bottom: 1.25rem;
    position: relative;
}
.timeline-item::before {
    content: '';
    width: 10px; height: 10px;
    background: var(--teal);
    border-radius: 50%;
    position: absolute;
    left: -6px; top: 4px;
}

.sidebar-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}
.sidebar-backdrop.show { display: block; }

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-main { margin-left: 0; }
}

.btn-outline-teal {
    color: var(--teal);
    border-color: var(--teal);
}
.btn-outline-teal:hover {
    background: var(--teal);
    border-color: var(--teal);
    color: #fff;
}

.notif-dropdown { width: 340px; max-height: 400px; overflow-y: auto; }
.notif-item.unread { background: #f0fdfa; }
.notif-list-item.unread { background: #f0fdfa; border-left: 3px solid var(--teal); }
.notif-badge { font-size: 0.65rem; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-weekday {
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--navy);
    padding: 0.5rem 0;
}
.cal-day {
    min-height: 90px;
    border: 1px solid #e8edf3;
    border-radius: 0.5rem;
    padding: 0.35rem;
    background: #fff;
}
.cal-day-empty { background: #f8fafc; border-color: transparent; }
.cal-today { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.cal-day-num { font-weight: 700; font-size: 0.8rem; color: var(--navy); margin-bottom: 0.25rem; }
.cal-event {
    display: block;
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    border-radius: 0.25rem;
    margin-bottom: 0.15rem;
    text-decoration: none;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cal-wo { background: #3b82f6; }
.cal-wo-overdue { background: #ef4444; }
.cal-project { background: #7c3aed; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; }
.cal-legend-item { display: flex; align-items: center; gap: 0.35rem; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cal-dot.cal-wo { background: #3b82f6; }
.cal-dot.cal-wo-overdue { background: #ef4444; }
.cal-dot.cal-project { background: #7c3aed; }

.qr-label-card { max-width: 200px; }
