﻿:root {
    --font-main: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-2: #f0f4f4;
    --border: #d9e1e1;

    --text: #172121;
    --text-muted: #536363;
    --text-subtle: #7b8a8a;

    --accent: #1f7a72;
    --accent-contrast: #ffffff;
    --link: #176b63;
    --shadow: 0 10px 24px rgba(23, 33, 33, 0.08);
    --week-num-bg: #c9862f;
    --week-num-text: #ffffff;
    --week-den-bg: #2f5d76;
    --week-den-text: #ffffff;
    --badge-border: rgba(0, 0, 0, 0.08);

    --radius-lg: 8px;
    --radius-md: 8px;
    --radius-sm: 8px;
    --transition-fast: 220ms ease;
    --transition: 280ms ease;
    --section-gap: clamp(1.4rem, 2.2vw, 2rem);
    --card-gap: clamp(1.05rem, 1.6vw, 1.5rem);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-subtle);
    --bs-border-color: var(--border);
    --bs-card-bg: var(--surface);
    --bs-card-color: var(--text);
    --bs-list-group-bg: var(--surface);
    --bs-list-group-color: var(--text);
    --bs-table-color: var(--text);
    --bs-table-bg: var(--surface);
    --bs-link-color: var(--link);
    --bs-link-hover-color: var(--accent);
}

html[data-theme='dark'] {
    --bg: #101717;
    --surface: #182222;
    --surface-2: #202c2c;
    --border: #344343;

    --text: #eef5f4;
    --text-muted: #bed0ce;
    --text-subtle: #95aaa7;

    --accent: #5dc0b5;
    --accent-contrast: #0d1515;
    --link: #7fd7cd;
    --shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
    --week-num-bg: #d69a4a;
    --week-num-text: #111717;
    --week-den-bg: #4f7f98;
    --week-den-text: #ffffff;
    --badge-border: rgba(255, 255, 255, 0.12);

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-secondary-color: var(--text-muted);
    --bs-tertiary-color: var(--text-subtle);
    --bs-border-color: var(--border);
    --bs-card-bg: var(--surface);
    --bs-card-color: var(--text);
    --bs-list-group-bg: var(--surface);
    --bs-list-group-color: var(--text);
    --bs-table-color: var(--text);
    --bs-table-bg: var(--surface);
    --bs-link-color: var(--link);
    --bs-link-hover-color: var(--accent);
}

.campus-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--card-gap);
}

.campus-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--card-gap);
    align-items: stretch;
}

.campus-grid > .glass-card + .glass-card,
.campus-detail-stats > .glass-card + .glass-card {
    margin-top: 0 !important;
}

.campus-card {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    overflow: hidden;
    min-height: 240px;
    height: 100%;
    align-items: stretch;
}

.campus-card-media,
.campus-detail-media {
    position: relative;
    min-height: 100%;
    background: color-mix(in srgb, var(--accent) 16%, var(--surface-2));
    min-width: 0;
}

.campus-card-media img,
.campus-detail-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.campus-card-media {
    aspect-ratio: 1 / 1;
    min-height: 240px;
    max-height: 240px;
    overflow: hidden;
}

.campus-card-placeholder,
.campus-detail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 220px;
    color: color-mix(in srgb, var(--accent) 72%, var(--text));
    font-size: clamp(2.4rem, 4vw, 4rem);
}

.campus-card-body {
    display: grid;
    align-content: start;
    gap: .9rem;
    padding: 1.2rem 1.25rem;
    min-width: 0;
    grid-template-rows: auto auto auto 1fr;
}

.campus-card-head h2,
.campus-detail-copy h1 {
    margin: 0;
    overflow-wrap: anywhere;
}

.campus-card-head h2 {
    font-size: clamp(1.35rem, 2vw, 1.9rem);
    line-height: 1.1;
}

.campus-card-address,
.campus-detail-address {
    margin: .4rem 0 0;
    color: var(--text-muted);
    font-weight: 600;
}

.campus-card-description,
.campus-detail-description {
    margin: 0;
    color: var(--text);
    line-height: 1.7;
}

.campus-card-description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.campus-card-meta,
.campus-route-badges,
.campus-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.campus-card-meta span,
.campus-route-badges span,
.campus-floor-note {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 650;
}

.campus-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    margin-top: auto;
}

.campus-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 48%);
    gap: 0;
    overflow: hidden;
    min-height: 360px;
    width: 100%;
    min-width: 0;
}

.campus-detail-copy {
    display: grid;
    align-content: center;
    justify-items: start;
    gap: 1.1rem;
    padding: clamp(1.4rem, 2.6vw, 2rem);
    min-width: 0;
}

.campus-detail-copy .chip {
    justify-self: start;
}

.campus-detail-copy h1 {
    font-size: clamp(2.25rem, 3.2vw, 3.3rem);
    line-height: 1.08;
}

.campus-detail-actions {
    margin-top: .35rem;
}

.campus-detail-address {
    font-size: 1.2rem;
    line-height: 1.45;
}

.campus-detail-description {
    font-size: 1.22rem;
    line-height: 1.75;
    max-width: 34ch;
}

.campus-detail-actions .btn {
    width: auto;
    min-height: 42px;
    white-space: nowrap;
}

.campus-detail-media {
    min-height: 360px;
    min-width: 0;
}

.campus-detail-media img {
    aspect-ratio: 16 / 10;
    max-width: 100%;
}

.campus-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--card-gap);
    width: 100%;
    min-width: 0;
}

.campus-detail-stat {
    padding: 1.15rem;
}

.campus-detail-stat span,
.campus-detail-stat strong {
    display: block;
}

.campus-detail-stat span {
    color: var(--text);
    font-size: 2rem;
    font-weight: 850;
    line-height: 1;
}

.campus-detail-stat strong {
    margin-top: .45rem;
    color: var(--text-muted);
    font-size: .92rem;
}

.campus-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    gap: var(--card-gap);
    align-items: start;
    width: 100%;
    min-width: 0;
}

.campus-detail-main,
.campus-detail-side {
    display: grid;
    gap: var(--card-gap);
    min-width: 0;
}

.campus-floor-list,
.campus-route-list,
.campus-side-list {
    display: grid;
    gap: .85rem;
}

.campus-floor-item,
.campus-route-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface-2) 76%, var(--surface));
}

.campus-floor-item strong,
.campus-route-top strong,
.campus-side-list strong {
    display: block;
    color: var(--text);
}

.campus-floor-item span,
.campus-route-top span,
.campus-side-list span,
.campus-route-item p {
    color: var(--text-muted);
}

.campus-floor-item span,
.campus-route-top span,
.campus-side-list span {
    display: block;
    margin-top: .2rem;
}

.campus-floor-actions {
    flex: 0 0 auto;
}

.campus-route-item {
    display: grid;
    gap: .8rem;
}

.campus-route-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.campus-route-item p {
    margin: 0;
    line-height: 1.65;
}

.campus-route-item.is-recommended {
    border-color: color-mix(in srgb, var(--accent) 46%, var(--border));
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.campus-route-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.05rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--surface-2) 76%, var(--surface));
}

.campus-route-link-copy {
    min-width: 0;
}

.campus-route-link-copy strong,
.campus-route-link-copy span {
    display: block;
}

.campus-route-link-copy span {
    margin-top: .25rem;
    color: var(--text-muted);
}

.campus-route-accent {
    color: var(--accent) !important;
    border-color: color-mix(in srgb, var(--accent) 38%, var(--border)) !important;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2)) !important;
}

.campus-side-list > div {
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

.campus-side-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.forum-hero,
.forum-topic-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--card-gap);
}

.forum-topic-head {
    min-width: 0;
}

.forum-topic-head > div {
    min-width: 0;
}

.forum-topic-head h1 {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forum-home-shell {
    width: 100%;
    max-width: none;
    margin: 0;
}

.forum-hero-actions,
.forum-search,
.forum-search-wide {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.forum-hero-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
    align-self: center;
}

.forum-hero-actions .btn {
    min-height: 42px;
    white-space: nowrap;
}

.forum-search {
    flex: 0 1 360px;
    min-width: 280px;
}

.forum-search .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
    width: 44px;
    padding: 0;
}

.forum-search .form-control,
.forum-search-wide .form-control {
    min-width: 0;
}

.forum-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
    gap: var(--card-gap);
    align-items: start;
}

.forum-main-column {
    display: grid;
    gap: var(--card-gap);
    min-width: 0;
}

.forum-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 210px;
    gap: var(--card-gap);
    align-items: stretch;
}

.forum-category-card {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
    max-height: 210px;
    gap: 1rem;
    height: 100%;
    padding: 1.15rem;
    color: var(--text);
}

.forum-category-card.is-pinned {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface)) !important;
}

.forum-category-grid > .glass-card + .glass-card {
    margin-top: 0 !important;
}

.forum-category-main {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: .95rem;
    min-width: 0;
    overflow: hidden;
}

.forum-category-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
    color: var(--accent);
    font-size: 1.15rem;
}

.forum-category-card:hover,
.forum-mini-topic:hover,
.forum-topic-row:hover {
    color: var(--text);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.forum-category-card h2,
.forum-topic-row h2 {
    margin: 0 0 .45rem;
    font-size: 1.1rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forum-category-card p,
.forum-topic-row p {
    margin: 0;
    color: var(--text-muted);
}

.forum-category-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.forum-card-meta,
.forum-topic-stats,
.profile-public-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.forum-card-meta span,
.forum-card-open,
.forum-card-action,
.forum-topic-stats span,
.profile-public-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 .65rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 650;
}

.forum-card-meta {
    margin-top: auto;
}

.forum-card-open {
    margin-left: auto;
    border-color: color-mix(in srgb, var(--accent) 24%, var(--border)) !important;
    color: var(--accent) !important;
    text-decoration: none;
}

.forum-card-action-form {
    margin: 0;
}

.forum-card-action {
    font: inherit;
    cursor: pointer;
}

.forum-sidebar {
    position: sticky;
    top: 88px;
    display: grid;
    gap: var(--card-gap);
}

.forum-sidebar-card {
    min-width: 0;
}

.forum-mini-topic {
    display: block;
    padding: .85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.forum-mini-topic strong,
.forum-mini-topic span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-mini-topic span {
    margin-top: .35rem;
    color: var(--text-muted);
    font-size: .88rem;
}

.forum-topic-list {
    overflow: hidden;
}

.forum-topic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: transform var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.forum-topic-row.is-pinned {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.forum-topic-main {
    min-width: 0;
    color: var(--text);
    text-decoration: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forum-topic-main:hover {
    color: var(--text);
}

.forum-topic-side {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .65rem;
    min-width: 220px;
}

.forum-topic-row:last-child {
    border-bottom: 0;
}

.forum-topic-row:hover {
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.forum-topic-stats {
    justify-content: flex-end;
    min-width: 190px;
}

.forum-pin-badge {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin-right: .4rem;
    padding: .18rem .48rem;
    border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border));
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    vertical-align: middle;
}

.forum-pin-button {
    min-height: 28px;
}

.forum-posts {
    display: grid;
    gap: var(--card-gap);
}

.forum-post {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.25rem;
}

.forum-post.is-pinned {
    background: color-mix(in srgb, var(--accent) 7%, var(--surface)) !important;
}

.forum-post-topic {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.forum-post:target {
    scroll-margin-top: 40vh;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 .18rem color-mix(in srgb, var(--accent) 22%, transparent);
}

.forum-author {
    display: flex;
    gap: .8rem;
    align-items: flex-start;
}

.forum-avatar,
.profile-public-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.forum-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
}

.forum-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.forum-avatar span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.forum-author-name {
    display: block;
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
}

.forum-author span {
    color: var(--text-muted);
    font-size: .88rem;
}

.forum-reply-author {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1rem;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
}

.forum-reply-author span {
    display: block;
    color: var(--text-muted);
    font-size: .88rem;
}

.forum-post-body {
    min-width: 0;
    color: var(--text);
    line-height: 1.65;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forum-post-body p {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.forum-post-body p:last-child {
    margin-bottom: 0;
}

.forum-post-content {
    display: grid;
    gap: .85rem;
    min-width: 0;
}

.forum-post-image {
    display: block;
    width: min(320px, 100%) !important;
    max-width: 320px !important;
    height: auto;
    padding: 0 !important;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    cursor: zoom-in;
    line-height: 0;
}

.forum-post-image img {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.forum-image-modal[hidden] {
    display: none;
}

.forum-image-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: clamp(16px, 3vw, 36px);
}

.forum-image-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(0, 0, 0, .72);
}

.forum-image-modal-dialog {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    max-width: min(1100px, 96vw);
    max-height: 92vh;
}

.forum-image-modal-dialog img {
    display: block;
    max-width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-md);
    object-fit: contain;
    background: #000;
}

.forum-image-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, .56);
    color: #fff;
}

.forum-image-modal-open {
    overflow: hidden;
}

.forum-reply-reference,
.forum-reply-target {
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.forum-reply-reference {
    display: inline-grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .65rem;
    align-items: center;
    padding: .75rem .9rem;
    color: var(--text);
    text-decoration: none;
}

.forum-reply-reference img,
.forum-reply-target-image {
    width: 68px;
    height: 52px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.forum-reply-reference span,
.forum-reply-reference em {
    display: block;
    min-width: 0;
}

.forum-reply-reference em {
    color: var(--text-muted);
    font-size: .9rem;
    font-style: normal;
}

.forum-reply-target {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    padding: .85rem 1rem;
}

.forum-reply-target > div {
    min-width: 0;
    flex: 1 1 auto;
}

.forum-reply-target span {
    display: block;
    margin-top: .2rem;
    color: var(--text-muted);
    font-size: .9rem;
}

.forum-reply-to-button {
    flex: 0 0 auto;
}

.forum-post-pin-form {
    margin: 0;
    flex: 0 0 auto;
}

.forum-post-delete-form {
    margin: 0;
    flex: 0 0 auto;
}

.forum-post-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: .55rem;
    min-width: 0;
    overflow-x: auto;
}

.forum-post-actions .btn {
    min-height: 32px;
    white-space: nowrap;
}

.forum-file-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.forum-file-row .form-control[type='file'] {
    min-width: 0;
}

.forum-file-clear {
    flex: 0 0 auto;
}

.profile-public-card {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
}

.profile-public-avatar {
    width: 128px;
    height: 128px;
    overflow: hidden;
    border-radius: 50%;
    font-size: 2.4rem;
}

.profile-public-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-public-main h1 {
    margin: 0 0 .55rem;
}

.profile-public-username {
    margin-bottom: .75rem;
    color: var(--text-muted);
    font-weight: 700;
}

.profile-public-main p {
    margin: 1rem 0 0;
    max-width: 820px;
    color: var(--text);
}

.profile-public-actions {
    margin-top: 1rem;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--card-gap);
}

.profile-stat-card {
    padding: 1.1rem;
}

.profile-stats-grid > .glass-card + .glass-card {
    margin-top: 0 !important;
}

.profile-stat-card span,
.profile-stat-card strong {
    display: block;
}

.profile-stat-card span {
    color: var(--text);
    font-size: 2rem;
    font-weight: 850;
    line-height: 1;
}

.profile-stat-card strong {
    margin-top: .45rem;
    color: var(--text-muted);
    font-size: .92rem;
}

.profile-detail-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: var(--card-gap);
    align-items: start;
}

.profile-info-column,
.profile-activity-column {
    display: grid;
    gap: var(--card-gap);
    min-width: 0;
}

.profile-about-text {
    color: var(--text);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.forum-mini-topic em {
    display: block;
    margin-top: .45rem;
    color: var(--text-muted);
    font-size: .9rem;
    font-style: normal;
    white-space: normal;
    overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
    .schedule-group-hero {
        grid-template-columns: 1fr;
    }

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

    .schedule-bells-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .schedule-home-layout {
        grid-template-columns: 1fr;
    }

    .schedule-home-main-head {
        flex-direction: column;
    }

    .schedule-home-meta {
        justify-content: flex-start;
        max-width: none;
    }

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

    .campus-grid,
    .campus-detail-stats,
    .campus-detail-layout {
        grid-template-columns: 1fr;
    }

    .campus-detail-hero {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .forum-layout {
        grid-template-columns: 1fr;
    }

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

    .forum-sidebar {
        position: static;
    }
}

@media (max-width: 760px) {
    .schedule-changes-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .schedule-group-filter,
    .schedule-bells-strip {
        grid-template-columns: 1fr;
    }

    .schedule-bell-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .campus-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .campus-card-media {
        aspect-ratio: 16 / 10;
        min-height: 220px;
        max-height: 220px;
    }

    .campus-detail-media {
        min-height: 280px;
    }

    .campus-floor-item,
    .campus-route-top,
    .campus-route-link {
        flex-direction: column;
    }

    .forum-hero,
    .forum-topic-head,
    .forum-hero-actions,
    .forum-search,
    .forum-search-wide,
    .forum-topic-row {
        align-items: stretch;
        flex-direction: column;
    }

    .forum-post,
    .profile-public-card {
        grid-template-columns: 1fr;
    }

    .forum-category-grid {
        grid-template-columns: 1fr;
    }

    .profile-public-avatar {
        width: 96px;
        height: 96px;
        font-size: 2rem;
    }

    .profile-stats-grid,
    .profile-detail-layout {
        grid-template-columns: 1fr;
    }

    .forum-topic-stats {
        justify-content: flex-start;
        min-width: 0;
    }

    .forum-topic-side {
        justify-content: flex-start;
        min-width: 0;
    }

    .forum-hero-actions {
        flex-wrap: wrap;
        justify-content: stretch;
    }

    .forum-search {
        flex: 1 1 100%;
        min-width: 0;
    }

    .forum-hero-actions > .btn {
        width: 100%;
        justify-content: center;
    }
}

html,
body {
    font-family: var(--font-main);
    background: var(--bg);
    color: var(--text);
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.55;
}

#main-content {
    flex: 1 0 auto;
}

#main-content > * + * {
    margin-top: var(--section-gap) !important;
}

#main-content > .row,
#main-content > .service-layout,
#main-content > .glass-card,
#main-content > .card,
#main-content > section,
#main-content > form,
#main-content > .table-responsive {
    margin-bottom: var(--section-gap);
}

#main-content > :last-child {
    margin-bottom: 0;
}

#main-content > h1,
#main-content > h2,
#main-content > h3,
#main-content > h4,
.page-heading {
    margin-bottom: 1rem;
}

.footer-modern {
    margin-top: auto !important;
}

h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    letter-spacing: 0;
    color: var(--text);
}

a {
    color: var(--link);
    text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
}

a:hover {
    color: var(--accent);
}

p,
span,
li,
td,
th,
label,
small {
    color: inherit;
}

.u-text {
    color: var(--text) !important;
}

.u-muted {
    color: var(--text-muted) !important;
}

.u-subtle {
    color: var(--text-subtle) !important;
}

.navbar-modern {
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
    transition: background var(--transition), box-shadow var(--transition-fast);
    min-height: 56px;
    margin-top: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    top: 0;
}

.navbar-modern > .container-fluid {
    min-height: 56px;
    align-items: center;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.navbar-modern .navbar-collapse {
    align-items: center;
}

.navbar-modern.is-scrolled {
    box-shadow: var(--shadow);
}

.navbar-modern .navbar-brand,
.navbar-modern .nav-link {
    color: var(--text) !important;
}

.navbar-modern .nav-link {
    opacity: 0.82;
    border-radius: var(--radius-sm);
    padding: 0.38rem 0.82rem !important;
    transition: all var(--transition-fast);
}

.navbar-modern .nav-link:hover,
.navbar-modern .nav-link.active {
    opacity: 1;
    background: var(--surface-2);
    color: var(--text) !important;
}

.navbar-modern .navbar-toggler {
    border: 1px solid var(--border);
    color: var(--text);
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 0.2rem 0.5rem;
}

.dropdown-menu-modern {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow);
    border-radius: var(--radius-md);
    min-width: 230px;
}

.dropdown-menu-modern .dropdown-item {
    color: var(--text) !important;
    border-radius: 8px;
    margin: 0.12rem 0.35rem;
    width: auto;
}

.dropdown-menu-modern .dropdown-item:hover,
.dropdown-menu-modern .dropdown-item:focus {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

.dropdown-menu-modern .dropdown-header {
    color: var(--text-muted);
}

.user-menu-toggle {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-toggle-btn {
    border: 0;
    background: transparent;
}

.offcanvas-modern {
    background: var(--surface) !important;
    color: var(--text);
    border-right: 1px solid var(--border);
}

.offcanvas-modern .offcanvas-header {
    border-bottom: 1px solid var(--border);
}

.offcanvas-modern .btn-close {
    filter: var(--btn-close-filter, none);
}

html[data-theme='dark'] .offcanvas-modern .btn-close {
    filter: invert(1) grayscale(100%);
}

.offcanvas-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-subtle);
    margin-bottom: 0.4rem;
}

.btn,
input,
select,
textarea,
.badge,
.card,
.list-group-item,
.navbar,
.dropdown-item {
    font-family: inherit;
}

.btn {
    border-radius: var(--radius-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.btn-accent,
.btn-primary {
    background: var(--accent) !important;
    border: 1px solid var(--accent) !important;
    color: var(--accent-contrast) !important;
    box-shadow: none;
}

.btn-accent:hover,
.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

.btn-ghost,
.btn-soft,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-light,
.btn-outline-dark {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
}

.btn-ghost:hover,
.btn-soft:hover,
.btn-outline-secondary:hover,
.btn-outline-light:hover,
.btn-outline-dark:hover {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

.btn-ripple:active {
    transform: scale(0.985);
}

.card,
.panel,
.surface,
.glass-card,
.list-group-item,
.accordion-item,
.empty-state,
.filter-bar,
.day-card,
.hero-block,
.table,
.toast {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 1px 2px rgba(23, 33, 33, 0.05);
}

.card,
.glass-card,
.panel,
.surface,
.filter-bar,
.day-card,
.hero-block {
    overflow: visible;
}

.card-body,
.glass-card.p-3,
.glass-card.p-4,
.panel,
.surface {
    min-width: 0;
}

.card + .card,
.glass-card + .glass-card,
.table-responsive + .glass-card,
.alert + .glass-card,
form + .table-responsive {
    margin-top: var(--card-gap) !important;
}

.hero-block + .row,
.hero-block + .glass-card,
.hero-block + .service-layout,
.row + .glass-card,
.row + .row,
.glass-card + .row,
.service-layout + .glass-card,
.service-layout + .row {
    margin-top: var(--section-gap) !important;
}

.row.g-0,
.row.gx-0 {
    --bs-gutter-x: 0;
}

.row:not(.g-0) {
    --bs-gutter-x: var(--card-gap);
    --bs-gutter-y: var(--card-gap);
}

.card,
.card-body,
.card-title,
.card-text,
.list-group-item,
.accordion-button,
.accordion-body,
.table,
.table > :not(caption) > * > * {
    color: var(--text) !important;
}

.surface-2 {
    background: var(--surface-2) !important;
}

.page-heading {
    max-width: 760px;
}

.page-heading h1 {
    font-size: clamp(1.9rem, 3vw, 2.65rem);
    line-height: 1.08;
}

.page-heading + .service-layout,
.page-heading + .row,
.page-heading + .glass-card,
.page-heading + .card {
    margin-top: 1.25rem;
}

.service-layout {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 1.35rem;
    align-items: start;
}

.service-stack {
    margin-top: var(--section-gap) !important;
}

.assistant-layout {
    display: grid;
    grid-template-columns: minmax(360px, 34vw) minmax(0, 1fr);
    gap: var(--section-gap);
    align-items: start;
    margin-top: var(--section-gap) !important;
}

.assistant-answer-card {
    min-height: 280px;
}

.assistant-answer {
    color: var(--text);
    line-height: 1.7;
    font-size: 1rem;
}

.schedule-home-hero {
    max-width: none;
}

.schedule-home-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr);
    gap: var(--card-gap);
    align-items: start;
}

.schedule-home-layout > .glass-card + .glass-card {
    margin-top: 0 !important;
}

.schedule-home-main,
.schedule-home-side {
    padding: 1.35rem;
}

.schedule-home-main {
    display: grid;
    gap: 1.1rem;
}

.schedule-home-main-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.schedule-home-main-head h2,
.schedule-home-side-head h2 {
    margin: 0;
    font-size: 1.25rem;
}

.schedule-home-main-head p,
.schedule-home-side-head p {
    margin: .35rem 0 0;
    color: var(--text-muted);
}

.schedule-home-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .5rem;
    max-width: 420px;
}

.schedule-home-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 650;
}

.schedule-home-form {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(180px, .55fr) 160px;
    gap: 1rem;
    align-items: end;
}

.schedule-home-field {
    min-width: 0;
}

.schedule-home-field .form-label {
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 700;
}

.schedule-home-group-field {
    display: grid;
    gap: .7rem;
}

.schedule-group-hints {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
}

.schedule-home-submit {
    min-height: 46px;
}

.schedule-home-links {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
}

.schedule-home-side {
    display: grid;
    gap: 1rem;
}

.schedule-bells-list {
    display: grid;
    gap: .6rem;
}

.schedule-bell-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem .95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.schedule-bell-item strong {
    color: var(--text);
}

.schedule-bell-item > span {
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}

.schedule-bell-item.is-current {
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
}

.schedule-group-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(520px, .85fr);
    gap: var(--card-gap);
    align-items: end;
    margin-bottom: 1rem;
}

.schedule-group-title {
    display: grid;
    gap: .8rem;
}

.schedule-group-title > .chip {
    justify-self: start;
}

.schedule-group-title h1 {
    margin: 0;
    font-size: clamp(2rem, 3vw, 3.1rem);
    line-height: 1.05;
}

.schedule-group-status {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
}

.schedule-group-filter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 140px 110px;
    gap: .75rem;
    align-items: end;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.schedule-group-filter .form-label {
    color: var(--text-muted);
    font-size: .86rem;
    font-weight: 700;
}

.schedule-bells-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: .7rem;
    margin-bottom: 1rem;
}

.schedule-bell-pill {
    display: grid;
    gap: .25rem;
    min-height: 72px;
    padding: .85rem .95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.schedule-bell-pill span {
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 750;
}

.schedule-bell-pill strong {
    color: var(--text);
    font-size: 1rem;
    white-space: nowrap;
}

.schedule-bell-pill.is-current {
    border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
    background: color-mix(in srgb, var(--accent) 12%, var(--surface));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.schedule-changes-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--border));
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.schedule-changes-summary > div {
    display: grid;
    gap: .2rem;
}

.schedule-changes-summary strong {
    color: var(--text);
    font-size: 1rem;
}

.schedule-changes-summary span {
    color: var(--text-muted);
    font-weight: 650;
}

.ai-widget {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1080;
}

.ai-widget-toggle {
    display: grid;
    place-items: center;
    width: 58px;
    height: 58px;
    border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--border));
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
    box-shadow: 0 18px 36px rgba(0, 0, 0, .2);
    font-size: 1.35rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.ai-widget-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 42px rgba(0, 0, 0, .24);
}

.ai-widget.is-open .ai-widget-toggle {
    opacity: 0;
    pointer-events: none;
    transform: scale(.9);
}

.ai-widget-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(390px, calc(100vw - 28px));
    height: min(560px, calc(100vh - 96px));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(.98);
    transform-origin: right bottom;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.ai-widget.is-open .ai-widget-panel {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}

.ai-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
}

.ai-widget-title {
    font-weight: 800;
    color: var(--text);
}

.ai-widget-subtitle {
    font-size: .85rem;
    color: var(--text-muted);
}

.ai-widget-close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
}

.ai-widget-messages {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding: .85rem;
    overflow: auto;
}

.ai-message {
    max-width: 86%;
    padding: .62rem .78rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    font-size: .95rem;
    font-weight: 500;
    text-align: left;
}

.ai-message-bot {
    align-self: flex-start;
    background: var(--surface-2);
    color: var(--text);
    border-bottom-left-radius: 6px;
}

.ai-message-user {
    align-self: flex-end;
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
    border-bottom-right-radius: 6px;
}

.ai-message-error {
    border-color: color-mix(in srgb, #d65b5b 55%, var(--border));
    background: color-mix(in srgb, #d65b5b 12%, var(--surface));
}

.ai-message-thinking {
    color: var(--text-muted);
}

.ai-widget-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    gap: .6rem;
    padding: .8rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.ai-widget-form textarea {
    min-height: 44px;
    max-height: 130px;
    resize: none;
}

.ai-widget-form button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    align-self: end;
    border: 1px solid var(--accent);
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
}

.ai-widget-form button:disabled {
    opacity: .65;
    cursor: wait;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(340px, .75fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: center;
    min-height: 340px;
}

.home-hero h1 {
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    line-height: .98;
    max-width: 760px;
}

.home-hero .lead {
    max-width: 680px;
}

.home-action-grid {
    display: grid;
    gap: .85rem;
}

.home-action {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2);
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.home-action:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    transform: translateY(-1px);
}

.home-action i {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--accent);
    flex: 0 0 auto;
}

.home-action span {
    display: grid;
    gap: .1rem;
}

.home-action small {
    color: var(--text-muted);
}

.home-dashboard {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, .6fr);
    gap: var(--section-gap);
    align-items: stretch;
}

.home-dashboard > .glass-card + .glass-card {
    margin-top: 0 !important;
}

.home-news-list {
    display: grid;
    gap: .75rem;
}

.home-news-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 0;
    border-bottom: 1px solid var(--border);
}

.home-news-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.home-news-item i {
    color: var(--text-subtle);
}

.home-checklist {
    display: grid;
    gap: .8rem;
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.home-checklist li::marker {
    color: var(--accent);
    font-weight: 700;
}

.routes-heading {
    max-width: none;
}

.routes-controls {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(180px, 220px);
    gap: 1rem;
    align-items: end;
}

.routes-field,
.routes-action,
.routes-layout,
.routes-summary-card {
    min-width: 0;
}

.routes-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
    gap: var(--card-gap);
    align-items: start;
}

.routes-map-card {
    overflow: hidden;
}

.routes-summary-card .list-group-item {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.service-layout > .glass-card {
    height: auto;
}

.service-layout > .glass-card:first-child {
    position: sticky;
    top: 86px;
}

.service-form {
    display: grid;
    gap: 1.05rem;
}

.form-field {
    display: grid;
    gap: .42rem;
}

.form-field .form-label,
.service-form .form-label,
.vstack .form-label {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--text-muted) !important;
}

.service-form .btn,
.vstack .btn,
form .btn[type='submit'] {
    margin-top: .25rem;
}

.form-field textarea {
    min-height: 150px;
    resize: vertical;
}

.section-title-row,
.table-header {
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--border);
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem .85rem;
}

.table-responsive {
    border-radius: var(--radius-md);
}

.table-modern {
    border: 0 !important;
    box-shadow: none;
}

.table-modern th,
.table-modern td {
    padding: .85rem 1rem;
    vertical-align: middle;
}

.table-modern thead th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-subtle) !important;
}

.dashboard-summary-grid {
    margin-top: var(--section-gap) !important;
    margin-bottom: var(--section-gap) !important;
}

.dashboard-notifications {
    margin-top: var(--section-gap) !important;
}

.hero-block {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg) !important;
    padding: 1.75rem;
    box-shadow: none;
}

.rounded-4,
.rounded-3,
img.rounded,
img.rounded-4 {
    border-radius: var(--radius-md) !important;
}

.display-6 {
    font-size: clamp(1.65rem, 2.2vw, 2.15rem);
    line-height: 1.05;
}

.text-muted,
.text-secondary,
.text-body-secondary,
small,
.form-text {
    color: var(--text-muted) !important;
}

.text-dark,
.link-dark,
.text-light,
.link-light {
    color: var(--text) !important;
}

.small-subtle {
    color: var(--text-subtle) !important;
}

hr,
.border,
.table,
.table th,
.table td,
.accordion-button,
.accordion-body,
.list-group-item {
    border-color: var(--border) !important;
}

table {
    color: var(--text) !important;
}

thead th {
    color: var(--text) !important;
    background: var(--surface-2) !important;
}

tbody td {
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.form-control,
.form-select,
textarea {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm);
    display: block;
    width: 100%;
    min-height: 42px;
    padding: .58rem .75rem;
}

.form-control[type='file'] {
    padding: .45rem .65rem !important;
}

.form-control[type='file']::file-selector-button {
    margin: -.45rem .75rem -.45rem -.65rem;
    padding: .45rem .75rem;
    border: 0;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
    color: var(--text);
    font: inherit;
    font-weight: 700;
}

.form-control[type='file']::-webkit-file-upload-button {
    margin: -.45rem .75rem -.45rem -.65rem;
    padding: .45rem .75rem;
    border: 0;
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--accent) 14%, var(--surface-2));
    color: var(--text);
    font: inherit;
    font-weight: 700;
}

textarea.form-control,
textarea {
    min-height: 130px;
}

select.form-select,
select {
    min-height: 42px;
}

form p {
    margin: 0 0 1rem;
}

form p label {
    display: block;
    margin-bottom: .4rem;
    font-weight: 600;
    color: var(--text-muted);
}

form p input,
form p select,
form p textarea {
    display: block;
    width: 100%;
}

.form-check-input {
    background-color: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
}

.form-check-input:checked {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
}

.form-check-label {
    color: var(--text) !important;
}

.form-label,
.invalid-feedback,
.form-text {
    color: var(--text-muted) !important;
}

.invalid-feedback {
    color: #ff8f9a !important;
    font-weight: 500;
}

ul.errorlist {
    margin: 0.15rem 0 0;
    padding-left: 1rem;
    color: #ff8f9a;
}

.form-control::placeholder,
.form-select::placeholder,
textarea::placeholder {
    color: var(--text-subtle) !important;
    opacity: 1;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--accent) 20%, transparent);
    border-color: var(--accent) !important;
}

.chip,
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    border-radius: 999px;
    padding: 0.28rem 0.58rem;
    font-size: 0.78rem;
    line-height: 1;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
}

.badge {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
}

.chip-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}

.chip-outline {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.chip-info {
    background: color-mix(in srgb, var(--accent) 20%, var(--surface));
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    color: var(--text);
}

.chip-success {
    background: color-mix(in srgb, #2ab070 30%, var(--surface));
    border-color: color-mix(in srgb, #2ab070 60%, var(--border));
    color: var(--text);
}

.chip-warning {
    background: color-mix(in srgb, #efc15b 34%, var(--surface));
    border-color: color-mix(in srgb, #efc15b 58%, var(--border));
    color: var(--text);
}

.chip-danger {
    background: color-mix(in srgb, #d65b5b 32%, var(--surface));
    border-color: color-mix(in srgb, #d65b5b 62%, var(--border));
    color: var(--text);
}

.badge-ghost {
    background: var(--surface-2);
    color: var(--text);
    border-color: var(--border);
}

.text-bg-primary,
.bg-primary {
    background: var(--accent) !important;
    color: var(--accent-contrast) !important;
}

.bg-white,
.bg-light,
.table-light,
.bg-dark,
.table-dark {
    background: var(--surface) !important;
    color: var(--text) !important;
}

.text-bg-warning,
.bg-warning {
    background: color-mix(in srgb, #efc15b 55%, var(--surface)) !important;
    color: var(--text) !important;
}

.text-bg-success,
.bg-success {
    background: color-mix(in srgb, #2ab070 58%, var(--surface)) !important;
    color: var(--accent-contrast) !important;
}

.text-bg-danger,
.bg-danger {
    background: color-mix(in srgb, #d65b5b 64%, var(--surface)) !important;
    color: #fff !important;
}

.text-bg-secondary,
.bg-secondary {
    background: color-mix(in srgb, var(--text-muted) 30%, var(--surface)) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.toast {
    color: var(--text) !important;
}

.alert {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.page-link {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

.page-item.active .page-link {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: var(--accent-contrast) !important;
}

.toast-success {
    border-left: 4px solid #23b26d !important;
}

.toast-warning {
    border-left: 4px solid #e7b243 !important;
}

.toast-danger {
    border-left: 4px solid #d65b5b !important;
}

.toast-info {
    border-left: 4px solid var(--accent) !important;
}

.footer-modern {
    border-top: 1px solid color-mix(in srgb, var(--accent) 18%, var(--border));
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 82%, var(--surface))),
        var(--surface);
    color: var(--text);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.35fr) repeat(3, minmax(160px, .7fr));
    gap: clamp(1rem, 1.6vw, 1.45rem);
    align-items: start;
}

.footer-brand,
.footer-section {
    min-width: 0;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    margin-bottom: .55rem;
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 850;
    letter-spacing: 0;
    text-decoration: none;
}

.footer-logo::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-right: .45rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent);
}

.footer-logo:hover {
    color: var(--accent);
}

.footer-brand p {
    max-width: 52ch;
    margin: 0;
    color: var(--text-muted);
    line-height: 1.65;
}

.footer-campus-list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
    margin-top: .25rem;
}

.footer-campus-list span {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 28px;
    padding: 0 .58rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    font-size: .82rem;
    font-weight: 650;
}

.footer-campus-list i {
    color: var(--accent);
}

.footer-section h2 {
    margin: 0 0 .45rem;
    color: var(--text);
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.footer-section {
    display: grid;
    gap: .28rem;
    align-content: start;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    min-height: 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.footer-link:hover {
    color: var(--accent);
    transform: translateX(2px);
}

.footer-note {
    color: var(--text-muted);
    font-size: .9rem;
    line-height: 1.4;
}

.footer-note span {
    color: var(--text);
    font-weight: 750;
}


.filter-bar {
    position: sticky;
    top: 76px;
    z-index: 11;
    padding: 0.9rem;
    backdrop-filter: blur(10px);
}

.quick-action,
.glass-card,
.day-card,
.lesson-item {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.quick-action:hover,
.glass-card:hover,
.day-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(23, 33, 33, 0.08);
}

.lesson-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.65rem;
    background: var(--surface-2);
}

.lesson-time {
    color: var(--accent);
    font-weight: 700;
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.day-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

.day-header {
    min-height: 52px;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.75rem;
}

.day-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.day-empty {
    margin-top: 0.25rem;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    padding: 0.8rem;
    font-size: 0.95rem;
}

.lesson-row {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: .75rem;
    align-items: start;
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.lesson-row.is-current-lesson {
    border-color: color-mix(in srgb, var(--accent) 62%, var(--border));
    background: color-mix(in srgb, var(--accent) 11%, var(--surface-2));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.lesson-row.has-schedule-change {
    border-color: color-mix(in srgb, var(--accent) 70%, var(--border));
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--accent) 13%, var(--surface-2)),
        var(--surface-2) 42%
    );
}

.lesson-row.is-current-lesson .lesson-pair,
.lesson-row.is-current-lesson .subject {
    color: var(--accent);
}

.current-slot-row > * {
    background: color-mix(in srgb, var(--accent) 10%, var(--surface-2)) !important;
}

.lesson-meta {
    color: var(--text-muted);
    font-weight: 700;
}

.lesson-pair {
    line-height: 1.1;
}

.lesson-content {
    min-width: 0;
}

.lesson-top {
    display: flex;
    gap: .5rem;
    align-items: center;
    justify-content: space-between;
}

.subject {
    font-weight: 650;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.teacher {
    margin-top: .35rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-variants {
    display: grid;
    gap: .45rem;
    margin-top: .1rem;
}

.schedule-change-stack {
    display: grid;
    gap: .55rem;
    margin-top: .65rem;
}

.schedule-change-card {
    padding: .75rem;
    border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--border));
    border-radius: var(--radius-sm);
    background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.schedule-change-card.schedule-change-cancel {
    border-color: color-mix(in srgb, #ef4444 55%, var(--border));
    background: color-mix(in srgb, #ef4444 10%, var(--surface));
}

.schedule-change-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .55rem;
    color: var(--text-muted);
    font-weight: 750;
}

.schedule-change-line {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: .65rem;
    align-items: start;
    padding: .25rem 0;
}

.schedule-change-line span {
    color: var(--text-muted);
    font-size: .85rem;
    font-weight: 750;
}

.schedule-change-line strong {
    color: var(--text);
    font-weight: 750;
    overflow-wrap: anywhere;
}

.variant {
    display: flex;
    gap: .5rem;
    align-items: flex-start;
    flex-wrap: nowrap;
}

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

.variant-tag {
    min-width: 96px;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

.schedule-cell-stack {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}

.schedule-subline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.schedule-teacher {
    color: var(--text-muted);
    font-weight: 500;
}

.badge-week {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .55rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: .85rem;
    line-height: 1.2;
    border: 1px solid var(--badge-border);
    box-shadow: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.badge-week:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 14px rgba(23, 33, 33, 0.12);
}

.badge-num {
    background: var(--week-num-bg);
    color: var(--week-num-text);
}

.badge-den {
    background: var(--week-den-bg);
    color: var(--week-den-text);
}

.badge-label {
    opacity: .9;
    font-weight: 700;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .02em;
}

.test-answer-option {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    background: var(--surface-2);
    border-color: var(--border) !important;
    color: var(--text) !important;
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.test-answer-option:hover {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 .12rem color-mix(in srgb, var(--accent) 18%, transparent);
}

.test-answer-option .form-check-input {
    margin-top: .2rem;
    flex-shrink: 0;
}

.test-answer-option .test-answer-text {
    color: var(--text) !important;
    font-weight: 500;
    line-height: 1.35;
}

.test-answer-option:has(.form-check-input:checked) {
    border-color: var(--accent) !important;
    background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
    box-shadow: 0 0 0 .14rem color-mix(in srgb, var(--accent) 20%, transparent);
}

.table-modern tbody tr {
    transition: background var(--transition-fast);
}

.table-modern tbody tr:hover {
    background: var(--surface-2);
}

.list-group-item,
.list-group-item-action {
    background: var(--surface) !important;
    color: var(--text) !important;
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: var(--surface-2) !important;
    color: var(--text) !important;
}

.room-item {
    transition: background var(--transition-fast), border-color var(--transition-fast);
    border-left: 3px solid transparent;
}

.room-item.active-room {
    border-left-color: var(--accent);
    background: var(--surface-2) !important;
}

.highlight-match {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 4px;
}

.onboarding-progress {
    height: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.onboarding-progress .progress-bar {
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 0.72rem;
}

.onboarding-section {
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.onboarding-section.is-completed {
    border-color: color-mix(in srgb, #2ab070 60%, var(--border)) !important;
    box-shadow: 0 0 0 0.18rem color-mix(in srgb, #2ab070 14%, transparent);
}

.onboarding-item-row.is-done .form-check-label {
    text-decoration: line-through;
    color: var(--text-muted);
}

.admin-sidebar {
    position: sticky;
    top: 86px;
}

.admin-panel-layout {
    align-items: flex-start;
}

.admin-panel-main,
.admin-stat-row > * {
    min-width: 0;
}

.admin-stat-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-height: 132px;
}

.admin-stat-card h6 {
    color: var(--text-muted);
}

.admin-chart-card {
    position: relative;
    height: 260px;
}

.admin-chart-card-wide {
    height: 300px;
}

.admin-chart-card canvas {
    width: 100% !important;
    height: 100% !important;
}

.admin-sidebar .list-group-item {
    border: 0 !important;
}

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 360ms ease, transform 360ms ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.page-enter,
.schedule-fade {
    animation: pageFade 280ms ease;
}

@keyframes pageFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 992px) {
    .footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .service-layout {
        grid-template-columns: 1fr;
        gap: var(--section-gap);
    }

    .assistant-layout {
        grid-template-columns: 1fr;
    }

    .home-hero,
    .home-dashboard {
        grid-template-columns: 1fr;
    }

    .home-hero {
        min-height: auto;
    }

    .ai-widget {
        right: 14px;
        bottom: 14px;
    }

    .ai-widget-panel {
        width: calc(100vw - 28px);
        height: min(540px, calc(100vh - 72px));
    }

    .service-layout > .glass-card:first-child {
        position: static;
    }

    .hero-block {
        padding: 1.55rem;
    }

    .filter-bar {
        top: 66px;
    }

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

    .navbar-modern {
        min-height: 64px;
    }
}

@media (max-width: 576px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }

    .schedule-home-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
        width: 100%;
        overflow: hidden;
    }

    .schedule-home-main,
    .schedule-home-side {
        min-width: 0;
        width: 100%;
        padding: 1rem;
    }

    .schedule-home-main-head {
        flex-direction: column;
        gap: .85rem;
    }

    .schedule-home-main-head h2,
    .schedule-home-side-head h2 {
        font-size: 1.12rem;
        line-height: 1.2;
    }

    .schedule-home-main-head p,
    .schedule-home-side-head p {
        font-size: .95rem;
        line-height: 1.45;
    }

    .schedule-home-meta {
        justify-content: flex-start;
        max-width: none;
        width: 100%;
    }

    .schedule-home-meta span {
        max-width: 100%;
        min-height: 32px;
        overflow-wrap: anywhere;
    }

    .schedule-home-form {
        grid-template-columns: minmax(0, 1fr);
        gap: .85rem;
    }

    .schedule-home-submit,
    .schedule-home-links .btn {
        width: 100%;
    }

    .schedule-home-links {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: .55rem;
    }

    .schedule-bell-item {
        align-items: flex-start;
        flex-direction: column;
        gap: .35rem;
    }

    .schedule-bell-item > span {
        white-space: normal;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Final responsive safety layer. Keep this at the end so it wins over older
   section styles that were declared after their media queries. */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas,
iframe {
    max-width: 100%;
}

.content-shell,
#main-content,
.glass-card,
.card,
.surface,
.panel,
.row > *,
[class*='col-'] {
    min-width: 0;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    :root {
        --page-gutter: 12px;
        --section-gap: 1rem;
        --card-gap: .85rem;
    }

    .content-shell,
    .navbar-modern .container-fluid {
        padding-left: var(--page-gutter) !important;
        padding-right: var(--page-gutter) !important;
    }

    main.content-shell {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    .navbar-modern,
    .navbar-modern > .container-fluid {
        min-height: 58px;
    }

    .navbar-modern .navbar-brand {
        min-width: 0;
        max-width: calc(100vw - 92px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .offcanvas-modern {
        width: min(330px, calc(100vw - 28px)) !important;
    }

    .page-heading {
        max-width: none;
        margin-bottom: .85rem;
    }

    .page-heading h1,
    .home-hero h1,
    .campus-detail-copy h1,
    .schedule-group-title h1,
    .profile-public-main h1 {
        font-size: clamp(1.65rem, 8vw, 2.25rem);
        line-height: 1.08;
        overflow-wrap: anywhere;
    }

    .lead {
        font-size: 1rem;
        line-height: 1.5;
    }

    .glass-card.p-4,
    .card-body,
    .hero-block,
    .empty-state.p-4 {
        padding: 1rem !important;
    }

    .home-hero,
    .home-dashboard,
    .routes-controls,
    .routes-layout,
    .service-layout,
    .assistant-layout,
    .campus-grid,
    .campus-detail-hero,
    .campus-detail-stats,
    .campus-detail-layout,
    .forum-layout,
    .forum-category-grid,
    .forum-post,
    .profile-public-card,
    .profile-stats-grid,
    .profile-detail-layout,
    .schedule-home-layout,
    .schedule-group-hero,
    .schedule-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: var(--card-gap);
        width: 100%;
    }

    .home-hero,
    .campus-detail-hero {
        min-height: 0;
    }

    .home-action,
    .home-news-item,
    .campus-floor-item,
    .campus-route-top,
    .campus-route-link,
    .forum-hero,
    .forum-topic-head,
    .forum-topic-row,
    .table-header,
    .section-title-row,
    .schedule-changes-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .home-news-item {
        justify-content: flex-start;
    }

    .home-action span,
    .home-news-item > div,
    .campus-route-link-copy,
    .forum-topic-main,
    .forum-post-body,
    .assistant-answer,
    .profile-about-text {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .campus-card {
        grid-template-columns: minmax(0, 1fr) !important;
        min-height: 0;
    }

    .campus-card-media,
    .campus-detail-media {
        min-height: 190px;
        max-height: 240px;
        aspect-ratio: 16 / 10;
    }

    .campus-detail-copy,
    .campus-card-body {
        padding: 1rem;
    }

    .campus-detail-actions,
    .campus-card-actions,
    .forum-hero-actions,
    .forum-post-actions,
    .profile-public-actions,
    .schedule-group-status,
    .schedule-home-meta,
    .schedule-home-links {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: .55rem;
        width: 100%;
    }

    .campus-detail-actions .btn,
    .campus-card-actions .btn,
    .forum-hero-actions .btn,
    .forum-post-actions .btn,
    .profile-public-actions .btn,
    .schedule-home-links .btn,
    .schedule-changes-summary .btn {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }

    .forum-search,
    .forum-search-wide {
        flex: 1 1 auto;
        min-width: 0;
        width: 100%;
    }

    .forum-topic-side,
    .forum-topic-stats {
        min-width: 0;
        justify-content: flex-start;
    }

    .forum-category-card {
        max-height: none;
        min-height: 180px;
    }

    .forum-post {
        padding: 1rem;
    }

    .forum-reply-reference,
    .forum-reply-target,
    .forum-file-row {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .forum-file-clear,
    .forum-post-actions {
        justify-content: flex-start;
        overflow-x: visible;
    }

    .profile-public-avatar {
        width: 88px;
        height: 88px;
        font-size: 1.8rem;
    }

    .service-layout > .glass-card:first-child,
    .forum-sidebar,
    .admin-sidebar,
    .admin-empty-card,
    .admin-recent-card {
        position: static;
    }

    .service-form,
    .vstack,
    form {
        min-width: 0;
    }

    .form-control,
    .form-select,
    textarea,
    select,
    input {
        min-width: 0;
        max-width: 100%;
    }

    .input-group {
        min-width: 0;
    }

    .input-group > .form-control,
    .input-group > .form-select {
        min-width: 0;
    }

    .schedule-home-main,
    .schedule-home-side {
        min-width: 0;
        width: 100%;
        padding: 1rem;
    }

    .schedule-home-main-head {
        align-items: stretch;
        flex-direction: column;
        gap: .85rem;
    }

    .schedule-home-form,
    .schedule-group-filter,
    .schedule-bells-strip {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: .75rem;
    }

    .schedule-home-meta span,
    .schedule-group-status .chip,
    .badge-week,
    .chip,
    .badge {
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .schedule-home-submit,
    .schedule-group-filter .btn {
        width: 100%;
    }

    .schedule-bell-item,
    .schedule-bell-pill {
        align-items: flex-start;
        min-width: 0;
    }

    .schedule-bell-item {
        flex-direction: column;
        gap: .35rem;
    }

    .schedule-bell-item > span,
    .schedule-bell-pill strong {
        white-space: normal;
    }

    .lesson-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .routes-action .btn {
        width: 100%;
        white-space: normal;
    }

    .lesson-top,
    .variant,
    .schedule-change-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .teacher {
        white-space: normal;
    }

    .variant-tag {
        min-width: 0;
        width: fit-content;
        max-width: 100%;
    }

    .table,
    table {
        max-width: 100%;
    }

    .table-responsive table {
        min-width: 640px;
    }

    .table th,
    .table td {
        white-space: normal;
        overflow-wrap: anywhere;
    }

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

    .ai-widget-toggle {
        width: 54px;
        height: 54px;
    }

    .ai-widget-panel {
        right: 0;
        width: calc(100vw - 24px);
        height: min(560px, calc(100vh - 70px));
        border-radius: var(--radius-md);
    }

    .footer-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (max-width: 900px) {
    .schedule-group-hero {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: .9rem;
    }

    .schedule-group-title h1 {
        font-size: clamp(1.7rem, 8vw, 2.25rem);
        line-height: 1.08;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .schedule-group-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: .7rem;
        padding: .85rem;
    }

    .schedule-group-filter .btn {
        min-width: 0;
        white-space: normal;
    }

    .schedule-bells-strip {
        display: flex;
        gap: .65rem;
        margin-left: calc(-1 * var(--page-gutter));
        margin-right: calc(-1 * var(--page-gutter));
        padding: 0 var(--page-gutter) .25rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
    }

    .schedule-bell-pill {
        flex: 0 0 min(150px, 44vw);
        scroll-snap-align: start;
    }
}

@media (max-width: 520px) {
    .schedule-group-filter {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (max-width: 420px) {
    :root {
        --page-gutter: 10px;
    }

    .glass-card.p-3,
    .glass-card.p-4,
    .card-body,
    .hero-block,
    .day-card {
        padding: .9rem !important;
    }

    .btn,
    .form-control,
    .form-select {
        min-height: 40px;
    }

    .display-6 {
        font-size: 1.55rem;
    }
}

