:root {
  --bg: #f3efe7;
  --bg-alt: #ebe4d8;
  --panel: #fbf8f2;
  --panel-strong: #fffdf8;
  --line: #ddd1c0;
  --line-soft: rgba(37, 54, 55, 0.08);
  --text: #1f2b2d;
  --muted: #657375;
  --brand: #0f8a83;
  --brand-strong: #0b6f69;
  --accent: #d98252;
  --accent-soft: rgba(217, 130, 82, 0.14);
  --success: #e2f1ea;
  --warning: #f6e4d9;
  --shadow: 0 20px 45px rgba(52, 48, 42, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --display: "Aptos Display", "Bahnschrift", "Trebuchet MS", sans-serif;
  --body: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--body);
  background:
    radial-gradient(circle at top left, rgba(15, 138, 131, 0.08), transparent 28%),
    radial-gradient(circle at top right, rgba(217, 130, 82, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 138, 131, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 138, 131, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 92%);
}

.page-shell,
.health-shell {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  position: relative;
}

.site-header,
.hero-card,
.auth-card,
.panel,
.plan-card,
.detail-panel,
.health-hero,
.health-card {
  background: rgba(251, 248, 242, 0.9);
  border: 1px solid rgba(221, 209, 192, 0.9);
  box-shadow: var(--shadow);
  border-radius: var(--radius-xl);
}

.hidden {
  display: none !important;
}

.eyebrow,
.mini-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-strong);
  font-weight: 800;
}

.mini-label {
  font-size: 0.7rem;
  opacity: 0.75;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
}

h1 {
  margin-top: 10px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2 {
  margin-top: 10px;
  font-size: clamp(1.45rem, 2.2vw, 2.1rem);
  line-height: 1.08;
}

h3 {
  font-size: 1.2rem;
}

p {
  margin: 0;
}

a,
button,
input,
select,
textarea {
  font: inherit;
}

.site-header {
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.header-actions,
.hero-actions,
.form-footer,
.library-controls,
.plan-card-top,
.plan-metrics,
.panel-heading-row,
.calendar-nav,
.ical-state-row,
.segmented-control {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button,
.segment {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.button:hover,
.segment:hover,
.plan-card:hover,
.calendar-day:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: linear-gradient(135deg, var(--brand) 0%, #159f97 100%);
  color: #fff;
  box-shadow: 0 16px 28px rgba(15, 138, 131, 0.2);
}

.button.secondary,
.segment {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-color: rgba(31, 43, 45, 0.1);
}

.button-fit {
  width: fit-content;
}

.segment.is-active {
  background: rgba(15, 138, 131, 0.12);
  border-color: rgba(15, 138, 131, 0.14);
  color: var(--brand-strong);
}

.hero-layout,
.two-column-layout,
.calendar-layout,
.library-layout,
.ical-layout,
.health-grid {
  display: grid;
  gap: 22px;
}

.hero-layout {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  align-items: start;
  margin-bottom: 24px;
}

.hero-card,
.auth-card,
.panel,
.health-hero {
  padding: 28px;
}

.hero-card {
  min-height: 100%;
}

.section-copy,
.form-status,
.plan-notes,
.detail-copy,
.detail-empty p,
.calendar-empty,
.health-note {
  color: var(--muted);
  line-height: 1.65;
}

.hero-stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 22px 0;
}

.hero-stat,
.stat-card,
.ical-result-card,
.calendar-sidebar,
.health-card {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.hero-stat strong,
.stat-card strong,
.health-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  font-family: var(--display);
}

.dashboard-stack {
  display: grid;
  gap: 22px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card span:last-child {
  color: var(--muted);
}

.two-column-layout {
  grid-template-columns: minmax(320px, 0.9fr) minmax(280px, 0.7fr);
}

.panel-heading {
  margin-bottom: 18px;
}

.panel-heading-row {
  align-items: end;
  justify-content: space-between;
}

.stack-form,
.detail-form {
  display: grid;
  gap: 14px;
}

.stack-form label,
.detail-form label,
.copy-field {
  display: grid;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  padding: 14px 16px;
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15, 138, 131, 0.4);
  box-shadow: 0 0 0 4px rgba(15, 138, 131, 0.08);
}

textarea {
  min-height: 106px;
  resize: vertical;
}

.dropzone {
  position: relative;
  overflow: hidden;
  border: 1px dashed rgba(15, 138, 131, 0.35);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(240, 235, 226, 0.92));
  padding: 22px;
}

.dropzone.dragging {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 248, 242, 0.96), rgba(247, 233, 222, 0.96));
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-title {
  font-family: var(--display);
  font-size: 1.08rem;
}

.dropzone-copy,
.dropzone-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.month-cloud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.month-pill,
.metric-chip,
.status-pill,
.calendar-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
}

.month-pill,
.metric-chip,
.calendar-chip {
  background: rgba(15, 138, 131, 0.1);
  color: var(--brand-strong);
}

.status-pill {
  font-size: 0.84rem;
  font-weight: 700;
}

.status-fresh {
  background: var(--warning);
  color: #9a5a35;
}

.status-reviewed {
  background: var(--success);
  color: #1b7c5a;
}

.status-custom {
  background: rgba(101, 115, 117, 0.14);
  color: var(--text);
}

.calendar-nav {
  align-items: center;
}

.calendar-month-label {
  min-width: 180px;
  text-align: center;
  font-family: var(--display);
  font-size: 1.1rem;
}

.calendar-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.6fr);
  align-items: start;
}

.calendar-board {
  display: grid;
  gap: 10px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 700;
}

.calendar-day {
  min-height: 120px;
  border-radius: 18px;
  border: 1px solid rgba(31, 43, 45, 0.08);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 10px;
  cursor: pointer;
}

.calendar-day.is-muted {
  opacity: 0.5;
}

.calendar-day.is-today {
  border-color: rgba(15, 138, 131, 0.36);
  box-shadow: inset 0 0 0 1px rgba(15, 138, 131, 0.16);
}

.calendar-day.is-selected {
  background: rgba(15, 138, 131, 0.12);
  border-color: rgba(15, 138, 131, 0.28);
}

.calendar-day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.calendar-day-number {
  font-weight: 800;
}

.calendar-dots {
  display: grid;
  gap: 6px;
}

.calendar-dot {
  border-radius: 999px;
  background: rgba(15, 138, 131, 0.12);
  color: var(--brand-strong);
  padding: 6px 8px;
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-sidebar {
  min-height: 100%;
}

.calendar-sidebar-head {
  margin-bottom: 16px;
}

.calendar-agenda {
  display: grid;
  gap: 12px;
}

.calendar-agenda-item {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(31, 43, 45, 0.08);
  padding: 14px;
}

.calendar-agenda-item strong {
  display: block;
  margin-bottom: 6px;
}

.calendar-agenda-item span {
  color: var(--muted);
}

.library-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  margin-top: 18px;
}

.plan-list {
  display: grid;
  gap: 14px;
  align-content: start;
}

.plan-card,
.detail-panel {
  border-radius: var(--radius-lg);
}

.plan-card {
  padding: 18px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
  cursor: pointer;
}

.plan-card.is-selected {
  border-color: rgba(15, 138, 131, 0.24);
  box-shadow: 0 18px 34px rgba(15, 138, 131, 0.1);
}

.plan-title {
  margin-top: 4px;
}

.plan-notes {
  margin: 14px 0 16px;
}

.detail-panel {
  padding: 22px;
  min-height: 520px;
  background: var(--panel-strong);
  position: sticky;
  top: 18px;
}

.detail-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 10px;
}

.detail-block + .detail-block {
  margin-top: 18px;
}

.detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.detail-list a {
  color: var(--brand-strong);
  text-decoration: none;
}

.split-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ical-layout {
  grid-template-columns: minmax(320px, 0.95fr) minmax(300px, 1.05fr);
  align-items: start;
}

.copy-field textarea {
  min-height: 130px;
  font-family: "Consolas", "Cascadia Code", monospace;
}

.ical-result-card {
  display: grid;
  gap: 14px;
}

.empty-state {
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px dashed rgba(31, 43, 45, 0.16);
  text-align: center;
  color: var(--muted);
}

.health-shell {
  width: min(1200px, calc(100% - 32px));
}

.health-hero {
  margin-bottom: 24px;
}

.health-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.health-card pre {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: #1a292d;
  color: #edf6f2;
  overflow: auto;
  font-family: "Consolas", "Cascadia Code", monospace;
}

.health-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 12px;
}

.health-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(31, 43, 45, 0.08);
}

@media (max-width: 1100px) {
  .hero-layout,
  .two-column-layout,
  .calendar-layout,
  .library-layout,
  .ical-layout,
  .health-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .page-shell,
  .health-shell {
    width: min(100% - 20px, 100%);
    padding-top: 18px;
  }

  .site-header,
  .hero-card,
  .auth-card,
  .panel,
  .detail-panel,
  .health-hero {
    padding: 20px;
  }

  .site-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-stat-row,
  .stats-grid,
  .split-inputs,
  .calendar-weekdays,
  .calendar-grid {
    grid-template-columns: 1fr;
  }

  .calendar-weekdays {
    display: none;
  }

  .calendar-day {
    min-height: auto;
  }

  .header-actions > *,
  .library-controls > * {
    flex: 1 1 100%;
  }
}

.color-swatches {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 4px solid transparent;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.is-active {
  border-color: rgba(15, 138, 131, 0.4);
  box-shadow: 0 0 12px rgba(15, 138, 131, 0.2);
}

/* Event highlighting for shifts */
.calendar-dot.highlight {
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
