* {
  box-sizing: border-box;
}

:root {
  --bg-1: #eef8ff;
  --bg-2: #f8fbff;
  --text-1: #152f42;
  --text-2: #456379;
  --panel-bg: rgba(255, 255, 255, 0.86);
  --panel-border: #d6e6f3;
  --panel-shadow: 0 18px 40px rgba(11, 55, 87, 0.11);
  --accent: #0f79b4;
  --accent-strong: #0b618f;
  --blob-a: rgba(16, 141, 204, 0.12);
  --blob-b: rgba(2, 164, 122, 0.11);
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--text-1);
  background:
    radial-gradient(1000px 500px at 0% -10%, #d2ecff 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #e5f6ff 0%, transparent 58%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 42%, #ffffff 100%);
  min-height: 100vh;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(24px);
  pointer-events: none;
}

body::before {
  width: 280px;
  height: 280px;
  right: -80px;
  top: 100px;
  background: var(--blob-a);
}

body::after {
  width: 220px;
  height: 220px;
  left: -70px;
  bottom: 90px;
  background: var(--blob-b);
}

.container {
  width: min(1120px, 100% - 2rem);
  margin: 2rem auto;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
}

.content {
  min-width: 0;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
  letter-spacing: 0.01em;
}

.header p {
  margin: 0.4rem 0 1.4rem;
  color: var(--text-2);
}

.panel {
  background: var(--panel-bg);
  backdrop-filter: blur(5px);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  box-shadow: var(--panel-shadow);
  overflow: hidden;
  animation: fade-in-up 280ms ease-out;
}

.panels {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.panel h2 {
  margin: 0;
  padding: 0.95rem 1rem;
  font-size: 1rem;
  border-bottom: 1px solid #e7f1f7;
}

.bus-filter-wrap {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #e7f1f7;
  background: #fbfdff;
}

.bus-filter-wrap button.active {
  background: #084d76;
}

.toolbar {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  background: #eff8fd;
  border-bottom: 1px solid #d8e8f2;
}

.home-overview-panel {
  margin-top: 1rem;
}

.home-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
  padding: 0.9rem 1rem;
}

.overview-item {
  border: 1px solid #dcecf6;
  border-radius: 12px;
  background: #fbfdff;
  padding: 0.72rem 0.8rem;
  border-top: 3px solid #b9dff2;
}

.overview-label {
  color: #58758a;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.overview-value {
  font-weight: 600;
  color: #1b3d53;
  line-height: 1.35;
}

.home-live-wrap {
  border-top: 1px solid #e7f1f7;
  padding: 0.8rem 1rem 1rem;
}

.sidebar {
  position: sticky;
  top: 1rem;
}

.menu {
  display: grid;
  gap: 0.6rem;
  padding: 1rem;
}

.menu-btn {
  width: 100%;
  text-align: left;
  border-radius: 10px;
  color: #ffffff;
}

.menu-btn.active {
  filter: saturate(1.08) brightness(1.02);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

#menuOversiktBtn {
  background: linear-gradient(180deg, #0f8bb5 0%, #0b6f91 100%);
}

#menuBussarBtn {
  background: linear-gradient(180deg, #2c5fb8 0%, #1d428a 100%);
}

#menuSchemaBtn {
  background: linear-gradient(180deg, #2f7a5f 0%, #225f48 100%);
}

#menuHandelserBtn {
  background: linear-gradient(180deg, #7a4ea0 0%, #5f397f 100%);
}

#menuVaderBtn {
  background: linear-gradient(180deg, #b07a15 0%, #8b5d08 100%);
}

#menuSportBtn {
  background: linear-gradient(180deg, #9a4b22 0%, #773717 100%);
}

#themeToggleBtn {
  background: linear-gradient(180deg, #4d5d73 0%, #38465a 100%);
}

body.page-oversikt {
  --blob-a: rgba(11, 154, 205, 0.14);
  --blob-b: rgba(16, 184, 166, 0.12);
  background:
    radial-gradient(1000px 500px at 0% -10%, #d3f1ff 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #def9f8 0%, transparent 58%),
    linear-gradient(180deg, #edfaff 0%, #f7fdff 42%, #ffffff 100%);
}

body.page-bussar {
  --blob-a: rgba(41, 98, 205, 0.16);
  --blob-b: rgba(68, 131, 236, 0.11);
  background:
    radial-gradient(1000px 500px at 0% -10%, #dbe7ff 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #e5eeff 0%, transparent 58%),
    linear-gradient(180deg, #f1f6ff 0%, #f9fbff 42%, #ffffff 100%);
}

body.page-schema {
  --blob-a: rgba(52, 159, 120, 0.13);
  --blob-b: rgba(120, 203, 166, 0.1);
  background:
    radial-gradient(1000px 500px at 0% -10%, #dff5eb 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #e8faf2 0%, transparent 58%),
    linear-gradient(180deg, #f3fcf7 0%, #f8fcfa 42%, #ffffff 100%);
}

body.page-handelser {
  --blob-a: rgba(125, 85, 176, 0.16);
  --blob-b: rgba(176, 129, 225, 0.11);
  background:
    radial-gradient(1000px 500px at 0% -10%, #eee3ff 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #f5ecff 0%, transparent 58%),
    linear-gradient(180deg, #f7f2ff 0%, #fbf9ff 42%, #ffffff 100%);
}

body.page-vader {
  --blob-a: rgba(200, 143, 28, 0.16);
  --blob-b: rgba(255, 200, 86, 0.12);
  background:
    radial-gradient(1000px 500px at 0% -10%, #fff1cc 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #fff5dc 0%, transparent 58%),
    linear-gradient(180deg, #fff9ea 0%, #fffdf7 42%, #ffffff 100%);
}

body.page-sport {
  --blob-a: rgba(189, 89, 49, 0.18);
  --blob-b: rgba(221, 126, 65, 0.12);
  background:
    radial-gradient(1000px 500px at 0% -10%, #ffe1d4 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #ffeddf 0%, transparent 58%),
    linear-gradient(180deg, #fff4ef 0%, #fff9f6 42%, #ffffff 100%);
}

.hidden {
  display: none;
}

.schedule-panel {
  margin-top: 0;
}

.schedule-controls {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e7f1f7;
}

#scheduleSubjectFilter {
  border: 1px solid #c5d9e8;
  border-radius: 10px;
  background: #ffffff;
  color: #1b3d53;
  font-weight: 600;
  padding: 0.5rem 0.7rem;
}

.schedule-now {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e7f1f7;
  background: #fbfdff;
}

.schedule-now-title {
  font-weight: 700;
  margin-bottom: 0.45rem;
}

.schedule-now-row {
  color: #2e4d63;
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.schedule-controls button.active {
  background: #084d76;
}

.schedule-board {
  padding: 1rem 1rem 1.1rem;
}

.schedule-board-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.schedule-selected-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.schedule-week-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.schedule-week-nav button {
  border: 1px solid #c5d9e8;
  border-radius: 10px;
  background: #ffffff;
  color: #1b3d53;
  font-weight: 600;
  padding: 0.45rem 0.65rem;
}

.schedule-week-nav button:hover {
  border-color: #9fc2dc;
  background: #f5fbff;
}

.schedule-week-meta {
  color: #58758a;
  font-size: 0.9rem;
}


.schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.day-card {
  border: 1px solid #dcecf6;
  border-radius: 12px;
  overflow: hidden;
  background: #fdfefe;
}

.today-day {
  border-color: #c99900;
  box-shadow: inset 0 0 0 1px rgba(201, 153, 0, 0.25);
}

.today-day h3 {
  background: #fff3c8;
}

.day-card h3 {
  margin: 0;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border-bottom: 1px solid #e7f1f7;
  background: #f4fafe;
}

.day-lessons {
  list-style: none;
  padding: 0.5rem 0.65rem 0.65rem;
  margin: 0;
  display: grid;
  gap: 0.45rem;
}

.lesson-item {
  border: 1px solid #e3eef6;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  background: #fff;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.lesson-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(17, 78, 113, 0.12);
}

.lesson-item.active {
  border-color: #c99900;
  background: #fff7db;
}

.lesson-item.event-item {
  border-color: #dac8f0;
  background: #f8f3ff;
}

.lesson-item.event-item.test-item {
  border-color: #8c5ec0;
  background: #efe4ff;
}

.lesson-time {
  font-size: 0.82rem;
  color: #4d677b;
}

.lesson-subject {
  font-weight: 700;
  font-size: 0.95rem;
}

.lesson-meta {
  font-size: 0.82rem;
  color: #5d778b;
}

.day-empty {
  padding: 0.9rem 0.75rem;
  color: #6b8597;
  font-size: 0.88rem;
}

.schedule-error {
  padding: 0.9rem 0.75rem;
  color: #a02600;
}

.schedule-image-wrap img {
  display: none;
  width: 100%;
  max-width: 900px;
  height: auto;
  border: 1px solid #d8e8f2;
  border-radius: 10px;
}

button {
  border: 1px solid transparent;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, box-shadow 140ms ease;
}

button:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(11, 90, 131, 0.22);
}

button:active {
  transform: translateY(0);
}

button:focus-visible {
  outline: 2px solid #77c8f1;
  outline-offset: 2px;
}

#statusText {
  color: #36566b;
  font-size: 0.95rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid #e7f1f7;
  white-space: nowrap;
}

th {
  background: #f3f9fe;
  font-size: 0.85rem;
  color: #47667a;
  letter-spacing: 0.02em;
}

tbody tr:nth-child(even) {
  background: rgba(247, 251, 255, 0.45);
}

tbody tr:hover {
  background: #f8fcff;
}

.today-row {
  background: #fff7db;
}

.today-row:hover {
  background: #ffefb8;
}

.line {
  display: inline-block;
  min-width: 3rem;
  text-align: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #0b7bbd;
  color: #fff;
  font-weight: 700;
}

.deviation {
  display: block;
  margin-top: 0.3rem;
  color: #8f2500;
  font-size: 0.82rem;
}

.loading,
.error,
.empty {
  text-align: center;
  color: #36566b;
  padding: 1rem;
}

.error {
  color: #a02600;
}

.weather-current {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid #e7f1f7;
}

.events-form-wrap {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid #e7f1f7;
}

.events-form {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.events-form label {
  display: grid;
  gap: 0.25rem;
  color: #35546a;
  font-size: 0.9rem;
}

.events-form input,
.events-form select {
  border: 1px solid #c5d9e8;
  border-radius: 10px;
  background: #ffffff;
  color: #1b3d53;
  font-weight: 600;
  padding: 0.5rem 0.65rem;
}

.events-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
}

.events-list-wrap {
  padding: 0.9rem 1rem 1rem;
}

.events-list {
  list-style: none;
  padding: 0;
  margin: 0.55rem 0 0;
  display: grid;
  gap: 0.45rem;
}

.events-list.compact {
  margin-top: 0.35rem;
}

.events-list.compact li {
  color: #2e4d63;
  font-size: 0.92rem;
}

.events-item {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  border: 1px solid #dcecf6;
  border-radius: 10px;
  background: #fbfdff;
  padding: 0.5rem 0.6rem;
}

.events-remove-btn {
  padding: 0.35rem 0.6rem;
  font-size: 0.84rem;
}

.events-empty {
  color: #5d778b;
  font-size: 0.92rem;
}

.sport-iframe-panel {
  margin-top: 1rem;
}

.iframe-wrap {
  padding: 0.9rem 1rem 1rem;
}

.iframe-wrap iframe {
  width: 100%;
  min-height: 580px;
  border: 1px solid #d8e8f2;
  border-radius: 12px;
  background: #ffffff;
}


#weatherNow {
  font-weight: 600;
}

#weatherUpdated {
  margin-top: 0.25rem;
  color: #47667a;
  font-size: 0.92rem;
}

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

  .sidebar {
    position: static;
  }
}

body.theme-dark {
  color: #d7e6ef;
  background: radial-gradient(circle at top, #10202c 0%, #0c161f 45%, #0a1218 100%);
}

body.theme-dark::before {
  background: rgba(31, 143, 209, 0.12);
}

body.theme-dark::after {
  background: rgba(9, 153, 117, 0.1);
}

body.theme-dark .panel {
  background: #0f1a23;
  border-color: #243848;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

body.theme-dark .panel h2,
body.theme-dark .toolbar,
body.theme-dark .bus-filter-wrap,
body.theme-dark .schedule-now,
body.theme-dark .schedule-controls,
body.theme-dark .weather-current {
  border-bottom-color: #243848;
}

body.theme-dark .toolbar,
body.theme-dark .bus-filter-wrap,
body.theme-dark .schedule-now,
body.theme-dark th {
  background: #13222e;
}

body.theme-dark #scheduleSubjectFilter {
  border-color: #2e495b;
  background: #0f1c25;
  color: #d7e6ef;
}


body.theme-dark .overview-item {
  border-color: #274050;
  background: #132430;
  border-top-color: #2f7aa4;
}

body.theme-dark .lesson-item.event-item {
  border-color: #5b4b76;
  background: #261f33;
}

body.theme-dark .lesson-item.event-item.test-item {
  border-color: #7a59aa;
  background: #33234b;
}

body.theme-dark .overview-label {
  color: #9fb6c7;
}

body.theme-dark .overview-value {
  color: #d7e6ef;
}

body.theme-dark .home-live-wrap {
  border-top-color: #243848;
}

body.theme-dark .header p,
body.theme-dark #statusText,
body.theme-dark #weatherUpdated,
body.theme-dark .schedule-now-row {
  color: #9fb6c7;
}

body.theme-dark th {
  color: #a9c2d4;
}

body.theme-dark th,
body.theme-dark td {
  border-bottom-color: #1f3241;
}

body.theme-dark tbody tr:hover {
  background: #162736;
}

body.theme-dark .today-row {
  background: #3a3013;
}

body.theme-dark .today-row:hover {
  background: #4a3d18;
}

body.theme-dark .schedule-image-wrap img {
  border-color: #2b4253;
}

body.theme-dark .iframe-wrap iframe {
  border-color: #2b4253;
  background: #0f1a23;
}

body.theme-dark .schedule-week-meta,
body.theme-dark .lesson-time,
body.theme-dark .lesson-meta,
body.theme-dark .day-empty {
  color: #9fb6c7;
}

body.theme-dark .schedule-week-nav button {
  border-color: #2e5067;
  background: #132f41;
  color: #d7ecff;
}

body.theme-dark .schedule-week-nav button:hover {
  border-color: #3f6886;
  background: #19425a;
}

body.theme-dark .day-card {
  border-color: #274050;
  background: #101d27;
}

body.theme-dark .day-card h3 {
  background: #162835;
  border-bottom-color: #274050;
}

body.theme-dark .today-day {
  border-color: #aa8a2e;
  box-shadow: inset 0 0 0 1px rgba(170, 138, 46, 0.35);
}

body.theme-dark .today-day h3 {
  background: #322912;
}

body.theme-dark .lesson-item {
  border-color: #2a4354;
  background: #12212c;
}

body.theme-dark .lesson-item.active {
  border-color: #aa8a2e;
  background: #3a3013;
}

body.theme-dark .line {
  background: #1f8fd1;
}

body.theme-dark button {
  background: linear-gradient(180deg, #2495d5 0%, #1a75a9 100%);
}

body.theme-dark button:hover {
  filter: brightness(1.04);
}

body.theme-dark .menu-btn.active,
body.theme-dark .schedule-controls button.active {
  background: #0f5f8e;
}

body.theme-dark #menuOversiktBtn {
  background: linear-gradient(180deg, #1b8eb6 0%, #145e79 100%);
}

body.theme-dark #menuBussarBtn {
  background: linear-gradient(180deg, #3e71c8 0%, #243f79 100%);
}

body.theme-dark #menuSchemaBtn {
  background: linear-gradient(180deg, #2f8665 0%, #205b45 100%);
}

body.theme-dark #menuHandelserBtn {
  background: linear-gradient(180deg, #8455b1 0%, #5a3a7a 100%);
}

body.theme-dark #menuVaderBtn {
  background: linear-gradient(180deg, #b68222 0%, #805a12 100%);
}

body.theme-dark #menuSportBtn {
  background: linear-gradient(180deg, #a4562f 0%, #6e3519 100%);
}

body.theme-dark.page-oversikt {
  --blob-a: rgba(41, 158, 207, 0.2);
  --blob-b: rgba(20, 170, 140, 0.16);
  background:
    radial-gradient(1000px 500px at 0% -10%, #0f2c3a 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #112f32 0%, transparent 58%),
    linear-gradient(180deg, #0b1a24 0%, #0a141c 42%, #09121a 100%);
}

body.theme-dark.page-bussar {
  --blob-a: rgba(66, 118, 214, 0.22);
  --blob-b: rgba(50, 89, 176, 0.16);
  background:
    radial-gradient(1000px 500px at 0% -10%, #14223d 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #152749 0%, transparent 58%),
    linear-gradient(180deg, #0c1528 0%, #0a1220 42%, #09101a 100%);
}

body.theme-dark.page-schema {
  --blob-a: rgba(56, 159, 120, 0.22);
  --blob-b: rgba(32, 122, 92, 0.16);
  background:
    radial-gradient(1000px 500px at 0% -10%, #132a22 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #123126 0%, transparent 58%),
    linear-gradient(180deg, #0b1b16 0%, #0a1613 42%, #09120f 100%);
}

body.theme-dark.page-handelser {
  --blob-a: rgba(131, 89, 186, 0.24);
  --blob-b: rgba(99, 66, 146, 0.17);
  background:
    radial-gradient(1000px 500px at 0% -10%, #211633 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #25193b 0%, transparent 58%),
    linear-gradient(180deg, #150f23 0%, #110c1d 42%, #0d0916 100%);
}

body.theme-dark.page-vader {
  --blob-a: rgba(196, 141, 32, 0.22);
  --blob-b: rgba(150, 103, 17, 0.18);
  background:
    radial-gradient(1000px 500px at 0% -10%, #2f2412 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #332710 0%, transparent 58%),
    linear-gradient(180deg, #1f170b 0%, #171107 42%, #130e06 100%);
}

body.theme-dark.page-sport {
  --blob-a: rgba(188, 87, 47, 0.25);
  --blob-b: rgba(144, 62, 29, 0.18);
  background:
    radial-gradient(1000px 500px at 0% -10%, #341c14 0%, transparent 60%),
    radial-gradient(900px 420px at 100% -20%, #2f1a11 0%, transparent 58%),
    linear-gradient(180deg, #20110b 0%, #170d08 42%, #130a06 100%);
}

body.theme-dark .events-form-wrap,
body.theme-dark .events-list-wrap {
  border-color: #243848;
}

body.theme-dark .events-form label,
body.theme-dark .events-list.compact li,
body.theme-dark .events-empty {
  color: #9fb6c7;
}

body.theme-dark .events-form input,
body.theme-dark .events-form select {
  border-color: #2e495b;
  background: #0f1c25;
  color: #d7e6ef;
}

body.theme-dark .events-item {
  border-color: #274050;
  background: #132430;
}

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