/* ── Theme Tokens ── */
/* Dark theme */
[data-theme="dark"], [data-theme="system"] {
    --sh-bg: #0c0e14;
    --sh-surface: #141620;
    --sh-surface-2: #1a1d2b;
    --sh-panel: #111827;
    --sh-border: #2a2d3a;
    --sh-border-light: #363949;
    --sh-accent: #3b82f6;
    --sh-accent-hover: #2563eb;
    --sh-accent-muted: rgba(59,130,246,0.15);
    --sh-text: #f1f5f9;
    --sh-text-2: #94a3b8;
    --sh-text-3: #64748b;
    --sh-success: #22c55e;
    --sh-warning: #f59e0b;
    --sh-error: #ef4444;
    --sh-shadow: 0 16px 40px rgba(0,0,0,0.22);
    --sh-radius: 8px;
    --sh-radius-sm: 6px;
    --sh-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Light theme */
[data-theme="light"] {
    --sh-bg: #f8fafc;
    --sh-surface: #ffffff;
    --sh-surface-2: #f1f5f9;
    --sh-panel: #ffffff;
    --sh-border: #e2e8f0;
    --sh-border-light: #cbd5e1;
    --sh-accent: #2563eb;
    --sh-accent-hover: #1d4ed8;
    --sh-accent-muted: rgba(37,99,235,0.1);
    --sh-text: #0f172a;
    --sh-text-2: #475569;
    --sh-text-3: #94a3b8;
    --sh-success: #16a34a;
    --sh-warning: #d97706;
    --sh-error: #dc2626;
    --sh-shadow: 0 18px 42px rgba(15,23,42,0.08);
    --sh-radius: 8px;
    --sh-radius-sm: 6px;
    --sh-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* System mode — follow OS preference */
@media (prefers-color-scheme: light) {
    [data-theme="system"] {
        --sh-bg: #f8fafc;
        --sh-surface: #ffffff;
        --sh-surface-2: #f1f5f9;
        --sh-border: #e2e8f0;
        --sh-border-light: #cbd5e1;
        --sh-accent: #2563eb;
        --sh-accent-hover: #1d4ed8;
        --sh-accent-muted: rgba(37,99,235,0.1);
        --sh-text: #0f172a;
        --sh-text-2: #475569;
        --sh-text-3: #94a3b8;
        --sh-success: #16a34a;
        --sh-warning: #d97706;
        --sh-error: #dc2626;
    }
}

@media (prefers-color-scheme: dark) {
    [data-theme="system"] {
        --sh-bg: #0c0e14;
        --sh-surface: #141620;
        --sh-surface-2: #1a1d2b;
        --sh-border: #2a2d3a;
        --sh-border-light: #363949;
        --sh-accent: #3b82f6;
        --sh-accent-hover: #2563eb;
        --sh-accent-muted: rgba(59,130,246,0.15);
        --sh-text: #f1f5f9;
        --sh-text-2: #94a3b8;
        --sh-text-3: #64748b;
        --sh-success: #22c55e;
        --sh-warning: #f59e0b;
        --sh-error: #ef4444;
    }
}

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

html, body {
    height: 100%;
    background: var(--sh-bg);
    color: var(--sh-text);
    font-family: var(--sh-font);
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body {
    min-width: 320px;
}

a { color: var(--sh-accent); text-decoration: none; }
a:hover { color: var(--sh-accent-hover); text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { color: var(--sh-text); font-weight: 600; letter-spacing: 0; line-height: 1.25; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p, span, label, li { color: var(--sh-text-2); font-size: 0.875rem; line-height: 1.7; }
p + p { margin-top: 0.65rem; }
strong { color: var(--sh-text); font-weight: 600; }

/* ── Layout ── */
.app-layout { display: flex; min-height: 100vh; align-items: flex-start; }

/* ── Sidebar ── */
.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: color-mix(in srgb, var(--sh-surface) 92%, var(--sh-bg));
    border-right: 1px solid var(--sh-border);
    display: flex;
    flex-direction: column;
    padding: 1.1rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header { text-align: left; margin-bottom: 1.5rem; }
.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.75rem;
    border-radius: var(--sh-radius);
    background: var(--sh-accent);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}
.sidebar-title { font-size: 1rem; color: var(--sh-text); margin-bottom: 0.35rem; }
.sidebar-tagline { font-size: 0.75rem; color: var(--sh-text-3); line-height: 1.45; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 2.35rem;
    padding: 0.55rem 0.7rem;
    border-radius: var(--sh-radius-sm);
    color: var(--sh-text-2);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
}
.nav-item:hover { background: var(--sh-surface-2); color: var(--sh-text); text-decoration: none; }
.nav-item.active { background: var(--sh-accent-muted); color: var(--sh-accent); box-shadow: inset 3px 0 0 var(--sh-accent); }
.nav-icon { font-size: 1.1rem; line-height: 1; }

.sidebar-footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--sh-border); text-align: center; }
.theme-switcher { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.theme-btn {
    background: var(--sh-surface-2);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    min-height: 2rem;
    padding: 0.35rem 0.55rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    transition: all 0.15s ease;
}
.theme-btn:hover { border-color: var(--sh-accent); background: var(--sh-accent-muted); }
.sidebar-version { font-size: 0.75rem; color: var(--sh-text-3); }
.sidebar-made { font-size: 0.7rem; color: var(--sh-text-3); margin-top: 0.25rem; }
.lang-switcher,
.model-switcher { margin-top: 0.5rem; text-align: left; }
.lang-switcher label,
.model-switcher label { font-size: 0.6875rem; color: var(--sh-text-3); margin-bottom: 0.25rem; }
.lang-switcher select,
.model-switcher select { font-size: 0.75rem; padding: 0.35rem 0.5rem; min-height: 0; }

/* ── Main Content ── */
.main-content {
    flex: 1;
    padding: 2rem clamp(1rem, 3vw, 3rem) 3rem;
    min-width: 0;
    max-width: 1240px;
    width: 100%;
}

.page-header { max-width: 760px; margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: 0.75rem; }
.page-header p { font-size: 0.95rem; color: var(--sh-text-2); }

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.36fr);
    gap: 1.25rem;
    align-items: stretch;
    padding: 1.4rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: linear-gradient(180deg, var(--sh-surface), var(--sh-panel));
    box-shadow: var(--sh-shadow);
}

.dashboard-hero h1 {
    max-width: 760px;
    margin: 0.25rem 0 0.75rem;
    font-size: clamp(1.8rem, 3vw, 2.45rem);
}

.dashboard-hero p {
    max-width: 760px;
    font-size: 0.95rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 1rem;
}

.hero-status,
.contact-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface-2);
}

.status-dot {
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: var(--sh-success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--sh-success) 18%, transparent);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.85rem;
    margin: 1rem 0 1.25rem;
}

.section-block {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sh-border);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.section-heading p,
.two-column-workflow > div > p {
    color: var(--sh-text-3);
    font-size: 0.85rem;
}

.feature-grid,
.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.two-column-workflow {
    display: grid;
    grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
    gap: 1rem;
}

.workflow-list {
    display: grid;
    gap: 0.35rem;
}

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
    gap: 1.25rem;
    align-items: start;
}

.side-panel {
    position: sticky;
    top: 1rem;
    padding: 1rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
}

.qa-search-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
    padding: 0.85rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
    margin-bottom: 1rem;
}

.qa-search-panel .hx-indicator {
    grid-column: 1 / -1;
    justify-content: flex-start;
}

.sample-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sample-list .btn {
    justify-content: flex-start;
    text-align: left;
    white-space: normal;
}

.library-row {
    padding: 0.35rem 0;
    border-top: 1px solid var(--sh-border);
}

.contact-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
    gap: 1.25rem;
    padding: 1.1rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
}

.service-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 1rem;
}

.service-list span {
    display: inline-flex;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    background: var(--sh-surface-2);
    color: var(--sh-text-2);
    font-size: 0.78rem;
    font-weight: 600;
}

.service-card {
    min-height: 132px;
    padding: 1rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    background: var(--sh-surface);
}

.service-card p {
    margin-top: 0.45rem;
    font-size: 0.82rem;
}

.cta-band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--sh-accent);
    border-radius: var(--sh-radius);
    background: var(--sh-accent-muted);
}

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--sh-border); margin: 2rem 0; }

/* ── Buttons ── */
.btn, button, .st-button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--sh-surface-2);
    color: var(--sh-text);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.375rem 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    line-height: 1.5;
    text-decoration: none;
}
.btn:hover, button:hover { border-color: var(--sh-border-light); background: var(--sh-surface); text-decoration: none; }
.btn-primary, button[type="primary"], button.primary {
    background: var(--sh-accent);
    color: #ffffff;
    border-color: var(--sh-accent);
}
.btn-primary:hover, button[type="primary"]:hover, button.primary:hover {
    background: var(--sh-accent-hover);
    border-color: var(--sh-accent-hover);
}
.btn-block { width: 100%; justify-content: center; }
.btn-danger { background: var(--sh-error); color: #fff; border-color: var(--sh-error); }

/* ── Inputs ── */
input, textarea, select {
    background: var(--sh-surface-2);
    color: var(--sh-text);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-family: inherit;
    line-height: 1.5;
    transition: border-color 0.15s ease;
    width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sh-accent); box-shadow: 0 0 0 2px var(--sh-accent-muted); }
textarea { resize: vertical; min-height: 65px; }
select { cursor: pointer; }
label { display: block; margin-bottom: 0.375rem; font-size: 0.8125rem; font-weight: 500; color: var(--sh-text-2); }
.form-label { margin-bottom: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: var(--sh-text-2); }

.visit-type-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.5rem;
}

.visit-type-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    background: var(--sh-surface);
    color: var(--sh-text-2);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.visit-type-button:hover {
    border-color: var(--sh-border-light);
    background: var(--sh-surface-2);
    color: var(--sh-text);
    text-decoration: none;
}

.visit-type-button.active {
    border-color: var(--sh-accent);
    background: var(--sh-accent-muted);
    color: var(--sh-accent);
    box-shadow: inset 0 0 0 1px var(--sh-accent);
}

.tools-control-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.protocol-control {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 220px;
}

.protocol-control label {
    margin: 0;
}

.tool-filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2.5rem;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--sh-accent);
    border-radius: var(--sh-radius-sm);
    background: var(--sh-accent-muted);
    color: var(--sh-accent);
    font-size: 0.835rem;
    font-weight: 600;
    line-height: 1.25;
}

.tool-button-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.5rem;
}

.tool-button {
    justify-content: flex-start;
    min-height: 2.75rem;
    padding: 0.65rem 0.85rem;
    background: var(--sh-surface);
    color: var(--sh-text-2);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    font-size: 0.835rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
}

.tool-button:hover {
    background: var(--sh-surface-2);
    color: var(--sh-text);
    border-color: var(--sh-border-light);
}

.tool-button.active {
    background: var(--sh-accent-muted);
    color: var(--sh-accent);
    border-color: var(--sh-accent);
    box-shadow: inset 3px 0 0 var(--sh-accent);
}

.section-label {
    color: var(--sh-text-3);
    font-size: 0.85em;
    font-weight: 600;
}

.section-label span {
    color: var(--sh-text-3);
    font-size: inherit;
    font-weight: 400;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.settings-panel {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    padding: 1rem;
}

/* ── Cards ── */
.card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    padding: 1.1rem;
    transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--sh-border-light); }

/* ── Metrics / Stat Cards ── */
.metric-card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    padding: 1rem;
    text-align: left;
}
.metric-card .metric-label { font-size: 0.75rem; color: var(--sh-text-3); text-transform: uppercase; letter-spacing: 0.04em; line-height: 1.35; margin-top: 0.35rem; }
.metric-card .metric-value { font-size: 1.55rem; font-weight: 700; color: var(--sh-text); letter-spacing: 0; line-height: 1.1; }

/* ── Grid (comprehensive) ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }
.grid-5 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr; gap: 1rem; }
.cols-7-3 { display: grid; grid-template-columns: 7fr 3fr; gap: 1.5rem; }
.cols-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 1.5rem; }
.cols-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.cols-1-5 { display: grid; grid-template-columns: 1fr 5fr; gap: 1rem; }
.grid-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; }

/* ── Info / Alert Boxes ── */
.alert {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-left: 3px solid var(--sh-accent);
    border-radius: var(--sh-radius);
    padding: 0.75rem 1rem;
    color: var(--sh-text-2);
    font-size: 0.8125rem;
    margin: 0.5rem 0;
}
.alert-success { border-left-color: var(--sh-success); }
.alert-warning { border-left-color: var(--sh-warning); }
.alert-error { border-left-color: var(--sh-error); }
.alert-info { border-left-color: var(--sh-accent); }

.guidance-note {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: baseline;
    line-height: 1.6;
}

.guidance-note strong {
    white-space: nowrap;
}

/* ── Spinner ── */
.spinner { display: inline-block; width: 1.5rem; height: 1.5rem; border: 2px solid var(--sh-border); border-top-color: var(--sh-accent); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Feature Cards (Home page) ── */
.feature-card {
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    padding: 1.15rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}
.feature-card:hover { border-color: var(--sh-border-light); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,23,42,0.12); }
.feature-card .fc-icon { font-size: 1.5rem; margin-bottom: 0.5rem; line-height: 1; }
.feature-card .fc-title { color: var(--sh-text); font-size: 0.95rem; font-weight: 600; margin: 0 0 0.55rem 0; line-height: 1.35; }
.feature-card .fc-desc { color: var(--sh-text-2); font-size: 0.835rem; line-height: 1.7; margin: 0; }
.feature-card::after {
    content: ''; position: absolute; top: 0; left: 0; width: 3px; height: 100%;
    background: var(--sh-accent); opacity: 0; transition: opacity 0.2s ease;
}
.feature-card:hover::after { opacity: 1; }

/* ── Quick Start Steps ── */
.qs-step { display: flex; align-items: flex-start; gap: 0.85rem; padding: 0.75rem 0; margin: 0.1rem 0; max-width: 820px; }
.qs-number {
    background: var(--sh-accent-muted); color: var(--sh-accent); border-radius: 50%;
    width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.qs-text { color: var(--sh-text-2); font-size: 0.85rem; line-height: 1.7; }

/* ── Tip Badge ── */
.tip-badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: var(--sh-surface); border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm); padding: 0.5rem 0.75rem;
    margin: 0.25rem 0.35rem 0.25rem 0; font-size: 0.8125rem; color: var(--sh-text-2);
}

/* ── Tag Badge ── */
.tag {
    display: inline-block; background: var(--sh-surface-2); color: var(--sh-text-2);
    padding: 0.25rem 0.625rem; border-radius: 12px; font-size: 0.75rem; margin: 0.125rem;
}

.highlight-card {
    border: 1px solid var(--sh-accent);
    background: linear-gradient(180deg, var(--sh-surface), var(--sh-surface-2));
}

.text-muted {
    color: var(--sh-text-3);
    font-size: 0.8125rem;
}

/* Learning library */
.learning-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.learning-hero-copy {
    max-width: 760px;
}

.learning-hero h1 {
    margin: 0.25rem 0 0.65rem;
}

.learning-toolbar {
    display: grid;
    grid-template-columns: minmax(220px, 1.15fr) minmax(190px, 0.75fr) minmax(260px, 1.6fr);
    gap: 0.9rem;
    align-items: end;
    margin: 1.25rem 0;
}

.learning-search,
.learning-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.learning-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.learning-filter {
    min-height: 2.25rem;
    padding: 0.45rem 0.75rem;
    background: var(--sh-surface);
    color: var(--sh-text-2);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
}

.learning-filter:hover {
    background: var(--sh-surface-2);
    color: var(--sh-text);
}

.learning-filter.active {
    background: var(--sh-accent-muted);
    color: var(--sh-accent);
    border-color: var(--sh-accent);
    box-shadow: inset 0 0 0 1px var(--sh-accent);
}

.learning-featured {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1.15fr);
    gap: 1.25rem;
    align-items: stretch;
    padding: 1rem 0;
    border-top: 1px solid var(--sh-border);
    border-bottom: 1px solid var(--sh-border);
    margin: 1.25rem 0;
}

.learning-featured-cover,
.video-thumb {
    position: relative;
    overflow: hidden;
    border-radius: var(--sh-radius);
    border: 1px solid var(--sh-border);
    background: linear-gradient(135deg, #1f2937, #0f172a);
}

.learning-featured-cover {
    min-height: 240px;
}

.learning-featured-cover::before,
.video-thumb::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(180deg, rgba(2,6,23,0.08), rgba(2,6,23,0.02) 45%, rgba(2,6,23,0.12));
    pointer-events: none;
}

.learning-featured-cover::after,
.video-thumb::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 30%;
    z-index: 1;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.18));
    pointer-events: none;
}

.accent-trial { background-color: #1d4ed8; }
.accent-gcp { background-color: #047857; }
.accent-ethics { background-color: #7c3aed; }
.accent-operations { background-color: #be123c; }
.accent-data { background-color: #0f766e; }
.accent-access { background-color: #b45309; }

.learning-play-mark,
.video-thumb-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    color: #0f172a;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.video-thumb-play {
    width: 3.2rem;
    height: 3.2rem;
    font-size: 0.65rem;
}

.learning-cover-topic,
.video-thumb-topic {
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    bottom: 0.75rem;
    z-index: 2;
    color: #ffffff;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.25;
}

.video-thumb-title {
    position: absolute;
    left: 0.8rem;
    right: 0.8rem;
    top: 0.75rem;
    z-index: 2;
    color: #ffffff;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
    text-shadow: 0 1px 14px rgba(0,0,0,0.45);
}

.learning-featured-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.75rem;
    min-width: 0;
}

.learning-featured-copy h2 {
    margin: 0;
    font-size: 1.45rem;
}

.learning-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.learning-meta-row span {
    display: inline-flex;
    align-items: center;
    min-height: 1.75rem;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius-sm);
    background: var(--sh-surface-2);
    color: var(--sh-text-2);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.25;
}

.learning-results-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin: 1.25rem 0 0.75rem;
}

.learning-results-row h3 {
    margin: 0;
}

#video-count {
    color: var(--sh-text-3);
    font-size: 0.8125rem;
    font-weight: 600;
}

.video-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.video-card {
    min-width: 0;
}

.video-card[hidden] {
    display: none;
}

.video-card-panel {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--sh-surface);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    text-align: left;
}

.video-card-panel:hover {
    background: var(--sh-surface);
    border-color: var(--sh-border-light);
    box-shadow: 0 8px 20px rgba(15,23,42,0.12);
}

.video-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    border-width: 0 0 1px;
    border-radius: var(--sh-radius) var(--sh-radius) 0 0;
}

.video-thumb img,
.video-thumb-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.video-thumb img {
    z-index: 0;
    display: block;
    object-fit: contain;
    object-position: center;
    background: #07111f;
}

.video-thumb-fallback {
    background-image:
        linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(135deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 42%);
    background-size: 22px 22px, 22px 22px, auto;
}

.video-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.95rem;
}

.video-card-title {
    color: var(--sh-text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.video-card-desc {
    color: var(--sh-text-2);
    font-size: 0.8125rem;
    line-height: 1.6;
}

.video-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.manual-video-panel {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr);
    gap: 1rem;
    align-items: end;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--sh-border);
}

.manual-video-controls {
    display: flex;
    gap: 0.5rem;
}

.manual-video-player {
    grid-column: 1 / -1;
    aspect-ratio: 16 / 9;
    background: var(--sh-surface-2);
    border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius);
    overflow: hidden;
}

.manual-video-player iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── Expander / Collapsible ── */
.expander {
    background: var(--sh-surface); border: 1px solid var(--sh-border);
    border-radius: var(--sh-radius); overflow: hidden; margin: 0.5rem 0;
}
.expander summary { padding: 0.75rem 1rem; cursor: pointer; font-weight: 600; color: var(--sh-text); }
.expander .expander-content { padding: 0.75rem 1rem; border-top: 1px solid var(--sh-border); }

/* ── Tabs ── */
.tab-list {
    display: flex; border-bottom: 1px solid var(--sh-border);
    background: var(--sh-surface); gap: 0; padding: 0;
}
.tab-item {
    padding: 0.625rem 1rem; font-size: 0.8125rem; font-weight: 500;
    color: var(--sh-text-3); cursor: pointer; border-bottom: 2px solid transparent;
    transition: all 0.15s ease; white-space: nowrap;
}
.tab-item:hover { color: var(--sh-text); background: var(--sh-accent-muted); }
.tab-item.active { color: var(--sh-accent); border-bottom-color: var(--sh-accent); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Table ── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--sh-border); font-size: 0.8125rem; }
th { color: var(--sh-text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--sh-text-2); }

/* ── Progress Bar ── */
.progress { height: 0.5rem; background: var(--sh-surface-2); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--sh-accent); border-radius: 999px; transition: width 0.3s ease; }

/* ── Code ── */
code {
    background: var(--sh-surface-2);
    color: var(--sh-text);
    border-radius: 4px;
    padding: 0.125rem 0.375rem;
    font-size: 0.8125rem;
}

/* ── Footer ── */
.app-footer {
    border-top: 1px solid var(--sh-border);
    padding: 1rem 2rem;
    text-align: center;
    background: var(--sh-surface);
}
.app-footer p { font-size: 0.75rem; color: var(--sh-text-3); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sh-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--sh-border-light); }

/* ── Utility ── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.w-full { width: 100%; }

/* ── Responsive ── */
@media screen and (max-width: 768px) {
    /* Sidebar becomes top nav */
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 0.75rem 0.5rem;
        border-right: none;
        border-bottom: 1px solid var(--sh-border);
    }
    .sidebar-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
    .brand-mark { width: 2.25rem; height: 2.25rem; margin: 0; }
    .sidebar-header h2 { font-size: 1rem; margin: 0; flex: 1; display: block !important; }
    .sidebar-header .sidebar-tagline { display: none; }
    .sidebar-title { font-size: 1rem; }
    .sidebar-tagline { display: none; }

    .app-layout { flex-direction: column; }

    .sidebar-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 0; -webkit-overflow-scrolling: touch; }
    .nav-item {
        font-size: 0.75rem;
        padding: 0.5rem 0.6rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-height: 2.5rem;
    }
    .nav-item .nav-icon { font-size: 0.9rem; }

    .sidebar-footer {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: none;
        flex-wrap: wrap;
        gap: 0.375rem;
    }
    .theme-switcher { margin-bottom: 0; gap: 0.25rem; }
    .theme-btn { font-size: 0.875rem; padding: 0.25rem 0.5rem; }
    .lang-switcher, .model-switcher { width: 100%; margin-top: 0; }
    .lang-switcher select, .model-switcher select { width: 100%; }
    .sidebar-version, .sidebar-made { display: none; }

    .main-content { padding: 0.75rem 0.5rem; }

    .dashboard-hero,
    .metric-strip,
    .two-column-workflow,
    .workspace-grid,
    .contact-hero,
    .cta-band {
        grid-template-columns: 1fr;
    }
    .dashboard-hero,
    .contact-hero,
    .cta-band {
        padding: 0.85rem;
    }
    .metric-strip {
        gap: 0.55rem;
    }
    .hero-actions,
    .cta-band {
        align-items: stretch;
    }
    .hero-actions .btn,
    .cta-band .btn {
        width: 100%;
        justify-content: center;
    }
    .side-panel {
        position: static;
    }
    .qa-search-panel {
        grid-template-columns: 1fr;
    }
    .feature-grid,
    .service-grid {
        grid-template-columns: 1fr;
    }

    /* Grids stack on mobile */
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; gap: 0.75rem; }
    .cols-7-3, .cols-3-2, .cols-2-1, .cols-1-5, .grid-3-2 { grid-template-columns: 1fr; gap: 0.75rem; }

    /* Typography */
    h1 { font-size: 1.25rem; }
    h2 { font-size: 1.1rem; }
    h3 { font-size: 0.95rem; }
    h4 { font-size: 0.875rem; }
    p, span, label, li { font-size: 0.8125rem; }

    /* Cards */
    .card { padding: 0.75rem; }
    .feature-card { padding: 0.625rem; }
    .feature-card .fc-title { font-size: 0.875rem; }
    .feature-card .fc-desc { font-size: 0.75rem; }

    /* Metrics */
    .metric-card { padding: 0.5rem; }
    .metric-card .metric-value { font-size: 1.25rem; }

    /* Tabs */
    .tab-list { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
    .tab-item { padding: 0.5rem 0.6rem; font-size: 0.75rem; white-space: nowrap; flex-shrink: 0; }

    /* Tables scroll horizontally */
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Buttons full width on mobile */
    .btn { padding: 0.5rem 0.75rem; min-height: 2.5rem; }
    .btn-block-mobile { width: 100%; justify-content: center; }

    /* Forms */
    input, textarea, select { font-size: 16px !important; padding: 0.625rem 0.75rem; min-height: 2.75rem; }

    /* Tool controls */
    .protocol-control { width: 100%; }
    .tool-filter-pill { width: 100%; }

    /* Learning */
    .learning-hero,
    .learning-featured,
    .manual-video-panel {
        grid-template-columns: 1fr;
    }
    .learning-hero {
        display: grid;
        align-items: start;
    }
    .learning-toolbar {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    .learning-filter-buttons {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.15rem;
        -webkit-overflow-scrolling: touch;
    }
    .learning-filter {
        flex: 0 0 auto;
        white-space: nowrap;
    }
    .learning-featured-cover {
        min-height: 190px;
    }
    .learning-featured-copy h2 {
        font-size: 1.2rem;
    }
    .video-library-grid {
        grid-template-columns: 1fr;
    }
    .manual-video-controls {
        flex-direction: column;
    }

    /* Expander */
    .expander summary { padding: 0.625rem 0.75rem; font-size: 0.875rem; }

    /* Footer */
    .app-footer { padding: 0.75rem; }
    .app-footer p { font-size: 0.6875rem; }
}
