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

:root {
  --bg: #0f1117;
  --surface: rgba(26, 29, 39, 0.65);
  --surface-hover: rgba(37, 40, 54, 0.8);
  --text: #e4e6ed;
  --text-muted: #8b8fa3;
  --text-dim: rgba(255, 255, 255, 0.4);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --bg-image: url("https://images.unsplash.com/photo-1507525428034-b723cf961d3e?w=1920&q=80");
}

html {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -24px;
  background: var(--bg-image) center/cover no-repeat;
  filter: blur(8px) brightness(0.65) saturate(1.2);
  z-index: -2;
}

/* App shell */

.app-shell {
  display: flex;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 1.5rem;
  gap: 1rem;
}

/* Start row — pairs start panel + agenda side by side */
.start-row {
  display: flex;
  align-items: flex-start;
  align-self: center;
  gap: 1rem;
}

body.portal-active .start-row {
  display: contents;
}

/* Start panel */
.start-panel {
  position: relative;
  width: 760px;
  max-width: 100%;
  padding: 3rem 2.5rem 2rem;
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Portal panel (hidden by default on home page, visible when active) */
.portal-panel {
  display: none;
}

.portal-panel:empty {
  display: none !important;
}

/* Auth + agenda controls on start card */
.start-auth {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  z-index: 1;
}

.start-auth .auth-user-name {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.start-auth .auth-signin,
.start-auth .auth-signout {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.start-auth .auth-signin:hover,
.start-auth .auth-signout:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.start-agenda-toggle {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.start-agenda-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

/* Hero */

.hero {
  text-align: center;
  margin-bottom: 0.75rem;
}

.greeting {
  font-size: 2.25rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.date {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* Weather */

.weather {
  display: flex;
  justify-content: center;
  padding: 0.75rem 0;
  margin-bottom: 1.5rem;
}

.weather-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.weather-loading {
  font-size: 0.8125rem;
  color: var(--text-dim);
  padding: 1rem 0;
}

.weather-current {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.weather-current__top {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.weather-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.weather-info {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.weather-temp {
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: -0.02em;
}

.weather-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.weather-range {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
}

/* Sunrise / sunset */
.weather-sun {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.weather-sun__item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.weather-sun__icon {
  width: 20px;
  height: 20px;
}

/* 5-day forecast strip */
.weather-forecast {
  display: flex;
  gap: 0.25rem;
  border-left: 1px solid var(--border);
  padding-left: 1.5rem;
}

.weather-forecast__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: 0.25rem 0.375rem;
}

.weather-forecast__name {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.weather-forecast__icon {
  width: 32px;
  height: 32px;
}

.weather-forecast__img {
  width: 100%;
  height: 100%;
}

.weather-forecast__temps {
  display: flex;
  gap: 0.375rem;
  font-size: 0.75rem;
}

.weather-forecast__hi {
  color: var(--text);
}

.weather-forecast__lo {
  color: var(--text-dim);
}

.weather-forecast__precip {
  font-size: 0.625rem;
  color: #60a5fa;
  opacity: 0.7;
}

/* Search */

.search {
  position: relative;
  max-width: 520px;
  margin: 0 auto 2.5rem;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search input::placeholder {
  color: var(--text-dim);
}

.search input:focus {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.1);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.portal-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  float: right;
  margin-top: 0.75rem;
  padding: 0.5rem 1rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: background 0.2s, color 0.2s;
}

.portal-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.portal-link__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.portal-link__text {
  font-weight: 500;
}

.portal-link__arrow {
  opacity: 0.4;
  flex-shrink: 0;
}

/* Status bar — floating bottom-left */

.status-bar {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.5rem 0.875rem;
  background: rgba(15, 17, 23, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
}

.status-bar__label {
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.status-bar__item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  text-decoration: none;
  font-size: 0.625rem;
  color: var(--text-dim);
  transition: color 0.15s ease;
}

.status-bar__item:hover {
  color: var(--text-muted);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.status-dot--operational { background: #34d399; }
.status-dot--minor { background: #fbbf24; }
.status-dot--major,
.status-dot--critical { background: #f87171; }

.light-mode .status-bar {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .status-bar__label { color: #9ca3af; }
.light-mode .status-bar__item { color: #9ca3af; }
.light-mode .status-bar__item:hover { color: #4b5563; }
.light-mode .status-dot { background: #d1d5db; }

/* Tiles */

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  padding: 1.125rem 0.5rem 0.875rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.tile:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
}

.tile:active {
  transform: translateY(0);
}

/* SVG icon tiles */
.tile-icon {
  position: relative;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tile-icon svg {
  width: 40px;
  height: 40px;
}

/* Brand PNG icon tiles */
.tile-icon--brand img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.tile-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
  color: var(--text-muted);
}

.tile:hover .tile-label {
  color: var(--text);
}

.tile-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e53e3e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

/* Responsive */

@media (max-width: 640px) {
  .app-shell {
    padding: 0.75rem;
  }

  .start-panel {
    padding: 2rem 1.25rem 1.5rem;
    border-radius: 20px;
  }

  .greeting {
    font-size: 1.75rem;
  }

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

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

  .weather-range {
    display: none;
  }

}

/* ========================================
   Portal Layout
   ======================================== */

/* Top navigation bar (portal mode) */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  flex-direction: column;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}

.topbar__primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 1.5rem;
}

.topbar__breadcrumb {
  padding: 0 1.5rem 0.5rem;
  display: flex;
  justify-content: center;
}

.topbar__breadcrumb .portal-nav {
  margin-bottom: 0;
}

body.portal-active .topbar {
  display: flex;
}

body.portal-active .start-row {
  display: none;
}

body.portal-active .app-shell {
  display: block;
  max-width: none;
  padding: 0;
}

.topbar__back {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

.topbar__back:hover {
  color: var(--text);
}

.topbar__nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.topbar__link {
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar__link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.topbar__link--active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.15), rgba(139, 92, 246, 0.15));
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar__weather {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.topbar__weather .weather-icon {
  width: 28px;
  height: 28px;
}

.topbar__weather .weather-temp {
  font-size: 0.875rem;
  font-weight: 400;
}

/* Portal panel (full-width below topbar) */
.portal-panel--visible {
  display: flex;
  flex-direction: column;
  max-width: 920px;
  margin: calc(80px + 1.5rem) auto 1.5rem;
  padding: 2rem 2.5rem;
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  min-height: calc(100dvh - 80px - 3rem);
  overflow: clip;
}

/* Portal hero banner */
.portal-hero {
  position: relative;
  margin: calc(-2rem - 1px) calc(-2.5rem - 1px) 2rem;
  padding: 3rem 5rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  text-align: center;
}

.portal-hero__bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.portal-hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(15, 17, 23, 0.5), rgba(15, 17, 23, 0.85));
}

.portal-hero__content {
  position: relative;
  z-index: 1;
}

.portal-hero__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--section-color, #60a5fa) 20%, transparent);
  color: var(--section-color, #60a5fa);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  padding: 14px;
}

.portal-hero__icon svg {
  width: 100%;
  height: 100%;
}

.portal-hero__title {
  font-size: 1.75rem;
  font-weight: 300;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.portal-hero__desc {
  font-size: 0.9375rem;
  color: rgba(255, 255, 255, 0.65);
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Portal navigation / breadcrumbs */
.portal-nav {
  margin-bottom: 0;
}

/* Auth status (topbar) */
.auth-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.portal-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.portal-breadcrumbs li:not(:last-child)::after {
  content: "›";
  margin-left: 0.375rem;
  color: var(--text-dim);
}

.portal-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.portal-breadcrumbs a:hover {
  color: var(--text);
}

.portal-breadcrumbs li[aria-current="page"] {
  color: var(--text);
}

/* Portal content area */
.portal-content {
  flex: 1;
}

/* Portal page */
.portal-page__title {
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

/* Portal cards grid */
.portal-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.portal-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--section-color, #60a5fa));
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.portal-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  border-left-color: var(--card-color, var(--section-color, #60a5fa));
}

.portal-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--card-color, var(--section-color, #60a5fa)) 12%, transparent);
  color: var(--card-color, var(--section-color, #60a5fa));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 10px;
}

.portal-card__icon svg {
  width: 100%;
  height: 100%;
}

.portal-card__info {
  flex: 1;
  min-width: 0;
}

.portal-card__title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.portal-card__desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Portal back link */
.portal-back {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 2rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.portal-back:hover {
  color: var(--text);
}

/* Portal body — markdown content typography */
.portal-body {
  line-height: 1.7;
  color: var(--text);
}

.portal-body h1 {
  font-size: 1.75rem;
  font-weight: 300;
  letter-spacing: -0.02em;
  margin: 2rem 0 1rem;
}

.portal-body h2 {
  font-size: 1.375rem;
  font-weight: 400;
  margin: 2rem 0 1rem;
  padding: 0.75rem 1rem;
  border-bottom: none;
  border-left: 3px solid var(--section-color, #60a5fa);
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-color, #60a5fa) 8%, transparent), transparent);
  border-radius: 0 8px 8px 0;
}

.portal-body h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 1.75rem 0 0.5rem;
  color: var(--section-color, #60a5fa);
  padding-bottom: 0.375rem;
  border-bottom: 1px solid color-mix(in srgb, var(--section-color, #60a5fa) 25%, transparent);
}

.portal-body h4 {
  font-size: 1rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--section-color, #60a5fa) 70%, var(--text));
  margin: 1.25rem 0 0.5rem;
}

.portal-body p {
  margin-bottom: 1rem;
}

.portal-body ul,
.portal-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.portal-body li {
  margin-bottom: 0.375rem;
}

.portal-body a {
  color: #60a5fa;
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.portal-body a:hover {
  text-decoration-color: #60a5fa;
}

.portal-body strong {
  font-weight: 600;
  color: var(--text);
}

.portal-body hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-color, #60a5fa) 40%, transparent), transparent);
  margin: 2.5rem 0;
}

.portal-body blockquote {
  border-left: 3px solid rgba(96, 165, 250, 0.4);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(96, 165, 250, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
}

.portal-body table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.portal-body th,
.portal-body td {
  padding: 0.5rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.portal-body table th:first-child,
.portal-body table td:first-child { padding-left: 0; }

.portal-body table th:last-child,
.portal-body table td:last-child { padding-right: 0; }

.portal-body th {
  font-weight: 500;
  color: var(--text);
}

.portal-body td {
  color: var(--text-muted);
}

.portal-body table td,
.portal-body table th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.portal-body table td:nth-child(2) {
  white-space: normal;
  overflow: visible;
}

.portal-body table th:nth-child(1),
.portal-body table td:nth-child(1) { width: 17%; }

.portal-body table th:nth-child(2),
.portal-body table td:nth-child(2) { width: 19%; }

.portal-body table th:nth-child(3),
.portal-body table td:nth-child(3) { width: 5%; }

.portal-body table th:nth-child(4),
.portal-body table td:nth-child(4) { width: 14%; }

.portal-body table th:nth-child(5),
.portal-body table td:nth-child(5) { width: 29%; }

.portal-body table th:nth-child(6),
.portal-body table td:nth-child(6) { width: 16%; }

#direct-numbers + table {
  table-layout: auto;
  width: auto;
}

#direct-numbers + table th,
#direct-numbers + table td {
  width: auto;
}

/* App QR code cards */
.app-qr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.app-qr__info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-qr__icon {
  border-radius: 10px;
  flex-shrink: 0;
}

.app-qr__name {
  font-weight: 500;
  color: var(--text);
  font-size: 0.95rem;
}

.app-qr__desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
}

.app-qr__codes {
  display: flex;
  gap: 1rem;
}

.app-qr__code {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
}

.app-qr__code img {
  border-radius: 8px;
}

.app-qr__label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Collapsible sections */
.portal-body details {
  margin: 0.75rem 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.portal-body summary {
  padding: 0.875rem 1rem;
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}

.portal-body summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.portal-body details[open] summary {
  border-bottom: 1px solid var(--border);
}

.portal-body details > :not(summary) {
  padding: 0 1rem;
}

.portal-body details > p:first-of-type {
  margin-top: 1rem;
}

.yt-lite {
  position: relative;
  margin: 1rem;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  cursor: pointer;
  background: #000;
}

.yt-lite img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-lite__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.yt-lite:hover .yt-lite__play { opacity: 1; }

.yt-lite--active { cursor: default; }

.yt-lite iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Shortcode: topic card */
.topic-card {
  position: relative;
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  margin: 0.75rem 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.topic-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--section-color, #60a5fa), transparent);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.topic-card:hover::before {
  opacity: 1;
}

.topic-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.topic-card__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--section-color, #60a5fa) 12%, transparent);
  color: var(--section-color, #60a5fa);
  padding: 8px;
}

.topic-card__icon svg {
  width: 100%;
  height: 100%;
}

.topic-card__body {
  flex: 1;
  min-width: 0;
}

.topic-card .topic-card__title {
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 0.5rem;
  border: none;
  padding: 0;
}

.topic-card__badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.1875rem 0.625rem;
  border-radius: 999px;
  color: #0f1117;
  margin-bottom: 0.375rem;
}

.topic-card__badge--warm {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.topic-card__badge--cool {
  background: linear-gradient(135deg, #2dd4bf, #22d3ee);
}

.topic-card__content {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.topic-card__content p {
  margin-bottom: 0.5rem;
}

.topic-card__content p:last-child {
  margin-bottom: 0;
}

.topic-card__content a {
  color: #60a5fa;
  text-decoration: underline;
  text-decoration-color: rgba(96, 165, 250, 0.3);
  text-underline-offset: 2px;
}

.topic-card__content ul,
.topic-card__content ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.topic-card__content li {
  margin-bottom: 0.25rem;
}

/* Shortcode: callout */
.callout {
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  border-radius: 12px;
  border-left: 4px solid;
}

.callout--info {
  background: rgba(96, 165, 250, 0.08);
  border-color: #60a5fa;
}

.callout--warning {
  background: rgba(251, 191, 36, 0.08);
  border-color: #fbbf24;
}

.callout--tip {
  background: rgba(52, 211, 153, 0.08);
  border-color: #34d399;
}

.callout__title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.375rem;
}

.callout--info .callout__title { color: #60a5fa; }
.callout--warning .callout__title { color: #fbbf24; }
.callout--tip .callout__title { color: #34d399; }

/* Shortcode: step */
.step {
  display: flex;
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

/* Timeline */
.timeline {
  position: relative;
  padding: 0.5rem 0 0.5rem 2rem;
  margin: 1rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, #2dd4bf, #34d399, #22d3ee);
  border-radius: 1px;
}

.timeline__item {
  position: relative;
  margin-bottom: 1.5rem;
}

.timeline__item:last-child { margin-bottom: 0; }

.timeline__item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2dd4bf, #34d399);
  box-shadow: 0 0 8px rgba(45, 212, 191, 0.4);
  z-index: 1;
}

.timeline__year {
  font-weight: 700;
  font-size: 1.125rem;
  background: linear-gradient(90deg, #2dd4bf, #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.timeline__text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Info panels */
.info-panel {
  margin: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border-left: 3px solid;
  background: rgba(255, 255, 255, 0.03);
}

.info-panel--hours {
  border-color: #2dd4bf;
  background: linear-gradient(135deg, rgba(45, 212, 191, 0.08), transparent);
}

.info-panel--flex {
  border-color: #60a5fa;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.08), transparent);
}

.info-panel--vacation {
  border-color: #a78bfa;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.08), transparent);
}

.info-panel--heart {
  border-color: #f472b6;
  background: linear-gradient(135deg, rgba(244, 114, 182, 0.08), transparent);
}

.info-panel__title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.info-panel--hours .info-panel__title { color: #2dd4bf; }
.info-panel--flex .info-panel__title { color: #60a5fa; }
.info-panel--vacation .info-panel__title { color: #a78bfa; }
.info-panel--heart .info-panel__title { color: #f472b6; }

.info-panel__text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.info-panel__text p { margin: 0.5rem 0; }
.info-panel__text p:first-child { margin-top: 0; }
.info-panel__text p:last-child { margin-bottom: 0; }

.info-panel__text a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.step__number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--section-color, #60a5fa) 18%, transparent);
  color: var(--section-color, #60a5fa);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.step__body {
  flex: 1;
  min-width: 0;
}

.step .step__title {
  font-weight: 500;
  font-size: 1.0625rem;
  margin: 0 0 0.5rem;
}

.auth-user-name {
  color: var(--text-muted);
}

.auth-signin,
.auth-signout {
  color: #60a5fa;
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  font-size: 0.8125rem;
  padding: 0;
  transition: color 0.15s ease;
}

.auth-signin:hover,
.auth-signout:hover {
  color: var(--text);
}

/* Auth gate — hidden until authenticated */
.auth-gate {
  display: none;
}

.auth-gate--visible {
  display: block;
}

/* Auth prompt card */
.auth-prompt {
  display: flex;
  justify-content: center;
  padding: 3rem 0;
}

.auth-prompt__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 3rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  text-align: center;
  max-width: 380px;
}

.auth-prompt__icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
}

.auth-prompt__title {
  font-size: 1.25rem;
  font-weight: 400;
}

.auth-prompt__text {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-prompt__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  margin-top: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.auth-prompt__btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.auth-prompt__btn:active {
  transform: translateY(0);
}

/* Locked portal card indicator */
.portal-card--locked {
  position: relative;
}

.portal-card__lock {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  color: var(--text-dim);
}

body.is-authenticated .portal-card__lock {
  display: none;
}

/* ========================================
   Agenda Panel
   ======================================== */

.agenda-panel {
  display: none;
}

.agenda-panel--visible {
  display: flex;
  flex-direction: column;
  width: 300px;
  flex-shrink: 0;
  background: rgba(15, 17, 23, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem;
  overflow: hidden;
}

.agenda-header {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.agenda-title {
  font-size: 0.9375rem;
  font-weight: 500;
  flex: 1;
}

.agenda-header__actions {
  display: flex;
  gap: 0.25rem;
}

.agenda-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.agenda-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Agenda toggle in nav */
.bg-cycle-btn,
.agenda-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.bg-cycle-btn:hover,
.agenda-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

/* Calendar picker */
.agenda-picker {
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.agenda-picker--visible {
  display: flex;
  flex: 1;
  min-height: 0;
}

.agenda-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.agenda-picker__list::-webkit-scrollbar {
  width: 5px;
}

.agenda-picker__list::-webkit-scrollbar-track {
  background: transparent;
}

.agenda-picker__list::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 3px;
}

.agenda-picker__list:hover::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

.agenda-picker__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0;
}

.agenda-picker__item input[type="checkbox"] {
  accent-color: #60a5fa;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.agenda-picker__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agenda-picker__name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-picker__save {
  align-self: flex-end;
  padding: 0.375rem 1rem;
  border: none;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.2);
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease;
}

.agenda-picker__save:hover {
  background: rgba(96, 165, 250, 0.35);
}

/* Agenda body */
.agenda-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}

.agenda-body::-webkit-scrollbar {
  display: none;
}

/* Loading skeleton */
.agenda-skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.agenda-skeleton__item {
  display: flex;
  gap: 0.625rem;
  padding: 0.5rem 0;
  animation: skeleton-pulse 1.5s ease-in-out infinite both;
}

.agenda-skeleton__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  margin-top: 0.25rem;
  flex-shrink: 0;
}

.agenda-skeleton__lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.agenda-skeleton__line {
  height: 11px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  width: 80%;
}

.agenda-skeleton__line--short {
  width: 35%;
  height: 9px;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

.agenda-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
  padding: 2rem 0;
}

/* Day groups */
.agenda-day {
  margin-bottom: 1.25rem;
}

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

.agenda-day__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.625rem;
}

/* Events */
.agenda-event {
  display: flex;
  gap: 0.625rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.agenda-event__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.375rem;
}

.agenda-event__info {
  flex: 1;
  min-width: 0;
}

.agenda-event__time {
  font-size: 0.6875rem;
  color: var(--text-dim);
  margin-bottom: 0.125rem;
}

.agenda-event__title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.agenda-event__location {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.125rem;
}

/* TOC layout — fixed panel with scrollable content */
.portal-panel--visible:has(.portal-page--toc) {
  max-width: 1200px;
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1.5rem;
  margin: 1.5rem auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

.portal-panel--visible:has(.portal-page--toc) > .auth-gate,
.portal-panel--visible:has(.portal-page--toc) > .auth-gate > .portal-content,
.portal-panel--visible:has(.portal-page--toc) > .portal-content,
.portal-page--toc {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.portal-toc-layout {
  display: flex;
  gap: 2rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.portal-toc {
  flex: 0 0 220px;
  overflow-y: auto;
  padding-bottom: 1rem;
}

.portal-toc__header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--section-color, #a78bfa);
  padding: 0 0.75rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.5rem;
}

.portal-toc #TableOfContents ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.portal-toc #TableOfContents li {
  margin: 0;
}

.portal-toc #TableOfContents > ul > li > a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.portal-toc #TableOfContents > ul > li > a:hover,
.portal-toc #TableOfContents > ul > li.active > a {
  color: var(--section-color, #7c3aed);
  border-left-color: var(--section-color, #7c3aed);
  background: color-mix(in srgb, var(--section-color, #7c3aed) 5%, transparent);
}

.portal-toc #TableOfContents > ul > li > ul {
  display: none;
  padding: 0.125rem 0 0.25rem 0.75rem;
}

.portal-toc #TableOfContents > ul > li.active > ul {
  display: block;
}

.portal-toc #TableOfContents > ul > li > ul > li > a {
  display: block;
  padding: 0.2rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.15s;
}

.portal-toc #TableOfContents > ul > li > ul > li > a:hover {
  color: var(--section-color, #7c3aed);
}

.portal-page--toc .portal-body {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding-right: 1rem;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--section-color, #60a5fa) 40%, transparent) transparent;
}

.portal-page--toc .portal-body::-webkit-scrollbar {
  width: 6px;
}

.portal-page--toc .portal-body::-webkit-scrollbar-track {
  background: transparent;
}

.portal-page--toc .portal-body::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--section-color, #60a5fa) 30%, transparent);
  border-radius: 3px;
}

.portal-page--toc .portal-body::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--section-color, #60a5fa) 50%, transparent);
}

.portal-page--toc .portal-body h2,
.portal-page--toc .portal-body h3 {
  scroll-margin-top: 0.5rem;
}

@media (max-width: 768px) {
  .portal-panel--visible:has(.portal-page--toc) {
    max-width: none;
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    bottom: 0.75rem;
    margin: 0.75rem;
  }

  .portal-toc-layout {
    flex-direction: column;
  }

  .portal-toc {
    flex: none;
    max-height: none;
    overflow-y: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
  }

  .portal-toc #TableOfContents > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
  }

  .portal-toc #TableOfContents > ul > li > a {
    border-left: none;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
  }

  .portal-toc #TableOfContents > ul > li > a:hover {
    border-left: none;
  }
}

/* Slide layout — each slide is its own frosted panel */
.portal-panel--visible:has(.portal-page--slides) {
  background: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-color: transparent;
  padding-left: 0;
  padding-right: 0;
}

.slide-card {
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 2rem 3rem;
  margin-bottom: 1.25rem;
}

.slide-card img[src*="/training/slide-"] {
  display: block;
  max-width: 100%;
  margin: 0 auto 1.25rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.slide-card img[src*="/training/slide-"]:last-child {
  margin-bottom: 0;
}

.slide-card p:last-child,
.slide-card ul:last-child,
.slide-card ol:last-child {
  margin-bottom: 0;
}

.slide-cta {
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 2rem 3rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.slide-cta p {
  margin: 0 0 1.25rem;
  color: rgba(255, 255, 255, 0.7);
}

.slide-cta__button,
.portal-body .slide-cta__button {
  display: inline-block;
  padding: 0.75rem 2rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.slide-cta__button:hover,
.portal-body .slide-cta__button:hover {
  color: #1a1a2e;
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.3);
}

.slide-references {
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 2rem 3rem;
  margin-bottom: 1.25rem;
}

.slide-references summary {
  cursor: pointer;
  font-size: 1.125rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  list-style: none;
}

.slide-references summary::before {
  content: "\25b6\00a0";
  font-size: 0.75rem;
  transition: transform 0.15s ease;
  display: inline-block;
}

.slide-references[open] summary::before {
  transform: rotate(90deg);
}

.slide-references[open] summary {
  margin-bottom: 1rem;
}

.slide-references ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.slide-references li {
  padding: 0.375rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.slide-references li:last-child {
  border-bottom: none;
}

.portal-page--slides .portal-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 17, 23, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 0.75rem 1.5rem;
  margin-top: 0.25rem;
}

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1.5rem;
  z-index: 99;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, top 0.3s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}

body.portal-active .theme-toggle {
  top: 5.5rem;
}

.theme-toggle__icon {
  width: 18px;
  height: 18px;
}

.theme-toggle__moon { display: none; }

.light-mode .theme-toggle {
  background: rgba(0, 0, 0, 0.06);
  color: #6b7280;
}

.light-mode .theme-toggle:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #1a1a2e;
}

.light-mode .theme-toggle__sun { display: none; }
.light-mode .theme-toggle__moon { display: block; }

/* ========================================
   Light Mode
   ======================================== */

.light-mode body::before {
  filter: blur(12px) brightness(1.15) saturate(0.9);
}

/* Start panel */
.light-mode .start-panel {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .greeting { color: #1a1a2e; }
.light-mode .date { color: #4b5563; }

/* Weather */
.light-mode .weather-temp { color: #1a1a2e; }
.light-mode .weather-desc { color: #4b5563; }
.light-mode .weather-icon,
.light-mode .weather-forecast__img,
.light-mode .weather-sun__icon { filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.4)); }
.light-mode .weather-range { color: #6b7280; border-left-color: rgba(0, 0, 0, 0.1); }
.light-mode .weather-sun { color: #6b7280; }
.light-mode .weather-forecast { border-left-color: rgba(0, 0, 0, 0.1); }
.light-mode .weather-forecast__name { color: #4b5563; }
.light-mode .weather-forecast__hi { color: #1a1a2e; }
.light-mode .weather-forecast__lo { color: #6b7280; }

/* Search */
.light-mode .search input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1a1a2e;
}

.light-mode .search input::placeholder { color: #9ca3af; }

.light-mode .search input:focus {
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(0, 0, 0, 0.06);
}

.light-mode .search-icon { color: #6b7280; }

/* Tiles */
.light-mode .tile {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #1a1a2e;
}

.light-mode .tile:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.light-mode .tile-label { color: #4b5563; }
.light-mode .tile:hover .tile-label { color: #1a1a2e; }

/* Portal link */
.light-mode .portal-link {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #4b5563;
}

.light-mode .portal-link:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1a1a2e;
}

/* Start auth & agenda toggle */
.light-mode .start-auth .auth-user-name { color: #6b7280; }

.light-mode .start-auth .auth-signin,
.light-mode .start-auth .auth-signout { color: #4b5563; }

.light-mode .start-auth .auth-signin:hover,
.light-mode .start-auth .auth-signout:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1a1a2e;
}

.light-mode .start-agenda-toggle {
  background: rgba(0, 0, 0, 0.04);
  color: #6b7280;
}

.light-mode .start-agenda-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: #1a1a2e;
}

/* Topbar */
.light-mode .topbar {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.light-mode .topbar__back { color: #4b5563; }
.light-mode .topbar__back:hover { color: #1a1a2e; }

.light-mode .topbar__link { color: #4b5563; }
.light-mode .topbar__link:hover { background: rgba(0, 0, 0, 0.06); color: #1a1a2e; }

.light-mode .topbar__link--active {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.12), rgba(139, 92, 246, 0.12));
  color: #6366f1;
  border-color: rgba(99, 102, 241, 0.2);
}

.light-mode .topbar__weather .weather-temp { color: #1a1a2e; }

/* Breadcrumbs */
.light-mode .portal-breadcrumbs { color: #9ca3af; }
.light-mode .portal-breadcrumbs a { color: #4b5563; }
.light-mode .portal-breadcrumbs a:hover { color: #1a1a2e; }
.light-mode .portal-breadcrumbs li[aria-current="page"] { color: #1a1a2e; }

/* Auth status */
.light-mode .auth-user-name { color: #6b7280; }
.light-mode .auth-signin,
.light-mode .auth-signout { color: #4b5563; }
.light-mode .auth-signin:hover,
.light-mode .auth-signout:hover { color: #1a1a2e; }

/* Portal panel */
.light-mode .portal-panel--visible {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .portal-page__title { color: #1a1a2e; }

/* Portal body content */
.light-mode .portal-body { color: #374151; }

.light-mode .portal-body p,
.light-mode .portal-body li { color: #374151; }

.light-mode .portal-body strong { color: #1a1a2e; }

.light-mode .portal-body a {
  color: var(--section-color, #7c3aed);
  text-decoration-color: color-mix(in srgb, var(--section-color, #7c3aed) 30%, transparent);
}

.light-mode .portal-body a:hover {
  text-decoration-color: var(--section-color, #7c3aed);
}

.light-mode .portal-body h1 { color: #1a1a2e; }

.light-mode .portal-body h2 {
  color: #1a1a2e;
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-color, #a78bfa) 10%, transparent), transparent);
}

.light-mode .portal-body h3 {
  color: var(--section-color, #d97706);
  text-transform: uppercase;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.5rem 0 0.5rem 1rem;
  border-left: 3px solid var(--section-color, #d97706);
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-color, #d97706) 6%, transparent), transparent);
  border-radius: 0 6px 6px 0;
  margin: 2rem 0 1rem;
}

.light-mode .portal-body h4 { color: #4b5563; }

.light-mode .portal-body table th { color: #1a1a2e; }
.light-mode .portal-body table td { color: #374151; }

.light-mode .portal-body table th,
.light-mode .portal-body table td { border-bottom-color: rgba(0, 0, 0, 0.08); }

.light-mode .portal-body hr {
  background: linear-gradient(90deg, color-mix(in srgb, var(--section-color, #a78bfa) 30%, transparent), transparent);
}

.light-mode .portal-body blockquote {
  border-left-color: color-mix(in srgb, var(--section-color, #a78bfa) 50%, transparent);
  background: color-mix(in srgb, var(--section-color, #a78bfa) 6%, transparent);
  color: #4b5563;
}

.light-mode .portal-body details {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.5);
}

.light-mode .portal-body summary {
  background: rgba(0, 0, 0, 0.02);
  color: #1a1a2e;
}

.light-mode .portal-body summary:hover { background: rgba(0, 0, 0, 0.05); }
.light-mode .portal-body details[open] summary { border-bottom-color: rgba(0, 0, 0, 0.1); }

/* Portal cards */
.light-mode .portal-card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .portal-card:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.12);
}

.light-mode .portal-card__title { color: #1a1a2e; }
.light-mode .portal-card__desc { color: #4b5563; }

/* Portal back */
.light-mode .portal-back { color: #4b5563; }
.light-mode .portal-back:hover { color: #1a1a2e; }

/* Topic card — override h3 treatment */
.light-mode .topic-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .topic-card:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
}

.light-mode .topic-card .topic-card__title {
  color: #1a1a2e;
  text-transform: none;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: normal;
  padding: 0;
  border-left: none;
  background: none;
  border-radius: 0;
  margin: 0 0 0.5rem;
}

.light-mode .topic-card__content { color: #374151; }

/* Step card — override h3 treatment */
.light-mode .step {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .step .step__title {
  color: #1a1a2e;
  text-transform: none;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: normal;
  padding: 0;
  border-left: none;
  background: none;
  border-radius: 0;
  margin: 0 0 0.5rem;
}

/* Callout */
.light-mode .callout--info { background: rgba(96, 165, 250, 0.06); }
.light-mode .callout--warning { background: rgba(251, 191, 36, 0.06); }
.light-mode .callout--tip { background: rgba(52, 211, 153, 0.06); }

/* Auth prompt */
.light-mode .auth-prompt__card {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .auth-prompt__title { color: #1a1a2e; }
.light-mode .auth-prompt__text { color: #4b5563; }
.light-mode .auth-prompt__icon { color: #6b7280; }

.light-mode .auth-prompt__btn {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1a1a2e;
}

.light-mode .auth-prompt__btn:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

/* TOC in light mode */
.light-mode .portal-toc__header { border-bottom-color: rgba(0, 0, 0, 0.08); }
.light-mode .portal-toc #TableOfContents > ul > li > a { color: #374151; }
.light-mode .portal-toc #TableOfContents > ul > li > ul > li > a { color: #6b7280; }

/* Slide layout */
.light-mode .slide-card {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .slide-card img[src*="/training/slide-"] {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
}

.light-mode .slide-cta {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .slide-cta p { color: #4b5563; }

.light-mode .slide-references {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .slide-references summary { color: #1a1a2e; }
.light-mode .slide-references li { border-bottom-color: rgba(0, 0, 0, 0.06); }

.light-mode .portal-page--slides .portal-back {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

/* Agenda panel */
.light-mode .agenda-panel--visible {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(0, 0, 0, 0.08);
}

.light-mode .agenda-title { color: #1a1a2e; }
.light-mode .agenda-header { border-bottom-color: rgba(0, 0, 0, 0.08); }
.light-mode .agenda-day__label { color: #4b5563; }
.light-mode .agenda-event { border-bottom-color: rgba(0, 0, 0, 0.06); }
.light-mode .agenda-event__title { color: #1a1a2e; }
.light-mode .agenda-event__time { color: #6b7280; }
.light-mode .agenda-event__location { color: #6b7280; }
.light-mode .agenda-empty { color: #9ca3af; }

.light-mode .agenda-btn { color: #6b7280; }
.light-mode .agenda-btn:hover { background: rgba(0, 0, 0, 0.06); color: #1a1a2e; }

.light-mode .bg-cycle-btn,
.light-mode .agenda-toggle-btn { color: #6b7280; }

.light-mode .bg-cycle-btn:hover,
.light-mode .agenda-toggle-btn:hover { background: rgba(0, 0, 0, 0.06); color: #1a1a2e; }

.light-mode .portal-card__lock { color: #9ca3af; }

/* Portal responsive */
@media (max-width: 768px) {
  .topbar__nav {
    display: none;
  }

  .topbar__weather {
    display: none;
  }

  .portal-panel--visible {
    margin: calc(80px + 0.75rem) 0.75rem 0.75rem;
    padding: 1.5rem 1.25rem;
    border-radius: 20px;
    min-height: auto;
  }

  .portal-hero {
    margin: calc(-1.5rem - 1px) calc(-1.25rem - 1px) 1.5rem;
    padding: 2.5rem 1.25rem;
    min-height: 160px;
  }

  .portal-hero__title {
    font-size: 1.375rem;
  }

  .portal-hero__icon {
    width: 48px;
    height: 48px;
    padding: 12px;
  }

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

  .agenda-panel--visible {
    display: none;
  }
}

@media (max-width: 1100px) {
  .agenda-panel--visible {
    display: none;
  }
}
