:root {
  color-scheme: light;
  --ink: #24392e;
  --muted: #76626b;
  --line: #f0cfdd;
  --paper: #fff0f5;
  --panel: #fffafd;
  --sage: #5f8068;
  --sage-2: #ffe5ef;
  --leaf: #2f6247;
  --gold: #b58b46;
  --rose: #d8a59f;
  --sky: #a9c7c8;
  --danger: #a64d45;
  --shadow: 0 18px 50px rgba(108, 65, 84, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 240, 245, 0.98), rgba(255, 248, 251, 0.94)),
    #fff0f5;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(255, 240, 245, 0.72);
  backdrop-filter: blur(3px);
}

.auth-card {
  position: relative;
  width: min(100%, 460px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 253, 0.94);
  box-shadow: var(--shadow);
  display: grid;
  gap: 22px;
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
}

.auth-brand {
  padding-bottom: 4px;
}

.auth-card h2 {
  margin: 0;
  font-size: clamp(26px, 5vw, 38px);
  line-height: 1.15;
  letter-spacing: 0;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-message {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  line-height: 1.5;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 240, 245, 0.86);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 13px;
  align-items: center;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--leaf);
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand h1,
.topbar h2,
.section-heading h3,
.hero-copy h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 18px;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--ink);
  background: var(--sage-2);
  border-color: #edc7d7;
}

.mini-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.mini-note span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-note strong {
  display: block;
  margin: 6px 0;
}

.mini-note p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.main-panel {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar h2 {
  font-size: clamp(24px, 4vw, 38px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu {
  min-height: 42px;
  padding: 4px 4px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.user-menu strong {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.search-box {
  width: min(34vw, 360px);
  min-width: 230px;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.dashboard-grid,
.recipes-layout,
.journal-layout,
.inventory-layout,
.split-layout {
  display: grid;
  gap: 18px;
}

.dashboard-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.hero-panel {
  grid-column: 1 / -1;
  min-height: 430px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 240, 245, 0.96) 0%, rgba(255, 240, 245, 0.78) 48%, rgba(255, 240, 245, 0.08) 82%),
    url("./assets/hero-lavender.jpg");
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-copy {
  max-width: 650px;
}

.hero-copy h3 {
  max-width: 640px;
  font-size: clamp(28px, 5vw, 54px);
  line-height: 1.06;
}

.hero-copy p:not(.eyebrow) {
  max-width: 600px;
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.hero-actions,
.section-heading,
.form-row,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hero-actions {
  margin-top: 26px;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 253, 0.92);
  box-shadow: 0 10px 30px rgba(108, 65, 84, 0.08);
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading h3 {
  font-size: 20px;
}

.stat-strip {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-strip article {
  min-height: 116px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stat-strip span,
.stat-strip small,
.helper-text,
.meta,
.compact-list small {
  color: var(--muted);
}

.stat-strip strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 32px;
}

.visual-links {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.visual-tile {
  position: relative;
  min-height: 156px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 30px rgba(108, 65, 84, 0.08);
}

.visual-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(36, 57, 46, 0.06), rgba(36, 57, 46, 0.54));
}

.visual-tile span {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 13px;
  color: white;
  font-size: 17px;
  font-weight: 800;
  text-align: left;
}

.visual-oils {
  background-image: url("./assets/visual-oils.jpg");
}

.visual-recipes {
  background-image: url("./assets/visual-blend.jpg");
}

.visual-journal {
  background-image: url("./assets/hero-lavender.jpg");
  background-position: right center;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-button {
  color: white;
  background: var(--leaf);
}

.secondary-button {
  color: var(--leaf);
  background: var(--sage-2);
  border-color: #edc7d7;
}

.ghost-button {
  color: var(--muted);
  background: var(--panel);
  border-color: var(--line);
}

.text-button {
  color: var(--leaf);
  background: transparent;
}

.danger-button {
  min-height: 34px;
  color: var(--danger);
  background: #fff5f3;
  border-color: #edd3cf;
}

.compact-list,
.oil-list,
.recipe-list,
.inventory-list,
.timeline {
  display: grid;
  gap: 10px;
}

.compact-item,
.oil-card,
.recipe-card,
.inventory-card,
.timeline-item,
.purpose-card,
.safety-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.compact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.compact-item strong,
.oil-card strong,
.recipe-card strong,
.inventory-card strong {
  display: block;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--sage-2);
  color: var(--leaf);
}

.badge.gold {
  background: #f4ead9;
  color: #7c5b23;
}

.badge.rose {
  background: #f9e4e1;
  color: #8f4b44;
}

.badge.sky {
  background: #e1eff0;
  color: #35666a;
}

.calculator {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.calculator label {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.calculator label input {
  grid-column: 1 / 2;
}

.calculator label span {
  align-self: center;
}

.calculator output {
  min-width: 86px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--leaf);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--ink);
  background: var(--panel);
  outline-color: var(--sage);
}

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

.split-layout {
  grid-template-columns: 380px minmax(0, 1fr);
}

.list-panel,
.detail-panel {
  align-self: start;
}

.oil-card {
  text-align: left;
  display: grid;
  gap: 9px;
}

button.oil-card {
  width: 100%;
}

.oil-card.is-selected {
  border-color: var(--sage);
  box-shadow: inset 0 0 0 1px var(--sage);
}

.oil-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.detail-tile {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff6fa;
}

.detail-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-panel h3 {
  margin-top: 0;
  font-size: 30px;
}

.detail-panel ul {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.75;
}

.purpose-grid,
.safety-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.purpose-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.purpose-card p,
.safety-card p,
.recipe-card p,
.inventory-card p,
.timeline-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.recipes-layout,
.journal-layout,
.inventory-layout {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-row {
  align-items: start;
}

.form-row label {
  flex: 1;
  min-width: 0;
}

.recipe-card {
  display: grid;
  gap: 8px;
}

.recipe-card header,
.inventory-card header,
.timeline-item header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.inventory-card {
  display: grid;
  gap: 12px;
}

.stock-meter {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--sage-2);
}

.stock-meter span {
  display: block;
  height: 100%;
  width: 50%;
  background: var(--leaf);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  border-radius: 8px;
  color: white;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

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

@media (max-width: 1080px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
    position: static;
    height: auto;
    padding: 16px;
  }

  .main-panel {
    order: 1;
  }

  .nav-list {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
    padding: 0 8px;
  }

  .mini-note {
    display: none;
  }

  .dashboard-grid,
  .split-layout,
  .recipes-layout,
  .journal-layout,
  .inventory-layout {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 760px) {
  .main-panel {
    display: flex;
    flex-direction: column;
    padding: 14px 18px 18px;
  }

  .topbar,
  .topbar-actions,
  .hero-actions,
  .form-row,
  .compact-item {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    order: 2;
    display: grid;
    margin: 16px 0 18px;
  }

  .view.is-active {
    order: 3;
  }

  #dashboard-view.is-active {
    display: contents;
  }

  #dashboard-view .dashboard-grid {
    display: contents;
  }

  .topbar-actions,
  .hero-actions {
    display: grid;
  }

  .auth-screen {
    padding: 18px;
  }

  .auth-card {
    padding: 22px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .search-box {
    width: 100%;
    min-width: 0;
  }

  .user-menu {
    width: 100%;
    justify-content: space-between;
  }

  .user-menu strong {
    max-width: 132px;
  }

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

  .hero-panel {
    order: 1;
    min-height: 520px;
    padding: 20px;
    background:
      linear-gradient(180deg, rgba(255, 240, 245, 0.96) 0%, rgba(255, 240, 245, 0.84) 58%, rgba(255, 240, 245, 0.42) 100%),
      url("./assets/hero-lavender.jpg");
    background-position: 62% center;
    background-size: cover;
  }

  .stat-strip {
    order: 3;
  }

  .visual-links {
    order: 4;
  }

  #dashboard-view .panel {
    order: 5;
  }

  .stat-strip,
  .visual-links,
  .purpose-grid,
  .safety-grid,
  .detail-grid,
  .calculator {
    grid-template-columns: 1fr;
  }
}
