/* SAM — Project page professional styling */

/* ═══════════════════════════════════════════════════════════
   TOP NAVIGATION (horizontale, globale)
   ═══════════════════════════════════════════════════════════ */

.top-nav {
    background: white;
    border-bottom: 1px solid var(--sam-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.top-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--sam-primary);
    flex-shrink: 0;
}

.brand-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--sam-primary);
}

.brand-name {
    font-size: 1.05em;
    font-weight: 700;
    color: var(--sam-primary);
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.75em;
    color: var(--sam-text-light);
    line-height: 1.2;
}

.top-nav-main {
    display: flex;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.top-nav-link {
    padding: 8px 16px;
    text-decoration: none;
    color: var(--sam-text);
    font-size: 0.95em;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s;
}

.top-nav-link:hover { background: var(--sam-primary-light); color: var(--sam-primary); }
.top-nav-link.active { color: var(--sam-primary); font-weight: 600; }

.top-nav-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.top-nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--sam-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: all 0.15s;
}

.top-nav-icon:hover { background: #F0F0F0; color: var(--sam-primary); }

.top-nav-dot {
    position: absolute;
    top: 10px; right: 10px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--sam-danger);
    border: 2px solid white;
}

.top-nav-user {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--sam-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85em;
    text-decoration: none;
    border: 2px solid var(--sam-primary);
}

.top-nav-user img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

/* ═══ Notifications panel ═══ */

.notifications-panel {
    position: fixed;
    top: 72px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 200;
    overflow-y: auto;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--sam-border);
}

.notifications-header h3 { color: var(--sam-primary); font-size: 1em; }

.notifications-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--sam-text-light);
}

/* ═══════════════════════════════════════════════════════════
   PAGE LAYOUT (sans sidebar globale)
   ═══════════════════════════════════════════════════════════ */

.page-main {
    min-height: calc(100vh - 64px);
    background: var(--sam-bg);
    padding: 24px 0 64px;
}

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title { font-size: 1.6em; font-weight: 700; color: var(--sam-text); }
.page-sub { color: var(--sam-text-light); margin-top: 4px; }

/* ═══ Dashboard hero banner ═══ */

.hero-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    background: linear-gradient(135deg, var(--sam-primary) 0%, var(--sam-primary-dark) 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(31, 78, 121, 0.2);
}

.hero-setup    { background: linear-gradient(135deg, #F39C12 0%, #D68910 100%); }
.hero-blocked  { background: linear-gradient(135deg, #95A5A6 0%, #7F8C8D 100%); }
.hero-done     { background: linear-gradient(135deg, var(--sam-success) 0%, #1E8449 100%); }

.hero-banner-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-banner-body { flex: 1; }
.hero-banner-eyebrow {
    font-size: 0.75em;
    letter-spacing: 1.2px;
    opacity: 0.9;
    margin-bottom: 6px;
}
.hero-banner-title {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 4px;
}
.hero-banner-hint { font-size: 0.9em; opacity: 0.92; }

.btn-hero {
    background: white;
    color: var(--sam-primary);
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.15s;
}
.btn-hero:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.hero-setup .btn-hero { color: #B7791F; }
.hero-done .btn-hero { color: #1E8449; }

/* ═══ KPI grid (4 cards dashboard) ═══ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    padding: 20px 22px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.kpi-label {
    font-size: 0.82em;
    color: var(--sam-text-light);
    font-weight: 500;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 2.4em;
    font-weight: 700;
    color: var(--sam-text);
    line-height: 1;
    margin-bottom: 6px;
}

.kpi-green { color: var(--sam-success); }
.kpi-orange { color: var(--sam-warning); }

.kpi-sub {
    font-size: 0.82em;
    color: var(--sam-text-light);
}

/* ═══ Stats pills (bandeau horizontal) ═══ */

.stats-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.stat-pill-chip {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 20px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88em;
}

.stat-pill-label { color: var(--sam-text); }
.stat-pill-value { font-weight: 700; color: var(--sam-text); }
.stat-green { color: var(--sam-success); }
.stat-blue { color: var(--sam-primary); }
.stat-red { color: var(--sam-danger); }

/* ═══ Section + search + filters ═══ */

.dashboard-section { margin-bottom: 40px; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-title { font-size: 1.3em; font-weight: 600; color: var(--sam-text); }
.section-sub { color: var(--sam-text-light); font-size: 0.9em; margin-top: 2px; }

.section-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--sam-text-light);
}
.search-box input {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.9em;
    width: 220px;
    background: transparent;
}

/* ═══ Project tiles (dashboard/my_projects grid) ═══ */

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.project-tile {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    padding: 20px 22px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-tile:hover {
    border-color: var(--sam-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.project-tile-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--sam-text);
}

.project-tile-tags { display: flex; gap: 6px; flex-wrap: wrap; }

.tile-tag {
    background: #F0F4F8;
    color: var(--sam-text-light);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.78em;
    font-weight: 500;
}

.tile-tag-status-in_progress,
.tile-tag-status-draft { background: #E8F0FE; color: var(--sam-primary); }
.tile-tag-status-waiting_gate { background: #FFF3CD; color: #854D0E; }
.tile-tag-status-completed { background: #D4EDDA; color: #155724; }
.tile-tag-status-archived { background: #EEEEEE; color: #666; }

/* Status "Bloque" when project has critical blockers */
.tile-tag-status-blocked { background: #FED7AA; color: #92400E; }

.project-tile-progress { margin-top: 4px; }
.progress-label-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-bottom: 4px;
}
.progress-label-row strong { color: var(--sam-text); }

.progress-track {
    height: 6px;
    background: #EEF2F6;
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sam-primary) 0%, var(--sam-success) 100%);
    border-radius: 3px;
}

.project-tile-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.82em;
    color: var(--sam-text-light);
    padding-top: 4px;
}
.tile-meta {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.project-tile-milestone {
    font-size: 0.82em;
    color: var(--sam-primary);
    padding-top: 10px;
    border-top: 1px solid var(--sam-border);
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ═══ Help FAB (floating SAM help button) ═══ */

.help-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--sam-primary);
    color: white;
    border-radius: 30px;
    padding: 10px 18px 10px 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(31, 78, 121, 0.4);
    transition: all 0.15s;
    z-index: 500;
}

.help-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31, 78, 121, 0.5); }
.help-fab img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
}

/* ═══ Deliverables global (grouped by project) ═══ */

.deliverables-group {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 20px;
}

.deliverables-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--sam-border);
    margin-bottom: 14px;
}

.dg-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--sam-primary);
    text-decoration: none;
}
.dg-title:hover { text-decoration: underline; }

.dg-meta { font-size: 0.85em; color: var(--sam-text-light); }

/* ═══ Filters bar (my_projects) ═══ */

.filters-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filters-bar .form-input { width: auto; }

.result-count {
    font-size: 0.9em;
    color: var(--sam-text-light);
    margin-bottom: 16px;
}

/* ═══ Empty state ═══ */

.empty-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--sam-primary);
    margin: 0 auto 16px;
    display: block;
}

/* ═══ Project page — use top nav + sidebar RAMS ═══ */

.project-main-layout { padding-top: 0; }
.project-content-wrap { padding-top: 24px; }

/* ═══ Responsive ═══ */

@media (max-width: 900px) {
    .top-nav-main { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-banner { flex-direction: column; text-align: center; }
}



/* ═══ Two-column project layout (secondary nav + content) ═══ */

.app-main-with-subnav { padding: 24px 28px; }

.project-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    margin-top: 20px;
    align-items: start;
}

/* Secondary sidebar (RAMS sections) */
.project-nav {
    background: var(--sam-white);
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 8px 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--sam-shadow);
}

.pnav-section {
    padding: 8px 0;
    border-top: 1px solid #F0F0F0;
    margin-top: 4px;
}

.pnav-section:first-child { border-top: none; margin-top: 0; }

.pnav-section-title {
    padding: 6px 16px;
    font-size: 0.72em;
    font-weight: 700;
    color: var(--sam-primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
}

.pnav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.88em;
    color: var(--sam-text);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.12s;
}

.pnav-item:hover {
    background: #F8FAFC;
    color: var(--sam-primary);
}

.pnav-item.active {
    background: var(--sam-primary-light);
    border-left-color: var(--sam-primary);
    color: var(--sam-primary);
    font-weight: 600;
}

.pnav-icon {
    font-size: 0.9em;
    width: 16px;
    display: inline-block;
    text-align: center;
}

.pnav-sub {
    padding-left: 24px;
    font-size: 0.85em;
}

.pnav-count {
    margin-left: auto;
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.72em;
    font-weight: 600;
}

.pnav-item.active .pnav-count {
    background: var(--sam-primary);
    color: white;
}

.project-content { min-width: 0; }

/* ═══ Critical risk dot indicators ═══ */

.critical-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #E74C3C;
    margin-left: 6px;
    animation: pulse-red 2s infinite;
    vertical-align: middle;
}

.critical-dot-lg {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #E74C3C;
    margin-left: 8px;
    box-shadow: 0 0 0 3px rgba(231, 60, 43, 0.25);
    animation: pulse-red 2s infinite;
    vertical-align: middle;
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 60, 43, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(231, 60, 43, 0); }
}

.critical-risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: 16px;
    font-size: 0.8em;
    font-weight: 600;
}

.risk-critical {
    background: #FEF2F2 !important;
    border-left: 3px solid #E74C3C;
}

/* ═══ Breadcrumb section ═══ */

.breadcrumb-section {
    color: var(--sam-text);
    font-weight: 500;
}

/* ═══ Metrics row ═══ */

.metrics-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin: 16px 0 20px;
}

.metric-box {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.metric-box-critical {
    background: #FEE2E2;
    border-color: #FECACA;
    color: #991B1B;
}

.metric-box-warning {
    background: #FEF3C7;
    border-color: #FDE68A;
    color: #854D0E;
}

.metric-box .metric-label {
    font-size: 0.72em;
    color: inherit;
    opacity: 0.8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-box .metric-value {
    font-size: 1.6em;
    font-weight: 700;
    color: inherit;
    margin-top: 4px;
}

.metric-box .metric-sub {
    font-size: 0.78em;
    color: inherit;
    opacity: 0.7;
    margin-top: 2px;
}

.section-subtitle {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--sam-primary);
    margin: 20px 0 10px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--sam-border);
}

/* ═══ Architecture overview (2 columns) ═══ */

.arch-overview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 12px;
}

.arch-col {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 14px 16px;
}

.arch-col-title {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--sam-primary);
    margin-bottom: 10px;
    padding-bottom: 4px;
    border-bottom: 2px solid var(--sam-primary-light);
}

.arch-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 6px 0;
    font-size: 0.88em;
    border-bottom: 1px dashed #E0E4E8;
}

.arch-item:last-child { border-bottom: none; }

.arch-more {
    display: inline-block;
    margin-top: 8px;
    font-size: 0.85em;
    color: var(--sam-primary);
    text-decoration: none;
    font-weight: 500;
}

.arch-more:hover { text-decoration: underline; }

@media (max-width: 700px) {
    .arch-overview { grid-template-columns: 1fr; }
}

/* ═══ Functional tree (architecture) ═══ */

.func-tree {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.func-node {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    padding: 12px 14px;
}

.func-child {
    margin-left: 24px;
    border-left: 3px solid var(--sam-primary-light);
}

.func-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.func-id {
    font-family: monospace;
    font-size: 0.82em;
    color: var(--sam-primary);
    font-weight: 600;
}

.func-name {
    font-weight: 500;
    color: var(--sam-text);
}

.func-desc {
    font-size: 0.85em;
    color: var(--sam-text-light);
    margin-top: 4px;
}

/* ═══ CCA card ═══ */

.cca-card {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
}

.cca-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cca-date {
    font-size: 0.82em;
    color: var(--sam-text-light);
}

.cca-findings ul {
    margin: 4px 0 0 20px;
    font-size: 0.88em;
}

/* ═══ Export cards ═══ */

.export-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.export-card {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    transition: all 0.15s;
}

.export-card:hover {
    border-color: var(--sam-primary);
    transform: translateY(-2px);
    box-shadow: var(--sam-shadow);
}

.export-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.export-card h4 {
    color: var(--sam-text);
    margin-bottom: 4px;
    font-size: 0.95em;
}

.export-card p {
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-bottom: 12px;
}

/* ═══ Action timeline (section 5.4) ═══ */

.action-timeline {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-item {
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-left: 4px solid var(--sam-primary);
    border-radius: 8px;
    padding: 14px 18px;
}

.action-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.action-author {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
}

.action-date {
    margin-left: auto;
    font-size: 0.78em;
    color: var(--sam-text-light);
}

.action-title {
    font-size: 1.02em;
    font-weight: 600;
    color: var(--sam-text);
    margin-bottom: 8px;
}

.action-body {
    background: white;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 6px;
    font-size: 0.88em;
}

.action-label {
    font-size: 0.78em;
    color: var(--sam-text-light);
    font-weight: 600;
    margin-bottom: 2px;
}

.action-source {
    font-size: 0.8em;
    color: var(--sam-text-light);
    margin-top: 6px;
}

/* ═══ Recommendation action box ═══ */

.rec-action-box {
    background: #E8F5E9;
    border: 1px solid #C8E6C9;
    color: #1B5E20;
    padding: 10px 14px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 0.88em;
}

/* ═══ Milestones timeline (RAMS) ═══ */

.ms-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.ms-timeline::before {
    content: "";
    position: absolute;
    left: 29px;
    top: 24px;
    bottom: 24px;
    width: 2px;
    background: var(--sam-border);
    z-index: 0;
}

.ms-step {
    display: grid;
    grid-template-columns: 60px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 0;
    position: relative;
    z-index: 1;
}

.ms-step-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ms-step-code {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--sam-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85em;
    color: var(--sam-text-light);
}

.ms-step-completed .ms-step-code {
    background: var(--sam-success);
    border-color: var(--sam-success);
    color: white;
}

.ms-step-in_progress .ms-step-code {
    background: var(--sam-primary);
    border-color: var(--sam-primary);
    color: white;
    box-shadow: 0 0 0 4px var(--sam-primary-light);
}

.ms-step-delayed .ms-step-code {
    background: var(--sam-danger);
    border-color: var(--sam-danger);
    color: white;
}

.ms-step-title {
    font-weight: 600;
    color: var(--sam-text);
    font-size: 0.98em;
}

.ms-step-meta {
    font-size: 0.85em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

.ms-step-desc {
    font-size: 0.85em;
    color: var(--sam-text);
    margin-top: 4px;
    line-height: 1.45;
}

/* ═══ Milestones / Deliverables grid (section 4) ═══ */

.milestones-deliverables {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ms-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    gap: 18px;
    padding: 18px;
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    border-left: 4px solid var(--sam-border);
    align-items: start;
}

.ms-row-completed { border-left-color: var(--sam-success); background: #F0F9F4; }
.ms-row-in_progress { border-left-color: var(--sam-primary); }
.ms-row-delayed { border-left-color: var(--sam-danger); background: #FEF2F2; }

.ms-col-milestone { min-width: 160px; }

.ms-code {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--sam-primary);
    letter-spacing: 0.5px;
}

.ms-name {
    font-weight: 500;
    color: var(--sam-text);
    font-size: 0.92em;
    margin-top: 2px;
}

.ms-meta,
.ms-meta-small {
    font-size: 0.8em;
    color: var(--sam-text-light);
    margin-top: 4px;
}

.ms-meta-small { margin-top: 6px; }

.ms-label {
    font-size: 0.75em;
    color: var(--sam-text-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ms-deliverable {
    margin-bottom: 8px;
}

.ms-desc {
    font-size: 0.88em;
    color: var(--sam-text);
    line-height: 1.5;
}

.ms-col-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 130px;
}

.chip-progress,
.chip-in_progress { background: #E8F0FE; color: var(--sam-primary); }
.chip-completed { background: #D4EDDA; color: #155724; }

/* ═══ Responsive for new layout ═══ */

@media (max-width: 1100px) {
    .project-layout {
        grid-template-columns: 1fr;
    }
    .project-nav {
        position: static;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .ms-row { grid-template-columns: 1fr; }
    .ms-col-status { align-items: flex-start; }
}

/* ═══════════════════════════════════════════════════════════
   WORKFLOW REDESIGN — clean, professional, scannable
   ═══════════════════════════════════════════════════════════ */

/* ── Hero banner (next recommended action) ── */

.hero-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 24px;
    margin-bottom: 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--sam-primary) 0%, var(--sam-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(31, 78, 121, 0.18);
}

.hero-setup    { background: linear-gradient(135deg, #F39C12 0%, #D68910 100%);
                 box-shadow: 0 4px 16px rgba(243, 156, 18, 0.25); }
.hero-blocked  { background: linear-gradient(135deg, #95A5A6 0%, #7F8C8D 100%); }
.hero-done     { background: linear-gradient(135deg, var(--sam-success) 0%, #1E8449 100%); }

.hero-banner-icon {
    font-size: 2.2em;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.hero-banner-body { flex: 1; }
.hero-banner-eyebrow {
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    opacity: 0.9;
    margin-bottom: 4px;
}
.hero-banner-title {
    font-size: 1.25em;
    font-weight: 600;
    margin-bottom: 2px;
}
.hero-banner-hint {
    font-size: 0.88em;
    opacity: 0.92;
}

.hero-banner .btn {
    background: white;
    color: var(--sam-primary);
}

.hero-setup .btn { color: #B7791F; }
.hero-done .btn  { color: #1E8449; }

/* ── Stats row ── */

.stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-pill {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    box-shadow: var(--sam-shadow);
}

.stat-completed { border-top: 3px solid var(--sam-success); }
.stat-available { border-top: 3px solid var(--sam-primary); }
.stat-blocked   { border-top: 3px solid var(--sam-warning); }

.stat-num {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--sam-text);
    line-height: 1;
}

.stat-label {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--sam-text-light);
    margin-top: 4px;
    font-weight: 500;
}

/* ── Setup card (collapsible) ── */

.setup-card {
    background: white;
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--sam-shadow);
    overflow: hidden;
}

.setup-summary {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #F8FAFC;
    list-style: none;
    user-select: none;
}

.setup-summary::-webkit-details-marker { display: none; }
.setup-summary::marker { content: ""; }

.setup-summary-title {
    font-size: 1em;
    font-weight: 600;
    color: var(--sam-primary);
}

.setup-summary-meta {
    font-size: 0.85em;
    color: var(--sam-text-light);
}

.setup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    padding: 16px 20px 20px;
}

.setup-tile {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--sam-text);
    transition: all 0.15s;
}

.setup-tile:hover {
    border-color: var(--sam-primary);
    background: var(--sam-primary-light);
}

.setup-tile-done {
    background: #F0FDF4;
    border-color: #BBF7D0;
}

.setup-tile-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    border: 1.5px solid var(--sam-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    font-weight: 600;
    color: var(--sam-text-light);
    flex-shrink: 0;
}

.setup-tile-done .setup-tile-check {
    background: var(--sam-success);
    border-color: var(--sam-success);
    color: white;
}

.setup-tile-text { flex: 1; min-width: 0; }
.setup-tile-label { font-weight: 500; font-size: 0.92em; line-height: 1.3; }
.setup-tile-hint { font-size: 0.78em; color: var(--sam-text-light); margin-top: 2px; }

/* ── Phases timeline (horizontal at top of each phase block) ── */

.phases-card { padding-bottom: 8px; }

.phases-timeline-h {
    display: flex;
    gap: 0;
    padding: 16px 0;
    overflow-x: auto;
}

.phase-step {
    flex: 1;
    min-width: 100px;
    text-align: center;
    position: relative;
    padding: 0 8px;
}

.phase-step-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.92em;
    background: #F0F0F0;
    color: var(--sam-text-light);
    border: 3px solid white;
    position: relative;
    z-index: 1;
}

.phase-completed .phase-step-circle {
    background: var(--sam-success);
    color: white;
}
.phase-in_progress .phase-step-circle {
    background: var(--sam-primary);
    color: white;
    box-shadow: 0 0 0 4px var(--sam-primary-light);
}

.phase-step-link {
    position: absolute;
    top: 19px;
    left: calc(50% + 19px);
    right: calc(-50% + 19px);
    height: 2px;
    background: var(--sam-border);
    z-index: 0;
}

.phase-completed + .phase-step .phase-step-link,
.phase-completed .phase-step-link {
    background: var(--sam-success);
}

.phase-step-label {
    font-size: 0.85em;
    font-weight: 500;
    color: var(--sam-text);
}

.phase-step-meta {
    font-size: 0.75em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

/* ── Phase block (sectionne par phase) ── */

.phase-block { padding: 0; overflow: hidden; }

.phase-block-header {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 18px 22px;
    background: #F8FAFC;
    border-bottom: 1px solid var(--sam-border);
}

.phase-block-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sam-text-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05em;
    flex-shrink: 0;
}

.phase-block-completed { background: var(--sam-success); }
.phase-block-in_progress { background: var(--sam-primary); }

.phase-block-info { flex: 1; }
.phase-block-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--sam-text);
    margin: 0;
}
.phase-block-desc {
    font-size: 0.85em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

.phase-block-progress { text-align: right; flex-shrink: 0; }
.phase-block-pct {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--sam-primary);
    line-height: 1;
}
.phase-block-fraction {
    font-size: 0.78em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

/* ── Analysis row (clean, single line per analysis) ── */

.phase-analyses { padding: 8px 0; }

.ana-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 22px;
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.12s;
}

.ana-row:last-child { border-bottom: none; }
.ana-row:hover { background: #F8FAFC; }

.ana-completed { background: #F8FDF9; }
.ana-blocked { opacity: 0.75; }

.ana-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    color: white;
    background: var(--sam-text-light);
    flex-shrink: 0;
}

.ana-completed .ana-icon { background: var(--sam-success); }
.ana-available .ana-icon { background: var(--sam-primary); }
.ana-blocked .ana-icon { background: var(--sam-warning); }

.ana-body { flex: 1; min-width: 0; }
.ana-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ana-code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.78em;
    background: #EEF2F6;
    color: var(--sam-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.ana-label {
    font-size: 0.95em;
    font-weight: 500;
    color: var(--sam-text);
}

.ana-prereqs {
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-top: 6px;
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.ana-prereq-chip {
    background: #FEF3C7;
    color: #854D0E;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.92em;
}

.ana-prereq-muted {
    background: #F0F0F0;
    color: #999;
}

.ana-action { flex-shrink: 0; }

/* ── Selection form (when no analyses chosen) ── */

.select-analyses-card .analyses-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.analyses-check {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    align-items: flex-start;
}

.analyses-check:hover {
    border-color: var(--sam-primary);
    background: var(--sam-primary-light);
}

.analyses-check input[type="checkbox"] {
    margin-top: 4px;
    accent-color: var(--sam-primary);
    flex-shrink: 0;
}

.analyses-check-content { flex: 1; min-width: 0; }

.analyses-check-code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.78em;
    background: white;
    color: var(--sam-primary);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 4px;
}

.analyses-check-label {
    font-weight: 500;
    font-size: 0.92em;
    color: var(--sam-text);
    line-height: 1.3;
}

.analyses-check-desc {
    font-size: 0.78em;
    color: var(--sam-text-light);
    margin-top: 4px;
    line-height: 1.4;
}

.form-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--sam-border);
    display: flex;
    justify-content: flex-end;
}

/* ── Responsive ── */

@media (max-width: 900px) {
    .stats-row { grid-template-columns: repeat(3, 1fr); }
    .hero-banner { flex-direction: column; text-align: center; }
    .phases-timeline-h { padding: 12px 0; }
    .phase-block-header { flex-direction: column; align-items: flex-start; }
    .phase-block-progress { text-align: left; }
}

/* ═══ Analyses checklist (selection) ═══ */

.analyses-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 8px;
}

.analyses-check {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.analyses-check:hover {
    border-color: var(--sam-primary);
    background: var(--sam-primary-light);
}

.analyses-check input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--sam-primary);
}

.analyses-check-label {
    font-size: 0.88em;
    line-height: 1.4;
}

/* ═══ Setup checklist ═══ */

.setup-checklist {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.setup-item {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: #F8FAFC;
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--sam-text);
    transition: all 0.15s;
}

.setup-item:hover {
    border-color: var(--sam-primary);
    background: var(--sam-primary-light);
}

.setup-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    background: white;
    border: 1.5px solid var(--sam-border);
    color: var(--sam-text-light);
}

.setup-done .setup-icon {
    background: var(--sam-success);
    border-color: var(--sam-success);
    color: white;
}

.setup-text { flex: 1; }
.setup-label { font-weight: 500; font-size: 0.92em; }
.setup-hint { font-size: 0.78em; color: var(--sam-text-light); margin-top: 2px; }

/* ═══ Analysis cards (flexible workflow) ═══ */

.analysis-card {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 10px;
    border-radius: 10px;
    border: 1px solid var(--sam-border);
    background: #F8FAFC;
    border-left: 4px solid var(--sam-border);
    transition: all 0.15s;
}

.analysis-card:hover { box-shadow: var(--sam-shadow); }

.analysis-completed { border-left-color: var(--sam-success); background: #F0FDF4; }
.analysis-available { border-left-color: var(--sam-primary); }
.analysis-blocked   { border-left-color: var(--sam-text-light); opacity: 0.85; }

.analysis-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1em;
    color: white;
    flex-shrink: 0;
    background: var(--sam-text-light);
}

.analysis-completed .analysis-card-icon { background: var(--sam-success); }
.analysis-available .analysis-card-icon { background: var(--sam-primary); }
.analysis-blocked   .analysis-card-icon { background: var(--sam-warning); }

.analysis-card-body { flex: 1; min-width: 0; }

.analysis-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.analysis-card-label {
    font-size: 1em;
    font-weight: 600;
    color: var(--sam-text);
    margin: 0;
}

.analysis-card-desc {
    font-size: 0.88em;
    color: var(--sam-text);
    margin-bottom: 10px;
    line-height: 1.45;
}

.analysis-card-status {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.missing-prereqs,
.missing-optional {
    font-size: 0.85em;
    color: var(--sam-text);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.missing-optional { color: var(--sam-text-light); }

/* ═══ Toasts (notifications non-bloquantes) ═══ */

.sam-toasts {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.sam-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--sam-white);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-left: 4px solid var(--sam-primary);
    min-width: 260px;
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.22s ease;
}

.sam-toast-show {
    opacity: 1;
    transform: translateX(0);
}

.sam-toast-success { border-left-color: var(--sam-success); }
.sam-toast-error { border-left-color: var(--sam-danger); }
.sam-toast-warning { border-left-color: var(--sam-warning); }

.sam-toast-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--sam-primary);
}

.sam-toast-success .sam-toast-icon { background: var(--sam-success); }
.sam-toast-error .sam-toast-icon { background: var(--sam-danger); }
.sam-toast-warning .sam-toast-icon { background: var(--sam-warning); }

.sam-toast-body {
    flex: 1;
    font-size: 0.9em;
    line-height: 1.4;
    color: var(--sam-text);
}

.sam-toast-close {
    background: transparent;
    border: none;
    color: var(--sam-text-light);
    cursor: pointer;
    font-size: 0.9em;
    padding: 4px 6px;
    border-radius: 4px;
}

.sam-toast-close:hover { background: #F0F0F0; }

/* ═══ Modal (confirmation / prompt) ═══ */

.sam-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 40, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.sam-modal {
    background: var(--sam-white);
    border-radius: 12px;
    padding: 24px;
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.sam-modal-title {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--sam-primary);
    margin-bottom: 12px;
}

.sam-modal-body {
    font-size: 0.92em;
    line-height: 1.5;
    color: var(--sam-text);
    margin-bottom: 20px;
}

.sam-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ═══ Spinner (loading) ═══ */

.sam-spinner {
    width: 40px;
    height: 40px;
    margin: 16px auto;
    border: 4px solid var(--sam-primary-light);
    border-top-color: var(--sam-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ═══ Alert variants ═══ */

.alert-warning {
    background: #FFF3CD;
    color: #664D03;
    border: 1px solid #FFE69C;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.9em;
}

/* ═══ Result details ═══ */

.result-details {
    margin-top: 10px;
    padding: 10px;
    background: #F8FAFC;
    border-radius: 6px;
    border: 1px solid var(--sam-border);
}

.result-details summary {
    cursor: pointer;
    font-size: 0.85em;
    color: var(--sam-text-light);
    font-weight: 500;
}

.result-details summary:hover {
    color: var(--sam-primary);
}

.result-data {
    margin-top: 8px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    font-size: 0.8em;
    font-family: monospace;
    overflow: auto;
    max-height: 300px;
}

/* ═══ Project header ═══ */

.project-header {
    background: var(--sam-white);
    border-radius: 12px;
    padding: 24px 28px 0;
    margin-bottom: 24px;
    box-shadow: var(--sam-shadow);
    border: 1px solid var(--sam-border);
}

.project-header-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.project-breadcrumb {
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-bottom: 4px;
}

.project-breadcrumb a {
    color: var(--sam-primary);
    text-decoration: none;
}

.project-title {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--sam-text);
    margin-bottom: 6px;
}

.project-meta {
    font-size: 0.88em;
    color: var(--sam-text-light);
}

.project-meta .dot {
    margin: 0 8px;
    color: #ccc;
}

.project-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ═══ Progress bar ═══ */

.progress-container {
    margin-bottom: 16px;
}

.progress-bar-outer {
    background: #EEF2F6;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-bar-inner {
    background: linear-gradient(90deg, #1F4E79 0%, #27AE60 100%);
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-label {
    font-size: 0.8em;
    color: var(--sam-text-light);
    text-align: right;
}

/* ═══ Gate alert ═══ */

.gate-alert {
    background: #FFF3CD;
    border: 1px solid #FFE69C;
    color: #664D03;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.88em;
    margin-bottom: 16px;
}

.gate-alert-item {
    display: inline-block;
    margin: 0 4px;
    padding: 2px 8px;
    background: white;
    border-radius: 12px;
    font-size: 0.85em;
}

/* ═══ Tabs ═══ */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--sam-border);
    margin-top: 8px;
    overflow-x: auto;
}

.tab {
    padding: 12px 16px;
    text-decoration: none;
    color: var(--sam-text-light);
    font-size: 0.92em;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.15s;
}

.tab:hover {
    color: var(--sam-primary);
    background: #F8FAFC;
}

.tab.active {
    color: var(--sam-primary);
    border-bottom-color: var(--sam-primary);
    font-weight: 600;
}

.tab-icon {
    font-size: 1em;
}

.tab-count {
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
}

.tab.active .tab-count {
    background: var(--sam-primary);
    color: white;
}

/* ═══ Tab content ═══ */

.tab-content {
    animation: fadeIn 0.2s ease;
}

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

/* ═══ Overview: metric cards ═══ */

.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--sam-white);
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    padding: 20px;
    box-shadow: var(--sam-shadow);
}

.metric-card-warning {
    border-left: 4px solid #F39C12;
}

.metric-label {
    font-size: 0.8em;
    font-weight: 500;
    color: var(--sam-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 2.2em;
    font-weight: 700;
    color: var(--sam-primary);
    line-height: 1;
}

.metric-sub {
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-top: 4px;
}

/* ═══ Milestones timeline ═══ */

.milestones-timeline {
    position: relative;
    padding-left: 32px;
}

.milestones-timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background: var(--sam-border);
}

.milestone {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
}

.milestone-marker {
    position: absolute;
    left: -32px;
    top: 14px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
    background: #F0F0F0;
    color: #999;
    border: 2px solid white;
}

.milestone-completed .milestone-marker {
    background: var(--sam-success);
    color: white;
}

.milestone-in_progress .milestone-marker {
    background: var(--sam-primary);
    color: white;
}

.milestone-delayed .milestone-marker {
    background: var(--sam-danger);
    color: white;
}

.milestone-content {
    flex: 1;
}

.milestone-title {
    font-weight: 600;
    color: var(--sam-text);
    font-size: 0.95em;
}

.milestone-meta {
    font-size: 0.8em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

.milestone-desc {
    font-size: 0.85em;
    color: var(--sam-text);
    margin-top: 4px;
}

/* ═══ Current step box ═══ */

.current-step-box {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--sam-primary-light);
    border-radius: 10px;
}

.current-step-num {
    width: 48px;
    height: 48px;
    background: var(--sam-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    font-weight: 700;
}

.current-step-title {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--sam-primary);
}

.current-step-meta {
    font-size: 0.82em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

/* ═══ Activity list ═══ */

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px;
    border-radius: 8px;
    transition: background 0.15s;
}

.activity-item:hover {
    background: #F8FAFC;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
    font-size: 0.9em;
}

.activity-time {
    font-size: 0.78em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

/* ═══ Inputs — documents by category ═══ */

.upload-box {
    background: #F8FAFC;
    border: 1px dashed var(--sam-border);
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
}

.upload-box.hidden {
    display: none;
}

.docs-by-cat {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.docs-category-title {
    font-size: 0.95em;
    font-weight: 600;
    color: var(--sam-primary);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--sam-primary-light);
}

.docs-count {
    color: var(--sam-text-light);
    font-weight: 400;
    font-size: 0.88em;
}

.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.doc-card {
    background: var(--sam-white);
    border: 1px solid var(--sam-border);
    border-radius: 8px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: all 0.15s;
}

.doc-card:hover {
    border-color: var(--sam-primary);
    transform: translateY(-1px);
    box-shadow: var(--sam-shadow);
}

.doc-icon {
    font-size: 1.6em;
    flex-shrink: 0;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    font-size: 0.9em;
    color: var(--sam-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.doc-meta {
    font-size: 0.75em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

.doc-parsed {
    color: var(--sam-success);
    font-weight: 500;
}

.doc-desc {
    font-size: 0.82em;
    color: var(--sam-text);
    margin-top: 4px;
}

.doc-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ═══ Analyses tab ═══ */

.analyses-list {
    display: flex;
    flex-direction: column;
}

.analysis-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 12px;
    border-bottom: 1px solid #F0F0F0;
    transition: background 0.15s;
}

.analysis-row:hover {
    background: #F8FAFC;
}

.analysis-row.current {
    background: var(--sam-primary-light);
    border-left: 3px solid var(--sam-primary);
    padding-left: 9px;
}

.analysis-row.done {
    opacity: 0.75;
}

.step-badge {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9em;
    flex-shrink: 0;
}

.step-done {
    background: #D4EDDA;
    color: #155724;
}

.step-current {
    background: var(--sam-primary);
    color: white;
}

.step-pending {
    background: #F0F0F0;
    color: #999;
}

.analysis-info {
    flex: 1;
}

.analysis-title {
    font-weight: 500;
    color: var(--sam-text);
    font-size: 0.95em;
}

.analysis-meta {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* ═══ Chips / tags ═══ */

.chip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
    background: #EEF2F6;
    color: var(--sam-text-light);
}

.chip-engine { background: #E3F2FD; color: #1565C0; }
.chip-gate { background: #FFF3CD; color: #856404; }
.chip-success { background: #D4EDDA; color: #155724; }
.chip-muted { background: #F0F0F0; color: #999; }

.chip-config { background: #E3F2FD; color: #1565C0; }
.chip-ingest { background: #FFF3CD; color: #856404; }
.chip-analysis { background: #E8F0FE; color: #1F4E79; }
.chip-report { background: #E1F5FE; color: #0277BD; }
.chip-review { background: #FCE4EC; color: #880E4F; }

.chip-priority-critical { background: #FEE2E2; color: #991B1B; font-weight: 600; }
.chip-priority-high { background: #FED7AA; color: #92400E; }
.chip-priority-medium { background: #FEF3C7; color: #854D0E; }
.chip-priority-low { background: #DCFCE7; color: #166534; }
.chip-priority-info { background: #DBEAFE; color: #1E3A8A; }

.chip-status-open { background: #FEE2E2; color: #991B1B; }
.chip-status-acknowledged { background: #FEF3C7; color: #854D0E; }
.chip-status-in_progress { background: #DBEAFE; color: #1E3A8A; }
.chip-status-resolved { background: #D4EDDA; color: #166534; }
.chip-status-rejected { background: #F0F0F0; color: #666; }

.chip-source { background: #E8F0FE; color: #1F4E79; font-weight: 500; }

/* ═══ Data table ═══ */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--sam-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--sam-border);
    background: #F8FAFC;
}

.data-table td {
    padding: 12px;
    font-size: 0.88em;
    border-bottom: 1px solid #F0F0F0;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #F8FAFC;
}

.hash-code {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.78em;
    background: #F0F0F0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #555;
}

/* ═══ Recommendations ═══ */

.rec-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.rec-card {
    padding: 14px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid;
}

.rec-card-critical { background: #FEE2E2; border-color: #FECACA; color: #991B1B; }
.rec-card-high { background: #FED7AA; border-color: #FDBA74; color: #92400E; }
.rec-card-medium { background: #FEF3C7; border-color: #FDE68A; color: #854D0E; }
.rec-card-low { background: #DCFCE7; border-color: #BBF7D0; color: #166534; }
.rec-card-total { background: var(--sam-primary-light); border-color: #C7D9F1; color: var(--sam-primary); }

.rec-card-label {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rec-card-value {
    font-size: 1.8em;
    font-weight: 700;
    margin-top: 4px;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-item {
    display: flex;
    background: var(--sam-white);
    border: 1px solid var(--sam-border);
    border-radius: 10px;
    overflow: hidden;
}

.rec-priority-bar {
    width: 4px;
    flex-shrink: 0;
}

.rec-priority-critical .rec-priority-bar { background: #991B1B; }
.rec-priority-high     .rec-priority-bar { background: #F97316; }
.rec-priority-medium   .rec-priority-bar { background: #EAB308; }
.rec-priority-low      .rec-priority-bar { background: #16A34A; }
.rec-priority-info     .rec-priority-bar { background: var(--sam-primary); }

.rec-content {
    flex: 1;
    padding: 16px 20px;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.rec-header > div:first-child {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.rec-date {
    font-size: 0.82em;
    color: var(--sam-text-light);
}

.rec-title {
    font-size: 1.02em;
    font-weight: 600;
    color: var(--sam-text);
    margin-bottom: 6px;
}

.rec-desc {
    color: var(--sam-text);
    font-size: 0.92em;
    line-height: 1.5;
    margin-bottom: 8px;
}

.rec-rationale {
    background: #F8FAFC;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.86em;
    margin-bottom: 8px;
}

.rec-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.82em;
    margin-bottom: 10px;
}

.rec-link {
    padding: 3px 10px;
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    border-radius: 12px;
}

.rec-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

/* ═══ History timeline ═══ */

.history-timeline {
    position: relative;
}

.history-item {
    display: grid;
    grid-template-columns: 80px 40px 1fr;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #F0F0F0;
}

.history-item:last-child { border-bottom: none; }

.history-time {
    text-align: right;
    font-size: 0.82em;
}

.history-date { font-weight: 500; color: var(--sam-text); }
.history-hour { color: var(--sam-text-light); font-size: 0.9em; }

.history-marker {
    display: flex;
    justify-content: center;
}

.history-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 600;
}

.history-action {
    font-size: 0.92em;
    color: var(--sam-text);
}

.history-details {
    margin-top: 4px;
    font-size: 0.8em;
    color: var(--sam-text-light);
}

.history-detail {
    margin-right: 12px;
}

.history-ip {
    font-size: 0.75em;
    color: #999;
    margin-top: 2px;
}

/* ═══ Team ═══ */

.team-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.team-member {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px;
    background: #F8FAFC;
    border-radius: 10px;
}

.team-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--sam-primary-light);
    color: var(--sam-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.team-avatar-owner {
    background: var(--sam-primary);
    color: white;
    border: 2px solid #E8C4A0;
}

.team-name { font-weight: 500; color: var(--sam-text); }
.team-role { font-size: 0.82em; color: var(--sam-primary); font-weight: 500; }
.team-org  { font-size: 0.8em; color: var(--sam-text-light); }

/* ═══ SAM Chat ═══ */

.sam-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.sam-chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--sam-primary);
    color: white;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(31, 78, 121, 0.4);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.sam-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(31, 78, 121, 0.5);
}

.sam-chat-toggle img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid white;
}

.sam-chat-panel {
    display: none;
    position: absolute;
    bottom: 60px;
    right: 0;
    width: 380px;
    height: 520px;
    background: var(--sam-white);
    border: 1px solid var(--sam-border);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    overflow: hidden;
}

.sam-chat:not(.collapsed) .sam-chat-panel {
    display: flex;
}

.sam-chat:not(.collapsed) .sam-chat-toggle {
    display: none;
}

.sam-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--sam-primary) 0%, var(--sam-primary-dark) 100%);
    color: white;
}

.sam-chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #E8C4A0;
}

.sam-chat-name { font-weight: 600; font-size: 0.95em; }
.sam-chat-status { font-size: 0.75em; opacity: 0.9; }

.sam-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #F8FAFC;
}

.chat-welcome {
    text-align: center;
    padding: 20px;
    color: var(--sam-text-light);
}

.chat-welcome img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid var(--sam-primary);
    margin-bottom: 8px;
}

.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-msg-user { justify-content: flex-end; }

.chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid var(--sam-border);
}

.chat-msg-avatar-user {
    background: var(--sam-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    font-weight: 600;
}

.chat-msg-bubble {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.88em;
    line-height: 1.45;
}

.chat-msg-sam .chat-msg-bubble {
    background: white;
    border: 1px solid var(--sam-border);
    border-top-left-radius: 4px;
    color: var(--sam-text);
}

.chat-msg-user .chat-msg-bubble {
    background: var(--sam-primary);
    color: white;
    border-top-right-radius: 4px;
}

.chat-msg-time {
    font-size: 0.68em;
    opacity: 0.7;
    margin-top: 3px;
}

.sam-chat-input {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-top: 1px solid var(--sam-border);
}

.sam-chat-input input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--sam-border);
    border-radius: 20px;
    font-size: 0.88em;
    outline: none;
}

.sam-chat-input input:focus {
    border-color: var(--sam-primary);
}

/* ═══ Utilities ═══ */

.card-subtitle {
    font-size: 0.85em;
    color: var(--sam-text-light);
    margin-top: 2px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--sam-text-light);
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--sam-text);
    margin-bottom: 6px;
    font-size: 1.05em;
}

.empty-state p {
    font-size: 0.9em;
}

.empty-hint {
    padding: 20px;
    text-align: center;
    color: var(--sam-text-light);
    font-style: italic;
    font-size: 0.9em;
}

.btn-icon {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--sam-text-light);
    font-size: 0.9em;
    transition: all 0.15s;
}

.btn-icon:hover {
    background: #F0F0F0;
    color: var(--sam-text);
}

.hidden { display: none !important; }

/* ═══ Responsive ═══ */

@media (max-width: 900px) {
    .overview-grid { grid-template-columns: repeat(2, 1fr); }
    .rec-summary   { grid-template-columns: repeat(2, 1fr); }
    .team-list     { grid-template-columns: 1fr; }
    .project-header-main { flex-direction: column; gap: 12px; }
    .sam-chat-panel { width: calc(100vw - 40px); }
}
