@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* ─── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
    --bg:           #080a14;
    --bg-2:         #0c0f1a;
    --surface:      rgba(255,255,255,0.035);
    --surface-hov:  rgba(255,255,255,0.06);
    --glass:        rgba(255,255,255,0.055);
    --glass-border: rgba(255,255,255,0.10);
    --glass-strong: rgba(255,255,255,0.09);

    --violet:       #a78bfa;
    --violet-dim:   #8b5cf6;
    --violet-soft:  rgba(167,139,250,0.12);
    --violet-glow:  rgba(167,139,250,0.25);

    --indigo:       #818cf8;
    --indigo-dim:   #6366f1;
    --indigo-soft:  rgba(129,140,248,0.12);
    --indigo-glow:  rgba(129,140,248,0.25);

    --emerald:      #34d399;
    --emerald-soft: rgba(52,211,153,0.12);

    --amber:        #f59e0b;
    --amber-soft:   rgba(245,158,11,0.12);

    --text:         #f1f5f9;
    --text-2:       #94a3b8;
    --text-3:       #64748b;

    --border:       rgba(255,255,255,0.08);
    --border-accent:rgba(129,140,248,0.28);

    --shadow-sm:    0 2px 8px rgba(0,0,0,0.25);
    --shadow:       0 8px 32px rgba(0,0,0,0.4);
    --shadow-lg:    0 20px 60px rgba(0,0,0,0.5);
    --shadow-indigo: 0 8px 32px rgba(129,140,248,0.18);
    --shadow-violet: 0 8px 32px rgba(167,139,250,0.18);

    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 22px;
    --r-xl: 28px;

    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ─── Reset & Base ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 60% 50% at 10% 0%, rgba(167,139,250,0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 90% 20%, rgba(129,140,248,0.10) 0%, transparent 50%),
        radial-gradient(ellipse 40% 60% at 50% 100%, rgba(52,211,153,0.06) 0%, transparent 50%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle grid overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.6), transparent 80%);
    z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

/* ─── Ambient Orbs ───────────────────────────────────────────────────────────── */
.page-backdrop {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(167,139,250,0.10) 0%, transparent 65%);
    pointer-events: none;
    z-index: 0;
    animation: orbFloat 12s ease-in-out infinite alternate;
}

@keyframes orbFloat {
    0%   { transform: translate(0,0) scale(1); }
    100% { transform: translate(3%,4%) scale(1.08); }
}

/* ─── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 12px;
    z-index: 100;
    width: min(1440px, calc(100% - 32px));
    margin: 12px auto 0;
    padding: 14px 22px;
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    background: rgba(10,15,30,0.72);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: var(--shadow), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: background 300ms var(--ease);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-dot {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--indigo), #8b5cf6);
    box-shadow: 0 0 0 6px var(--indigo-soft), var(--shadow-indigo);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.brand-dot::after {
    content: '📚';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.brand-kicker,
.section-label {
    margin: 0 0 3px;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--indigo);
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.site-header h1 {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.logout-form { display: inline-flex; }

.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--indigo-soft);
    border: 1px solid var(--border-accent);
    color: var(--indigo);
    font-weight: 700;
    font-size: 0.85rem;
}

.user-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--indigo);
    box-shadow: 0 0 0 3px var(--indigo-soft);
    animation: statusPulse 2.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--indigo-soft); }
    50%       { box-shadow: 0 0 0 5px rgba(129,140,248,0.06); }
}

/* ─── Button System ──────────────────────────────────────────────────────────── */
.header-link,
.ghost-button,
.primary-button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: transform 200ms var(--ease-bounce), box-shadow 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease), color 200ms var(--ease);
    white-space: nowrap;
}

.header-link,
.ghost-button {
    color: var(--text-2);
    background: var(--glass);
    border-color: var(--border);
}

.header-link:hover,
.ghost-button:hover {
    color: var(--indigo);
    background: var(--indigo-soft);
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.primary-button {
    color: #fff;
    background: linear-gradient(135deg, var(--indigo) 0%, #6366f1 100%);
    box-shadow: 0 4px 16px var(--indigo-glow);
    border-color: transparent;
    font-weight: 700;
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px var(--indigo-glow);
}

.primary-button:active { transform: translateY(0); }

.secondary-button {
    color: var(--text-2);
    background: var(--glass);
    border-color: var(--border);
}

.secondary-button:hover {
    color: var(--text);
    background: var(--surface-hov);
    border-color: rgba(255,255,255,0.16);
    transform: translateY(-1px);
}

/* Admin badge */
.admin-badge {
    display: inline-block;
    font-size: 0.6rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 1px 7px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* ─── Dashboard Nav ──────────────────────────────────────────────────────────── */
.db-nav {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.db-nav a {
    padding: 7px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
    background: var(--glass);
    text-decoration: none;
    transition: all 200ms var(--ease);
}

.db-nav a:hover {
    color: var(--indigo);
    background: var(--indigo-soft);
    border-color: var(--border-accent);
}

.db-nav a.active {
    background: linear-gradient(135deg, var(--indigo), var(--indigo-dim));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 14px var(--indigo-glow);
}

.admin-link.active-link {
    color: var(--indigo);
    background: var(--indigo-soft);
    border-radius: 999px;
    border-color: var(--border-accent) !important;
}

/* ─── Page Shell ─────────────────────────────────────────────────────────────── */
.page-shell {
    position: relative;
    z-index: 1;
    width: min(1440px, calc(100% - 32px));
    margin: 20px auto 48px;
    display: grid;
    gap: 20px;
}

/* ─── Card System ────────────────────────────────────────────────────────────── */
.hero-card,
.workspace-card,
.sidebar-card {
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    background: var(--glass);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* Card inner shimmer */
.hero-card::before,
.workspace-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%);
    pointer-events: none;
    border-radius: inherit;
}

.hero-card {
    padding: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    background:
        linear-gradient(135deg, rgba(129,140,248,0.06) 0%, rgba(99,102,241,0.04) 100%),
        var(--glass);
}

.hero-copy h2 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.7rem, 3.5vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin-top: 4px;
    background: linear-gradient(135deg, var(--text) 30%, var(--indigo) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-text {
    margin: 12px 0 0;
    max-width: 52ch;
    color: var(--text-2);
    font-size: 0.95rem;
    line-height: 1.65;
}

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.hero-badges span,
.period-chip,
.row-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--indigo-soft);
    color: var(--indigo);
    border: 1px solid var(--border-accent);
    font-weight: 700;
    font-size: 0.82rem;
    letter-spacing: 0.01em;
}

.hero-stats {
    min-width: 220px;
    display: grid;
    gap: 10px;
}

.hero-stats > div {
    padding: 16px 18px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    display: grid;
    gap: 3px;
}

.hero-stats strong {
    font-family: 'Outfit', sans-serif;
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--indigo);
}

.hero-stats span {
    color: var(--text-3);
    font-size: 0.82rem;
    font-weight: 500;
}

/* ─── Layout Grid ────────────────────────────────────────────────────────────── */
.layout-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
    align-items: start;
}

.workspace-card,
.sidebar-card {
    padding: 22px;
}

/* ─── Card Header ────────────────────────────────────────────────────────────── */
.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.card-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-top: 2px;
}

.card-subtitle {
    margin: 6px 0 0;
    color: var(--text-3);
    font-size: 0.84rem;
    line-height: 1.55;
}

/* ─── Messages ───────────────────────────────────────────────────────────────── */
.message-stack {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    padding: 12px 16px;
    border-radius: var(--r-sm);
    font-weight: 600;
    font-size: 0.9rem;
}

.message-success {
    background: rgba(16,185,129,0.12);
    border: 1px solid rgba(16,185,129,0.28);
    color: #34d399;
}

.message-error {
    background: rgba(239,68,68,0.10);
    border: 1px solid rgba(239,68,68,0.24);
    color: #f87171;
}

/* ─── Form Fields ────────────────────────────────────────────────────────────── */
.diary-form {
    display: grid;
    gap: 18px;
}

.header-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.field {
    display: grid;
    gap: 7px;
}

.field > span {
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
}

.field input,
.field select {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    outline: none;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease);
    -webkit-appearance: none;
    appearance: none;
}

.field input:hover,
.field select:hover {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
}

.field input:focus,
.field select:focus,
.diary-table input:focus,
.diary-table select:focus,
.diary-table textarea:focus {
    border-color: var(--indigo-dim);
    box-shadow: 0 0 0 3px var(--indigo-soft);
    background: rgba(129,140,248,0.04);
}

.field input::placeholder { color: var(--text-3); }

.field-hint {
    font-size: 0.72rem;
    color: var(--text-3);
    line-height: 1.4;
    margin-top: 2px;
}

/* ─── Checkbox ───────────────────────────────────────────────────────────────── */
.deputation-toggle {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-2);
    cursor: pointer;
}

.checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--indigo);
    cursor: pointer;
    border-radius: 4px;
}

/* ─── Deputation Section ─────────────────────────────────────────────────────── */
.deputation-section {
    padding: 18px;
    border-radius: var(--r-md);
    border: 1px solid rgba(245,158,11,0.25);
    background: var(--amber-soft);
}

.deputation-header {
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.deputation-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--amber), #d97706);
    color: #fff;
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
}

.deputation-fields {
    display: grid;
    gap: 12px;
}

.deputation-fields .field textarea {
    width: 100%;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 11px 14px;
    resize: vertical;
    min-height: 72px;
    outline: none;
    font-family: inherit;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.deputation-fields .field textarea:focus {
    border-color: var(--indigo-dim);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

/* Voice lang */
.voice-lang-select {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-3);
    font-weight: 600;
}

.voice-lang-dropdown {
    padding: 4px 10px;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    font-size: 0.75rem;
    color: var(--text);
    outline: none;
    cursor: pointer;
}

.voice-input-wrap {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.voice-input-wrap input,
.voice-input-wrap textarea {
    flex: 1;
    min-width: 0;
}

.voice-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-height: 46px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    transition: all 200ms var(--ease);
    flex-shrink: 0;
    padding: 0;
}

.voice-btn:hover {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
    color: var(--indigo);
}

.voice-btn .mic-icon { display: block; color: var(--text-2); }

.voice-btn.listening {
    background: var(--amber);
    border-color: var(--amber);
    animation: voicePulse 1s ease-in-out infinite;
}

.voice-btn.listening .mic-icon { color: #fff; }
.voice-btn.error   { background: #ef4444; border-color: #ef4444; }
.voice-btn.done    { background: #10b981; border-color: #10b981; }

@keyframes voicePulse {
    0%, 100% { transform: scale(1); box-shadow: none; }
    50%       { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(245,158,11,0.2); }
}

/* ─── Form Errors ────────────────────────────────────────────────────────────── */
.field-error, .form-errors {
    color: #f87171;
    font-size: 0.82rem;
    font-weight: 600;
}

/* ─── Diary Table ────────────────────────────────────────────────────────────── */
.table-shell {
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.02);
}

.diary-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.diary-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(129,140,248,0.08);
    color: var(--indigo);
    text-align: left;
    padding: 13px 11px;
    border-bottom: 1px solid var(--border-accent);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.diary-table tbody td {
    padding: 9px 9px;
    border-top: 1px solid var(--border);
    vertical-align: top;
    background: transparent;
    transition: background 150ms var(--ease);
}

.diary-table tbody tr:nth-child(even) td {
    background: rgba(255,255,255,0.015);
}

.diary-table tbody tr:hover td {
    background: rgba(129,140,248,0.04);
}

.diary-table tbody tr.break-row td {
    background: rgba(129,140,248,0.06);
}

.diary-table td:nth-child(1) { width: 60px; text-align: center; }
.diary-table td:nth-child(2) { width: 110px; }
.diary-table td:nth-child(3) { width: 130px; }
.diary-table td:nth-child(4) { width: 130px; }
.diary-table td:nth-child(5) { width: 200px; }
.diary-table td:nth-child(6) { width: 200px; }
.diary-table td:nth-child(7) { width: 180px; }
.diary-table td:nth-child(8) { width: 130px; }

.diary-table input,
.diary-table select,
.diary-table textarea {
    width: 100%;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text);
    padding: 8px 10px;
    resize: vertical;
    min-height: 44px;
    outline: none;
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

.diary-table input:hover,
.diary-table select:hover,
.diary-table textarea:hover {
    border-color: rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
}

.diary-table textarea { min-height: 52px; }

.diary-table input::placeholder,
.diary-table textarea::placeholder { color: var(--text-3); font-size: 0.82rem; }

.row-chip {
    background: var(--amber-soft);
    border-color: rgba(245,158,11,0.22);
    color: var(--amber);
}

.period-chip { min-width: 80px; }

/* ─── Action Row ─────────────────────────────────────────────────────────────── */
.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

/* ─── Custom Export Picker ───────────────────────────────────────────────────── */
.custom-export-picker {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    width: 100%;
}

.custom-export-picker.show { display: flex; }

.export-date-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-size: 0.82rem;
    outline: none;
    flex: 1;
}

.export-date-input:focus {
    border-color: var(--indigo-dim);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

.custom-export-picker span { color: var(--text-3); font-size: 0.82rem; }

/* ─── Sidebar ────────────────────────────────────────────────────────────────── */
.sidebar-card {
    display: grid;
    gap: 16px;
}

.lesson-card,
.calendar-card,
.history-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: var(--r-md);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
}

/* ─── Calendar ───────────────────────────────────────────────────────────────── */
.calendar-nav {
    display: inline-flex;
    gap: 6px;
}

.calendar-nav-link {
    min-height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.82rem;
    transition: all 200ms var(--ease);
}

.calendar-nav-link:hover {
    color: var(--indigo);
    background: var(--indigo-soft);
    border-color: var(--border-accent);
}

.calendar-weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-3);
}

.calendar-day {
    min-height: 56px;
    padding: 8px 6px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    display: grid;
    align-content: space-between;
    gap: 3px;
    transition: transform 200ms var(--ease-bounce), border-color 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease);
    cursor: pointer;
}

.calendar-day:hover {
    transform: translateY(-2px);
    border-color: var(--border-accent);
    box-shadow: 0 8px 20px rgba(129,140,248,0.12);
    background: var(--indigo-soft);
}

.calendar-day-number {
    font-weight: 800;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
}

.calendar-day-state {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calendar-day.muted { opacity: 0.3; }

.calendar-day.today {
    border-color: rgba(245,158,11,0.4);
    background: var(--amber-soft);
}

.calendar-day.today .calendar-day-number { color: var(--amber); }

.calendar-day.selected {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
    box-shadow: 0 6px 18px var(--indigo-glow);
}

.calendar-day.selected .calendar-day-number,
.calendar-day.selected .calendar-day-state { color: var(--indigo); }

.calendar-day.has-entry .calendar-day-state { color: var(--indigo); }

/* ─── Lesson Presets ─────────────────────────────────────────────────────────── */
.lesson-section-stack { display: grid; gap: 10px; }

.lesson-section {
    padding: 12px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.025);
    transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

.lesson-section:hover {
    border-color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
}

.lesson-section-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.lesson-section-header h4 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.lesson-section-header p {
    margin: 3px 0 0;
    color: var(--text-3);
    line-height: 1.4;
    font-size: 0.78rem;
}

.lesson-section-header span {
    flex: 0 0 auto;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--indigo-soft);
    color: var(--indigo);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid var(--border-accent);
}

.lesson-button-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.lesson-button {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: var(--r-xs);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.04);
    color: var(--text-2);
    font-weight: 600;
    font-size: 0.8rem;
    text-align: center;
    cursor: pointer;
    transition: transform 200ms var(--ease-bounce), border-color 200ms var(--ease), background 200ms var(--ease), color 200ms var(--ease), box-shadow 200ms var(--ease);
}

.lesson-button:hover {
    transform: translateY(-1px);
    border-color: var(--border-accent);
    background: var(--indigo-soft);
    color: var(--indigo);
    box-shadow: 0 4px 12px var(--indigo-glow);
}

.lesson-button.active {
    background: var(--indigo-soft);
    border-color: var(--border-accent);
    color: var(--indigo);
    box-shadow: 0 2px 8px var(--indigo-glow);
}

.lesson-preview {
    padding: 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-accent);
    background: linear-gradient(135deg, var(--indigo-soft), rgba(255,255,255,0.02));
    display: grid;
    gap: 10px;
}

.lesson-preview strong { font-size: 0.95rem; color: var(--indigo); }
.lesson-preview p { margin: 0; color: var(--text-2); line-height: 1.5; font-size: 0.82rem; }

.lesson-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.lesson-preview-grid div {
    padding: 9px 10px;
    border-radius: var(--r-xs);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    display: grid;
    gap: 3px;
}

.lesson-preview-grid span {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

.lesson-preview-grid strong { font-size: 0.82rem; line-height: 1.4; color: var(--text); }

.lesson-help { margin: 0; color: var(--text-3); line-height: 1.5; font-size: 0.82rem; }

.lesson-status {
    padding: 10px 14px;
    border-radius: var(--r-xs);
    background: var(--amber-soft);
    border: 1px solid rgba(245,158,11,0.22);
    color: var(--amber);
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1.5;
}

.preset-flash td { animation: presetFlash 1.2s var(--ease); }

@keyframes presetFlash {
    0%   { background: inherit; }
    20%  { background: var(--indigo-soft); }
    100% { background: inherit; }
}

/* ─── History List ───────────────────────────────────────────────────────────── */
.history-list { display: grid; gap: 8px; }

.history-item {
    display: grid;
    gap: 3px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    transition: transform 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease), background 200ms var(--ease);
}

.history-item strong { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.history-item span, .history-item small, .empty-state p, .guide-card p { color: var(--text-3); font-size: 0.8rem; }

.history-item.active {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
}

.history-item.active strong { color: var(--indigo); }

.history-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-accent);
    box-shadow: 0 8px 20px rgba(129,140,248,0.1);
    background: var(--indigo-soft);
}

.empty-state,
.guide-card {
    padding: 16px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border);
    text-align: center;
}

.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); }
.guide-card p { margin: 0; line-height: 1.6; }

/* ─── Auth Pages ─────────────────────────────────────────────────────────────── */
.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 480px);
    gap: 22px;
    align-items: start;
}

.auth-hero,
.auth-card {
    border: 1px solid var(--glass-border);
    border-radius: var(--r-xl);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: var(--shadow);
}

.auth-hero {
    padding: 36px;
    min-height: 100%;
    background:
        linear-gradient(135deg, rgba(129,140,248,0.07) 0%, rgba(99,102,241,0.05) 100%),
        var(--glass);
    position: relative;
    overflow: hidden;
}

.auth-hero::after {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, var(--indigo-soft), transparent 70%);
    pointer-events: none;
}

.auth-hero h2 {
    margin: 6px 0 0;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text) 30%, var(--indigo) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-card {
    padding: 28px;
    background: var(--glass);
}

.auth-note {
    margin: 0 0 18px;
    padding: 12px 16px;
    border-radius: var(--r-sm);
    background: var(--indigo-soft);
    border: 1px solid var(--border-accent);
    color: var(--indigo);
    line-height: 1.5;
    font-size: 0.9rem;
}

.auth-note code {
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    font-weight: 700;
    font-size: 0.9em;
}

.auth-form { display: grid; gap: 16px; }

.auth-field input { min-height: 50px; }

.auth-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.auth-links {
    margin: 16px 0 0;
    color: var(--text-3);
    font-size: 0.88rem;
}

.auth-links a {
    color: var(--indigo);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ─── Dashboard Specific ─────────────────────────────────────────────────────── */
.db-shell { max-width: 1100px; margin: 0 auto; }

.db-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}

.db-stat-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    backdrop-filter: blur(16px);
    transition: transform 200ms var(--ease-bounce), box-shadow 200ms var(--ease);
    position: relative;
    overflow: hidden;
}

.db-stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--indigo), #6366f1);
    border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.db-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-indigo);
}

.db-stat-card .stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--indigo);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.db-stat-card .stat-label {
    font-size: 0.78rem;
    color: var(--text-3);
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.db-section { margin-bottom: 24px; }

.db-section h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    color: var(--text-2);
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.83rem;
    background: var(--glass);
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
}

.db-table th {
    background: rgba(129,140,248,0.07);
    color: var(--indigo);
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-accent);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.db-table td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    transition: background 150ms var(--ease);
}

.db-table tr:last-child td { border-bottom: none; }
.db-table tr:hover td { background: var(--indigo-soft); color: var(--text); }
.db-table a { color: var(--indigo); text-decoration: none; font-weight: 600; }
.db-table a:hover { text-decoration: underline; }

/* Bar chart */
.db-chart-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 110px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.db-chart-bar .bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.db-chart-bar .bar-fill {
    width: 100%;
    max-width: 38px;
    background: linear-gradient(180deg, var(--indigo), var(--indigo-dim));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.4s var(--ease-bounce);
    box-shadow: 0 0 12px var(--indigo-glow);
}

.db-chart-bar .bar-label { font-size: 0.65rem; color: var(--text-3); font-weight: 600; }
.db-chart-bar .bar-count { font-size: 0.7rem; font-weight: 700; color: var(--indigo); }

/* User list */
.db-search {
    width: 100%;
    max-width: 400px;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    background: var(--glass);
    color: var(--text);
    outline: none;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
    backdrop-filter: blur(8px);
}

.db-search:focus {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

.db-search::placeholder { color: var(--text-3); }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.badge-active   { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-disabled { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.22); }
.badge-staff    { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }

/* ─── Game Manager ───────────────────────────────────────────────────────────── */
.game-manager { max-width: 960px; margin: 0 auto; }

.game-manager .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.selection-stats { font-size: 0.82rem; color: var(--text-3); }

.game-search {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.88rem;
    margin-bottom: 18px;
    background: var(--glass);
    color: var(--text);
    outline: none;
    transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
    backdrop-filter: blur(8px);
}

.game-search:focus {
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}

.game-search::placeholder { color: var(--text-3); }

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 7px;
    margin-bottom: 22px;
}

.game-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-radius: var(--r-sm);
    background: var(--glass);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 200ms var(--ease);
    user-select: none;
    backdrop-filter: blur(8px);
}

.game-item:hover {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--indigo-glow);
}

.game-item.selected {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
}

.game-item input[type="checkbox"] {
    accent-color: var(--indigo);
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.game-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }

.game-item .game-section-tag {
    font-size: 0.65rem;
    color: var(--text-3);
    margin-left: auto;
    background: rgba(255,255,255,0.06);
    padding: 1px 7px;
    border-radius: 6px;
    white-space: nowrap;
}

.quick-buttons {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.quick-buttons button {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--glass);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-2);
    transition: all 200ms var(--ease);
    backdrop-filter: blur(8px);
}

.quick-buttons button:hover {
    border-color: var(--border-accent);
    background: var(--indigo-soft);
    color: var(--indigo);
}

.empty-search {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2.5rem;
    color: var(--text-3);
    font-size: 0.9rem;
}

/* ─── User/Activity detail pages ─────────────────────────────────────────────── */
.db-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
/* Tablet landscape and down */
@media (max-width: 1180px) {
    .layout-grid    { grid-template-columns: 1fr; }
    .auth-shell     { grid-template-columns: 1fr; }
    .db-detail-grid { grid-template-columns: 1fr; }
}

/* Tablet portrait */
@media (max-width: 920px) {
    .site-header,
    .hero-card {
        flex-direction: column;
        align-items: stretch;
    }

    .site-header { padding: 12px 18px; gap: 10px; }
    .brand-dot { width: 30px; height: 30px; }
    .brand-dot::after { font-size: 15px; }
    .brand-kicker { font-size: 0.6rem; }

    .hero-stats {
        min-width: 0;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-actions { justify-content: flex-start; }

    .table-shell { overflow-x: auto; }

    .diary-table,
    .diary-table thead,
    .diary-table tbody,
    .diary-table th,
    .diary-table td,
    .diary-table tr { display: block; width: 100%; }

    .diary-table thead { display: none; }

    .diary-table tbody tr {
        margin-bottom: 14px;
        border-radius: var(--r-md);
        overflow: hidden;
        border: 1px solid var(--border);
        box-shadow: var(--shadow-sm);
    }

    .diary-table tbody td {
        border-top: 1px solid var(--border);
        display: grid;
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 8px;
        align-items: start;
        padding: 10px 12px;
    }

    .diary-table tbody td::before {
        content: attr(data-label);
        color: var(--indigo);
        font-weight: 700;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .diary-table tbody td:nth-child(1),
    .diary-table tbody td:nth-child(2) { text-align: left; }

    .lesson-preview-grid { grid-template-columns: 1fr; }

    .modal-box { width: 95%; max-height: 90vh; margin: 0 auto; }

    .db-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Mobile large */
@media (max-width: 640px) {
    .page-shell, .site-header { width: min(100% - 12px, 100%); }

    .site-header { top: 8px; margin: 8px auto 0; padding: 10px 14px; border-radius: var(--r-lg); gap: 8px; }
    .brand-mark { gap: 10px; }
    .brand-dot { width: 28px; height: 28px; border-radius: 8px; }
    .brand-dot::after { font-size: 13px; }
    .brand-kicker { font-size: 0.55rem; letter-spacing: 0.12em; }
    .site-header h1 { font-size: clamp(0.85rem, 4vw, 1rem); }

    .hero-card, .workspace-card, .sidebar-card {
        padding: 16px;
        border-radius: var(--r-lg);
    }
    .hero-card { padding: 20px 16px; }

    .hero-copy h2 { font-size: clamp(1.3rem, 6vw, 1.7rem); }
    .hero-text { font-size: 0.85rem; }
    .hero-stats { grid-template-columns: 1fr; gap: 8px; }
    .hero-stats > div { padding: 12px 14px; }
    .hero-stats strong { font-size: 1.3rem; }

    .action-row, .card-header {
        flex-direction: column;
        align-items: stretch;
    }
    .card-header { gap: 10px; margin-bottom: 14px; }
    .card-header h3 { font-size: 1.05rem; }

    .ghost-button, .primary-button, .secondary-button, .header-link { width: 100%; text-align: center; }

    .diary-table tbody td { grid-template-columns: 1fr; padding: 9px 10px; }
    .diary-table tbody td::before { margin-bottom: 4px; display: block; }
    .diary-table tbody tr { margin-bottom: 10px; }

    .auth-hero, .auth-card { padding: 18px; border-radius: var(--r-lg); }
    .auth-hero h2 { font-size: clamp(1.4rem, 6vw, 1.8rem); }
    .auth-hero { padding: 24px 18px; }
    .auth-card { padding: 20px 18px; }

    .auth-actions, .header-actions { flex-direction: column; align-items: stretch; }
    .auth-actions { gap: 8px; }
    .header-actions { gap: 6px; }
    .user-pill { justify-content: center; width: 100%; min-height: 34px; font-size: 0.8rem; }

    .logout-form, .header-link, .secondary-button, .primary-button { width: 100%; }
    .header-link { min-height: 34px; font-size: 0.8rem; }

    .db-nav { gap: 4px; }
    .db-nav a { font-size: 0.75rem; padding: 5px 11px; min-height: 32px; }

    .calendar-nav { width: 100%; }
    .calendar-nav-link { flex: 1; min-height: 32px; font-size: 0.75rem; padding: 0 10px; }

    .lesson-button-grid,
    .calendar-weekdays,
    .calendar-grid { gap: 3px; }

    .calendar-day { min-height: 44px; padding: 6px 4px; }
    .calendar-day-number { font-size: 0.78rem; }
    .calendar-day-state { font-size: 0.5rem; }

    .lesson-button-grid { grid-template-columns: 1fr; gap: 5px; }
    .lesson-preview-grid { grid-template-columns: 1fr; gap: 6px; }
    .lesson-section { padding: 10px; }

    .lesson-section-header { flex-direction: column; gap: 6px; }
    .lesson-section-header span { align-self: flex-start; }

    .lesson-button { min-height: 36px; font-size: 0.75rem; padding: 6px 8px; }

    .db-stats { grid-template-columns: 1fr 1fr; gap: 8px; }
    .db-stat-card { padding: 14px 16px; }
    .db-stat-card .stat-value { font-size: 1.5rem; }

    .game-grid { grid-template-columns: 1fr; }
    .game-item { min-height: 40px; padding: 8px 10px; }

    .header-grid { grid-template-columns: 1fr; gap: 10px; }
    .field input, .field select { min-height: 42px; }

    .deputation-section { padding: 14px; }
    .deputation-fields .field textarea { min-height: 60px; }

    .export-toolbar { flex-direction: column; align-items: stretch; }
    .export-btn { justify-content: center; min-height: 36px; }
    .export-toolbar .label { margin-right: 0; }
    .custom-export-row { flex-direction: column; align-items: stretch; }
    .custom-export-row .export-date-input { width: 100%; }

    .db-shell { padding: 0; }
    .db-table { font-size: 0.75rem; }
    .db-table th, .db-table td { padding: 7px 10px; }

    .db-chart-bar { height: 80px; padding: 8px 0; gap: 4px; }
    .db-chart-bar .bar-fill { max-width: 28px; }

    .db-search { max-width: 100%; font-size: 0.8rem; }
    .db-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
    .db-table td, .db-table th { white-space: normal; }

    .db-section { margin-bottom: 16px; }
    .db-section h3 { font-size: 0.8rem; }

    .db-user-header { flex-direction: column; }
    .db-user-meta { flex-direction: column; width: 100%; }
    .db-user-meta > div { width: 100%; }

    .modal-box { padding: 1rem; border-radius: var(--r-md); }
    .modal-box h3 { font-size: 0.95rem; }

    .ps-section-header { padding: 0.4rem 0.6rem; }
    .ps-section-header h4 { font-size: 0.8rem; }

    .sidebar-card { padding: 14px; }

    .lesson-card, .calendar-card, .history-card { padding: 12px; }

    .export-date-input { min-height: 34px; }

    .db-filter { flex-direction: column; align-items: stretch; }
    .db-filter select { width: 100%; }
    .db-filter .btn { justify-content: center; }

    .game-search { font-size: 0.82rem; padding: 8px 12px; }

    .quick-buttons { gap: 5px; }
    .quick-buttons button { font-size: 0.72rem; padding: 4px 10px; min-height: 32px; }

    .auth-benefits, .signup-steps { padding: 14px; margin-top: 1.25rem; }

    .db-user-header .db-actions { width: 100%; }
    .db-user-header .db-actions .btn { flex: 1; justify-content: center; }

    .custom-export-picker { flex-direction: column; align-items: stretch; }
    .custom-export-picker .export-date-input { width: 100%; }
}

/* Small phones */
@media (max-width: 420px) {
    .page-shell, .site-header { width: calc(100% - 8px); }
    .site-header { padding: 8px 10px; border-radius: var(--r-md); top: 4px; margin: 4px auto 0; }
    .brand-mark { gap: 8px; }
    .brand-dot { width: 24px; height: 24px; border-radius: 6px; }
    .brand-dot::after { font-size: 11px; }
    .site-header h1 { font-size: 0.8rem; }

    .header-actions { gap: 4px; }
    .user-pill { min-height: 30px; font-size: 0.75rem; padding: 0 10px; }
    .user-pill::before { width: 6px; height: 6px; }
    .header-link { min-height: 30px; font-size: 0.75rem; padding: 0 10px; }

    .hero-card { padding: 16px 12px; border-radius: var(--r-md); }
    .hero-copy h2 { font-size: clamp(1.1rem, 5vw, 1.3rem); }
    .hero-text { font-size: 0.8rem; }

    .db-stats { grid-template-columns: 1fr 1fr; gap: 6px; }
    .db-stat-card { padding: 10px 12px; border-radius: var(--r-md); }
    .db-stat-card .stat-value { font-size: 1.25rem; }
    .db-stat-card .stat-label { font-size: 0.65rem; }

    .workspace-card, .sidebar-card { padding: 12px; border-radius: var(--r-md); }

    .card-header h3 { font-size: 0.95rem; }

    .db-nav a { font-size: 0.7rem; padding: 4px 8px; min-height: 28px; }

    .calendar-day { min-height: 38px; padding: 4px 3px; }
    .calendar-day-number { font-size: 0.7rem; }
    .calendar-weekdays span { font-size: 0.55rem; }

    .auth-hero { padding: 18px 14px; }
    .auth-card { padding: 16px 14px; }
    .auth-hero h2 { font-size: clamp(1.2rem, 5vw, 1.4rem); }
    .auth-hero .hero-text { font-size: 0.8rem; }

    .db-table { font-size: 0.7rem; }
    .db-table th, .db-table td { padding: 5px 7px; }
    .db-search { padding: 6px 10px; font-size: 0.75rem; }

    .modal-box { padding: 0.75rem; }
    .modal-field { margin-bottom: 0.5rem; }
    .modal-field label { font-size: 0.7rem; }
    .modal-field input, .modal-field textarea { padding: 0.35rem 0.5rem; font-size: 0.78rem; }

    .game-item { min-height: 36px; padding: 6px 8px; }
    .game-label { font-size: 0.78rem; }

    .export-btn { font-size: 0.75rem; min-height: 32px; padding: 0.25rem 0.6rem; }
    .ps-card { padding: 0.5rem; }
    .ps-card .edit-btn { font-size: 0.6rem; padding: 0.15rem 0.4rem; top: 0.3rem; right: 0.3rem; }
    .ps-label { font-size: 0.8rem; }
    .ps-detail { font-size: 0.72rem; }

    .history-item { padding: 8px 10px; }
    .history-item strong { font-size: 0.8rem; }

    .field input, .field select { min-height: 38px; font-size: 0.8rem; padding: 8px 10px; }

    .deputation-section { padding: 10px; }
    .deputation-badge { font-size: 0.65rem; padding: 3px 10px; }

    .empty-state { padding: 16px 12px; }
    .guide-card { padding: 12px; }
}

/* ─── Print Styles ───────────────────────────────────────────────────────────── */
@media print {
    @page { size: A4 landscape; margin: 8mm 10mm; }

    body {
        background: #fff !important;
        color: #000 !important;
        font-size: 11px !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body::before,
    .page-backdrop,
    .site-header,
    .hero-card,
    .sidebar-card,
    .workspace-card .card-header,
    .message-stack,
    .action-row,
    .ghost-button,
    .header-link { display: none !important; }

    .page-shell {
        width: 100% !important; margin: 0 !important; padding: 0 !important;
    }

    .layout-grid {
        display: block !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .workspace-card {
        border: none !important;
        box-shadow: none !important;
        background: #fff !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        backdrop-filter: none !important;
    }

    .diary-form { display: block !important; width: 100% !important; }

    .header-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 12px !important;
        margin-bottom: 8px !important;
        border-bottom: 1.5px solid #000 !important;
        padding-bottom: 6px !important;
    }

    .field {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 6px !important;
    }

    .field > span { font-weight: bold !important; color: #000 !important; white-space: nowrap !important; font-size: 11px !important; }

    .field input {
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: auto !important;
        font-size: 11px !important;
        color: #000 !important;
        box-shadow: none !important;
        pointer-events: none !important;
    }

    .table-shell {
        border: 1px solid #000 !important;
        border-radius: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .diary-table { width: 100% !important; border-collapse: collapse !important; table-layout: fixed !important; border: 1px solid #000 !important; display: table !important; }

    .diary-table thead { display: table-header-group !important; }
    .diary-table tbody { display: table-row-group !important; }
    .diary-table tr { display: table-row !important; }
    .diary-table th, .diary-table td { display: table-cell !important; }

    .diary-table thead th {
        position: static !important;
        background: #efefef !important;
        color: #000 !important;
        border: 1px solid #000 !important;
        border-bottom: 2px solid #000 !important;
        font-weight: bold !important;
        padding: 4px 6px !important;
        font-size: 10px !important;
        backdrop-filter: none !important;
    }

    .diary-table tbody td {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
        padding: 3px 5px !important;
        vertical-align: top !important;
        font-size: 10px !important;
    }

    .diary-table tbody tr { page-break-inside: avoid !important; break-inside: avoid !important; }
    .diary-table tbody tr:nth-child(even) td { background: #fff !important; }
    .diary-table tbody tr.break-row td { background: #fafafa !important; }

    .diary-table th:nth-child(1) { width: 4%  !important; text-align: center !important; }
    .diary-table th:nth-child(2) { width: 8%  !important; }
    .diary-table th:nth-child(3) { width: 8%  !important; }
    .diary-table th:nth-child(4) { width: 12% !important; }
    .diary-table th:nth-child(5) { width: 18% !important; }
    .diary-table th:nth-child(6) { width: 18% !important; }
    .diary-table th:nth-child(7) { width: 22% !important; }
    .diary-table th:nth-child(8) { width: 10% !important; }

    .diary-table td { width: auto !important; }

    .diary-table input,
    .diary-table select,
    .diary-table textarea {
        border: none !important;
        background: transparent !important;
        color: #000 !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        min-height: auto !important;
        height: auto !important;
        resize: none !important;
        box-shadow: none !important;
        outline: none !important;
        appearance: none !important;
        -webkit-appearance: none !important;
        font-family: inherit !important;
        font-size: 10px !important;
        line-height: 1.25 !important;
        field-sizing: content;
        overflow: visible !important;
    }

    .diary-table input::placeholder,
    .diary-table textarea::placeholder { color: transparent !important; }

    .diary-table td::before { display: none !important; }

    .site-footer { display: none !important; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.site-footer {
    margin-top: 2rem;
    padding: 1.5rem 1.5rem 1.2rem;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--glass);
}
.footer-tagline {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--indigo);
    letter-spacing: 0.04em;
    margin: 0 0 6px;
}
.footer-disclaimer {
    font-size: 0.72rem;
    color: var(--text-3);
    line-height: 1.55;
    max-width: 720px;
    margin: 0 auto 8px;
}
.footer-copy {
    font-size: 0.68rem;
    color: var(--text-3);
    margin: 0;
    opacity: 0.7;
}

/* ─── Modern Enhancements ───────────────────────────────────────────────────── */
/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* Selection */
::selection { background: var(--indigo-soft); color: var(--indigo); }
::-moz-selection { background: var(--indigo-soft); color: var(--indigo); }

/* Focus visible */
:focus-visible { outline: 2px solid var(--indigo-dim); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, a:focus-visible { outline-offset: 3px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* Page fade-in */
.page-shell { animation: pageEnter 0.4s var(--ease); }

@keyframes pageEnter {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Auth shell consistent spacing */
.auth-shell { align-items: start; }

/* Dialog/Modal animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Skeleton loader utility */
.skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--r-xs);
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Progress bar */
.progress-bar {
    height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); overflow: hidden;
}
.progress-bar-fill {
    height: 100%; border-radius: 2px;
    background: linear-gradient(90deg, var(--indigo), #6366f1);
    transition: width 0.4s var(--ease-bounce);
}

/* Empty state refinements */
.empty-state { padding: 24px 16px; }
.empty-state strong { display: block; margin-bottom: 6px; color: var(--text); font-size: 0.95rem; }
.empty-state p { color: var(--text-3); font-size: 0.82rem; line-height: 1.6; }

/* Guide/info cards */
.guide-card { padding: 16px; border-radius: var(--r-sm); background: rgba(255,255,255,0.025); border: 1px solid var(--border); }
.guide-card p { margin: 0; line-height: 1.6; color: var(--text-3); font-size: 0.82rem; }

/* Tab-like button groups */
.tab-group { display: flex; gap: 4px; flex-wrap: wrap; }
.tab-btn {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px;
    background: var(--glass); color: var(--text-2); font-weight: 600; font-size: 0.78rem;
    cursor: pointer; transition: all 200ms var(--ease);
}
.tab-btn:hover { border-color: var(--border-accent); background: var(--indigo-soft); color: var(--indigo); }
.tab-btn.active { background: var(--indigo-soft); color: var(--indigo); border-color: var(--border-accent); }

/* Badge variants */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; }
.badge-active   { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.25); }
.badge-disabled { background: rgba(239,68,68,0.12);  color: #f87171; border: 1px solid rgba(239,68,68,0.22); }
.badge-staff    { background: rgba(99,102,241,0.15); color: #818cf8; border: 1px solid rgba(99,102,241,0.25); }

/* Scrollable table wrapper */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll::-webkit-scrollbar { height: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

/* Disabled button state */
.primary-button:disabled, .secondary-button:disabled, .ghost-button:disabled {
    opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important;
}

/* Card header extra polish */
.card-header .card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Modern light interface refresh */
:root {
    --bg: #f4f7fb;
    --bg-2: #e9eef6;
    --surface: #ffffff;
    --surface-hov: #f8fafc;
    --glass: #ffffff;
    --glass-border: #d9e2ec;
    --glass-strong: #ffffff;

    --violet: #7c3aed;
    --violet-dim: #6d28d9;
    --violet-soft: rgba(124,58,237,0.08);
    --violet-glow: rgba(124,58,237,0.18);

    --indigo: #2563eb;
    --indigo-dim: #1d4ed8;
    --indigo-soft: rgba(37,99,235,0.08);
    --indigo-glow: rgba(37,99,235,0.16);

    --emerald: #059669;
    --emerald-soft: rgba(5,150,105,0.10);
    --amber: #d97706;
    --amber-soft: rgba(217,119,6,0.10);

    --text: #172033;
    --text-2: #435166;
    --text-3: #758195;
    --border: #dce4ee;
    --border-accent: rgba(37,99,235,0.28);

    --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
    --shadow: 0 10px 28px rgba(15,23,42,0.08);
    --shadow-lg: 0 20px 50px rgba(15,23,42,0.12);
    --shadow-indigo: 0 14px 32px rgba(37,99,235,0.12);
    --shadow-violet: 0 14px 32px rgba(124,58,237,0.12);

    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 10px;
    --r-lg: 12px;
    --r-xl: 14px;
}

body {
    background:
        linear-gradient(180deg, #f8fbff 0%, #eef3f9 44%, #f7f9fc 100%);
    color: var(--text);
}

body.theme-emerald {
    --bg: #f2f8f4;
    --bg-2: #e4f1e8;
    --indigo: #047857;
    --indigo-dim: #065f46;
    --indigo-soft: rgba(4,120,87,0.10);
    --indigo-glow: rgba(4,120,87,0.18);
    --emerald: #65a30d;
    --emerald-soft: rgba(101,163,13,0.12);
    --border-accent: rgba(4,120,87,0.28);
    background: linear-gradient(180deg, #f7fcf8 0%, #eaf5ee 46%, #f7fbf8 100%);
}

body.theme-sunset {
    --bg: #fff7ed;
    --bg-2: #ffedd5;
    --indigo: #c2410c;
    --indigo-dim: #9a3412;
    --indigo-soft: rgba(194,65,12,0.09);
    --indigo-glow: rgba(194,65,12,0.18);
    --emerald: #b45309;
    --emerald-soft: rgba(180,83,9,0.12);
    --amber: #b45309;
    --border-accent: rgba(194,65,12,0.28);
    background: linear-gradient(180deg, #fffaf4 0%, #ffedd5 44%, #fff8ef 100%);
}

body.theme-berry {
    --bg: #fff1f7;
    --bg-2: #fce7f3;
    --indigo: #be185d;
    --indigo-dim: #9d174d;
    --indigo-soft: rgba(190,24,93,0.09);
    --indigo-glow: rgba(190,24,93,0.18);
    --violet: #7c3aed;
    --emerald: #7c3aed;
    --emerald-soft: rgba(124,58,237,0.11);
    --border-accent: rgba(190,24,93,0.28);
    background: linear-gradient(180deg, #fff8fb 0%, #fce7f3 46%, #faf7ff 100%);
}

body.theme-slate {
    --bg: #f8fafc;
    --bg-2: #e2e8f0;
    --indigo: #334155;
    --indigo-dim: #1e293b;
    --indigo-soft: rgba(51,65,85,0.09);
    --indigo-glow: rgba(51,65,85,0.16);
    --emerald: #0891b2;
    --emerald-soft: rgba(8,145,178,0.11);
    --text: #0f172a;
    --text-2: #334155;
    --text-3: #64748b;
    --border-accent: rgba(8,145,178,0.28);
    background: linear-gradient(180deg, #ffffff 0%, #edf2f7 50%, #f8fafc 100%);
}

body.theme-rose {
    --bg: #fff5f7;
    --bg-2: #ffe4e6;
    --indigo: #e11d48;
    --indigo-dim: #be123c;
    --indigo-soft: rgba(225,29,72,0.09);
    --indigo-glow: rgba(225,29,72,0.18);
    --emerald: #db2777;
    --emerald-soft: rgba(219,39,119,0.11);
    --border-accent: rgba(225,29,72,0.28);
    background: linear-gradient(180deg, #fffafb 0%, #ffe4e6 46%, #fff7f8 100%);
}

body.theme-contrast {
    --bg: #ffffff;
    --bg-2: #f3f4f6;
    --surface: #ffffff;
    --glass: #ffffff;
    --glass-border: #111827;
    --indigo: #111827;
    --indigo-dim: #000000;
    --indigo-soft: rgba(17,24,39,0.08);
    --indigo-glow: rgba(17,24,39,0.16);
    --emerald: #ca8a04;
    --emerald-soft: rgba(250,204,21,0.22);
    --text: #000000;
    --text-2: #111827;
    --text-3: #374151;
    --border: #111827;
    --border-accent: rgba(17,24,39,0.50);
    background: #ffffff;
}

body::before,
.page-backdrop {
    display: none;
}

a {
    color: var(--indigo);
}

.site-header {
    top: 0;
    width: 100%;
    margin: 0;
    padding: 14px clamp(16px, 4vw, 44px);
    border-width: 0 0 1px;
    border-radius: 0;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 1px 0 rgba(15,23,42,0.04);
}

.brand-mark {
    gap: 12px;
}

.brand-dot {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #059669);
    box-shadow: 0 8px 18px rgba(37,99,235,0.22);
}

.brand-dot::after {
    content: 'PE';
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    color: #fff;
}

.brand-kicker,
.section-label {
    color: var(--text-3);
    letter-spacing: 0.08em;
}

.site-header h1 {
    color: var(--text);
    letter-spacing: 0;
}

.header-actions {
    gap: 10px;
}

.header-link,
.ghost-button,
.primary-button,
.secondary-button,
.qa-btn,
.db-nav a,
.quick-buttons button,
.calendar-nav-link,
.export-btn,
.btn {
    border-radius: 8px;
    min-height: 38px;
    box-shadow: none;
}

.header-link,
.ghost-button,
.secondary-button,
.qa-btn,
.db-nav a,
.quick-buttons button,
.calendar-nav-link {
    color: var(--text-2);
    background: #fff;
    border-color: var(--border);
}

.header-link:hover,
.ghost-button:hover,
.secondary-button:hover,
.qa-btn:hover,
.db-nav a:hover,
.quick-buttons button:hover,
.calendar-nav-link:hover {
    color: var(--indigo);
    background: #f7fbff;
    border-color: var(--border-accent);
    transform: translateY(-1px);
}

.primary-button,
.qa-btn.primary,
.db-nav a.active {
    background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(37,99,235,0.18);
}

.primary-button:hover,
.qa-btn.primary:hover {
    box-shadow: 0 14px 28px rgba(37,99,235,0.22);
}

.user-pill {
    border-radius: 8px;
    background: #eef6ff;
    color: #1d4ed8;
    border-color: #c7dbff;
}

.user-pill::before {
    background: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

.page-shell {
    width: min(1320px, calc(100% - 40px));
    margin: 24px auto 48px;
}

.hero-card,
.workspace-card,
.sidebar-card,
.auth-card,
.auth-hero,
.lesson-card,
.calendar-card,
.history-card,
.db-stat-card,
.db-chart-wrap,
.guide-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.hero-card::before,
.workspace-card::before,
.auth-card::before,
.auth-hero::before {
    display: none;
}

.hero-card {
    align-items: center;
    background:
        linear-gradient(135deg, rgba(37,99,235,0.08), rgba(5,150,105,0.08)),
        #fff;
}

.hero-copy h2,
.auth-hero h2 {
    color: var(--text);
    background: none;
    -webkit-text-fill-color: currentColor;
    letter-spacing: 0;
}

.hero-text,
.card-subtitle,
.lesson-help,
.auth-links,
.auth-note {
    color: var(--text-2);
}

.hero-badges span,
.period-chip,
.row-chip,
.deputation-badge,
.badge {
    border-radius: 8px;
    background: #eef6ff;
    color: #1d4ed8;
    border-color: #c7dbff;
}

.hero-stats > div,
.lesson-preview-grid > div,
.lesson-section,
.deputation-section,
.auth-benefits,
.signup-steps {
    background: #f8fafc !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--r-lg);
}

.hero-stats strong,
.db-stat-card .stat-value,
.db-chart-bar .bar-count,
.db-table a {
    color: var(--indigo);
}

.layout-grid {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
}

.field input,
.field select,
.field textarea,
.diary-table input,
.diary-table select,
.diary-table textarea,
.db-search,
.game-search,
.export-date-input,
.modal-field input,
.modal-field textarea {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(15,23,42,0.02);
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.diary-table input:hover,
.diary-table select:hover,
.diary-table textarea:hover {
    background: #fff;
    border-color: #bdc9d8;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.diary-table input:focus,
.diary-table select:focus,
.diary-table textarea:focus,
.db-search:focus,
.game-search:focus,
.export-date-input:focus {
    background: #fff;
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.field > span,
.db-section-header h3,
.db-stat-card .stat-label,
.calendar-weekdays span,
.lesson-section-header p,
.lesson-preview-grid span {
    color: var(--text-3);
}

.table-shell,
.db-table {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.diary-table th,
.db-table th {
    background: #f1f6fd;
    color: #315173;
    border-bottom: 1px solid var(--border);
}

.diary-table td,
.db-table td {
    color: var(--text-2);
    border-bottom-color: #edf1f6;
}

.diary-table tr:hover td,
.db-table tr:hover td {
    background: #f8fbff;
    color: var(--text);
}

.break-row td {
    background: #f8fafc !important;
}

.sidebar-card {
    display: grid;
    gap: 16px;
}

.lesson-card,
.calendar-card,
.history-card {
    box-shadow: none;
    padding: 18px;
}

.lesson-button,
.game-item,
.history-item,
.calendar-day {
    border-radius: 8px;
    border-color: var(--border);
    background: #fff;
    color: var(--text-2);
}

.lesson-button:hover,
.game-item:hover,
.history-item:hover,
.calendar-day:hover {
    background: #f7fbff;
    border-color: var(--border-accent);
    color: var(--indigo);
}

.lesson-button.active,
.game-item.selected,
.history-item.active,
.calendar-day.selected {
    background: #eef6ff;
    color: #1d4ed8;
    border-color: #bcd4ff;
    box-shadow: none;
}

.calendar-day.today {
    border-color: #0f766e;
}

.calendar-day.has-entry .calendar-day-state {
    color: #047857;
}

.message-success,
.badge-active,
.chip-user_enabled {
    background: var(--emerald-soft);
    color: #047857;
    border-color: rgba(5,150,105,0.22);
}

.message-error,
.badge-disabled,
.chip-user_disabled {
    background: rgba(220,38,38,0.08);
    color: #b91c1c;
    border-color: rgba(220,38,38,0.18);
}

.admin-badge,
.badge-staff {
    background: #eef6ff;
    color: #1d4ed8;
    border: 1px solid #c7dbff;
}

.db-stat-card::before {
    background: linear-gradient(90deg, #2563eb, #059669);
}

.db-chart-bar .bar-fill,
.db-chart-bar .bar-fill.today {
    background: linear-gradient(180deg, #2563eb, #0f766e);
    box-shadow: none;
}

.auth-shell {
    align-items: stretch;
}

.auth-card,
.auth-hero {
    padding: clamp(22px, 4vw, 34px);
}

.auth-benefits-list li,
.signup-steps-list li {
    color: var(--text-2) !important;
}

.auth-check {
    background: #e9f7ef !important;
    color: #047857 !important;
    border-color: rgba(5,150,105,0.20) !important;
}

.custom-export-picker {
    background: #f8fafc !important;
    border: 1px solid var(--border);
    border-radius: var(--r-lg) !important;
}

.timetable-workspace {
    padding: 22px;
}

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

.timetable-shell {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.timetable-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    table-layout: fixed;
}

.timetable-table th,
.timetable-table td {
    border-bottom: 1px solid #edf1f6;
    border-right: 1px solid #edf1f6;
    padding: 10px;
    text-align: left;
    vertical-align: middle;
}

.timetable-table th:last-child,
.timetable-table td:last-child {
    border-right: 0;
}

.timetable-table thead th,
.timetable-table tbody th {
    background: #f1f6fd;
    color: #315173;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.timetable-table tbody th {
    width: 110px;
}

.timetable-table input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    outline: none;
}

.timetable-table input:focus {
    border-color: var(--indigo);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

@media (max-width: 720px) {
    .timetable-table {
        min-width: 0;
    }

    .timetable-table thead {
        display: none;
    }

    .timetable-table,
    .timetable-table tbody,
    .timetable-table tr,
    .timetable-table th,
    .timetable-table td {
        display: block;
        width: 100%;
    }

    .timetable-table tr {
        border-bottom: 1px solid var(--border);
        padding: 10px;
    }

    .timetable-table tbody th {
        border: 0;
        padding: 0 0 8px;
        background: transparent;
    }

    .timetable-table td {
        border: 0;
        padding: 7px 0;
    }

    .timetable-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 5px;
        color: var(--text-3);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }
}

::-webkit-scrollbar-thumb {
    background: #c8d2df;
}

::selection {
    background: #dbeafe;
    color: #1e3a8a;
}

@media (max-width: 980px) {
    .site-header {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 16px, 100%);
        margin-top: 16px;
    }

    .site-header {
        padding: 12px 14px;
    }

    .brand-dot {
        width: 34px;
        height: 34px;
    }

    .brand-dot::after {
        font-size: 0.68rem;
    }

    .hero-card,
    .workspace-card,
    .sidebar-card,
    .auth-card,
    .auth-hero {
        border-radius: 12px;
    }
}
