:root {
  --bg-canvas: #f3ecdf;
  --bg-panel: rgba(255, 250, 242, 0.78);
  --bg-panel-strong: rgba(255, 250, 242, 0.94);
  --ink-strong: #182325;
  --ink-muted: #596669;
  --line: rgba(24, 35, 37, 0.1);
  --shadow-soft: 0 24px 60px rgba(53, 62, 55, 0.12);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --accent-warm: #c96c42;
  --accent-cool: #1f7a73;
  --daily: #2d739f;
  --weekly: #2d8f63;
  --monthly: #cf7a1f;
  --seasonal: #6f5ca8;
  --danger: #b24848;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --font-ui: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  --bg-canvas: #132024;
  --bg-panel: rgba(21, 33, 36, 0.78);
  --bg-panel-strong: rgba(18, 28, 31, 0.94);
  --ink-strong: #edf0ec;
  --ink-muted: #a6b4b4;
  --line: rgba(255, 255, 255, 0.1);
  --shadow-soft: 0 28px 70px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink-strong);
  background:
    radial-gradient(circle at 10% 20%, rgba(201, 108, 66, 0.16), transparent 28%),
    radial-gradient(circle at 85% 12%, rgba(31, 122, 115, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), transparent 38%),
    var(--bg-canvas);
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ambient-shell {
  inset: 0;
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

.ambient-shell__blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.75;
}

.ambient-shell__blob--one {
  width: 18rem;
  height: 18rem;
  background: rgba(201, 108, 66, 0.23);
  top: 3rem;
  left: -4rem;
}

.ambient-shell__blob--two {
  width: 20rem;
  height: 20rem;
  background: rgba(31, 122, 115, 0.18);
  right: -4rem;
  top: 9rem;
}

.ambient-shell__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.26), transparent 75%);
}

.app-shell {
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 7rem;
}

.hero,
.wizard-shell,
.dashboard-shell {
  animation: rise 320ms ease;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 1.5rem;
  align-items: start;
  min-height: calc(100vh - 4rem);
  padding-top: 1rem;
}

.hero__copy,
.auth-card,
.wizard-card,
.panel,
.room-card,
.chat-dock,
.toast {
  backdrop-filter: blur(16px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.hero__copy,
.auth-card,
.wizard-card,
.panel {
  border-radius: var(--radius-xl);
  padding: 1.5rem;
}

.hero__copy h1,
.wizard-header h1,
.topbar h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.7rem, 6vw, 4.8rem);
  line-height: 0.96;
  margin: 0.35rem 0 1rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

.lede,
.section-heading p,
.hero__copy .lede {
  color: var(--ink-muted);
  line-height: 1.65;
  max-width: 58ch;
}

.hero__metrics,
.stat-grid,
.field-grid {
  display: grid;
  gap: 1rem;
}

.hero__metrics,
.stat-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 2rem;
}

.metric-card,
.panel--stat {
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid var(--line);
}

.metric-card strong,
.panel--stat strong {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 0.4rem;
}

.pill,
.frequency-pill,
.step-pill,
.choice-chip,
.appliance-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.pill {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
}

.pill--warm {
  background: rgba(201, 108, 66, 0.14);
}

.pill--cool {
  background: rgba(31, 122, 115, 0.14);
}

.auth-card {
  width: min(100%, 28rem);
  justify-self: end;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  margin-bottom: 1rem;
}

.segmented button,
.step-pill {
  background: transparent;
  border: 0;
  color: var(--ink-muted);
  padding: 0.7rem 0.95rem;
  border-radius: 999px;
}

.segmented .is-active,
.step-pill.is-active {
  background: var(--ink-strong);
  color: var(--bg-canvas);
}

.stack-form,
.wizard-panel,
.room-list,
.task-list,
.room-summary,
.chat-log {
  display: grid;
  gap: 1rem;
}

.stack-form label,
.field-grid label {
  display: grid;
  gap: 0.35rem;
  color: var(--ink-muted);
}

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

.field-grid__wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 0.88rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-panel-strong);
  color: var(--ink-strong);
}

input:focus,
select:focus,
textarea:focus,
button:focus {
  outline: 2px solid rgba(45, 115, 159, 0.35);
  outline-offset: 2px;
}

.button {
  padding: 0.82rem 1.05rem;
  border-radius: 14px;
  border: 1px solid transparent;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent-warm), #d89b5b);
  color: #fff8f0;
}

.button--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-strong);
}

.wizard-header,
.section-heading,
.topbar,
.wizard-nav,
.room-card__head,
.task-card__footer,
.task-card__meta,
.chat-dock__head,
.topbar__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wizard-steps,
.choice-row,
.day-picker__grid,
.topbar__meta,
.task-card__actions,
.task-card__labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.wizard-shell,
.dashboard-shell {
  display: grid;
  gap: 1.4rem;
}

.wizard-header__actions {
  display: grid;
  gap: 0.75rem;
  justify-items: end;
}

.wizard-card {
  padding: 1.3rem;
}

.wizard-note {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(45, 115, 159, 0.18);
  background: rgba(45, 115, 159, 0.1);
  color: var(--ink-muted);
}

.wizard-nav {
  justify-content: flex-end;
  padding-top: 0.5rem;
}

.room-card {
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.choice-chip,
.appliance-pill {
  position: relative;
  padding: 0.58rem 0.82rem;
  background: rgba(255, 255, 255, 0.16);
}

.choice-chip input,
.appliance-pill input,
.checkbox-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-chip.is-active,
.appliance-pill.is-active {
  background: rgba(45, 143, 99, 0.18);
  border-color: rgba(45, 143, 99, 0.32);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-row input {
  position: static;
  opacity: 1;
  width: 1rem;
  height: 1rem;
}

.day-picker {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.day-picker__label {
  margin: 0 0 0.75rem;
  color: var(--ink-muted);
}

.day-picker__grid,
.appliance-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.45fr 0.9fr;
  gap: 1.2rem;
}

.dashboard-column,
.dashboard-sidebar {
  display: grid;
  gap: 1.2rem;
}

.panel h2,
.wizard-panel h2 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-size: 1.7rem;
}

.room-summary__item,
.task-card,
.chat-bubble {
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.15);
}

.room-summary__item strong,
.task-card h3 {
  display: block;
  margin-bottom: 0.3rem;
}

.room-summary__item span,
.room-summary__item small,
.task-card p,
.task-card small {
  color: var(--ink-muted);
}

.task-card {
  border-left-width: 5px;
}

.task-card--daily {
  border-left-color: var(--daily);
}

.task-card--weekly {
  border-left-color: var(--weekly);
}

.task-card--monthly {
  border-left-color: var(--monthly);
}

.task-card--seasonal {
  border-left-color: var(--seasonal);
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  text-transform: capitalize;
}

.priority-pill--high {
  background: rgba(178, 72, 72, 0.16);
}

.priority-pill--medium {
  background: rgba(207, 122, 31, 0.16);
}

.priority-pill--low {
  background: rgba(31, 122, 115, 0.12);
}

.task-card.is-overdue {
  box-shadow: inset 0 0 0 1px rgba(178, 72, 72, 0.3);
}

.frequency-pill {
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  text-transform: capitalize;
}

.frequency-pill--daily {
  background: rgba(45, 115, 159, 0.16);
}

.frequency-pill--weekly {
  background: rgba(45, 143, 99, 0.16);
}

.frequency-pill--monthly {
  background: rgba(207, 122, 31, 0.16);
}

.frequency-pill--seasonal {
  background: rgba(111, 92, 168, 0.16);
}

.assistant-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 10;
  padding: 0.95rem 1.15rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent-cool), #2f8a82);
  color: #f7fcfa;
  box-shadow: var(--shadow-soft);
}

.optimizer-card,
.optimizer-card__meta {
  display: grid;
  gap: 0.85rem;
}

.chat-dock {
  position: fixed;
  right: 1.25rem;
  bottom: 5rem;
  width: min(26rem, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 6.5rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-xl);
  padding: 1rem;
  transform: translateY(110%);
  transition: transform 180ms ease;
  z-index: 11;
}

.chat-dock.is-open {
  transform: translateY(0);
}

.chat-bubble--user {
  background: rgba(45, 115, 159, 0.16);
}

.chat-bubble--assistant {
  background: rgba(31, 122, 115, 0.13);
}

.chat-bubble p,
.chat-bubble small {
  margin: 0;
}

.chat-bubble p {
  white-space: pre-wrap;
  line-height: 1.55;
}

.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.2rem;
}

.chat-form {
  flex: 0 0 auto;
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.chat-form textarea {
  min-height: 5.5rem;
  max-height: 11rem;
  resize: vertical;
}

.assistant-status {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.assistant-status small {
  line-height: 1.45;
}

.toast {
  position: sticky;
  top: 1rem;
  z-index: 20;
  padding: 0.95rem 1.1rem;
  border-radius: 16px;
  margin: 0 auto 1rem;
  width: min(30rem, calc(100% - 1rem));
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(14, 24, 25, 0.28);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.loading-card {
  width: min(26rem, calc(100vw - 2rem));
  display: grid;
  gap: 0.85rem;
  justify-items: center;
  text-align: center;
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--bg-panel-strong);
  box-shadow: var(--shadow-soft);
}

.loading-card p,
.loading-card strong {
  margin: 0;
}

.loading-card p {
  color: var(--ink-muted);
  line-height: 1.6;
}

.loading-spinner {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  border: 3px solid rgba(31, 122, 115, 0.18);
  border-top-color: var(--accent-cool);
  animation: spin 820ms linear infinite;
}

.toast--error {
  border-color: rgba(178, 72, 72, 0.3);
}

.toast--success {
  border-color: rgba(45, 143, 99, 0.3);
}

.empty-copy {
  margin: 0;
  color: var(--ink-muted);
}

small {
  color: var(--ink-muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

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

@media (max-width: 1040px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    justify-self: stretch;
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1rem;
  }

  .hero__metrics,
  .stat-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .wizard-header,
  .topbar,
  .section-heading,
  .room-card__head,
  .chat-dock__head,
  .wizard-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .wizard-header__actions {
    justify-items: stretch;
  }

  .assistant-toggle,
  .chat-dock {
    right: 0.5rem;
  }

  .chat-dock {
    width: calc(100vw - 1rem);
    max-height: calc(100dvh - 5.75rem);
    bottom: 4.75rem;
  }
}
