:root {
  color-scheme: light;
  --forest-950: #0d2c26;
  --forest-900: #123f35;
  --forest-800: #195143;
  --forest-700: #216452;
  --forest-100: #dfece5;
  --forest-50: #eff6f2;
  --cream: #f6f3ea;
  --paper: #fffefa;
  --ink: #17231f;
  --muted: #65736d;
  --line: #dce3de;
  --website: #247159;
  --website-soft: #d8ece4;
  --hipcamp: #86506e;
  --hipcamp-soft: #f0dde7;
  --blocked: #b55c32;
  --blocked-soft: #f8e1d5;
  --danger: #a73c35;
  --shadow: 0 24px 60px rgba(23, 46, 37, 0.11);
  --small-shadow: 0 8px 24px rgba(23, 46, 37, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 2%, rgba(68, 132, 105, 0.15), transparent 28rem),
    radial-gradient(circle at 96% 30%, rgba(215, 170, 111, 0.14), transparent 30rem),
    var(--cream);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(41, 128, 100, 0.35);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.85rem;
  color: white;
  background: var(--forest-950);
  border-radius: 0.6rem;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient-shape {
  position: fixed;
  z-index: -1;
  border: 1px solid rgba(25, 81, 67, 0.09);
  border-radius: 50%;
  pointer-events: none;
}

.ambient-shape-one {
  width: 28rem;
  height: 28rem;
  top: -16rem;
  right: -8rem;
}

.ambient-shape-two {
  width: 22rem;
  height: 22rem;
  bottom: -12rem;
  left: -10rem;
}

.app-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.auth-view {
  display: grid;
  min-height: calc(100vh - 3rem);
  min-height: calc(100dvh - 3rem);
  place-items: center;
}

.auth-card {
  width: min(100%, 29rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  background: rgba(255, 254, 250, 0.95);
  border: 1px solid rgba(25, 81, 67, 0.12);
  border-radius: 1.7rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.brand-lockup,
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-lockup img,
.topbar-brand img {
  flex: 0 0 auto;
  border-radius: 1rem;
  box-shadow: var(--small-shadow);
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--forest-700);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  color: var(--forest-950);
  line-height: 1.1;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  letter-spacing: -0.025em;
}

.auth-intro {
  margin: 1.5rem 0;
  color: var(--muted);
  line-height: 1.65;
}

.login-form {
  display: grid;
  gap: 0.55rem;
}

.login-form label {
  margin-top: 0.55rem;
  color: var(--forest-950);
  font-size: 0.84rem;
  font-weight: 750;
}

.login-form input {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.75rem 0.9rem;
  color: var(--ink);
  background: white;
  border: 1px solid #ccd8d2;
  border-radius: 0.8rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.login-form input:focus {
  border-color: var(--forest-700);
  box-shadow: 0 0 0 4px rgba(33, 100, 82, 0.1);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 4.2rem;
}

.text-button {
  padding: 0.35rem;
  color: var(--forest-700);
  background: transparent;
  border: 0;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.65rem;
  transform: translateY(-50%);
}

.mfa-field {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.35rem;
  padding: 0.9rem;
  background: var(--forest-50);
  border-radius: 0.9rem;
}

.mfa-field label {
  margin-top: 0;
}

.mfa-field small {
  color: var(--muted);
  line-height: 1.45;
}

.form-message {
  min-height: 1.25rem;
  margin: 0.5rem 0 0;
  color: var(--danger);
  font-size: 0.85rem;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.today-button,
.menu-button {
  min-height: 2.7rem;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  color: white;
  background: var(--forest-900);
  border: 1px solid var(--forest-900);
  box-shadow: 0 10px 24px rgba(18, 63, 53, 0.18);
}

.primary-button:hover {
  background: var(--forest-800);
}

.wide-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 0.35rem;
}

button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.trust-note {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-top: 1.25rem;
  padding-top: 1rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  line-height: 1.5;
}

.trust-note p {
  margin: 0;
}

.trust-icon {
  display: grid;
  flex: 0 0 1.3rem;
  width: 1.3rem;
  height: 1.3rem;
  color: white;
  background: var(--forest-700);
  border-radius: 50%;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.calendar-view {
  display: grid;
  gap: 1rem;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
  padding: 0.4rem 0;
}

.topbar-brand img {
  border-radius: 0.75rem;
}

.topbar-brand h1 {
  font-size: 1.35rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-button,
.avatar-button {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  place-items: center;
}

.icon-button:hover,
.avatar-button:hover {
  border-color: #b5c7be;
}

.icon-button svg,
.device-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button.is-spinning svg {
  animation: rotate 800ms linear infinite;
}

.avatar-button {
  color: white;
  background: var(--forest-900);
  border-color: var(--forest-900);
  font-size: 0.78rem;
  font-weight: 850;
}

.account-menu {
  position: absolute;
  z-index: 20;
  top: 4.1rem;
  right: 0;
  display: grid;
  width: min(19rem, calc(100vw - 2rem));
  padding: 1rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.account-menu span {
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8rem;
}

.menu-button {
  margin-top: 0.85rem;
  color: var(--danger);
  background: #fff7f5;
  border: 1px solid #f0d6d1;
}

.connection-banner,
.error-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.9rem;
  border-radius: 0.85rem;
  font-size: 0.84rem;
}

.connection-banner {
  color: #6d4a12;
  background: #fff2cf;
  border: 1px solid #ecd89f;
}

.error-banner {
  justify-content: space-between;
  color: #7a2c27;
  background: #fff1ee;
  border: 1px solid #efcec8;
}

.error-banner button {
  flex: 0 0 auto;
  padding: 0.4rem 0.65rem;
  color: inherit;
  background: white;
  border: 1px solid #e1b8b1;
  border-radius: 0.55rem;
  font-weight: 800;
  cursor: pointer;
}

.calendar-card,
.agenda-card,
.device-card {
  padding: clamp(1rem, 3vw, 1.5rem);
  background: rgba(255, 254, 250, 0.96);
  border: 1px solid rgba(25, 81, 67, 0.12);
  border-radius: 1.35rem;
  box-shadow: var(--small-shadow);
}

.calendar-toolbar,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.last-updated {
  min-height: 1rem;
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.month-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-button.subtle {
  width: 2.45rem;
  height: 2.45rem;
  background: var(--forest-50);
  border-color: transparent;
}

.today-button {
  min-height: 2.45rem;
  padding: 0.45rem 0.75rem;
  color: var(--forest-800);
  background: var(--forest-50);
  border: 0;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 1rem 0 0.8rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
}

.booking-dot {
  background: var(--website);
}

.hipcamp-dot {
  background: var(--hipcamp);
}

.blocked-dot {
  background: var(--blocked);
}

.calendar-scroll {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 1rem;
}

.weekday-row,
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  color: var(--muted);
  background: #f4f7f4;
  border-bottom: 1px solid var(--line);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-align: center;
  text-transform: uppercase;
}

.weekday-row span {
  padding: 0.65rem 0.2rem;
}

.day-cell {
  position: relative;
  min-width: 0;
  min-height: 7rem;
  padding: 0.35rem;
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.day-cell:nth-child(7n) {
  border-right: 0;
}

.day-cell.blank {
  background: #f7f7f2;
}

.day-cell:not(.blank) {
  cursor: pointer;
}

.day-cell:not(.blank):hover {
  background: #fafcf9;
}

.day-cell.is-selected {
  z-index: 1;
  background: var(--forest-50);
  box-shadow: inset 0 0 0 2px var(--forest-700);
}

.day-number {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  margin-bottom: 0.25rem;
  border-radius: 50%;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}

.day-cell.is-today .day-number {
  color: white;
  background: var(--forest-900);
}

.day-events {
  display: grid;
  gap: 0.2rem;
}

.event-chip {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0.26rem 0.35rem;
  border: 0;
  border-left: 3px solid currentColor;
  border-radius: 0.32rem;
  font-size: 0.64rem;
  font-weight: 780;
  line-height: 1.2;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.event-chip.booking {
  color: var(--website);
  background: var(--website-soft);
}

.event-chip.hipcamp {
  color: var(--hipcamp);
  background: var(--hipcamp-soft);
}

.event-chip.blocked {
  color: var(--blocked);
  background: var(--blocked-soft);
}

.more-events {
  display: block;
  padding: 0.12rem 0.25rem;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 800;
}

.calendar-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 12rem;
  color: var(--muted);
}

.spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--forest-100);
  border-top-color: var(--forest-700);
  border-radius: 50%;
  animation: rotate 800ms linear infinite;
}

@keyframes rotate {
  to { transform: rotate(360deg); }
}

.count-badge {
  padding: 0.38rem 0.65rem;
  color: var(--forest-700);
  background: var(--forest-50);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
}

.agenda-list {
  display: grid;
  gap: 0.6rem;
  margin-top: 1rem;
}

.agenda-event {
  display: grid;
  grid-template-columns: 0.35rem minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.8rem;
  background: #fafbf8;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  text-align: left;
  cursor: pointer;
}

.agenda-event:hover {
  background: white;
  border-color: #b9c9c1;
}

.agenda-bar {
  align-self: stretch;
  border-radius: 999px;
}

.agenda-event.booking .agenda-bar {
  background: var(--website);
}

.agenda-event.hipcamp .agenda-bar {
  background: var(--hipcamp);
}

.agenda-event.blocked .agenda-bar {
  background: var(--blocked);
}

.agenda-copy {
  min-width: 0;
}

.agenda-copy strong,
.agenda-copy span {
  display: block;
}

.agenda-copy .agenda-booking-details {
  color: var(--forest-800);
  font-size: 0.76rem;
  font-weight: 720;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.agenda-copy strong {
  overflow: hidden;
  color: var(--forest-950);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-copy span {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.agenda-arrow {
  color: var(--muted);
  font-size: 1.2rem;
}

.empty-agenda {
  padding: 1.25rem;
  color: var(--muted);
  background: #fafbf8;
  border: 1px dashed #cad6d0;
  border-radius: 0.9rem;
  line-height: 1.5;
  text-align: center;
}

.device-options {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.device-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
  padding: 0.8rem;
  background: #fafbf8;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
}

.device-option strong {
  display: block;
  color: var(--forest-950);
}

.device-option p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.device-icon {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  color: var(--forest-700);
  background: var(--forest-50);
  border-radius: 0.75rem;
  place-items: center;
}

.secondary-button {
  min-height: 2.4rem;
  padding: 0.45rem 0.75rem;
  color: var(--forest-800);
  background: white;
  border: 1px solid #bfcfc7;
  font-size: 0.78rem;
}

.secondary-button:hover {
  background: var(--forest-50);
}

.secondary-button.is-enabled {
  color: var(--forest-700);
  background: var(--forest-50);
  border-color: var(--forest-100);
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 0 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
}

dialog {
  width: min(calc(100% - 2rem), 31rem);
  max-height: calc(100dvh - 2rem);
  padding: 0;
  overflow: auto;
  background: var(--paper);
  border: 0;
  border-radius: 1.3rem;
  box-shadow: 0 30px 90px rgba(5, 26, 20, 0.32);
}

dialog::backdrop {
  background: rgba(8, 29, 23, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-accent {
  height: 0.5rem;
  background: var(--website);
}

.dialog-accent.hipcamp {
  background: var(--hipcamp);
}

.dialog-accent.blocked {
  background: var(--blocked);
}

.dialog-content {
  padding: 1.35rem;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.event-source {
  display: inline-flex;
  padding: 0.3rem 0.55rem;
  color: var(--forest-700);
  background: var(--forest-50);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.event-dialog h2 {
  margin-top: 0.85rem;
}

.event-details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.7rem 1rem;
  margin: 1.2rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.event-details dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.event-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--forest-950);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: right;
}

.event-details a {
  color: var(--forest-700);
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

.read-only-note,
.dialog-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.install-steps {
  display: grid;
  gap: 0.85rem;
  margin: 1.25rem 0;
  padding-left: 1.4rem;
  color: var(--ink);
  line-height: 1.5;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 1rem;
  bottom: max(1rem, env(safe-area-inset-bottom));
  left: 1rem;
  width: fit-content;
  max-width: min(28rem, calc(100vw - 2rem));
  margin: auto;
  padding: 0.75rem 1rem;
  color: white;
  background: var(--forest-950);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(1rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

  .calendar-card,
  .agenda-card,
  .device-card {
    padding: 0.9rem;
    border-radius: 1.1rem;
  }

  .calendar-toolbar {
    align-items: flex-start;
  }

  .day-cell {
    min-height: 5.5rem;
    padding: 0.22rem;
  }

  .day-number {
    width: 1.45rem;
    height: 1.45rem;
    font-size: 0.68rem;
  }

  .event-chip {
    min-height: 0.9rem;
    padding: 0.18rem 0.2rem;
    border-left-width: 2px;
    font-size: 0.55rem;
  }

  .device-option {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .device-option .secondary-button {
    grid-column: 2;
    justify-self: start;
  }
}

@media (max-width: 430px) {
  .topbar-brand .eyebrow {
    display: none;
  }

  .topbar-brand h1 {
    max-width: 10rem;
    font-size: 1.12rem;
  }

  .calendar-toolbar {
    display: grid;
  }

  .month-controls {
    justify-content: space-between;
  }

  .month-controls .today-button {
    flex: 1;
  }

  .weekday-row {
    font-size: 0.58rem;
  }

  .weekday-row span {
    padding: 0.55rem 0.1rem;
  }

  .day-cell {
    min-height: 4.65rem;
  }

  .day-events .event-chip:nth-child(n + 3) {
    display: none;
  }

  .device-icon {
    width: 2.3rem;
    height: 2.3rem;
  }
}

@media (display-mode: standalone) {
  .app-shell {
    padding-top: max(0.8rem, env(safe-area-inset-top));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
