:root {
    --bg: #fff7df;
    --bg-soft: #fff1b8;
    --card: #ffffff;
    --text: #3b2404;
    --muted: #8a6a1f;

    --primary: #ffc400;
    --primary-dark: #f59e0b;
    --primary-soft: #fff3bf;

    --accent: #ef233c;
    --accent-dark: #c1121f;

    --border: #f5d76e;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;

    --sidebar: #7a1f05;
    --sidebar-2: #a83208;

    --shadow: 0 18px 40px rgba(122, 31, 5, 0.11);
    --radius: 20px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 196, 0, 0.28), transparent 34%),
        radial-gradient(circle at top right, rgba(239, 35, 60, 0.08), transparent 28%),
        var(--bg);
    color: var(--text);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #4a2700;
    padding: 11px 16px;
    cursor: pointer;
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(245, 158, 11, 0.18);
}

button:hover {
    background: linear-gradient(135deg, #ffd84d, #f59e0b);
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 11px 16px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #4a2700;
    font-weight: 900;
}

.button-link:hover {
    background: linear-gradient(135deg, #ffd84d, #f59e0b);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px 1fr;
}

.sidebar {
    background:
        radial-gradient(circle at top, rgba(255, 196, 0, 0.28), transparent 34%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: #ffffff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo,
.login-logo {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 24px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.brand-logo-image img,
.login-logo-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
}

.brand-title {
    font-weight: 950;
    font-size: 20px;
    color: #ffeb3b;
    text-shadow:
        0 2px 0 rgba(239, 35, 60, 0.9),
        0 3px 10px rgba(0, 0, 0, 0.2);
}

.brand-subtitle {
    color: #fff6bf;
    font-size: 13px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav a {
    padding: 12px 14px;
    border-radius: 14px;
    color: #fff4c2;
    font-weight: 800;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 196, 0, 0.2);
    color: #ffffff;
    box-shadow: inset 4px 0 0 #ffde3b;
}

.logout-button {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    box-shadow: none;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.22);
}

.main {
    padding: 28px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
}

.topbar h1 {
    margin: 0;
    font-size: 34px;
    color: #7a1f05;
}

.topbar p {
    margin: 8px 0 0;
    color: var(--muted);
}

.badge {
    display: inline-flex;
    padding: 8px 12px;
    background: #fff0a6;
    color: #9a3412;
    border: 1px solid #facc15;
    border-radius: 999px;
    font-weight: 900;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.grid {
    display: grid;
    gap: 20px;
}

.cards-grid {
    grid-template-columns: 2fr repeat(4, 1fr);
}

.two-columns {
    grid-template-columns: 1fr 1fr;
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.hero-card {
    background:
        radial-gradient(circle at right, rgba(239, 35, 60, 0.18), transparent 34%),
        linear-gradient(135deg, #ffcb05, #ffea61);
    color: #5a2600;
    border-color: #ffc400;
}

.hero-card p {
    color: rgba(90, 38, 0, 0.78);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    font-weight: 950;
    color: #b91c1c;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stat-label {
    color: var(--muted);
    font-size: 14px;
}

.stat-card strong {
    font-size: 28px;
    margin-top: 8px;
    color: #7a1f05;
}

.section-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.section-header h2 {
    margin: 0;
    color: #7a1f05;
}

.section-header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.quick-actions a {
    padding: 14px;
    border-radius: 14px;
    background: #fff8dc;
    border: 1px solid #fde68a;
    font-weight: 900;
    color: #7a1f05;
}

.quick-actions a:hover {
    background: #fff0a6;
    color: #b91c1c;
}

.feature-list {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    line-height: 1.9;
}

.table-wrap {
    overflow-x: auto;
    border-radius: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    color: #9a3412;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fff8dc;
}

.item-list,
.cards-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.item,
.club-card {
    border: 1px solid var(--border);
    background: #fffdf3;
    border-radius: 16px;
    padding: 16px;
}

.item h3,
.club-card h3 {
    margin: 0 0 8px;
    color: #7a1f05;
}

.meta {
    color: var(--muted);
    font-size: 14px;
}

.login-body {
    background:
        radial-gradient(circle at 15% 15%, rgba(255, 196, 0, 0.42), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(239, 35, 60, 0.12), transparent 28%),
        linear-gradient(135deg, #7a1f05, #f59e0b);
}

.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 440px 1fr;
    align-items: center;
    gap: 60px;
    padding: 48px;
    color: #ffffff;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    color: var(--text);
    border-radius: 30px;
    padding: 36px;
    box-shadow: 0 24px 80px rgba(122, 31, 5, 0.35);
    border: 2px solid rgba(255, 196, 0, 0.45);
}

.login-logo {
    width: 84px;
    height: 84px;
    border-radius: 24px;
    margin-bottom: 18px;
}

.login-card h1 {
    margin-bottom: 8px;
    color: #7a1f05;
    font-size: 34px;
}

.login-subtitle {
    color: var(--muted);
    line-height: 1.5;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 900;
}

.form input {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 16px;
    background: #fffef7;
}

.form input:focus,
.form textarea:focus,
.form select:focus,
.compact-input:focus {
    outline: 3px solid rgba(255, 196, 0, 0.35);
    border-color: #f59e0b;
}

.form button {
    margin-top: 8px;
    padding: 15px;
    font-size: 16px;
}

.error-message {
    color: var(--danger);
    margin-top: 14px;
    font-weight: 900;
}

.login-hint {
    margin-top: 18px;
    color: var(--muted);
    font-size: 14px;
}

.login-side h2 {
    font-size: 42px;
    max-width: 680px;
    color: #fff7b0;
    text-shadow:
        0 3px 0 rgba(185, 28, 28, 0.9),
        0 8px 28px rgba(0, 0, 0, 0.24);
}

.login-side li {
    margin: 12px 0;
    font-size: 20px;
    color: #fff8dc;
    font-weight: 800;
}

.login-side-badge {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    color: #fff7b0;
    font-weight: 900;
    border: 1px solid rgba(255, 255, 255, 0.28);
}

.admin-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.admin-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--muted);
    font-weight: 900;
    box-shadow: 0 8px 18px rgba(122, 31, 5, 0.04);
}

.admin-tabs a:hover,
.admin-tabs a.active {
    background: #fff0a6;
    color: #b91c1c;
    border-color: #facc15;
}

.admin-layout {
    align-items: start;
}

.admin-layout > .card:last-child {
    position: sticky;
    top: 18px;
    align-self: start;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
}

@media (max-width: 1100px) {
    .admin-layout > .card:last-child {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

.admin-form select,
.admin-form textarea {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    background: #fffef7;
}

.admin-form textarea {
    resize: vertical;
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 10px !important;
}

.checkbox-label input {
    width: auto;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.secondary-button {
    background: #fff0a6;
    color: #7a1f05;
    box-shadow: none;
}

.secondary-button:hover {
    background: #fde68a;
}

.small-button {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
}

.danger-button {
    background: linear-gradient(135deg, #ef233c, #b91c1c);
    color: #ffffff;
}

.danger-button:hover {
    background: linear-gradient(135deg, #f43f5e, #991b1b);
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-message {
    margin-top: 14px;
    font-weight: 900;
}

.form-message.success {
    color: var(--success);
}

.form-message.error {
    color: var(--danger);
}

.status-ok {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-weight: 900;
    font-size: 13px;
}

.status-bad {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 900;
    font-size: 13px;
}

.mini-badge {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff0a6;
    color: #7a1f05;
    font-weight: 900;
    font-size: 13px;
}

.inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.inline-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 8px;
    border-radius: 999px;
    background: #fff0a6;
    color: #7a1f05;
    font-weight: 900;
    font-size: 13px;
}

.chip-remove-button {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    background: #fde68a;
    color: #7a1f05;
    font-size: 14px;
    line-height: 1;
    font-weight: 900;
}

.chip-remove-button:hover {
    background: #dc2626;
    color: #ffffff;
}

.soft-divider {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.admin-form h3,
.card h3 {
    margin-top: 0;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 14px;
}

.filters-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 900;
}

.filters-grid select,
.filters-grid input,
.compact-input {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    background: #fffef7;
}

.compact-input {
    width: 100%;
}

.period-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.gradebook-wrap {
    max-height: 70vh;
    overflow: auto;
}

.gradebook-table {
    min-width: 1200px;
}

.gradebook-table th,
.gradebook-table td {
    white-space: nowrap;
    vertical-align: top;
}

.sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
    min-width: 220px;
}

.gradebook-table thead .sticky-col {
    z-index: 3;
}

.gradebook-cell {
    min-width: 92px;
    max-width: 120px;
}

.gradebook-cell-content {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.grade-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 8px;
    background: #fff0a6;
    color: #9a3412;
    font-weight: 900;
    font-size: 13px;
}

.attendance-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    border-radius: 8px;
    font-weight: 900;
    font-size: 12px;
}

.attendance-present {
    background: #dcfce7;
    color: #166534;
}

.attendance-absent {
    background: #fee2e2;
    color: #991b1b;
}

.attendance-late {
    background: #fef3c7;
    color: #92400e;
}

.attendance-sick {
    background: #ede9fe;
    color: #5b21b6;
}

.attendance-excused {
    background: #e0f2fe;
    color: #075985;
}

.cell-add-button {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
    background: #e2e8f0;
    color: #0f172a;
}

.cell-add-button:hover {
    background: #cbd5e1;
}

.final-grade-box {
    display: flex;
    gap: 6px;
    align-items: center;
}

.final-grade-input {
    width: 70px;
}

.grade-chip-with-delete {
    gap: 4px;
    padding: 0 4px 0 8px;
}

.grade-chip-delete {
    width: 18px;
    height: 18px;
    padding: 0;
    border-radius: 50%;
    background: rgba(30, 64, 175, 0.14);
    color: #1e40af;
    font-size: 13px;
    line-height: 1;
    font-weight: 900;
}

.grade-chip-delete:hover {
    background: #dc2626;
    color: #ffffff;
}

.diary-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.diary-summary-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border);
    background: #fffdf3;
    border-radius: 16px;
    padding: 16px;
}

.diary-summary-card h3 {
    margin: 0;
    color: #7a1f05;
}

.diary-summary-card p {
    margin: 6px 0 0;
}

.diary-average-box {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.diary-average-box strong {
    font-size: 30px;
    color: #c1121f;
}

.diary-average-box span {
    color: var(--muted);
    font-weight: 800;
}

.homework-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
}

.homework-stat-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    background: #fffdf3;
    box-shadow: none;
}

.homework-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(240px, 1fr));
    gap: 18px;
}

.homework-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.homework-column > h3 {
    margin: 0;
    font-size: 18px;
    color: #7a1f05;
}

.homework-card {
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
}

.homework-card-today {
    border-color: #facc15;
    background: #fffef0;
}

.homework-card-tomorrow {
    border-color: #fde68a;
    background: #fffbeb;
}

.homework-card-overdue {
    border-color: #fecaca;
    background: #fef2f2;
}

.homework-card-upcoming {
    border-color: #dbeafe;
}

.homework-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.homework-card-header h3 {
    margin: 0 0 6px;
    color: #7a1f05;
}

.homework-status {
    display: inline-flex;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
}

.homework-status-today {
    background: #dcfce7;
    color: #166534;
}

.homework-status-tomorrow {
    background: #fef3c7;
    color: #92400e;
}

.homework-status-overdue {
    background: #fee2e2;
    color: #991b1b;
}

.homework-status-upcoming {
    background: #dcfce7;
    color: #166534;
}

.events-overview-grid {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
}

.event-stat-card {
    box-shadow: none;
    background: #fffdf3;
}

.events-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.event-card {
    display: grid;
    grid-template-columns: 86px 1fr;
    gap: 16px;
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: 18px;
    padding: 16px;
}

.event-card-conflict {
    border-color: #fca5a5;
    background: #fff7f7;
}

.event-card-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff0a6;
    color: #9a3412;
    border-radius: 16px;
    min-height: 86px;
}

.event-card-conflict .event-card-date {
    background: #fee2e2;
    color: #991b1b;
}

.event-card-date strong {
    font-size: 32px;
    line-height: 1;
}

.event-card-date span {
    margin-top: 6px;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 12px;
}

.event-card-body {
    min-width: 0;
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.event-card-header h3 {
    margin: 0 0 6px;
    color: #7a1f05;
}

.event-card-body p {
    color: #334155;
    line-height: 1.5;
}

.event-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.event-type-badge,
.event-status-chip {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 900;
    font-size: 12px;
}

.event-type-school {
    background: #dbeafe;
    color: #1d4ed8;
}

.event-type-class {
    background: #dcfce7;
    color: #166534;
}

.event-type-meeting {
    background: #fef3c7;
    color: #92400e;
}

.event-type-trip {
    background: #ede9fe;
    color: #5b21b6;
}

.event-type-contest {
    background: #fee2e2;
    color: #991b1b;
}

.event-type-sport {
    background: #ccfbf1;
    color: #0f766e;
}

.event-type-holiday {
    background: #fce7f3;
    color: #be185d;
}

.event-status-confirmed {
    background: #dcfce7;
    color: #166534;
}

.event-status-declined {
    background: #fee2e2;
    color: #991b1b;
}

.event-status-maybe {
    background: #fef3c7;
    color: #92400e;
}

.event-status-invited {
    background: #e2e8f0;
    color: #334155;
}

.event-conflict-box {
    margin: 12px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fee2e2;
    color: #991b1b;
    font-weight: 800;
    font-size: 14px;
}

.event-conflict-box ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.event-conflict-box li {
    margin: 8px 0;
    line-height: 1.45;
}

.event-conflict-box span {
    color: #7f1d1d;
    font-weight: 700;
}

.event-conflict-mini {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.event-table-conflict-row {
    background: #fff7f7;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(74, 39, 0, 0.58);
}

.modal-card {
    width: min(980px, 100%);
    max-height: 86vh;
    overflow: auto;
    background: var(--card);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(74, 39, 0, 0.32);
    padding: 24px;
    border: 1px solid var(--border);
}

.event-participant-item,
.event-participant-add-box {
    display: grid;
    grid-template-columns: 1fr minmax(260px, 420px);
    gap: 16px;
    align-items: start;
    border: 1px solid var(--border);
    background: #fffdf3;
    border-radius: 16px;
    padding: 16px;
}

.event-participant-add-box {
    border: 1px dashed #facc15;
    background: #fffef0;
}

.event-participant-item h3,
.event-participant-add-box h3 {
    margin: 0 0 6px;
    color: #7a1f05;
}

.event-participant-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.events-timeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 18px;
    color: var(--muted);
    font-weight: 800;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 10px 0;
    background: var(--card);
}

.legend-dot {
    display: inline-flex;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-right: 6px;
}

.legend-normal {
    background: #2563eb;
}

.legend-conflict {
    background: #dc2626;
}

.events-visual-timeline {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Timeline v2 — удобный календарный вид */
.timeline-day-v2 {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.timeline-day-label {
    position: sticky;
    left: 0;
    z-index: 7;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 16px;
    background: #fffdf3;
    border-right: 1px solid var(--border);
}

.timeline-day-label strong {
    font-size: 16px;
    color: #7a1f05;
}

.timeline-day-label span,
.timeline-day-label em {
    color: var(--muted);
    font-size: 13px;
    font-style: normal;
    font-weight: 800;
}

.timeline-day-label em {
    color: #991b1b;
}

.timeline-scroll {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    background:
        linear-gradient(to right, #ffffff 30%, rgba(255, 255, 255, 0)),
        linear-gradient(to left, #ffffff 30%, rgba(255, 255, 255, 0)) 100% 0,
        linear-gradient(to right, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0)),
        linear-gradient(to left, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0)) 100% 0;
    background-repeat: no-repeat;
    background-size: 36px 100%, 36px 100%, 14px 100%, 14px 100%;
    background-attachment: local, local, scroll, scroll;
}

.timeline-canvas {
    position: relative;
    min-height: 140px;
    padding: 0 18px 18px;
}

.timeline-hours-v2 {
    position: sticky;
    top: 0;
    z-index: 6;
    height: 42px;
    display: block;
    padding: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 253, 243, 0.96);
    backdrop-filter: blur(8px);
}

.timeline-hour-mark {
    position: absolute;
    top: 13px;
    transform: translateX(-50%);
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.timeline-grid-lines {
    position: absolute;
    inset: 42px 18px 18px;
    pointer-events: none;
    z-index: 1;
}

.timeline-grid-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: #e5e7eb;
}

.timeline-lanes {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
}

.timeline-lane {
    position: relative;
    height: 118px;
    border-radius: 14px;
    background:
        linear-gradient(to right, rgba(226, 232, 240, 0.72) 1px, transparent 1px),
        #ffffff;
    background-size: 140px 100%;
    border: 1px solid #eef2f7;
}

.timeline-event {
    position: absolute;
    top: 10px;
    bottom: 10px;
    min-width: 150px;
    border-radius: 14px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f59e0b, #ffc400);
    color: #4a2700;
    box-shadow: 0 12px 28px rgba(245, 158, 11, 0.22);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 800;
}

.timeline-event-conflict {
    background: linear-gradient(135deg, #dc2626, #fb7185);
    box-shadow: 0 12px 28px rgba(220, 38, 38, 0.24);
    color: #ffffff;
}

.timeline-event-main {
    min-width: 0;
}

.timeline-event-title {
    font-size: 14px;
    font-weight: 950;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-event-time {
    margin-top: 3px;
    font-size: 12px;
    font-weight: 900;
    opacity: 0.96;
}

.timeline-event-meta {
    margin-top: 3px;
    font-size: 12px;
    opacity: 0.9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-event-conflicts {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 58px;
    overflow: hidden;
}

.timeline-event-conflict-line {
    padding: 5px 7px;
    border-radius: 9px;
    background: rgba(127, 29, 29, 0.25);
    font-size: 11px;
    line-height: 1.25;
}

.timeline-event-conflict-line b,
.timeline-event-conflict-line span,
.timeline-event-conflict-line small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.timeline-event-conflict-line small {
    opacity: 0.9;
}

.timeline-event-conflict-more {
    font-size: 11px;
    font-weight: 900;
    opacity: 0.94;
}

.timeline-event:hover {
    z-index: 10;
    overflow: visible;
    min-width: 280px;
    height: auto;
    bottom: auto;
}

.timeline-event:hover .timeline-event-conflicts {
    max-height: none;
    overflow: visible;
}

.timeline-event:hover .timeline-event-title,
.timeline-event:hover .timeline-event-meta,
.timeline-event:hover .timeline-event-conflict-line b,
.timeline-event:hover .timeline-event-conflict-line span,
.timeline-event:hover .timeline-event-conflict-line small {
    white-space: normal;
}

@media (max-width: 1100px) {
    .app-shell,
    .login-page {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .cards-grid,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .login-page {
        padding: 24px;
    }

    .login-side {
        display: none;
    }
}

@media (max-width: 900px) {
    .filters-grid {
        grid-template-columns: 1fr;
    }

    .homework-overview-grid,
    .homework-board,
    .events-overview-grid {
        grid-template-columns: 1fr;
    }

    .event-card {
        grid-template-columns: 1fr;
    }

    .event-card-date {
        align-items: flex-start;
        padding: 14px;
    }

    .event-card-header {
        flex-direction: column;
    }

    .event-participant-item,
    .event-participant-add-box {
        grid-template-columns: 1fr;
    }

    .modal-card {
        max-height: 92vh;
    }

    .timeline-day-v2 {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    .timeline-day-label {
        padding: 14px 10px;
    }

    .timeline-day-label strong {
        font-size: 14px;
    }

    .timeline-lane {
        height: 126px;
    }

    .timeline-event {
        min-width: 170px;
    }
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #334155;
}

.toggle-label input {
    width: 18px;
    height: 18px;
    accent-color: #f59e0b;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}

.form-message {
    margin: 12px 0;
    font-size: 14px;
    color: #64748b;
}

.form-message.success {
    color: #15803d;
}

.form-message.error {
    color: #b91c1c;
}

.topbar-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(245, 158, 11, 0.35);
    background: #fff7ed;
}

.profile-avatar-layout {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 20px;
    align-items: start;
}

.profile-avatar-preview-wrap {
    display: flex;
    justify-content: center;
}

.profile-avatar-preview {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    object-fit: cover;
    border: 2px solid rgba(245, 158, 11, 0.35);
    background: #fff7ed;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}

.profile-avatar-info h3 {
    margin-top: 0;
}

.profile-avatar-form {
    margin-top: 22px;
    display: grid;
    gap: 16px;
}

.profile-avatar-form input[type="file"] {
    margin-top: 8px;
    display: block;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 900px) {
    .profile-avatar-layout {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .events-overview-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Soft Yellow Theme Overrides
   ========================================================= */

:root {
    --bg: #fff9dc;
    --bg-soft: #fff3b8;
    --card: #ffffff;
    --text: #3a2a0a;
    --muted: #8a6f28;

    --primary: #f5d85b;
    --primary-dark: #d8ad32;
    --primary-soft: #fff4bd;

    --accent: #c99418;
    --accent-dark: #9f7210;

    --border: #efd98a;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;

    --sidebar: #fff1a8;
    --sidebar-2: #f4d96c;

    --shadow: 0 18px 40px rgba(159, 114, 16, 0.12);
}

body {
    background:
        radial-gradient(circle at top left, rgba(245, 216, 91, 0.30), transparent 34%),
        radial-gradient(circle at top right, rgba(255, 241, 168, 0.36), transparent 28%),
        linear-gradient(135deg, #fffbe8, var(--bg));
    color: var(--text);
}

.sidebar {
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.42), transparent 34%),
        linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
    color: #3a2a0a;
}

.brand-title {
    color: #7a5208;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.9),
        0 3px 10px rgba(159, 114, 16, 0.12);
}

.brand-subtitle {
    color: #8a6f28;
}

.nav a {
    color: #6b4b0a;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.56);
    color: #3a2a0a;
    box-shadow: inset 4px 0 0 #d8ad32;
}

.logout-button {
    background: rgba(255, 255, 255, 0.54);
    color: #6b4b0a;
    box-shadow: none;
}

.logout-button:hover {
    background: rgba(255, 255, 255, 0.78);
    color: #3a2a0a;
}

.topbar h1 {
    color: #7a5208;
}

.topbar p {
    color: var(--muted);
}

.section-header h2,
.item h3,
.club-card h3,
.diary-summary-card h3,
.homework-column > h3,
.homework-card-header h3,
.event-card-header h3,
.event-participant-item h3,
.event-participant-add-box h3,
.timeline-day-label strong,
.card h3 {
    color: #7a5208;
}

.card {
    border-color: var(--border);
    box-shadow: var(--shadow);
}

.item,
.club-card,
.diary-summary-card,
.homework-stat-card,
.event-stat-card,
.event-participant-item {
    border-color: var(--border);
    background: #fffdf3;
}

.hero-card {
    background:
        radial-gradient(circle at right, rgba(255, 255, 255, 0.28), transparent 34%),
        linear-gradient(135deg, #ffe680, #fff4bd);
    color: #3a2a0a;
    border-color: #efd98a;
}

.hero-card p {
    color: rgba(58, 42, 10, 0.72);
}

.eyebrow {
    color: #a86f09;
}

.stat-card strong {
    color: #7a5208;
}

.stat-label,
.meta,
.section-header p {
    color: var(--muted);
}

th {
    color: #7a5208;
    background: #fff6cc;
}

td,
th {
    border-bottom-color: var(--border);
}

button {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #3a2a0a;
    box-shadow: 0 8px 18px rgba(216, 173, 50, 0.20);
}

button:hover {
    background: linear-gradient(135deg, #ffe275, #c99418);
}

.button-link {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #3a2a0a;
}

.button-link:hover {
    background: linear-gradient(135deg, #ffe275, #c99418);
}

.secondary-button {
    background: #fff4bd;
    color: #7a5208;
}

.secondary-button:hover {
    background: #ffe99a;
}

.badge {
    background: #fff4bd;
    color: #7a5208;
    border-color: #efd98a;
}

.mini-badge,
.inline-chip {
    background: #fff4bd;
    color: #7a5208;
}

.quick-actions a {
    background: #fffdf3;
    border-color: #efd98a;
    color: #7a5208;
}

.quick-actions a:hover {
    background: #fff4bd;
    color: #5f3f06;
}

.form input,
.form textarea,
.form select,
.admin-form select,
.admin-form textarea,
.filters-grid select,
.filters-grid input,
.compact-input {
    border-color: var(--border);
    background: #fffef8;
    color: var(--text);
}

.form input:focus,
.form textarea:focus,
.form select:focus,
.compact-input:focus {
    outline: 3px solid rgba(216, 173, 50, 0.28);
    border-color: #d8ad32;
}

.login-body {
    background:
        radial-gradient(circle at 15% 15%, rgba(245, 216, 91, 0.48), transparent 30%),
        radial-gradient(circle at 88% 18%, rgba(255, 255, 255, 0.36), transparent 28%),
        linear-gradient(135deg, #fff1a8, #fff9dc);
}

.login-page {
    color: #3a2a0a;
}

.login-card {
    background: rgba(255, 255, 255, 0.98);
    color: var(--text);
    box-shadow: 0 24px 80px rgba(159, 114, 16, 0.18);
    border-color: rgba(216, 173, 50, 0.38);
}

.login-card h1 {
    color: #7a5208;
}

.login-subtitle,
.login-hint {
    color: var(--muted);
}

.login-side h2 {
    color: #6b4b0a;
    text-shadow:
        0 2px 0 rgba(255, 255, 255, 0.78),
        0 8px 28px rgba(159, 114, 16, 0.14);
}

.login-side li {
    color: #6b4b0a;
}

.login-side-badge {
    background: rgba(255, 255, 255, 0.50);
    color: #7a5208;
    border-color: rgba(216, 173, 50, 0.38);
}

.admin-tabs a {
    background: #ffffff;
    border-color: var(--border);
    color: #8a6f28;
}

.admin-tabs a:hover,
.admin-tabs a.active {
    background: #fff4bd;
    color: #7a5208;
    border-color: #d8ad32;
}

.diary-average-box strong {
    color: #a86f09;
}

.grade-chip {
    background: #fff4bd;
    color: #7a5208;
}

.homework-card-today {
    border-color: #efd98a;
    background: #fffdf0;
}

.homework-card-tomorrow {
    border-color: #efd98a;
    background: #fff9df;
}

.homework-card-upcoming {
    border-color: #efd98a;
}

.homework-status-today,
.homework-status-upcoming {
    background: #fff4bd;
    color: #7a5208;
}

.homework-status-tomorrow {
    background: #fff0a6;
    color: #7a5208;
}

.event-card-date {
    background: #fff4bd;
    color: #7a5208;
}

.event-type-school,
.event-type-class,
.event-type-sport {
    background: #fff4bd;
    color: #7a5208;
}

.event-type-meeting,
.event-type-trip,
.event-type-holiday {
    background: #fff0a6;
    color: #7a5208;
}

.event-type-contest {
    background: #ffe5b4;
    color: #854d0e;
}

.timeline-day-label {
    background: #fffdf3;
    border-right-color: var(--border);
}

.timeline-hours-v2 {
    background: rgba(255, 253, 243, 0.96);
    border-bottom-color: var(--border);
}

.timeline-event {
    background: linear-gradient(135deg, #f5d85b, #d8ad32);
    color: #3a2a0a;
    box-shadow: 0 12px 28px rgba(216, 173, 50, 0.22);
}

.modal-backdrop {
    background: rgba(58, 42, 10, 0.42);
}

.modal-card {
    border-color: var(--border);
    box-shadow: 0 30px 90px rgba(159, 114, 16, 0.22);
}

.topbar-avatar,
.profile-avatar-preview {
    border-color: rgba(216, 173, 50, 0.46);
    background: #fff9dc;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
}

.status-bad {
    background: #fee2e2;
    color: #991b1b;
}

.form-message.success {
    color: #15803d;
}

.form-message.error {
    color: #b91c1c;
}

@media (max-width: 1100px) {
    .sidebar {
        background:
            radial-gradient(circle at top, rgba(255, 255, 255, 0.42), transparent 34%),
            linear-gradient(135deg, #fff1a8, #f4d96c);
    }
}

/* =========================================================
   Compact Laptop Layout
   ========================================================= */

@media (max-width: 1400px) {
    .app-shell {
        grid-template-columns: 240px 1fr;
    }

    .sidebar {
        padding: 18px;
        gap: 18px;
    }

    .brand {
        gap: 10px;
    }

    .brand-logo,
    .login-logo {
        width: 46px;
        height: 46px;
        border-radius: 14px;
    }

    .brand-title {
        font-size: 17px;
    }

    .brand-subtitle {
        font-size: 12px;
    }

    .nav {
        gap: 5px;
    }

    .nav a {
        padding: 9px 11px;
        border-radius: 11px;
        font-size: 14px;
    }

    .logout-button {
        padding: 10px 12px;
        font-size: 14px;
    }

    .main {
        padding: 18px;
    }

    .topbar {
        margin-bottom: 16px;
    }

    .topbar h1 {
        font-size: 26px;
    }

    .topbar p {
        margin-top: 5px;
        font-size: 14px;
    }

    .content {
        gap: 16px;
    }

    .card {
        padding: 16px;
        border-radius: 16px;
    }

    .section-header {
        margin-bottom: 12px;
        gap: 12px;
    }

    .section-header h2 {
        font-size: 21px;
    }

    .section-header p,
    .meta {
        font-size: 13px;
    }

    button,
    .button-link {
        padding: 9px 13px;
        border-radius: 10px;
        font-size: 14px;
    }

    .badge {
        padding: 6px 10px;
        font-size: 13px;
    }

    .topbar-avatar {
        width: 32px;
        height: 32px;
    }

    .cards-grid {
        gap: 14px;
    }

    .grid {
        gap: 14px;
    }

    th,
    td {
        padding: 10px 9px;
        font-size: 14px;
    }

    .item,
    .club-card,
    .diary-summary-card,
    .homework-card,
    .event-card,
    .event-participant-item,
    .event-participant-add-box {
        padding: 13px;
        border-radius: 14px;
    }

    .item h3,
    .club-card h3,
    .card h3 {
        font-size: 18px;
    }

    .stat-card strong {
        font-size: 23px;
    }

    .hero-card h2 {
        font-size: 24px;
        margin: 6px 0;
    }

    .quick-actions {
        gap: 9px;
    }

    .quick-actions a {
        padding: 11px;
        border-radius: 12px;
        font-size: 14px;
    }

    .filters-grid {
        gap: 10px;
    }

    .filters-grid label {
        gap: 6px;
        font-size: 14px;
    }

    .filters-grid select,
    .filters-grid input,
    .compact-input {
        padding: 8px 10px;
        border-radius: 10px;
        font-size: 13px;
    }

    .form {
        gap: 12px;
        margin-top: 18px;
    }

    .form input,
    .admin-form select,
    .admin-form textarea {
        padding: 11px 13px;
        border-radius: 12px;
        font-size: 14px;
    }

    .form button {
        padding: 12px;
        font-size: 14px;
    }

    .small-button {
        padding: 7px 9px;
        border-radius: 9px;
        font-size: 12px;
    }
}

@media (max-width: 900px) {
    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header .row-actions,
    .section-header > button {
        width: 100%;
    }

    .section-header > button,
    .form-actions button,
    .admin-form > button {
        width: 100%;
    }

    .admin-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .admin-tabs a {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .table-wrap {
        margin: 0 -4px;
    }
}

@media (max-width: 760px), (max-height: 760px) {
    .modal-backdrop {
        align-items: flex-start;
        justify-content: center;
        padding: 12px;
        overflow-y: auto;
    }

    .modal-card {
        width: 100%;
        max-height: none;
        overflow: visible;
        padding: 16px;
        border-radius: 18px;
    }
}

/* =========================================================
   Compact Height Layout
   ========================================================= */

@media (max-height: 760px) and (min-width: 1101px) {
    .app-shell {
        grid-template-columns: 230px 1fr;
    }

    .sidebar {
        padding: 14px 16px;
        gap: 13px;
        overflow-y: auto;
    }

    .brand-logo,
    .login-logo {
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }

    .brand-title {
        font-size: 16px;
        line-height: 1.1;
    }

    .brand-subtitle {
        font-size: 11px;
    }

    .nav {
        gap: 4px;
    }

    .nav a {
        padding: 7px 10px;
        border-radius: 10px;
        font-size: 13px;
        line-height: 1.15;
    }

    .logout-button {
        padding: 8px 10px;
        font-size: 13px;
    }

    .main {
        padding: 14px 16px;
    }

    .topbar {
        margin-bottom: 12px;
    }

    .topbar h1 {
        font-size: 24px;
        line-height: 1.15;
    }

    .topbar p {
        font-size: 13px;
        margin-top: 4px;
    }

    .content {
        gap: 12px;
    }

    .card {
        padding: 14px;
        border-radius: 14px;
    }

    .section-header {
        margin-bottom: 10px;
    }

    .section-header h2 {
        font-size: 19px;
    }

    .eyebrow {
        font-size: 10px;
    }

    .badge {
        padding: 5px 9px;
        font-size: 12px;
    }

    button,
    .button-link {
        padding: 8px 11px;
        border-radius: 9px;
        font-size: 13px;
    }

    .item,
    .club-card,
    .diary-summary-card,
    .homework-card,
    .event-card,
    .event-participant-item,
    .event-participant-add-box {
        padding: 11px;
        border-radius: 12px;
    }

    th,
    td {
        padding: 8px 8px;
        font-size: 13px;
    }

    .stat-card strong {
        font-size: 21px;
    }

    .profile-avatar-preview {
        width: 42px;
        height: 42px;
    }

    .topbar-avatar {
        width: 30px;
        height: 30px;
    }
}

/* =========================================================
   Compact Login Page
   ========================================================= */

@media (max-width: 1400px), (max-height: 760px) {
    .login-page {
        grid-template-columns: 380px 1fr;
        gap: 38px;
        padding: 28px;
    }

    .login-card {
        padding: 26px;
        border-radius: 24px;
    }

    .login-logo {
        width: 64px;
        height: 64px;
        border-radius: 18px;
        margin-bottom: 14px;
    }

    .login-card h1 {
        font-size: 27px;
    }

    .login-subtitle {
        font-size: 14px;
    }

    .login-side h2 {
        font-size: 32px;
        max-width: 560px;
    }

    .login-side li {
        font-size: 16px;
        margin: 9px 0;
    }

    .login-side-badge {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (max-height: 760px) and (min-width: 900px) {
    .login-page {
        min-height: 100vh;
        grid-template-columns: 360px 1fr;
        gap: 32px;
        padding: 22px 32px;
    }

    .login-card {
        padding: 22px;
    }

    .login-logo {
        width: 58px;
        height: 58px;
        margin-bottom: 10px;
    }

    .login-card h1 {
        font-size: 25px;
        margin-bottom: 6px;
    }

    .form {
        gap: 10px;
        margin-top: 16px;
    }

    .form input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .form button {
        padding: 11px;
    }

    .login-hint {
        margin-top: 12px;
        font-size: 12px;
    }

    .login-side h2 {
        font-size: 29px;
    }

    .login-side li {
        font-size: 15px;
    }
}

/* =========================================================
   Analytics
   ========================================================= */

.analytics-hero-card {
    background:
        radial-gradient(circle at right, rgba(255, 255, 255, 0.38), transparent 34%),
        linear-gradient(135deg, #fff1a8, #fff9dc);
}

.analytics-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.analytics-filters label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 900;
    color: var(--text);
}

.analytics-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.analytics-tab {
    background: #fff4bd;
    color: #7a5208;
    box-shadow: none;
}

.analytics-tab:hover,
.analytics-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #3a2a0a;
}

.analytics-tab-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.analytics-metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.analytics-metric-card {
    padding: 16px;
}

.analytics-metric-card span {
    display: block;
    color: var(--muted);
    font-size: 13px;
    font-weight: 900;
}

.analytics-metric-card strong {
    display: block;
    margin-top: 8px;
    color: #7a5208;
    font-size: 28px;
    line-height: 1.1;
}

.analytics-chart-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-bar-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fffdf3;
}

.analytics-bar-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 900;
}

.analytics-bar-track {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #fff4bd;
}

.analytics-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

@media (max-width: 1400px) {
    .analytics-metrics-grid {
        grid-template-columns: repeat(4, minmax(140px, 1fr));
    }
}

@media (max-width: 1100px) {
    .analytics-filters,
    .analytics-metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 700px) {
    .analytics-filters,
    .analytics-metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Login legal agreements and legal pages
   ========================================================= */

.login-legal-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fffdf3;
}

.login-legal-checkbox {
    display: grid !important;
    grid-template-columns: 18px 1fr;
    gap: 9px !important;
    align-items: start;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 700 !important;
    color: var(--muted);
}

.login-legal-checkbox input {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--primary-dark);
}

.login-legal-checkbox a {
    color: #7a5208;
    font-weight: 900;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.login-legal-checkbox a:hover {
    color: #3a2a0a;
}

.legal-page {
    min-height: 100vh;
    padding: 32px;
    background:
        radial-gradient(circle at top left, rgba(245, 216, 91, 0.24), transparent 34%),
        linear-gradient(135deg, #fffbe8, var(--bg));
}

.legal-card {
    max-width: 920px;
    margin: 0 auto;
    line-height: 1.7;
}

.legal-card h1 {
    margin-top: 0;
    color: #7a5208;
}

.legal-card h2 {
    margin-top: 28px;
    color: #7a5208;
}

.legal-card p,
.legal-card li {
    color: #4b3a12;
}

.legal-card ul {
    padding-left: 22px;
}

@media (max-height: 760px) and (min-width: 900px) {
    .login-legal-box {
        gap: 7px;
        padding: 9px;
    }

    .login-legal-checkbox {
        font-size: 11px;
    }
}

/* =========================================================
   Student Portfolio Final
   ========================================================= */

.portfolio-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.portfolio-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
}

.portfolio-toolbar-main {
    display: grid;
    grid-template-columns: minmax(240px, 420px) minmax(180px, 240px);
    gap: 14px;
}

.portfolio-toolbar-main label,
.portfolio-url-label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 900;
}

.portfolio-actions,
.portfolio-block-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.portfolio-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.portfolio-editor-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 18px;
}

.portfolio-form textarea {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    font-size: 16px;
    font-family: inherit;
    background: #fffef8;
    resize: vertical;
}

.portfolio-mobile-note {
    display: none;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #fde68a;
    background: #fffbeb;
    color: #92400e;
    font-weight: 800;
}

.portfolio-document {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.portfolio-cover,
.portfolio-section,
.portfolio-qr-section {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 28px;
}

.portfolio-cover {
    min-height: 460px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: #3a2a0a;
}

.portfolio-theme-sunny .portfolio-cover {
    background:
        radial-gradient(circle at 82% 14%, rgba(255,255,255,0.65), transparent 25%),
        linear-gradient(135deg, #fff1a8, #fff9dc);
}

.portfolio-theme-classic .portfolio-cover {
    background: linear-gradient(135deg, #f8fafc, #ffffff);
}

.portfolio-theme-creative .portfolio-cover {
    background:
        radial-gradient(circle at top right, rgba(168, 85, 247, 0.22), transparent 28%),
        radial-gradient(circle at bottom left, rgba(14, 165, 233, 0.20), transparent 30%),
        linear-gradient(135deg, #fff7ed, #fdf2f8);
}

.portfolio-theme-olympic .portfolio-cover {
    background:
        radial-gradient(circle at top right, rgba(245, 158, 11, 0.24), transparent 30%),
        linear-gradient(135deg, #fffbeb, #fff7ed);
}

.portfolio-cover-bg {
    position: absolute;
    right: -80px;
    top: -80px;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: rgba(216, 173, 50, 0.22);
}

.portfolio-cover-content {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 28px;
    align-items: center;
}

.portfolio-avatar-wrap {
    width: 180px;
    height: 180px;
    padding: 8px;
    border-radius: 42px;
    background: rgba(255,255,255,0.72);
    box-shadow: 0 18px 40px rgba(159, 114, 16, 0.16);
}

.portfolio-avatar {
    width: 100%;
    height: 100%;
    border-radius: 34px;
    object-fit: cover;
    background: #fffdf3;
}

.portfolio-cover h2 {
    margin: 8px 0;
    font-size: 48px;
    line-height: 1;
    color: #7a5208;
}

.portfolio-class {
    display: inline-flex;
    margin: 0;
    padding: 8px 13px;
    border-radius: 999px;
    background: #ffffff;
    color: #7a5208;
    font-weight: 950;
}

.portfolio-tagline {
    margin: 18px 0 0;
    font-size: 22px;
    font-weight: 950;
    color: #5f3f06;
}

.portfolio-summary {
    max-width: 820px;
    color: #6b4b0a;
    line-height: 1.65;
    font-size: 16px;
}

.portfolio-cover-footer {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: #8a6f28;
    font-weight: 900;
}

.portfolio-badges-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0;
}

.portfolio-badge {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: none;
}

.portfolio-badge-main {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 11px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #7a5208;
}

.portfolio-badge-main:hover {
    background: rgba(255, 244, 189, 0.75);
}

.portfolio-badge-main:disabled {
    cursor: default;
    opacity: 1;
}

.portfolio-badge-remove {
    width: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 0;
    background: rgba(220, 38, 38, 0.10);
    color: #991b1b;
    box-shadow: none;
    font-size: 20px;
    line-height: 1;
}

.portfolio-badge-remove:hover {
    background: #dc2626;
    color: #ffffff;
}

.portfolio-achievement-map {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
}

.portfolio-map-card {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 14px;
    align-items: center;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(245,216,91,0.22), transparent 35%),
        #fffdf3;
    cursor: pointer;
}

.portfolio-map-icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #3a2a0a;
    font-weight: 950;
    font-size: 22px;
}

.portfolio-map-card h3,
.portfolio-project-card h3,
.portfolio-skill-card h3,
.portfolio-gallery-card h3,
.portfolio-timeline-item h3,
.portfolio-reflection-card h3,
.portfolio-review-card h3 {
    margin: 0 0 7px;
    color: #7a5208;
}

.portfolio-map-card p,
.portfolio-map-card span,
.portfolio-project-card p,
.portfolio-skill-card p,
.portfolio-gallery-card p,
.portfolio-timeline-item p,
.portfolio-reflection-card p,
.portfolio-review-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.portfolio-projects-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 16px;
}

.portfolio-project-card {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 16px;
    padding: 16px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: #fffdf3;
    cursor: pointer;
}

.portfolio-project-card img,
.portfolio-gallery-card img {
    width: 100%;
    height: 130px;
    border-radius: 18px;
    object-fit: cover;
    background: #fff4bd;
}

.portfolio-project-placeholder,
.portfolio-gallery-placeholder {
    height: 130px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff4bd;
    color: #7a5208;
    font-weight: 950;
}

.portfolio-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.portfolio-card-meta span {
    display: inline-flex;
    padding: 5px 9px;
    border-radius: 999px;
    background: #fff4bd;
    color: #7a5208;
    font-size: 12px;
    font-weight: 900;
}

.portfolio-skills-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    gap: 16px;
}

.portfolio-skill-card,
.portfolio-review-card {
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fffdf3;
    cursor: pointer;
}

.portfolio-skill-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.portfolio-skill-header strong {
    color: #a86f09;
    font-size: 22px;
}

.portfolio-skill-track {
    height: 11px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #fff4bd;
}

.portfolio-skill-track span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.portfolio-gallery-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 16px;
}

.portfolio-gallery-card {
    display: flex;
    flex-direction: column;
    padding: 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fffdf3;
    cursor: pointer;
}

.portfolio-gallery-image-button {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0 0 12px;
    border: 0;
    border-radius: 18px;
    background: #fff8dc;
    box-shadow: none;
    cursor: zoom-in;
    overflow: hidden;
}

.portfolio-gallery-image-button:hover {
    background: #fff4bd;
}

.portfolio-gallery-card img {
    display: block;
    width: 100%;
    height: 280px;
    object-fit: contain;
    object-position: center;
    border-radius: 18px;
    background:
        linear-gradient(45deg, rgba(226, 232, 240, 0.45) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(226, 232, 240, 0.45) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.45) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(226, 232, 240, 0.45) 75%),
        #ffffff;
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.portfolio-gallery-placeholder {
    height: 280px;
}

.portfolio-image-viewer {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.82);
}

.portfolio-image-viewer-card {
    width: min(1100px, 100%);
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.35);
}

.portfolio-image-viewer-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
}

.portfolio-image-viewer-header h2 {
    margin: 0;
    color: #7a5208;
}

.portfolio-image-viewer-card img {
    display: block;
    width: 100%;
    max-height: calc(94vh - 150px);
    object-fit: contain;
    border-radius: 18px;
    background:
        linear-gradient(45deg, rgba(226, 232, 240, 0.55) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(226, 232, 240, 0.55) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(226, 232, 240, 0.55) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(226, 232, 240, 0.55) 75%),
        #ffffff;
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.portfolio-image-viewer-actions {
    display: flex;
    justify-content: flex-end;
}

.portfolio-image-viewer-open {
    overflow: hidden;
}

.portfolio-timeline-list,
.portfolio-reflection-list,
.portfolio-reviews-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.portfolio-timeline-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 16px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fffdf3;
    cursor: pointer;
}

.portfolio-timeline-date {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 72px;
    border-radius: 16px;
    background: #fff4bd;
    color: #7a5208;
    font-weight: 950;
    text-align: center;
}

.portfolio-reflection-card {
    padding: 18px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: #fffdf3;
    cursor: pointer;
}

.portfolio-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.portfolio-tag-cloud span {
    display: inline-flex;
    padding: 8px 11px;
    border-radius: 999px;
    background: #fff4bd;
    color: #7a5208;
    font-weight: 900;
}

.portfolio-qr-section {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.portfolio-qr-section a {
    color: #7a5208;
    font-weight: 950;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.portfolio-qr-image {
    width: 180px;
    height: 180px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #ffffff;
    padding: 10px;
}

.portfolio-empty {
    padding: 18px;
    border-radius: 18px;
    border: 1px dashed var(--border);
    background: #fffdf3;
    color: var(--muted);
    font-weight: 800;
}

.portfolio-block-editor {
    position: fixed;
    inset: 0;
    z-index: 80;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(58, 42, 10, 0.42);
}

.portfolio-block-editor .modal-card {
    width: min(720px, 100%);
}

.portfolio-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    padding: 13px 16px;
    border-radius: 14px;
    background: #3a2a0a;
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
}

.portfolio-rating-card {
    position: relative;
    z-index: 1;
    margin-top: 22px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.28);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
    overflow: hidden;
    animation: portfolioRatingAppear 520ms ease both;
}

.portfolio-rating-card::before {
    content: "";
    position: absolute;
    inset: -40%;
    opacity: 0.18;
    pointer-events: none;
    background: radial-gradient(circle, #38bdf8 0%, transparent 54%);
    animation: portfolioRatingGlow 2.4s ease-in-out infinite;
}

.portfolio-rating-card-up::before {
    background: radial-gradient(circle, #22c55e 0%, transparent 54%);
}

.portfolio-rating-card-down::before {
    background: radial-gradient(circle, #ef4444 0%, transparent 54%);
}

.portfolio-rating-card-stable::before {
    background: radial-gradient(circle, #38bdf8 0%, transparent 54%);
}

.portfolio-rating-head,
.portfolio-rating-grid {
    position: relative;
    z-index: 1;
}

.portfolio-rating-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.portfolio-rating-head h3 {
    margin: 2px 0 0;
    font-size: 22px;
}

.portfolio-rating-trend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.portfolio-rating-trend span:first-child {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    color: #ffffff;
    animation: portfolioRatingArrowPulse 1.2s ease-in-out infinite;
}

.portfolio-rating-trend-up {
    color: #166534;
    background: rgba(34, 197, 94, 0.14);
}

.portfolio-rating-trend-up span:first-child {
    background: #22c55e;
}

.portfolio-rating-trend-down {
    color: #991b1b;
    background: rgba(239, 68, 68, 0.14);
}

.portfolio-rating-trend-down span:first-child {
    background: #ef4444;
}

.portfolio-rating-trend-stable {
    color: #075985;
    background: rgba(14, 165, 233, 0.14);
}

.portfolio-rating-trend-stable span:first-child {
    background: #0ea5e9;
}

.portfolio-rating-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.portfolio-rating-metric {
    padding: 14px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.86);
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.portfolio-rating-label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portfolio-rating-metric strong {
    display: block;
    font-size: 26px;
    line-height: 1.1;
    color: #0f172a;
}

.portfolio-rating-metric small {
    display: block;
    margin-top: 6px;
    color: #64748b;
}

.portfolio-rating-card-up .portfolio-rating-metric strong {
    animation: portfolioRatingGrow 720ms ease both;
}

.portfolio-rating-card-down .portfolio-rating-metric strong {
    animation: portfolioRatingFall 720ms ease both;
}

.portfolio-rating-card-compact {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    align-items: center;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.24);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
    animation: portfolioRatingAppear 420ms ease both;
}

.portfolio-rating-card-compact::before {
    display: none;
}

.portfolio-rating-compact-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
}

.portfolio-rating-compact-title span {
    font-size: 12px;
    font-weight: 900;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.portfolio-rating-compact-title strong {
    font-size: 22px;
    line-height: 1;
    color: #0f172a;
}

.portfolio-rating-compact-items {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}

.portfolio-rating-compact-items strong {
    color: #0f172a;
}

.portfolio-rating-card-compact .portfolio-rating-trend {
    padding: 4px 8px;
    font-size: 12px;
}

.portfolio-rating-card-compact .portfolio-rating-trend b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    color: #ffffff;
    font-size: 12px;
    animation: portfolioRatingArrowPulse 1.2s ease-in-out infinite;
}

.portfolio-rating-trend-up b {
    background: #22c55e;
}

.portfolio-rating-trend-down b {
    background: #ef4444;
}

.portfolio-rating-trend-stable b {
    background: #0ea5e9;
}

.portfolio-rating-compact-note {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 11px;
    line-height: 1.25;
    color: #64748b;
}

.portfolio-rating-compact-note span {
    display: inline-flex;
}

.portfolio-rating-card-up .portfolio-rating-compact-title strong {
    animation: portfolioRatingGrow 620ms ease both;
}

.portfolio-rating-card-down .portfolio-rating-compact-title strong {
    animation: portfolioRatingFall 620ms ease both;
}

@keyframes portfolioRatingAppear {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes portfolioRatingGlow {
    0%,
    100% {
        transform: translate3d(-8%, -6%, 0) scale(1);
    }

    50% {
        transform: translate3d(8%, 6%, 0) scale(1.08);
    }
}

@keyframes portfolioRatingArrowPulse {
    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.16);
    }
}

@keyframes portfolioRatingGrow {
    0% {
        color: #0f172a;
        transform: translateY(8px) scale(0.94);
    }

    55% {
        color: #16a34a;
        transform: translateY(-4px) scale(1.08);
    }

    100% {
        color: #0f172a;
        transform: translateY(0) scale(1);
    }
}

@keyframes portfolioRatingFall {
    0% {
        color: #0f172a;
        transform: translateY(-8px) scale(1.04);
    }

    55% {
        color: #dc2626;
        transform: translateY(4px) scale(0.96);
    }

    100% {
        color: #0f172a;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1100px) {
    .portfolio-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .portfolio-toolbar-main,
    .portfolio-editor-grid,
    .portfolio-cover-content,
    .portfolio-projects-list {
        grid-template-columns: 1fr;
    }

    .portfolio-achievement-map,
    .portfolio-skills-list,
    .portfolio-gallery-list {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }

    .portfolio-cover h2 {
        font-size: 38px;
    }
}

@media (max-width: 760px) {
    .portfolio-editor-panel,
    #portfolio-save-button,
    #portfolio-demo-button,
    #portfolio-add-review-button,
    .portfolio-block-editor {
        display: none !important;
    }

    .portfolio-toolbar {
        display: block;
    }

    .portfolio-toolbar-main {
        grid-template-columns: 1fr;
    }

    .portfolio-actions {
        margin-top: 12px;
    }

    .portfolio-mobile-note {
        display: block;
    }

    .portfolio-cover,
    .portfolio-section,
    .portfolio-qr-section {
        padding: 18px;
        border-radius: 20px;
    }

    .portfolio-cover-content,
    .portfolio-project-card,
    .portfolio-timeline-item,
    .portfolio-qr-section {
        grid-template-columns: 1fr;
    }

    .portfolio-avatar-wrap {
        width: 140px;
        height: 140px;
        border-radius: 32px;
    }

    .portfolio-avatar {
        border-radius: 24px;
    }

    .portfolio-cover h2 {
        font-size: 30px;
    }

    .portfolio-tagline {
        font-size: 18px;
    }

    .portfolio-achievement-map,
    .portfolio-skills-list,
    .portfolio-gallery-list {
        grid-template-columns: 1fr;
    }

    .portfolio-cover-footer {
        flex-direction: column;
    }

    .portfolio-rating-head {
        flex-direction: column;
    }

    .portfolio-rating-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-rating-card-compact {
        grid-template-columns: 1fr;
    }

    .portfolio-rating-compact-title {
        justify-content: space-between;
    }

    .portfolio-gallery-list {
        grid-template-columns: 1fr;
    }

    .portfolio-gallery-card img,
    .portfolio-gallery-placeholder {
        height: 240px;
    }

    .portfolio-image-viewer {
        padding: 12px;
    }

    .portfolio-image-viewer-card {
        max-height: 96vh;
        padding: 12px;
        border-radius: 18px;
    }

    .portfolio-image-viewer-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .portfolio-image-viewer-card img {
        max-height: calc(96vh - 180px);
    }
}

@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    html,
    body {
        width: 210mm;
        background: #ffffff !important;
        color: #111827 !important;
    }

    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .no-print,
    .sidebar,
    .topbar,
    .admin-tabs,
    .portfolio-toolbar,
    .portfolio-editor-panel,
    .portfolio-block-editor,
    .logout-button {
        display: none !important;
    }

    .app-shell {
        display: block !important;
        min-height: auto !important;
    }

    .main {
        padding: 0 !important;
    }

    .content,
    .portfolio-page,
    .portfolio-document {
        display: block !important;
    }

    .portfolio-cover,
    .portfolio-section,
    .portfolio-qr-section {
        box-shadow: none !important;
        border: 1px solid #e5e7eb !important;
        border-radius: 0 !important;
        margin: 0 0 10mm !important;
        padding: 10mm !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .portfolio-cover {
        min-height: 250mm;
        page-break-after: always;
        break-after: page;
    }

    .portfolio-cover h2 {
        font-size: 34pt;
    }

    .portfolio-tagline {
        font-size: 15pt;
    }

    .portfolio-summary,
    .portfolio-project-card p,
    .portfolio-gallery-card p,
    .portfolio-timeline-item p,
    .portfolio-reflection-card p,
    .portfolio-review-card p {
        font-size: 10.5pt;
        color: #374151 !important;
    }

    .portfolio-achievement-map,
    .portfolio-skills-list,
    .portfolio-gallery-list {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .portfolio-projects-list {
        grid-template-columns: 1fr !important;
    }

    .portfolio-project-card,
    .portfolio-gallery-card,
    .portfolio-map-card,
    .portfolio-skill-card,
    .portfolio-timeline-item,
    .portfolio-reflection-card,
    .portfolio-review-card {
        box-shadow: none !important;
        page-break-inside: avoid;
        break-inside: avoid;
        cursor: default !important;
    }

    .portfolio-project-card {
        grid-template-columns: 38mm 1fr !important;
    }

    .portfolio-project-card img,
    .portfolio-project-placeholder {
        height: 30mm !important;
    }

    .portfolio-gallery-card img,
    .portfolio-gallery-placeholder {
        height: 130mm !important;
        max-height: 130mm !important;
        object-fit: contain !important;
        object-position: center !important;
        border-radius: 0 !important;
        background: #ffffff !important;
    }

    .portfolio-gallery-print-large {
        page-break-before: always;
        break-before: page;
    }

    .portfolio-gallery-image-button {
        margin-bottom: 4mm !important;
        background: #ffffff !important;
    }

    .portfolio-gallery-card h3 {
        font-size: 15pt !important;
    }

    .portfolio-gallery-card p {
        font-size: 10.5pt !important;
    }

    .portfolio-image-viewer {
        display: none !important;
    }

    .portfolio-qr-image {
        width: 38mm !important;
        height: 38mm !important;
    }

    a {
        text-decoration: none !important;
    }

    .portfolio-rating-card {
        box-shadow: none;
        animation: none;
    }

    .portfolio-rating-card::before,
    .portfolio-rating-trend span:first-child,
    .portfolio-rating-card-up .portfolio-rating-metric strong,
    .portfolio-rating-card-down .portfolio-rating-metric strong {
        animation: none;
    }

    .portfolio-rating-card-compact {
        margin-top: 8px;
        padding: 7px 9px;
        border-radius: 12px;
        box-shadow: none;
        animation: none;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .portfolio-rating-compact-title strong {
        font-size: 18px;
    }

    .portfolio-rating-compact-items {
        gap: 6px;
        font-size: 11px;
    }

    .portfolio-rating-card-compact .portfolio-rating-trend {
        padding: 2px 6px;
        font-size: 10px;
    }

    .portfolio-rating-card-compact .portfolio-rating-trend b {
        width: 15px;
        height: 15px;
        font-size: 10px;
        animation: none;
    }

    .portfolio-rating-compact-note {
        display: none;
    }

    .portfolio-rating-card-up .portfolio-rating-compact-title strong,
    .portfolio-rating-card-down .portfolio-rating-compact-title strong {
        animation: none;
    }
}

/* =========================================================
   Admin layout stable fix
   ========================================================= */

.grid.two-columns.admin-layout,
.admin-layout.two-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(360px, 30vw, 460px) !important;
    gap: 20px;
    align-items: start;
}

.admin-layout > .card {
    min-width: 0;
}

.admin-layout > .card:first-child {
    min-width: 0;
    overflow: visible !important;
}

.admin-layout > .card:last-child {
    width: 100%;
    min-width: 0;
    max-width: 460px;
    justify-self: stretch;
}

@media (min-width: 1101px) {
    .admin-layout > .card:last-child {
        position: sticky;
        top: 18px;
        align-self: start;
        max-height: calc(100vh - 36px);
        overflow-y: auto;
    }
}

.admin-layout .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px;
}

.admin-layout .table-wrap table {
    width: max-content;
    min-width: 100%;
}

.admin-layout .table-wrap th,
.admin-layout .table-wrap td {
    padding: 9px 8px;
    font-size: 13px;
    vertical-align: top;
}

.admin-layout .table-wrap td {
    max-width: 260px;
    overflow-wrap: anywhere;
}

.admin-layout .table-wrap th:last-child,
.admin-layout .table-wrap td:last-child {
    white-space: nowrap;
    max-width: none;
}

.admin-layout .admin-form input,
.admin-layout .admin-form select,
.admin-layout .admin-form textarea {
    width: 100%;
    max-width: 100%;
}

@media (max-width: 1320px) {
    .grid.two-columns.admin-layout,
    .admin-layout.two-columns {
        grid-template-columns: minmax(0, 1fr) 360px !important;
        gap: 16px;
    }

    .admin-layout > .card:last-child {
        max-width: 360px;
    }

    .admin-layout .table-wrap th,
    .admin-layout .table-wrap td {
        padding: 8px 7px;
        font-size: 12px;
    }

    .admin-layout .table-wrap td {
        max-width: 220px;
    }
}

@media (max-width: 1100px) {
    .grid.two-columns.admin-layout,
    .admin-layout.two-columns {
        grid-template-columns: 1fr !important;
    }

    .admin-layout > .card:last-child {
        position: static !important;
        top: auto;
        max-width: none;
        max-height: none;
        overflow-y: visible;
    }

    .admin-layout .table-wrap table {
        min-width: 900px;
    }
}

@media (max-width: 700px) {
    .admin-layout .table-wrap table {
        min-width: 760px;
    }

    .admin-layout .table-wrap th,
    .admin-layout .table-wrap td {
        padding: 8px 6px;
        font-size: 12px;
    }

    .admin-layout .form-actions {
        justify-content: stretch;
    }

    .admin-layout .form-actions button,
    .admin-layout .admin-form > button {
        width: 100%;
    }
}

/* =========================================================
   Community
   ========================================================= */

.community-hero-card {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.14), rgba(33, 150, 243, 0.08));
}

.community-tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.community-tile {
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    padding: 16px;
    background: #ffffff;
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.community-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
}

.community-tile-icon {
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    flex: 0 0 72px;
    border-radius: 18px;
    overflow: hidden;
    background: #f8fafc;
    margin-bottom: 12px;
}

.community-tile-icon img {
    display: block;
    width: 72px;
    height: 72px;
    max-width: 72px;
    max-height: 72px;
    object-fit: cover;
}

.community-tile h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.community-tile p {
    margin: 0 0 8px;
    color: #64748b;
}

.school-needs-list {
    display: grid;
    gap: 16px;
}

.school-need-card {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 18px;
    padding: 16px;
    background: #ffffff;
}

.school-need-image {
    width: 100%;
    min-height: 140px;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    background: #f8fafc;
}

.school-need-body h3 {
    margin-top: 0;
}

.community-progress {
    width: 100%;
    height: 12px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
    margin: 12px 0 8px;
}

.community-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #22c55e, #14b8a6);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.58);
}

.modal-card {
    max-width: 720px;
    width: min(720px, 100%);
    max-height: 88vh;
    overflow: auto;
    border-radius: 24px;
    padding: 24px;
    background: #ffffff;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.34);
}

.community-modal-card p {
    line-height: 1.6;
}

.community-modal-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 18px;
    margin: 12px 0 18px;
    background: #f8fafc;
}

.stacked-form {
    display: grid;
    gap: 14px;
}

.stacked-form label {
    display: grid;
    gap: 6px;
}

.form-message.success {
    color: #15803d;
}

.form-message.error {
    color: #b91c1c;
}

.community-tile-button {
    display: block;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
    cursor: pointer;
    border: 1px solid rgba(148, 163, 184, 0.28);
    background: #ffffff;
}

.community-tile-button:focus {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 2px;
}

.community-tile,
.community-tile-button {
    min-height: 180px;
    overflow: hidden;
}

.community-tile h3,
.community-tile-button h3 {
    margin: 0 0 6px;
    font-size: 16px;
    line-height: 1.25;
}

.community-tile p,
.community-tile-button p {
    margin: 0 0 8px;
    color: #64748b;
    line-height: 1.35;
}

@media (max-width: 720px) {
    .community-tiles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .school-need-card {
        grid-template-columns: 1fr;
    }

    .school-need-image {
        height: 180px;
    }

    .modal-card {
        border-radius: 18px;
        padding: 18px;
    }
}

.homework-status-completed {
    background: #dcfce7;
    color: #166534;
}

.homework-card-completed {
    border-color: rgba(22, 101, 52, 0.22);
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.homework-completion-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}
/* =========================================================
   Academic year transfer
   ========================================================= */

.academic-transfer-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 14px;
}

.academic-transfer-table-wrap {
    max-height: 68vh;
    overflow: auto;
}

.academic-transfer-table {
    min-width: 980px;
}

.academic-transfer-table th {
    position: sticky;
    top: 0;
    z-index: 3;
}

.academic-transfer-table td:first-child,
.academic-transfer-table th:first-child {
    min-width: 260px;
}

.academic-transfer-table td:nth-child(4),
.academic-transfer-table th:nth-child(4) {
    min-width: 260px;
}

@media (max-width: 900px) {
    .academic-transfer-stats {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 560px) {
    .academic-transfer-stats {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Academic year transfer missing class actions
   ========================================================= */

.academic-transfer-row-warning {
    background: #fff7ed;
}

.academic-transfer-row-warning td {
    border-bottom-color: #fed7aa;
}

.academic-transfer-missing-class {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    padding: 10px;
    border: 1px dashed #f59e0b;
    border-radius: 12px;
    background: #fffbeb;
    color: #92400e;
}

.academic-transfer-missing-class b {
    color: #92400e;
}

.academic-transfer-missing-class .button-link {
    margin-top: 0;
}

.academic-transfer-missing-class .row-actions {
    margin-top: 4px;
}

/* =========================================================
   Analytics Live Dashboard
   ========================================================= */

.live-dashboard-hero {
    background:
        radial-gradient(circle at 90% 15%, rgba(34, 197, 94, 0.16), transparent 24%),
        radial-gradient(circle at 70% 80%, rgba(245, 158, 11, 0.22), transparent 28%),
        linear-gradient(135deg, #fffdf3, #fff4bd);
}

.live-dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

.live-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-weight: 950;
    white-space: nowrap;
}

.live-status-refreshing {
    background: #dbeafe;
    color: #1d4ed8;
}

.live-status-ok {
    background: #dcfce7;
    color: #166534;
}

.live-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.live-status-critical {
    background: #fee2e2;
    color: #991b1b;
}

.live-status-idle {
    background: #e2e8f0;
    color: #475569;
}

.live-dashboard-filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}

.live-dashboard-filters label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-weight: 900;
}

.live-updated-at {
    margin: 14px 0 0;
}

.live-metrics-grid {
    margin-bottom: 0;
}

.live-gauges-grid {
    display: grid;
    grid-template-columns: 0.7fr 1.6fr 0.7fr;
    gap: 18px;
}

.live-gauge-card {
    min-height: 210px;
}

.live-gauge-card h3 {
    margin-bottom: 14px;
}

.live-gauge,
.live-online-radar {
    min-height: 132px;
    border-radius: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.95), rgba(255, 244, 189, 0.8)),
        linear-gradient(135deg, #fffdf3, #fff4bd);
    box-shadow: inset 0 0 40px rgba(245, 158, 11, 0.10);
}

.live-gauge strong,
.live-online-radar strong {
    font-size: 46px;
    line-height: 1;
    color: #7a5208;
}

.live-gauge span,
.live-online-radar span {
    color: var(--muted);
    font-weight: 900;
}

.live-gauge-ok {
    box-shadow:
        inset 0 0 40px rgba(34, 197, 94, 0.14),
        0 0 0 4px rgba(34, 197, 94, 0.08);
}

.live-gauge-warning {
    box-shadow:
        inset 0 0 40px rgba(245, 158, 11, 0.20),
        0 0 0 4px rgba(245, 158, 11, 0.10);
}

.live-gauge-critical {
    box-shadow:
        inset 0 0 44px rgba(220, 38, 38, 0.20),
        0 0 0 4px rgba(220, 38, 38, 0.10);
}

.live-gauge-critical strong {
    color: #991b1b;
}

.live-sparkline {
    height: 132px;
    display: flex;
    align-items: end;
    gap: 5px;
    padding: 12px;
    border-radius: 24px;
    background:
        linear-gradient(to top, rgba(226, 232, 240, 0.55) 1px, transparent 1px),
        #fffdf3;
    background-size: 100% 25%;
    border: 1px solid var(--border);
}

.live-sparkline-bar {
    flex: 1;
    min-width: 6px;
    border-radius: 999px 999px 4px 4px;
    background: linear-gradient(180deg, #f59e0b, #f5d85b);
    position: relative;
    transition: height 0.25s ease;
}

.live-sparkline-bar span {
    display: none;
}

.live-sparkline-bar:hover span {
    display: inline-flex;
    position: absolute;
    left: 50%;
    bottom: calc(100% + 6px);
    transform: translateX(-50%);
    padding: 4px 7px;
    border-radius: 8px;
    background: #3a2a0a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    z-index: 3;
}

.live-sparkline-empty {
    width: 100%;
    align-self: center;
    text-align: center;
    color: var(--muted);
    font-weight: 900;
}

.live-online-users,
.live-events-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 620px;
    overflow: auto;
    padding-right: 4px;
}

.live-user-card {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fffdf3;
}

.live-user-online {
    border-color: rgba(34, 197, 94, 0.42);
    background:
        radial-gradient(circle at right, rgba(34, 197, 94, 0.10), transparent 34%),
        #fffdf3;
}

.live-user-card h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
}

.live-dot {
    width: 11px;
    height: 11px;
    min-width: 11px;
    border-radius: 999px;
    display: inline-flex;
}

.live-dot-online {
    background: #22c55e;
    box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.14);
    animation: livePulse 1.4s ease-in-out infinite;
}

.live-dot-away {
    background: #94a3b8;
}

.live-current-place {
    margin: 8px 0 0;
    color: #4b3a12;
    font-size: 13px;
    word-break: break-word;
}

.live-user-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-content: flex-start;
}

.live-user-stats span,
.live-user-stats b {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 999px;
    background: #fff4bd;
    color: #7a5208;
    font-size: 12px;
    font-weight: 900;
}

.live-user-stats b {
    background: #ffffff;
    border: 1px solid var(--border);
}

.live-event-row {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 12px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fffdf3;
}

.live-event-time {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.live-event-time strong {
    color: #7a5208;
}

.live-event-time span {
    color: var(--muted);
    font-size: 12px;
}

.live-event-body h3 {
    margin: 0 0 7px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.live-event-body code {
    display: inline-block;
    max-width: 100%;
    margin-top: 7px;
    padding: 7px 9px;
    border-radius: 10px;
    background: #ffffff;
    border: 1px solid var(--border);
    color: #475569;
    white-space: normal;
    word-break: break-word;
}

.live-diagnostic-warning {
    border-color: #f59e0b;
    background: #fffbeb;
}

.live-diagnostic-ok {
    border-color: rgba(34, 197, 94, 0.35);
    background: #f0fdf4;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.30);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@media (max-width: 1400px) {
    .live-dashboard-filters {
        grid-template-columns: repeat(4, minmax(140px, 1fr));
    }

    .live-gauges-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .live-dashboard-filters {
        grid-template-columns: 1fr 1fr;
    }

    .live-user-card {
        grid-template-columns: 1fr;
    }

    .live-user-stats {
        justify-content: flex-start;
    }
}

@media (max-width: 700px) {
    .live-dashboard-filters {
        grid-template-columns: 1fr;
    }

    .live-dashboard-actions {
        justify-content: stretch;
    }

    .live-dashboard-actions > * {
        width: 100%;
    }

    .live-event-row {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Live Dashboard Russian Section Labels
   ========================================================= */

.live-section-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 11px;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 13px;
    font-weight: 900;
}

.live-section-name b {
    color: #14532d;
}

.live-section-name-small {
    margin: 4px 0 8px;
    background: #fff4bd;
    color: #7a5208;
}

.live-section-name-small b {
    color: #5f3f06;
}



.ai-topbar-button {
    white-space: nowrap;
    font-weight: 800;
}

.ai-modal[hidden] {
    display: none;
}

.ai-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.ai-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.62);
    backdrop-filter: blur(3px);
}

.ai-modal-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(980px, calc(100vw - 32px));
    height: min(860px, calc(100vh - 32px));
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    padding: 0;
    border-radius: 22px;
    box-shadow: 0 24px 80px rgba(15, 23, 42, 0.35);
}

.ai-modal-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 22px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #eff6ff, #ffffff);
}

.ai-modal-header h2 {
    margin: 0 0 6px;
}

.ai-modal-header p {
    margin: 0;
}

.ai-modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
    overflow: auto;
    padding: 18px 24px;
}

.ai-settings-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid #dbeafe;
    border-radius: 14px;
    background: #eff6ff;
}

.ai-mode-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-mode-tabs button.active {
    filter: brightness(0.95);
    font-weight: 800;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.ai-quick-prompts {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
}

.ai-quick-prompts-title {
    margin-bottom: 10px;
    color: #334155;
    font-size: 14px;
    font-weight: 900;
}

.ai-quick-prompts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-quick-prompts-list button {
    font-size: 13px;
}

.ai-chat-history {
    min-height: 150px;
    max-height: 240px;
    overflow: auto;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
}

.ai-chat-message {
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 10px;
    white-space: pre-wrap;
}

.ai-chat-message-user {
    background: #dbeafe;
    margin-left: 48px;
}

.ai-chat-message-assistant {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    margin-right: 48px;
}

.ai-command-preview {
    overflow: auto;
    border: 1px solid #d1fae5;
    border-radius: 14px;
    padding: 14px;
    background: #ffffff;
}

.ai-command-list {
    display: grid;
    gap: 10px;
}

.ai-command-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px;
    background: #f8fafc;
}

.ai-command-card.ready {
    border-color: #22c55e;
    background: #f0fdf4;
}

.ai-command-card.error {
    border-color: #ef4444;
    background: #fef2f2;
}

.ai-command-card h3 {
    margin-top: 0;
}

.ai-input-box {
    padding: 16px 24px 20px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.ai-input-box textarea {
    width: 100%;
    resize: vertical;
    min-height: 96px;
}

@media (max-width: 768px) {
    .ai-modal-panel {
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        transform: none;
        border-radius: 0;
    }

    .ai-modal-header {
        padding: 16px;
    }

    .ai-modal-body {
        padding: 14px;
    }

    .ai-settings-box {
        grid-template-columns: 1fr;
    }

    .ai-chat-message-user,
    .ai-chat-message-assistant {
        margin-left: 0;
        margin-right: 0;
    }

    .ai-input-box {
        padding: 14px;
    }
}

/* ... existing code ... */

.ai-modal-panel {
    height: min(940px, calc(100vh - 16px));
}

.ai-modal-body {
    min-height: 0;
}

.ai-command-preview {
    flex: 1;
    min-height: 420px;
    max-height: none;
}

.ai-command-list {
    gap: 14px;
}

.ai-class-choice-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin-top: 8px;
}

.ai-class-choice-list button {
    text-align: left;
    justify-content: flex-start;
    white-space: normal;
}

.ai-clarification-box {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
}

@media (max-width: 768px) {
    .ai-command-preview {
        min-height: 320px;
    }

    .ai-class-choice-list {
        grid-template-columns: 1fr;
    }
}

.schedule-view-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.schedule-view-toggle .secondary-button.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.teacher-schedule-excel-wrap {
    margin-top: 8px;
}

.teacher-schedule-excel-scroll {
    overflow: auto;
    max-width: 100%;
    border: 2px solid #111827;
    background: #ffffff;
}

.teacher-schedule-excel-table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: "Times New Roman", Times, serif;
    color: #000000;
}

.teacher-schedule-excel-table th,
.teacher-schedule-excel-table td {
    border: 2px solid #000000;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.teacher-schedule-excel-table th {
    height: 34px;
    background: #fff200;
    font-weight: 700;
    font-size: 16px;
}

.teacher-schedule-excel-day-col {
    width: 54px;
    min-width: 54px;
}

.teacher-schedule-excel-time-col {
    width: 120px;
    min-width: 120px;
}

.teacher-schedule-excel-number-col {
    width: 84px;
    min-width: 84px;
}

.teacher-schedule-excel-class-head {
    width: 150px;
    min-width: 150px;
}

.teacher-schedule-excel-day {
    width: 54px;
    min-width: 54px;
    padding: 6px 4px !important;
    font-weight: 700;
    font-size: 18px;
    text-transform: lowercase;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 3px;
}

.teacher-schedule-excel-day-1 {
    background: #b7cce2;
}

.teacher-schedule-excel-day-2 {
    background: #d8e8bd;
}

.teacher-schedule-excel-day-3 {
    background: #ffd9b0;
}

.teacher-schedule-excel-day-4 {
    background: #d9e7ff;
}

.teacher-schedule-excel-day-5 {
    background: #ead7ff;
}

.teacher-schedule-excel-day-6,
.teacher-schedule-excel-day-7 {
    background: #eeeeee;
}

.teacher-schedule-excel-time {
    width: 120px;
    min-width: 120px;
    height: 44px;
    color: #ff0000;
    font-weight: 700;
    font-size: 15px;
    background: #ffffff;
}

.teacher-schedule-excel-number {
    width: 84px;
    min-width: 84px;
    color: #ff0000;
    font-weight: 700;
    font-size: 15px;
    background: #ffffff;
}

.teacher-schedule-excel-cell {
    width: 150px;
    min-width: 150px;
    height: 44px;
    background: #ffffff;
}

.teacher-schedule-excel-cell-empty {
    background: #ffffff;
}

.teacher-schedule-excel-lesson {
    display: flex;
    min-height: 44px;
    height: 100%;
    padding: 4px 6px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-sizing: border-box;
    line-height: 1.12;
    word-break: break-word;
}

.teacher-schedule-excel-subject {
    font-size: 15px;
    font-weight: 700;
}

.teacher-schedule-excel-room,
.teacher-schedule-excel-note {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 400;
}

.teacher-schedule-excel-separator td {
    height: 10px;
    background: #fff200;
}

.teacher-schedule-excel-empty {
    min-width: 320px;
    padding: 18px !important;
    font-family: inherit;
    font-size: 15px;
    background: #ffffff;
}

.teacher-schedule-subject-1 {
    background: #15aee0;
}

.teacher-schedule-subject-2 {
    background: #ffbf00;
}

.teacher-schedule-subject-3 {
    background: #e7d2d2;
}

.teacher-schedule-subject-4 {
    background: #d8d4bd;
}

.teacher-schedule-subject-5 {
    background: #ff0b0b;
}

.teacher-schedule-subject-6 {
    background: #9ad0dc;
}

.teacher-schedule-subject-7 {
    background: #c7d99c;
}

.teacher-schedule-subject-8 {
    background: #f6c193;
}

.teacher-schedule-subject-9 {
    background: #16b35c;
}

.teacher-schedule-subject-10 {
    background: #8c3bbd;
    color: #000000;
}

.teacher-schedule-subject-11 {
    background: #18e0b3;
}

.teacher-schedule-subject-12 {
    background: #ee82ee;
}

@media (max-width: 768px) {
    .schedule-view-toggle {
        justify-content: flex-start;
        width: 100%;
    }

    .teacher-schedule-excel-table th {
        font-size: 14px;
    }

    .teacher-schedule-excel-subject {
        font-size: 13px;
    }

    .teacher-schedule-excel-class-head,
    .teacher-schedule-excel-cell {
        width: 128px;
        min-width: 128px;
    }
}

/* =========================================================
   Teacher schedule Excel sticky header and colored cells
   ========================================================= */

.teacher-schedule-excel-scroll {
    max-height: calc(100vh - 260px);
    overflow: auto;
    position: relative;
    border: 2px solid #000000;
    background: #ffffff;
}

.teacher-schedule-excel-table {
    border-collapse: separate;
    border-spacing: 0;
}

.teacher-schedule-excel-table th,
.teacher-schedule-excel-table td {
    border-right: 2px solid #000000;
    border-bottom: 2px solid #000000;
}

.teacher-schedule-excel-table th:first-child,
.teacher-schedule-excel-table td:first-child {
    border-left: 2px solid #000000;
}

.teacher-schedule-excel-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    border-top: 2px solid #000000;
    background: #fff200;
    box-shadow: 0 3px 0 #000000;
}

.teacher-schedule-excel-day,
.teacher-schedule-excel-time,
.teacher-schedule-excel-number {
    position: sticky;
    z-index: 12;
}

.teacher-schedule-excel-day,
.teacher-schedule-excel-table thead .teacher-schedule-excel-day-col {
    left: 0;
}

.teacher-schedule-excel-time,
.teacher-schedule-excel-table thead .teacher-schedule-excel-time-col {
    left: 54px;
}

.teacher-schedule-excel-number,
.teacher-schedule-excel-table thead .teacher-schedule-excel-number-col {
    left: 174px;
}

.teacher-schedule-excel-table thead .teacher-schedule-excel-day-col,
.teacher-schedule-excel-table thead .teacher-schedule-excel-time-col,
.teacher-schedule-excel-table thead .teacher-schedule-excel-number-col {
    position: sticky;
    z-index: 30;
    background: #fff200;
}

.teacher-schedule-excel-day {
    box-shadow: 4px 0 0 #000000;
}

.teacher-schedule-excel-time {
    box-shadow: 4px 0 0 #000000;
}

.teacher-schedule-excel-number {
    box-shadow: 5px 0 0 #000000;
}

.teacher-schedule-excel-class-head,
.teacher-schedule-excel-cell {
    border-left: 3px solid #000000 !important;
}

.teacher-schedule-excel-class-head:nth-child(even),
.teacher-schedule-excel-cell:nth-child(even) {
    border-left-width: 4px !important;
}

.teacher-schedule-excel-lesson {
    width: 100%;
    min-height: 44px;
    height: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    padding: 4px 6px;
    box-shadow: none;
    color: #000000;
    font-family: "Times New Roman", Times, serif;
    cursor: pointer;
}

.teacher-schedule-excel-lesson:hover {
    filter: brightness(0.94);
    outline: 3px solid rgba(37, 99, 235, 0.55);
    outline-offset: -3px;
}

.teacher-schedule-excel-lesson:focus {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.teacher-schedule-excel-cell {
    padding: 0 !important;
}

.teacher-schedule-excel-cell .teacher-schedule-excel-lesson + .teacher-schedule-excel-lesson {
    border-top: 2px solid #000000;
}

.teacher-schedule-excel-separator td {
    position: relative;
    z-index: 1;
    height: 12px;
    background: #fff200;
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
}

@media (max-width: 768px) {
    .teacher-schedule-excel-scroll {
        max-height: calc(100vh - 220px);
    }

    .teacher-schedule-excel-time,
    .teacher-schedule-excel-table thead .teacher-schedule-excel-time-col {
        left: 54px;
    }

    .teacher-schedule-excel-number,
    .teacher-schedule-excel-table thead .teacher-schedule-excel-number-col {
        left: 174px;
    }
}

/* =========================================================
   Teacher schedule Excel fixed final override
   ========================================================= */

.teacher-schedule-excel-wrap {
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
}

.teacher-schedule-excel-scroll {
    width: 100%;
    max-width: 100%;
    max-height: none !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    position: relative;
    border: 3px solid #000000 !important;
    border-radius: 0 !important;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.teacher-schedule-excel-table {
    width: max-content !important;
    min-width: 100%;
    table-layout: fixed;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    font-family: "Times New Roman", Times, serif;
    color: #000000;
}

.teacher-schedule-excel-table th,
.teacher-schedule-excel-table td {
    padding: 0 !important;
    text-align: center !important;
    vertical-align: middle !important;
    border-top: 0 !important;
    border-right: 2px solid #000000 !important;
    border-bottom: 2px solid #000000 !important;
    border-left: 0 !important;
}

.teacher-schedule-excel-table th:first-child,
.teacher-schedule-excel-table td:first-child {
    border-left: 2px solid #000000 !important;
}

.teacher-schedule-excel-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
}

.teacher-schedule-excel-table thead th {
    position: sticky !important;
    top: 0 !important;
    z-index: 110 !important;
    height: 38px;
    background: #fff200 !important;
    color: #000000 !important;
    font-size: 16px;
    font-weight: 900;
    border-top: 2px solid #000000 !important;
    border-bottom: 4px solid #000000 !important;
    box-shadow: 0 4px 0 #000000;
}

.teacher-schedule-excel-day-col,
.teacher-schedule-excel-day {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
}

.teacher-schedule-excel-time-col,
.teacher-schedule-excel-time {
    width: 120px !important;
    min-width: 120px !important;
    max-width: 120px !important;
}

.teacher-schedule-excel-number-col,
.teacher-schedule-excel-number {
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
}

.teacher-schedule-excel-class-head,
.teacher-schedule-excel-class-cell {
    width: 160px !important;
    min-width: 160px !important;
    max-width: 160px !important;
}

.teacher-schedule-excel-day,
.teacher-schedule-excel-time,
.teacher-schedule-excel-number {
    position: sticky !important;
    z-index: 70 !important;
    background-clip: padding-box;
}

.teacher-schedule-excel-day-col,
.teacher-schedule-excel-day {
    left: 0 !important;
}

.teacher-schedule-excel-time-col,
.teacher-schedule-excel-time {
    left: 54px !important;
}

.teacher-schedule-excel-number-col,
.teacher-schedule-excel-number {
    left: 174px !important;
}

.teacher-schedule-excel-table thead .teacher-schedule-excel-day-col,
.teacher-schedule-excel-table thead .teacher-schedule-excel-time-col,
.teacher-schedule-excel-table thead .teacher-schedule-excel-number-col {
    z-index: 130 !important;
    background: #fff200 !important;
}

.teacher-schedule-excel-day {
    padding: 6px 4px !important;
    font-weight: 900;
    font-size: 18px;
    text-transform: lowercase;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 3px;
    border-right: 4px solid #000000 !important;
}

.teacher-schedule-excel-time {
    height: 48px;
    color: #ff0000 !important;
    font-size: 15px;
    font-weight: 900;
    background: #ffffff !important;
    border-right: 3px solid #000000 !important;
}

.teacher-schedule-excel-number {
    color: #ff0000 !important;
    font-size: 15px;
    font-weight: 900;
    background: #ffffff !important;
    border-right: 5px solid #000000 !important;
}

.teacher-schedule-excel-class-head {
    border-left: 4px solid #000000 !important;
    border-right: 4px solid #000000 !important;
}

.teacher-schedule-excel-class-cell {
    height: 48px;
    background: #ffffff;
    border-left: 4px solid #000000 !important;
    border-right: 4px solid #000000 !important;
}

.teacher-schedule-excel-class-cell + .teacher-schedule-excel-class-cell {
    border-left: 5px solid #000000 !important;
}

.teacher-schedule-excel-cell-empty {
    background:
        repeating-linear-gradient(
            135deg,
            #ffffff 0,
            #ffffff 8px,
            #f3f4f6 8px,
            #f3f4f6 10px
        ) !important;
}

.teacher-schedule-excel-lesson {
    display: flex;
    width: 100%;
    min-height: 48px;
    height: 100%;
    margin: 0;
    padding: 4px 6px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #000000 !important;
    font-family: "Times New Roman", Times, serif;
    line-height: 1.12;
    word-break: break-word;
    cursor: pointer;
}

.teacher-schedule-excel-cell .teacher-schedule-excel-lesson + .teacher-schedule-excel-lesson {
    border-top: 2px solid #000000 !important;
}

.teacher-schedule-excel-lesson:hover {
    filter: brightness(0.94);
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.teacher-schedule-excel-lesson:focus {
    outline: 3px solid #2563eb;
    outline-offset: -3px;
}

.teacher-schedule-excel-subject {
    font-size: 15px;
    font-weight: 900;
}

.teacher-schedule-excel-room,
.teacher-schedule-excel-note {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 700;
}

.teacher-schedule-excel-separator td {
    height: 14px !important;
    background: #fff200 !important;
    border-top: 3px solid #000000 !important;
    border-bottom: 3px solid #000000 !important;
}

.teacher-schedule-excel-empty {
    min-width: 320px;
    padding: 18px !important;
    font-family: inherit;
    font-size: 15px;
    background: #ffffff;
}

@media (max-width: 768px) {
    .teacher-schedule-excel-class-head,
    .teacher-schedule-excel-class-cell {
        width: 136px !important;
        min-width: 136px !important;
        max-width: 136px !important;
    }

    .teacher-schedule-excel-table thead th {
        font-size: 14px;
    }

    .teacher-schedule-excel-subject {
        font-size: 13px;
    }
}

/* =========================================================
   Main schedule Excel compact override
   ========================================================= */

#schedule-excel-section .teacher-schedule-excel-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible !important;
}

#schedule-excel-section .teacher-schedule-excel-table {
    width: max-content !important;
    min-width: 100%;
    table-layout: fixed !important;
}

#schedule-excel-section .teacher-schedule-excel-class-head,
#schedule-excel-section .teacher-schedule-excel-class-cell {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
}

#schedule-excel-section .teacher-schedule-excel-time {
    height: 46px !important;
}

#schedule-excel-section .teacher-schedule-excel-class-cell {
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    overflow: hidden !important;
}

#schedule-excel-section .teacher-schedule-excel-lesson {
    min-height: 46px !important;
    height: 46px !important;
    max-height: 46px !important;
    overflow: hidden !important;
    padding: 3px 5px !important;
}

#schedule-excel-section .teacher-schedule-excel-subject {
    max-width: 100%;
    font-size: 14px !important;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
}

#schedule-excel-section .teacher-schedule-excel-room,
#schedule-excel-section .teacher-schedule-excel-note {
    max-width: 100%;
    margin-top: 1px !important;
    font-size: 10px !important;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#schedule-excel-section .teacher-schedule-excel-cell .teacher-schedule-excel-lesson + .teacher-schedule-excel-lesson {
    border-top: 2px solid #000000 !important;
}

#schedule-excel-section .teacher-schedule-excel-lesson:hover {
    height: auto !important;
    min-height: 46px !important;
    max-height: none !important;
    overflow: visible !important;
    position: relative;
    z-index: 20;
}

#schedule-excel-section .teacher-schedule-excel-lesson:hover .teacher-schedule-excel-room,
#schedule-excel-section .teacher-schedule-excel-lesson:hover .teacher-schedule-excel-note,
#schedule-excel-section .teacher-schedule-excel-lesson:hover .teacher-schedule-excel-subject {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

@media (max-width: 768px) {
    #schedule-excel-section .teacher-schedule-excel-class-head,
    #schedule-excel-section .teacher-schedule-excel-class-cell {
        width: 128px !important;
        min-width: 128px !important;
        max-width: 128px !important;
    }

    #schedule-excel-section .teacher-schedule-excel-subject {
        font-size: 12px !important;
    }

    #schedule-excel-section .teacher-schedule-excel-room,
    #schedule-excel-section .teacher-schedule-excel-note {
        font-size: 9px !important;
    }
}
/* Плашка о тесте / оплате подписки (showSubscriptionBanner в app.js) */
.subscription-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid #fde68a;
    background: #fef3c7;
    color: #78350f;
    font-weight: 700;
}

.subscription-banner-info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
}

.subscription-banner-bad {
    border-color: #fecaca;
    background: #fee2e2;
    color: #7f1d1d;
}

.subscription-banner .button-link {
    margin-top: 0;
    white-space: nowrap;
}

/* Опросы (survey_runner.js) */
body.survey-open { overflow: hidden; }
.survey-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
    margin-bottom: 18px; padding: 12px 16px; border-radius: 14px;
    border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a;
}
.survey-banner-actions { display: inline-flex; gap: 8px; }
.survey-overlay {
    position: fixed; inset: 0; z-index: 10000; background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.survey-dialog {
    background: var(--card, #fff); color: var(--text, #0f172a); width: 100%; max-width: 720px; max-height: calc(100vh - 32px);
    border-radius: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35); display: flex; flex-direction: column; overflow: hidden;
}
.survey-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 8px; }
.survey-head h2 { margin: 4px 0 0; font-size: 22px; }
.survey-step { font-size: 13px; color: var(--muted, #64748b); font-weight: 700; }
.survey-anon { color: #15803d; }
.survey-close { background: transparent; color: var(--muted, #64748b); font-size: 28px; line-height: 1; padding: 0 6px; box-shadow: none; }
.survey-progress { height: 4px; background: #e2e8f0; margin: 0 22px; border-radius: 999px; overflow: hidden; }
.survey-progress span { display: block; height: 100%; background: #f59e0b; transition: width .2s; }
.survey-body { padding: 14px 22px; overflow-y: auto; flex: 1; }
.survey-body h3 { margin: 6px 0 4px; }
.survey-intro { background: #fffbeb; border-radius: 12px; padding: 10px 14px; }
.survey-group { border: 1px solid var(--border, #e2e8f0); border-radius: 16px; padding: 12px 14px; margin: 12px 0; }
.survey-group-title { font-weight: 900; }
.survey-group-sub { font-size: 13px; color: var(--muted, #64748b); margin-bottom: 4px; }
.survey-item { margin: 14px 0; }
.survey-question { font-weight: 700; margin-bottom: 8px; }
.survey-optional { font-weight: 400; font-size: 12px; color: var(--muted, #64748b); }
.survey-nps-row { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 4px; }
.survey-nps { padding: 10px 0; border-radius: 10px; background: #f1f5f9; color: #0f172a; box-shadow: none; font-weight: 800; }
.survey-nps.is-on.low { background: #ef4444; color: #fff; }
.survey-nps.is-on.mid { background: #f59e0b; color: #fff; }
.survey-nps.is-on.high { background: #16a34a; color: #fff; }
.survey-scale-hint { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted, #64748b); margin-top: 4px; }
.survey-stars { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.survey-star { background: transparent; box-shadow: none; color: #cbd5e1; font-size: 32px; padding: 0 2px; line-height: 1; }
.survey-star.is-on { color: #f59e0b; }
.survey-star-label { margin-left: 8px; font-weight: 700; color: var(--muted, #64748b); }
.survey-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.survey-chip { background: #f1f5f9; color: #0f172a; box-shadow: none; border: 1px solid #e2e8f0; border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.survey-chip.small { padding: 6px 10px; font-size: 13px; }
.survey-chip.is-on { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
.survey-followup { margin-top: 10px; padding: 10px 12px; background: #fef2f2; border-radius: 12px; }
.survey-followup-title { font-weight: 700; margin-bottom: 6px; color: #991b1b; }
.survey-text { width: 100%; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 10px 12px; font: inherit; resize: vertical; box-sizing: border-box; }
.survey-error { color: #b91c1c; font-weight: 700; padding: 0 22px; }
.survey-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 22px 18px; border-top: 1px solid var(--border, #e2e8f0); }
.survey-foot-left, .survey-foot-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.survey-foot button[disabled] { opacity: .5; cursor: not-allowed; }
.survey-link { background: transparent; box-shadow: none; color: var(--muted, #64748b); text-decoration: underline; padding: 6px; font-weight: 400; }
.survey-thanks { text-align: center; padding: 28px 22px 0; }
.survey-thanks-icon { width: 64px; height: 64px; border-radius: 50%; background: #dcfce7; color: #16a34a; font-size: 36px; line-height: 64px; margin: 0 auto; }
.survey-links { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.survey-referral { margin: 16px auto; max-width: 420px; display: grid; gap: 8px; text-align: left; }
.survey-referral input { padding: 8px 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; }
@media (max-width: 600px) {
    .survey-overlay { padding: 0; align-items: stretch; }
    .survey-dialog { max-height: 100vh; border-radius: 0; }
    .survey-nps-row { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
