:root {
	--bg: #020617;
	--bg2: #0f172a;
	--card: rgba(30, 41, 59, 0.9);
	--border: rgba(148, 163, 184, 0.26);
	--text: #f8fafc;
	--muted: rgba(226, 232, 240, 0.72);
	--primary: #a5b4fc;
	--primary2: #6366f1;
	--danger: #ef4444;
	--radius: 18px;
	--shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
	--shadow2: 0 12px 32px rgba(0, 0, 0, 0.35);
	--ring: 0 0 0 3px rgba(99, 102, 241, 0.25);
	--ring-strong: 0 0 0 4px rgba(165, 180, 252, 0.28);
}

* { box-sizing: border-box; }
html, body {
	height: 100%;
	overflow-x: hidden;
}
html { color-scheme: dark; }
@supports (overflow-x: clip) {
	html, body { overflow-x: clip; }
}
body {
	margin: 0;
	font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	background: var(--bg);
	color: var(--text);
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

/* Background (shared pattern with CGPA tools / goal planner) */
.gradient-overlay {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background:
		radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.16) 0%, transparent 50%),
		radial-gradient(circle at 80% 80%, rgba(165, 180, 252, 0.14) 0%, transparent 50%);
	pointer-events: none;
	z-index: 0;
}

.gradient-overlay::after {
	content: '';
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 300px;
	background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

/* Page layout (scoped to avoid collisions with global responsive.css) */
.ac { min-height: 100%; position: relative; z-index: 1; }

.ac-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 1.5rem 1.25rem 3rem;
}

.ac-muted { color: var(--muted); }

.ac-topbar {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 0.75rem;
	margin-bottom: 1.1rem;
}

.ac-topbar-title {
	font-size: 1.05rem;
	font-weight: 900;
	letter-spacing: -0.02em;
	color: rgba(248, 250, 252, 0.98);
	min-width: 0;
}

.ac-back {
	justify-self: start;
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	text-decoration: none;
	color: rgba(226, 232, 240, 0.88);
	padding: 0.45rem 0.7rem;
	border-radius: 999px;
	border: 1px solid rgba(148, 163, 184, 0.22);
	background: rgba(2, 6, 23, 0.25);
	transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
	max-width: 100%;
}

.ac-back:hover {
	transform: translateY(-1px);
	color: var(--text);
	border-color: rgba(165, 180, 252, 0.42);
	background: rgba(2, 6, 23, 0.35);
}

.ac-topbar-spacer { justify-self: end; }

/* Teacher-Reviews-style header */
.ac-sub-navbar { margin-bottom: 1.25rem; }

.ac-sub-nav-content {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ac-sub-back-link {
	position: absolute;
	left: 0;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	color: rgba(226, 232, 240, 0.82);
	text-decoration: none;
	padding: 0.35rem 0.6rem;
	border-radius: 0.75rem;
	transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
	font-size: 0.9rem;
	font-weight: 750;
}

.ac-sub-back-link:hover {
	color: rgba(199, 210, 254, 0.98);
	background: rgba(30, 41, 59, 0.35);
	transform: translateX(-3px);
}

.ac-sub-nav-title {
	text-align: center;
	font-size: 1.3rem;
	font-weight: 900;
	margin: 0;
	background: linear-gradient(135deg, var(--primary2), var(--primary));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.ac-hero {
	text-align: center;
	margin: 0 0 1.35rem;
}

.ac-hero-title {
	margin: 0;
	font-size: 2rem;
	font-weight: 950;
	letter-spacing: -0.03em;
	line-height: 1.2;
}

.ac-hero-highlight {
	background: linear-gradient(135deg, var(--primary2), var(--primary));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.ac-hero-subtitle {
	margin: 0.55rem auto 0;
	max-width: 620px;
	font-size: 1rem;
	color: rgba(148, 163, 184, 0.95);
}

.ac-header {
	background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(2, 6, 23, 0.22));
	border: 1px solid rgba(148, 163, 184, 0.2);
	border-radius: calc(var(--radius) + 10px);
	box-shadow: var(--shadow);
	backdrop-filter: blur(22px);
	padding: 1.35rem;
}

.ac-header-main {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-width: 0;
}

.ac-header-text { min-width: 0; }

.ac-header-icon {
	width: 56px;
	height: 56px;
	border-radius: 18px;
	display: grid;
	place-items: center;
	background: rgba(99, 102, 241, 0.18);
	border: 1px solid rgba(99, 102, 241, 0.35);
	color: rgba(199, 210, 254, 0.98);
	font-size: 1.25rem;
}

.ac-header-text h1 {
	margin: 0;
	font-size: 1.75rem;
	font-weight: 950;
	letter-spacing: -0.03em;
	line-height: 1.15;
}

.ac-header-text p { margin: 0.25rem 0 0; }

.ac-controls {
	margin-top: 1rem;
	display: flex;
	align-items: end;
	justify-content: space-between;
	gap: 0.9rem;
	flex-wrap: wrap;
	min-width: 0;
}

.ac-field { display: grid; gap: 0.35rem; min-width: 260px; }
.ac-field span { font-size: 0.85rem; font-weight: 950; color: rgba(226, 232, 240, 0.78); }
.ac-field select {
	width: 100%;
	padding: 0.75rem 0.9rem;
	border-radius: 14px;
	border: 1px solid rgba(148, 163, 184, 0.28);
	background: rgba(2, 6, 23, 0.38);
	color: var(--text);
	color-scheme: dark;
}
.ac-field select:focus { outline: none; border-color: rgba(165, 180, 252, 0.55); box-shadow: var(--ring); }

.ac-field select option,
.ac-field select optgroup {
	background: var(--bg);
	color: var(--text);
}

.ac-month-nav { display: flex; align-items: center; gap: 0.55rem; }
.ac-month-label {
	min-width: 170px;
	text-align: center;
	font-weight: 950;
	letter-spacing: -0.015em;
	color: rgba(248, 250, 252, 1);
	padding: 0 0.25rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.ac-btn {
	appearance: none;
	border: 1px solid rgba(148, 163, 184, 0.22);
	background: rgba(2, 6, 23, 0.3);
	color: rgba(248, 250, 252, 0.96);
	padding: 0.6rem 0.85rem;
	border-radius: 999px;
	font-weight: 900;
	cursor: pointer;
	transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.ac-btn:hover { transform: translateY(-1px); background: rgba(2, 6, 23, 0.44); border-color: rgba(165, 180, 252, 0.46); }
.ac-btn:focus-visible { outline: none; box-shadow: var(--ring); }

.ac-btn-icon { padding: 0.6rem 0.7rem; width: 40px; display: inline-grid; place-items: center; }

.ac-grid {
	margin-top: 1rem;
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
	align-items: start;
}

.ac-card {
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow2);
	backdrop-filter: blur(20px);
}

.ac-card-head {
	padding: 1.05rem 1.05rem 0.75rem;
	display: flex;
	align-items: start;
	justify-content: space-between;
	gap: 0.8rem;
	min-width: 0;
}

.ac-card-title { font-weight: 950; letter-spacing: -0.015em; }
.ac-card-sub { margin-top: 0.15rem; font-size: 0.95rem; }
.ac-card-body { padding: 0 1.05rem 1.05rem; }

.ac-status { margin-top: 0.75rem; }

.ac-legend { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.ac-legend-item { display: inline-flex; align-items: center; gap: 0.35rem; color: rgba(226, 232, 240, 0.82); font-weight: 850; font-size: 0.86rem; }

.ac-upcoming-title { font-size: 0.95rem; font-weight: 900; color: rgba(148, 163, 184, 0.95); }

/* Modal */
body.ac-modal-open { overflow: hidden; }

.ac-modal {
	position: fixed;
	inset: 0;
	z-index: 60;
	display: grid;
	place-items: center;
	padding: 1rem;
}

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

.ac-modal-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(2, 6, 23, 0.72);
	backdrop-filter: blur(6px);
}

.ac-modal-panel {
	position: relative;
	width: min(760px, calc(100vw - 2rem));
	max-height: min(78vh, 720px);
	overflow: hidden;
	border-radius: calc(var(--radius) + 6px);
	background: linear-gradient(135deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.96));
	border: 1px solid rgba(148, 163, 184, 0.22);
	box-shadow: var(--shadow);
	backdrop-filter: blur(22px);
}

.ac-modal-head {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: 1.05rem 1.05rem 0.75rem;
	display: flex;
	align-items: start;
	justify-content: space-between;
	gap: 0.75rem;
	border-bottom: 1px solid rgba(148, 163, 184, 0.16);
	background: linear-gradient(135deg, rgba(30, 41, 59, 0.98), rgba(15, 23, 42, 0.98));
	backdrop-filter: blur(22px);
}

.ac-modal-actions { display: inline-flex; align-items: center; gap: 0.55rem; }

.ac-modal-title { font-weight: 950; letter-spacing: -0.015em; font-size: 1.1rem; }
.ac-modal-sub { margin-top: 0.15rem; font-size: 0.95rem; }

.ac-modal-body {
	padding: 1rem 1.05rem 1.05rem;
	overflow: auto;
	max-height: calc(min(78vh, 720px) - 74px);
}

.weekday {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0.45rem;
	color: rgba(226, 232, 240, 0.7);
	font-weight: 900;
	font-size: 0.86rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-bottom: 0.55rem;
}

.month-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 0.45rem;
	width: 100%;
	min-width: 0;
}

.day {
	min-height: 86px;
	border-radius: 16px;
	border: 1px solid rgba(148, 163, 184, 0.18);
	background: rgba(2, 6, 23, 0.18);
	padding: 0.6rem 0.65rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	cursor: pointer;
	transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
	min-width: 0;
}

.day:hover { transform: translateY(-1px); border-color: rgba(165, 180, 252, 0.36); background: rgba(2, 6, 23, 0.24); }
.day:focus-visible { outline: none; box-shadow: var(--ring); }
.day.outside { opacity: 0.35; }
.day.today { border-color: rgba(99, 102, 241, 0.75); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18) inset; }
.day.selected { border-color: rgba(165, 180, 252, 0.78); box-shadow: var(--ring-strong) inset; background: rgba(99, 102, 241, 0.08); }

.day-top { display: flex; align-items: center; justify-content: space-between; }
.day-num { font-weight: 950; font-size: 0.95rem; color: rgba(248, 250, 252, 0.95); }


.dots { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.dot { width: 11px; height: 11px; border-radius: 999px; display: inline-block; }
.dot-high { background: rgba(239, 68, 68, 0.95); box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.22), 0 0 14px rgba(239, 68, 68, 0.28); }
.dot-mid { background: rgba(245, 158, 11, 0.95); box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2), 0 0 14px rgba(245, 158, 11, 0.26); }
.dot-reg { background: rgba(99, 102, 241, 0.96); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.22), 0 0 14px rgba(99, 102, 241, 0.26); }
.dot-low { background: rgba(34, 197, 94, 0.95); box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18), 0 0 14px rgba(34, 197, 94, 0.22); }

/* Desktop vs mobile month-cell density */
.day-items { display: grid; }
.day .dots { display: none; }

.day-items {
	display: grid;
	gap: 0.25rem;
	margin-top: 0.25rem;
}

.day-item {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	min-width: 0;
	font-size: 0.78rem;
	font-weight: 850;
	color: rgba(248, 250, 252, 0.82);
}

.day-item .dot { width: 8px; height: 8px; }

.day-item-text {
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.day-more {
	font-size: 0.75rem;
	font-weight: 850;
	color: rgba(226, 232, 240, 0.62);
}

.legend { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; color: rgba(226, 232, 240, 0.82); font-weight: 800; font-size: 0.86rem; }

.events { display: grid; gap: 0.65rem; }
.event {
	border-radius: 16px;
	border: 1px solid rgba(148, 163, 184, 0.16);
	background: rgba(2, 6, 23, 0.18);
	padding: 0.9rem;
	transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.event[role="button"] { cursor: pointer; }
.event[role="button"]:hover { transform: translateY(-1px); border-color: rgba(165, 180, 252, 0.32); background: rgba(2, 6, 23, 0.28); }
.event[role="button"]:focus-visible { outline: none; box-shadow: var(--ring); }

.event-head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem;
	min-width: 0;
}

.event-title {
	font-weight: 950;
	letter-spacing: -0.01em;
	min-width: 0;
}

.event-range {
	font-size: 0.86rem;
	font-weight: 850;
	white-space: nowrap;
	flex: 0 0 auto;
	margin-top: 0.12rem;
}

.event-meta {
	margin-top: 0.55rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	align-items: center;
}

.event-desc {
	margin-top: 0.6rem;
	padding-top: 0.6rem;
	border-top: 1px solid rgba(148, 163, 184, 0.14);
	white-space: pre-wrap;
	color: rgba(248, 250, 252, 0.9);
	line-height: 1.55;
}

.pill {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	border: 1px solid rgba(148, 163, 184, 0.24);
	color: rgba(248, 250, 252, 0.88);
	font-size: 0.82rem;
	font-weight: 900;
}

.pill .dot { width: 8px; height: 8px; }

.pill-high {
	border-color: rgba(239, 68, 68, 0.35);
}

.divider { height: 1px; background: rgba(148, 163, 184, 0.16); margin: 1rem 0; }


@media (max-width: 980px) {
	.ac-grid { grid-template-columns: 1fr; }
	.ac-month-label { min-width: 140px; }
	.ac-topbar { grid-template-columns: auto 1fr; }
	.ac-topbar-title { justify-self: end; }
	.ac-topbar-spacer { display: none; }
}

@media (max-width: 720px) {
	.ac-controls { gap: 0.75rem; }
	.ac-card-head { flex-direction: column; align-items: stretch; }
	.ac-legend { justify-content: flex-start; }
	.ac-month-nav { width: 100%; justify-content: space-between; }
	.ac-month-label { flex: 1; min-width: 0; }
	.day-items { display: none; }
	.day .dots { display: flex; }
}

@media (max-width: 520px) {
	.ac-container { padding: 1rem 0.95rem 2rem; }
	.ac-header-main { align-items: start; }
	.ac-header-icon { width: 48px; height: 48px; border-radius: 16px; }
	.ac-header-text h1 { font-size: 1.4rem; }
	.ac-sub-nav-content { flex-direction: column; align-items: center; gap: 0.5rem; }
	.ac-sub-back-link { position: static; align-self: flex-start; }
	.ac-sub-nav-title { margin-top: 0.1rem; }
	.ac-field { min-width: 100%; }
	.ac-month-nav { width: 100%; justify-content: space-between; }
	.ac-month-label { min-width: auto; }
	.month-grid { gap: 0.4rem; }
	.day { min-height: 72px; padding: 0.55rem 0.55rem; border-radius: 14px; }
	.dots { gap: 0.25rem; }
	.dot { width: 10px; height: 10px; }

	.ac-modal { padding: 0.75rem; }
	.ac-modal-panel { width: calc(100vw - 1.5rem); max-height: 84vh; border-radius: 16px; }
	.ac-modal-actions { flex-wrap: wrap; justify-content: flex-end; }
	.ac-btn { padding: 0.55rem 0.8rem; }
	.ac-btn-icon { width: 38px; }
	.event-range { white-space: normal; text-align: right; }
}
