:root {
  color-scheme: dark;
  --bg-page: #040510;
  --bg-surface: #080b1c;
  --bg-surface-strong: #0b1026;
  --bg-elevated: rgba(13, 18, 42, 0.92);
  --bg-muted: rgba(20, 26, 54, 0.78);
  --surface-highlight: rgba(34, 40, 80, 0.75);
  --border-soft: rgba(129, 140, 248, 0.22);
  --border-strong: rgba(99, 102, 241, 0.48);
  --text-primary: #e8ebff;
  --text-secondary: rgba(232, 235, 255, 0.7);
  --accent-primary: #6366f1;
  --accent-primary-soft: rgba(99, 102, 241, 0.18);
  --accent-secondary: #f97316;
  --accent-secondary-soft: rgba(249, 115, 22, 0.2);
  --accent-tertiary: #22d3ee;
  --mwat-accent: #818cf8;
  --daily-accent: #fb923c;
  --focus-ring: rgba(129, 140, 248, 0.38);
  --success-soft: rgba(34, 197, 94, 0.22);
  --success-strong: #bbf7d0;
  --error-soft: rgba(248, 113, 113, 0.2);
  --error-strong: #fecaca;
  /* Shared gradient for hero + cards */
  --card-gradient: var(--surface-gradient-primary);
}

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

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: "Inter", "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 18% 20%, rgba(88, 132, 255, 0.22), transparent 58%),
    radial-gradient(circle at 82% 18%, rgba(48, 196, 255, 0.16), transparent 55%),
    radial-gradient(circle at 70% 84%, rgba(60, 120, 235, 0.14), transparent 60%),
    var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

body.has-mobile-nav-open {
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

main {
  display: block;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4.5rem;
}

.page > * + * {
  margin-top: 2.75rem;
}

.global-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  --nav-padding: clamp(1.5rem, 4vw, 3rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: clamp(0.6rem, 1vw, 1rem);
  padding: 1rem var(--nav-padding);
  background: linear-gradient(135deg, rgba(14, 20, 48, 0.96), rgba(24, 30, 68, 0.92));
  border-bottom: 1px solid rgba(129, 140, 248, 0.28);
  box-shadow: 0 20px 40px rgba(3, 7, 18, 0.55);
  backdrop-filter: blur(16px);
}

.global-nav__brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.7rem, 1vw, 1rem);
  margin-right: clamp(0.65rem, 2vw, 1.5rem);
  text-decoration: none;
  flex: 0 1 auto;
  min-width: 0;
}

.global-nav__menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 140, 248, 0.35);
  background: rgba(12, 16, 36, 0.85);
  color: #f8faff;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  margin-left: auto;
}

.global-nav__menu-toggle:hover,
.global-nav__menu-toggle:focus-visible {
  outline: none;
  background: rgba(18, 22, 48, 0.95);
  border-color: rgba(129, 140, 248, 0.6);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.global-nav__menu-toggle-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform var(--transition), background var(--transition);
}

.global-nav__menu-toggle-icon::before,
.global-nav__menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  transition: transform var(--transition), opacity var(--transition);
}

.global-nav__menu-toggle-icon::before {
  transform: translateY(-6px);
}

.global-nav__menu-toggle-icon::after {
  transform: translateY(6px);
}

.global-nav--menu-open .global-nav__menu-toggle-icon {
  background: transparent;
}

.global-nav--menu-open .global-nav__menu-toggle-icon::before {
  transform: rotate(45deg);
}

.global-nav--menu-open .global-nav__menu-toggle-icon::after {
  transform: rotate(-45deg);
}

.global-nav__logo {
  height: clamp(44px, 8vw, 58px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(3, 7, 18, 0.55));
}

.global-nav__brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.global-nav__overline {
  font-size: clamp(0.6rem, 0.7vw, 0.72rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(232, 235, 255, 0.62);
}

.global-nav__title {
  font-size: clamp(0.98rem, 1.1vw + 0.7rem, 1.35rem);
  font-weight: 600;
  color: #f8faff;
  white-space: normal;
}

.global-nav__menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: auto;
  right: var(--nav-padding);
  width: min(360px, calc(100% - 2 * var(--nav-padding)));
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 1.1rem 1.4rem 1.6rem;
  background: linear-gradient(135deg, rgba(14, 20, 48, 0.96), rgba(24, 30, 68, 0.92));
  border: 1px solid rgba(129, 140, 248, 0.32);
  border-radius: 20px;
  box-shadow: 0 26px 48px rgba(5, 9, 24, 0.6);
  backdrop-filter: blur(12px);
  z-index: 120;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.global-nav--menu-open .global-nav__menu {
  display: flex;
}

.global-nav__item {
  position: relative;
  width: 100%;
}

.global-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.55rem clamp(0.85rem, 1.2vw, 1.2rem);
  border-radius: 999px;
  font-size: clamp(0.85rem, 0.55vw + 0.7rem, 1.05rem);
  font-weight: 500;
  color: rgba(232, 235, 255, 0.9);
  text-decoration: none;
  transition: background var(--transition), color var(--transition), border-color var(--transition), box-shadow var(--transition);
  border: 1px solid transparent;
  width: 100%;
  text-align: left;
}

.global-nav__link:hover,
.global-nav__link:focus-visible {
  color: #f8faff;
  background: rgba(129, 140, 248, 0.2);
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
  outline: none;
}

.global-nav__link--active {
  background: rgba(129, 140, 248, 0.25);
  border-color: rgba(129, 140, 248, 0.6);
  color: #f8faff;
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

.global-nav__toggle {
  background: none;
  cursor: pointer;
}

.global-nav__caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(232, 235, 255, 0.8);
  transition: transform 0.2s ease;
  margin-top: 2px;
  margin-left: auto;
}

.global-nav__item--open .global-nav__caret {
  transform: rotate(-180deg);
}

.global-nav__dropdown {
  display: none;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.6rem;
  background: rgba(10, 14, 34, 0.9);
  border: 1px solid rgba(129, 140, 248, 0.22);
  border-radius: 16px;
  box-shadow: inset 0 0 0 1px rgba(3, 7, 18, 0.4);
}

.global-nav__item--open .global-nav__dropdown {
  display: flex;
}

.global-nav__dropdown-link {
  display: block;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.9rem;
  color: rgba(232, 235, 255, 0.92);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}

.global-nav__dropdown-link:hover,
.global-nav__dropdown-link:focus-visible {
  background: rgba(129, 140, 248, 0.25);
  color: #f8faff;
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.card {
  background: var(--card-gradient);
  border-radius: 22px;
  padding: 2rem clamp(1.25rem, 3vw, 2.5rem);
  margin-bottom: 2rem;
  box-shadow: 0 28px 60px rgba(3, 7, 18, 0.65);
  border: 1px solid var(--border-soft);
  backdrop-filter: blur(12px);
}

.card--inputs {
  background: var(--card-gradient);
  border-color: var(--border-strong);
  box-shadow: 0 32px 70px rgba(8, 12, 35, 0.7);
}

.card__header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.card__header h2 {
  font-size: 1.45rem;
  font-weight: 600;
  color: #f8faff;
}

.card__header p {
  color: var(--text-secondary);
}

.card__actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.card__actions--inline {
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  margin-top: 1.25rem;
  margin-bottom: 0.85rem;
}

.card__divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(129, 140, 248, 0), rgba(129, 140, 248, 0.35), rgba(129, 140, 248, 0));
  margin: 2rem 0 1.5rem;
}

.card__subtitle {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 235, 255, 0.6);
}

.input-grid {
  display: grid;
  gap: 1.15rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  margin-top: 1.5rem;
}

.input-grid--periods {
  margin-top: 1rem;
}

.input-grid--periods {
  margin-top: 1rem;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-weight: 600;
  color: var(--text-primary);
}

.input-group span {
  font-size: 0.95rem;
  color: rgba(232, 235, 255, 0.85);
}

.input-group input[type="file"],
.input-group input[type="datetime-local"],
.input-group select {
  padding: 0.7rem 0.85rem;
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(10, 14, 32, 0.9);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.input-group input[type="file"]:focus-visible,
.input-group input[type="datetime-local"]:focus-visible,
.input-group select:focus-visible {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px var(--focus-ring);
  background: rgba(12, 16, 36, 0.95);
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: rgba(12, 16, 36, 0.82);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-primary-soft);
  border: 1px solid rgba(129, 140, 248, 0.35);
  color: rgba(232, 235, 255, 0.85);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.radio input[type="radio"] {
  accent-color: var(--accent-primary);
}

.radio--checked {
  background: rgba(129, 140, 248, 0.45);
  border-color: rgba(129, 140, 248, 0.65);
  color: #eef2ff;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.4);
}

.radio input[type="radio"]:focus-visible + span {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
  border-radius: 6px;
}

.intermittent {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  padding: 1.25rem 1.3rem 1.4rem;
  border-radius: 16px;
  background: rgba(12, 16, 36, 0.78);
  border: 1px solid rgba(129, 140, 248, 0.25);
  box-shadow: inset 0 0 0 1px rgba(3, 7, 18, 0.45);
}

.intermittent__actions {
  display: flex;
  justify-content: flex-start;
}

.input-error {
  margin: 0;
  font-size: 0.9rem;
  color: #fca5a5;
}

.period-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.period-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.35);
}

.period-list__label {
  font-size: 0.95rem;
  color: rgba(232, 235, 255, 0.9);
}

.period-list__remove {
  background: none;
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  color: rgba(232, 235, 255, 0.85);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.period-list__remove:hover {
  border-color: rgba(232, 235, 255, 0.65);
  background: rgba(129, 140, 248, 0.18);
}

.period-list__remove:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: #f8faff;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.9rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 18px 32px rgba(34, 211, 238, 0.25);
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 38px rgba(34, 211, 238, 0.35);
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button:disabled:hover {
  transform: none;
}

.button.button--subtle {
  background: rgba(129, 140, 248, 0.18);
  box-shadow: none;
  border: 1px solid rgba(129, 140, 248, 0.4);
  padding: 0.7rem 1.6rem;
  color: #dedefe;
}

.button.button--subtle:hover {
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.45);
  background: rgba(129, 140, 248, 0.28);
}

.button.button--subtle:disabled {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.24);
}

.note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

#messages {
  margin-top: 1.25rem;
  min-height: 2rem;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: rgba(99, 102, 241, 0.16);
  color: #c7d2fe;
}

#messages.error {
  background: var(--error-soft);
  color: var(--error-strong);
}

#messages.success {
  background: var(--success-soft);
  color: var(--success-strong);
}

#messages:empty {
  display: none;
}

.summary {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 0;
}

.summary div {
  background: rgba(12, 16, 36, 0.82);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.summary dt {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary dd {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: #f8faff;
}

.metric-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Add spacing below Data snapshot header before summary cards */
#summarySection .card__header {
  margin-bottom: 0.75rem;
}

/* Add small space below table descriptions */
#windowsSection .card__header,
#dailySection .card__header {
  margin-bottom: 0.75rem;
}

.metric {
  background: rgba(12, 16, 36, 0.82);
  border-radius: 18px;
  padding: 1.5rem 1.75rem;
  border: 1px solid rgba(129, 140, 248, 0.25);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.metric--mwat {
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 25px 40px rgba(99, 102, 241, 0.25);
}

.metric--mwat::before {
  background: radial-gradient(circle at top left, rgba(129, 140, 248, 0.75), transparent 62%),
    linear-gradient(140deg, rgba(34, 211, 238, 0.35), transparent 70%);
}

.metric--mwat .metric__title,
.metric--mwat .metric__detail {
  color: rgba(199, 210, 254, 0.95);
}

.metric--mwat .metric__note {
  color: rgba(199, 210, 254, 0.68);
}

.metric--daily {
  border-color: rgba(249, 115, 22, 0.55);
  box-shadow: 0 25px 40px rgba(249, 115, 22, 0.28);
}

.metric--daily::before {
  background: radial-gradient(circle at top right, rgba(249, 115, 22, 0.75), transparent 62%),
    linear-gradient(140deg, rgba(34, 197, 94, 0.32), transparent 70%);
}

.metric--daily .metric__title,
.metric--daily .metric__detail {
  color: rgba(255, 237, 213, 0.95);
}

.metric--daily .metric__note {
  color: rgba(255, 237, 213, 0.7);
}

.metric__title {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(232, 235, 255, 0.72);
}

.metric__value {
  font-size: clamp(2.1rem, 5vw, 2.6rem);
  font-weight: 700;
  color: #f8faff;
}

.metric__detail {
  font-weight: 600;
  color: var(--accent-primary);
}

.metric__note {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.table-group {
  border-radius: 22px;
  padding: 0.5rem;
  background: rgba(10, 14, 32, 0.85);
  border: 1px solid rgba(129, 140, 248, 0.22);
  box-shadow: inset 0 0 0 1px rgba(3, 7, 18, 0.45);
  position: relative;
  overflow: hidden;
}

.table-group::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.18;
  pointer-events: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  border-radius: 16px;
  overflow: hidden;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 18px;
}

.table thead {
  background: rgba(99, 102, 241, 0.22);
}

.table th,
.table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(129, 140, 248, 0.18);
  text-align: left;
}

.table tbody tr:nth-child(even) {
  background: rgba(12, 16, 36, 0.75);
}

.table__row--highlight {
  background: rgba(129, 140, 248, 0.32) !important;
}

.table__cell--highlight {
  font-weight: 700;
  color: #f8faff;
  position: relative;
  padding-right: 3.5rem;
}

.table__cell-inner {
  display: inline-block;
  max-width: calc(100% - 3rem);
}

.table__badge {
  position: absolute;
  top: 0.55rem;
  right: 0.75rem;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.7);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #ecfeff;
  pointer-events: none;
}

.table-group--mwat {
  border-color: rgba(129, 140, 248, 0.45);
  box-shadow: 0 22px 45px rgba(99, 102, 241, 0.3);
}

.table-group--mwat::before {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.35), transparent 65%);
}

.table-group--mwat .table thead {
  background: rgba(129, 140, 248, 0.3);
}

.table-group--mwat .table__row--highlight {
  background: rgba(129, 140, 248, 0.42) !important;
}

.table-group--mwat .table__cell--highlight {
  color: #e0e7ff;
}

.table-group--mwat .table__badge {
  background: rgba(129, 140, 248, 0.75);
  color: #e0e7ff;
}

.table-group--daily {
  border-color: rgba(249, 115, 22, 0.45);
  box-shadow: 0 22px 45px rgba(249, 115, 22, 0.28);
}

.table-group--daily::before {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.4), transparent 65%);
}

.table-group--daily .table thead {
  background: rgba(249, 115, 22, 0.28);
}

.table-group--daily .table__row--highlight {
  background: rgba(249, 115, 22, 0.4) !important;
}

.table-group--daily .table__cell--highlight {
  color: #fff7ed;
}

.table-group--daily .table__badge {
  background: rgba(249, 115, 22, 0.78);
  color: #fff3e0;
}

.table__subtext {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: rgba(232, 235, 255, 0.65);
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .page {
    padding: 2rem 1rem 3.5rem;
  }

  .hero {
    padding: 1.8rem 1.5rem;
  }

  .card {
    padding: 1.75rem 1.25rem;
    border-radius: 18px;
  }

  .button {
    width: 100%;
  }
}
