/* ── Tokens ── */
:root {
    --bg:        #f5f5f7;
    --surface:   #ffffff;
    --surface2:  #f9f9fb;
    --border:    #e4e4e8;
    --border2:   #eeeeF2;
    --text:      #18181b;
    --muted:     #71717a;
    --muted2:    #a1a1aa;
    --accent:    #2563eb;
    --accent-h:  #1d4ed8;
    --accent-bg: rgba(37,99,235,.08);
    --success:   #16a34a;
    --success-bg:rgba(22,163,74,.1);
    --danger:    #dc2626;
    --danger-bg: rgba(220,38,38,.1);
    --shadow:    0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
    --shadow-m:  0 4px 16px rgba(0,0,0,.08);
    --r:         12px;
    --sidebar:   256px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    background: var(--bg); color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
h1, h2, h3 { margin: 0; }

/* ── Shell: exactly 2 children: aside + main ── */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}
.brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 18px 0;
    flex-shrink: 0;
}
.brand-inner { display: flex; gap: 10px; align-items: center; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 9px;
    background: var(--text); color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.brand-title { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.brand-subtitle { font-size: 11px; color: var(--muted2); margin-top: 1px; }

/* Mobile toggle — hidden on desktop */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px; height: 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    cursor: pointer;
    padding: 8px;
    flex-shrink: 0;
}
.mobile-nav-toggle span {
    display: block; width: 100%; height: 2px;
    background: var(--text); border-radius: 2px;
    transition: .2s;
}

/* Sidebar body: scrollable content */
.sidebar-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 16px 12px 20px;
    gap: 16px;
    overflow-y: auto;
}

/* User summary */
.user-summary {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border2);
    padding-bottom: 16px;
}
.avatar-initial {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--text); color: #fff;
    display: grid; place-items: center;
    font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.user-summary strong { font-size: 13px; font-weight: 600; display: block; }
.small { font-size: 12px; }

/* Nav */
.nav { display: grid; gap: 2px; }
.nav-section-title {
    font-size: 10px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--muted2);
    padding: 12px 8px 4px;
}
.nav-link, .nav-button {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; text-align: left; border: 0;
    padding: 8px 10px; border-radius: 8px;
    background: transparent; color: var(--text);
    cursor: pointer; font-size: 13.5px; font-weight: 500;
    transition: background .12s;
    gap: 8px;
}
.nav-link:hover, .nav-button:hover { background: var(--surface2); }
.nav-link.active { background: var(--accent-bg); color: var(--accent); font-weight: 600; }
.nav-soon { color: var(--muted); font-weight: 400; }
.soon-badge {
    font-size: 10px; font-weight: 600; letter-spacing: .04em;
    text-transform: uppercase;
    background: var(--border2); color: var(--muted2);
    padding: 2px 6px; border-radius: 20px;
    flex-shrink: 0; margin-left: auto;
}

/* Sidebar footer */
.sidebar-footer { margin-top: auto; padding-top: 8px; }

/* ── Main ── */
.main { padding: 32px 36px; min-width: 0; }

/* ── Topbar ── */
.topbar {
    display: flex; justify-content: space-between;
    align-items: flex-start; gap: 16px;
    margin-bottom: 28px;
}
.topbar-title h1 { font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 3px; }
.topbar-title p { margin: 0; color: var(--muted); font-size: 13px; }
.topbar-meta {
    font-size: 13px; color: var(--muted);
    background: var(--surface); border: 1px solid var(--border);
    padding: 7px 13px; border-radius: 8px;
    white-space: nowrap; box-shadow: var(--shadow);
    flex-shrink: 0;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 22px;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 16px; font-weight: 600; letter-spacing: -.2px; margin-bottom: 6px; }
.card > p { margin: 0 0 16px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.card.narrow { max-width: 700px; }

/* Auth */
.auth-card { max-width: 400px; margin: 10vh auto; }
.auth-card .card { padding: 32px; }
.auth-card h2 { font-size: 20px; margin-bottom: 8px; }

/* ── Grid ── */
.grid { display: grid; gap: 18px; margin-bottom: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Forms ── */
.stack-md { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 500; }
label span { color: var(--muted); font-weight: 400; font-size: 13px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%; padding: 10px 13px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
textarea { resize: vertical; line-height: 1.6; }
input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; }
.range-val {
    min-width: 38px; text-align: center;
    font-size: 14px; font-weight: 700; color: var(--accent);
    background: var(--accent-bg); border-radius: 6px;
    padding: 4px 8px; flex-shrink: 0;
}

/* ── Buttons ── */
.button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 0;
    background: var(--accent); color: #fff;
    font-size: 14px; font-weight: 600; cursor: pointer;
    text-decoration: none;
    transition: background .15s;
    box-shadow: 0 1px 3px rgba(37,99,235,.2);
}
.button:hover { background: var(--accent-h); }
.button-secondary {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    box-shadow: var(--shadow);
}
.button-secondary:hover { background: var(--surface2); }
.button-small { padding: 7px 13px; font-size: 13px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0 18px; }
.stat {
    background: var(--surface2); border: 1px solid var(--border2);
    border-radius: 10px; padding: 14px 16px;
}
.stat-label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; font-weight: 500; letter-spacing: .01em; }
.stat strong { font-size: 20px; font-weight: 700; letter-spacing: -.5px; }

/* ── Helper box ── */
.helper-box {
    margin-top: 16px; padding: 13px 15px; border-radius: 9px;
    background: var(--accent-bg);
    border: 1px solid rgba(37,99,235,.14);
    color: var(--muted); font-size: 13px; line-height: 1.6;
}

/* ── Flash ── */
.flash { margin-bottom: 14px; padding: 11px 15px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.flash-success { background: var(--success-bg); border: 1px solid rgba(22,163,74,.22); color: var(--success); }
.flash-error   { background: var(--danger-bg);  border: 1px solid rgba(220,38,38,.22);  color: var(--danger); }

/* ── Timeline ── */
.timeline { display: grid; gap: 8px; }
.timeline-item {
    padding: 13px 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}
.timeline-date { color: var(--muted); font-size: 12px; margin-bottom: 4px; font-weight: 500; }
.timeline-item .muted { font-size: 13px; margin-top: 3px; line-height: 1.5; }

/* ── Misc ── */
.muted { color: var(--muted); }
.clean-list { margin: 0; padding-left: 18px; display: grid; gap: 9px; font-size: 14px; line-height: 1.6; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border2); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; background: var(--surface2); }

/* ── Report ── */
.report-box {
    white-space: pre-wrap; background: var(--surface2);
    border: 1px solid var(--border); padding: 15px; border-radius: 9px;
    font-size: 13px; line-height: 1.7; font-family: inherit;
}

/* ── Toast ── */
.toast {
    position: fixed; right: 20px; bottom: 24px;
    background: var(--text); color: #fff;
    border-radius: 10px; padding: 12px 18px;
    max-width: 290px; font-size: 13.5px; line-height: 1.5;
    box-shadow: var(--shadow-m); z-index: 1000;
}

/* ── Code ── */
code {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 5px; padding: 2px 6px;
    font-size: .87em; color: var(--accent); font-family: inherit;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }

    .sidebar {
        position: relative; height: auto;
        border-right: 0; border-bottom: 1px solid var(--border);
        overflow: visible;
    }

    .mobile-nav-toggle { display: flex; }

    /* Collapse sidebar body on mobile; toggle adds .is-open */
    .sidebar-body {
        display: none;
        padding-top: 12px;
    }
    .sidebar.is-open .sidebar-body { display: flex; }

    .main { padding: 20px 16px; }
    .grid.two, .stats { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; gap: 10px; margin-bottom: 18px; }
    .auth-card { margin: 6vh 16px; }
}

@media (max-width: 520px) {
    .card { padding: 16px; }
    .main { padding: 14px; }
    .button-row { flex-direction: column; }
    .button-row .button, .button-row a.button { width: 100%; justify-content: center; }
}

/* ── Onboarding ── */
.onboarding-wrap { max-width: 520px; margin: 8vh auto; padding: 0 16px; }
.onboarding-card { padding: 40px; }
.onboarding-top { text-align: center; margin-bottom: 32px; }
.onboarding-top h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; margin-bottom: 10px; }
.onboarding-sub { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0; }
.onboarding-actions { display: flex; justify-content: flex-end; margin-top: 8px; }
em.opt { font-style: normal; font-size: 12px; color: var(--muted2); font-weight: 400; }

/* ── Greeting ── */
.greeting-block { margin-bottom: 28px; }
.greeting-text { font-size: 28px; font-weight: 700; letter-spacing: -.6px; margin: 0 0 6px; }
.greeting-sub { margin: 0; color: var(--muted); font-size: 15px; }

/* ── Action Cards ── */
.action-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 28px; }
.action-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 22px 20px 20px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .12s;
    box-shadow: var(--shadow);
    text-decoration: none; color: var(--text);
    display: block;
}
.action-card:hover { border-color: var(--accent); box-shadow: 0 4px 16px rgba(37,99,235,.1); transform: translateY(-2px); }
.action-icon { font-size: 20px; margin-bottom: 12px; opacity: .7; }
.action-title { font-size: 15px; font-weight: 600; letter-spacing: -.2px; margin-bottom: 6px; }
.action-desc { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ── Chat ── */
    .chat-layout { height: calc(100vh - 120px); border-radius: 0; border-left: 0; border-right: 0; }
    .chat-bubble { max-width: 88%; }
    .manager-card-stats { grid-template-columns: repeat(3,1fr); }
}

/* ── Color vars for charts ── */
:root {
    --energy-color: #2563eb;
    --stress-color: #e85d3a;
}

/* ── Greeting quote ── */
.greeting-quote {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 15px;
    font-style: italic;
    font-weight: 400;
    line-height: 1.5;
}

/* ── Action cards: bigger, with status top row ── */
.action-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}
.action-title { font-size: 17px; font-weight: 700; letter-spacing: -.3px; margin-bottom: 8px; }
.action-desc  { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.action-icon  { font-size: 22px; opacity: .75; }

.action-badge {
    font-size: 11px; font-weight: 600; letter-spacing: .03em;
    padding: 3px 9px; border-radius: 20px;
    text-transform: uppercase;
}
.action-badge--done {
    background: rgba(22,163,74,.12); color: var(--success);
    border: 1px solid rgba(22,163,74,.2);
}
.action-badge--open {
    background: rgba(217,119,6,.1); color: #b45309;
    border: 1px solid rgba(217,119,6,.2);
}
.action-card--done { border-color: rgba(22,163,74,.25); }
.action-card--primary { border-color: rgba(37,99,235,.25); }

/* ── Check-in prompt banner ── */
.checkin-prompt {
    background: var(--surface);
    border: 1px solid rgba(37,99,235,.2);
    border-radius: var(--r);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(37,99,235,.08);
}
.checkin-prompt-inner {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.checkin-prompt-icon { font-size: 22px; opacity: .6; flex-shrink: 0; }
.checkin-prompt-title { font-size: 15px; font-weight: 600; }
.checkin-prompt-sub { font-size: 13px; color: var(--muted); }
.checkin-prompt-actions { display: flex; gap: 8px; margin-left: auto; }

/* ── Post-save modal ── */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    display: flex; align-items: center; justify-content: center;
    z-index: 200;
    padding: 20px;
}
.modal-box {
    background: var(--surface);
    border-radius: 18px;
    padding: 40px 36px;
    max-width: 420px; width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
    animation: modalIn .2s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }
.modal-icon {
    width: 52px; height: 52px; border-radius: 16px;
    background: var(--success-bg);
    color: var(--success);
    display: grid; place-items: center;
    font-size: 22px; font-weight: 700;
    margin: 0 auto 18px;
}
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; margin-bottom: 10px; }
.modal-text  { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 24px; }
.modal-actions { display: grid; gap: 10px; margin-bottom: 20px; }
.modal-actions .button { justify-content: center; }
.modal-logout {
    font-size: 13px; color: var(--muted2);
    border-bottom: 1px solid var(--border2);
    padding-bottom: 2px; cursor: pointer;
}
.modal-logout:hover { color: var(--muted); }

/* ── Mood selector ── */
.mood-row { display: grid; gap: 10px; }
.mood-label { font-size: 14px; font-weight: 500; }
.mood-emojis { display: flex; gap: 12px; align-items: center; }
.mood-option { cursor: pointer; }
.mood-option input { display: none; }
.mood-emoji {
    font-size: 28px; display: block;
    border-radius: 10px;
    padding: 6px 8px;
    transition: background .12s, transform .12s;
    opacity: .55;
}
.mood-option:hover .mood-emoji { opacity: .85; transform: scale(1.1); }
.mood-option input:checked + .mood-emoji {
    opacity: 1; background: var(--accent-bg);
    transform: scale(1.15);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Slider label ── */
.range-label-min { font-size: 12px; color: var(--muted2); white-space: nowrap; flex-shrink: 0; }

/* ── Checkbox label ── */
.checkbox-label {
    display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
    font-size: 14px; font-weight: 400;
}
.checkbox-label input { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }

/* ── Timeline row ── */
.timeline-date-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.discuss-badge {
    font-size: 10px; font-weight: 600; letter-spacing: .04em;
    padding: 2px 7px; border-radius: 20px; text-transform: uppercase;
    background: rgba(37,99,235,.1); color: var(--accent);
}
.intensity-dot {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.intensity-high { background: #e85d3a; }
.intensity-mid  { background: #d97706; }
.intensity-low  { background: var(--success); }

/* ── Level pills on dashboard ── */
.timeline-levels { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0; }
.level-pill {
    font-size: 11px; font-weight: 600; padding: 2px 8px;
    border-radius: 20px;
}
.level-energy { background: rgba(37,99,235,.1);  color: var(--accent); }
.level-stress { background: rgba(232,93,58,.1);  color: #c04a2a; }
.level-todo   { background: rgba(217,119,6,.1);  color: #b45309; }

/* ── Report ── */
.report-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.report-week-title { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin: 0 0 4px; }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.week-day {
    border-radius: 10px; padding: 12px 8px; text-align: center;
    border: 1px solid var(--border2);
}
.week-day--done  { background: rgba(22,163,74,.07); border-color: rgba(22,163,74,.25); }
.week-day--empty { background: var(--surface2); }
.week-day-label { font-size: 11px; font-weight: 600; color: var(--muted2); margin-bottom: 6px; text-transform: uppercase; }
.week-day-icon { font-size: 16px; margin-bottom: 4px; }
.week-day-icon--empty { color: var(--border); }
.week-day-vals { font-size: 11px; font-weight: 600; display: grid; gap: 2px; }

.chart-wrap { margin: 12px 0 8px; position: relative; }
.chart-legend { font-size: 12px; color: var(--muted); display: flex; gap: 16px; margin-top: 8px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

.stat-bar-row { display: flex; align-items: center; gap: 10px; }
.stat-bar-label { font-size: 12px; color: var(--muted); width: 70px; flex-shrink: 0; }
.stat-bar-track { flex: 1; height: 6px; background: var(--border2); border-radius: 3px; overflow: hidden; }
.stat-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.stat-bar-energy { background: var(--energy-color); }
.stat-bar-stress { background: var(--stress-color); }
.stat-bar-val { font-size: 13px; font-weight: 700; width: 28px; text-align: right; }

.topic-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.topic-chip {
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 20px; padding: 5px 13px;
    font-size: 13px; color: var(--text);
}

/* ── Responsive additions ── */
@media (max-width: 860px) {
    .week-grid { grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .week-day { padding: 8px 4px; }
    .week-day-vals { font-size: 10px; }
    .checkin-prompt-inner { flex-direction: column; align-items: flex-start; }
    .checkin-prompt-actions { margin-left: 0; }
    .modal-box { padding: 28px 20px; }
}
@media (max-width: 520px) {
    .week-grid { grid-template-columns: repeat(4, 1fr); }
    .mood-emojis { gap: 8px; }
    .mood-emoji { font-size: 24px; }
}

/* ── Check-in Step Flow ─────────────────────────────────────────── */
.ci-wrap {
    max-width: 580px;
    margin: 0 auto;
}
.ci-progress {
    height: 3px;
    background: var(--border2);
    border-radius: 3px;
    margin-bottom: 36px;
    overflow: hidden;
}
.ci-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .4s ease;
}
.ci-step {
    display: none;
    animation: stepIn .28s ease;
}
.ci-step.active { display: block; }
@keyframes stepIn { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }

.ci-step-label {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -.5px;
    margin-bottom: 32px;
    color: var(--text);
    line-height: 1.3;
}

/* Big emojis */
.ci-emojis {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.ci-emoji-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 18px;
    padding: 20px 18px;
    cursor: pointer;
    transition: border-color .15s, transform .12s, background .12s, box-shadow .12s;
    min-width: 90px;
}
.ci-emoji-btn:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(37,99,235,.12);
}
.ci-emoji-btn.selected {
    border-color: var(--accent);
    background: var(--accent-bg);
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37,99,235,.15);
}
.ci-emoji {
    font-size: 52px;
    line-height: 1;
    display: block;
}
.ci-emoji-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

/* Large sliders */
.ci-slider-wrap { margin-bottom: 28px; }
.ci-slider-poles {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted2);
    margin-bottom: 12px;
}
.ci-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    border-radius: 5px;
    background: var(--border2);
    outline: none;
    cursor: pointer;
    margin-bottom: 16px;
}
.ci-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
    transition: transform .12s;
}
.ci-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.ci-slider::-moz-range-thumb {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}
.ci-slider-val {
    text-align: center;
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -2px;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}
.ci-next-btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface2);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
    transition: background .12s;
    margin-top: 8px;
}
.ci-next-btn:hover { background: var(--border2); }
.ci-textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color .15s;
    margin-bottom: 20px;
    min-height: 120px;
    font-family: inherit;
}
.ci-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.ci-submit-btn {
    width: 100%;
    padding: 16px;
    font-size: 16px;
    border-radius: 12px;
    justify-content: center;
}

/* Success screen */
.ci-success {
    max-width: 500px;
    margin: 4vh auto;
    text-align: center;
}
.ci-success-inner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 36px;
    box-shadow: var(--shadow-m);
}
.ci-success-check {
    width: 64px; height: 64px;
    border-radius: 20px;
    background: var(--success-bg);
    color: var(--success);
    font-size: 28px; font-weight: 800;
    display: grid; place-items: center;
    margin: 0 auto 24px;
}
.ci-success h2 {
    font-size: 26px; font-weight: 800;
    letter-spacing: -.6px; margin-bottom: 10px;
}
.ci-success p {
    color: var(--muted); font-size: 15px;
    line-height: 1.6; margin-bottom: 32px;
}
.ci-success-actions {
    display: grid;
    gap: 12px;
    margin-bottom: 24px;
}
.ci-action-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 22px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, background .12s;
    text-align: left;
}
.ci-action-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(37,99,235,.1);
    background: var(--accent-bg);
}
.ci-action-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.ci-action-primary:hover { background: var(--accent-h); border-color: var(--accent-h); }
.ci-action-icon { font-size: 20px; flex-shrink: 0; }
.ci-action-label { font-size: 15px; font-weight: 600; }
.ci-logout {
    font-size: 13px;
    color: var(--muted2);
    text-decoration: none;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 1px;
}
.ci-logout:hover { color: var(--muted); }

/* ── Coach Detail ───────────────────────────────────────────────── */
.coach-detail-back {
    display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap;
}
.coach-mgr-header {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.coach-mgr-avatar {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--text); color: #fff;
    display: grid; place-items: center;
    font-size: 22px; font-weight: 800; flex-shrink: 0;
}
.coach-mgr-info { flex: 1; min-width: 0; }
.coach-mgr-info h2 { font-size: 22px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 4px; }
.coach-mgr-meta { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.coach-mgr-goal { font-size: 13px; color: var(--accent); font-weight: 500; }
.coach-mgr-stats { display: flex; gap: 16px; flex-shrink: 0; }
.coach-mgr-stats .stat { min-width: 60px; }

/* AI Analysis Card */
.coach-analysis-card {
    background: linear-gradient(135deg, #fafbff 0%, #f0f4ff 100%);
    border: 1px solid rgba(37,99,235,.18);
    border-radius: var(--r);
    padding: 28px;
    margin-bottom: 18px;
    box-shadow: 0 2px 12px rgba(37,99,235,.07);
}
.coach-analysis-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}
.coach-analysis-badge {
    background: var(--accent); color: #fff;
    font-size: 11px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; padding: 4px 10px;
    border-radius: 20px;
}
.coach-analysis-age { font-size: 12px; color: var(--muted2); }
.coach-analysis-body {
    font-size: 14px; line-height: 1.75; color: var(--text);
    white-space: pre-wrap;
}
/* Basic markdown-like formatting */
.markdown-output { white-space: pre-wrap; }

/* Coach overview */
.coach-overview-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }
.stress-signal {
    padding: 4px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 700;
    margin-left: auto; flex-shrink: 0;
}
.signal-high { background: rgba(220,38,38,.12); color: var(--danger); }
.signal-mid  { background: rgba(217,119,6,.1);  color: #b45309; }
.signal-ok   { background: var(--success-bg);   color: var(--success); }
.manager-mini-bars { display: grid; gap: 7px; margin: 12px 0 0; }
.mini-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.mini-bar-row > span:first-child { width: 50px; flex-shrink: 0; }
.mini-bar-track { flex: 1; height: 5px; background: var(--border2); border-radius: 3px; overflow: hidden; }
.mini-bar-fill  { height: 100%; border-radius: 3px; }
.mini-bar-row > span:last-child { width: 26px; text-align: right; font-weight: 600; color: var(--text); }

/* Chat toggle */
.coach-chat-toggle-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.coach-chat-toggle-row h2 { margin-bottom: 0; }

/* ── Responsive additions ── */
@media (max-width: 860px) {
    .coach-overview-grid { grid-template-columns: 1fr; }
    .ci-emoji { font-size: 40px; }
    .ci-emoji-btn { min-width: 70px; padding: 14px 12px; }
    .ci-slider-val { font-size: 36px; }
    .ci-step-label { font-size: 20px; }
    .coach-mgr-stats { width: 100%; justify-content: flex-start; }
}
@media (max-width: 480px) {
    .ci-emojis { gap: 8px; }
    .ci-emoji { font-size: 34px; }
    .ci-emoji-btn { min-width: 58px; padding: 12px 8px; }
    .ci-success-inner { padding: 32px 20px; }
}

/* ── Check-in Button Fixes ───────────────────────────────────────── */

/* Both accent actions same weight/color */
.ci-action-accent {
    background: var(--surface);
    border: 1.5px solid var(--accent);
    color: var(--accent);
}
.ci-action-accent:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(37,99,235,.18);
}
.ci-action-accent .ci-action-icon { color: inherit; }

.ci-action-neutral {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--muted);
}
.ci-action-neutral:hover { background: var(--surface2); color: var(--text); }

/* Remove old primary override that made one blue */
.ci-action-primary { background: var(--surface); border: 1.5px solid var(--accent); color: var(--accent); }
.ci-action-primary:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Already-done dialog */
.ci-redo-wrap { max-width: 440px; margin: 8vh auto; padding: 0 16px; }
.ci-redo-card { padding: 40px; text-align: center; }
.ci-redo-icon {
    width: 52px; height: 52px; border-radius: 14px;
    background: rgba(22,163,74,.1); color: var(--success);
    font-size: 22px; font-weight: 800;
    display: grid; place-items: center;
    margin: 0 auto 20px;
}
.ci-redo-card h2 { font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.ci-redo-card p  { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 24px; }
.ci-redo-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Abmelden button – bigger, more visible ── */
.sidebar-footer .button-secondary {
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 600;
    border-color: var(--border);
    color: var(--text);
    text-align: center;
    justify-content: center;
    width: 100%;
}
.sidebar-footer .button-secondary:hover {
    background: var(--surface2);
    border-color: var(--muted2);
}

/* ── Analysis formatted output ───────────────────────────────────── */
.an-heading {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted2);
    margin: 20px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border2);
}
.an-heading:first-child { margin-top: 0; }
.an-bullet {
    font-size: 13.5px;
    line-height: 1.6;
    padding: 3px 0 3px 6px;
    color: var(--text);
}
.an-warn {
    font-size: 13.5px;
    line-height: 1.6;
    padding: 5px 10px;
    margin: 4px 0;
    background: rgba(220,38,38,.07);
    border-left: 3px solid var(--danger);
    border-radius: 0 6px 6px 0;
    color: var(--text);
    font-weight: 500;
}
.an-ok {
    font-size: 13.5px;
    line-height: 1.6;
    padding: 3px 0 3px 6px;
    color: var(--success);
}
.an-line {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
}
.an-gap { height: 6px; }

/* Analysis loading dots */
.analysis-loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 12px 0;
}
.analysis-loading-dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--muted2);
    animation: typing .9s infinite;
}
.analysis-loading-dots span:nth-child(2) { animation-delay: .2s; }
.analysis-loading-dots span:nth-child(3) { animation-delay: .4s; }

/* Analysis loading popup overlay */
.analysis-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
}
.analysis-popup-box {
    background: var(--surface);
    border-radius: 18px;
    padding: 36px 40px;
    text-align: center;
    max-width: 320px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.analysis-popup-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto 18px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.analysis-popup-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.3px;
    margin-bottom: 8px;
}
.analysis-popup-sub {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── Chat suggestion chips ────────────────────────────────────────── */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
    align-self: flex-start;
    max-width: 85%;
}
.chat-suggestion-btn {
    background: var(--surface);
    border: 1.5px solid var(--accent);
    color: var(--accent);
    border-radius: 20px;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s;
    text-align: left;
    line-height: 1.4;
}
.chat-suggestion-btn:hover {
    background: var(--accent);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════
   5 SITE-WIDE COLOR THEMES  (applied to <html> element)
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. Blanc (default – clean light) ─────────────────────────────── */
html,
html.theme-blanc {
    --bg:           #f5f5f7;
    --surface:      #ffffff;
    --surface2:     #f9f9fb;
    --border:       #e4e4e8;
    --border2:      #eeeeF2;
    --text:         #18181b;
    --muted:        #71717a;
    --muted2:       #a1a1aa;
    --accent:       #2563eb;
    --accent-h:     #1d4ed8;
    --accent-bg:    rgba(37,99,235,.08);
    --success:      #16a34a;
    --success-bg:   rgba(22,163,74,.1);
    --danger:       #dc2626;
    --danger-bg:    rgba(220,38,38,.1);
    --warning:      #d97706;
    --shadow:       0 1px 3px rgba(0,0,0,.07),0 1px 2px rgba(0,0,0,.04);
    --shadow-m:     0 4px 16px rgba(0,0,0,.08);
    /* sidebar brand mark */
    --brand-bg:     #18181b;
    --brand-text:   #ffffff;
    /* chat */
    --chat-bg:      #f5f5f7;
    --chat-surface: #ffffff;
    --chat-surface2:#f9f9fb;
    --chat-border:  #e4e4e8;
    --chat-text:    #18181b;
    --chat-muted:   #71717a;
    --chat-muted2:  #a1a1aa;
    --chat-accent:  #2563eb;
    --chat-user-bg: #2563eb;
    --chat-user-txt:#ffffff;
    --chat-bot-bg:  #f0f0f4;
    --chat-bot-txt: #18181b;
    --chat-bot-bdr: #e4e4e8;
    --chat-inp-bg:  #f9f9fb;
    --chat-inp-txt: #18181b;
    --chat-send-bg: #2563eb;
    --chat-hint:    #a1a1aa;
}

/* ── 2. Ivory (warm light – amber accents) ─────────────────────────── */
html.theme-ivory {
    --bg:           #faf8f4;
    --surface:      #fffdf8;
    --surface2:     #f5f3ef;
    --border:       #e8e3db;
    --border2:      #f0ece4;
    --text:         #1c1917;
    --muted:        #78716c;
    --muted2:       #a8a29e;
    --accent:       #b45309;
    --accent-h:     #92400e;
    --accent-bg:    rgba(180,83,9,.09);
    --success:      #15803d;
    --success-bg:   rgba(21,128,61,.1);
    --danger:       #b91c1c;
    --danger-bg:    rgba(185,28,28,.1);
    --warning:      #d97706;
    --shadow:       0 1px 3px rgba(0,0,0,.06),0 1px 2px rgba(0,0,0,.04);
    --shadow-m:     0 4px 16px rgba(0,0,0,.08);
    --brand-bg:     #1c1917;
    --brand-text:   #fffdf8;
    --chat-bg:      #faf8f4;
    --chat-surface: #fffdf8;
    --chat-surface2:#f5f3ef;
    --chat-border:  #e8e3db;
    --chat-text:    #1c1917;
    --chat-muted:   #78716c;
    --chat-muted2:  #a8a29e;
    --chat-accent:  #b45309;
    --chat-user-bg: #b45309;
    --chat-user-txt:#ffffff;
    --chat-bot-bg:  #f0ece4;
    --chat-bot-txt: #1c1917;
    --chat-bot-bdr: #e8e3db;
    --chat-inp-bg:  #f5f3ef;
    --chat-inp-txt: #1c1917;
    --chat-send-bg: #b45309;
    --chat-hint:    #a8a29e;
}

/* ── 3. Ocean (light – sky/teal accent) ────────────────────────────── */
html.theme-ocean {
    --bg:           #f0f6ff;
    --surface:      #ffffff;
    --surface2:     #e8f2ff;
    --border:       #c7dcf5;
    --border2:      #d8eaff;
    --text:         #0c1e35;
    --muted:        #3d6080;
    --muted2:       #7a9ab5;
    --accent:       #0284c7;
    --accent-h:     #0369a1;
    --accent-bg:    rgba(2,132,199,.1);
    --success:      #0f766e;
    --success-bg:   rgba(15,118,110,.1);
    --danger:       #be185d;
    --danger-bg:    rgba(190,24,93,.1);
    --warning:      #b45309;
    --shadow:       0 1px 4px rgba(2,50,100,.08),0 1px 2px rgba(0,0,0,.04);
    --shadow-m:     0 4px 18px rgba(2,50,100,.1);
    --brand-bg:     #0c1e35;
    --brand-text:   #ffffff;
    --chat-bg:      #eef5ff;
    --chat-surface: #ffffff;
    --chat-surface2:#e0eefc;
    --chat-border:  #c7dcf5;
    --chat-text:    #0c1e35;
    --chat-muted:   #3d6080;
    --chat-muted2:  #7a9ab5;
    --chat-accent:  #0284c7;
    --chat-user-bg: #0284c7;
    --chat-user-txt:#ffffff;
    --chat-bot-bg:  #daeaff;
    --chat-bot-txt: #0c1e35;
    --chat-bot-bdr: #c7dcf5;
    --chat-inp-bg:  #e8f2ff;
    --chat-inp-txt: #0c1e35;
    --chat-send-bg: #0284c7;
    --chat-hint:    #7a9ab5;
}

/* ── 4. Midnight (dark – navy / blue) ──────────────────────────────── */
html.theme-midnight {
    --bg:           #0f172a;
    --surface:      #1e293b;
    --surface2:     #152030;
    --border:       #2d4060;
    --border2:      #253550;
    --text:         #e2e8f0;
    --muted:        #94a3b8;
    --muted2:       #64748b;
    --accent:       #60a5fa;
    --accent-h:     #3b82f6;
    --accent-bg:    rgba(96,165,250,.13);
    --success:      #4ade80;
    --success-bg:   rgba(74,222,128,.12);
    --danger:       #f87171;
    --danger-bg:    rgba(248,113,113,.12);
    --warning:      #fbbf24;
    --shadow:       0 1px 4px rgba(0,0,0,.3),0 1px 2px rgba(0,0,0,.2);
    --shadow-m:     0 6px 24px rgba(0,0,0,.4);
    --brand-bg:     #60a5fa;
    --brand-text:   #0f172a;
    --chat-bg:      #0f172a;
    --chat-surface: #1e293b;
    --chat-surface2:#152030;
    --chat-border:  #2d4060;
    --chat-text:    #e2e8f0;
    --chat-muted:   #94a3b8;
    --chat-muted2:  #64748b;
    --chat-accent:  #60a5fa;
    --chat-user-bg: #2563eb;
    --chat-user-txt:#ffffff;
    --chat-bot-bg:  #1e293b;
    --chat-bot-txt: #e2e8f0;
    --chat-bot-bdr: #2d4060;
    --chat-inp-bg:  #1e293b;
    --chat-inp-txt: #e2e8f0;
    --chat-send-bg: #3b82f6;
    --chat-hint:    #64748b;
}

/* ── 5. Emerald (dark – forest green) ──────────────────────────────── */
html.theme-emerald {
    --bg:           #071912;
    --surface:      #0f2d1e;
    --surface2:     #0a2018;
    --border:       #1a4230;
    --border2:      #153324;
    --text:         #d1fae5;
    --muted:        #6ee7b7;
    --muted2:       #4ade80;
    --accent:       #34d399;
    --accent-h:     #10b981;
    --accent-bg:    rgba(52,211,153,.13);
    --success:      #4ade80;
    --success-bg:   rgba(74,222,128,.12);
    --danger:       #f87171;
    --danger-bg:    rgba(248,113,113,.12);
    --warning:      #fbbf24;
    --shadow:       0 1px 4px rgba(0,0,0,.35),0 1px 2px rgba(0,0,0,.25);
    --shadow-m:     0 6px 24px rgba(0,0,0,.5);
    --brand-bg:     #34d399;
    --brand-text:   #071912;
    --chat-bg:      #071912;
    --chat-surface: #0f2d1e;
    --chat-surface2:#0a2018;
    --chat-border:  #1a4230;
    --chat-text:    #d1fae5;
    --chat-muted:   #6ee7b7;
    --chat-muted2:  #34d399;
    --chat-accent:  #34d399;
    --chat-user-bg: #059669;
    --chat-user-txt:#ffffff;
    --chat-bot-bg:  #0f2d1e;
    --chat-bot-txt: #d1fae5;
    --chat-bot-bdr: #1a4230;
    --chat-inp-bg:  #0a2018;
    --chat-inp-txt: #d1fae5;
    --chat-send-bg: #34d399;
    --chat-hint:    #4ade80;
}

/* ── Apply theme vars to ALL components ─────────────────────────────── */

/* Sidebar brand mark uses brand-specific vars */
.brand-mark {
    background: var(--brand-bg) !important;
    color: var(--brand-text) !important;
}

/* Chat layout now uses --chat-* vars */
.chat-layout       { background: var(--chat-bg); border-color: var(--chat-border); }
.chat-header       { background: var(--chat-surface); border-color: var(--chat-border); }
.chat-header-name  { color: var(--chat-text); }
.chat-header-sub   { color: var(--chat-muted); }
.chat-avatar       { background: var(--chat-accent); color: var(--chat-user-txt); }
.chat-messages     { background: var(--chat-bg); }

.chat-bubble--user .bubble-text {
    background: var(--chat-user-bg);
    color: var(--chat-user-txt);
}
.chat-bubble--bot .bubble-text {
    background: var(--chat-bot-bg);
    border-color: var(--chat-bot-bdr);
    color: var(--chat-bot-txt);
}
.chat-typing {
    background: var(--chat-bot-bg);
    border-color: var(--chat-bot-bdr);
}
.chat-typing span   { background: var(--chat-muted); }

.chat-input-area    { background: var(--chat-bg); border-color: var(--chat-border); }
.chat-input {
    background: var(--chat-inp-bg);
    color: var(--chat-inp-txt);
    border-color: var(--chat-border);
}
.chat-input::placeholder { color: var(--chat-muted2); }
.chat-input:focus   { border-color: var(--chat-accent); }
.chat-send          { background: var(--chat-send-bg); color: var(--chat-user-txt); }
.chat-send:hover    { background: var(--chat-accent); }
.chat-hint          { color: var(--chat-hint); }
.chat-limit-notice  { background: var(--chat-surface); border-color: var(--chat-border); color: var(--chat-muted); }

.chat-suggestion-btn {
    border-color: var(--chat-accent);
    color: var(--chat-accent);
    background: transparent;
}
.chat-suggestion-btn:hover { background: var(--chat-accent); color: var(--chat-user-txt); }

/* History panel uses chat vars */
.chat-history-btn   { border-color: var(--chat-border); color: var(--chat-muted); }
.chat-history-btn:hover { background: var(--chat-surface2); }
.chat-history-panel { background: var(--chat-surface); border-color: var(--chat-border); }
.chat-history-title { color: var(--chat-muted2); }
.hist-day-label     { color: var(--chat-accent); }
.hist-msg           { color: var(--chat-text); }
.hist-msg--user     { background: var(--chat-surface2); }
.hist-msg--assistant{ color: var(--chat-muted); }
.hist-msg-time      { color: var(--chat-muted2); }

/* Dark-theme input fix */
html.theme-midnight input, html.theme-midnight textarea, html.theme-midnight select,
html.theme-emerald  input, html.theme-emerald  textarea, html.theme-emerald  select {
    background: var(--surface2);
    color: var(--text);
    border-color: var(--border);
}
html.theme-midnight input:focus, html.theme-midnight textarea:focus, html.theme-midnight select:focus,
html.theme-emerald  input:focus, html.theme-emerald  textarea:focus, html.theme-emerald  select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-bg);
}
html.theme-midnight input::placeholder, html.theme-midnight textarea::placeholder,
html.theme-emerald  input::placeholder, html.theme-emerald  textarea::placeholder {
    color: var(--muted2);
}

/* Dark mode: code blocks */
html.theme-midnight code, html.theme-emerald code {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--accent);
}

/* Dark mode: flash adjustments */
html.theme-midnight .flash-success, html.theme-emerald .flash-success {
    background: var(--success-bg);
    border-color: rgba(74,222,128,.25);
    color: var(--success);
}
html.theme-midnight .flash-error, html.theme-emerald .flash-error {
    background: var(--danger-bg);
    border-color: rgba(248,113,113,.25);
    color: var(--danger);
}

/* Dark mode: helper-box */
html.theme-midnight .helper-box, html.theme-emerald .helper-box {
    background: var(--accent-bg);
    border-color: rgba(255,255,255,.1);
    color: var(--muted);
}

/* Dark-mode modal */
html.theme-midnight .modal-box, html.theme-emerald .modal-box {
    background: var(--surface);
    border: 1px solid var(--border);
}
html.theme-midnight .modal-title, html.theme-emerald .modal-title { color: var(--text); }
html.theme-midnight .modal-text,  html.theme-emerald .modal-text  { color: var(--muted); }

/* ── Coach settings theme cards (5 themes) ──────────────────────────── */

/* Theme selector cards update (remove old .theme-swatch, use .theme-card-preview) */
.theme-selector { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; }
.theme-option input { display: none; }
.theme-swatch {
    display: flex; overflow: hidden;
    width: 52px; height: 36px; border-radius: 9px;
    border: 2px solid var(--border);
    transition: border-color .15s;
}
.theme-swatch span { flex: 1; display: block; }
.theme-option input:checked + .theme-swatch {
    border-color: var(--accent);
    box-shadow: 0 2px 10px var(--accent-bg);
}

/* ── Chat Redesign v17 ───────────────────────────────────────────── */

/* Layout: prev panel + main side by side on desktop */
.chat-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 160px);
    min-height: 460px;
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--shadow-m);
    border: 1px solid var(--chat-border, var(--border));
}

/* Previous chats panel */
.chat-prev-panel {
    width: 280px;
    flex-shrink: 0;
    background: var(--chat-surface, var(--surface));
    border-right: 1px solid var(--chat-border, var(--border));
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-prev-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--chat-muted, var(--muted));
    border-bottom: 1px solid var(--chat-border, var(--border));
    flex-shrink: 0;
}
.chat-prev-close {
    background: none; border: none; cursor: pointer;
    color: var(--chat-muted, var(--muted)); font-size: 14px; padding: 2px 6px;
}
.chat-prev-close:hover { color: var(--chat-text, var(--text)); }
.chat-prev-day { padding: 12px 14px; border-bottom: 1px solid var(--chat-border, var(--border)); overflow-y: auto; }
.chat-prev-panel > .chat-prev-day { flex: 1; overflow-y: auto; }
.chat-prev-day-label { font-size: 11px; font-weight: 700; color: var(--chat-muted, var(--muted)); margin-bottom: 8px; }
.chat-prev-msg { margin-bottom: 6px; }
.chat-prev-bubble {
    padding: 7px 10px; border-radius: 9px;
    font-size: 12.5px; line-height: 1.5;
}
.chat-prev-msg--user .chat-prev-bubble {
    background: var(--chat-user-bg, var(--accent));
    color: var(--chat-user-txt, #fff);
    margin-left: 20%;
}
.chat-prev-msg--assistant .chat-prev-bubble {
    background: var(--chat-bot-bg, var(--surface2));
    color: var(--chat-bot-txt, var(--text));
    border: 1px solid var(--chat-bot-bdr, var(--border));
}
.chat-prev-time { font-size: 10px; color: var(--chat-muted, var(--muted)); margin-top: 2px; padding: 0 4px; }

/* Main chat area */
.chat-main {
    display: flex; flex-direction: column;
    flex: 1; min-width: 0;
    background: var(--chat-bg, var(--bg));
    overflow: hidden;
}

/* Header */
.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px;
    background: var(--chat-surface, var(--surface));
    border-bottom: 1px solid var(--chat-border, var(--border));
    flex-shrink: 0;
}
.chat-header-info { display: flex; align-items: center; gap: 12px; }
.chat-header-actions { display: flex; gap: 6px; }

/* Avatar with emoji + online dot */
.chat-avatar-wrap { position: relative; flex-shrink: 0; }
.chat-avatar-img {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--chat-surface, var(--surface2));
    border: 1px solid var(--chat-border, var(--border));
    display: grid; place-items: center; font-size: 20px;
}
.chat-avatar-dot {
    position: absolute; bottom: -1px; right: -1px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #22c55e; border: 2px solid var(--chat-bg, var(--bg));
}

.chat-header-name { font-size: 14px; font-weight: 600; color: var(--chat-text, var(--text)); }
.chat-header-sub  { font-size: 12px; color: var(--chat-muted, var(--muted)); }

.chat-header-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 13px; border-radius: 20px;
    border: 1px solid rgba(128,128,128,.18);
    background: rgba(255,255,255,.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    color: var(--chat-muted, var(--muted));
    font-size: 12px; font-weight: 600;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.chat-header-btn svg { flex-shrink: 0; }
.chat-header-btn:hover {
    background: rgba(255,255,255,.22);
    border-color: rgba(128,128,128,.3);
    color: var(--chat-text, var(--text));
}
.chat-header-btn--exit:hover {
    background: rgba(220,38,38,.12);
    border-color: rgba(220,38,38,.25);
    color: var(--danger);
}

/* Messages */
.chat-messages {
    flex: 1; overflow-y: auto;
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    background: var(--chat-bg, var(--bg));
    scroll-behavior: smooth;
}

/* Bubble with timestamp */
.chat-bubble { max-width: 75%; display: flex; flex-direction: column; }
.chat-bubble--user { align-self: flex-end; align-items: flex-end; }
.chat-bubble--bot  { align-self: flex-start; align-items: flex-start; }
.chat-bubble--bot .bubble-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-bubble--bot .bubble-avatar {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: var(--chat-surface, var(--surface2));
    border: 1px solid var(--chat-border, var(--border));
    display: grid; place-items: center; font-size: 14px;
    align-self: flex-end;
}
.bubble-text {
    padding: 10px 14px; border-radius: 14px;
    font-size: 14px; line-height: 1.6;
}
.chat-bubble--user .bubble-text {
    background: var(--chat-user-bg, var(--accent));
    color: var(--chat-user-txt, #fff);
    border-bottom-right-radius: 4px;
}
.chat-bubble--bot .bubble-text {
    background: var(--chat-bot-bg, var(--surface2));
    border: 1px solid var(--chat-bot-bdr, var(--border));
    color: var(--chat-bot-txt, var(--text));
    border-bottom-left-radius: 4px;
}
    display: flex; align-items: center; gap: 10px;
    align-self: flex-start; padding: 4px 0;
}
.chat-thinking-avatar {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    background: var(--chat-surface, var(--surface2));
    border: 1px solid var(--chat-border, var(--border));
    display: grid; place-items: center; font-size: 14px;
}
.chat-thinking-text {
    font-size: 13px; color: var(--chat-muted, var(--muted));
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:.5} 50%{opacity:1} }

/* Input area */
.chat-input-area {
    padding: 12px 14px;
    border-top: 1px solid var(--chat-border, var(--border));
    background: var(--chat-bg, var(--bg));
    flex-shrink: 0;
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input {
    flex: 1; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--chat-border, var(--border));
    background: var(--chat-inp-bg, var(--surface2));
    color: var(--chat-inp-txt, var(--text));
    resize: none; font-size: 14px; line-height: 1.5;
    max-height: 100px; overflow-y: auto;
    outline: none;
    transition: border-color .15s;
}
.chat-input:focus { border-color: var(--chat-accent, var(--accent)); }
.chat-input::placeholder { color: var(--chat-muted, var(--muted)); }
.chat-send {
    width: 38px; height: 38px; border-radius: 10px; border: 0;
    background: var(--chat-send-bg, var(--accent)); color: #fff;
    display: grid; place-items: center; cursor: pointer; flex-shrink: 0;
    transition: opacity .15s;
}
.chat-send:hover { opacity: .85; }
.chat-send:disabled { opacity: .4; cursor: default; }
.chat-footer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.chat-hint { font-size: 11px; color: var(--chat-hint, var(--muted2)); }

/* Suggestion chips */
.chat-suggestions {
    display: flex; flex-wrap: wrap; gap: 7px;
    align-self: flex-start; max-width: 100%; padding: 2px 0 4px;
}
.chat-suggestion-btn {
    background: transparent;
    border: 1.5px solid var(--chat-accent, var(--accent));
    color: var(--chat-accent, var(--accent));
    border-radius: 20px; padding: 6px 13px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: background .12s, color .12s; line-height: 1.4;
}
.chat-suggestion-btn:hover { background: var(--chat-accent, var(--accent)); color: #fff; }

/* Limit notice */
.chat-limit-notice {
    text-align: center; padding: 14px;
    font-size: 14px; color: var(--chat-muted, var(--muted));
    background: var(--chat-surface, var(--surface));
    border-radius: 10px; border: 1px solid var(--chat-border, var(--border));
}

/* ── Technique Sliders (Coach UI) ─────────────────────────────────── */
.tech-sliders-title {
    font-size: 11px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--muted2);
    padding: 14px 0 8px;
    border-top: 1px solid var(--border2);
    margin-top: 4px;
}
.tech-sliders-grid { display: grid; gap: 10px; }
.tech-slider-row { display: flex; align-items: center; gap: 12px; }
.tech-slider-label { font-size: 13px; color: var(--text); width: 180px; flex-shrink: 0; }
.tech-slider-wrap  { display: flex; align-items: center; gap: 8px; flex: 1; }
.tech-slider { flex: 1; accent-color: var(--accent); cursor: pointer; }
.tech-slider-val {
    min-width: 28px; text-align: center;
    font-size: 13px; font-weight: 700; color: var(--accent);
    background: var(--accent-bg); border-radius: 6px; padding: 2px 6px;
}

/* Prompt preview */
.prompt-preview-toggle { margin: 16px 0 8px; }
.prompt-preview-label {
    font-size: 11px; font-weight: 600; color: var(--muted2);
    text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px;
}
.prompt-preview-content {
    white-space: pre-wrap; font-size: 12px; line-height: 1.6;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: 9px; padding: 14px; max-height: 400px; overflow-y: auto;
    font-family: inherit; color: var(--text);
}

/* ── Responsive chat ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .chat-layout { height: calc(100vh - 80px); max-height: none; border-radius: 0; border: none; }
    .chat-prev-panel { position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; width: 85%; max-width: 320px; box-shadow: var(--shadow-m); }
    .tech-slider-label { width: 130px; }
    .tech-slider-row { flex-wrap: wrap; }
}
@media (max-width: 520px) {
    .chat-bubble { max-width: 88%; }
    .chat-prev-panel { width: 90%; }
}

/* ── Improved history panel ─────────────────────────────────────── */
.chat-prev-panel {
    width: 300px;
    background: var(--chat-surface, var(--surface));
    border-right: 1px solid var(--chat-border, var(--border));
    display: flex; flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(12px);
}
.chat-prev-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--chat-border, var(--border));
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
}
.chat-prev-header-title {
    font-size: 11px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--chat-muted, var(--muted));
}
.chat-prev-close {
    background: none; border: none; cursor: pointer;
    color: var(--chat-muted, var(--muted)); font-size: 13px;
    width: 24px; height: 24px; border-radius: 6px;
    display: grid; place-items: center;
    transition: background .12s;
}
.chat-prev-close:hover { background: var(--chat-surface, var(--surface2)); color: var(--chat-text, var(--text)); }
.chat-prev-scroll { flex: 1; overflow-y: auto; padding: 12px; display: grid; gap: 16px; }
.chat-prev-day-label {
    font-size: 11px; font-weight: 700; color: var(--chat-accent, var(--accent));
    padding: 4px 0 8px; border-bottom: 1px solid var(--chat-border, var(--border));
    margin-bottom: 8px;
}
.chat-prev-msgs { display: grid; gap: 6px; }
.chat-prev-msg { display: flex; flex-direction: column; }
.chat-prev-msg--user  { align-items: flex-end; }
.chat-prev-msg--assistant { align-items: flex-start; }
.chat-prev-bubble {
    padding: 8px 11px; border-radius: 11px;
    font-size: 12.5px; line-height: 1.5; max-width: 92%;
}
.chat-prev-msg--user .chat-prev-bubble {
    background: var(--chat-user-bg, var(--accent));
    color: var(--chat-user-txt, #fff);
    border-bottom-right-radius: 3px;
}
.chat-prev-msg--assistant .chat-prev-bubble {
    background: var(--chat-bot-bg, var(--surface2));
    border: 1px solid var(--chat-bot-bdr, var(--border));
    color: var(--chat-bot-txt, var(--text));
    border-bottom-left-radius: 3px;
}
.chat-prev-time {
    font-size: 10px; color: var(--chat-muted, var(--muted));
    margin-top: 2px; padding: 0 3px; opacity: .6;
}

/* ── Summary Lightbox ───────────────────────────────────────────── */
.summary-backdrop {
    position: fixed; inset: 0; z-index: 400;
    background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    backdrop-filter: blur(3px);
    animation: fadeIn .18s ease;
}
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.summary-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 32px 28px;
    max-width: 480px; width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: slideUp .2s ease;
}
@keyframes slideUp { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:translateY(0)} }
.summary-box-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.summary-box-title { font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.summary-close {
    width: 28px; height: 28px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface2);
    cursor: pointer; font-size: 13px;
    display: grid; place-items: center;
}
.summary-close:hover { background: var(--border2); }
.summary-loading { color: var(--muted); font-size: 14px; font-style: italic; padding: 12px 0; }
.summary-text {
    font-size: 14.5px; line-height: 1.75; color: var(--text);
    border-left: 3px solid var(--accent);
    padding-left: 14px; margin: 0;
}
.summary-footer { margin-top: 18px; text-align: right; }

/* Dark theme summary box */
html.theme-midnight .summary-box,
html.theme-emerald  .summary-box {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

/* ── Timestamp fix ── */
/* ── Chat header buttons ── */
.chat-glass-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--accent);
    background: var(--accent-bg, rgba(37,99,235,.08));
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .01em;
    transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(37,99,235,.1);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.chat-glass-btn:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 3px 10px rgba(37,99,235,.25);
    transform: translateY(-1px);
}
.chat-glass-btn:active { transform: translateY(0); }

/* Beenden button – subtle red tint */
.chat-glass-btn--exit {
    border-color: var(--danger, #dc2626);
    background: rgba(220,38,38,.07);
    color: var(--danger, #dc2626);
    box-shadow: 0 1px 4px rgba(220,38,38,.1);
}
.chat-glass-btn--exit:hover {
    background: var(--danger, #dc2626);
    color: #fff;
    box-shadow: 0 3px 10px rgba(220,38,38,.25);
}

/* Dark themes: invert to white outlines */
html.theme-midnight .chat-glass-btn,
html.theme-emerald  .chat-glass-btn {
    border-color: rgba(255,255,255,.3);
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.85);
    box-shadow: 0 1px 4px rgba(0,0,0,.2), inset 0 1px 0 rgba(255,255,255,.1);
}
html.theme-midnight .chat-glass-btn:hover,
html.theme-emerald  .chat-glass-btn:hover {
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.5);
    color: #fff;
}
html.theme-midnight .chat-glass-btn--exit,
html.theme-emerald  .chat-glass-btn--exit {
    border-color: rgba(255,100,100,.4);
    background: rgba(220,38,38,.12);
    color: #ffaaaa;
}
html.theme-midnight .chat-glass-btn--exit:hover,
html.theme-emerald  .chat-glass-btn--exit:hover {
    background: rgba(220,38,38,.3);
    color: #fff;
}
/* ── History panel redesign ── */
.chat-prev-panel {
    width: 300px;
    overflow-y: auto;
}
.chat-prev-day {
    padding: 0;
    border-bottom: 1px solid var(--chat-border, var(--border));
}
.chat-prev-day-label {
    font-size: 11px; font-weight: 700; color: var(--chat-muted, var(--muted));
    padding: 10px 14px 6px;
    text-transform: uppercase; letter-spacing: .05em;
    position: sticky; top: 0;
    background: var(--chat-surface, var(--surface));
    z-index: 1;
}
.chat-prev-msg {
    padding: 3px 14px;
    display: flex; flex-direction: column;
}
.chat-prev-bubble {
    padding: 8px 11px;
    border-radius: 11px;
    font-size: 12.5px;
    line-height: 1.5;
    max-width: 90%;
}
.chat-prev-msg--user { align-items: flex-end; }
.chat-prev-msg--user .chat-prev-bubble {
    background: var(--chat-user-bg, var(--accent));
    color: var(--chat-user-txt, #fff);
    border-bottom-right-radius: 3px;
}
.chat-prev-msg--assistant { align-items: flex-start; }
.chat-prev-msg--assistant .chat-prev-bubble {
    background: var(--chat-bot-bg, var(--surface2));
    border: 1px solid var(--chat-bot-bdr, var(--border));
    color: var(--chat-bot-txt, var(--text));
    border-bottom-left-radius: 3px;
}
.chat-prev-time {
    font-size: 10px; color: var(--chat-muted, var(--muted));
    margin: 2px 4px 6px; opacity: .6;
}
.chat-prev-msg--user .chat-prev-time { text-align: right; }

/* ── Summary Lightbox ── */

/* ── Bubble timestamp (single authoritative definition) ── */
.bubble-time {
    font-size: 10px;
    color: var(--chat-muted, var(--muted2));
    opacity: .5;
    margin-top: 2px;
    padding: 0 3px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: .01em;
}

/* ── Summary Lightbox (fixed, correct) ── */
.summary-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .52);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    padding: 20px;
}
.summary-lightbox-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 28px 64px rgba(0, 0, 0, .22);
    overflow: hidden;
    animation: fadeUp .2s ease;
}
.summary-lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border2);
    background: var(--surface);
}
.summary-lightbox-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.3px;
    color: var(--text);
}
.summary-lightbox-close {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    padding: 3px 9px;
    transition: background .12s;
}
.summary-lightbox-close:hover { background: var(--surface2); color: var(--text); }
.summary-lightbox-body { padding: 22px; }
.summary-loading {
    color: var(--muted);
    font-size: 14px;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}
.summary-text {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    white-space: pre-wrap;
}

/* Remove old duplicate summary-lightbox blocks if any came from appends */

/* ── Chat page: remove max-width constraint on main ── */
body.page-chat .main {
    max-width: none;
    padding: 16px 20px;
}
body.page-chat .topbar {
    margin-bottom: 14px;
}

@media (max-width: 900px) {
    .chat-layout {
        height: calc(100vh - 100px) !important;
        min-height: 350px;
        border-radius: 0;
        border-left: 0 !important;
        border-right: 0 !important;
    }
    body.page-chat .main { padding: 10px 0; }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE & RESPONSIVE FIXES + DASHBOARD IMPROVEMENTS
   ═══════════════════════════════════════════════════════════════════ */

/* ── Action grid: 1 column on mobile ── */
@media (max-width: 860px) {
    .action-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .action-card {
        display: flex;
        align-items: center;
        gap: 16px;
        padding: 16px 18px;
    }
    .action-card-top {
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .action-icon { font-size: 24px; }
    .action-card-body { flex: 1; }
    .action-title { font-size: 15px; margin-bottom: 2px; }
    .action-desc  { font-size: 13px; }
}

/* ── Chat header: stack on very small screens ── */
@media (max-width: 400px) {
    .chat-header {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 12px;
    }
    .chat-header-actions { gap: 5px; }
    .chat-glass-btn {
        font-size: 11px;
        padding: 5px 11px;
    }
    .chat-glass-btn .btn-label { display: none; }
    .chat-glass-btn .btn-icon  { display: inline; }
    .chat-header-sub { display: none; }
}

/* ── Greeting block: tighter on mobile ── */
@media (max-width: 860px) {
    .greeting-block { margin-bottom: 18px; }
    .greeting-text  { font-size: 22px; }
    .greeting-quote { font-size: 13px; }
    .topbar-title h1 { font-size: 20px; }
}

/* ─────────────────────────────────────────────────────────────────
   DASHBOARD IMPROVEMENTS
   ───────────────────────────────────────────────────────────────── */

/* Action cards: status dot on badge */
.action-badge--open  { animation: pulse-badge 2.5s ease-in-out infinite; }
@keyframes pulse-badge {
    0%,100% { opacity:1; }
    50%      { opacity:.65; }
}

/* Stat numbers: larger and bolder */
.stat strong { font-size: 26px; font-weight: 800; letter-spacing: -.8px; }
.stat-label  { font-size: 11px; letter-spacing: .02em; text-transform: uppercase; }

/* Timeline items: left border accent */
.timeline-item {
    border-left: 3px solid var(--border2);
    border-radius: 0 10px 10px 0;
    padding-left: 14px;
    transition: border-color .15s;
}
.timeline-item:hover { border-left-color: var(--accent); }

/* Level pills: slightly larger */
.level-pill { font-size: 11.5px; padding: 3px 9px; font-weight: 700; }
.level-energy { background: rgba(37,99,235,.1);  color: #1d4ed8; }
.level-stress { background: rgba(232,93,58,.1);  color: #b94020; }
.level-todo   { background: rgba(217,119,6,.12); color: #92400e; }

/* Dashboard greeting: subtle separator */
.greeting-block {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border2);
    margin-bottom: 24px;
}

/* Quick action strip below greeting (mobile: horizontal scroll) */
.action-grid {
    -webkit-overflow-scrolling: touch;
}
@media (max-width: 860px) {
    .action-grid {
        overflow-x: visible;
    }
}

/* Cards: slightly more shadow on hover */
.card { transition: box-shadow .18s; }
.card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.09); }

/* Empty state styling */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--muted);
}
.empty-state-icon { font-size: 32px; margin-bottom: 10px; opacity: .5; }
.empty-state-text { font-size: 14px; line-height: 1.6; }

/* ── Reflections: importance dot colors ── */
.intensity-high { background: #ef4444; }
.intensity-mid  { background: #f59e0b; }
.intensity-low  { background: #22c55e; }

/* ── Check-in success screen: button gap on mobile ── */
@media (max-width: 520px) {
    .ci-success-actions { gap: 8px; }
    .ci-action-btn { padding: 14px 16px; }
    .ci-action-label { font-size: 14px; }
}

/* ── Wochenüberblick: week grid on mobile ── */
@media (max-width: 480px) {
    .week-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; }
    .week-day-vals { font-size: 10px; }
    .week-day { padding: 8px 4px; }
    .stats { grid-template-columns: repeat(3,1fr); }
}

/* ── Coach detail: back button row mobile ── */
@media (max-width: 860px) {
    .coach-detail-back { flex-wrap: wrap; }
    .coach-mgr-header { gap: 12px; }
    .coach-mgr-info h2 { font-size: 18px; }
}

/* ── Topbar: hide date on very small screens ── */
@media (max-width: 380px) {
    .topbar-meta { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════
   MOCKUP PAGES + SETTINGS + HISTORY FIX
   ═══════════════════════════════════════════════════════════════════ */

/* Dev badge */
.dev-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(37,99,235,.1);
    color: var(--accent);
    border: 1px solid rgba(37,99,235,.2);
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: 18px;
}
.dev-badge::before { content: '◉'; font-size: 10px; animation: pulse 2s infinite; }

/* Mockup shell */
.mockup-wrap { max-width: 680px; }
.mockup-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 28px;
    box-shadow: var(--shadow);
}
.mockup-title  { font-size: 20px; font-weight: 700; letter-spacing: -.4px; margin-bottom: 6px; }
.mockup-sub    { color: var(--muted); font-size: 14px; margin-bottom: 22px; }

/* Progress */
.mockup-progress    { margin-bottom: 22px; }
.mockup-step-label  { font-size: 12px; font-weight: 600; color: var(--muted); display: block; margin-bottom: 6px; }
.mockup-progress-bar  { height: 4px; background: var(--border2); border-radius: 2px; overflow: hidden; }
.mockup-progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width .3s; }

/* Options / chips */
.mockup-options { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.mockup-option, .mockup-chip {
    padding: 10px 18px; border-radius: 10px;
    border: 1.5px solid var(--border);
    background: var(--surface); color: var(--text);
    font-size: 14px; font-weight: 500; cursor: pointer;
    transition: border-color .12s, background .12s, color .12s;
}
.mockup-option:hover, .mockup-chip:hover { border-color: var(--accent); color: var(--accent); }
.mockup-option.selected, .mockup-chip.selected {
    border-color: var(--accent); background: var(--accent-bg); color: var(--accent); font-weight: 700;
}
.mockup-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Inputs */
.mockup-label  { display: grid; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 14px; }
.mockup-input  { width: 100%; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; outline: none; transition: border-color .15s; font-family: inherit; }
.mockup-input:focus { border-color: var(--accent); }
.mockup-textarea { width: 100%; padding: 10px 13px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px; outline: none; resize: vertical; min-height: 80px; font-family: inherit; transition: border-color .15s; }
.mockup-textarea:focus { border-color: var(--accent); }

/* Strategy */
.mockup-strategy-list  { display: grid; gap: 10px; }
.mockup-strategy {
    padding: 14px 18px; border-radius: 10px;
    border: 1.5px solid var(--border); background: var(--surface);
    text-align: left; cursor: pointer; width: 100%;
    display: flex; flex-direction: column; gap: 3px;
    transition: border-color .12s, background .12s;
}
.mockup-strategy strong { font-size: 15px; color: var(--text); }
.mockup-strategy span   { font-size: 13px; color: var(--muted); }
.mockup-strategy.selected { border-color: var(--accent); background: var(--accent-bg); }

/* Analysis cards */
.mockup-analysis-grid { display: grid; gap: 12px; }
.mockup-analysis-card { padding: 16px; border-radius: 10px; background: var(--surface2); border: 1px solid var(--border2); }
.mockup-analysis-risk { border-left: 3px solid var(--danger); }
.mockup-analysis-key  { border-left: 3px solid var(--success); }
.mockup-analysis-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); margin-bottom: 6px; }
.mockup-analysis-text  { font-size: 14px; line-height: 1.6; color: var(--text); }

/* Implementation sections */
.mockup-impl-section { margin-bottom: 16px; }
.mockup-impl-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted2); margin-bottom: 8px; }
.mockup-impl-list { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 14px; line-height: 1.6; }
.mockup-quote { background: var(--accent-bg); border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; padding: 12px 16px; font-size: 14px; line-height: 1.6; color: var(--text); font-style: italic; }

/* Table */
.mockup-table-wrap { overflow-x: auto; border-radius: 9px; border: 1px solid var(--border); }
.mockup-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mockup-table th { background: var(--surface2); padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.mockup-table td { padding: 10px 12px; border-bottom: 1px solid var(--border2); }
.mockup-table tbody tr:last-child td { border-bottom: 0; }
.mockup-td-center { text-align: center; font-weight: 700; color: var(--accent); }
.mockup-select-sm { padding: 5px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px; }

/* Radio */
.mockup-radio { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; margin-bottom: 8px; transition: border-color .12s; }
.mockup-radio:hover { border-color: var(--accent); }
.mockup-radio input[type=radio] { accent-color: var(--accent); }
.mockup-range { width: 100%; accent-color: var(--accent); }
.mockup-range-val { min-width: 26px; text-align: center; font-weight: 700; color: var(--accent); font-size: 13px; }
.mockup-crit-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border2); }
.mockup-crit-name { flex: 1; font-size: 14px; }
.mockup-crit-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Buttons */
.mockup-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border2); }
.mockup-btn-next { padding: 10px 22px; border-radius: 9px; border: 0; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .15s; }
.mockup-btn-next:hover { background: var(--accent-h); }
.mockup-btn-next:disabled { opacity: .4; cursor: default; }
.mockup-btn-back { padding: 10px 18px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 14px; cursor: pointer; transition: background .12s; }
.mockup-btn-back:hover { background: var(--surface2); color: var(--text); }
.mockup-btn-add { padding: 8px 14px; border-radius: 8px; border: 1.5px dashed var(--border); background: transparent; color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }
.mockup-btn-add:hover { background: var(--accent-bg); border-color: var(--accent); }
.mockup-btn-remove { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; }
.mockup-btn-remove:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.mockup-btn-remove:disabled { opacity: .3; cursor: default; }
.mockup-dev-note { margin-top: 18px; padding: 12px 14px; border-radius: 9px; background: var(--accent-bg); border: 1px solid rgba(37,99,235,.14); color: var(--muted); font-size: 13px; }

/* Finish screen */
.mockup-finish { text-align: center; padding: 48px 24px; }
.mockup-finish-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--success-bg); color: var(--success); font-size: 24px; font-weight: 800; display: grid; place-items: center; margin: 0 auto 18px; }
.mockup-finish h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.mockup-finish p { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

/* Goal tracking */
.goal-list { display: grid; gap: 14px; }
.goal-item { padding: 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }
.goal-item--completed { opacity: .7; }
.goal-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 12px; }
.goal-title { font-size: 15px; font-weight: 600; }
.goal-badge { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.goal-badge--active { background: var(--accent-bg); color: var(--accent); }
.goal-badge--done   { background: var(--success-bg); color: var(--success); }
.goal-progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.goal-progress-bar  { flex: 1; height: 6px; background: var(--border2); border-radius: 3px; overflow: hidden; }
.goal-progress-fill { height: 100%; background: var(--accent); border-radius: 3px; }
.goal-progress-fill--done { background: var(--success); }
.goal-progress-label { font-size: 12px; font-weight: 700; color: var(--muted); width: 32px; }
.goal-meta { font-size: 12px; color: var(--muted2); }

/* Session briefing */
.briefing-section { margin-bottom: 22px; }
.briefing-section-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--muted2); margin-bottom: 12px; }
.briefing-date-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.briefing-block { padding: 14px 16px; border-radius: 9px; background: var(--surface2); border: 1px solid var(--border2); margin-bottom: 10px; }
.briefing-block--highlight { background: var(--accent-bg); border-color: rgba(37,99,235,.15); }
.briefing-block-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted2); margin-bottom: 6px; }
.briefing-block-content { font-size: 14px; line-height: 1.6; color: var(--text); }
.briefing-list { margin: 0; padding-left: 18px; display: grid; gap: 5px; font-size: 14px; line-height: 1.6; }

/* Settings: theme palette row */
.theme-palette-row { display: flex; gap: 4px; margin-bottom: 6px; }
.theme-palette-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); }
.theme-selector--large {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.theme-card-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 22px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    flex: none;
}
.theme-card-option:hover { border-color: var(--muted2); }
.theme-card-option input:checked ~ * { color: var(--accent); }
.theme-card-option input[type=radio] { display: none; }
.theme-card-option.theme-active {
    border-color: var(--accent);
    background: var(--accent-bg);
}
.theme-palette-row { display: flex; gap: 3px; flex-shrink: 0; }
.theme-palette-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(0,0,0,.08); }
.theme-card-info { display: flex; flex-direction: column; gap: 1px; }
.theme-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.theme-card-desc { display: none; }
.theme-card-preview { display: none; }
.theme-card-bg { display: none; }

/* Settings: data sharing */
.data-sharing-grid { display: grid; gap: 10px; }
.data-sharing-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--surface2); border-radius: 9px; border: 1px solid var(--border2); }
.data-sharing-info { flex: 1; min-width: 0; }
.data-sharing-name { font-size: 13.5px; font-weight: 600; }
.data-sharing-desc { font-size: 12px; color: var(--muted); }
.data-sharing-select { max-width: 180px; flex-shrink: 0; font-size: 13px; padding: 6px 10px; opacity: .7; }

/* Chat history: single scroll */
.chat-prev-scroll { flex: 1; overflow-y: auto; padding: 0; }
.chat-prev-day-label { font-size: 11px; font-weight: 700; color: var(--chat-muted, var(--muted)); padding: 10px 14px 6px; text-transform: uppercase; letter-spacing: .05em; position: sticky; top: 0; background: var(--chat-surface, var(--surface)); z-index: 1; }

/* Mockup responsive */
@media (max-width: 680px) {
    .mockup-card { padding: 18px; }
    .mockup-title { font-size: 17px; }
    .mockup-crit-row { flex-wrap: wrap; }
    .mockup-crit-controls { width: 100%; }
    .theme-selector--large { grid-template-columns: repeat(3,1fr); }
    .data-sharing-row { flex-direction: column; align-items: flex-start; }
    .data-sharing-select { width: 100%; max-width: none; }
    .briefing-date-row { flex-direction: column; }
    .briefing-date-row input { width: 100%; }
}
@media (max-width: 400px) {
    .theme-selector--large { grid-template-columns: repeat(2,1fr); }
}

/* ═══════════════════════════════════════════════════════════════════
   MOBILE APP DASHBOARD + GLOBAL MOBILE POLISH  (clean rewrite)
   ═══════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────
   STEP 1: Kill the sidebar completely on mobile — replace with
   a slim brand bar + slide-in drawer
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {

    /* Top bar is useless on mobile */
    .topbar { display: none !important; }

    /* Shell: single column, no sidebar column */
    .app-shell { grid-template-columns: 1fr; }

    /* Sidebar becomes a slim brand/hamburger bar */
    .sidebar {
        position: sticky;
        top: 0;
        height: auto;
        min-height: 0;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        background: var(--surface);
        z-index: 90;
        overflow: visible;
        flex-direction: row;
        align-items: center;
        padding: 0 16px;
    }
    .brand {
        padding: 12px 0;
        flex: 1;
    }
    .brand-inner { gap: 8px; }
    .brand-mark   { width: 28px; height: 28px; font-size: 14px; border-radius: 7px; }
    .brand-name   { font-size: 15px; }
    .brand-sub    { display: none; }

    /* Sidebar body: hidden by default, slide-in as overlay */
    .sidebar-body {
        display: none;
        position: fixed;
        top: 0; left: 0; bottom: 0;
        width: 280px;
        max-width: 85vw;
        background: var(--surface);
        border-right: 1px solid var(--border);
        z-index: 300;
        flex-direction: column;
        gap: 0;
        padding: 20px 0 20px;
        overflow-y: auto;
        box-shadow: 6px 0 32px rgba(0,0,0,.18);
    }
    .sidebar.is-open .sidebar-body  { display: flex; }
    .sidebar.is-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 299;
    }

    /* Hamburger always visible */
    .mobile-nav-toggle { display: flex; }

    /* Main: full width, zero top padding (topbar gone) */
    .main { padding: 0 !important; }
}

/* ─────────────────────────────────────────────────────────────────
   STEP 2: App-like mobile page padding (non-dashboard pages)
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    body:not(.page-dashboard) .main {
        padding: 16px !important;
    }
    body.page-chat .main { padding: 0 !important; }
}

/* ─────────────────────────────────────────────────────────────────
   STEP 3: Dashboard – mobile app layout
   ───────────────────────────────────────────────────────────────── */

/* Mobile-only greeting bar */
.mob-header { display: none; }

@media (max-width: 860px) {
    /* Hide desktop-only dashboard elements */
    body.page-dashboard .greeting-block { display: none; }
    body.page-dashboard .action-grid    { display: none; }
    body.page-dashboard .checkin-prompt { display: none; }
    body.page-dashboard .grid           { display: none; }

    /* Show mobile elements */
    .mob-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 18px 12px;
    }
    .mob-header-greeting {
        font-size: 22px;
        font-weight: 800;
        letter-spacing: -.6px;
        color: var(--text);
    }
    .mob-header-date {
        font-size: 12px;
        font-weight: 600;
        color: var(--muted);
        background: var(--surface2);
        border: 1px solid var(--border);
        padding: 5px 12px;
        border-radius: 20px;
    }

    .dash-body { padding: 0 14px 32px; }

    /* Quote strip */
    .dash-quote {
        font-size: 12.5px;
        color: var(--muted);
        font-style: italic;
        line-height: 1.6;
        margin: 0 0 18px;
        padding: 10px 14px;
        background: var(--surface);
        border-left: 3px solid var(--accent);
        border-radius: 0 10px 10px 0;
        border: 1px solid var(--border2);
        border-left: 3px solid var(--accent);
    }
}

@media (min-width: 861px) {
    .mob-header  { display: none !important; }
    .dash-quote  { display: none; }
    .dash-tiles  { display: none; }
    .dash-stats-row { display: none; }
    .dash-section   { display: none; }
}

/* ── 3 large tiles ── */
.dash-tiles {
    display: none; /* hidden desktop */
}
@media (max-width: 860px) {
    .dash-tiles {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        margin-bottom: 16px;
    }
}

.dash-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 18px 8px 14px;
    border-radius: 18px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    gap: 6px;
    min-height: 108px;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    transition: transform .15s, box-shadow .15s;
    overflow: hidden;
}
.dash-tile:active { transform: scale(.97); }
.dash-tile--primary {
    border-color: rgba(37,99,235,.3);
    background: linear-gradient(145deg, var(--surface), rgba(37,99,235,.05));
}
.dash-tile--done {
    border-color: rgba(22,163,74,.3);
    background: linear-gradient(145deg, var(--surface), rgba(22,163,74,.05));
}
.dash-tile--accent {
    border-color: rgba(37,99,235,.2);
    background: linear-gradient(145deg, var(--surface), rgba(37,99,235,.03));
}

/* Badge: top-right corner */
.dash-tile-badge {
    position: absolute;
    top: 8px; right: 8px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--success);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .02em;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}
.dash-tile-badge--open {
    background: var(--accent);
    animation: pulse-badge 2.5s ease-in-out infinite;
}

.dash-tile-icon  { font-size: 26px; line-height: 1; }
.dash-tile-label { font-size: 13px; font-weight: 700; letter-spacing: -.2px; text-align: center; }
.dash-tile-sub   { font-size: 11px; color: var(--muted); text-align: center; }

/* ── Quick stats strip ── */
.dash-stats-row {
    display: none;
}
@media (max-width: 860px) {
    .dash-stats-row {
        display: flex;
        align-items: center;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        padding: 14px 0;
        margin-bottom: 18px;
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }
}
.dash-stat { flex: 1; text-align: center; }
.dash-stat-num {
    font-size: 22px; font-weight: 800;
    letter-spacing: -.5px; line-height: 1;
    color: var(--text);
}
.dash-stat-lbl {
    font-size: 10px; color: var(--muted); margin-top: 4px;
    font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
}
.dash-stat-divider { width: 1px; height: 28px; background: var(--border); }

/* ── Collapsible sections ── */
.dash-section { display: none; }
@media (max-width: 860px) {
    .dash-section {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 14px;
        margin-bottom: 10px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,.05);
    }
}
.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 13px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -.2px;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}
.dash-section-header:active { background: var(--surface2); }
.dash-section-toggle { font-size: 13px; color: var(--muted); }
.dash-section-body {
    padding: 4px 14px 14px;
    border-top: 1px solid var(--border2);
}

/* ─────────────────────────────────────────────────────────────────
   STEP 4: Check-in page — remove redundant heading + date on mobile
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .ci-page-title { display: none; }
    .ci-date-display { display: none; }
    .ci-step-label { font-size: 18px; }
    .ci-wrap { padding-top: 4px; }
}

/* ─────────────────────────────────────────────────────────────────
   STEP 5: Tighten other pages on mobile
   ───────────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .card { border-radius: 12px; }
    .card + .card { margin-top: 12px; }
    h2 { font-size: 17px; }
    .stat strong { font-size: 22px; }
    /* Reports */
    .report-header { flex-direction: column; gap: 6px; }
    /* Settings */
    .settings-wrap { max-width: 100%; }
    /* Reflections form */
    .stack-md > * + * { margin-top: 12px; }
}

/* Desktop dashboard: show, mobile: hide */
.desktop-dash { display: block; }
@media (max-width: 860px) {
    .desktop-dash { display: none; }
}

/* ── Prompt Preview (coach UI) ── */
.prompt-preview-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 8px;
}
.prompt-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: var(--surface2);
    border-bottom: 1px solid var(--border2);
    flex-wrap: wrap;
}
.prompt-preview-header-left { display: flex; flex-direction: column; gap: 2px; }
.prompt-preview-hint { font-size: 11px; color: var(--muted2); }
.prompt-preview-state-row { display: flex; align-items: center; gap: 8px; }
.prompt-preview-state-sel {
    padding: 5px 8px; border-radius: 7px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 13px;
}
.prompt-preview-tabs {
    display: flex;
    border-bottom: 1px solid var(--border2);
}
.prompt-tab {
    flex: 1; padding: 8px 12px;
    background: none; border: none; border-right: 1px solid var(--border2);
    font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
    transition: background .12s, color .12s;
}
.prompt-tab:last-child { border-right: 0; }
.prompt-tab:hover { background: var(--surface2); color: var(--text); }
.prompt-tab.active { background: var(--accent-bg); color: var(--accent); }
.prompt-preview-loading {
    font-size: 12px; color: var(--muted); font-style: italic;
    padding: 8px 16px; background: var(--surface2);
}
.prompt-preview-content {
    white-space: pre-wrap;
    font-size: 12px; line-height: 1.65;
    background: var(--surface); border-radius: 0;
    padding: 16px; max-height: 480px; overflow-y: auto;
    font-family: inherit; color: var(--text);
    margin: 0; border: 0;
    transition: opacity .2s;
}

/* ── Coach Chat Log with State Badges ── */
.coach-chat-date-sep {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted2);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 14px 0 6px;
    position: relative;
}
.coach-chat-date-sep::before,
.coach-chat-date-sep::after {
    content: '';
    position: absolute;
    top: 50%; left: 0;
    height: 1px;
    background: var(--border2);
    width: calc(50% - 40px);
    margin-top: 7px;
}
.coach-chat-date-sep::after { left: auto; right: 0; }

.coach-chat-item { padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; }
.coach-chat-user      { background: var(--surface2); border: 1px solid var(--border2); }
.coach-chat-assistant { background: var(--accent-bg); border: 1px solid rgba(37,99,235,.12); }
.coach-chat-exit      { border-color: rgba(22,163,74,.25); background: rgba(22,163,74,.06); }

.coach-chat-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
}
.coach-chat-time { opacity: .7; font-weight: 400; }
.coach-chat-content { font-size: 13.5px; line-height: 1.6; color: var(--text); }

/* State badge */
.coach-state-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    letter-spacing: .03em;
    text-transform: uppercase;
    border: 1px solid;
}

/* State colors */
.coach-state-intake-orientation        { background: rgba(37,99,235,.1);  color: #1d4ed8; border-color: rgba(37,99,235,.2); }
.coach-state-emotional-regulation      { background: rgba(236,72,153,.1); color: #be185d; border-color: rgba(236,72,153,.2); }
.coach-state-problem-structuring       { background: rgba(180,83,9,.1);   color: #92400e; border-color: rgba(180,83,9,.2); }
.coach-state-decision-support          { background: rgba(124,58,237,.1); color: #5b21b6; border-color: rgba(124,58,237,.2); }
.coach-state-conflict-clarification    { background: rgba(220,38,38,.1);  color: #991b1b; border-color: rgba(220,38,38,.2); }
.coach-state-resource-activation       { background: rgba(22,163,74,.1);  color: #14532d; border-color: rgba(22,163,74,.2); }
.coach-state-perspective-expansion     { background: rgba(2,132,199,.1);  color: #075985; border-color: rgba(2,132,199,.2); }
.coach-state-action-planning           { background: rgba(217,119,6,.1);  color: #78350f; border-color: rgba(217,119,6,.2); }
.coach-state-reflection-deepening      { background: rgba(100,116,139,.1);color: #334155; border-color: rgba(100,116,139,.2); }
.coach-state-crisis-escalation         { background: rgba(220,38,38,.18); color: #7f1d1d; border-color: rgba(220,38,38,.35); font-weight: 800; }

.coach-exit-badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 20px;
    background: rgba(22,163,74,.12); color: var(--success);
    border: 1px solid rgba(22,163,74,.25);
    text-transform: uppercase; letter-spacing: .03em;
}

/* ── Improved Technique Sliders ── */
.tech-slider-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border2);
}
.tech-slider-row:last-child { border-bottom: 0; }
.tech-slider-info { display: flex; flex-direction: column; gap: 2px; }
.tech-slider-label { font-size: 14px; font-weight: 600; color: var(--text); }
.tech-slider-desc  { font-size: 12px; color: var(--muted); }
.tech-slider-wrap  { display: flex; align-items: center; gap: 8px; }
.tech-slider       { flex: 1; accent-color: var(--accent); cursor: pointer; height: 4px; }
.tech-slider-tag {
    font-size: 10px; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; white-space: nowrap;
}
.tech-slider-tag--low  { color: var(--muted2); }
.tech-slider-tag--high { color: var(--accent); }
.tech-slider-val {
    min-width: 28px; text-align: center;
    font-size: 14px; font-weight: 800;
    padding: 2px 6px; border-radius: 6px;
    transition: background .15s, color .15s;
}
.tech-slider-val--high { background: var(--accent-bg); color: var(--accent); }
.tech-slider-val--low  { background: var(--surface2);  color: var(--muted2); }
.tech-slider-val--     { background: transparent;      color: var(--text); }

/* ── KI Coach branding + footer ── */
.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 24px;
    font-size: 12px;
    color: var(--muted2);
    border-top: 1px solid var(--border2);
    background: var(--surface);
}
.site-footer-contact {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    transition: color .12s;
}
.site-footer-contact:hover { color: var(--accent); }

/* ── Hide user name/role on mobile sidebar ── */
@media (max-width: 860px) {
    .sidebar-user-summary { display: none; }
}

/* ── Login log grid ── */
.login-log-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.login-log-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--surface2);
    border-radius: 9px;
    font-size: 13px;
}
.login-log-day  { font-weight: 700; color: var(--accent); min-width: 22px; }
.login-log-date { color: var(--text); }
.login-log-time { color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ── Chat prev panel: enforce single scroll ── */
.chat-prev-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.chat-prev-panel .chat-prev-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Remove any per-day overflow */
.chat-prev-day { overflow: visible !important; }

/* ═══════════════════════════════════════════════════════════════════
   COACH DASHBOARD REDESIGN
   ═══════════════════════════════════════════════════════════════════ */

.coach-dashboard {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 22px;
    align-items: start;
}
.coach-dash-title {
    font-size: 18px; font-weight: 700; margin-bottom: 14px;
    letter-spacing: -.3px;
}

/* ── Manager row card ── */
.mgr-row {
    margin-bottom: 14px;
    padding: 18px 20px;
}
.mgr-row-head {
    display: flex; align-items: flex-start;
    justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.mgr-row-identity {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: var(--text);
    min-width: 0;
}
.mgr-row-identity:hover .mgr-row-name { color: var(--accent); }
.mgr-row-name { font-size: 16px; font-weight: 700; letter-spacing: -.2px; }
.mgr-row-pos   { font-size: 12px; margin-top: 2px; }

.mgr-row-stats {
    display: flex; align-items: center; gap: 18px;
    flex-shrink: 0; flex-wrap: wrap;
}
.mgr-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mgr-stat span { font-size: 16px; font-weight: 800; letter-spacing: -.4px; }
.mgr-stat small { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted2); }

/* ── Charts row ── */
.mgr-row-charts {
    display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
    margin-bottom: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--border2);
    border-bottom: 1px solid var(--border2);
}
.mgr-chart-wrap { min-width: 0; }
.mgr-chart-label { font-size: 11px; font-weight: 600; color: var(--muted2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }

/* ── Topics ── */
.mgr-row-topics { margin-bottom: 10px; }
.mgr-topics-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.mgr-topics-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mgr-topic-chip {
    padding: 4px 11px; border-radius: 20px;
    background: rgba(37,99,235,.08); color: var(--accent);
    border: 1px solid rgba(37,99,235,.18);
    font-size: 12px; font-weight: 600;
}

.mgr-row-foot { font-size: 12px; margin-top: 10px; }

/* ── Appointments sidebar ── */
.coach-dash-side { position: sticky; top: 80px; }
.coach-appt-card { padding: 18px; }
.coach-appt-card h2 { font-size: 15px; margin-bottom: 14px; }

.appt-form { display: grid; gap: 10px; }
.appt-label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.appt-input {
    padding: 8px 10px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 13px; font-family: inherit;
    outline: none; transition: border-color .15s;
}
.appt-input:focus { border-color: var(--accent); }

.appt-list { margin-top: 16px; display: grid; gap: 8px; border-top: 1px solid var(--border2); padding-top: 14px; }
.appt-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: 10px;
    background: var(--surface2); border: 1px solid var(--border2);
}
.appt-item-date {
    display: flex; flex-direction: column; align-items: center;
    min-width: 52px; flex-shrink: 0;
    font-size: 12px; color: var(--muted);
}
.appt-day  { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--accent); }
.appt-time { font-size: 13px; font-weight: 700; color: var(--text); margin-top: 2px; }
.appt-item-info { flex: 1; min-width: 0; font-size: 13px; }
.appt-del-btn {
    background: none; border: none; cursor: pointer;
    color: var(--muted2); font-size: 13px; padding: 2px 6px;
    border-radius: 6px; transition: background .12s, color .12s;
    flex-shrink: 0;
}
.appt-del-btn:hover { background: var(--danger-bg); color: var(--danger); }

/* Responsive */
@media (max-width: 1000px) {
    .coach-dashboard { grid-template-columns: 1fr; }
    .coach-dash-side { position: static; }
}
@media (max-width: 600px) {
    .mgr-row-charts { grid-template-columns: 1fr; }
    .mgr-row-stats  { gap: 12px; }
}
