/* ============================================
   BioDOE - Exact Replica of Mockup UI
   ============================================ */

:root {
    /* Modern SaaS palette — clean neutral slate + a single indigo accent.
       No warm/brown tones anywhere. */
    --bg-base: #F8FAFC;
    --bg-surface: #ffffff;
    --bg-surface-hover: #F1F5F9;

    /* Sidebar */
    --sidebar-bg: #F8FAFC;
    --sidebar-text: #64748B;
    --sidebar-text-active: #4F46E5;
    --sidebar-active-bg: #EEF2FF;
    --sidebar-border: #E2E8F0;
    --sidebar-width: 220px;

    /* Typography */
    --text-primary: #0F172A;
    --text-secondary: #334155;
    --text-muted: #64748B;

    /* Table Headers — a single accent family, two shades, so the two
       tables read as distinct without introducing an extra hue */
    --factor-header-bg: #4F46E5;
    --response-header-bg: #0EA5E9;
    --matrix-header-bg: #4F46E5;

    /* Primary Accent — indigo */
    --teal: #4F46E5;
    --teal-hover: #4338CA;
    --teal-light: #EEF2FF;
    --teal-border: #C7D2FE;

    /* Secondary accent — emerald, for success/confirmation states */
    --agar: #059669;
    --agar-soft: #ECFDF5;
    --agar-ink: #065F46;
    --agar-border: #A7F3D0;

    /* Alert — red, used sparingly */
    --alert: #DC2626;
    --alert-soft: #FEF2F2;
    --alert-border: #FECACA;
    --alert-ink: #991B1B;

    /* Borders & Radius */
    --border-color: #E2E8F0;
    --border-light: #F1F5F9;
    --radius: 10px;
    --radius-sm: 6px;
    --topbar-height: 56px;

    /* Type system: one clean sans-serif for everything written, monospace
       reserved for tabular data so numbers line up. */
    --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* --- Reset --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* --- App Layout --- */
.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-icon {
    font-size: 26px;
    color: var(--teal);
}

.brand-title {
    font-size: 18px;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 10px;
    color: #718096;
    font-weight: 500;
}

.nav-menu {
    flex: 1;
    padding: 8px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: rgba(20, 138, 123, 0.08);
    color: var(--teal);
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 600;
}

.nav-item i {
    font-size: 15px;
    color: var(--teal);
    width: 18px;
    text-align: center;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 700;
    color: #718096;
    padding: 16px 12px 6px;
}

.btn-new-project {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    font-weight: 700;
    color: var(--teal);
    background: var(--teal-light);
    border: 1px solid var(--teal-border);
    border-radius: 999px;
    padding: 3px 9px 3px 7px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-new-project:hover {
    background: var(--teal-border);
}

.btn-new-project i {
    font-size: 13px;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 12px;
    color: var(--sidebar-text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
}

.project-item:hover {
    background: rgba(0,0,0,0.04);
}

.project-item.active {
    background: var(--sidebar-active-bg);
    color: var(--teal);
    font-weight: 600;
}

.project-item .proj-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.project-item .delete-btn {
    opacity: 0;
    font-size: 13px;
    color: #e53e3e;
    transition: opacity 0.15s;
}

.project-item:hover .delete-btn {
    opacity: 0.7;
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-base);
}

/* --- Topbar --- */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.breadcrumbs {
    font-size: 12px;
    color: var(--text-muted);
}

.breadcrumbs .highlight {
    color: var(--text-primary);
    font-weight: 500;
}

.page-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    outline: none;
}

.edit-icon {
    font-size: 14px;
    color: var(--teal);
    cursor: pointer;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Content Area --- */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* --- Views --- */
.view-section { display: none; }
.view-section.active { display: block; }

/* ============================================
   TABBED WORKSPACE — one panel full-width at a time
   ============================================ */

.workspace-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 0;
}

.workspace-tab {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-bottom: none;
    padding: 10px 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.workspace-tab:hover { color: var(--text-primary); }
.workspace-tab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.workspace-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: 0 1px 2px rgba(32,41,31,0.06), 0 6px 16px -10px rgba(32,41,31,0.22);
    transform: translateY(1px);
    position: relative;
    z-index: 1;
}

.workspace-panels {
    height: calc(100vh - var(--topbar-height) - 32px - 41px);
}

.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0 var(--radius) var(--radius) var(--radius);
    display: none;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(32,41,31,0.06), 0 6px 16px -10px rgba(32,41,31,0.22);
    width: 100%;
    height: 100%;
}

.panel.active-tab {
    display: flex;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
}

.panel-header h2 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.panel-header .panel-icon {
    font-size: 16px;
    color: var(--teal);
    cursor: pointer;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

/* --- Panel 1: Factors & Responses --- */
.section-label {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Info tooltip — replaces a paragraph of explanation with an (i) icon that
   reveals the same text on hover/focus, so the panel isn't dominated by
   prose the user only needs to read once. */
.info-tip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    font-size: 10px;
    cursor: help;
    position: relative;
    vertical-align: middle;
    text-transform: none;
    letter-spacing: normal;
}
.info-tip:hover, .info-tip:focus-visible {
    background: var(--teal-light);
    color: var(--teal-hover);
    outline: none;
}
.info-tip::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    top: 140%;
    background: var(--text-primary);
    color: var(--bg-surface);
    font-family: var(--font-body);
    font-size: 11.5px;
    font-weight: 400;
    line-height: 1.5;
    padding: 9px 11px;
    border-radius: 6px;
    width: 250px;
    box-shadow: 0 6px 16px -6px rgba(32,41,31,0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease;
    z-index: 50;
    pointer-events: none;
}
.info-tip:hover::after, .info-tip:focus-visible::after {
    opacity: 1;
    visibility: visible;
}

.panel-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 6px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.factor-table th {
    background: var(--factor-header-bg);
    color: white;
    padding: 7px 10px;
    text-align: left;
    font-weight: 700;
    font-size: 10.5px;
    font-family: var(--font-body);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.response-table th {
    background: var(--response-header-bg);
    color: white;
    padding: 7px 10px;
    text-align: left;
    font-weight: 700;
    font-size: 10.5px;
    font-family: var(--font-body);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.panel-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 12px;
}

.panel-table tr:hover td {
    background: var(--bg-surface-hover);
}

.td-actions {
    text-align: right;
    white-space: nowrap;
    width: 68px;
}

.td-actions i {
    cursor: pointer;
    font-size: 13px;
    color: var(--teal);
    margin-left: 4px;
}

/* Bigger, easier-to-hit click targets for row edit/delete icons — the plain
   13px glyphs they replaced were genuinely hard to click precisely. */
.row-action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 2px;
    transition: background .15s ease;
}
.row-action-icon:hover { background: var(--bg-surface-hover); }
.edit-factor-btn, .edit-response-btn { color: var(--teal-hover); }
.delete-factor-btn, .delete-response-btn { color: var(--alert); }

.add-link-wrapper {
    text-align: right;
    margin-bottom: 14px;
}

.add-factor-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--teal-hover);
    background: var(--teal-light);
    border: 1.5px solid var(--teal-border);
    padding: 5px 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s ease, color .15s ease, transform .15s ease;
}

.add-factor-link:hover {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
    transform: translateY(-1px);
}

/* --- Panel 2: Design of Experiment --- */
.section-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.table-responsive {
    overflow-x: auto;
    max-height: 400px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.matrix-table th {
    background: var(--matrix-header-bg);
    color: white;
    padding: 7px 8px;
    text-align: center;
    font-weight: 700;
    font-size: 10.5px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
}

.matrix-table td {
    padding: 5px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.matrix-table tr:nth-child(even) td {
    background: var(--bg-surface-hover);
}

.table-input {
    width: 100%;
    padding: 3px 4px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 11px;
    font-family: var(--font-mono);
    text-align: center;
    outline: none;
    background: var(--bg-surface);
    color: var(--text-primary);
}

.table-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 2px rgba(184, 122, 23, 0.18);
}

/* --- Editable response column header (added via the Panel 2 "+ Add
   Response" button) --- */
.response-col-header {
    min-width: 108px;
    vertical-align: top;
}

.response-col-inner {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 0;
}

.response-name-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px dashed rgba(255,255,255,0.5);
    color: white;
    font-weight: 700;
    font-size: 10.5px;
    text-transform: none;
    letter-spacing: normal;
    text-align: center;
    padding: 1px 2px;
    outline: none;
}

.response-name-input:focus {
    border-bottom-color: white;
}

.response-col-controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

.response-unit-input {
    width: 0;
    flex: 1;
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 9px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: normal;
    text-align: center;
    padding: 2px 3px;
    outline: none;
}

.response-unit-input::placeholder {
    color: rgba(255,255,255,0.65);
}

.response-goal-select {
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 3px;
    color: white;
    font-size: 9px;
    font-weight: 500;
    text-transform: none;
    padding: 2px 1px;
    outline: none;
}

.response-goal-select option {
    color: var(--text-primary);
}

.delete-response-col {
    color: white;
    opacity: 0.75;
    cursor: pointer;
    font-size: 12px;
    flex-shrink: 0;
}

.delete-response-col:hover {
    opacity: 1;
}

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

/* --- Panel 3: Data Analysis --- */
.chart-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--bg-surface);
}

.chart-heading {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
    text-align: center;
}

.plot-container {
    width: 100%;
    min-height: 180px;
}

.chart-placeholder {
    height: 160px;
    background: var(--bg-surface-hover);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: box-shadow .12s ease, background .12s ease, color .12s ease, border-color .12s ease;
    font-family: var(--font-body);
}

.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.btn-teal-filled {
    background: var(--teal);
    color: white;
    border-color: var(--teal);
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3);
}

.btn-teal-filled:hover {
    background: var(--teal-hover);
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.btn-teal-outline {
    background: var(--bg-surface);
    color: var(--teal);
    border-color: var(--border-color);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.btn-teal-outline:hover {
    background: var(--teal-light);
    border-color: var(--teal-border);
}

.btn-danger-outline {
    background: var(--bg-surface);
    color: var(--alert);
    border-color: var(--border-color);
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.btn-danger-outline:hover {
    background: var(--alert-soft);
    border-color: var(--alert-border);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
}

.surface-view-toggle {
    background: var(--bg-surface);
    color: var(--text-muted);
}

.surface-view-toggle.active {
    background: var(--teal);
    color: white;
}

/* --- Utility classes --- */
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }

/* Stats Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.data-table th {
    background: var(--matrix-header-bg);
    color: white;
    padding: 5px 6px;
    text-align: left;
    font-family: var(--font-body);
    font-size: 10.5px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 700;
}

.data-table td {
    padding: 4px 6px;
    border-bottom: 1px solid var(--border-light);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Modal Wizard Overlay */
.wizard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.wizard-overlay.active { display: flex; }

.wizard-container {
    background: var(--bg-surface);
    width: 800px;
    max-width: 90vw;
    height: 550px;
    border-radius: 12px;
    display: flex;
    box-shadow: 0 20px 40px rgba(32,41,31,0.28);
    overflow: hidden;
}

.wizard-sidebar {
    width: 200px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px 16px;
}

.wizard-sidebar h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 20px;
}

.wizard-steps { list-style: none; }
.wizard-steps li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-muted);
}

.wizard-steps li.active {
    color: var(--teal);
    font-weight: 600;
}

.step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 10px;
}

.wizard-steps li.active .step-num {
    background: var(--teal);
    color: white;
}

.wizard-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

.wizard-pane { display: none; }
.wizard-pane.active { display: block; }

.wizard-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}

.input-field {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-body);
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    min-width: 0; /* let it shrink inside a flex/grid row instead of forcing the row to overflow */
}

.input-field:focus {
    border-color: var(--teal);
}

.dial-builder {
    background: var(--bg-surface-hover);
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Range-slider dials — turning a knob, not filling a form field */
input[type="range"].dial-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--agar-soft), var(--teal-light));
    outline: none;
    margin: 10px 0 4px;
}
input[type="range"].dial-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--teal);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 1.5px var(--teal);
    cursor: pointer;
    margin-top: -6px;
}
input[type="range"].dial-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--teal);
    border: 3px solid var(--bg-surface);
    box-shadow: 0 0 0 1.5px var(--teal);
    cursor: pointer;
}
.dial-slider-endpoints {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
}

/* Live range preview under the Low/High fields when adding a numeric factor —
   the closest honest equivalent of a "dial" for a range that doesn't exist
   yet (a slider needs a domain to drag within; here the user IS defining
   that domain, so there's nothing to drag until both ends are typed). */
.range-preview { margin-top: 2px; }
.range-preview-track {
    height: 6px;
    border-radius: 99px;
    background: var(--border-color);
    position: relative;
    overflow: hidden;
}
.range-preview-fill {
    position: absolute;
    top: 0; bottom: 0; left: 0; width: 100%;
    background: linear-gradient(90deg, var(--agar), var(--teal));
    border-radius: 99px;
}
.range-preview-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.dial-input-row {
    display: flex;
    gap: 6px;
}

.dial-list { margin-top: 10px; }

.dial-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    font-size: 12px;
}

/* --- Goal cards (replaces the plain intent dropdown) --- */
.goal-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 4px;
}
@media (max-width: 900px) {
    .goal-cards { grid-template-columns: 1fr; }
}
.goal-card {
    text-align: left;
    cursor: pointer;
    background: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-family: inherit;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: border-color .15s ease, transform .15s ease, background .15s ease;
}
.goal-card:hover { transform: translateY(-1px); }
.goal-card:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.goal-card .goal-glyph { font-size: 18px; }
.goal-card .goal-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-primary);
}
.goal-card.selected {
    border-color: var(--teal);
    background: var(--teal-light);
}
.goal-card.selected .goal-name { color: var(--teal-hover); }

/* --- Mobile sidebar drawer ---
   On a phone-width viewport the fixed 220px sidebar used to eat ~40% of the
   screen permanently with no way to hide it. Below 768px it becomes an
   off-canvas drawer: hidden by default, hamburger-toggled, closes on
   backdrop tap or on navigating. */
.btn-mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 40;
}

@media (max-width: 768px) {
    .btn-mobile-menu-toggle {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 2px 0 16px rgba(15, 23, 42, 0.18);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar-backdrop.mobile-open {
        display: block;
    }

    .main-content {
        width: 100%;
        min-width: 0;
    }
}
