*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg-page);
    min-height: 100vh;
}

a {
    color: var(--link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.content-centered {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

.w-400  { max-width: 400px;  margin: 0 auto; }
.w-600  { max-width: 600px;  margin: 0 auto; }
.w-600  { max-width: 600px;  margin: 0 auto; }
.w-800  { max-width: 800px;  margin: 0 auto; }
.w-1000 { max-width: 1000px; margin: 0 auto; }
.w-1200 { max-width: 1200px; margin: 0 auto; }
.w-1400 { max-width: 1400px; margin: 0 auto; }
.w-full { max-width: 100%;   margin: 0 auto; padding: 0 1rem; }

.box {
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    overflow: auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
    color: var(--text);
}

textarea {
    width: 100%;
    padding: 0.75rem;
    font-family: var(--font);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
    color: var(--text);
    box-sizing: border-box;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 162, 235, 0.15);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 162, 235, 0.15);
}

select {
    padding: 0.5rem 0.75rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
    color: var(--text);
}

.form-group select {
    width: 100%;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-family: var(--font);
    font-size: 1.125rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--primary);
    color: #FFFFFF;
    width: 100%;
}

.btn:hover {
    background: var(--primary-hover);
}

.error-box {
    background: var(--error-light);
    color: var(--error);
    border: 1px solid var(--error);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
}

.success-box {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
}

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.875rem; }
.spacer { margin-top: 2rem; }

h1 {
    font-size: 1.75rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
}

.checkbox-group {
    margin-bottom: 0.75rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 400;
    cursor: pointer;
}

input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}


/* ===================
   NAVIGATION BAR — sticky top nav
   =================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-box);
    border-bottom: 1px solid var(--border);
}

.nav-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    height: 48px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-bar a,
.nav-links a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.25rem 0;
    white-space: nowrap;
    transition: color 150ms ease;
}

.nav-bar a:hover,
.nav-links a:hover {
    color: var(--primary);
    text-decoration: none;
}

.nav-bar a.active,
.nav-links a.active {
    color: var(--text);
    font-weight: 600;
}

/* Hamburger button — hidden on desktop */
.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 4px;
}

.nav-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    transition: transform 150ms ease, opacity 150ms ease;
}

.nav-hamburger.open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
    opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile dropdown menu */
.nav-mobile-menu {
    background: var(--bg-box);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem 0.75rem;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-mobile-menu.open {
    display: flex;
}

.nav-mobile-menu a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: background 150ms ease, color 150ms ease;
}

.nav-mobile-menu a:hover {
    background: var(--bg-page);
    color: var(--primary);
    text-decoration: none;
}

.nav-mobile-menu a.active {
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 640px) {
    .nav-links {
        display: none;
    }
    .nav-hamburger {
        display: flex;
    }
    .nav-bar {
        justify-content: flex-end;
    }
}


/* ===================
   UTILITY CLASSES
   =================== */

/* Visibility */
.hidden {
    display: none;
}

/* Brand link — inherits color, no underline */
.brand-link {
    color: inherit;
    text-decoration: none;
}

.brand-link:hover {
    color: inherit;
    text-decoration: none;
}

/* Button variants */
.btn-small {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-danger {
    background: var(--error);
}

.btn-danger:hover {
    background: #D32F2F;
}

/* Input variants */
.input-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: var(--font);
}

/* Flex layouts */
.flex-column-gap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.flex-row-gap {
    display: flex;
    gap: 0.5rem;
}

.flex-row-center {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Section divider — top border with spacing */
.section-divider {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Pre-formatted block (backup codes, etc.) */
.pre-block {
    background: var(--bg-page);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* QR code image */
.qr-image {
    max-width: 200px;
}

/* Spacing */
.spacer-small {
    margin-top: 1rem;
}

.mb-xs {
    margin-bottom: 0.25rem;
}

.mb-sm {
    margin-bottom: 0.5rem;
}

.mb-md {
    margin-bottom: 0.75rem;
}

.mb-lg {
    margin-bottom: 1rem;
}

.mb-xl {
    margin-bottom: 1.5rem;
}

/* Font weight */
.font-medium {
    font-weight: 500;
}

/* Section heading — shared across lessons, exercises, check-in */
.section-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Block label — for form labels above inputs */
.block-label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

/* Full-width block link/button */
.block-center {
    display: block;
    text-align: center;
    text-decoration: none;
}

.block-center:hover {
    text-decoration: none;
}


/* ===================
   THEME PICKER CARDS
   =================== */

.picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.picker-card {
    background: var(--bg-box);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 1rem 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 150ms ease;
}

.picker-card:hover {
    border-color: var(--primary);
}

.picker-card.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--focus);
}

.picker-card .card-label {
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.25rem;
}

.picker-card .card-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.picker-card .color-bar {
    height: 6px;
    border-radius: 3px;
    margin-top: 0.5rem;
}
.color-bar-default { background: linear-gradient(90deg, #FAF9F7, #36A2EB); }
.color-bar-warm    { background: linear-gradient(90deg, #FDF6E9, #C67B3C); }
.color-bar-cool    { background: linear-gradient(90deg, #E8EEF4, #2563EB); }
.color-bar-bold    { background: linear-gradient(90deg, #1a1a2e, #00d4ff);
}

.font-preview {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.font-preview-default {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.font-preview-serif {
    font-family: Georgia, "Times New Roman", Times, serif;
}

.font-preview-rounded {
    font-family: "Nunito", "Varela Round", sans-serif;
}


/* ===================
   PROGRESS BAR
   =================== */

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0;
}


/* ===================
   LESSON LIST
   =================== */

.level-heading {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.level-heading:first-child {
    margin-top: 0;
}

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

.lesson-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: background-color 150ms ease;
}

.lesson-row:hover {
    background: var(--bg-page);
    text-decoration: none;
}

.lesson-row--locked {
    opacity: 0.45;
}

.lesson-row--locked:hover {
    background: transparent;
}

.lesson-row--next {
    background: var(--focus);
}

.lesson-num {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    min-width: 2.75rem;
    flex-shrink: 0;
}

.lesson-title {
    flex: 1;
    min-width: 0;
}

.lesson-row--exercise .lesson-title {
    padding-left: 0.75rem;
    font-style: italic;
}

.lesson-badges {
    display: flex;
    gap: 0.375rem;
    flex-shrink: 0;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

.badge--exercise {
    background: var(--bg-page);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.badge--done {
    background: var(--success-light);
    color: var(--success);
}

.badge--next {
    background: var(--primary);
    color: #fff;
}

.badge--locked {
    background: transparent;
    font-size: 0.8125rem;
}


/* ===================
   LESSON DETAIL
   =================== */

.video-responsive {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
}

.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lesson-section {
    margin-bottom: 1.5rem;
}

.lesson-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pre-wrap {
    white-space: pre-wrap;
    line-height: 1.7;
}

.btn-complete {
    width: auto;
    padding: 0.75rem 3rem;
}


/* ===================
   EXERCISES — SHARED
   =================== */

.exercise-item-card {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.exercise-item-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.exercise-condition-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0 0.25rem 0.75rem;
}

.exercise-condition-label {
    min-width: 6rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.option-row {
    display: flex;
    gap: 0.375rem;
}

.option-btn {
    font-family: var(--font);
    font-size: 0.8125rem;
    padding: 0.3125rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-box);
    color: var(--text);
    cursor: pointer;
    flex: 1 1 0;
    min-width: 0;
    text-align: center;
    transition: border-color 150ms ease, background 150ms ease;
}

.option-btn:hover {
    border-color: var(--primary);
}

.option-btn.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Semantic colors — severity scale for exercises and check-in tool reports */
.option-btn.selected[data-value="very_positive"],
.option-btn.selected[data-value="better"] {
    background: var(--success); border-color: var(--success);
}
.option-btn.selected[data-value="somewhat_positive"] {
    background: var(--success-light); color: var(--success); border-color: var(--success);
}
.option-btn.selected[data-value="neutral"],
.option-btn.selected[data-value="same"] {
    background: var(--neutral-light); color: var(--neutral); border-color: var(--neutral);
}
.option-btn.selected[data-value="somewhat_negative"] {
    background: var(--error-light); color: var(--error); border-color: var(--error);
}
.option-btn.selected[data-value="very_negative"],
.option-btn.selected[data-value="worse"] {
    background: var(--error); border-color: var(--error);
}
.option-btn.selected[data-value="inorder"] {
    background: var(--success); border-color: var(--success);
}
.option-btn.selected[data-value="disordered"] {
    background: var(--caution); border-color: var(--caution);
}
.option-btn.selected[data-value="outofcontrol"] {
    background: var(--error); border-color: var(--error);
}
.option-btn.selected[data-value="inside"] {
    background: var(--success); border-color: var(--success);
}
.option-btn.selected[data-value="slightly_outside"] {
    background: var(--caution); border-color: var(--caution);
}
.option-btn.selected[data-value="too_far_outside"] {
    background: var(--error); border-color: var(--error);
}
.option-btn.selected[data-value="skipped"] {
    background: var(--bg-page); color: var(--text-muted); border-color: var(--border);
}


/* ===================
   EXERCISES — TOOLS TABLE
   =================== */

.tools-table {
    width: 100%;
    overflow-x: auto;
}

.tools-header-row {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.tools-header-cell {
    font-weight: 600;
    font-size: 0.875rem;
}

.tools-tool-col {
    flex: 2;
    min-width: 8rem;
    padding: 0.25rem 0.5rem;
}

.tools-cond-col {
    flex: 1;
    min-width: 4rem;
    text-align: center;
    padding: 0.25rem 0.5rem;
}

.tools-strength-heading {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--text);
}

.tools-cat-heading {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    margin-top: 0.5rem;
}

.tools-row {
    display: flex;
    gap: 0;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.tools-row:last-child {
    border-bottom: none;
}

.tools-cond-col input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary);
}


/* ===================
   EXERCISES — TIMELINE BAR
   =================== */

/* Legend */
.tl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.8125rem;
}

.tl-legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tl-legend-swatch {
    display: inline-block;
    width: 1rem;
    height: 0.625rem;
    border-radius: 3px;
}

/* Segment colors */
.tl-seg-nointervention { background: #6abf69; }
.tl-seg-simple { background: #d4a843; }
.tl-seg-stronger { background: #e8a0a0; }
.tl-seg-extreme { background: #d45f5f; }
.tl-seg-crisis { background: #7a2020; }

/* Per-condition section */
.tl-condition {
    margin-bottom: 2.5rem;
}

.tl-condition-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

/* Question mode */
.tl-questions {
    margin-bottom: 1.25rem;
}

.tl-question {
    margin-bottom: 1rem;
}

.tl-question-label {
    display: block;
    font-size: 0.9375rem;
    margin-bottom: 0.4rem;
    color: var(--text);
}

.tl-question-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.tl-question-number {
    width: 5rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-box);
    color: var(--text);
}

.tl-question-unit {
    padding: 0.4rem 0.5rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-box);
    color: var(--text);
}

/* Bar container */
.tl-bar-container {
    position: relative;
    margin-bottom: 0.5rem;
}

.tl-bar-placeholder {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.875rem;
}

/* Bar track */
.tl-bar-track {
    position: relative;
    height: 1rem;
    border-radius: 0.5rem;
    overflow: visible;
    background: var(--neutral-light);
}

.tl-bar-segment {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 0;
}

.tl-bar-segment:first-child {
    border-radius: 0.5rem 0 0 0.5rem;
}

.tl-bar-segment:last-child {
    border-radius: 0 0.5rem 0.5rem 0;
}

/* Draggable dots */
.tl-dot {
    position: absolute;
    top: 50%;
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    border: 2px solid var(--bg-box);
    transform: translate(-50%, -50%);
    cursor: grab;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: box-shadow 0.15s;
}

.tl-dot:hover {
    box-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

body.tl-dragging {
    cursor: grabbing;
    user-select: none;
}

body.tl-dragging .tl-dot {
    cursor: grabbing;
}

/* Labels below bar */
.tl-bar-labels {
    position: relative;
    height: 1.5rem;
    margin-top: 0.25rem;
}

.tl-bar-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Reset row */
.tl-reset-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.9375rem;
}

.tl-reset-label {
    color: var(--text);
}

.tl-reset-number {
    width: 4.5rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-box);
    color: var(--text);
}

.tl-reset-unit {
    padding: 0.35rem 0.5rem;
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-box);
    color: var(--text);
}


/* Threshold message — shown when crisis window is too short for timeline */
.tl-threshold-message {
    padding: 1rem 1.25rem;
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9375rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

/* ===================
   EXERCISES — COLLAPSIBLE SECTIONS
   =================== */

.exercise-section {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.exercise-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    background: var(--bg-box);
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    user-select: none;
}

.exercise-section-count {
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 0.5rem;
    text-transform: none;
    letter-spacing: 0;
}

.exercise-section-header:hover {
    background: var(--bg);
}

.exercise-section-header::after {
    content: '\25B2';
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform 150ms ease;
}

.exercise-section.collapsed .exercise-section-header::after {
    transform: rotate(180deg);
}

.exercise-section-body {
    padding: 0 0.75rem 0.75rem;
}

.exercise-section.collapsed .exercise-section-body {
    display: none;
}

.exercise-section-teaser {
    font-size: 0.8125rem;
    color: var(--text-muted);
    padding: 0 0.75rem 0.5rem;
    display: none;
}

.exercise-section.collapsed .exercise-section-teaser {
    display: block;
}


/* ===================
   EXERCISES — NAME YOUR OWN (inline form)
   =================== */

.name-your-own-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 0 0.25rem;
    align-items: center;
    border-top: 1px dashed var(--border);
    margin-top: 0.5rem;
}

.name-your-own-form input[type="text"] {
    flex: 1;
    min-width: 0;
}

.name-your-own-form select {
    max-width: 10rem;
}

.name-your-own-form .btn {
    white-space: nowrap;
}

.name-your-own-feedback {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
}


/* ===================
   EXERCISES — USER-CREATED INDICATOR
   =================== */

.exercise-item-card--user-created .exercise-item-label::after {
    content: '(yours)';
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.375rem;
}

.tools-row--user-created .tools-tool-col::after {
    content: '(yours)';
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.375rem;
}


/* ===================
   EXERCISES — SIDEBAR
   =================== */

.exercise-layout {
    display: flex;
    gap: 1.5rem;
}

.exercise-main {
    flex: 1;
    min-width: 0;
}

.exercise-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
    align-self: flex-start;
}

.exercise-sidebar-section {
    margin-bottom: 1rem;
}

.exercise-sidebar-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.375rem;
}

.exercise-sidebar-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    padding: 0.125rem 0;
}

.exercise-sidebar-count {
    font-weight: 500;
}

.sidebar-good { color: var(--success, #2d7d2d); }
.sidebar-warning { color: var(--warning, #b37800); }
.sidebar-caution { color: var(--danger, #c0392b); }

@media (max-width: 600px) {
    .exercise-layout {
        flex-direction: column;
    }
    .exercise-sidebar {
        width: 100%;
        position: static;
        order: -1;
        margin-bottom: 1rem;
    }
    .exercise-condition-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .option-row {
        flex-direction: column;
        width: 100%;
    }
    .option-btn {
        text-align: left;
        padding: 0.5rem 0.75rem;
    }
}


/* ===================
   CHECK-IN — unique styles only
   =================== */

/* Tool report card */
.tool-report-card {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Summary after submission */
.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border);
}

.summary-row:last-child {
    border-bottom: none;
}

/* Three-column dropdowns row */
.checkin-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.checkin-field-col {
    flex: 0 0 calc((100% - 1.5rem) / 3);
    min-width: 0;
}

.checkin-field-col select {
    width: 100%;
}

/* Stack check-in fields vertically on phones */
@media (max-width: 600px) {
    .checkin-field-col {
        flex: 0 0 100%;
    }
}

/* Keep it simple toggle — inside each attribution panel */
.checkin-simple-toggle {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-page);
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.checkin-simple-toggle:hover {
    border-color: var(--primary);
    color: var(--text);
}

.checkin-simple-toggle.is-simple {
    background: var(--focus);
    border-color: var(--primary);
    color: var(--primary);
    margin-bottom: 0;
}

.checkin-simple-chevron {
    font-size: 0.5rem;
    transition: transform 150ms ease;
}

.checkin-simple-toggle.is-simple .checkin-simple-chevron {
    transform: rotate(180deg);
}

/* Attribution panel — shown below each dropdown when triggered */
.checkin-attribution-panel {
    margin-top: 0.375rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
}

.checkin-attribution-heading {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Free text field within attribution panel */
.checkin-attribution-text {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.checkin-attribution-text label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-weight: 400;
}

.checkin-attribution-text textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
    color: var(--text);
    resize: vertical;
    min-height: 3.5rem;
    line-height: 1.5;
}

.checkin-attribution-text textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 162, 235, 0.15);
}

/* ===================
   AI COACH CHAT
   =================== */

.ai-coach-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-box);
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.ai-coach-box h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    font-weight: 600;
}

.ai-coach-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ai-coach-bubble {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    line-height: 1.5;
    font-size: 0.9375rem;
    max-width: 90%;
    white-space: pre-wrap;
}

.ai-coach-bubble.ai {
    background: var(--chat-ai-bg);
    border: 1px solid var(--chat-ai-border);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.ai-coach-bubble.user {
    background: var(--chat-user-bg);
    border: 1px solid var(--chat-user-border);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-coach-input-area textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-box);
    color: var(--text);
    resize: vertical;
    min-height: 3.5rem;
    max-height: 8rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.ai-coach-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus);
}

.ai-coach-status {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* In-coach weekly usage indicator (services/ai_budget.py drives the data). */
#mio-budget-indicator { margin: 0.5rem 0; }
.budget-indicator { font-size: 0.8125rem; color: var(--text-muted); }
.budget-indicator .budget-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.35rem;
}
.budget-indicator .budget-bar-fill {
    height: 100%;
    background: var(--link);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.budget-indicator.over {
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 0.75rem;
    color: var(--text);
    line-height: 1.4;
}

.ai-coach-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.75rem;
    line-height: 1.4;
}

.ai-coach-thinking {
    font-style: italic;
    color: var(--text-muted);
}


/* ===================
   REPORTS — LANDING PAGE
   =================== */

.report-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.report-card {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-box);
    text-decoration: none;
    color: var(--text);
    transition: border-color 150ms ease, background 150ms ease;
}

.report-card:hover {
    border-color: var(--primary);
    background: var(--bg-page);
    text-decoration: none;
}

.report-card.coming-soon {
    opacity: 0.45;
    pointer-events: none;
}

.report-title {
    display: block;
    font-weight: 600;
    font-size: 0.9375rem;
}

.report-desc {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.report-card.coming-soon .report-title::after {
    content: ' — Coming Soon';
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* ===================
   FULL PROGRESS REPORT
   =================== */

/* Chart wrapper */
.report-graph-box {
    position: relative;
    margin-bottom: 1.5rem;
}

.report-chart-area {
    position: relative;
    height: 300px;
}

/* Alignment line (red vertical line follows mouse) */
.report-alignment-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--line-x, 0);
    width: 2px;
    background: red;
    opacity: 0.8;
    pointer-events: none;
    z-index: 9999;
}

/* Clickable graph cursor */
.report-graph-box--clickable {
    cursor: pointer;
}

/* Bands container — padding set by JS via data attributes is not needed;
   JS sets paddingLeft/paddingRight on the element directly.
   CSP blocks that, so we use CSS vars instead. */
.report-bands-container {
    padding-left: var(--band-pad-left, 0);
    padding-right: var(--band-pad-right, 0);
}

/* Legend */
.report-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.report-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.report-legend-swatch {
    display: inline-block;
    width: 18px;
    height: 3px;
    background: #ccc;
}

/* Condition-specific swatch colors (match LINE_COLORS in mio-reports.js) */
.report-legend-swatch--mania       { background: rgb(255,99,132); }
.report-legend-swatch--depression  { background: rgb(54,162,235); }
.report-legend-swatch--adhd        { background: rgb(75,192,192); }
.report-legend-swatch--anxiety     { background: rgb(255,159,64); }
.report-legend-swatch--ptsd        { background: rgb(153,102,255); }
.report-legend-swatch--ocd         { background: rgb(255,205,86); }

/* Zone legend badges — background set via specific classes */
.badge--zone-inside {
    background: rgba(100,150,255,0.30);
}

.badge--zone-slight {
    background: rgba(255,245,100,0.35);
}

.badge--zone-far {
    background: rgba(255,60,60,0.25);
}

/* Date controls */
.report-date-form {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Status bands */
.report-band-header {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.report-band-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-band-bar {
    position: relative;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    background: #e5e5e5;
}

.report-band-segment {
    position: absolute;
    left: var(--seg-left, 0);
    width: var(--seg-width, 0);
    height: 100%;
    border-radius: 6px;
}

/* Band segment colors — environment */
.report-band-seg--very_positive       { background: #d0f5ce; }
.report-band-seg--somewhat_positive   { background: #b8e6b3; }
.report-band-seg--neutral             { background: #d4d4d4; }
.report-band-seg--somewhat_negative   { background: #ffb3b3; }
.report-band-seg--very_negative       { background: #ff9999; }

/* Band segment colors — behavior */
.report-band-seg--in_order            { background: #c4e9ff; }
.report-band-seg--disordered          { background: #ffe9b8; }
.report-band-seg--out_of_control      { background: #ffb3b3; }

/* Band segment colors — comfort zone */
.report-band-seg--inside              { background: #b2c4ff; }
.report-band-seg--slightly_outside    { background: #ffffa8; }
.report-band-seg--too_far_outside     { background: #ffb2b2; }

/* Band pill colors — environment */
.badge--env-very_positive       { background: #d0f5ce; }
.badge--env-somewhat_positive   { background: #b8e6b3; }
.badge--env-neutral             { background: #d4d4d4; }
.badge--env-somewhat_negative   { background: #ffb3b3; }
.badge--env-very_negative       { background: #ff9999; }

/* Band pill colors — behavior */
.badge--beh-in_order            { background: #c4e9ff; }
.badge--beh-disordered          { background: #ffe9b8; }
.badge--beh-out_of_control      { background: #ffb3b3; }

/* Band pill colors — comfort */
.badge--cz-inside               { background: #b2c4ff; }
.badge--cz-slightly_outside     { background: #ffffa8; }
.badge--cz-too_far_outside      { background: #ffb2b2; }


/* Report tabs (awareness map) */
.report-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.report-tab {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text-muted);
}

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

/* Report badge variants */
.badge--reflection {
    background: var(--success-light);
    color: var(--text);
}

.badge--tool {
    background: var(--primary-light, #e0edff);
    color: var(--text);
}

.badge--active {
    background: #4B89DC;
    color: #fff;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

/* Episode Map */
.episode-map {
    margin: 1rem 0;
}

.episode-map-axis {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
    margin-bottom: 0.5rem;
}

.episode-map-row {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.episode-map-label {
    width: 120px;
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: right;
    padding-right: 0.75rem;
}

.episode-map-track {
    position: relative;
    flex: 1;
    height: 28px;
    background: var(--bg-box-alt, #f4f4f4);
    border-radius: 4px;
    overflow: hidden;
}

.episode-block {
    position: absolute;
    top: 2px;
    bottom: 2px;
    left: var(--ep-left, 0);
    width: var(--ep-width, 0);
    background: var(--ep-color, #999);
    border-radius: 3px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.episode-block:hover {
    opacity: 0.8;
}

.episode-block--active {
    animation: episode-pulse 2s ease-in-out infinite;
}

@keyframes episode-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.episode-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    justify-content: center;
}

.episode-legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted, #888);
}

.episode-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

/* Episode pattern summary */
.report-pattern-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.report-pattern-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.report-pattern-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

.report-pattern-label {
    font-size: 0.8125rem;
    color: var(--text-muted, #888);
    margin-top: 0.25rem;
}

/* Episode detail phase timeline */
.episode-phase-timeline {
    margin: 0.5rem 0 0.5rem 1rem;
    border-left: 2px solid var(--border, #ddd);
    padding-left: 1rem;
}

.episode-phase-step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.episode-phase-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-left: -1.375rem;
}

.episode-phase-label {
    font-size: 0.875rem;
    text-transform: capitalize;
}

.episode-phase-date {
    font-size: 0.75rem;
    color: var(--text-muted, #888);
}

/* Carry-forward badge */
.checkin-carry-badge {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 4px;
    padding: 0 0.3rem;
    margin-left: 0.375rem;
    vertical-align: middle;
    opacity: 0.7;
}

/* ============================================================
   Partner Admin — stats grid, tables, sortable headers
   ============================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-box, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text, #222);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted, #888);
    margin-top: 0.25rem;
}

.stat-card--green  { background: #e8f5e9; }
.stat-card--blue   { background: #e3f2fd; }
.stat-card--yellow { background: #fff8e1; }
.stat-card--peach  { background: #fce4ec; }

/* Inactive users warning banner */
.admin-warning-banner {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

/* Admin link grid — three columns with boxed groups */
.admin-link-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.admin-link-group {
    background: var(--bg-box, #fff);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 12px;
    padding: 1.25rem;
}

.admin-link-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.admin-link-item {
    margin-bottom: 0.75rem;
}

.admin-link-item:last-child {
    margin-bottom: 0;
}

.admin-link-item a {
    font-weight: 500;
}

.admin-link-item .admin-link-name {
    font-weight: 500;
    color: var(--text-muted, #888);
}

.admin-link-item .admin-link-desc {
    font-size: 0.8125rem;
    color: var(--text-muted, #888);
    margin-top: 0.0625rem;
}

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

/* Admin badge — red pill with count; :empty hides badges with no text */
.admin-badge {
    display: inline-block;
    min-width: 1.25rem;
    padding: 0.125rem 0.375rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #fff;
    background: var(--error, #E53935);
    margin-left: 0.25rem;
    vertical-align: middle;
}
.admin-badge:empty { display: none; }

/* Attention highlight — light green tint on box when items need review */
.admin-link-group--attention {
    background: #e8f5e9;
    border-color: #a5d6a7;
}

/* Pending reviews banner */
.admin-pending-banner {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

/* Trial expiry banners */
.admin-trial-info-banner {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

.admin-trial-urgent-banner {
    background: #ffebee;
    border: 1px solid #ef9a9a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Trial expired interstitial overlay */
.trial-expired-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.trial-expired-card {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.trial-expired-card h2 {
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}

.trial-expired-card p {
    color: var(--text-muted, #888);
    margin-bottom: 1.5rem;
}

.admin-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    text-align: left;
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid var(--border, #e5e5e5);
    white-space: nowrap;
}
.admin-table td:first-child {
    white-space: nowrap;
    min-width: 100px;
}
.admin-table td:nth-child(2) {
    white-space: nowrap;
    min-width: 160px;
}
.admin-table td:nth-child(3) {
    white-space: normal;
    word-break: break-word;
    min-width: 160px;
}

.admin-table th {
    font-weight: 600;
    color: var(--text-muted, #888);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table tr:hover td {
    background: var(--bg-body, #faf9f7);
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    color: var(--primary, #36A2EB);
}

/* Admin detail tabs */

.detail-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border, #e5e5e5);
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted, #888);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text, #222);
}

.tab-btn.active {
    color: var(--primary, #36A2EB);
    border-bottom-color: var(--primary, #36A2EB);
    font-weight: 600;
}

.tab-content {
    /* shown/hidden via .hidden */
}

.tag {
    display: inline-block;
    background: var(--bg-body, #faf9f7);
    border: 1px solid var(--border, #e5e5e5);
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.85rem;
    margin: 0.2rem;
}

.mt-sm { margin-top: 0.5rem; }
.mt-md { margin-top: 1rem; }

.flex-wrap { flex-wrap: wrap; }


/* ===================
   SETTINGS — ACCORDION SECTIONS
   =================== */

.settings-section {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: var(--bg-box);
    overflow: hidden;
}

.settings-section summary {
    padding: 0.875rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 150ms ease;
}

.settings-section summary::-webkit-details-marker {
    display: none;
}

.settings-section summary::after {
    content: '\25B6';
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: transform 200ms ease;
}

.settings-section[open] summary::after {
    transform: rotate(90deg);
}

.settings-section summary:hover {
    background: var(--bg);
}

.settings-section-body {
    padding: 0 1rem 1rem;
    border-top: 1px solid var(--border);
}

.settings-section-body p.desc {
    color: var(--text-muted);
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9375rem;
}

/* Settings form fields */
.settings-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form input[type="password"],
.settings-form input[type="tel"],
.settings-form input[type="number"],
.settings-form select {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-family: var(--font);
    font-size: 0.9375rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-box);
    color: var(--text);
    margin-bottom: 1rem;
}

.settings-form input:focus,
.settings-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 162, 235, 0.15);
}

.settings-form .field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.settings-form .input-narrow {
    max-width: 120px;
}

/* Picker grid (palette / font) */
.picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.picker-card {
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    cursor: pointer;
    text-align: center;
    transition: border-color 150ms ease, transform 150ms ease;
    background: var(--bg-box);
}

.picker-card:hover {
    transform: translateY(-1px);
    border-color: var(--text-muted);
}

.picker-card.selected {
    border-color: var(--primary);
}

.picker-card .card-label {
    font-weight: 600;
    margin-bottom: 0.125rem;
}

.picker-card .card-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Color bar previews */
.color-bar {
    height: 6px;
    border-radius: 3px;
}

.color-bar-default {
    background: linear-gradient(to right, #81C784 0%, #FFB74D 40%, #E57373 70%, #D32F2F 100%);
}

.color-bar-warm {
    background: linear-gradient(to right, #81C784 0%, #FFB74D 40%, #E57373 70%, #D32F2F 100%);
}

.color-bar-cool {
    background: linear-gradient(to right, #86EFAC 0%, #FDE047 40%, #FCA5A5 70%, #DC2626 100%);
}

.color-bar-bold {
    background: linear-gradient(to right, #4ADE80 0%, #FBBF24 40%, #F87171 70%, #DC2626 100%);
}

/* Font preview */
.font-preview {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.font-preview-default { font-family: var(--font); }
.font-preview-serif { font-family: Georgia, 'Times New Roman', serif; }
.font-preview-rounded { font-family: 'Nunito', sans-serif; }

/* Session list */
.session-list {
    list-style: none;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

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

.session-current {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
}

.session-revoke {
    font-size: 0.8125rem;
    color: var(--error);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font);
}

.session-revoke:hover {
    text-decoration: underline;
}

/* Exercise links grid */
.exercise-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.exercise-link {
    display: block;
    padding: 0.625rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background 150ms ease;
}

.exercise-link:hover {
    background: var(--bg-box);
    text-decoration: none;
}

/* Inline status messages */
.settings-status {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.settings-status.ok { color: var(--success); }
.settings-status.err { color: var(--error); }

/* Privacy info list */
.privacy-list {
    list-style: none;
    margin-bottom: 1rem;
}

.privacy-list li {
    padding: 0.375rem 0;
    font-size: 0.9375rem;
}

.privacy-list li strong {
    display: inline;
}

/* Danger zone */
.danger-zone {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--error);
}

.danger-zone h4 {
    color: var(--error);
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .settings-form .field-row {
        grid-template-columns: 1fr;
    }
    .exercise-links {
        grid-template-columns: 1fr;
    }
    .picker-grid {
        grid-template-columns: 1fr 1fr;
    }
}


@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .admin-table {
        font-size: 0.8rem;
    }
    .admin-table th,
    .admin-table td {
        padding: 0.4rem 0.5rem;
    }
    .detail-tabs {
        gap: 0;
    }
    .tab-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}


/* ===================
   SHARING CARDS
   =================== */

.share-card {
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: var(--text);
    transition: background 150ms ease;
}

a.share-card:hover {
    background: var(--bg-offset);
    text-decoration: none;
}

.share-card.revoked {
    opacity: 0.6;
}

.share-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.share-card-name {
    font-weight: 600;
    font-size: 1rem;
}

.share-card-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.admin-share-detail {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.admin-share-detail p {
    margin-bottom: 0.25rem;
}

div.share-card {
    cursor: pointer;
}

div.share-card:hover {
    background: var(--bg-offset);
}

.spacer-tiny {
    margin-bottom: 0.25rem;
}

.text-nowrap {
    white-space: nowrap;
}


/* ===================
   DATA TABLE (reference library, etc.)
   =================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table th,
.data-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: var(--bg-offset);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table tbody tr:hover {
    background: var(--bg-offset);
}

.data-table .row-pending {
    background: rgba(255, 193, 7, 0.08);
}

.data-table .row-rejected {
    opacity: 0.5;
}

.data-table .row-inactive {
    opacity: 0.5;
}

.badge-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-status--pending {
    background: #fff8e1;
    color: #6d4c00;
}

.badge-status--active {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-status--rejected {
    background: #fce4ec;
    color: #8e0000;
}

.badge-status--inactive {
    background: var(--border);
    color: var(--text-muted);
}


/* ===================
   MODAL OVERLAY
   =================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: var(--bg-box, #fff);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.modal-box .form-group {
    margin-bottom: 0.75rem;
}

.modal-box .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

@media (max-width: 600px) {
    .data-table {
        font-size: 0.8rem;
    }
    .data-table th,
    .data-table td {
        padding: 0.4rem 0.5rem;
    }
    .modal-box {
        width: 95%;
        padding: 1rem;
    }
}


/* ===================
   ANNOUNCEMENT MODAL (user-facing — loaded from mio-core.js)
   =================== */

.mio-ann-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 1rem;
    overflow-y: auto;
}

.mio-ann-modal {
    background: var(--bg-box);
    border-radius: 12px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.25);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.mio-ann-close {
    position: absolute;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1;
    line-height: 1;
}

.mio-ann-close-top {
    top: 0.75rem;
    right: 1rem;
    color: #fff;
    font-size: 1.75rem;
    opacity: 0.8;
}
.mio-ann-close-top:hover { opacity: 1; }

.mio-ann-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary) 100%);
    color: #fff;
    padding: 2rem 1.5rem;
    text-align: center;
}
.mio-ann-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    text-align: center;
}
.mio-ann-header p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0;
}

.mio-ann-body {
    padding: 1.5rem;
}
.mio-ann-body .ann-section { margin-bottom: 1.25rem; }
.mio-ann-body .ann-section:last-child { margin-bottom: 0; }
.mio-ann-body .ann-section h4 { font-size: 1.0625rem; font-weight: 600; margin: 0 0 0.5rem; color: var(--text); }
.mio-ann-body .ann-section p { color: var(--text-muted); line-height: 1.6; margin: 0 0 0.5rem; }
.mio-ann-body .ann-section p:last-child { margin-bottom: 0; }
.mio-ann-body .ann-highlight {
    background: var(--bg-page);
    border-left: 3px solid var(--primary);
    padding: 0.75rem 1rem;
    border-radius: 0 6px 6px 0;
    margin: 0.75rem 0;
}
.mio-ann-body .ann-highlight p { color: var(--text); font-weight: 500; margin: 0; }
.mio-ann-body ul { list-style: none; padding: 0; margin: 0.5rem 0; }
.mio-ann-body ul li {
    padding: 0.375rem 0 0.375rem 1.25rem;
    position: relative;
    color: var(--text-muted);
    line-height: 1.5;
}
.mio-ann-body ul li::before {
    content: "\2022";
    position: absolute;
    left: 0.375rem;
    color: var(--primary);
    font-weight: 700;
}
.mio-ann-body ul li strong { color: var(--text); }
.mio-ann-body .ann-section-divider { height: 1px; background: var(--border); margin: 1rem 0; }

.mio-ann-footer {
    padding: 1rem 1.5rem 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border);
}
.mio-ann-footer .btn { width: auto; }

.mio-ann-scroll-hint {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3rem;
    background: linear-gradient(to bottom, transparent, var(--bg-box) 70%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.25rem;
    pointer-events: none;
    color: var(--text-muted);
    animation: mio-ann-bounce 1.5s ease infinite;
}
@keyframes mio-ann-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

@media (max-width: 640px) {
    .mio-ann-overlay { padding: 0.5rem; }
    .mio-ann-header { padding: 1.5rem 1rem; }
    .mio-ann-header h2 { font-size: 1.25rem; }
    .mio-ann-body { padding: 1rem; }
    .mio-ann-footer { padding: 1rem; }
}

/* ========================================
   GATE PROGRESS (phase 2) — stacked exercises
   Sticky bar showing true per-gate completion + jump-to-next-unrated.
   Variable-driven; colors from themes.css.
   ======================================== */
.gate-progress {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.gate-progress-text {
    font-weight: 600;
    color: var(--text);
}

.gate-progress-jump {
    flex: 0 0 auto;
}

/* Brief highlight when "jump to next unrated" lands on a card. */
.exercise-item-card--flash {
    animation: gate-flash 1.5s ease-out;
    border-radius: 6px;
}

@keyframes gate-flash {
    0%   { background: var(--caution-light); }
    100% { background: transparent; }
}
