/* Refined editorial vibe — warm, intimate, soft. Telegram theme as base. */
:root {
    /* Telegram theme (fallbacks for sandbox / when not in Telegram) */
    --bg-color: var(--tg-theme-bg-color, #f8f5f1);
    --text-color: var(--tg-theme-text-color, #2a2622);
    --hint-color: var(--tg-theme-hint-color, #7a756e);
    --link-color: var(--tg-theme-link-color, #b85a4a);
    --button-color: var(--tg-theme-button-color, #b85a4a);
    --button-text: var(--tg-theme-button-text-color, #fff);
    --secondary-bg: var(--tg-theme-secondary-bg-color, #efeae4);

    /* Design system — soft editorial, relationship-friendly */
    --font-heading: 'Plus Jakarta Sans', -apple-system, sans-serif;
    --font-body: 'Fraunces', Georgia, serif;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-full: 9999px;
    --space-xs: 6px;
    --space-sm: 12px;
    --space-md: 18px;
    --space-lg: 26px;
    --space-xl: 36px;
    --accent: #b85a4a;
    --accent-soft: rgba(184, 90, 74, 0.14);
    --accent-hover: #9e4a3c;
    --success: #2d7a5e;
    --success-soft: rgba(45, 122, 94, 0.14);
    --warning: #b8860b;
    --warning-soft: rgba(184, 134, 11, 0.14);
    --gap-color: #c23d2e;
    --gap-soft: rgba(194, 61, 46, 0.12);
    --partner-accent: #9e4a6a;
    --partner-soft: rgba(158, 74, 106, 0.16);
    --shadow-soft: 0 2px 16px rgba(42, 38, 34, 0.07);
    --shadow-card: 0 6px 24px rgba(42, 38, 34, 0.09);
    --shadow-card-hover: 0 10px 32px rgba(42, 38, 34, 0.12);
    /* Atmosphere (light) */
    --gradient-warm: radial-gradient(ellipse 120% 80% at 70% 0%, rgba(184, 90, 74, 0.06) 0%, transparent 55%);
    --grain-opacity: 0.035;
    --border-subtle: rgba(0, 0, 0, 0.04);
}

/* Dark theme when Telegram provides dark bg */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: var(--tg-theme-bg-color, #1a1816);
        --text-color: var(--tg-theme-text-color, #ebe8e4);
        --hint-color: var(--tg-theme-hint-color, #8e8982);
        --secondary-bg: var(--tg-theme-secondary-bg-color, #252220);
        --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.25);
        --shadow-card: 0 6px 24px rgba(0, 0, 0, 0.3);
        --shadow-card-hover: 0 10px 32px rgba(0, 0, 0, 0.35);
        --gradient-warm: radial-gradient(ellipse 120% 80% at 70% 0%, rgba(184, 90, 74, 0.08) 0%, transparent 55%);
        --grain-opacity: 0.04;
        --border-subtle: rgba(255, 255, 255, 0.06);
    }

    /* Coach starter card: avoid light box on dark theme — use theme-consistent background */
    .starter-card {
        background: var(--secondary-bg);
        border-color: var(--border-subtle);
    }
    .starter-topic,
    .starter-suggestion {
        color: var(--text-color);
        opacity: 1;
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.miniapp-body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    padding-bottom: var(--space-xl);
    min-height: 100vh;
    position: relative;
    background: var(--bg-color);
}

/* Atmosphere: warm gradient + subtle grain */
.miniapp-body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background: var(--gradient-warm);
}
.miniapp-body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app {
    position: relative;
    z-index: 1;
    max-width: 100%;
    min-height: 100vh;
}

/* ----- Tabs (top nav) ----- */
.tabs {
    display: flex;
    background: var(--secondary-bg);
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    margin: var(--space-md);
    gap: var(--space-xs);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
}

.tab {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--hint-color);
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color 0.22s ease, background 0.22s ease, transform 0.2s ease, box-shadow 0.22s ease;
}

.tab:hover {
    color: var(--text-color);
}

.tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

.tab.active {
    background: var(--bg-color);
    color: var(--accent);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}

.tab-content {
    display: none;
    padding: var(--space-md);
    animation: tabFade 0.35s ease backwards;
}

.tab-content.active {
    display: block;
    animation: tabFade 0.35s ease backwards;
}

@keyframes tabFade {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ----- Date navigation ----- */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--secondary-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--button-color);
    color: var(--button-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.nav-btn:hover:not(:disabled) {
    transform: scale(1.06);
    background: var(--accent-hover, var(--accent));
}

.nav-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.nav-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

#currentDate {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    min-width: 100px;
    text-align: center;
}

/* ----- Loading ----- */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--hint-color);
    font-family: var(--font-body);
    font-size: 0.9375rem;
}

/* ----- Category section (Comparison) ----- */
.category {
    margin-bottom: var(--space-lg);
    background: var(--secondary-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    transition: box-shadow 0.25s ease;
}

.category:hover {
    box-shadow: var(--shadow-card-hover);
}

.category-header {
    padding: var(--space-md) var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.category-header:hover {
    background: rgba(0, 0, 0, 0.04);
}

.category-header:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--accent);
}

.category-header h3 {
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.category-avg {
    font-size: 0.8125rem;
    color: var(--hint-color);
    font-family: var(--font-heading);
}

.category-questions {
    padding: 0 var(--space-lg) var(--space-md);
}

/* ----- Question card (Comparison) ----- */
.question-card {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-subtle);
}

.question-card .question-text {
    font-size: 0.875rem;
    color: var(--hint-color);
    margin-bottom: var(--space-sm);
    font-style: italic;
}

.ratings {
    display: flex;
    gap: var(--space-md);
}

.rating-box {
    flex: 1;
    text-align: center;
}

.rating-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hint-color);
    margin-bottom: var(--space-xs);
    font-family: var(--font-heading);
}

.rating-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.rating-value.gap-large {
    color: var(--gap-color);
}

.rating-value.gap-medium {
    color: var(--warning);
}

.rating-value.aligned {
    color: var(--success);
}

.rating-value.missing {
    color: var(--hint-color);
    font-size: 0.875rem;
}

.gap-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    margin-top: var(--space-sm);
}

.gap-indicator.aligned {
    background: var(--success-soft);
    color: var(--success);
}

.gap-indicator.gap {
    background: var(--gap-soft);
    color: var(--gap-color);
}

/* ----- Comments ----- */
.comments {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--secondary-bg);
}

.comment {
    font-size: 0.8125rem;
    padding: var(--space-sm);
    background: var(--secondary-bg);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
}

.comment-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hint-color);
    margin-bottom: 2px;
    font-family: var(--font-heading);
}

/* ----- Trends ----- */
.trend-chart {
    background: var(--secondary-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
}

.trend-chart h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

#trendBars {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.trend-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.trend-date {
    width: 56px;
    font-size: 0.8125rem;
    color: var(--hint-color);
    flex-shrink: 0;
}

.trend-bars {
    flex: 1;
    display: flex;
    gap: 6px;
    height: 26px;
    align-items: center;
}

.trend-bar {
    height: 100%;
    border-radius: var(--radius-sm);
    min-width: 4px;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.trend-bar.user {
    background: var(--button-color);
}

.trend-bar.partner {
    background: var(--partner-accent);
    opacity: 0.85;
}

.trend-values {
    width: 56px;
    font-size: 0.8125rem;
    text-align: right;
    font-family: var(--font-heading);
    font-weight: 500;
}

/* ----- Empty state ----- */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--hint-color);
    font-family: var(--font-body);
    font-size: 0.9375rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
    line-height: 1;
    opacity: 0.9;
}

/* ----- Partner status banner ----- */
.partner-status {
    padding: var(--space-sm) var(--space-md);
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: var(--space-md);
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
}

/* ============= DAILY CHECK-IN ============= */
.daily-question {
    background: var(--secondary-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.daily-question:nth-child(1) { animation-delay: 0.06s; }
.daily-question:nth-child(2) { animation-delay: 0.12s; }
.daily-question:nth-child(3) { animation-delay: 0.18s; }
.daily-question:nth-child(4) { animation-delay: 0.24s; }
.daily-question:nth-child(5) { animation-delay: 0.3s; }

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.daily-question .category-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hint-color);
    margin-bottom: var(--space-xs);
    font-family: var(--font-heading);
}

.daily-question .question-text {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: var(--space-md);
    line-height: 1.45;
    font-family: var(--font-heading);
    letter-spacing: -0.01em;
}

.rating-buttons {
    display: flex;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.rating-btn {
    flex: 1;
    min-width: 0;
    height: 48px;
    border: 2px solid var(--secondary-bg);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.22s ease, background 0.22s ease, color 0.22s ease, transform 0.2s ease;
}

.rating-btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: scale(1.02);
}

.rating-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

.rating-btn.selected {
    background: var(--button-color);
    border-color: var(--button-color);
    color: var(--button-text);
}

.comment-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--secondary-bg);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9375rem;
    font-family: var(--font-body);
    resize: none;
    min-height: 64px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.comment-input::placeholder {
    color: var(--hint-color);
}

.comment-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.save-indicator {
    font-size: 0.8125rem;
    font-family: var(--font-heading);
    color: var(--hint-color);
    text-align: center;
    padding: var(--space-sm);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-indicator.visible {
    opacity: 1;
}

.save-indicator.saving {
    color: var(--hint-color);
}

.save-indicator.saved {
    color: var(--success);
}

.save-indicator.error {
    color: var(--gap-color);
}

.daily-submit-row {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}

.submit-daily-btn {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    background: var(--button-color);
    color: var(--button-text);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
}

.submit-daily-btn:hover:not(:disabled) {
    background: var(--accent-hover, var(--accent));
}

.submit-daily-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-message {
    margin-top: var(--space-sm);
    font-size: 0.9375rem;
    font-family: var(--font-heading);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
}

.submit-message-success {
    color: var(--success);
    background: var(--success-soft);
}

.submit-message-error {
    color: var(--gap-color);
    background: var(--gap-soft);
}

.submit-hint {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--hint-color);
    margin-top: var(--space-xs);
    font-family: var(--font-heading);
}

.daily-progress {
    background: var(--secondary-bg);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
}

.daily-progress .progress-text {
    font-family: var(--font-heading);
    font-size: 0.9375rem;
    font-weight: 600;
}

.daily-progress .progress-bar {
    flex: 1;
    max-width: 120px;
    height: 8px;
    background: var(--bg-color);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.daily-progress .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--button-color), var(--accent-hover, var(--accent)));
    border-radius: var(--radius-full);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.daily-complete {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    background: var(--success-soft);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(45, 122, 94, 0.2);
}

.daily-complete .complete-icon {
    font-size: 2.75rem;
    margin-bottom: var(--space-sm);
    line-height: 1;
}

.daily-complete .complete-text {
    font-family: var(--font-heading);
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--success);
}

.both-completed {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: linear-gradient(135deg, var(--partner-soft), var(--accent-soft));
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(166, 61, 106, 0.15);
    animation: slideIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.both-completed-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.both-completed-text {
    flex: 1;
}

.both-completed-text strong {
    color: var(--partner-accent);
    font-size: 0.9375rem;
    font-family: var(--font-heading);
}

.both-completed-text span {
    font-size: 0.8125rem;
    color: var(--hint-color);
}

/* ============= COACH TAB ============= */

/* ----- Conversation Starter Card ----- */
.coach-starter {
    margin-bottom: var(--space-md);
}

.starter-card {
    background: linear-gradient(135deg, var(--accent-soft), var(--partner-soft));
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    padding-bottom: var(--space-sm);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.starter-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.starter-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.starter-label {
    flex: 1;
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hint-color);
}

.starter-refresh {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    background: var(--bg-color);
    color: var(--hint-color);
    font-size: 1.125rem;
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.starter-refresh:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

.starter-topic {
    font-family: var(--font-heading);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: var(--space-sm);
    line-height: 1.35;
}

.starter-suggestion {
    font-size: 0.9375rem;
    color: var(--text-color);
    line-height: 1.55;
    opacity: 0.85;
}

/* ----- Quick-question Chips ----- */
.coach-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    animation-delay: 0.15s;
}

.coach-chip {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--secondary-bg);
    color: var(--text-color);
    font-family: var(--font-heading);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    line-height: 1.3;
    text-align: left;
}

.coach-chip:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    transform: scale(1.02);
}

.coach-chip:active {
    transform: scale(0.97);
}

.coach-chip:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

/* Coach tab: flex layout so chat gets remaining height and scrolls correctly */
#coach.tab-content.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
}

#coach .coach-starter {
    flex-shrink: 0;
}

/* ----- Chat Section ----- */
.coach-chat {
    background: var(--secondary-bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 260px;
    max-height: min(65vh, 500px);
}

.coach-chat-header {
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-heading);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hint-color);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-md);
    padding-bottom: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    -webkit-overflow-scrolling: touch;
}

.chat-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 120px;
    color: var(--hint-color);
    font-size: 0.875rem;
    text-align: center;
    padding: var(--space-lg);
}

.chat-bubble {
    max-width: 85%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    line-height: 1.55;
    animation: cardIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) backwards;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
    flex-shrink: 0;
}

.chat-bubble-user {
    align-self: flex-end;
    background: var(--button-color);
    color: var(--button-text);
    border-bottom-right-radius: var(--space-xs);
}

.chat-bubble-coach {
    align-self: flex-start;
    background: var(--bg-color);
    color: var(--text-color);
    border-bottom-left-radius: var(--space-xs);
    border: 1px solid var(--border-subtle);
}

.chat-typing {
    opacity: 0.5;
    font-style: italic;
}

/* ----- Chat Input ----- */
.chat-input-row {
    display: flex;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-top: 1px solid var(--border-subtle);
    background: var(--secondary-bg);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 0.9375rem;
    font-family: var(--font-body);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input::placeholder {
    color: var(--hint-color);
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--button-color);
    color: var(--button-text);
    font-size: 1.25rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    flex-shrink: 0;
}

.chat-send-btn:hover:not(:disabled) {
    transform: scale(1.06);
    background: var(--accent-hover, var(--accent));
}

.chat-send-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.chat-send-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent);
}

/* ----- Reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
    .tab-content.active,
    .daily-question,
    .both-completed,
    .starter-card,
    .chat-bubble {
        animation: none;
    }
    .trend-bar,
    .progress-fill,
    .save-indicator,
    .starter-refresh {
        transition: none;
    }
}
