:root {
    --bg: #f8f3ea;
    --bg-gradient-top: #fbf7f1;
    --bg-gradient-bottom: #f2eadc;
    --paper: rgba(255, 251, 245, 0.86);
    --paper-strong: rgba(255, 250, 242, 0.96);
    --text: #201a15;
    --muted: #6e625a;
    --primary: #bf5a2a;
    --primary-dark: #8f3f1a;
    --accent: #184d63;
    --accent-soft: #dcecf1;
    --line: rgba(32, 26, 21, 0.08);
    --success: #1f7a53;
    --danger: #ab412e;
    --shadow: 0 24px 80px rgba(43, 33, 24, 0.12);
    --topbar-bg: rgba(255, 251, 245, 0.55);
    --topbar-border: rgba(255, 255, 255, 0.45);
    --ghost-bg: rgba(255, 255, 255, 0.38);
    --ghost-border: rgba(32, 26, 21, 0.1);
    --surface-soft: rgba(255, 255, 255, 0.58);
    --surface-soft-strong: rgba(255, 255, 255, 0.8);
    --chart-secondary: rgba(24, 77, 99, 0.26);
    --chart-muted: rgba(32, 26, 21, 0.1);
    --calendar-min-width: 920px;
}

:root[data-theme="dark"] {
    --bg: #15181d;
    --bg-gradient-top: #1b2027;
    --bg-gradient-bottom: #11151b;
    --paper: rgba(22, 27, 34, 0.88);
    --paper-strong: rgba(26, 31, 39, 0.95);
    --text: #eef2f7;
    --muted: #9ba8b8;
    --primary: #ff915c;
    --primary-dark: #d76e3d;
    --accent: #7ec7e1;
    --accent-soft: rgba(126, 199, 225, 0.16);
    --line: rgba(255, 255, 255, 0.08);
    --success: #6cda9f;
    --danger: #ff8a7b;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
    --topbar-bg: rgba(20, 25, 31, 0.72);
    --topbar-border: rgba(255, 255, 255, 0.08);
    --ghost-bg: rgba(255, 255, 255, 0.06);
    --ghost-border: rgba(255, 255, 255, 0.08);
    --surface-soft: rgba(255, 255, 255, 0.05);
    --surface-soft-strong: rgba(255, 255, 255, 0.08);
    --chart-secondary: rgba(126, 199, 225, 0.42);
    --chart-muted: rgba(255, 255, 255, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 0% 0%, rgba(236, 145, 92, 0.22), transparent 30%),
        radial-gradient(circle at 100% 10%, rgba(24, 77, 99, 0.18), transparent 24%),
        linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg-gradient-bottom) 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

.page-shell {
    max-width: 1360px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    z-index: 2;
}

.page-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(10px);
    z-index: 0;
    pointer-events: none;
}

.orb-a {
    width: 340px;
    height: 340px;
    background: rgba(191, 90, 42, 0.13);
    top: -80px;
    left: -80px;
}

.orb-b {
    width: 320px;
    height: 320px;
    background: rgba(24, 77, 99, 0.11);
    right: -80px;
    top: 180px;
}

.grid-overlay {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
    padding: 20px 24px;
    border: 1px solid var(--topbar-border);
    background: var(--topbar-bg);
    backdrop-filter: blur(18px);
    border-radius: 24px;
    box-shadow: 0 18px 50px rgba(52, 40, 29, 0.08);
}

.brand {
    font-weight: 800;
    font-size: 1.65rem;
    letter-spacing: -0.04em;
}

.subtitle,
.empty,
.recent span,
.stats-line span,
.message {
    color: var(--muted);
}

.top-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--ghost-border);
    background: var(--ghost-bg);
    backdrop-filter: blur(10px);
}

.ghost-button {
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--ghost-border);
    background: var(--ghost-bg);
    backdrop-filter: blur(10px);
    font: inherit;
    cursor: pointer;
    color: inherit;
}

.theme-toggle {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 999px;
    border: 1px solid var(--ghost-border);
    background: var(--ghost-bg);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.theme-toggle::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #ffd76a;
    box-shadow:
        0 0 0 5px rgba(255, 215, 106, 0.15),
        0 0 18px rgba(255, 215, 106, 0.45);
}

:root[data-theme="dark"] .theme-toggle::before {
    background: #ffe38a;
    box-shadow:
        0 0 0 5px rgba(255, 227, 138, 0.1),
        0 0 22px rgba(255, 227, 138, 0.4);
}

.inline-form {
    margin: 0;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    background: rgba(24, 77, 99, 0.1);
    color: var(--accent);
    font-weight: 700;
}

.ghost-link-large {
    min-height: 52px;
    padding: 0 18px;
}

.hero,
.result-hero,
.question-card,
.progress-card,
.card,
.stats-card,
.review-card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.hero,
.result-hero {
    padding: 34px;
    margin-bottom: 26px;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
    gap: 24px;
    align-items: stretch;
}

.hero h1,
.result-hero h1 {
    margin: 10px 0 12px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 0.95;
}

.hero-copy p,
.result-hero p {
    max-width: 680px;
    font-size: 1.05rem;
    line-height: 1.65;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    color: var(--primary-dark);
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.hero-badge {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(24, 77, 99, 0.08);
    color: var(--accent);
    font-size: 0.92rem;
    font-weight: 700;
}

.hero-panel {
    display: grid;
    gap: 14px;
}

.hero-panel-card {
    border-radius: 22px;
    padding: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 238, 228, 0.88));
    border: 1px solid rgba(32, 26, 21, 0.08);
}

.hero-panel-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.hero-panel-card strong {
    font-size: 1.8rem;
    letter-spacing: -0.04em;
}

.cards,
.modes-grid,
.summary-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.cards {
    margin-top: 8px;
}

.modes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-stack {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) 360px;
    gap: 22px;
    margin-bottom: 22px;
}

.dashboard-main,
.readiness-card,
.summary-card,
.history-card,
.mode-card,
.calendar-card,
.problem-card,
.upload-card,
.stats-card {
    padding: 26px;
    border-radius: 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.calendar-card {
    padding: 30px;
}

.problem-card {
    max-width: 920px;
}

.dashboard-main h1,
.history-card h2 {
    margin: 10px 0 12px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 0.98;
}

.dashboard-main p {
    margin: 0;
    color: var(--muted);
    max-width: 680px;
    line-height: 1.65;
}

.readiness-card {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 18px;
}

.readiness-chart {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    display: grid;
    place-items: center;
}

.readiness-core {
    width: 138px;
    height: 138px;
    border-radius: 50%;
    background: rgba(255, 250, 243, 0.96);
    display: grid;
    place-items: center;
    text-align: center;
    box-shadow: inset 0 0 0 1px rgba(32, 26, 21, 0.06);
}

.readiness-core strong {
    display: block;
    font-size: 2rem;
    line-height: 1;
}

.readiness-core span {
    color: var(--muted);
    font-size: 0.92rem;
}

.readiness-legend {
    display: grid;
    gap: 8px;
    width: 100%;
    color: var(--muted);
}

.legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.legend-primary {
    background: var(--primary);
}

.legend-accent {
    background: rgba(24, 77, 99, 0.5);
}

.legend-muted {
    background: rgba(32, 26, 21, 0.14);
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 8px;
}

.summary-card strong {
    display: block;
    font-size: 2rem;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
}

.summary-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.dashboard-head {
    margin-bottom: 22px;
    padding: 26px 28px;
    border-radius: 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.dashboard-head h1 {
    margin: 10px 0 12px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 0.98;
}

.dashboard-head p {
    margin: 0;
    color: var(--muted);
    max-width: 760px;
    line-height: 1.6;
}

.quiz-head {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: flex-start;
}

.plus-button {
    width: 68px;
    height: 68px;
    border: 0;
    border-radius: 22px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 18px 34px rgba(191, 90, 42, 0.24);
}

.card,
.mode-card,
.stats-card,
.review-card {
    padding: 24px;
}

.card,
.mode-card {
    background: linear-gradient(180deg, var(--paper-strong), rgba(247, 240, 230, 0.9));
}

.mode-card,
.quiz-card,
.quiz-mini-card,
.stats-card,
.summary-card {
    height: 100%;
}

.mode-card,
.quiz-card,
.stats-card {
    display: flex;
    flex-direction: column;
}

.card-head,
.stats-line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.stats-line {
    padding-top: 12px;
}

.stats-card h2,
.quiz-card h2,
.mode-card h2 {
    margin: 0;
}

.mode-card p,
.quiz-card p {
    margin: 0 0 12px;
    line-height: 1.55;
}

.mode-card .button,
.quiz-card-actions {
    margin-top: auto;
}

.pill {
    background: rgba(182, 84, 43, 0.12);
    color: var(--primary-dark);
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    background: var(--primary);
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 16px 32px rgba(191, 90, 42, 0.22);
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(143, 63, 26, 0.28);
}

.attempt-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 22px;
}

.progress-card,
.question-card {
    padding: 28px;
}

.attempt-quiz-title {
    display: block;
    margin-top: 8px;
    color: var(--accent);
}

.progress-card {
    position: sticky;
    top: 24px;
    height: fit-content;
}

.progress-bar {
    height: 14px;
    border-radius: 999px;
    background: rgba(35, 31, 26, 0.08);
    overflow: hidden;
    margin: 20px 0 10px;
}

.progress-bar span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #e28952, #bf5a2a);
}

.mini-note {
    margin-top: 22px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(24, 77, 99, 0.08);
    color: var(--accent);
    line-height: 1.5;
}

.answer-form {
    display: grid;
    gap: 14px;
}

.option {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.option:hover {
    transform: translateY(-1px);
    border-color: rgba(191, 90, 42, 0.25);
    background: rgba(255, 250, 244, 0.92);
}

.option-correct {
    border-color: rgba(31, 122, 83, 0.35);
    background: linear-gradient(180deg, rgba(240, 252, 245, 0.95), rgba(252, 255, 253, 0.92));
}

.option-wrong {
    border-color: rgba(171, 65, 46, 0.28);
    background: linear-gradient(180deg, rgba(255, 245, 243, 0.95), rgba(255, 252, 251, 0.92));
}

.option input {
    margin-top: 3px;
    accent-color: var(--primary);
}

.feedback-box {
    padding: 16px 18px;
    border-radius: 18px;
    font-weight: 700;
    line-height: 1.5;
}

.feedback-correct {
    background: rgba(31, 122, 83, 0.1);
    color: var(--success);
}

.feedback-wrong {
    background: rgba(171, 65, 46, 0.1);
    color: var(--danger);
}

.recent ul,
.review-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.review-list {
    display: grid;
    gap: 16px;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.is-correct {
    border-color: rgba(29, 122, 74, 0.28);
    background: linear-gradient(180deg, rgba(242, 252, 246, 0.92), rgba(255, 255, 255, 0.82));
}

.is-wrong {
    border-color: rgba(165, 59, 46, 0.22);
    background: linear-gradient(180deg, rgba(255, 246, 243, 0.92), rgba(255, 255, 255, 0.82));
}

.success {
    color: var(--success);
}

.danger {
    color: var(--danger);
}

.messages {
    margin-bottom: 18px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
}

.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.history-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid rgba(32, 26, 21, 0.07);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-board {
    overflow-x: auto;
    padding-bottom: 6px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
    min-width: var(--calendar-min-width);
}

.calendar-weekdays {
    margin-bottom: 12px;
    color: var(--muted);
    font-weight: 700;
}

.calendar-day {
    min-width: 0;
    min-height: 148px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(32, 26, 21, 0.08);
    background: var(--surface-soft);
    overflow: hidden;
}

.calendar-day.is-outside {
    opacity: 0.42;
}

.calendar-day.is-today {
    border-color: rgba(191, 90, 42, 0.3);
    box-shadow: inset 0 0 0 1px rgba(191, 90, 42, 0.12);
}

.calendar-day-head {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.calendar-day-head strong {
    min-width: 0;
}

.shift-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    line-height: 1.1;
    font-weight: 700;
    text-align: center;
    overflow-wrap: anywhere;
}

.shift-badge.is-hidden {
    display: none;
}

.shift-day {
    background: rgba(24, 77, 99, 0.12);
    color: var(--accent);
}

.shift-full {
    background: rgba(191, 90, 42, 0.12);
    color: var(--primary-dark);
}

.shift-form {
    display: grid;
    gap: 8px;
}

.shift-form button {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid rgba(32, 26, 21, 0.08);
    background: var(--surface-soft-strong);
    font: inherit;
    font-size: 0.82rem;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.shift-clear {
    color: var(--danger);
}

.problem-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.problem-list li {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--surface-soft);
    border: 1px solid rgba(32, 26, 21, 0.08);
}

.problem-list span {
    line-height: 1.5;
}

.problem-list strong {
    color: var(--danger);
}

.quiz-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.quiz-card,
.quiz-mini-card {
    display: grid;
    gap: 12px;
    padding: 24px;
    border-radius: 26px;
    background: linear-gradient(180deg, var(--paper-strong), rgba(245, 237, 228, 0.92));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.quiz-card-title {
    display: inline-block;
}

.quiz-card p,
.quiz-mini-card span {
    margin: 0;
    color: var(--muted);
}

.quiz-card-actions,
.quiz-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
}

.quiz-card-link {
    justify-self: start;
    margin-top: 8px;
}

.danger-button {
    color: var(--danger);
}

.create-quiz-panel {
    margin-bottom: 24px;
    padding: 26px;
    border-radius: 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.create-quiz-panel.is-hidden {
    display: none;
}

.create-quiz-form {
    display: grid;
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-weight: 700;
}

.field input[type="text"] {
    width: 100%;
    min-height: 54px;
    padding: 0 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    color: var(--text);
    font: inherit;
}

.dropzone {
    position: relative;
    margin-top: 12px;
    padding: 18px;
    border-radius: 24px;
    border: 2px dashed rgba(24, 77, 99, 0.24);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(236, 246, 249, 0.8));
    cursor: pointer;
}

.dropzone.is-dragging {
    border-color: rgba(191, 90, 42, 0.4);
    background: linear-gradient(180deg, rgba(255, 247, 242, 0.82), rgba(255, 255, 255, 0.9));
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.dropzone-inner {
    display: grid;
    gap: 8px;
    text-align: center;
}

.dropzone-inner strong {
    font-size: 1.1rem;
}

.dropzone-inner span,
.dropzone-inner p {
    color: var(--muted);
    margin: 0;
}

.upload-result {
    margin-top: 14px;
    min-height: 24px;
    font-weight: 700;
}

.upload-result.is-success {
    color: var(--success);
}

.upload-result.is-error {
    color: var(--danger);
}

.history-list span,
.history-list time {
    color: var(--muted);
}

.message {
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--paper-strong);
    border: 1px solid var(--line);
}

.impersonation-banner {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 18px;
    background: rgba(191, 90, 42, 0.12);
    border: 1px solid rgba(191, 90, 42, 0.16);
}

.chat-fab {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 30;
    border: 0;
    width: 60px;
    height: 60px;
    border-radius: 999px;
    background: linear-gradient(180deg, var(--primary), var(--primary-dark));
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.chat-fab svg {
    width: 26px;
    height: 26px;
}

.chat-widget {
    position: fixed;
    right: 22px;
    bottom: 88px;
    z-index: 30;
    width: min(380px, calc(100vw - 24px));
    padding: 18px;
    border-radius: 24px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
}

.ai-widget {
    right: 96px;
}

.ai-fab {
    right: 94px;
    background: linear-gradient(180deg, var(--accent), #0f3b4e);
}

.chat-widget.is-hidden {
    display: none;
}

.chat-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.chat-head span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.92rem;
}

.chat-messages {
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow-y: auto;
    margin-bottom: 14px;
}

.chat-message {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid var(--line);
    width: fit-content;
    max-width: 88%;
}

.chat-message time {
    font-size: 0.76rem;
    color: var(--muted);
}

.chat-message.from-user {
    justify-self: end;
    background: rgba(191, 90, 42, 0.12);
}

.chat-message.from-admin {
    justify-self: start;
    background: rgba(24, 77, 99, 0.12);
}

.ai-assistant-message {
    background: rgba(24, 77, 99, 0.14);
}

.ai-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-sources a {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.48);
    color: var(--accent);
    font-size: 0.8rem;
    text-decoration: none;
}

.admin-chat-thread .chat-message.from-admin {
    justify-self: end;
}

.admin-chat-thread .chat-message.from-user {
    justify-self: start;
}

.chat-form {
    display: grid;
    gap: 10px;
}

.chat-form textarea {
    width: 100%;
    min-height: 96px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    color: var(--text);
    font: inherit;
    resize: vertical;
}

.schedule-upload-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    align-items: center;
}

.schedule-upload-form input[type="file"] {
    max-width: 100%;
}

.schedule-preview {
    display: block;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
}

.schedule-preview img {
    display: block;
    width: 100%;
    height: auto;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.section-head-spaced {
    margin-top: 24px;
}

.admin-chat-thread {
    margin-bottom: 18px;
}

.auth-wrap {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}

.auth-card {
    width: min(100%, 520px);
    padding: 30px;
    border-radius: 28px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.auth-card h1 {
    margin: 10px 0 20px;
    font-size: 2rem;
}

.auth-text {
    margin: 0 0 20px;
    color: var(--muted);
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field span {
    font-weight: 700;
}

.auth-field input {
    width: 100%;
    min-height: 52px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--paper-strong);
    color: var(--text);
    padding: 0 16px;
    font: inherit;
}

.errorlist {
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--danger);
    font-size: 0.92rem;
}

.auth-link {
    display: inline-block;
    margin-top: 18px;
    color: var(--accent);
    font-weight: 700;
}

:root[data-theme="dark"] .subtitle,
:root[data-theme="dark"] .empty,
:root[data-theme="dark"] .recent span,
:root[data-theme="dark"] .stats-line span,
:root[data-theme="dark"] .message,
:root[data-theme="dark"] .dashboard-main p,
:root[data-theme="dark"] .dashboard-head p,
:root[data-theme="dark"] .summary-card p,
:root[data-theme="dark"] .summary-card span,
:root[data-theme="dark"] .history-list span,
:root[data-theme="dark"] .history-list time,
:root[data-theme="dark"] .readiness-core span,
:root[data-theme="dark"] .dropzone-inner span,
:root[data-theme="dark"] .dropzone-inner p,
:root[data-theme="dark"] .chat-head span,
:root[data-theme="dark"] .chat-message time,
:root[data-theme="dark"] .hero-panel-card span {
    color: var(--muted);
}

:root[data-theme="dark"] .eyebrow,
:root[data-theme="dark"] .pill,
:root[data-theme="dark"] .shift-full {
    color: #ffd1bb;
}

:root[data-theme="dark"] .hero-panel-card,
:root[data-theme="dark"] .readiness-core,
:root[data-theme="dark"] .history-card,
:root[data-theme="dark"] .calendar-card,
:root[data-theme="dark"] .problem-card,
:root[data-theme="dark"] .upload-card,
:root[data-theme="dark"] .stats-card,
:root[data-theme="dark"] .summary-card,
:root[data-theme="dark"] .dashboard-main,
:root[data-theme="dark"] .readiness-card,
:root[data-theme="dark"] .dashboard-head,
:root[data-theme="dark"] .mode-card,
:root[data-theme="dark"] .quiz-card,
:root[data-theme="dark"] .quiz-mini-card,
:root[data-theme="dark"] .dropzone,
:root[data-theme="dark"] .create-quiz-panel,
:root[data-theme="dark"] .message,
:root[data-theme="dark"] .schedule-preview {
    background: linear-gradient(180deg, rgba(30, 36, 45, 0.94), rgba(21, 27, 35, 0.94));
}

:root[data-theme="dark"] .option,
:root[data-theme="dark"] .history-list li,
:root[data-theme="dark"] .calendar-day,
:root[data-theme="dark"] .problem-list li,
:root[data-theme="dark"] .schedule-upload-form input[type="file"],
:root[data-theme="dark"] .shift-form button,
:root[data-theme="dark"] .field input[type="text"],
:root[data-theme="dark"] .auth-field input,
:root[data-theme="dark"] .chat-form textarea {
    border-color: rgba(255, 255, 255, 0.08);
}

:root[data-theme="dark"] .option {
    background: var(--surface-soft);
}

:root[data-theme="dark"] .option:hover {
    background: var(--paper-strong);
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .mode-card,
:root[data-theme="dark"] .quiz-card,
:root[data-theme="dark"] .quiz-mini-card {
    background: linear-gradient(180deg, rgba(30, 36, 45, 0.94), rgba(21, 27, 35, 0.94));
}

:root[data-theme="dark"] .pill {
    background: rgba(255, 145, 92, 0.14);
}

:root[data-theme="dark"] .mini-note,
:root[data-theme="dark"] .hero-badge,
:root[data-theme="dark"] .shift-day,
:root[data-theme="dark"] .chat-message.from-admin {
    background: rgba(126, 199, 225, 0.12);
}

:root[data-theme="dark"] .shift-full,
:root[data-theme="dark"] .chat-message.from-user {
    background: rgba(255, 145, 92, 0.12);
}

:root[data-theme="dark"] .ai-assistant-message,
:root[data-theme="dark"] .ai-fab {
    background: linear-gradient(180deg, rgba(38, 102, 128, 0.96), rgba(18, 52, 68, 0.96));
}

:root[data-theme="dark"] .ai-sources a {
    background: rgba(255, 255, 255, 0.08);
    color: #bfe9f6;
}

:root[data-theme="dark"] .legend-muted {
    background: rgba(255, 255, 255, 0.18);
}

:root[data-theme="dark"] .legend-accent {
    background: rgba(126, 199, 225, 0.72);
}

:root[data-theme="dark"] .option-correct {
    background: linear-gradient(180deg, rgba(18, 60, 42, 0.92), rgba(21, 33, 29, 0.92));
}

:root[data-theme="dark"] .option-wrong {
    background: linear-gradient(180deg, rgba(73, 31, 28, 0.92), rgba(35, 24, 24, 0.92));
}

:root[data-theme="dark"] .feedback-correct {
    background: rgba(31, 122, 83, 0.18);
}

:root[data-theme="dark"] .feedback-wrong {
    background: rgba(171, 65, 46, 0.18);
}

:root[data-theme="dark"] .user-chip,
:root[data-theme="dark"] .hero-badge,
:root[data-theme="dark"] .shift-day,
:root[data-theme="dark"] .chat-message.from-admin {
    color: #bfe9f6;
}

:root[data-theme="dark"] .chat-message.from-user {
    color: #ffe6d8;
}

@media (max-width: 860px) {
    .dashboard-columns,
    .dashboard-hero,
    .hero,
    .result-hero,
    .attempt-layout {
        grid-template-columns: 1fr;
    }

    .summary-grid,
    .modes-grid,
    .history-list li {
        grid-template-columns: 1fr;
    }

    .two-columns {
        grid-template-columns: 1fr;
    }

    .topbar {
        flex-direction: column;
    }

    .page-shell {
        padding: 16px;
    }

    .quiz-head,
    .impersonation-banner,
    .section-head,
    .chat-head {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-board {
        margin-inline: -8px;
        padding-inline: 8px;
    }

    .calendar-grid {
        min-width: 760px;
    }

    .chat-fab {
        right: 14px;
        bottom: 14px;
        width: 56px;
        height: 56px;
    }

    .ai-fab {
        right: 80px;
    }

    .chat-widget {
        right: 12px;
        left: 12px;
        bottom: 72px;
        width: auto;
    }

    .ai-widget {
        right: 12px;
        left: 12px;
        bottom: 140px;
    }

    .hero,
    .result-hero,
    .question-card,
    .progress-card,
    .card,
    .stats-card,
    .review-card {
        border-radius: 22px;
    }
}

@media (max-width: 1100px) {
    .calendar-day {
        min-height: 136px;
        padding: 10px;
    }

    .shift-badge {
        font-size: 0.68rem;
        padding: 5px 8px;
    }

    .shift-form button {
        font-size: 0.76rem;
        min-height: 30px;
        padding: 5px 6px;
    }
}
