/* Shared visual system for the workspace and owner dashboard. */
:root {
    --bg: #090b10; --surface: #0d1017; --sidebar: #101218; --raised: #151924;
    --hover: #1a2030; --active: #1b2130; --border: #293040; --border-soft: #202633;
    --text: #f6f7fb; --muted: #a0a8ba; --quiet: #7c879c;
    --accent: #6172ff; --accent-hover: #7180ff; --accent-ink: #ffffff;
    --input: #0c0f15; --code-bg: #07090d; --code-text: #d9deea;
    --shadow: 0 20px 60px #00000030; --sidebar-width: 264px;
    --overlay: rgba(2, 4, 9, .72); --success: #73c99b;
}
:root[data-theme="light"] {
    --bg: #ffffff; --surface: #fbfcfe; --sidebar: #f7f8fb; --raised: #f2f4f9;
    --hover: #eef1f7; --active: #e9edfa; --border: #dfe4ed; --border-soft: #eaedf3;
    --text: #171a22; --muted: #606a7c; --quiet: #667085;
    --accent: #5065f5; --accent-hover: #4157e9; --accent-ink: #ffffff;
    --input: #ffffff; --code-bg: #f3f5f9; --code-text: #2b3240;
    --shadow: 0 20px 60px #212b431f; --overlay: rgba(24, 30, 44, .3); --success: #28845a;
}
body { font-size: 14px; }
button, a, input, textarea, select { transition: background-color .16s, border-color .16s, color .16s, box-shadow .16s; }
::selection { color: var(--text); background: var(--active); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary-button, .send-button, .new-chat-button { color: var(--accent-ink); }
.primary-button, .secondary-button { min-height: 42px; border-radius: 11px; padding-inline: 17px; font-size: 13px; }
.secondary-button:hover { background: var(--hover); border-color: var(--accent); }
.app-shell { padding: 12px 12px 12px 0; gap: 0; background: var(--sidebar); }
.sidebar { padding: 17px 16px 6px; border: 0; }
.brand-row { gap: 13px; min-height: 48px; }
.brand-mark { width: 34px; height: 34px; background: var(--accent); color: var(--accent-ink); border-radius: 12px; font-size: 20px; }
.brand-mark.kairo-orbit::after { display: none; }
.brand-name { font-size: 21px; letter-spacing: -.7px; }
.brand-caption { display: block; margin-top: 2px; font-size: 10px; letter-spacing: 0; color: var(--quiet); font-weight: 450; }
.new-chat-button { min-height: 46px; margin-top: 25px; border-radius: 12px; padding: 0 16px; }
.sidebar-section-header { margin-top: 26px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-empty-copy { padding: 12px; margin: 0; font-size: 12px; border-left: 1px solid var(--border); }
.journey-item, .journey-empty-button { min-height: 46px; border-radius: 11px; }
.journey-item-copy strong { font-size: 13px; font-weight: 550; }
.journey-item-icon { border-radius: 9px; width: 30px; height: 30px; }
.sidebar-footer-button { min-height: 44px; border-radius: 11px; font-size: 13px; }
.settings-popover { width: 100%; padding: 12px; border-radius: 17px; bottom: 48px; }
.workspace { border: 1px solid var(--border-soft); border-radius: 22px; box-shadow: 0 2px 10px #00000005; }
.workspace-header { min-height: 76px; padding: 15px 30px; }
.workspace-title-wrap h1 { font-size: 15px; }
.workspace-title-wrap p { margin-top: 5px; font-size: 11px; }
.header-actions { gap: 9px; }
.call-button { background: var(--surface); border-color: var(--border); width: 42px; height: 42px; border-radius: 50%; color: var(--accent); }
.call-button:hover { background: var(--active); border-color: var(--accent); }
.conversation-column { padding: 0 clamp(20px, 4vw, 60px) 17px; }
.chat { width: min(100%, 820px); padding-top: 32px; }
.welcome-state { align-items: flex-start; text-align: left; width: min(100%, 750px); margin: 0 auto; padding: 34px 4px 48px; }
.welcome-mark { width: 46px; height: 46px; margin-bottom: 29px; border-radius: 15px; color: var(--accent); background: var(--active); }
.welcome-mark.kairo-orbit::after { border-color: var(--accent); opacity: .35; }
.welcome-eyebrow { color: var(--quiet); font-size: 10px; font-weight: 650; letter-spacing: .14em; }
.welcome-state h2 { max-width: 620px; margin: 13px 0 15px; font-size: clamp(30px, 3.4vw, 46px); font-weight: 540; line-height: 1.14; letter-spacing: -.045em; text-wrap: balance; }
.welcome-state > p { max-width: 530px; font-size: 15px; line-height: 1.7; }
.suggestions { width: 100%; gap: 12px; margin-top: 30px; }
.suggestions button { position: relative; display: grid; grid-template-columns: 34px 1fr; column-gap: 12px; row-gap: 5px; min-height: 105px; padding: 20px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--surface); }
.suggestions button:hover { background: var(--raised); border-color: var(--accent); }
.starter-symbol { grid-row: span 2; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: var(--active); font-size: 24px; line-height: 1; }
.suggestions strong { color: var(--text); font-size: 14px; font-weight: 600; line-height: 1.4; }
.suggestions small { font-size: 12px; color: var(--muted); line-height: 1.55; }
.composer { width: min(100%, 820px); border-radius: 20px; min-height: 70px; padding: 13px; gap: 8px; background: var(--surface); box-shadow: 0 7px 24px #0000000c; }
.composer:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.composer textarea { font-size: 14px; }
.composer-icon { border: 1px solid var(--border-soft); border-radius: 50%; }
.mode-control { border: 1px solid var(--border-soft); border-radius: 10px; }
.send-button { border-radius: 12px; }
.composer-note { margin-top: 10px; font-size: 10px; color: var(--quiet); }
.message { margin-bottom: 30px; }
.message-body { font-size: 15px; line-height: 1.8; }
.message.user .message-body { padding: 14px 20px; border-radius: 20px 20px 5px 20px; background: var(--raised); }
.message.assistant .message-body { max-width: 100%; width: 100%; padding: 4px 8px; }
.answer-badge { border: 0; background: var(--active); color: var(--accent); padding: 4px 9px; border-radius: 7px; font-size: 9px; }
.response-actions { margin-top: 16px; }
.message-studio-actions { gap: 18px; }
.chat-artifact { background: var(--surface); border-radius: 18px; border-left: 3px solid var(--accent); padding: 22px; }
.journey-context { background: var(--surface); padding-top: 28px; }
.context-label { font-size: 10px; letter-spacing: .08em; }
.study-scroll { width: min(100%, 1100px); padding: 35px clamp(18px, 3vw, 42px) 60px; }
.study-hero { padding: 24px 28px; border: 1px solid var(--border-soft); border-radius: 20px; background: var(--surface); }
.study-hero h2 { font-size: clamp(27px, 3vw, 38px); }
.study-kicker, .study-section-label { font-size: 10px; letter-spacing: .11em; }
.study-mastery { width: 104px; height: 104px; }
.study-mastery::after { background: var(--surface); }
.study-mastery strong { font-size: 25px; }
.study-mastery span { font-size: 7px; letter-spacing: .025em; }
.study-mission, .study-focus, .study-map, .study-coach, .study-overview-card, .study-key-card, .study-weak-card, .quiz-card { border-radius: 18px; border-color: var(--border-soft); background: var(--surface); }
.study-mission { border-left: 3px solid var(--accent); }
.study-focus { background: var(--raised); }
.study-tabs { position: sticky; z-index: 3; top: 0; padding: 5px; border-radius: 14px; background: var(--surface); box-shadow: 0 5px 20px #00000008; }
.study-tabs button { min-height: 43px; border-radius: 10px; font-size: 13px; }
.study-tabs button.active { background: var(--active); color: var(--accent); box-shadow: none; }
.study-overview { font-size: 15px; line-height: 1.85; }
.study-key-points p { font-size: 13px; line-height: 1.7; }
.quiz-card { padding: 30px; }
.quiz-option { border-radius: 13px; padding: 13px 16px; }
.quiz-meta { font-size: 11px; }
.flashcard { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); }
.study-chat-composer { border-radius: 16px; background: var(--surface); }
.study-empty, .study-loading { min-height: 340px; }
dialog { border-radius: 22px !important; box-shadow: var(--shadow); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(5px); }
.creation-dialog { width: min(1100px, 95vw); }
.creation-heading { padding-bottom: 15px; border-bottom: 1px solid var(--border-soft); margin-bottom: 20px; }
.creation-heading h2 { font-size: 28px; letter-spacing: -.035em; margin-bottom: 5px; }
.creation-layout { gap: 28px; }
.creation-item { padding: 17px; border-radius: 14px; background: var(--raised); }
.creation-item:hover { border-color: var(--accent); }
.creation-section { padding: 22px 0; }
.creation-section h3 { font-size: 20px; letter-spacing: -.02em; }
.slide-preview { background: var(--raised); color: var(--text); }
.slide-preview h3 { color: var(--text); }
.slide-preview summary { color: var(--accent); }
.voice-orb { background: radial-gradient(circle at 30% 25%, #a4a8ff, #6354cf 65%, #34307b); box-shadow: 0 10px 40px #7867d544; }
.voice-message.user { background: var(--raised); }
.voice-settings { background: var(--raised); border-color: var(--border-soft); }
.auth-shell { background: var(--sidebar); }
.auth-card { width: min(100%, 460px); padding: 40px; border-radius: 24px; box-shadow: var(--shadow); }
.auth-heading h1 { font-size: 30px; letter-spacing: -.04em; }
.auth-heading p { font-size: 14px; line-height: 1.7; }
.auth-tabs { border-radius: 12px; }
.auth-form input { border-radius: 11px; min-height: 46px; }
.auth-form .primary-button { min-height: 46px; }
.auth-footnote { font-size: 11px; line-height: 1.6; }
.pet-panel { border-radius: 18px; }
.toast { border-radius: 13px; font-size: 13px; }
/* The owner controls use the same tokens without inheriting workspace layout. */
.admin-page .admin-header { background: var(--sidebar); min-height: 76px; border-bottom-color: var(--border-soft); }
.admin-page .admin-main { max-width: 1280px; padding-top: 42px; }
.admin-page .hero h1 { font-size: clamp(30px, 4vw, 44px); }
.admin-page .metric-grid { gap: 16px; }
.admin-page .metric-card { border-radius: 18px; padding: 24px; }
.admin-page .metric-card strong { font-size: 34px; color: var(--accent); }
.admin-page .panel { border-radius: 20px; padding: 26px; margin-top: 16px; }
.admin-page .dashboard-columns { gap: 16px; }
.admin-page .primary-button { color: var(--accent-ink); }
.admin-page .system-grid { border-radius: 13px; }
.admin-page .system-grid > div { background: var(--raised); padding: 19px; }
.admin-page .system-grid span, .admin-page .system-grid small, .admin-page .record-copy p { font-size: 11px; }
.admin-page .metric-card span, .admin-page .metric-card small { font-size: 11px; }
.admin-page .quiet-button { border-radius: 10px; }
@media (max-width: 1100px) and (min-width: 761px) {
    :root { --sidebar-width: 232px; }
    .conversation-column { padding-inline: 24px; }
    .suggestions button { padding: 15px; }
}
@media (max-width: 760px) {
    .app-shell { padding: 0; }
    .workspace { border: 0; border-radius: 0; }
    .sidebar { padding: max(20px, env(safe-area-inset-top)) 18px max(14px, env(safe-area-inset-bottom)); }
    .workspace-header { min-height: 66px; gap: 7px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; }
    .workspace-title-wrap { flex: 1; }
    .header-actions { gap: 4px; }
    .conversation-column { padding: 0 14px max(12px, env(safe-area-inset-bottom)); }
    .welcome-state { padding: 23px 4px 28px; min-height: auto; }
    .welcome-mark { margin-bottom: 24px; width: 36px; height: 36px; }
    .welcome-state h2 { font-size: 32px; max-width: 440px; }
    .welcome-state > p { font-size: 14px; }
    .suggestions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 22px; }
    .suggestions button { grid-template-columns: 1fr; gap: 8px; padding: 14px; min-height: 138px; }
    .starter-symbol { grid-row: auto; width: 29px; height: 29px; font-size: 22px; }
    .suggestions strong { font-size: 13px; }
    .suggestions small { font-size: 11px; }
    .composer { gap: 3px; padding: 7px; border-radius: 18px; min-height: 61px; }
    .composer textarea, input, select, textarea { font-size: 16px; }
    .composer-icon { width: 36px; height: 44px; border: 0; }
    .mode-control { border: 0; padding: 0 2px; }
    .mode-control select { max-width: 65px; font-size: 12px; }
    .composer-note { margin-top: 7px; font-size: 9px; }
    .message-body { font-size: 15px; }
    .message.user .message-body { max-width: 92%; padding: 12px 16px; }
    .study-scroll { padding: 18px 14px 45px; }
    .study-hero { padding: 19px; gap: 14px; align-items: flex-start; }
    .study-hero h2 { font-size: 27px; }
    .study-mastery { width: 82px; height: 82px; }
    .study-mastery strong { font-size: 21px; }
    .study-mastery span { max-width: 58px; text-align: center; font-size: 7px; }
    .study-hero p { font-size: 13px; }
    .quiz-card { padding: 20px; }
    .quiz-actions { flex-wrap: wrap; }
    .creation-heading { gap: 10px; }
    .creation-heading h2 { font-size: 24px; }
    .creation-heading > button { padding-inline: 11px; flex-shrink: 0; }
    .creation-options { align-items: stretch; }
    .creation-options > label { width: 100%; }
    .voice-stage { padding-top: 12px; }
    .voice-settings label { display: flex; }
    .voice-settings select { min-width: 0; max-width: 100%; flex: 1; }
    .voice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .voice-actions button { min-width: 0; padding-inline: 10px; }
    .auth-card { padding: 28px 23px; }
    .admin-page .admin-header { min-height: 64px; }
    .admin-page .panel { padding: 18px; }
    .admin-page .metric-grid { gap: 9px; }
    .admin-page .metric-card { padding: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Composer focus is indicated by its enclosing field, without a second outline. */
.composer textarea:focus-visible, .study-chat-composer textarea:focus-visible { outline: none; }
.study-chat-composer:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.study-focus .secondary-button + .secondary-button { margin-left: 6px; }
.concept-star { background: var(--raised); padding: 12px 18px; font-size: 13px; }
.concept-star:hover { border-color: var(--accent); }
@media (min-width: 761px) and (max-height: 800px) {
    .welcome-state { padding-top: 18px; padding-bottom: 20px; }
    .welcome-mark { margin-bottom: 22px; width: 38px; height: 38px; }
    .welcome-state h2 { font-size: 38px; }
    .suggestions { margin-top: 23px; }
    .suggestions button { min-height: 92px; padding: 17px; }
}

.library-hint { color: var(--muted); line-height: 1.7; max-width: 650px; }
.creation-compose { border: 1px solid var(--border-soft); border-radius: 13px; padding: 15px; margin: 18px 0; }
.creation-compose summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.creation-compose[open] summary { color: var(--text); margin-bottom: 14px; }
.message-sources a { gap: 10px; max-width: min(100%, 350px); padding: 10px 12px; border-radius: 11px; }
.source-number { color: var(--accent); font-weight: 650; flex-shrink: 0; }
.source-card-copy { display: grid; gap: 4px; min-width: 0; }
.source-card-copy strong { font-size: 12px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.source-card-copy small { font-size: 10px; color: var(--quiet); }
.evidence-review { margin-top: 16px; padding: 13px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 12px; }
.evidence-review summary { cursor: pointer; color: var(--muted); }
.evidence-difference { border-top: 1px solid var(--border-soft); margin-top: 12px; padding-top: 10px; }
.evidence-difference p { margin: 6px 0; line-height: 1.65; }
.evidence-difference strong { color: var(--muted); }
.evidence-difference small { color: var(--accent); }

.study-today-button { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 9px 12px; margin: 0 0 6px; background: var(--active); border: 1px solid var(--border); border-radius: 10px; color: var(--text); font-size: 12px; text-align: left; }
.study-today-button:hover { border-color: var(--accent); }
#study-plan-count { color: var(--accent); font-size: 10px; }
.daily-study-coach { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 14px; padding: 22px 24px; margin: 18px 0; }
.coach-heading, .coach-action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.coach-heading .secondary-button { min-height: 32px; font-size: 11px; }
.daily-study-coach h3 { font-size: 22px; margin: 14px 0 8px; letter-spacing: -.4px; }
.daily-study-coach > p, .study-plan-card > p { color: var(--muted); line-height: 1.7; margin: 8px 0 18px; }
#coach-next-review, .coach-next-date { font-size: 11px; color: var(--quiet); }
.coach-schedule { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.coach-schedule summary { color: var(--muted); cursor: pointer; font-size: 12px; }
.coach-schedule-row { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border-soft); padding: 16px 0; }
.coach-schedule-row > div:first-child { min-width: 0; }
.coach-schedule-row strong { font-size: 13px; overflow-wrap: anywhere; }
.coach-schedule-row p, #coach-schedule-note { margin: 6px 0 0; color: var(--quiet); font-size: 11px; line-height: 1.7; }
.coach-schedule-time { display: grid; align-content: start; text-align: right; min-width: 110px; gap: 7px; font-size: 12px; }
.coach-schedule-time small { color: var(--quiet); font-size: 10px; }
.coach-due-label { color: var(--accent); }
#coach-schedule-note { margin-top: 14px; }
.study-plan-dialog { width: min(700px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); overflow-y: auto; box-shadow: var(--shadow); }
.study-plan-content { position: relative; padding: 30px; }
.study-plan-content > h2 { font-size: 32px; margin: 10px 0; letter-spacing: -.8px; }
.study-plan-content > p { color: var(--muted); line-height: 1.7; }
#study-plan-status { font-size: 12px; margin: 18px 0; }
.study-plan-card { border: 1px solid var(--border); border-radius: 13px; padding: 20px; margin-top: 12px; background: var(--bg); }
.study-plan-card:first-child { border-color: var(--accent); }
.study-plan-card h3 { font-size: 20px; margin: 12px 0 6px; overflow-wrap: anywhere; }
.study-plan-card > p { font-size: 13px; }
.coach-topic-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 16px; }
.coach-topic-chips span { font-size: 11px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 760px) {
    .daily-study-coach { padding: 18px; }
    .daily-study-coach h3 { font-size: 20px; }
    .study-plan-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
    .study-plan-content { padding: 24px 18px; }
    .study-plan-card { padding: 18px; }
    .coach-schedule-row { gap: 12px; }
    .coach-schedule-time { min-width: 85px; font-size: 11px; }
}
