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

:root {
    --bg: #eef2f7;
    --white: #ffffff;
    --sidebar-bg: #ffffff;
    --primary: #3b7ddd;
    --primary-dark: #2a5fad;
    --primary-light: #e8f0fe;
    --text: #2d3748;
    --text-light: #718096;
    --text-muted: #a0aec0;
    --border: #e2e8f0;
    --green: #48bb78;
    --green-light: #f0fff4;
    --green-bg: #c6f6d5;
    --yellow: #ecc94b;
    --yellow-light: #fffff0;
    --yellow-bg: #fefcbf;
    --purple: #9f7aea;
    --purple-light: #faf5ff;
    --red: #fc8181;
    --red-light: #fff5f5;
    --blue-event: #63b3ed;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --radius-lg: 16px;
    --sidebar-width: 300px;
    --right-sidebar-width: 380px;
}

body {
    font-family: 'Nunito', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

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

img {
    max-width: 100%;
    height: auto;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    min-width: 0;
}

.content-area {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 0 24px 24px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.right-sidebar {
    width: var(--right-sidebar-width);
    flex-shrink: 0;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow: visible;
}

.sidebar-header {
    padding: 20px 16px 12px;
    text-align: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.sidebar-logo-link {
    display: inline-block;
}

.sidebar-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    margin-bottom: 10px;
    transition: transform 0.2s;
}

.sidebar-logo-link:hover .sidebar-logo {
    transform: scale(1.05);
}

.sidebar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.5px;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.sidebar-school {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
    line-height: 1.3;
}

.sidebar-municipality {
    font-size: 10px;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1 1 auto;
    padding: 8px 12px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.sidebar-nav .sidebar-header {
    padding: 20px 4px 12px;
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
    position: relative;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-illustration {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%) translateY(6%);
    width: 200px;
    max-width: 200px;
    z-index: 0;
    pointer-events: none;
    line-height: 0;
}

.sidebar-illustration img {
    width: 200px;
    max-width: 200px;
    height: auto;
    display: block;
}

/* Header */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 24px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.page-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-dark);
    letter-spacing: 1px;
}

.grade-switch-link {
    font-size: 10px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    line-height: 1.25;
}

.grade-switch-link:hover {
    text-decoration: underline;
}

.page-title-home-link {
    color: inherit;
    text-decoration: none;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: var(--text-light);
    transition: background 0.2s;
}

.header-icon-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #e53e3e;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-ask-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
}

.header-ask-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 10px;
    cursor: pointer;
    position: relative;
}

.header-profile:hover {
    background: var(--bg);
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-role {
    font-size: 11px;
    color: var(--text-muted);
}

.profile-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

/* Welcome Hero */
.welcome-hero {
    background: linear-gradient(rgba(255,255,255,0.75), rgba(255,255,255,0.82)), url('../background.png') center/cover no-repeat;
    border-radius: var(--radius-lg);
    padding: 18px 40px;
    margin-bottom: 14px;
    min-height: 110px;
    display: flex;
    align-items: center;
    width: 100%;
}

.welcome-text {
    width: 100%;
}

.welcome-text h2 {
    font-size: 34px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
    line-height: 1.2;
}

.welcome-text p {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    max-width: 100%;
    line-height: 1.5;
}

/* Quick Cards */
.quick-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 16px;
}

.quick-card {
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    min-height: 140px;
}

.quick-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.quick-card img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    margin-bottom: 12px;
}

.quick-card h3 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}

.quick-card p {
    font-size: 14px;
    opacity: 0.85;
    line-height: 1.4;
}

.quick-card.green { background: #d1fae5; color: #065f46; }
.quick-card.yellow { background: #fef3c7; color: #92400e; }
.quick-card.purple { background: #ede9fe; color: #5b21b6; }
.quick-card.blue { background: #dbeafe; color: #1e40af; }

/* Section Cards */
.section-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.section-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0;
}

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

.see-all-inline {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.see-all-inline:hover {
    text-decoration: underline;
}

/* Materials List */
.materials-list {
    list-style: none;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.material-item:last-child {
    border-bottom: none;
}

.material-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}

.material-info {
    flex: 1;
    min-width: 0;
}

.material-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.material-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-view {
    padding: 6px 16px;
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-view:hover {
    background: var(--primary);
    color: white;
}

/* Homework List */
.homework-list {
    list-style: none;
}

.homework-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.homework-item:last-child {
    border-bottom: none;
}

.homework-icon {
    width: 36px;
    height: 36px;
    background: var(--green-light);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.homework-icon svg {
    color: var(--green);
}

.homework-info {
    flex: 1;
}

.homework-info h4 {
    font-size: 14px;
    font-weight: 600;
}

.homework-due {
    font-size: 12px;
    color: var(--text-muted);
}

.badge-active {
    padding: 4px 12px;
    background: var(--green-bg);
    color: #22543d;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge-expired {
    padding: 4px 12px;
    background: #fed7d7;
    color: #9b2c2c;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-past {
    padding: 4px 12px;
    background: #e2e8f0;
    color: #718096;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.homework-item.homework-past {
    opacity: 0.65;
}

.homework-item.homework-past .homework-info h4,
.homework-item.homework-past .homework-due {
    color: var(--text-muted);
}

/* Two Column Grid */
.two-col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 14px;
}

/* Bottom Promo Cards */
.promo-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 10px;
}

.promo-card {
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.promo-card.blue-bg {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
}

.promo-card.green-bg {
    background: linear-gradient(135deg, #d1fae5, #ecfdf5);
}

.promo-text h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.promo-text p {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.promo-card img {
    width: 100px;
    height: auto;
    flex-shrink: 0;
}

.btn-primary {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-green {
    background: var(--green);
}

.btn-green:hover {
    background: #38a169;
}

/* Calendar Widget */
.calendar-subscribe-box {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-top: 24px;
    box-shadow: var(--shadow);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.calendar-subscribe-text h3 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 800;
    color: var(--primary-dark);
}

.calendar-subscribe-text p {
    margin: 0;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

.calendar-video-help {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 6px;
    font-size: 13px;
    font-weight: 800;
    color: #c53030;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
}

.calendar-video-help:hover {
    background: #fed7d7;
}

.calendar-video-help.is-disabled {
    opacity: 0.55;
    cursor: default;
    color: #9b2c2c;
}

.calendar-subscribe-steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.calendar-subscribe-steps li {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.calendar-subscribe-steps strong {
    color: var(--primary-dark);
}

.calendar-feed-copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 8px;
}

.calendar-feed-url {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
}

.calendar-feed-copy-row .btn-sm {
    flex-shrink: 0;
}

.calendar-addbyurl-btn {
    display: inline-flex;
    margin-top: 8px;
    text-align: center;
    justify-content: center;
}

.calendar-subscribe-extra {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding-top: 4px;
    border-top: 1px solid #bbf7d0;
}

.calendar-subscribe-download {
    font-size: 12px;
    font-weight: 700;
}

.calendar-subscribe-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.upcoming-events--mobile {
    display: none;
}

.calendar-widget {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.calendar-header h3 {
    font-size: 15px;
    font-weight: 700;
}

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

.cal-nav-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-light);
    transition: background 0.2s;
}

.cal-nav-btn:hover {
    background: var(--bg);
}

.cal-month {
    font-size: 13px;
    font-weight: 600;
    min-width: 100px;
    text-align: center;
}

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 10px;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }
.dot-blue { background: var(--blue-event); }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
}

.cal-day-name {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 4px 0;
}

.cal-day {
    font-size: 12px;
    padding: 6px 2px;
    border-radius: 6px;
    position: relative;
}

.cal-day.empty {
    visibility: hidden;
}

.cal-day.today {
    background: var(--primary-light);
    font-weight: 700;
    color: var(--primary);
}

.cal-day.has-event {
    font-weight: 700;
}

.cal-day.event-yellow { background: var(--yellow-bg); color: #744210; }
.cal-day.event-red { background: #fed7d7; color: #9b2c2c; }
.cal-day.event-blue { background: #bee3f8; color: #2a4365; }

/* Upcoming Events */
.upcoming-events {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
}

.upcoming-events h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.events-list {
    list-style: none;
}

.event-item {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

.event-item:last-child {
    border-bottom: none;
}

.event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
}

.event-item.event-yellow .event-dot { background: var(--yellow); }
.event-item.event-red .event-dot { background: var(--red); }
.event-item.event-blue .event-dot { background: var(--blue-event); }

.event-info strong {
    display: block;
    font-size: 12px;
    margin-bottom: 2px;
}

.event-info span {
    color: var(--text-muted);
    font-size: 11px;
}

.see-all-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

.see-all-link:hover {
    text-decoration: underline;
}

.no-events {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 0;
}

/* Footer */
.site-footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 12px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--white);
}

/* Page Content Styles */
.page-header {
    margin-bottom: 28px;
    text-align: center;
    padding-top: 20px;
}

.page-header h2 {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary-dark);
}

.page-header p {
    font-size: 15px;
    color: var(--text-light);
    margin-top: 6px;
}

/* Forms */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow);
    max-width: 600px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.15);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
}

.alert-success {
    background: var(--green-light);
    color: #22543d;
    border: 1px solid var(--green-bg);
}

.alert-error {
    background: var(--red-light);
    color: #9b2c2c;
    border: 1px solid #fed7d7;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: var(--white);
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.gallery-caption {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
}

/* Links List */
.links-list {
    list-style: none;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    transition: transform 0.2s;
}

.link-item:hover {
    transform: translateX(4px);
}

.link-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 18px;
    flex-shrink: 0;
}

.link-info h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

.link-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* About Page */
.about-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow);
    line-height: 1.8;
}

.about-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 0 10px;
    color: var(--primary-dark);
}

.about-content h3:first-child {
    margin-top: 0;
}

.about-content p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.legal-content ul {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 12px 20px;
    line-height: 1.8;
}

.legal-content a {
    color: var(--primary);
    font-weight: 600;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* Announcements */
.announcement-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    border-left: 4px solid var(--purple);
}

.announcement-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.announcement-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.announcement-card p {
    font-size: 14px;
    color: var(--text-light);
    line-height: 1.6;
}

/* Quiz Placeholder */
.quiz-placeholder {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 48px;
    text-align: center;
    box-shadow: var(--shadow);
}

.quiz-placeholder img {
    width: 120px;
    margin-bottom: 20px;
}

.quiz-placeholder h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.quiz-placeholder p {
    font-size: 14px;
    color: var(--text-light);
    max-width: 400px;
    margin: 0 auto;
}

/* Quiz list + player */
.quiz-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.quiz-card-body {
    flex: 1;
    min-width: 0;
}

.quiz-card-body h3 {
    margin-bottom: 6px;
}

.quiz-card-body .hashtag {
    display: inline-block;
    margin-bottom: 8px;
}

.quiz-card-body p {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.quiz-card-meta {
    font-size: 12px !important;
    color: var(--text-muted) !important;
    margin-bottom: 0 !important;
}

.quiz-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.quiz-player {
    max-width: 820px;
    margin: 0 auto;
}

.quiz-player-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.quiz-back {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
}

.quiz-back:hover {
    text-decoration: underline;
}

.quiz-progress-meta {
    display: flex;
    gap: 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
}

.quiz-progress {
    height: 8px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 18px;
}

.quiz-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #60a5fa);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.quiz-player-header {
    margin-bottom: 16px;
}

.quiz-player-header h3 {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.quiz-topics {
    background: var(--primary-light);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
}

.quiz-topics h4 {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--primary-dark);
}

.quiz-topics ul {
    list-style: none;
    display: grid;
    gap: 6px;
}

.quiz-topics li {
    font-size: 14px;
    color: var(--text);
}

.quiz-intro .btn-quiz-start {
    margin-top: 8px;
}

.quiz-round-banner {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 18px;
}

.quiz-round-banner strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.quiz-round-banner p {
    font-size: 13px;
    color: var(--text-light);
    margin: 0;
}

.quiz-section-intro {
    text-align: center;
    padding: 20px 8px;
}

.quiz-round-label {
    font-size: 12px;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.quiz-section-intro h3 {
    font-size: 22px;
    margin-bottom: 10px;
}

.quiz-section-intro p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.quiz-question-text {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.45;
    margin-bottom: 16px;
    color: var(--text);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quiz-options-row {
    flex-direction: row;
    flex-wrap: wrap;
}

.quiz-options-row .quiz-option {
    flex: 1;
    min-width: 140px;
    justify-content: center;
}

.quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--white);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-option.is-correct {
    border-color: var(--green);
    background: var(--green-light);
}

.quiz-option.is-wrong {
    border-color: var(--red);
    background: var(--red-light);
}

.quiz-option.is-selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.quiz-option.is-correct .quiz-option-letter {
    background: var(--green-bg);
    color: #276749;
}

.quiz-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.quiz-short textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 12px;
}

.quiz-short textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.15);
}

.quiz-notebook {
    background: #fffbeb;
    border: 1px dashed #f6ad55;
    color: #9c4221;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 16px;
}

.quiz-visual {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    margin-bottom: 16px;
}

.quiz-visual-caption {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    margin: 0 0 10px;
}

.quiz-visual-start {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.quiz-steps {
    list-style: none;
    display: grid;
    gap: 8px;
    margin: 0;
}

.quiz-steps li {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
}

.quiz-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 12px;
    font-weight: 800;
    flex-shrink: 0;
}

.quiz-table-wrap {
    overflow-x: auto;
}

.quiz-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    font-size: 14px;
}

.quiz-table th,
.quiz-table td {
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: center;
}

.quiz-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 800;
}

.quiz-legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 10px;
}

.quiz-pixels {
    display: grid;
    gap: 4px;
    justify-content: center;
}

.quiz-pixel {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    border: 1px solid var(--border);
}

.quiz-pixel.is-off {
    background: #fff;
    color: #a0aec0;
}

.quiz-pixel.is-on {
    background: #1a202c;
    color: #edf2f7;
    border-color: #1a202c;
}

.quiz-queue {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.quiz-queue-item {
    min-width: 48px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--white);
    border: 2px solid var(--primary);
    font-weight: 800;
    text-align: center;
}

.quiz-queue-arrow {
    color: var(--primary);
    font-weight: 800;
}

.quiz-bits {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.quiz-bit {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 56px;
}

.quiz-bit-place {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-light);
}

.quiz-bit-dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: 2px solid var(--border);
    background: var(--white);
}

.quiz-bit-val {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 800;
}

.quiz-formula {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-weight: 700;
    text-align: center;
    background: var(--white);
    border-radius: 10px;
    padding: 12px;
}

.quiz-cardlets,
.quiz-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.quiz-cardlet {
    min-width: 110px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.quiz-cardlet strong {
    font-size: 14px;
}

.quiz-cardlet span {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 700;
}

.quiz-chip {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 700;
}

@media (max-width: 640px) {
    .quiz-match-grid {
        grid-template-columns: 1fr;
    }
}

.quiz-match-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}

.quiz-match-col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-match-item {
    text-align: left;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.quiz-match-item:hover:not(:disabled) {
    border-color: var(--primary);
}

.quiz-match-item.is-active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-match-item.is-paired {
    border-color: #93c5fd;
    background: #eff6ff;
}

.quiz-match-item.is-correct {
    border-color: var(--green);
    background: var(--green-light);
}

.quiz-match-item.is-wrong {
    border-color: var(--red);
    background: var(--red-light);
}

.quiz-match-pairs {
    margin-bottom: 12px;
    font-size: 13px;
}

.quiz-match-pairs ul {
    list-style: none;
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
}

.quiz-link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.quiz-link-btn:hover {
    text-decoration: underline;
}

.quiz-feedback {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.quiz-feedback.is-ok {
    background: var(--green-light);
    color: #276749;
    border: 1px solid var(--green-bg);
}

.quiz-feedback.is-bad {
    background: var(--red-light);
    color: #9b2c2c;
    border: 1px solid #feb2b2;
}

.quiz-feedback .quiz-extra {
    margin-top: 8px;
    font-weight: 700;
}

.quiz-actions {
    margin-top: 16px;
}

.quiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.quiz-nav-btn {
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--white);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.quiz-nav-btn:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

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

.quiz-nav-next-slot {
    margin-left: auto;
}

.quiz-match-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
}

.quiz-mistakes {
    text-align: left;
    margin: 24px 0 8px;
    padding: 16px 18px;
    background: var(--red-light);
    border: 1px solid #feb2b2;
    border-radius: var(--radius);
}

.quiz-mistakes h4 {
    font-size: 16px;
    font-weight: 800;
    color: #9b2c2c;
    margin-bottom: 12px;
}

.quiz-mistakes ol {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 14px;
}

.quiz-mistakes li {
    font-size: 14px;
    color: var(--text);
}

.quiz-mistake-section {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #c53030;
    margin-bottom: 4px;
}

.quiz-mistake-q {
    font-weight: 700;
    margin-bottom: 6px;
}

.quiz-mistake-note {
    margin-top: 4px;
    color: var(--text-light);
    font-size: 13px;
}

.quiz-mistakes-empty {
    margin: 18px 0;
    font-weight: 700;
    color: #276749;
}

.quiz-results {
    text-align: center;
}

.quiz-results h3 {
    font-size: 22px;
    margin-bottom: 18px;
}

.quiz-score-circle {
    width: 140px;
    height: 140px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 30%, #dbeafe, #eff6ff 55%, #f8fafc);
    border: 4px solid #93c5fd;
}

.quiz-score-circle strong {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary-dark);
    line-height: 1.1;
}

.quiz-score-circle span {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-light);
}

.quiz-results-mood {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.quiz-results-traffic {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.quiz-results-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 18px;
    align-items: center;
}

@media (max-width: 700px) {
    .quiz-card {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-card .btn-primary {
        text-align: center;
    }

    .quiz-match-grid {
        grid-template-columns: 1fr;
    }

    .quiz-options-row {
        flex-direction: column;
    }
}

/* Calendar Full Page */
.calendar-full {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.calendar-widget { padding: 24px; }
.calendar-widget .calendar-header h3 { font-size: 17px; }
.calendar-widget .cal-month { font-size: 15px; font-weight: 700; }
.calendar-widget .cal-day { font-size: 14px; padding: 9px 3px; min-height: 34px; }
.calendar-widget .cal-day-name { font-size: 12px; }
.calendar-widget .calendar-legend-inline { font-size: 11px; margin-bottom: 10px; }
.calendar-widget .calendar-legend-inline .legend-item { font-size: 11px; font-weight: 700; color: #000; }
.material-actions { display: flex; gap: 6px; }
.btn-download { background: #edf2f7; color: var(--text); }
.btn-download:hover { background: var(--text); color: white; }

.calendar-header-widget {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}
.calendar-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}
.calendar-title-row h3 {
    margin: 0;
    font-size: 17px;
}
.calendar-legend-widget {
    justify-content: center;
    text-align: center;
}
.calendar-full .calendar-grid { gap: 6px; }
.calendar-grid-full .cal-day { min-height: 52px; font-size: 15px; padding: 10px 4px; }

.calendar-full .cal-day {
    padding: 12px 4px;
    min-height: 60px;
    font-size: 14px;
}

.event-detail-list {
    list-style: none;
    margin-top: 24px;
}

.event-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.event-detail-item:last-child {
    border-bottom: none;
}

.event-type-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.event-type-badge.test { background: #fed7d7; color: #9b2c2c; }
.event-type-badge.ispituvanje { background: var(--yellow-bg); color: #744210; }
.event-type-badge.activity { background: #bee3f8; color: #2a4365; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
}

/* Profile dropdown */
.profile-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 10px 14px;
    min-width: 260px;
    z-index: 200;
    margin-top: 6px;
}

.header-profile.open .profile-dropdown-menu { display: block; }
.header-profile.open .profile-arrow { transform: rotate(180deg); }
.profile-dropdown-menu a { color: var(--primary); font-size: 13px; font-weight: 600; word-break: break-all; }
.profile-dropdown-name {
    display: none;
}

/* Homework status dot */
.homework-status-wrap { display: flex; align-items: center; gap: 8px; }
.status-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--green); animation: pulse 1.5s infinite;
}
.days-left { color: #e53e3e; font-size: 12px; font-weight: 700; }
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

.homework-item.clickable { cursor: pointer; transition: background 0.2s; border-radius: 8px; }
.homework-item.clickable:hover { background: var(--bg); }

/* Announcement colors */
.announcement-red { border-left-color: #e53e3e !important; }
.announcement-yellow { border-left-color: var(--yellow) !important; }
.announcement-blue { border-left-color: var(--blue-event) !important; }
.announcement-purple { border-left-color: var(--purple); }
.announcement-card { cursor: pointer; transition: transform 0.2s; }
.announcement-card:hover { transform: translateY(-2px); }
.announcement-preview { font-size: 14px; color: var(--text-light); }

/* Search & Pagination */
.search-box {
    width: 100%; max-width: 400px; margin: 0 auto 20px; display: block;
    padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 15px; font-family: inherit;
}
.search-box:focus { outline: none; border-color: var(--primary); }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.page-link {
    padding: 8px 14px; border-radius: 8px; background: white;
    border: 1px solid var(--border); font-weight: 700; font-size: 14px;
}
.page-link.active, .page-link:hover { background: var(--primary); color: white; border-color: var(--primary); }

.hashtag { color: var(--primary); font-weight: 600; font-size: 11px; }

/* Modal */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: white; border-radius: 16px; padding: 28px; max-width: 560px;
    width: 100%; max-height: 80vh; overflow-y: auto; position: relative;
}
.modal-close {
    position: absolute; top: 12px; right: 16px; border: none; background: none;
    font-size: 28px; cursor: pointer; color: var(--text-muted);
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; padding-right: 30px; }
.modal-date { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.modal-content { font-size: 15px; line-height: 1.7; color: var(--text-light); }
.modal-content img { max-width: 100%; max-height: 200px; border-radius: 8px; margin: 8px 8px 8px 0; cursor: pointer; display: inline-block; vertical-align: top; }
.modal-content img:hover { opacity: 0.9; }
.modal-content a { color: var(--primary); font-weight: 600; }
.modal-content u { text-decoration: underline; }

/* Calendar enhancements */
.calendar-legend-inline {
    justify-content: center; gap: 14px; font-size: 12px; font-weight: 700;
    color: #000; margin-bottom: 14px;
}
.calendar-legend-inline .legend-item { font-size: 12px; }
.calendar-full .calendar-header {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
    margin-bottom: 16px;
}
.calendar-header-center {
    flex: 1;
    text-align: center;
}
.calendar-header-center h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}
.calendar-full .calendar-header h3 { font-size: 22px; font-weight: 800; }
.calendar-full .calendar-legend-inline { justify-content: center; margin-bottom: 0; }
.cal-day.has-event { cursor: pointer; }
.cal-day.has-event:hover { filter: brightness(0.95); transform: scale(1.05); }

.calendar-tooltip {
    display: none; position: absolute; background: #1a202c; color: white;
    padding: 8px 12px; border-radius: 8px; font-size: 12px; z-index: 300;
    max-width: 240px; pointer-events: none;
}

.event-detail-list {
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px; list-style: none;
}
.event-detail-item {
    background: var(--bg); border-radius: 10px; padding: 12px;
    display: flex; flex-direction: column; gap: 6px; border-bottom: none;
    font-size: 13px;
}
.event-detail-clickable {
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.event-detail-clickable:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}
.event-detail-item strong {
    font-size: 13px;
    line-height: 1.3;
}
.event-detail-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.event-detail-list.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}
.event-detail-list.cols-3 .event-detail-item {
    padding: 10px;
}
.event-detail-list.cols-3 .event-detail-item strong {
    font-size: 12px;
}
.event-detail-list.cols-3 .event-detail-date {
    font-size: 10px;
}

/* Izrabotki grid */
.izrabotki-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.izrabotka-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}
.izrabotka-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.izrabotka-thumb {
    aspect-ratio: 4/3;
    background: var(--bg);
    overflow: hidden;
}
.izrabotka-thumb img,
.izrabotka-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.izrabotka-body {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.izrabotka-body h4 {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}
.izrabotka-body p {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.4;
}
.izrabotka-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    margin-top: auto;
}

/* About QR */
.about-qr {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    text-align: center;
}
.about-qr h3 {
    margin-top: 0;
}
.about-qr-image {
    max-width: 180px;
    margin-top: 12px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.about-qr-placeholder {
    margin-top: 12px;
    padding: 24px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.event-title-short, .event-date-short { display: block; font-size: 11px; color: var(--text-muted); }

/* Ask teacher form */
.ask-teacher-wrap { max-width: 680px; margin: 0 auto; }
.ask-contact-box-bottom {
    text-align: center;
    margin-top: 24px;
    padding: 16px 20px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.ask-contact-box-bottom h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}
.ask-contact-box-bottom p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.ask-contact-box-bottom a {
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
}
.form-card.centered { margin: 0 auto; max-width: 680px; padding: 32px; }
.form-card.centered .form-group label { font-size: 15px; }
.form-card.centered .form-group input,
.form-card.centered .form-group textarea { font-size: 16px; padding: 14px 18px; }
.form-submit-center { text-align: center; margin-top: 8px; }
.form-submit-center .btn-primary { font-size: 16px; padding: 12px 28px; }
.char-counter { font-size: 12px; color: var(--text-muted); text-align: right; margin-top: 4px; }

/* TikTok gallery */
.gallery-tiktok {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}
.gallery-tiktok-item {
    aspect-ratio: 9/16; border-radius: 14px; overflow: hidden;
    box-shadow: var(--shadow-md); background: #000; position: relative;
}
.gallery-tiktok-item img,
.gallery-tiktok-item video {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.gallery-tiktok-caption {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 12px; background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white; font-size: 13px; font-weight: 600;
}

/* PDF viewer */
.pdf-viewer-wrap { background: white; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.pdf-viewer-wrap iframe { width: 100%; height: 75vh; border: none; }

/* Footer */
.site-footer a { color: var(--primary); font-weight: 600; }
.site-footer a:hover { text-decoration: underline; }
.site-footer p { margin: 0; }

/* Mobile menu */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--primary-dark);
    border-radius: 8px;
}
.mobile-menu-btn:hover { background: var(--primary-light); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
}
.sidebar-overlay.open { display: block; }

body.menu-open { overflow: hidden; }

@media (max-width: 1200px) {
    .quick-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .right-sidebar {
        display: none;
    }
}

/* Responsive - tablet (desktop layout unchanged above 1024px) */
@media (max-width: 1024px) {
    .sidebar-illustration {
        display: none;
    }

    .top-header {
        position: sticky;
        top: 0;
        z-index: 200;
        flex-wrap: nowrap;
        gap: 8px;
        padding: 10px 16px;
    }

    .page-title {
        flex: 1;
        min-width: 0;
        font-size: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .page-title-home-link {
        pointer-events: auto;
        cursor: pointer;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .grade-switch-link {
        font-size: 9px;
    }

    .header-actions {
        width: auto;
        flex-shrink: 0;
        flex-wrap: nowrap;
        gap: 8px;
    }

    .calendar-full .calendar-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
    }

    .calendar-header-center {
        flex: 1;
        min-width: 0;
        order: 0;
    }

    .calendar-full .calendar-header > .calendar-nav {
        flex-shrink: 0;
    }

    .calendar-full .calendar-header > .calendar-nav:first-child {
        order: -1;
    }

    .calendar-full .calendar-header > .calendar-nav:last-child {
        order: 1;
    }

    .calendar-header-center h3 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .calendar-legend-inline {
        flex-wrap: wrap;
        gap: 8px;
        font-size: 11px;
    }

    .calendar-full .cal-day.has-event.event-yellow {
        background: var(--yellow-bg);
        color: #744210;
    }

    .calendar-full .cal-day.has-event.event-red {
        background: #fed7d7;
        color: #9b2c2c;
    }

    .calendar-full .cal-day.has-event.event-blue {
        background: #bee3f8;
        color: #2a4365;
    }

    .calendar-full .cal-day.today.has-event {
        font-weight: 800;
    }

    .calendar-full .cal-day.cal-day-selected {
        outline: 3px solid var(--primary);
        outline-offset: -2px;
        box-shadow: 0 0 0 2px var(--white);
        z-index: 1;
    }

    .calendar-full .cal-day.has-event:hover {
        transform: none;
    }

    .profile-dropdown-name {
        display: block;
        font-size: 15px;
        font-weight: 800;
        color: var(--primary-dark);
        margin-bottom: 8px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
    }

    .content-area {
        flex-direction: column;
    }
    .right-sidebar {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }
    .upcoming-events--desktop {
        display: none;
    }
    .upcoming-events--mobile {
        display: block;
    }
    .izrabotki-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .event-detail-list.cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1200px) {
    .quick-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - mobile/tablet sidebar */
@media (max-width: 900px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .profile-info { display: none; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .sidebar-nav .sidebar-header {
        padding-top: 58px;
        padding-bottom: 6px;
    }

    .sidebar-nav .sidebar-logo {
        width: 100px;
        height: 100px;
        margin-bottom: 6px;
    }

    .sidebar-nav .sidebar-title {
        font-size: 16px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-md);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .content-area {
        padding: 0 16px 16px;
        flex-direction: column;
    }

    .two-col-grid,
    .promo-cards {
        grid-template-columns: 1fr;
    }

    .quick-cards {
        grid-template-columns: 1fr 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

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

    .event-detail-list,
    .event-detail-list.cols-3 {
        grid-template-columns: 1fr;
    }

    .calendar-full .calendar-grid-full .cal-day {
        min-height: 44px;
        font-size: 13px;
        padding: 8px 2px;
    }

    .calendar-subscribe-box {
        padding: 14px;
        gap: 10px;
    }

    .calendar-addbyurl-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .calendar-feed-copy-row {
        flex-wrap: wrap;
    }

    .calendar-feed-copy-row .btn-sm {
        width: 100%;
        text-align: center;
    }

    .main-content,
    .content-area,
    .calendar-full {
        max-width: 100%;
        min-width: 0;
        overflow-x: hidden;
    }

    .welcome-text h2 { font-size: 24px; }
    .welcome-text p { font-size: 15px; }
    .welcome-hero { padding: 16px 20px; min-height: auto; }

    .material-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .material-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .homework-item {
        flex-wrap: wrap;
    }

    .homework-status-wrap {
        width: 100%;
        justify-content: flex-end;
    }

    .search-box {
        max-width: 100%;
    }

    .modal-box {
        padding: 20px;
        margin: 10px;
    }

    .ask-teacher-wrap,
    .form-card.centered {
        max-width: 100%;
    }

    .pdf-viewer-wrap iframe {
        height: 60vh;
    }

    .site-footer p {
        font-size: 11px;
        line-height: 1.5;
        padding: 0 8px;
    }
}

@media (max-width: 600px) {
    .quick-cards {
        grid-template-columns: 1fr;
    }

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

    .header-ask-btn {
        display: none;
    }

    .page-title {
        font-size: 17px;
    }

    .grade-switch-link {
        font-size: 8px;
    }

    .promo-card {
        flex-direction: column;
        text-align: center;
    }

    .promo-card img {
        width: 80px;
    }

    .nav-item {
        font-size: 15px;
        padding: 10px 14px;
    }

    .page-header h2 {
        font-size: 22px;
    }

    .section-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/* Landing page */
.landing-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.landing-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 20px 32px;
}

.landing-header {
    text-align: center;
    margin-bottom: 32px;
}

.landing-logo {
    width: 72px;
    height: auto;
    margin-bottom: 12px;
}

.landing-header h1 {
    font-size: 30px;
    color: var(--primary-dark);
    margin-bottom: 6px;
}

.landing-header p {
    color: var(--text-muted);
    font-size: 14px;
}

.landing-intro {
    text-align: center;
    margin-bottom: 28px;
}

.landing-intro h2 {
    font-size: 22px;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.landing-intro p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.7;
}

.grade-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grade-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px 20px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    border: 2px solid transparent;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.grade-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
}

.grade-card-number {
    display: block;
    font-size: 42px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 8px;
}

.grade-card-label {
    display: block;
    font-size: 15px;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.grade-card-link {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 700;
}

.landing-footer {
    margin-top: 36px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.landing-footer a {
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.landing-footer span {
    margin: 0 8px;
}

@media (max-width: 768px) {
    .grade-picker {
        grid-template-columns: 1fr;
    }
}
