:root {
	--paper: #f7f7f5;
	--card: #ffffff;
	--ink: #171b20;
	--ink-soft: #5b6168;
	--line: #dcdfe1;
	--line-strong: #9aa0a6;
	--accent: #3557e8;
	--accent-soft: #eef1fd;
	--error: #b3261e;
	--error-bright: #e0342a;
	--chevron-rest: #aeb3b8;
}

* {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	padding: 0 1.5rem 1.5rem;
	background: var(--paper);
	background-image:
		linear-gradient(rgba(23, 27, 32, 0.045) 1px, transparent 1px),
		linear-gradient(90deg, rgba(23, 27, 32, 0.045) 1px, transparent 1px),
		radial-gradient(circle, rgba(53, 87, 232, 0.42) 2.2px, transparent 2.4px),
		radial-gradient(circle, rgba(53, 87, 232, 0.36) 2px, transparent 2.2px),
		radial-gradient(circle, rgba(53, 87, 232, 0.3) 1.8px, transparent 2px);
	background-size: 26px 26px, 26px 26px, 260px 260px, 338px 338px, 416px 416px;
	background-position: 0 0, 0 0, 0 0, 130px 210px, 60px 40px;
	color: var(--ink);
	font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
	font-size: 16px;
	line-height: 1.5;
}

.display {
	font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
}

a {
	color: inherit;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

body.is-app {
	height: 100dvh;
	overflow: hidden;
}

.wrap {
	max-width: 640px;
	margin: 0 auto;
}

.wrap.wrap--grid-wide {
	max-width: none;
}

.wrap--app {
	display: flex;
	flex-direction: column;
	height: 100%;
	padding-bottom: 0.75rem;
	position: relative;
}

/* Brand: logo mark + wordmark, used in both the masthead and the topbar */
.brand {
	display: flex;
	align-items: center;
	gap: 0.45rem;
	text-decoration: none;
	width: fit-content;
	flex: 0 0 auto;
}

.logo-mark {
	color: var(--ink);
	flex: 0 0 auto;
}

.logo-dot {
	fill: var(--accent);
}

.wordmark {
	font-size: 1.15rem;
	font-weight: 600;
	letter-spacing: -0.01em;
	color: var(--ink);
}

.wordmark .accent-part {
	color: var(--accent);
}

/* Browse: masthead + tabs */
.masthead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1.25rem 0 0.75rem;
}

.masthead-tagline {
	font-size: 0.82rem;
	color: var(--ink-soft);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.room-finder {
	margin-top: 1.5rem;
	margin-bottom: 1.5rem;
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
}

.room-finder summary {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.9rem 1.25rem;
	font-weight: 500;
	color: var(--ink);
	cursor: pointer;
	list-style: none;
}

.room-finder summary::-webkit-details-marker {
	display: none;
}

.room-finder summary svg {
	width: 18px;
	height: 18px;
	color: var(--chevron-rest);
	flex: 0 0 auto;
}

.room-finder[open] summary {
	border-bottom: 1px solid var(--line);
}

.room-finder-form {
	padding: 1rem 1.25rem 0.25rem;
}

.room-finder-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	margin-bottom: 0.75rem;
}

.room-finder-row .field {
	flex: 1 1 12rem;
	min-width: 10rem;
	margin-bottom: 0;
}

.room-finder-toggle {
	display: inline-flex;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	overflow: hidden;
}

.room-finder-toggle input {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.room-finder-toggle label {
	padding: 0.45rem 1.1rem;
	font-size: 0.85rem;
	color: var(--ink-soft);
	cursor: pointer;
	background: var(--card);
	transition: background 0.15s ease, color 0.15s ease;
}

.room-finder-toggle label:first-of-type {
	border-right: 1px solid var(--line-strong);
}

.room-finder-toggle input:checked + label {
	background: var(--accent);
	color: #fff;
}

.room-finder-toggle input:focus-visible + label {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.room-finder-hint {
	margin: -0.4rem 0 0.75rem;
	font-size: 0.8rem;
	color: var(--ink-soft);
}

.room-finder-form select,
.room-finder-form input[type="date"] {
	width: 100%;
	padding: 0.55rem 0.6rem;
	border: 1px solid var(--line-strong);
	border-radius: 8px;
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--ink);
	background: var(--card);
}

.room-finder-form select:focus,
.room-finder-form input[type="date"]:focus {
	outline: none;
	border-color: var(--accent);
}

.room-finder-form .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.6rem 1.2rem;
	margin: 0.25rem 0 1.1rem;
	border: 1px solid var(--accent);
	border-radius: 8px;
	background: var(--accent);
	color: #fff;
	font-family: inherit;
	font-size: 0.9rem;
	cursor: pointer;
}

.room-finder-form .btn:hover {
	background: #2a46c9;
	border-color: #2a46c9;
}

.room-finder-results {
	padding: 0 1.25rem 1.1rem;
}

.room-finder-message {
	margin: 0 0 0.6rem;
	font-size: 0.9rem;
	color: var(--ink-soft);
}

.room-finder-message--error {
	color: var(--error);
}

.room-finder-message--empty {
	margin: 0;
	padding: 0.75rem 1rem;
	border-radius: 8px;
	background: rgba(184, 134, 11, 0.1);
	color: #8a6300;
	font-weight: 500;
}

.room-finder-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.room-chip {
	padding: 0.4rem 0.8rem;
	border-radius: 999px;
	border: 1px solid var(--line-strong);
	color: var(--ink);
	text-decoration: none;
	font-size: 0.88rem;
}

.room-chip:hover,
.room-chip:focus-visible {
	border-color: var(--accent);
	color: var(--accent);
}

.tabs {
	display: flex;
	gap: 1.5rem;
	margin: 0 0 2rem;
	padding-bottom: 0.9rem;
	border-bottom: 1px solid var(--line);
}

.tabs a {
	text-decoration: none;
	color: var(--ink-soft);
	font-size: 0.95rem;
	padding-bottom: 0.95rem;
	margin-bottom: -1rem;
	border-bottom: 2px solid transparent;
}

.tabs a.active {
	color: var(--ink);
	border-bottom-color: var(--accent);
}

.tabs a:hover {
	color: var(--ink);
}

/* Browse: search + entity list */
.search-field-wrap {
	position: relative;
	margin: 0 0 1rem;
}

.search-field {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.85rem 2.5rem 0.85rem 1.1rem;
	border: 1px solid var(--line-strong);
	border-radius: 10px;
	background: var(--card);
	font-family: inherit;
	font-size: 1.05rem;
	color: var(--ink);
}

.search-clear-btn {
	display: none;
	position: absolute;
	top: 50%;
	right: 0.5rem;
	transform: translateY(-50%);
	width: 2rem;
	height: 2rem;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: none;
	color: var(--ink-soft);
	font-size: 1.6rem;
	line-height: 1;
	cursor: pointer;
}

.search-clear-btn:hover {
	color: var(--ink);
}

.search-field-wrap.has-value .search-clear-btn {
	display: flex;
}

.search-field::placeholder {
	color: var(--ink-soft);
}

.search-field:focus {
	outline: none;
	border-color: var(--accent);
}

.browse-card {
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
	overflow: hidden;
}

.entity-list {
	max-height: 55vh;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--line-strong) transparent;
}

.entity-list::-webkit-scrollbar,
.overview-scroll::-webkit-scrollbar {
	width: 6px;
	height: 6px;
}

.entity-list::-webkit-scrollbar-button,
.overview-scroll::-webkit-scrollbar-button {
	display: none;
}

.entity-list::-webkit-scrollbar-track,
.overview-scroll::-webkit-scrollbar-track {
	background: transparent;
}

.entity-list::-webkit-scrollbar-thumb,
.overview-scroll::-webkit-scrollbar-thumb {
	background: var(--line-strong);
	border-radius: 8px;
}

.entity-list::-webkit-scrollbar-thumb:hover,
.overview-scroll::-webkit-scrollbar-thumb:hover {
	background: var(--ink-soft);
}

.entity-row {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.4rem 0.6rem 0.4rem 1.25rem;
	border-bottom: 1px solid var(--line);
}

.entity-row-link {
	display: flex;
	flex: 1 1 auto;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 0.5rem 0;
	text-decoration: none;
	color: var(--ink);
	font-size: 1.05rem;
	min-width: 0;
}

.entity-type-badge {
	display: none;
	flex: 0 0 auto;
	font-size: 0.72rem;
	color: var(--ink-soft);
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	padding: 0.1rem 0.55rem;
}

.entity-row.show-type-badge .entity-type-badge {
	display: inline-block;
}

#no-matches,
#no-favorites {
	padding: 2rem 1.25rem;
}

.entity-row:last-child {
	border-bottom: none;
}

.entity-row-link:hover,
.entity-row-link:focus-visible {
	color: var(--accent);
}

.entity-row.is-hidden {
	display: none;
}

.entity-favorite-btn {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.1rem;
	height: 2.1rem;
	padding: 0;
	border: none;
	border-radius: 8px;
	background: none;
	color: var(--line-strong);
	cursor: pointer;
}

.entity-favorite-btn:hover {
	background: var(--paper);
	color: var(--ink-soft);
}

.entity-favorite-btn.is-active {
	color: var(--accent);
}

.entity-favorite-btn.is-active svg {
	fill: currentColor;
}

.empty-state {
	padding: 2rem 0;
	color: var(--ink-soft);
}

/* Browse: footer attribution */
.site-footer {
	text-align: center;
	padding: 1.5rem 0 0.5rem;
	color: var(--line-strong);
	font-size: 0.75rem;
}

.site-footer a {
	color: var(--line-strong);
	text-decoration: underline;
	text-decoration-color: var(--line);
	text-underline-offset: 2px;
}

.site-footer a:hover {
	color: var(--accent);
	text-decoration-color: var(--accent);
}

/* Schedule: topbar (logo left, entity name right - no tabs here) */
.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	padding: 1.25rem 0 0.75rem;
	flex: 0 0 auto;
}

.topbar-right {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	min-width: 0;
	max-width: 55%;
}

.topbar-entity {
	font-size: 0.85rem;
	color: var(--ink-soft);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 100%;
}

.topbar-updated {
	font-size: 0.72rem;
	color: var(--line-strong);
	white-space: nowrap;
}

/* Schedule: day view */
.schedule-view {
	display: none;
}

.schedule-view.is-visible {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
}

.date-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	margin-bottom: 0.6rem;
	flex: 0 0 auto;
}

.schedule-date {
	font-size: 1.3rem;
	font-weight: 600;
	margin: 0;
	letter-spacing: -0.01em;
	color: var(--ink);
}

.schedule-week {
	color: var(--ink-soft);
	margin: 0;
	font-size: 0.78rem;
}

.day-nav-grid {
	display: grid;
	grid-template-columns: 2.1rem 1fr 2.1rem;
	grid-template-rows: 2.1rem 1fr 2.1rem;
	grid-template-areas:
		".    up    ."
		"left card right"
		".    down  .";
	align-items: stretch;
	gap: 0.3rem;
	flex: 1;
	min-height: 0;
}

.nav-slot {
	display: flex;
	align-items: center;
	justify-content: center;
}

.nav-slot--up { grid-area: up; }
.nav-slot--down { grid-area: down; }
.nav-slot--left { grid-area: left; }
.nav-slot--right { grid-area: right; }

.grid-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.1rem;
	height: 2.1rem;
	color: var(--chevron-rest);
	text-decoration: none;
}

.grid-icon:hover,
.grid-icon:focus-visible {
	color: var(--accent);
}

.grid-icon.is-disabled {
	opacity: 0;
	pointer-events: none;
}

.day-card {
	grid-area: card;
	min-width: 0;
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	transition: opacity 0.14s ease, transform 0.14s ease;
}

.floating-btn.is-hidden {
	opacity: 0;
	pointer-events: none;
}

.more-menu-wrap {
	position: absolute;
	bottom: 1.25rem;
	left: 0;
}

.more-menu-wrap .floating-btn {
	position: static;
}

.more-menu {
	position: absolute;
	bottom: calc(100% + 0.5rem);
	left: 0;
	z-index: 6;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 14rem;
	padding: 0.4rem;
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
}

.more-menu[hidden] {
	display: none;
}

.more-menu-item {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: none;
	border-radius: 8px;
	background: none;
	color: var(--ink);
	font-family: inherit;
	font-size: 0.88rem;
	text-decoration: none;
	text-align: left;
	cursor: pointer;
}

.more-menu-item svg {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	color: var(--chevron-rest);
}

.more-menu-item:hover {
	background: var(--paper);
}

.more-menu-item.is-disabled {
	color: var(--line-strong);
	cursor: default;
}

.more-menu-item.is-disabled svg {
	color: var(--line-strong);
}

.more-menu-item.is-disabled:hover {
	background: none;
}

.more-menu-item#favorite-btn.is-active svg {
	color: var(--accent);
	fill: var(--accent);
}

.pair-block {
	flex: 1 1 0;
	min-height: 0;
	display: flex;
	align-items: stretch;
	border-bottom: 1px dotted var(--line-strong);
}

.pair-block:last-child {
	border-bottom: none;
}

.pair-time {
	flex: 0 0 3.1rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 0.1rem;
	color: var(--ink-soft);
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 0.76rem;
	line-height: 1.2;
}

.pair-block.is-current .pair-time {
	color: var(--accent);
}

.pair-content {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 0 0.65rem;
	position: relative;
}

.pair-content::before {
	content: "";
	position: absolute;
	left: 0;
	top: 18%;
	bottom: 18%;
	width: 2px;
	background: var(--line-strong);
}

.pair-block.is-current .pair-content::before {
	background: var(--accent);
}

.pair-content:not(.has-conflict) .pair-entry + .pair-entry {
	margin-top: 0.6rem;
	padding-top: 0.6rem;
	border-top: 1px dashed var(--line);
}

.pair-title-row {
	display: flex;
	align-items: baseline;
	gap: 0.3rem;
}

.pair-title {
	flex: 1;
	min-width: 0;
	font-weight: 500;
	font-size: 0.92rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pair-info-btn {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.1rem;
	height: 1.1rem;
	padding: 0;
	border: none;
	background: none;
	color: var(--line-strong);
	cursor: pointer;
}

.pair-info-btn svg {
	width: 12px;
	height: 12px;
}

.pair-info-btn:hover,
.pair-info-btn:focus-visible {
	color: var(--accent);
}

.pair-secondary {
	color: var(--ink-soft);
	font-size: 0.8rem;
	margin-top: 0.1rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pair-meta {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.2rem;
	font-size: 0.75rem;
	color: var(--ink-soft);
	overflow: hidden;
}

.pair-room {
	display: inline-flex;
	align-items: center;
	gap: 0.2rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 0 1 auto;
	min-width: 0;
}

.pair-room span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.pair-room svg {
	flex: 0 0 auto;
	width: 11px;
	height: 11px;
}

.pair-date-note {
	font-variant-numeric: tabular-nums;
}

.broken-ref {
	color: var(--error);
	font-style: italic;
}

/* Cross-links to another entity's schedule (group/teacher/room mentioned
   inside an entry) */
.xref {
	text-decoration: underline;
	text-decoration-color: var(--line-strong);
	text-underline-offset: 2px;
}

.xref:hover,
.xref:focus-visible {
	color: var(--accent);
	text-decoration-color: var(--accent);
}

/* Same-slot conflict (a data error: two lessons landed on one exact date) -
   show one at a time, paged via a red arrow that also flags the problem */
.pair-content.has-conflict {
	padding-right: 1.7rem;
}

.pair-content.has-conflict .pair-entry {
	display: none;
}

.pair-content.has-conflict .pair-entry.is-active {
	display: block;
}

.pair-content.has-conflict .pair-entry.is-leaving {
	display: block;
	animation: pair-entry-leave 0.15s ease forwards;
}

.pair-content.has-conflict .pair-entry.is-active:not(.is-leaving) {
	animation: pair-entry-enter 0.15s ease;
}

@keyframes pair-entry-leave {
	to { opacity: 0; transform: translateX(-6px); }
}

@keyframes pair-entry-enter {
	from { opacity: 0; transform: translateX(6px); }
	to { opacity: 1; transform: translateX(0); }
}

.pair-conflict-nav {
	position: absolute;
	right: 0.5rem;
	top: 50%;
	transform: translateY(-50%);
	width: 1.6rem;
	height: 1.6rem;
	padding: 0;
	border: none;
	background: none;
	color: var(--error-bright);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.pair-conflict-nav svg {
	width: 20px;
	height: 20px;
	stroke-width: 2.6;
}

/* Mobile-friendly "read the full text" popover - title="" tooltips don't
   fire on touch (long-press just selects text instead), so tapping the
   info button shows this instead, centered so there's more room for text */
.popover-backdrop {
	position: fixed;
	inset: 0;
	background: rgba(23, 27, 32, 0.4);
	z-index: 10;
}

.text-popover {
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 11;
	width: calc(100vw - 3rem);
	max-width: 22rem;
	background: var(--ink);
	color: var(--card);
	font-size: 0.9rem;
	line-height: 1.5;
	padding: 1rem 1.15rem;
	border-radius: 10px;
	white-space: pre-line;
	box-shadow: 0 10px 30px rgba(23, 27, 32, 0.3);
}

/* Floating action buttons: anchored to the container (.wrap--app), not the
   viewport corner - stay right where the content ends, even on wide screens */
.floating-btn {
	position: absolute;
	bottom: 1.25rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	background: var(--card);
	color: var(--chevron-rest);
	border: none;
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
	text-decoration: none;
	font-family: inherit;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.floating-btn:hover,
.floating-btn:focus-visible {
	color: var(--accent);
}

.floating-btn.is-active {
	color: var(--accent);
}

.floating-btn--right {
	right: 0;
}

.floating-btn--left {
	left: 0;
}

/* Schedule: full overview */
.overview-card {
	flex: 1;
	min-height: 0;
	margin: 0.9rem 1.5rem 0.9rem 1.4rem;
	display: flex;
	flex-direction: column;
	position: relative;
}

.overview-scroll {
	flex: 1;
	min-height: 0;
	overflow: auto;
	padding: 1.5rem 0.4rem 1.5rem 1rem;
	scrollbar-width: thin;
	scrollbar-color: var(--line-strong) transparent;
}

.overview-day-block {
	margin: 0 0 1.25rem;
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
}

.overview-day-block:last-child {
	margin-bottom: 0;
}

.overview-day-label {
	color: var(--ink);
	font-weight: 500;
	font-size: 1.05rem;
	padding: 0.5rem 0.6rem;
	border-bottom: 1px solid var(--line-strong);
	border-radius: 10px 10px 0 0;
}

.overview-grid {
	display: grid;
	grid-template-columns: auto auto 1fr;
	font-size: 0.85rem;
}

.ov-time,
.ov-week,
.ov-cell {
	border-bottom: 1px dotted var(--line-strong);
	padding: 0.45rem 0.5rem;
	text-align: left;
	display: flex;
	align-items: center;
}

.ov-time.no-border,
.ov-week.no-border,
.ov-cell.no-border {
	border-bottom: none;
}

.ov-time {
	color: var(--ink-soft);
	white-space: nowrap;
	justify-content: center;
	flex-direction: column;
}

.ov-time span {
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 0.76rem;
	line-height: 1.35;
}

.ov-week {
	color: var(--ink-soft);
	white-space: nowrap;
	justify-content: center;
}

.ov-cell {
	flex-direction: column;
	justify-content: center;
	align-items: stretch;
}

.overview-empty {
	color: var(--line-strong);
}

.overview-entry {
	display: block;
	text-decoration: none;
	color: var(--ink);
	padding: 0.15rem 0;
	min-width: 10rem;
}

.overview-entry + .overview-entry {
	margin-top: 0.5rem;
	padding-top: 0.5rem;
	border-top: 1px dashed var(--line);
}

.overview-entry:hover,
.overview-entry:focus-visible {
	color: var(--accent);
}

.overview-entry.has-error {
	color: var(--error);
}

.overview-entry-title {
	display: block;
	font-weight: 500;
}

.overview-entry-secondary,
.overview-entry-room,
.overview-entry-date {
	display: inline-block;
	color: var(--ink-soft);
	font-size: 0.8rem;
	margin-right: 0.5rem;
}

@media (min-width: 900px) {
	.wrap {
		max-width: 900px;
	}
}

@media (max-width: 480px) {
	body {
		padding: 0 1rem 1.25rem;
	}

	body.is-app {
		padding: 0 1rem;
	}

	.tabs {
		gap: 1rem;
	}

	.schedule-date {
		font-size: 1.15rem;
	}
}

/* Schedule: extended grid view (whole week, all days as columns - the
   original spreadsheet's own layout). Desktop-oriented: wide table with
   its own scroll area, rather than shrinking to fit small screens. */
.grid-view-card {
	flex: 1;
	min-height: 0;
	margin: 0.9rem 1.5rem 0.9rem 1.4rem;
	display: flex;
	flex-direction: column;
}

.grid-view-scroll {
	flex: 1;
	min-height: 0;
	overflow: auto;
	background: var(--card);
	border-radius: 10px;
	box-shadow: 0 1px 3px rgba(23, 27, 32, 0.14), 0 4px 14px rgba(23, 27, 32, 0.08);
}

table.grid-view-table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	font-size: 0.82rem;
}

table.grid-view-table th {
	position: sticky;
	top: 0;
	z-index: 2;
	background: var(--card);
	color: var(--ink-soft);
	font-weight: 500;
	text-align: center;
	white-space: nowrap;
	padding: 0.6rem 0.5rem;
	border-bottom: 1px solid var(--line-strong);
}

table.grid-view-table th.grid-view-corner,
table.grid-view-table td.grid-view-day-col {
	width: 2.6rem;
}

table.grid-view-table th.grid-view-corner {
	left: 0;
	z-index: 3;
	border-right: 1px solid var(--line-strong);
}

table.grid-view-table td.grid-view-day-col {
	position: sticky;
	left: 0;
	z-index: 1;
	text-align: center;
	font-weight: 500;
	line-height: 1.35;
	color: var(--ink);
	background: var(--card);
	vertical-align: middle;
	padding: 0.6rem 0.3rem;
	border-right: 1px solid var(--line-strong);
}

.grid-view-time {
	display: block;
	margin-top: 0.25rem;
	font-family: 'IBM Plex Mono', ui-monospace, monospace;
	font-size: 0.68rem;
	color: var(--line-strong);
}

table.grid-view-table td.grid-view-cell {
	vertical-align: top;
	padding: 0.4rem 0.5rem;
	border: 1px solid var(--line-strong);
	overflow: hidden;
}

table.grid-view-table td.grid-view-cell--week1 {
	border-bottom: none;
}

table.grid-view-table td.grid-view-cell.has-entry {
	background: rgba(23, 27, 32, 0.045);
}

/* Drop the table's own outer right/bottom edge - it sits flush against
   the card's rounded corner and shadow, doubling up visually. Using the
   data-pair/data-day attributes (rather than :last-child) because a
   rowspan'd weekly cell can shift which element is structurally "last"
   in a row, but these attributes are always set correctly regardless.
   Each selector repeats the element+class of the rule it overrides
   (td.grid-view-cell, th) so its specificity is at least as high -
   an attribute selector alone isn't enough to beat a rule that also
   names the element type. */
table.grid-view-table td.grid-view-cell[data-pair="7"] {
	border-right: none;
}

table.grid-view-table th[data-pair="7"] {
	border-right: none;
}

table.grid-view-table td.grid-view-cell[data-day="7"] {
	border-bottom: none;
}

.grid-cell-entry {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
}

.grid-cell-entry + .grid-cell-entry {
	margin-top: 0.2rem;
	padding-top: 0.2rem;
	border-top: 1px dotted var(--line);
}

table.grid-view-table th.is-hover-th,
table.grid-view-table td.grid-view-day-col.is-hover-day {
	background: var(--accent-soft);
	color: var(--accent);
}

table.grid-view-table th.is-hover-th .grid-view-time {
	color: var(--accent);
}

.grid-scale-wrap {
	overflow: hidden;
}

#grid-table {
	transition: transform 0.1s ease;
}

@media (max-width: 700px) {
	table.grid-view-table {
		table-layout: auto;
		min-width: 50rem;
	}

	table.grid-view-table td.grid-view-cell {
		min-width: 8rem;
	}
}

table.grid-view-table tr.grid-view-day-start td {
	border-top: 2px solid var(--line-strong);
}

table.grid-view-table tr.grid-view-day-start:first-child td {
	border-top: none;
}

@media print {
	body {
		background: none !important;
		padding: 0 !important;
		color: #000;
	}

	body.is-app {
		height: auto !important;
		overflow: visible !important;
	}

	.wrap--app,
	.schedule-view.is-visible {
		height: auto !important;
		display: block !important;
	}

	.masthead-tagline,
	.site-footer,
	.search-field-wrap,
	.room-finder,
	.floating-btn,
	.more-menu-wrap,
	.day-nav-grid .nav-slot,
	.pair-info-btn,
	.pair-conflict-nav,
	.text-popover,
	.popover-backdrop {
		display: none !important;
	}

	.day-nav-grid {
		display: block !important;
	}

	.day-card,
	.overview-day-block {
		box-shadow: none !important;
		border: 1px solid #ccc !important;
		break-inside: avoid;
		page-break-inside: avoid;
	}

	.overview-card {
		margin: 0.5rem 0 !important;
	}

	.overview-scroll {
		overflow: visible !important;
		height: auto !important;
		padding: 0 !important;
	}

	.pair-block.is-current {
		background: none !important;
	}

	/* Extended grid: the on-screen fit-to-viewport scale (JS, sized for a
	   monitor) and sticky headers don't make sense on a printed page - let
	   the table print at its natural size and paginate normally. The
	   <thead> already repeats on each printed page automatically. */
	.wrap.wrap--grid-wide {
		max-width: none !important;
	}

	.grid-view-card {
		margin: 0 !important;
	}

	.grid-view-scroll,
	#grid-scale-wrap {
		overflow: visible !important;
		height: auto !important;
	}

	#grid-table {
		transform: none !important;
		width: 100% !important;
		table-layout: auto !important;
	}

	table.grid-view-table th,
	table.grid-view-table td.grid-view-day-col {
		position: static !important;
	}

	table.grid-view-table tr {
		break-inside: avoid;
		page-break-inside: avoid;
	}

	a[href] {
		color: inherit !important;
	}

	.xref {
		text-decoration: none !important;
	}
}

/* --- Masthead help button --- */

.masthead-right {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	min-width: 0;
}

.help-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.9rem;
	height: 1.9rem;
	flex-shrink: 0;
	border-radius: 50%;
	border: 1px solid var(--line-strong);
	background: var(--card);
	color: var(--ink-soft);
	cursor: pointer;
	padding: 0;
}

.help-btn:hover {
	color: var(--ink);
	border-color: var(--ink-soft);
}

/* --- Onboarding tour --- */

.tour-overlay {
	position: fixed;
	inset: 0;
	background: rgba(23, 27, 32, 0.55);
	z-index: 480;
	cursor: pointer;
	animation: tour-fade-in 0.15s ease;
}

.tour-highlight {
	border-radius: 10px;
	animation: tour-pulse 1.6s ease-in-out infinite;
}

@keyframes tour-pulse {
	0%, 100% { box-shadow: 0 0 0 4px var(--accent), 0 0 0 8px rgba(53, 87, 232, 0.25); }
	50% { box-shadow: 0 0 0 4px var(--accent), 0 0 0 13px rgba(53, 87, 232, 0.12); }
}

@keyframes tour-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.tour-tooltip {
	position: fixed;
	z-index: 500;
	width: 20rem;
	max-width: calc(100vw - 2rem);
	padding: 1rem 1.1rem;
	background: var(--card);
	border-radius: 12px;
	box-shadow: 0 4px 20px rgba(23, 27, 32, 0.22);
	animation: tour-pop-in 0.18s ease;
}

@keyframes tour-pop-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

.tour-progress {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.72rem;
	color: var(--ink-soft);
	margin-bottom: 0.3rem;
}

.tour-title {
	font-family: 'Space Grotesk', sans-serif;
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 0.4rem;
	color: var(--ink);
}

.tour-text {
	font-size: 0.88rem;
	line-height: 1.45;
	color: var(--ink);
	margin: 0 0 0.9rem;
}

.tour-actions {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 0.75rem;
}

.tour-skip {
	background: none;
	border: none;
	color: var(--ink-soft);
	font-size: 0.85rem;
	cursor: pointer;
	padding: 0.3rem 0;
}

.tour-skip:hover {
	color: var(--ink);
	text-decoration: underline;
}

.tour-next {
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 8px;
	padding: 0.5rem 1.1rem;
	font-size: 0.85rem;
	font-weight: 500;
	cursor: pointer;
}

.tour-next:hover {
	background: #2843c4;
}

/* --- Push notification toggle --- */

.help-btn.is-active {
	background: var(--accent-soft);
	color: var(--accent);
	border-color: var(--accent);
}

.push-hint {
	position: fixed;
	z-index: 500;
	max-width: 18rem;
	padding: 0.75rem 0.9rem;
	background: var(--ink);
	color: #fff;
	font-size: 0.82rem;
	line-height: 1.4;
	border-radius: 10px;
	box-shadow: 0 4px 16px rgba(23, 27, 32, 0.28);
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease;
	pointer-events: none;
}

.push-hint.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* --- "Что изменилось" page --- */

.changes-subtitle {
	color: var(--ink-soft);
	font-size: 0.88rem;
	margin: 0 0 1.5rem;
}

.changes-day-group {
	margin-bottom: 1.5rem;
}

.changes-day-label {
	font-family: 'IBM Plex Mono', monospace;
	font-size: 0.75rem;
	color: var(--ink-soft);
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-bottom: 0.5rem;
}

.change-card {
	background: var(--card);
	border-radius: 12px;
	border: 1px solid var(--line);
	padding: 0.85rem 1rem;
	margin-bottom: 0.6rem;
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
}

.change-card.is-hidden-extra {
	display: none;
}

.change-badge {
	flex-shrink: 0;
	width: 1.7rem;
	height: 1.7rem;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--accent-soft);
	color: var(--accent);
}

.change-badge svg {
	width: 16px;
	height: 16px;
}

.change-badge--added {
	background: #e7f5ee;
	color: #1a7d4a;
}

.change-badge--removed {
	background: #fbeceb;
	color: #b23b2e;
}

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

.change-title {
	font-weight: 500;
	font-size: 0.92rem;
	margin: 0 0 0.2rem;
}

.change-detail {
	color: var(--ink-soft);
	font-size: 0.85rem;
	line-height: 1.4;
	margin: 0;
}

.change-meta {
	font-size: 0.78rem;
	color: var(--line-strong);
	margin: 0.3rem 0 0;
}

.changes-more-btn {
	display: block;
	width: 100%;
	text-align: center;
	padding: 0.7rem;
	color: var(--accent);
	background: none;
	font-size: 0.85rem;
	font-weight: 500;
	border: 1px dashed var(--line-strong);
	border-radius: 12px;
	cursor: pointer;
}

.changes-more-btn:hover {
	background: var(--accent-soft);
}
