/* ═══════════════════════════════════════════════════════
   Mindfrog Analytics Platform — Styles
   Aesthetic: Clean pharmaceutical research tool.
   Warm neutrals, teal accent, generous whitespace.
   ═══════════════════════════════════════════════════════ */

:root {
    /* ── Palette ────────────────────────────── */
    --bg:           #FFFFFF;
    --bg-card:      #FFFFFF;
    --bg-sidebar:   #0F1C22;
    --bg-input:     #FFFFFF;
    --bg-hover:     #F1F4F5;
    --bg-band:      #F1F4F5;   /* new: metric strips, zone bands */
    --bg-code:      #2d3748;

    --text:         #0F1C22;
    --text-secondary: #4A5168;
    --text-muted:   #5A6178;   /* 4.5:1 on white; the old #9ca3af failed */
    --text-inverse: #f1f0ec;

    --accent:       #517584;
    --accent-hover: #3B5966;
    --accent-light: #E7EEF0;
    --accent-muted: rgba(81, 117, 132, 0.45);

    --warn:         #d97706;
    --warn-bg:      #fffbeb;
    --error:        #B42318;
    --error-bg:     #fef2f2;
    --success:      #059669;
    --success-bg:   #ecfdf5;

    --border:       #D9DCE8;
    --border-light: #E6E8F0;

    --shadow-sm:    none;
    --shadow:       none;
    --shadow-md:    none;
    --shadow-lg:    none;

    --radius:       12px;
    --radius-lg:    16px;
    --radius-sm:    10px;

    /* ── Typography ────────────────────────── */
    --font:         Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Space Grotesk', Inter, system-ui, sans-serif;   /* new */
    --font-mono:    'JetBrains Mono', ui-monospace, Consolas, monospace;

    /* spec_ui_consistency_1009 §3b — colours that had no token yet */
    --on-dark:        #FFFFFF;                   /* text and marks on the black sidebar / red fills */
    --on-dark-soft:   rgba(255,255,255,0.88);
    --on-dark-muted:  rgba(255,255,255,0.55);
    --on-dark-border: rgba(255,255,255,0.35);
    --on-dark-line:   rgba(255,255,255,0.14);
    --on-dark-hover:  rgba(255,255,255,0.08);
    --bg-sidebar-active: #517584;
    --text-code:      #E2E8F0;                   /* log text on --bg-code */
    --info-bg:        #E8F1FB;   --info-text:   #163A5F;   --info-border:   #B9D3EE;
    --notice-bg:      #FFF4E5;   --notice-text: #8A4B00;   --notice-border: #F5C98A;
    --veil:           rgba(255,255,255,0.72);    /* a section loading over the page */
    --spinner-track:  rgba(0,0,0,0.12);
    --overlay:        rgba(0,0,0,0.55);          /* behind a modal */
    --overlay-strong: rgba(17,17,17,0.78);       /* the server-down notice, tooltips on dark */
    /* spec_lr_frame_1124 — Lantern Road (design guide, Tokens) */
    --night:        #0F1C22;
    --slate:        #517584;
    --slate-deep:   #3B5966;
    --slate-tint:   #E7EEF0;
    --mist:         #8FA6AC;
    --gold:         #E9B85A;
    --gold-text:    #F0C66E;
    --glow:         #FFE3A3;
    --page:         #F1F4F5;
    --line:         #E6E8F0;
    --fault:        #E5484D;
    --fault-text:   #B42318;
    --bg-page:      #F1F4F5;
    --radius-xl:    26px;
    --radius-round: 50%;
    --font-body:    var(--font);
    --nav-text:     rgba(255,255,255,0.8);
    --on-dark-edge: rgba(255,255,255,0.16);
    --dusk:         linear-gradient(180deg, #0F1C22 0%, #132630 28%, #1C3644 48%, #2D4D5C 66%, #4A6068 84%, #7A6A48 100%);
    --dusk-foot:    radial-gradient(ellipse 100% 60% at 50% 115%, rgba(233,184,90,.32), rgba(233,184,90,0) 70%);
    --shadow-fly:   0 0 3px 1px rgba(255,227,163,0.85), 0 0 9px 3px rgba(233,184,90,0.40);
    --shadow-lamp:  0 0 10px rgba(233,184,90,0.55);
    --shadow-lamp-rest: 0 0 0 rgba(233,184,90,0);
    --shadow-fault: 0 0 10px rgba(229,72,77,0.50);
}


/* ── Reset ────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-page);
    font-weight: 400;
    line-height: 1.55;
    min-height: 100vh;
}
/* spec_look_1127 — a rule that begins :where(:root[data-look="mindfrog"]) (or html:where([data-look="mindfrog"])) is the Mindfrog look's version of the rule directly above it. :where() adds no weight, so which rule wins is unchanged. */
:where(:root[data-look="mindfrog"]) body { background: var(--bg); font-weight: 300; }
:where(:root[data-look="mindfrog"]) body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 3px; background: var(--brand-rule-colour); z-index: 1000; pointer-events: none; }

strong, b { font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }


/* ── Loading screen ───────────────────────────────── */

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    color: var(--text-muted);
}

.loading-logo img {
    animation: none;
}
:where(:root[data-look="mindfrog"]) .loading-logo img { animation: pulse-ring 2s ease-in-out infinite; }

@keyframes pulse-ring {
    0%, 100% { opacity: 0.6; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}


/* ═══════════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════════ */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: none;
    padding: 48px 40px;
    border: 1px solid var(--border-light);
}

.login-brand {
    text-align: center;
    margin-bottom: 36px;
}

.login-brand h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text);
    margin-top: 16px;
}

.login-brand p {
    font-size: 0.87rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-error {
    background: var(--error-bg);
    color: var(--error);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    display: none;
}

.login-error.visible { display: block; }


/* ═══════════════════════════════════════════════════════
   LAYOUT — SIDEBAR + MAIN
   ═══════════════════════════════════════════════════════ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 272px;
    background: var(--dusk);
    color: var(--on-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow: hidden;
}
:where(:root[data-look="mindfrog"]) .sidebar { width: 260px; background: var(--bg-sidebar); color: var(--text-inverse); }

.sidebar-brand {
    padding: 24px 20px 18px;
    border-bottom: 1px solid var(--on-dark-line);
}
:where(:root[data-look="mindfrog"]) .sidebar-brand { padding: 28px 24px 20px; }
:where(:root[data-look="mindfrog"]) .sidebar-brand h2 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; letter-spacing: 0.08em; }
:where(:root[data-look="mindfrog"]) .sidebar-brand span { font-size: 0.75rem; color: var(--on-dark-muted); display: block; margin-top: 2px; }

/* W6 §3 — sandbox badge beside the version; absent on prod (MINDFROG_ENV=prod). */
.sidebar-brand .mf-env-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    border-radius: 2px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.3;
    vertical-align: middle;
    color: var(--night);
    background: var(--gold);
    opacity: 1;
}
:where(:root[data-look="mindfrog"]) .sidebar-brand .mf-env-badge { color: var(--mf-env-ink); background: var(--mf-env-bg); }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    min-height: 0;
}

.nav-section-label {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mist);
    padding: 16px 12px 6px;
}
:where(:root[data-look="mindfrog"]) .nav-section-label { font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.12em; color: var(--on-dark-muted); }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    min-height: 44px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
    font-weight: 500;
    color: var(--nav-text);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
}
:where(:root[data-look="mindfrog"]) .nav-item { min-height: auto; border-radius: 0; font-size: 0.9rem; font-weight: 400; color: var(--on-dark-soft); border-left: 3px solid transparent; }

.nav-item:hover { background: var(--on-dark-hover); color: var(--on-dark); }
.nav-item.active { background: var(--slate); color: var(--on-dark); font-weight: 600; }
:where(:root[data-look="mindfrog"]) .nav-item.active { background: var(--bg-sidebar-active); border-left-color: var(--accent); }
.nav-item.disabled { opacity: 0.3; cursor: not-allowed; }
.nav-item i { width: 18px; height: 18px; opacity: 0.7; }

.nav-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 2px;
    background: transparent;
    border: 1px solid var(--on-dark-border);
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-item.completed .nav-step-num {
    background: transparent;
    border-color: var(--on-dark-muted);
    color: var(--on-dark);
}

.nav-item.active .nav-step-num { background: var(--accent); border-color: var(--accent); color: var(--on-dark); }

.sidebar-footer {
    margin: 12px;
    padding: 10px 12px;
    border: 1px solid var(--on-dark-edge);
    border-radius: var(--radius);
    background: var(--on-dark-hover);
    font-size: 13px;
    color: var(--on-dark-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
:where(:root[data-look="mindfrog"]) .sidebar-footer { margin: 0; padding: 16px 24px; border: none; border-top: 1px solid var(--on-dark-line); border-radius: 0; background: none; font-size: 0.8rem; color: var(--on-dark-muted); gap: normal; }

.sidebar-footer span { min-width: 0; overflow-wrap: anywhere; }

.sidebar-footer button {
    background: none;
    border: none;
    color: var(--on-dark-soft);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}
:where(:root[data-look="mindfrog"]) .sidebar-footer button { color: var(--on-dark-muted); font-size: 0.8rem; }

.sidebar-footer button:hover { color: var(--on-dark); background: var(--on-dark-hover); }

.main-content {
    flex: 1;
    margin-left: 272px;
    padding: 26px 44px 56px;
    max-width: 1200px;
}
:where(:root[data-look="mindfrog"]) .main-content { margin-left: 260px; padding: 44px 48px 56px; }


/* ═══════════════════════════════════════════════════════
   HOME / ENGINE SELECTION
   ═══════════════════════════════════════════════════════ */

.home-header {
    margin-bottom: 40px;
}

.home-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.home-header p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-size: 0.95rem;
}

.engine-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.engine-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 36px 32px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.engine-card:hover {
    border-color: var(--accent);
}

.engine-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.engine-card:hover::before { opacity: 1; }

.engine-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 2px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: 20px;
}

.engine-card h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.engine-card p {
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.engine-card-steps {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* ═══════════════════════════════════════════════════════
   HOME — TOP-LEVEL CARDS (3-card layout)
   ═══════════════════════════════════════════════════════ */

.home-cards-top {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.home-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.home-card:hover {
    border-color: var(--accent);
}

.home-card-accent {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
    opacity: 0;
    transition: opacity 0.2s;
}

.home-card:hover .home-card-accent { opacity: 1; }

.home-card-body {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding: 32px 36px;
}

.home-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 2px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.home-card-text h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.home-card-text p {
    font-size: 0.87rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.home-card-steps {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.home-card-badge {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--accent-light);
    color: var(--accent);
    padding: 3px 10px;
    border-radius: 2px;
}


/* ═══════════════════════════════════════════════════════
   INSTRUMENTS MODULE
   ═══════════════════════════════════════════════════════ */

.inst-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.inst-tab {
    font-size: 0.9rem;
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    font-family: var(--font);
    font-weight: 400;
    transition: color 0.15s;
}

.inst-tab:hover { color: var(--text); }

.inst-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 500;
}

.inst-tab.disabled {
    color: var(--text-muted);
    opacity: 0.5;
    cursor: not-allowed;
    font-style: italic;
}

.inst-tool-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.inst-tool-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid transparent;
}

.inst-tool-card:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}

.inst-tool-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.inst-tool-body h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.inst-tool-body p {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.inst-tool-meta {
    display: block;
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.inst-scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.inst-score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
}

.inst-score-name { color: var(--text-secondary); }

.inst-score-value {
    font-weight: 600;
    font-size: 0.82rem;
}

.inst-score-0 { color: var(--error); }
.inst-score-1 { color: var(--warn); }
.inst-score-2 { color: var(--text-secondary); }
.inst-score-3 { color: var(--success); }

/* ── Consulting depth info tooltip ───── */

.inst-info-trigger {
    position: relative;
    display: inline-block;
    margin-left: 4px;
}

.inst-info-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: 22px;
    z-index: 200;
    width: 420px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: none;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
}

.inst-info-trigger:hover .inst-info-tooltip { display: block; }

.inst-info-dims {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.inst-info-dims span {
    font-size: 0.76rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.inst-info-dims b {
    color: var(--text);
    font-weight: 600;
    margin-right: 2px;
}

/* ── In-app explainer panel ────────── */

.inst-explainer {
    padding: 16px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.inst-explainer-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.inst-explainer p { margin-bottom: 8px; }
.inst-explainer p:last-of-type { margin-bottom: 4px; }

.inst-explainer-dims {
    margin-top: 10px;
}

.inst-explainer-dims summary {
    cursor: pointer;
    font-weight: 500;
    font-size: 0.84rem;
    color: var(--accent);
}

.inst-explainer-dims summary:hover { text-decoration: underline; }

.inst-explainer-dim-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-top: 8px;
    padding-left: 4px;
}

.inst-explainer-dim-list span {
    font-size: 0.78rem;
    line-height: 1.4;
}

.inst-explainer-dim-list b {
    color: var(--text);
    font-weight: 600;
    margin-right: 2px;
}

/* ── Form helpers used by instruments (and reusable) ── */

.form-section-title {
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 16px;
    color: var(--slate);
}
:where(:root[data-look="mindfrog"]) .form-section-title { font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text); }

.form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
    margin-bottom: 16px;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 16px;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.form-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}


/* ═══════════════════════════════════════════════════════
   FORMS + INPUTS
   ═══════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 6px;
    color: var(--text);
}
:where(:root[data-look="mindfrog"]) .form-label { font-family: var(--font-display); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; }

.form-hint {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* spec_u8_ux_batch5_1004 §2b - the one line that stands where an output
   folder field was in web mode. Same type scale and muted colour as .form-hint. */
.mf-output-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* fix3 §1b - study bar: first row of the content column, on every page (spec_lr_frame_1124 §8: the white top bar). */
.mf-study-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 52px;
    padding: 8px 16px;
    margin: 0 0 22px 0;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--line);
}
:where(:root[data-look="mindfrog"]) .mf-study-bar { flex-wrap: nowrap; height: 40px; min-height: auto; padding: 0 20px; margin: 0 0 12px 0; border-radius: 2px; line-height: 1; background: var(--info-bg); color: var(--info-text); border: 1px solid var(--info-border); }

.mf-study-bar.is-empty {
    background: var(--bg-card);
    color: var(--slate-deep);
    border: 1px dashed var(--slate);
}
:where(:root[data-look="mindfrog"]) .mf-study-bar.is-empty { background: var(--notice-bg); color: var(--notice-text); border: 1px solid var(--notice-border); }

.mf-study-bar__skips {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-muted);
}
:where(:root[data-look="mindfrog"]) .mf-study-bar__skips { color: inherit; opacity: 0.85; }

.mf-study-bar__cta {
    margin-left: auto;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
}
:where(:root[data-look="mindfrog"]) .mf-study-bar__cta { color: inherit; padding: 0; border: none; border-radius: 0; background: none; opacity: 0.8; }

.mf-study-bar:hover { border-color: var(--border); }
:where(:root[data-look="mindfrog"]) .mf-study-bar:hover { filter: brightness(0.97); border-color: var(--info-border); }
:where(:root[data-look="mindfrog"]) .mf-study-bar.is-empty:hover { border-color: var(--notice-border); }

/* spec_u8_ux_batch5_1004 §3a - the bar stays at the top while the page
   scrolls; content scrolls under it (its own background, above page content)
   and every overlay (modals 1000+, picker 10000, runs list 10020, notices
   10030+) stays above it. The window scrolls, so scroll-padding-top keeps
   headings brought into view clear of it (52px bar + 22px gap). */
.mf-study-bar {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 90;
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 74px); }
html:where([data-look="mindfrog"]) { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 52px); }

/* spec_u5_ux_batch4_0930 §2a — runs in progress, any study: a count in the
   study bar (every page), its list opening under it. */
.mf-runs-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 28px; padding: 0 10px; margin-left: auto;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
    color: inherit; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
:where(:root[data-look="mindfrog"]) .mf-runs-btn { height: 26px; border: 1px solid currentColor; border-radius: 2px; background: var(--bg); }
.mf-runs-btn + .mf-study-bar__cta { margin-left: 0; }
.mf-runs-btn__count {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-sm);
    background: var(--night); color: var(--gold-text); font-size: 11px; line-height: 18px; text-align: center;
}
:where(:root[data-look="mindfrog"]) .mf-runs-btn__count { border-radius: 2px; background: var(--mf-red); color: var(--on-dark); }
/* spec_run_state_frontend_1012 §2c — waiting reviews beside the run count, never in it */
.mf-runs-btn__waiting { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.mf-runs-list__counts { padding: 0 16px 8px; }
.mf-runs-list {
    position: fixed; top: 56px; right: 24px; z-index: 10020;
    width: 380px; max-width: calc(100vw - 32px); max-height: 60vh; overflow-y: auto;
    background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border); border-radius: 2px; box-shadow: none;
    font-size: 13px;
}
.mf-runs-list__head {
    padding: 12px 16px; border-bottom: 1px solid var(--border);
    font-family: var(--font-display); font-size: 0.66rem; font-weight: 700;
    letter-spacing: 0.12em; text-transform: uppercase;
}
.mf-runs-list__empty { padding: 14px 16px; color: var(--text-secondary); }
.mf-runs-list__row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center;
    padding: 14px 16px; border-bottom: 1px solid var(--border-light);
}
.mf-runs-list__row:last-child { border-bottom: 0; }
.mf-runs-list__what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-runs-list__when { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* spec_u8_ux_batch5_1004 §4a — "<study> — <engine> <step> finished · Open":
   bottom-left of the content column, clear of the transient toasts
   (bottom-right) and the Runs list (top-right). */
.mf-finish-toasts {
    position: fixed; left: 296px; bottom: 22px; z-index: 10035;
    display: flex; flex-direction: column-reverse; gap: 8px; max-width: min(520px, calc(100vw - 312px));
}
:where(:root[data-look="mindfrog"]) .mf-finish-toasts { left: 284px; max-width: min(520px, calc(100vw - 300px)); }
.mf-finish-toast {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem 0.45rem 1rem;
    border-radius: 2px; background: var(--bg-card); color: var(--text);
    border: 1px solid var(--border); border-top: 3px solid var(--accent);
    box-shadow: none; font-size: 0.86rem;
}
.mf-finish-toast.is-failed { border-top-color: var(--error); }
/* spec_run_notices_4615_1014 §2b — "N more runs finished · Show" */
.mf-finish-toast--more { border-top-color: var(--border); color: var(--text-secondary); }
.mf-finish-toast__text { flex: 1; min-width: 0; }
@media (max-width: 900px) {
    .mf-finish-toasts { left: 244px; max-width: calc(100vw - 260px); }
}

/* spec_u5_ux_batch4_0930 §7a — a section click covers the content area at
   once; the next render replaces it with the new panel. */
.main-content { position: relative; }
.mf-section-loading {
    position: absolute; inset: 0; z-index: 50;
    display: flex; align-items: flex-start; justify-content: center; gap: 10px;
    padding-top: 120px; background: var(--veil);
    color: var(--text-secondary); font-size: 0.9rem;
}
.mf-section-loading .spinner { border-color: var(--spinner-track); border-top-color: var(--accent); }
/* spec_cross_study_1031 §2 — the cover over a study screen that is still loading */
.main-content[inert] { user-select: none; }
.mf-load-cover { position: absolute; inset: 0; z-index: 50; background: var(--bg-input);
    opacity: 0.92; display: flex; justify-content: center; align-items: flex-start; padding-top: 22vh; }
.mf-load-cover__box { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center;
    max-width: 480px; color: var(--text); }
.mf-load-cover__spinner { width: 44px; height: 44px; border-width: 4px;
    border-color: var(--spinner-track); border-top-color: var(--accent); }
.mf-load-cover__label { font-size: 1rem; }
.mf-load-cover__slow { font-size: 0.875rem; color: var(--text-secondary); min-height: 1.2em; }
/* spec_cross_study_1031 §2d — the Working indicator's spinner: a sibling of
   #mf-activity-label, inside its left padding (ring, border and colours from .spinner) */
#mf-activity-spinner { position: fixed; top: 20px; right: 16px; z-index: 10051; pointer-events: none;
    display: none; width: 16px; height: 16px; box-sizing: border-box; }
#mf-activity-spinner.is-on { display: block; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    background: var(--bg-input);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg);
}

/* spec_u5_ux_batch4_0930 §5a — every picker row on one grid: the field takes
   the row, each button a fixed column after it, so every field has the same
   width and every Browse the same x (seen on dev 4.1.24: Step 2's guide field was
   40 px narrower than Clean Transcripts). The spacing is R4's (--mf-ws-*),
   set here at the root for the pages as .mf-ws sets it for the panel. */
:root {
    --mf-ws-gap: 8px;
    --mf-ws-browse-w: 88px;     /* a picker's Browse (and desktop's Add) */
}

.file-picker {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    grid-auto-columns: var(--mf-ws-browse-w);
    column-gap: var(--mf-ws-gap);
    align-items: center;
}

.file-picker > .btn {
    width: 100%;
    justify-content: center;
}

.file-picker input {
    min-width: 0;
    width: 100%;
    font-family: var(--font);
    font-size: 0.82rem;
}
:where(:root[data-look="mindfrog"]) .file-picker input { font-family: var(--font-mono); }

.file-picker input::placeholder { color: var(--text-muted); }

.file-picker-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.file-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.file-picker-item button {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
}

.file-picker-item button:hover { color: var(--error); }


/* ═══════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    min-height: 44px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    line-height: 1;
}
:where(:root[data-look="mindfrog"]) .btn { padding: 10px 20px; min-height: 40px; border-radius: 2px; font-family: var(--font-display); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.btn-primary {
    background: var(--accent);
    color: var(--on-dark);
    border-color: var(--accent);
    min-height: 46px;
}
:where(:root[data-look="mindfrog"]) .btn-primary { min-height: 40px; }

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
:where(:root[data-look="mindfrog"]) .btn-primary:hover { border-color: var(--accent); }
.btn-primary:disabled { background: var(--accent-muted); border-color: transparent; opacity: 1; cursor: not-allowed; color: var(--on-dark); }
:where(:root[data-look="mindfrog"]) .btn-primary:disabled { border-color: var(--accent-muted); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--border);
}
:where(:root[data-look="mindfrog"]) .btn-secondary { background: var(--bg); border-color: var(--text); }

.btn-secondary:hover { background: var(--bg-hover); }
:where(:root[data-look="mindfrog"]) .btn-secondary:hover { background: var(--bg-input); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font);
    font-weight: 600;
}

.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
:where(:root[data-look="mindfrog"]) .btn-sm { font-size: 0.7rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}


/* ═══════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════ */

.page-header {
    margin-bottom: 32px;
}

.page-header h2 {
    font-family: var(--font-display);
    font-size: 46px;
    font-weight: 500;
    letter-spacing: -0.02em;
    text-transform: none;
    line-height: 1.03;
}
:where(:root[data-look="mindfrog"]) .page-header h2 { font-size: 1.95rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }

.page-header p {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 17px;
    font-weight: 400;
    max-width: 680px;
    line-height: 1.55;
}
:where(:root[data-look="mindfrog"]) .page-header p { font-size: 0.93rem; font-weight: 300; }

.page-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--slate);
    margin-bottom: 8px;
    font-weight: 600;
}
:where(:root[data-look="mindfrog"]) .page-breadcrumb { font-family: var(--font-display); font-size: 0.7rem; font-weight: inherit; letter-spacing: 0.1em; color: var(--text-secondary); }

.page-breadcrumb a { color: var(--text-muted); }
.page-breadcrumb a:hover { color: var(--accent); }


/* ═══════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    box-shadow: none;
}
:where(:root[data-look="mindfrog"]) .card { border: 1px solid var(--border); border-radius: 2px; padding: 24px; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-header h3 {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.01em;
    text-transform: none;
    color: var(--text);
}
:where(:root[data-look="mindfrog"]) .card-header h3 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }

/* spec_ui_foundation_1009 §5f — Mindfrog kit, from the Design canvas mockups */
.mf-page-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.mf-page-head__context { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; color: var(--slate); text-transform: uppercase; }
:where(:root[data-look="mindfrog"]) .mf-page-head__context { font-family: var(--font-display); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; color: var(--text); text-transform: none; }
.mf-page-title { margin: 0; font-family: var(--font-display); font-size: 46px; font-weight: 500; letter-spacing: -0.02em; text-transform: none; line-height: 1.03; }
:where(:root[data-look="mindfrog"]) .mf-page-title { font-size: 1.95rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.mf-page-lede { margin: 0; max-width: 680px; font-size: 17px; font-weight: 400; line-height: 1.55; color: var(--text-secondary); }
:where(:root[data-look="mindfrog"]) .mf-page-lede { font-size: 0.93rem; font-weight: 300; }
.mf-step-body { display: flex; flex-direction: column; gap: 32px; }
.mf-strip { background: var(--bg-band); border-top: 1px solid var(--border-light); border-bottom: 1px solid var(--border-light); padding: 18px 24px; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 24px; margin-bottom: 32px; }
.mf-strip__label { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); }
:where(:root[data-look="mindfrog"]) .mf-strip__label { font-family: var(--font-display); font-size: 0.66rem; letter-spacing: 0.12em; color: var(--text-secondary); }
.mf-strip__value { font-family: var(--font-display); font-size: 2rem; font-weight: 500; line-height: 1.1; color: var(--text); }
:where(:root[data-look="mindfrog"]) .mf-strip__value { font-weight: 700; }
.mf-strip__caption { font-family: var(--font); font-size: 0.75rem; font-weight: 400; color: var(--text-secondary); margin-top: 4px; }
.mf-hero { font-family: var(--font-display); font-size: 2.9rem; font-weight: 500; line-height: 1; color: var(--accent); }
:where(:root[data-look="mindfrog"]) .mf-hero { font-weight: 700; }
.mf-zone-title { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; text-transform: none; margin: 0 0 12px; }
:where(:root[data-look="mindfrog"]) .mf-zone-title { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
/* spec_review_speed_1013 §5a — the ADVANCED title sits beside the disclosure marker */
#inst-advanced > summary > .mf-zone-title { display: inline-block; margin: 0; }
.mf-rows { border: 1px solid var(--border); border-radius: 2px; }
.mf-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-light); }
.mf-row:last-child { border-bottom: 0; }
.mf-row__label { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--slate); }
:where(:root[data-look="mindfrog"]) .mf-row__label { font-family: var(--font-display); font-size: 0.66rem; letter-spacing: 0.1em; color: var(--text-secondary); }
/* spec_outline_layout_1104 — the Strategic Memo outline read view: three levels */
.mf-outline { display: flex; flex-direction: column; gap: 28px; max-width: 72rem; }
.mf-outline__brief { padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 8px; }
.mf-outline__questions { margin: 0 0 8px; padding-left: 0; list-style: none; font-size: 0.87rem; line-height: 1.5; }
.mf-outline__questions li { display: flex; gap: 10px; padding: 2px 0; }
.mf-outline__qid, .mf-outline__tag { font-family: var(--font-display); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1px 6px; white-space: nowrap; align-self: flex-start; }
.mf-outline__decision { margin: 0; font-weight: 600; font-size: 0.93rem; line-height: 1.5; }
.mf-outline__answer { margin: 0; font-size: 0.93rem; line-height: 1.5; }
.mf-outline__section { display: flex; flex-direction: column; gap: 12px; }
.mf-outline__heading { margin: 0; font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; line-height: 1.3; display: flex; gap: 12px; align-items: baseline; }
.mf-outline__num { font-size: 0.85rem; color: var(--text-secondary); letter-spacing: 0.06em; }
.mf-outline__lead { margin: 0; font-size: 0.93rem; line-height: 1.5; }
.mf-outline__finding { padding-left: 20px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.mf-outline__headline { margin: 0; font-size: 0.93rem; font-weight: 700; line-height: 1.4; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.mf-outline__tags { display: inline-flex; gap: 4px; }
.mf-outline__because { margin: 0; font-size: 0.87rem; line-height: 1.5; }
.mf-outline__points { margin: 0; padding-left: 20px; font-size: 0.85rem; line-height: 1.5; }
.mf-outline__points li { margin: 2px 0; }
.mf-outline__means { margin: 2px 0 0; font-size: 0.85rem; font-style: italic; line-height: 1.5; }
.mf-outline__evidence summary { color: var(--text-muted); cursor: pointer; }
.mf-outline__origin { margin-top: 2px; }
.mf-outline__options { padding-top: 8px; border-top: 1px solid var(--border); }
.mf-panel { border: 1px solid var(--text); border-radius: 2px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.mf-two-col { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; }
.mf-two-col__main { flex: 999 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 36px; }
.mf-two-col__side { flex: 1 1 320px; min-width: 0; max-width: 380px; }
/* spec_mapping_overlap_warm_1013 §2 — the construct list is sticky only
   while it sits beside the cards; once the columns wrap it is a plain block
   above them and scrolls away (a sticky full-width list covered the cards). */
.q-mapping-cols { container-type: inline-size; }
.q-construct-index { position: sticky; top: 16px; background: var(--bg); z-index: 1; }
@container (max-width: 760px) {
    .q-construct-index { position: static; max-width: none !important; flex-basis: 100%; }
}
.mf-tag { font-family: var(--font-display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 6px; border: 1px solid currentColor; border-radius: 2px; }
/* spec_ui_consistency_1009 §3e — an empty error / preflight / progress host
   in a side panel takes no gap (div only: an input or a spinner is empty too) */
.mf-panel > div:empty { display: none; }
/* addendum A2 — a multi-file picker's list inside a kit row draws no frame of
   its own: the row's frame is the one frame. Outside a row it keeps its box. */
.mf-row .file-picker-list > .mf-rows { border: 0; border-radius: 0; background: none; padding: 0; }
@media (max-width: 760px) { .mf-row { grid-template-columns: minmax(0, 1fr); } }
/* spec_nav_home_engines_1010 §4 — Run Analyses: numbered, bordered engine entries */
.mf-engines { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mf-engine { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; margin: 0; padding: 24px;
    text-align: left; font: inherit; color: var(--text); background: var(--bg-card);
    border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 2px; cursor: pointer; }
.mf-engine:hover, .mf-engine:focus-within { background: var(--bg-band); border-color: var(--text); border-top-color: var(--accent); }
/* addendum G — the whole card opens the engine (the open button's ::after covers it); the chips sit above it */
.mf-engine__open { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; margin: 0; padding: 0;
    text-align: left; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.mf-engine__open::after { content: ''; position: absolute; inset: 0; }
.mf-engine__open:focus-visible { outline: none; }
.mf-engine:has(.mf-engine__open:focus-visible), .mf-engine:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mf-engine__label { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); }
.mf-engine__title { font-family: var(--font-display); font-size: 22px; font-weight: 500; letter-spacing: -0.01em; text-transform: none; line-height: 1.2; }
:where(:root[data-look="mindfrog"]) .mf-engine__title { font-size: 20px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.mf-engine__text { font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.mf-engine__steps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.mf-engine__step { position: relative; z-index: 1; font-family: var(--font-display); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
    padding: 2px 6px; border: 1px solid var(--border); border-radius: 2px; color: var(--text-secondary); background: var(--bg-card); cursor: pointer; }
.mf-engine__step:hover, .mf-engine__step:focus-visible { color: var(--text); border-color: var(--text); }
.mf-engine__step:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 760px) { .mf-engines { grid-template-columns: minmax(0, 1fr); } }
/* spec_run_output_layout_1009 — run output full width; settings collapse */
.mf-run-output { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.mf-run-output:empty, .mf-run-output > div:empty { display: none; }
.mf-settings.is-collapsed > .mf-two-col { display: none; }
.mf-settings__bar { display: none; align-items: center; justify-content: space-between; gap: 16px;
    padding: 12px 16px; background: var(--bg-band); border: 1px solid var(--border-light); border-radius: 2px; }
.mf-settings.is-collapsed > .mf-settings__bar { display: flex; }
/* spec_run_state_frontend_1012 §4a — opened by the analyst: the bar stays, with Hide settings */
.mf-settings.has-settings-bar > .mf-settings__bar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.mf-settings__summary { font-size: 13px; color: var(--text-secondary); }
.mf-run-pointer { font-size: 13px; font-weight: 600; }


/* ═══════════════════════════════════════════════════════
   PROGRESS DISPLAY
   ═══════════════════════════════════════════════════════ */

.progress-container {
    margin: 24px 0;
}

.progress-bar-wrapper {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* spec_progress_panel_1008 §3 — nothing measured yet: a moving stripe */
.progress-bar-wrapper--waiting {
    position: relative;
}
.progress-bar-wrapper--waiting::after {
    content: "";
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    border-radius: 2px;
    background: var(--accent);
    opacity: 0.45;
    animation: progress-waiting 1.6s ease-in-out infinite;
}
@keyframes progress-waiting {
    0%   { left: -30%; }
    100% { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    .progress-bar-wrapper--waiting::after { animation: none; left: 0; width: 100%; opacity: 0.2; }
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.progress-label__clock {
    font-weight: 700;
    color: var(--text);
}

.log-output {
    background: var(--bg-code);
    color: var(--text-code);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.7;
    max-height: 320px;
    overflow-y: auto;
    margin-top: 16px;
}

.log-output .log-line {
    opacity: 0.8;
    /* web-parity-fix B2 — long lines wrap by default; the panel's toggle
       switches to a horizontal scroll (log-nowrap). */
    white-space: pre-wrap;
    word-break: break-word;
}

.log-output.log-nowrap {
    overflow-x: auto;
}

.log-output.log-nowrap .log-line {
    white-space: pre;
}

.log-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.log-tools .log-wrap-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.log-output .log-line:last-child {
    opacity: 1;
    color: var(--on-dark);
}

/* spec_p1 §4 — the run panel: analyst lines in plain type, then the
   activity pulse, then "Technical details" (collapsed; the monospace log). */
.run-log {
    margin-top: 16px;
}

.run-log .log-analyst {
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--text);
    max-height: 260px;
    overflow-y: auto;
}

.run-log .log-analyst .log-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.run-log .log-analyst .log-line[data-kind="failure"] {
    color: var(--error);
}

/* spec_run_state_frontend_1012 §2b — "Earlier run not found on this server" */
.run-log .log-analyst .log-line[data-kind="muted"] {
    color: var(--text-muted);
}

.run-log .log-stall {
    margin-top: 4px;
    font-size: 0.84rem;
    color: var(--warn);
}

.run-log .log-pulse {
    margin-top: 6px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.run-log .log-pulse:empty {
    display: none;
}

.run-log .log-technical {
    margin-top: 10px;
}

.run-log .log-technical-summary {
    cursor: pointer;
    font-family: var(--font-display);
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.run-log .log-technical .log-output {
    margin-top: 8px;
}

.run-log.log-nowrap .log-output {
    overflow-x: auto;
}

.run-log.log-nowrap .log-output .log-line {
    white-space: pre;
}


/* ═══════════════════════════════════════════════════════
   STEP INDICATOR
   ═══════════════════════════════════════════════════════ */

.step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 32px;
}

.step-dot {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.step-dot.active { color: var(--accent); font-weight: 500; }
.step-dot.completed { color: var(--success); }

.step-dot-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
}

.step-dot.active .step-dot-circle {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-dark);
}

.step-dot.completed .step-dot-circle {
    border-color: var(--border);
    background: transparent;
    color: var(--text-primary);
}
/* spec_step_icons_1103 — a step's icon, and the check after a finished step (never tinted) */
.mf-step-icon { width: 16px; height: 16px; margin-right: 8px; flex-shrink: 0; }
.mf-step-check { width: 14px; height: 14px; margin-left: 4px; color: var(--text-secondary); vertical-align: -2px; }

.step-connector {
    flex: 1;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
}

.step-connector.completed { background: var(--success); }


/* ═══════════════════════════════════════════════════════
   OUTPUT FILES
   ═══════════════════════════════════════════════════════ */

.output-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.output-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.output-file:hover { background: var(--bg-hover); }

.output-file-name {
    flex: 1;
    font-size: 0.87rem;
    font-weight: 500;
}

.output-file-size {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.output-file a {
    font-size: 0.82rem;
    font-weight: 500;
}


/* ═══════════════════════════════════════════════════════
   ALERTS
   ═══════════════════════════════════════════════════════ */

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-info    { background: var(--bg-input); color: var(--text-secondary); }
.alert-warning { background: var(--warn-bg); color: var(--warn); }

/* spec_hold_statements_1115 §7 — printing a receipt prints the receipt alone */
@media print {
    body:has(#statements-receipt) * { visibility: hidden; }
    body:has(#statements-receipt) #statements-receipt,
    body:has(#statements-receipt) #statements-receipt * { visibility: visible; }
    body:has(#statements-receipt) #statements-receipt { position: absolute; left: 0; top: 0; width: 100%; }
}
.alert-error   { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-guidance { background: var(--accent-light); color: var(--text); border-left: 3px solid var(--accent); border-radius: 2px; }
.alert-info svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; margin-top: 1px; }


/* ═══════════════════════════════════════════════════════
   FRAMEWORK EDITOR (Quant)
   ═══════════════════════════════════════════════════════ */

.objective-card {
    background: var(--bg-input);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 12px;
}

.objective-card h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.objective-qids {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.qid-tag {
    display: inline-block;
    padding: 3px 8px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 2px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    font-weight: 500;
}


/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    .engine-cards { grid-template-columns: 1fr; }
    .sidebar { width: 220px; }
    .main-content { margin-left: 220px; padding: 28px 24px; }
    .home-card-body { padding: 24px 20px; gap: 16px; }
    .inst-scores-grid { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════ */

.mt-4  { margin-top: 16px; }
.mt-6  { margin-top: 24px; }
.mt-8  { margin-top: 32px; }
.mb-4  { margin-bottom: 16px; }
.mb-6  { margin-bottom: 24px; }
.gap-3 { gap: 12px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm { font-size: 0.87rem; }
.text-xs { font-size: 0.78rem; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.font-mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--on-dark-border);
    border-top-color: var(--on-dark);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* spec_ui_consistency_1009 §3e — the Navigator workspace rules have ONE
   source: the stylesheet navigator.js injects. Only the rules it does not
   define stay here. */

/* Drag handle between the workspace + chat columns. Sized to be
   discoverable without taking up obvious vertical space. The full
   handle is a 10px-tall hit zone; the visible accent bar is a 4px
   strip centered inside, with a hover state that brightens to the
   accent color so the analyst notices the affordance.

   The handler (Navigator._startChatResize) mutates style.height on
   both columns inline; persisted to localStorage on mouseup and
   restored via Navigator._applySavedChatHeights after every render. */

.nav-chat-resize-handle {
    height: 10px;
    margin: -2px 0;            /* tightens the gap so the handle
                                  doesn't add visual height between
                                  the columns when not hovered */
    cursor: row-resize;
    position: relative;
    flex-shrink: 0;
    user-select: none;
    z-index: 5;
}

.nav-chat-resize-handle::before {
    content: "";
    position: absolute;
    left: 25%;
    right: 25%;
    top: 50%;
    transform: translateY(-50%);
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background 120ms ease, height 120ms ease;
}

.nav-chat-resize-handle:hover::before,
.nav-chat-resize-handle:active::before {
    background: var(--accent);
    height: 5px;
}

/* Subtle "grip" cue: three small dots overlaid on the bar so the
   handle reads as a control, not decoration. Pure CSS — no extra
   markup. */

.nav-chat-resize-handle::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 36px;
    height: 4px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, var(--text-muted) 1px, transparent 1.5px) 0 0 / 8px 8px repeat-x;
    opacity: 0.6;
    pointer-events: none;
}

.nav-chat-resize-handle:hover::after,
.nav-chat-resize-handle:active::after {
    opacity: 1;
}

/* Branding: "MiNDai" — "ai" smaller and italic, flush at the baseline,
   wrapped in a no-break container so it never splits across lines. */
.brand-mark {
    white-space: nowrap;
}
.brand-ai {
    font-size: 0.62em;
    font-style: italic;
    font-weight: 400;
    letter-spacing: 0;
    opacity: 0.85;
}


/* ─── Construct mapping hover tooltips ────────────────────────────── */
.mf-hover-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: help;
    user-select: none;
    transition: color 0.15s;
    line-height: 1;
    vertical-align: middle;
}
.mf-hover-icon:hover, .mf-hover-icon:focus {
    color: var(--accent);
    outline: none;
}
.mf-hover-tip {
    position: fixed;
    z-index: 9999;
    max-width: 360px;
    min-width: 280px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 2px;
    box-shadow: none;
    padding: 12px 14px 10px;
    font-size: 0.83rem;
    line-height: 1.4;
    display: none;
    pointer-events: auto;
}
.mf-tip-block {
    margin-bottom: 8px;
}
.mf-tip-block:last-child {
    margin-bottom: 0;
}
.mf-tip-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 3px;
}
.mf-tip-body {
    color: var(--text-secondary);
}


/* ══════════════════════════════════════════════════════════════════════
   W7 — the study picker and the Workspace panel.
   mindfrog-brand + mindfrog-rip-design: zones, not cards. White ground, 1px
   var(--border) rules, no shadows, no gradients, radius ≤ 2px; red only where it
   means something — the brand rule, the current folder, the selected row,
   the one primary action. Headlines in ITC Avant Garde Gothic → Century
   Gothic → Futura, UPPERCASE; body Helvetica Neue 300, line-height ≥ 1.5.
   ══════════════════════════════════════════════════════════════════════ */
:root {
    --mf-red: var(--accent, #E83524);
    --mf-red-hover: var(--accent-hover, #B82A1C);
    --mf-black: var(--text);
    --mf-grey-1: var(--text-muted);
    --mf-grey-2: var(--border);
    --mf-grey-3: var(--text-secondary);
    --mf-off: var(--bg-hover);
    --mf-head: 'ITC Avant Garde Gothic', 'Century Gothic', 'Futura', 'Trebuchet MS', sans-serif;
    --mf-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.mf-picker-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: var(--overlay);
    display: flex; align-items: center; justify-content: center;
}

.mf-picker, .mf-ws {
    background: var(--bg); color: var(--mf-black);
    font-family: var(--mf-body); font-weight: 300; line-height: 1.5;
    border-top: 3px solid var(--mf-red);          /* the brand rule */
    border-radius: 0 0 2px 2px;
    display: flex; flex-direction: column;
}
.mf-picker { width: min(970px, 96vw); height: min(600px, 92vh); }
.mf-ws { width: min(620px, 96vw); max-height: 92vh; overflow: auto; padding-bottom: 20px; }
@media (max-width: 720px) {
    .mf-picker { width: 100vw; height: 100vh; border-radius: 0; }
    .mf-picker__tree { display: none; }
}

.mf-picker__head, .mf-ws__head {
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px;
    padding: 18px 24px 12px; border-bottom: 1px solid var(--mf-grey-2);
}
.mf-picker__title, .mf-ws__title, .mf-ws__label {
    font-family: var(--mf-head); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; font-size: 13px; color: var(--mf-black);
}
.mf-picker__study, .mf-ws__study { font-size: 14px; color: var(--mf-grey-3); }

.mf-picker__bar {
    display: flex; align-items: center; gap: 16px;
    padding: 10px 24px; border-bottom: 1px solid var(--mf-grey-2);
}
.mf-picker__crumbs {
    flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
    font-size: 13px; color: var(--mf-grey-3);
}
.mf-picker__crumb {
    background: none; border: 0; padding: 0; font: inherit; color: var(--mf-grey-3); cursor: pointer;
}
.mf-picker__crumb:hover, .mf-picker__crumb.is-current { color: var(--mf-black); }
.mf-picker__crumb.is-current { font-weight: 400; cursor: default; }
.mf-picker__sep { color: var(--mf-grey-1); }
input.mf-picker__search {
    width: 260px; max-width: 40%; padding: 6px 10px;
    border: 1px solid var(--mf-grey-2); border-radius: 2px; background: var(--bg);
    font-family: var(--mf-body); font-weight: 300; font-size: 13px; color: var(--mf-black);
    box-shadow: none; transition: none;
}
input.mf-picker__search:focus { border-color: var(--mf-black); box-shadow: none; background: var(--bg); }

.mf-picker__body { flex: 1; display: flex; min-height: 0; }
.mf-picker__tree {
    width: 260px; flex: 0 0 260px; overflow: auto;
    border-right: 1px solid var(--mf-grey-2); padding: 8px 0;
}
.mf-picker__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mf-picker__count {
    padding: 8px 24px; font-size: 12px; color: var(--mf-grey-3);
    border-bottom: 1px solid var(--mf-grey-2);
}
/* W7-polish §1.1 — the tree on screen is the one we last saw; this says a
   fresh one is on its way. Only ever visible over an already-drawn tree. */
.mf-picker__chip {
    padding: 5px 24px; font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--mf-grey-3); background: var(--mf-off);
    border-bottom: 1px solid var(--mf-grey-2);
}
.mf-picker__list { flex: 1; overflow: auto; }

.mf-picker__node {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 5px 16px; border: 0; border-left: 3px solid transparent;
    background: none; font-family: var(--mf-body); font-weight: 300; font-size: 13px;
    color: var(--mf-black); text-align: left; cursor: pointer; line-height: 1.5;
}
.mf-picker__node:hover { background: var(--mf-off); }
.mf-picker__node.is-current { border-left-color: var(--mf-red); color: var(--mf-red); font-weight: 400; }

.mf-picker__row {
    display: grid; grid-template-columns: minmax(0, 1fr) 64px 84px 110px 56px; align-items: center; gap: 12px;
    padding: 7px 24px 7px 21px; border-left: 3px solid transparent;
    border-bottom: 1px solid var(--mf-off); font-size: 13px; cursor: pointer;
}
.mf-picker__row:hover { background: var(--mf-off); }
.mf-picker__row.is-selected { border-left-color: var(--mf-red); background: var(--mf-off); }
.mf-picker__row.is-selected .mf-picker__name { color: var(--mf-red); font-weight: 400; }
.mf-picker__row.is-highlight { outline: 1px solid var(--mf-black); outline-offset: -1px; }
.mf-picker__row.is-dim { color: var(--mf-grey-1); cursor: default; }
.mf-picker__row.is-dim:hover { background: none; }
.mf-picker__del {
    border: 0; background: none; padding: 0;
    font-family: var(--mf-body); font-weight: 300; font-size: 12px;
    color: var(--mf-grey-1); cursor: pointer; text-align: right;
}
.mf-picker__del:hover, .mf-picker__del:focus-visible { color: var(--mf-red); text-decoration: underline; }
/* spec_picker_full_names_0924 — the whole name, up to two lines (versions of a
   document differ only at the end); the title attribute carries the rest. */
.mf-picker__name {
    min-width: 0; white-space: normal; overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; line-height: 1.3;
}
/* The folder tree's names stay on one line. */
.mf-picker__name--crumb {
    white-space: nowrap; text-overflow: ellipsis; display: inline; -webkit-line-clamp: unset;
}
.mf-picker__type {
    font-family: var(--mf-head); font-size: 10px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--mf-grey-3);
}
.is-dim .mf-picker__type { color: var(--mf-grey-1); }
.mf-picker__meta { font-size: 12px; color: var(--mf-grey-3); text-align: right; white-space: nowrap; }
.mf-picker__badge {
    font-family: var(--mf-head); font-size: 10px; letter-spacing: 0.06em;
    text-transform: uppercase; color: var(--mf-red); margin-left: 8px; white-space: nowrap;
}
.mf-picker__empty { padding: 48px 24px; text-align: center; color: var(--mf-grey-3); font-size: 14px; }

.mf-picker__foot {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 24px; border-top: 1px solid var(--mf-grey-2);
}
.mf-picker__status {
    flex: 1; min-width: 0; font-size: 12px; color: var(--mf-grey-3);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mf-picker__btn, .mf-picker__add, .mf-ws__btn {
    font-family: var(--mf-head); font-weight: 700; font-size: 12px; letter-spacing: 0.08em;
    text-transform: uppercase; padding: 9px 18px; line-height: 1;
    border: 1px solid var(--mf-black); border-radius: 2px;
    background: var(--bg); color: var(--mf-black); cursor: pointer;
}
.mf-picker__btn:hover, .mf-picker__add:hover, .mf-ws__btn:hover { background: var(--mf-off); }
.mf-picker__btn--primary, .mf-ws__btn--primary { background: var(--mf-red); border-color: var(--mf-red); color: var(--on-dark); }
.mf-picker__btn--primary:hover, .mf-ws__btn--primary:hover { background: var(--mf-red-hover); border-color: var(--mf-red-hover); }
.mf-picker__btn:disabled, .mf-picker__add:disabled, .mf-ws__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.mf-picker__add { border-color: var(--mf-grey-2); }
/* spec_r4_workspace_panel_layout_0930 §4c — destructive, not primary: outlined
   red at rest and on hover. The panel's one filled red button is Download. */
.mf-ws__btn--danger { border-color: var(--mf-red); color: var(--mf-red); }
.mf-ws__btn--danger:hover { background: var(--accent-light); }

/* spec_r4 §4d — the panel's spacing, from one set of variables. */
.mf-ws {
    --mf-ws-pad-x: 24px;        /* card side padding */
    --mf-ws-section-gap: 16px;  /* above each section */
    --mf-ws-gap: 8px;           /* between buttons, under a section title */
    --mf-ws-col-gap: 12px;      /* between a row's columns */
    --mf-ws-row-h: 34px;        /* one study / folder / file row */
    --mf-ws-meta-w: 150px;      /* date · N files, or a size */
    --mf-ws-open-w: 64px;       /* the study row's Open */
    --mf-ws-del-w: 48px;        /* the quiet Delete */
    --mf-ws-dl-w: 72px;         /* a file row's Download (spec_465_ui_1012 §5b) */
    --mf-ws-indent: 16px;       /* one tree step */
}
.mf-ws__section { padding: var(--mf-ws-section-gap) var(--mf-ws-pad-x) 0; }
.mf-ws__label { margin-bottom: var(--mf-ws-gap); }
.mf-ws__row { display: flex; flex-wrap: wrap; gap: var(--mf-ws-gap); align-items: center; }
.mf-ws__row .mf-ws__btn { white-space: nowrap; }
.mf-ws__line { font-size: 13px; color: var(--mf-grey-3); margin-top: var(--mf-ws-gap); }
.mf-ws__expiry {
    display: flex; align-items: center; gap: 8px; color: var(--error); overflow-wrap: anywhere;
    font-size: 12px; margin-top: 0; padding: 0 0 8px var(--mf-ws-indent);
    border-bottom: 1px solid var(--border-light);
}
.mf-ws__srow.mf-ws__srow--expiring { border-bottom: 0; }
.mf-ws__retention { padding: var(--mf-ws-section-gap) var(--mf-ws-pad-x) 0; }
#mf-panel-delete { margin-top: var(--mf-ws-gap); }
.mf-ws__counts { font-size: 13px; border-top: 1px solid var(--border-light); }
/* spec_ui_consistency_1009 §3e — study, folder and file rows as kit row lines:
   one hairline divider each, folder names in the display face, the row
   actions (Open, Delete) as text links. */
.mf-ws__count {
    display: grid; grid-template-columns: minmax(0, 1fr) var(--mf-ws-meta-w) var(--mf-ws-del-w);
    align-items: center; column-gap: var(--mf-ws-col-gap); min-height: var(--mf-ws-row-h);
    border-bottom: 1px solid var(--border-light);
}
.mf-ws__srow .mf-ws__name-text,
.mf-ws__toggle:not(.mf-ws__toggle--none) + .mf-ws__name-text { font-family: var(--font-display); font-weight: 700; }
/* spec_465_ui_1012 §5b — folder and file rows: name · N files or size · Download · Delete. */
.mf-ws__tree-row {
    grid-template-columns: minmax(0, 1fr) var(--mf-ws-meta-w) var(--mf-ws-dl-w) var(--mf-ws-del-w);
}
/* §2a — the study list: name · date · N files · Open · Download · Delete, every row (spec_flow3_1108 §5). */
.mf-ws__srow {
    --mf-ws-del-w: 80px;        /* spec_screens_fixup_1110 §6 — "Delete study" */
    grid-template-columns: minmax(0, 1fr) var(--mf-ws-meta-w) var(--mf-ws-open-w) var(--mf-ws-dl-w) var(--mf-ws-del-w);
}
.mf-ws__name { min-width: 0; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.mf-ws__name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-ws__open-mark { flex: none; color: var(--mf-grey-3); font-size: 12px; }
.mf-ws__meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: right; }
.mf-ws__btn.mf-ws__btn--sm {
    justify-self: end; width: auto; padding: 2px 0; border: 0; border-radius: 0; background: none;
    font-family: var(--font); font-weight: 400; font-size: 12px; letter-spacing: 0; text-transform: none;
    color: var(--accent); white-space: nowrap;
}
.mf-ws__btn.mf-ws__btn--sm:hover, .mf-ws__btn.mf-ws__btn--sm:focus-visible { background: none; text-decoration: underline; }
/* the study row's "Download deliverables" wraps inside its column rather than spilling over Open */
.mf-ws__srow .mf-ws__btn.mf-ws__btn--sm[id^="mf-panel-srow-dl-"] { white-space: normal; text-align: right; }
.mf-ws__toggle {
    flex: none; width: var(--mf-ws-indent); padding: 0; border: 0; background: none;
    color: inherit; cursor: pointer; text-align: left; font: inherit;
}
.mf-ws__toggle--none { cursor: default; }
.mf-ws__tree-empty { line-height: var(--mf-ws-row-h); }
/* §4b — Delete is quiet: grey text at rest, red on hover or focus. */
.mf-ws__del {
    justify-self: end; padding: 2px 0; border: 0; background: none; cursor: pointer;
    font-family: var(--mf-body); font-size: 12px; color: var(--mf-grey-3); white-space: nowrap;
}
.mf-ws__del:hover, .mf-ws__del:focus-visible { color: var(--mf-red); text-decoration: underline; }
.mf-ws__del:focus-visible { outline: 1px solid var(--mf-red); outline-offset: 2px; }
.mf-ws__del:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: none; }
/* spec_465_ui_1012 §5b — Download as quiet as Delete, but not red: it destroys nothing. */
.mf-ws__dl {
    justify-self: end; padding: 2px 0; border: 0; background: none; cursor: pointer;
    font-family: var(--mf-body); font-size: 12px; color: var(--mf-grey-3); white-space: nowrap;
}
.mf-ws__dl:hover, .mf-ws__dl:focus-visible { color: var(--text); text-decoration: underline; }
.mf-ws__dl:focus-visible { outline: 1px solid var(--text); outline-offset: 2px; }
.mf-ws__dl:disabled { opacity: 0.4; cursor: not-allowed; text-decoration: none; }
.mf-ws__sub { color: var(--mf-grey-3); font-size: 12px; }
.mf-ws__rule { border-top: 1px solid var(--mf-grey-2); margin: 20px var(--mf-ws-pad-x) 0; }
