/* ByteSize SimLab v2 — Mobile-First */
:root {
    --bg: #f8f9fa; --surface: #ffffff; --text: #1a1a2e; --text-muted: #6c757d;
    --primary: #2563eb; --primary-hover: #1d4ed8; --primary-light: #eff6ff;
    --success: #059669; --success-light: #ecfdf5;
    --warning: #d97706; --warning-light: #fffbeb;
    --danger: #dc2626; --danger-light: #fef2f2;
    --border: #e2e8f0; --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08); --shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font); background: var(--bg); color: var(--text);
    line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column;
    -webkit-text-size-adjust: 100%;
}

/* Header & Footer */
.app-header {
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
    min-height: 60px; gap: 0.5rem;
}
.header-left { display: flex; align-items: center; gap: 1.5rem; flex-shrink: 0; }
.header-center { flex: 1; display: flex; justify-content: center; align-items: center; min-width: 0; }
.header-right { display: flex; align-items: center; gap: 1rem; flex-shrink: 0; }
.header-logo { max-height: 60px; width: auto; }
.header-client-logo { max-height: 60px; width: auto; }
.header-banner-img { max-height: 56px; max-width: 100%; width: auto; object-fit: contain; }
.header-brand-text { font-size: 1.2rem; font-weight: 700; color: var(--primary); text-decoration: none; }
.header-nav { display: flex; gap: 0.25rem; align-items: center; }
.header-nav-link {
    padding: 0.35rem 0.7rem; border-radius: var(--radius); font-size: 0.85rem;
    color: var(--text-muted); text-decoration: none; transition: background 0.15s, color 0.15s;
}
.header-nav-link:hover { background: var(--primary-light); color: var(--primary); }
.header-user { display: flex; align-items: center; gap: 0.5rem; }
.header-user-name { font-size: 0.85rem; color: var(--text); font-weight: 500; }
.header-logout { font-size: 0.8rem; color: var(--text-muted); }
@media (max-width: 640px) {
    .app-header { padding: 0.5rem 0.75rem; flex-wrap: wrap; }
    .header-logo { max-height: 40px; }
    .header-client-logo { max-height: 40px; }
    .header-banner-img { max-height: 36px; }
    .header-left { gap: 0.5rem; }
    .header-nav { gap: 0; }
    .header-nav-link { padding: 0.3rem 0.4rem; font-size: 0.75rem; }
    .header-user-name { display: none; }
    .header-center { order: 10; width: 100%; justify-content: center; }
}
.app-footer {
    margin-top: auto; padding: 1rem; text-align: center; font-size: 0.8rem;
    color: var(--text-muted); border-top: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 0.25rem; align-items: center;
}
.powered-by { font-size: 0.7rem; opacity: 0.6; }

/* Main */
.main { max-width: 960px; margin: 0 auto; padding: 1rem; flex: 1; width: 100%; }
@media (min-width: 640px) { .main { padding: 2rem 1rem; } }

/* Messages */
.messages { max-width: 960px; margin: 0 auto; padding: 0.5rem 1rem; }
.message { padding: 0.75rem 1rem; border-radius: var(--radius); margin-bottom: 0.5rem; font-size: 0.9rem; }
.message--success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.message--warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.message--error   { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.message--info    { background: var(--primary-light); color: #1e40af; border: 1px solid #93c5fd; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card--centered { text-align: center; max-width: 480px; margin: 1.5rem auto; }
@media (min-width: 640px) { .card { padding: 1.5rem; } .card--centered { margin: 3rem auto; } }

/* Typography */
h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
h2 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.5rem; }
h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; }
.subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
@media (min-width: 640px) { h1 { font-size: 1.75rem; } h2 { font-size: 1.35rem; } }

/* Buttons — 44px min touch target */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0.65rem 1.25rem; border: none; border-radius: var(--radius);
    font-size: 0.9rem; font-weight: 500; cursor: pointer; text-decoration: none;
    transition: background 0.15s, transform 0.1s; min-height: 44px; touch-action: manipulation;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--primary); color: white; }
.btn--primary:hover { background: var(--primary-hover); }
.btn--success { background: var(--success); color: white; }
.btn--warning { background: var(--warning); color: white; }
.btn--danger  { background: var(--danger); color: white; }
.btn--outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn--outline:hover { background: var(--bg); }
.btn--sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; min-height: 36px; }
.btn--full { width: 100%; }

/* Forms — 44px min touch target */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 0.3rem; }
.form-input {
    width: 100%; padding: 0.7rem 0.75rem; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 1rem; font-family: var(--font);
    transition: border-color 0.15s; min-height: 44px;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Checkbox */
.checkbox-group { display: flex; align-items: flex-start; gap: 0.5rem; margin: 1rem 0; }
.checkbox-group input[type="checkbox"] { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; accent-color: var(--primary); }
.checkbox-group label { font-size: 0.85rem; color: var(--text-muted); cursor: pointer; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
th { font-weight: 600; font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }

/* Badges */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.badge--draft { background: #e2e8f0; color: #475569; }
.badge--published { background: #dcfce7; color: #166534; }
.badge--archived { background: #fef3c7; color: #92400e; }
.badge--lobby { background: #e0e7ff; color: #3730a3; }
.badge--intro { background: #e0f2fe; color: #075985; }
.badge--individual { background: #fce7f3; color: #9d174d; }
.badge--team { background: #fef3c7; color: #92400e; }
.badge--recommended_order { background: #e0f2fe; color: #075985; }
.badge--debrief { background: #dcfce7; color: #166534; }
.badge--closed { background: #e2e8f0; color: #475569; }

/* Session code */
.session-code {
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 1.75rem; font-weight: 700;
    letter-spacing: 0.2em; color: var(--primary); padding: 0.5rem 1rem;
    background: var(--primary-light); border-radius: var(--radius); display: inline-block;
}

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr 1fr; }
}

/* ═══ Sortable list ═══ */
.sortable-list { list-style: none; padding: 0; }
.sortable-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.65rem; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 0.35rem;
    user-select: none; -webkit-user-select: none; touch-action: manipulation;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.sortable-item.sortable-chosen { border-color: var(--primary); box-shadow: var(--shadow-lg); z-index: 10; }
.sortable-ghost { opacity: 0.3; background: var(--primary-light); }
.sortable-drag { box-shadow: var(--shadow-lg); }

/* ── DESKTOP defaults (>768px): flat single-row flex ── */
.drag-zone { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.drag-handle {
    cursor: grab; color: var(--text-muted); flex-shrink: 0;
    touch-action: none; min-width: 28px; min-height: 44px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.drag-handle span { display: block; width: 22px; height: 3px; border-radius: 999px; background: #687487; }
.drag-handle:active { cursor: grabbing; }

/* Desktop: content-zone is a simple flex row */
.content-zone { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.5rem; }
.title-zone { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.35rem; }
.title-zone > * { min-width: 0; }

/* Desktop: top-controls shows inline with small rank circle + help pill */
.top-controls { display: inline-flex; align-items: center; flex-shrink: 0; min-width: 0; }
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary); color: white; border-radius: 50%;
    font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
    width: 1.75rem; height: 1.75rem;
}
.top-controls__spacer { display: none; }

.sortable-title {
    font-weight: 500; font-size: 0.88rem; line-height: 1.3; margin: 0;
    word-break: break-word; flex: 1; min-width: 0;
}
.sortable-desc { font-size: 0.8rem; color: var(--text-muted); display: none; }
@media (min-width: 769px) { .sortable-desc { display: block; } }

/* Desktop help trigger: small inline pill */
.help-trigger {
    border: 2px solid var(--primary); color: var(--primary); background: white;
    border-radius: 10px; font-size: 0.7rem; font-weight: 700;
    padding: 0 0.6rem; height: 26px; max-width: 100%; white-space: nowrap;
    cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    touch-action: manipulation; flex-shrink: 0;
}
.help-trigger:active { background: var(--primary-light); }

/* Desktop move zone: small stacked arrows */
.move-zone { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.move-btn {
    width: 32px; height: 26px; border: 1px solid var(--border); border-radius: 4px;
    background: var(--surface); cursor: pointer; display: flex; align-items: center;
    justify-content: center; font-size: 0.7rem; color: var(--text-muted);
    transition: background 0.1s; touch-action: manipulation;
}
.move-btn:active { background: var(--primary-light); }
.move-btn:disabled { opacity: 0.3; cursor: default; }

/* Desktop confidence: small inline buttons */
.confidence-zone { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.confidence-row { display: flex; gap: 4px; }
.confidence-btn {
    min-width: 36px; min-height: 36px; padding: 0.2rem; border: 2px solid var(--border);
    border-radius: 6px; background: var(--surface); cursor: pointer;
    font-size: 0.75rem; font-weight: 600; transition: all 0.15s; touch-action: manipulation;
    display: flex; align-items: center; justify-content: center;
}
.confidence-btn.active-low { background: var(--danger-light); border-color: #fca5a5; color: var(--danger); }
.confidence-btn.active-medium { background: var(--warning-light); border-color: #fcd34d; color: var(--warning); }
.confidence-btn.active-high { background: var(--success-light); border-color: #6ee7b7; color: var(--success); }
.confidence-btn:disabled { opacity: 0.6; cursor: default; }

/* Complex participant workspace */
.workspace-section + .workspace-section { margin-top: 1rem; }
.workspace-section__header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 0.75rem; margin-bottom: 0.75rem; flex-wrap: wrap;
    min-width: 0;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--bg) 70%, white);
}
.workspace-section__header > div { min-width: 0; flex: 1; }
.workspace-section__title { margin: 0; font-size: 1.05rem; }
.workspace-section__subtitle { font-size: 0.82rem; color: var(--text-muted); overflow-wrap: anywhere; }
.workspace-pill {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 2rem; padding: 0.15rem 0.55rem; border-radius: 999px;
    background: var(--primary-light); color: var(--primary);
    font-size: 0.78rem; font-weight: 700;
}
.workspace-tray {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.workspace-tray summary {
    list-style: none;
    cursor: pointer;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-weight: 600;
}
.workspace-tray summary::-webkit-details-marker { display: none; }
.workspace-tray[open] summary { border-bottom: 1px solid var(--border); }
.workspace-tray__hint {
    padding: 0 1rem 0.85rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.workspace-tray__empty {
    padding: 0.9rem 1rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.tray-list {
    list-style: none;
    padding: 0.85rem 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.tray-item {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fbfcff;
    padding: 0.85rem 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.tray-item__body { min-width: 0; flex: 1; }
.tray-item__title {
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.35;
    margin-top: 0.3rem;
    word-break: break-word;
}
.tray-item__meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.tray-item__actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.tray-action-btn {
    min-height: 36px;
}
.tray-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 700;
}
.tray-badge--excluded { background: var(--warning-light); color: var(--warning); }
.tray-badge--note { background: var(--primary-light); color: var(--primary); }
.sortable-item--readonly { opacity: 0.95; }
.sortable-item--blocked {
    border-style: dashed;
    background: #fffdf5;
}
.sortable-item--blocked .drag-zone,
.sortable-item--blocked .move-btn {
    opacity: 0.45;
}
.rank-badge.rank-badge--pending {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid #fcd34d;
}
.decision-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.35rem;
    min-width: 0;
}
.decision-action {
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    min-height: 30px;
    cursor: pointer;
    touch-action: manipulation;
    flex-shrink: 0;
    max-width: 100%;
}
.decision-action:disabled {
    opacity: 0.55;
    cursor: default;
}
.decision-action--secondary {
    border-color: var(--border);
    color: var(--text);
}
.decision-summary {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.35;
    min-width: 0;
    overflow-wrap: anywhere;
}
.decision-hint {
    font-size: 0.76rem;
    color: var(--warning);
    line-height: 1.35;
    min-width: 0;
}
.complex-progress {
    margin-top: 1rem;
}
.complex-progress__summary {
    font-weight: 700;
    line-height: 1.35;
}
.complex-progress__list {
    margin: 0.45rem 0 0;
    padding-left: 1.1rem;
    font-size: 0.86rem;
    line-height: 1.45;
}
.tray-item__summary {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.help-trigger.help-trigger--noted {
    border-color: var(--success);
    color: var(--success);
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE — workspace tray / complex-progress / tray-item overrides
   (Legacy .sortable-item mobile card grid and the .content-zone
   display-contents rule were removed — iOS Safari has documented
   fragility with display-contents plus grid ancestors, and the
   classes had no live consumer in current V8 templates. The 390px
   dead-class !important block was removed for the same reason.
   Participant card layout is now owned by .activity-card /
   .ordering-overview-card in design-system.css.)
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .complex-progress {
        padding: 0.85rem 0.95rem;
    }
    .complex-progress__summary {
        font-size: 0.92rem;
    }
    .complex-progress__list {
        padding-left: 1rem;
        font-size: 0.82rem;
    }
    .workspace-tray summary {
        padding: 0.8rem 0.85rem;
    }
    .tray-list {
        padding: 0.7rem;
    }
    .tray-item {
        flex-direction: column;
        align-items: stretch;
        padding: 0.8rem;
    }
    .tray-item__actions {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
        justify-content: stretch;
        width: 100%;
    }
    .tray-item__actions > * {
        width: 100%;
        max-width: none;
    }
    .tray-item__summary {
        font-size: 0.8rem;
    }
    .workspace-section__header {
        align-items: flex-start;
    }
    .workspace-section__subtitle {
        font-size: 0.8rem;
    }
}

/* ═══ Debrief ═══ */
.score-big { font-size: 2.5rem; font-weight: 700; line-height: 1; }
@media (min-width: 640px) { .score-big { font-size: 3rem; } }
.score-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.score-card { text-align: center; padding: 1.25rem; }
.comparison-bar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin: 0.5rem 0; }
.comparison-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.report-grid { display: grid; gap: 1rem; }
.report-grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.report-story {
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 35%),
        linear-gradient(180deg, rgba(15, 23, 42, 0.02), transparent 45%);
}
.report-story__header,
.report-team__header,
.report-panel__header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 1rem;
}
.report-story__eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}
.report-story__title,
.report-section__title,
.report-panel__title,
.report-team__title { margin: 0; }
.report-story__summary,
.report-section__subtitle,
.report-panel__subtitle,
.report-story__detail,
.report-kpi-card__detail,
.report-list__meta,
.report-list__note,
.distribution-list__detail {
    color: var(--text-muted);
}
.report-story__summary { max-width: 72ch; margin: 0.5rem 0 0; }
.report-story__grid,
.report-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
    margin-top: 1rem;
}
.report-story__card,
.report-kpi-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(255,255,255,0.92));
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}
.report-story__card--success,
.report-kpi-card--success { border-top: 3px solid var(--success); }
.report-story__card--danger,
.report-kpi-card--danger { border-top: 3px solid var(--danger); }
.report-story__card--warning,
.report-kpi-card--warning { border-top: 3px solid var(--warning); }
.report-story__label,
.report-kpi-card__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
}
.report-story__value,
.report-kpi-card__value,
.report-team__headline-score {
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    line-height: 1;
    font-weight: 700;
    margin-top: 0.4rem;
}
.report-story__detail,
.report-kpi-card__detail { font-size: 0.88rem; margin-top: 0.4rem; }
.report-story__notes { margin-top: 1rem; display: grid; gap: 0.55rem; }
.report-story__note {
    padding: 0.75rem 0.9rem;
    border-radius: var(--radius);
    background: var(--surface);
    border-left: 3px solid var(--primary);
    font-size: 0.92rem;
}
.report-team__headline-score { color: var(--primary); }
.report-section__subtitle,
.report-panel__subtitle { margin-top: 0.25rem; font-size: 0.88rem; }
.report-kpi-card__history {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.65rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}
.report-kpi-card__history span {
    padding: 0.22rem 0.45rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
}
.report-panel { overflow: hidden; }
.report-panel--danger { border-top: 3px solid var(--danger); }
.report-panel--warning { border-top: 3px solid var(--warning); }
.distribution-list,
.report-list { display: grid; gap: 0.7rem; }
.distribution-list__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(110px, 1.4fr) auto;
    gap: 0.75rem;
    align-items: center;
}
.distribution-list__label,
.report-list__title { font-weight: 600; }
.distribution-list__bar-wrap {
    height: 10px;
    background: rgba(148, 163, 184, 0.16);
    border-radius: 999px;
    overflow: hidden;
}
.distribution-list__bar { height: 100%; border-radius: 999px; }
.distribution-list__bar--success { background: var(--success); }
.distribution-list__bar--danger { background: var(--danger); }
.distribution-list__bar--warning { background: var(--warning); }
.distribution-list__bar--neutral { background: var(--primary); }
.distribution-list__value { font-weight: 700; }
.report-list__item { border-top: 1px solid var(--border); padding-top: 0.7rem; }
.report-list__item:first-child { border-top: 0; padding-top: 0; }
.report-panel__empty { color: var(--text-muted); margin: 0; }
.report-details { border-top: 1px solid var(--border); padding-top: 0.85rem; }
.report-details summary { cursor: pointer; font-weight: 600; color: var(--text); }
.report-delta--success { color: var(--success); }
.report-delta--warning { color: var(--warning); }
.report-delta--danger { color: var(--danger); }
@media (max-width: 640px) {
    .report-story__grid,
    .report-kpi-grid { grid-template-columns: 1fr; }
    .distribution-list__row { grid-template-columns: 1fr; }
    .report-story__header,
    .report-team__header,
    .report-panel__header { flex-direction: column; align-items: start; }
}

/* Presentation mode */
.slide-nav {
    position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 0.75rem;
    background: var(--surface); padding: 0.5rem 1rem; border-radius: 999px;
    box-shadow: var(--shadow-lg); z-index: 100;
}
.slide-counter { font-size: 0.85rem; color: var(--text-muted); min-width: 60px; text-align: center; }

/* PDF viewer */
.pdf-viewer { width: 100%; max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.pdf-viewer canvas { max-width: 100%; height: auto; box-shadow: var(--shadow-lg); border-radius: var(--radius); }

/* Utility */
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; } .text-center { text-align: center; } .text-muted { color: var(--text-muted); }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.gap-1 { gap: 0.5rem; } .hidden { display: none; }

/* Downloadable materials bar */
.materials-bar {
    max-width: 960px; margin: 0 auto; padding: 0.5rem 1rem;
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.material-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.8rem; background: var(--primary-light); border-radius: var(--radius);
    font-size: 0.8rem; color: var(--primary); text-decoration: none;
    border: 1px solid transparent; transition: border-color 0.15s;
    min-height: 36px;
}
.material-link:hover { border-color: var(--primary); }
.material-icon { font-size: 1rem; }
.material-dl { font-size: 0.7rem; opacity: 0.6; }

/* Countdown timer bar */
.timer-bar {
    max-width: 960px; margin: 0 auto 0.5rem; padding: 0.5rem 1rem;
    display: flex; align-items: center; gap: 0.5rem; justify-content: center;
    background: var(--success-light); border: 1px solid #6ee7b7; border-radius: var(--radius);
    font-size: 0.9rem; color: var(--success); font-weight: 600;
    position: sticky; top: 0; z-index: 50;
}
.timer-bar.timer-warning { background: var(--warning-light); border-color: #fcd34d; color: var(--warning); }
.timer-bar.timer-critical { background: var(--danger-light); border-color: #fca5a5; color: var(--danger); animation: timer-pulse 1s infinite; }
.timer-bar.timer-expired { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.timer-icon { font-size: 1.1rem; }
.timer-display { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 1.3rem; letter-spacing: 0.05em; }
.timer-label { font-weight: 400; font-size: 0.8rem; opacity: 0.8; }
@keyframes timer-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* Confidence missing highlight */
.sortable-item.confidence-missing {
    border-color: var(--danger) !important;
    background: var(--danger-light) !important;
    animation: confidence-flash 0.5s ease 2;
}
@keyframes confidence-flash { 0%, 100% { background: var(--danger-light); } 50% { background: #fecaca; } }

/* ═══════════════════════════════════════════════════════════════
   PX-01: Stage status bar
═══════════════════════════════════════════════════════════════ */
.stage-status-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
}
.stage-status-inner {
    max-width: 900px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    flex-wrap: wrap;
}
.stage-status-left { display: flex; align-items: center; gap: 0.5rem; }
.stage-status-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.stage-status-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dot--active  { background: var(--success); animation: dot-pulse 2s ease-in-out infinite; }
.dot--waiting { background: var(--warning); }
.dot--info    { background: var(--primary); }
.dot--muted   { background: var(--text-muted); }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.stage-status-label { font-weight: 500; color: var(--text); }
.stage-status-name  { color: var(--text-muted); }
.stage-status-team  {
    background: var(--primary-light); color: var(--primary);
    padding: 0.1rem 0.5rem; border-radius: 999px; font-weight: 600;
}
.stage-status-submitted {
    background: var(--success-light); color: var(--success);
    padding: 0.15rem 0.6rem; border-radius: 999px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 0.25rem;
}

/* ═══════════════════════════════════════════════════════════════
   PX-05: Accessibility baseline
═══════════════════════════════════════════════════════════════ */
/* WCAG 2.4.11 — visible focus indicator for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}
/* Remove browser default outline only when focus-visible is handled above */
*:focus:not(:focus-visible) { outline: none; }

/* aria-live status region */
.sr-status {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Page-level participant live class — hides nav on active session screens */
.page-participant-live .header-nav { display: none; }

/* ═══════════════════════════════════════════════════════════════
   PX-03: Accessible help modal
═══════════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 1rem;
    /* Closed state: opacity AND visibility. `visibility: hidden` removes the
       element from hit-testing and the accessibility tree even if `opacity: 0`
       or `pointer-events: none` are overridden by a later rule / Safari repaint
       glitch. The 0.15s visibility delay fires only on close, so the fade-out
       still animates. */
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.15s, visibility 0s linear 0.15s;
}
.modal-overlay.is-open {
    opacity: 1; visibility: visible; pointer-events: all;
    transition: opacity 0.15s, visibility 0s linear 0s;
}
/* Belt-and-braces: if an `hidden` attribute is ever set on a .modal-overlay,
   force it off the layout entirely. */
.modal-overlay[hidden] { display: none !important; }
.modal-content {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); max-width: 480px; width: 100%;
    max-height: 80vh; overflow-y: auto;
    padding: 1.5rem; position: relative;
    transform: translateY(8px); transition: transform 0.15s;
}
.modal-overlay.is-open .modal-content { transform: translateY(0); }
.modal-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; margin-bottom: 1rem;
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin: 0; }
.modal-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.25rem; line-height: 1; color: var(--text-muted);
    padding: 0.15rem 0.35rem; border-radius: 4px; flex-shrink: 0;
    min-width: 32px; min-height: 32px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { font-size: 0.9rem; line-height: 1.6; }
.modal-body h4 { font-size: 0.9rem; margin: 0.75rem 0 0.3rem; }
.activity-modal__content { max-width: 720px; }
.activity-modal__counter {
    margin: 0.3rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.activity-modal__status { margin-top: 0.2rem; margin-bottom: 0; }
.activity-modal__body { display: flex; flex-direction: column; gap: 1.15rem; }
.activity-modal__section h4 { margin-top: 0; }
.activity-modal__label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.45rem;
}
.activity-modal__note {
    min-height: 120px;
    resize: vertical;
}
.activity-modal__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.activity-modal__checkbox input {
    margin-top: 0.1rem;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: var(--primary);
}
.activity-modal__hint {
    margin-top: 0.45rem;
    font-size: 0.8rem;
}
.activity-modal__options {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.activity-modal__option {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    background: #fbfcff;
}
.activity-modal__option.activity-modal__option--selected {
    border-color: var(--primary);
    background: var(--primary-light);
}
.activity-modal__option-title {
    font-weight: 600;
    margin-bottom: 0.2rem;
}
.activity-modal__option-summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    overflow-wrap: anywhere;
}
.activity-modal__actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.activity-modal__confidence {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.activity-modal__confidence .confidence-btn {
    min-width: 56px;
    min-height: 56px;
}
.activity-modal__clear-rank,
.p-drawer__clear-rank {
    margin-top: 0.7rem;
}
@media (max-width: 640px) {
    .activity-modal {
        align-items: flex-end;
        padding: 0;
    }
    .activity-modal__content {
        width: 100%;
        max-width: none;
        min-height: min(94vh, 94svh);
        max-height: min(94vh, 94svh);
        border-radius: 22px 22px 0 0;
        padding: 1rem 1rem 1.15rem;
    }
    .activity-modal__body {
        gap: 0.85rem;
    }
    .activity-modal__section {
        min-width: 0;
    }
    .activity-modal__note {
        min-height: 104px;
    }
    .activity-modal__options {
        gap: 0.5rem;
    }
    .activity-modal__option {
        padding: 0.7rem;
    }
    .activity-modal__confidence {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }
    .activity-modal__confidence .confidence-btn {
        width: 100%;
        min-width: 0;
        min-height: 42px;
    }
    .activity-modal__actions .btn {
        width: 100%;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PX-12: Design-system additions — grid-4, alert, details toggle
═══════════════════════════════════════════════════════════════ */
.grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (min-width: 640px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* Standardised alert variants replacing inline border-left hacks */
.alert { border-radius: var(--radius); padding: 0.75rem 1rem; font-size: 0.9rem; }
.alert--error   { background: var(--danger-light);  border-left: 4px solid var(--danger);  color: #7f1d1d; }
.alert--warning { background: var(--warning-light); border-left: 4px solid var(--warning); color: #78350f; }
.alert--info    { background: var(--primary-light); border-left: 4px solid var(--primary); color: #1e3a8a; }
.alert--success { background: var(--success-light); border-left: 4px solid var(--success); color: #064e3b; }

/* details/summary toggle standardisation */
details > summary { user-select: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary .details-chevron { display: inline-block; transform: rotate(90deg); }

/* ═══════════════════════════════════════════════════════════════
   AUTH-01: Header avatar
═══════════════════════════════════════════════════════════════ */
.header-avatar {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 1.5px solid var(--border);
}
.header-avatar--initials {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-light); color: var(--primary);
    font-size: 0.75rem; font-weight: 700;
    width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
    border: 1.5px solid var(--primary);
}
