@import url('/assets/fonts/fonts-local.css');

:root {
  --ink: #2B2620;
  --mocha: #8C6F63;
  --accent: #9C5570;
  --accent2: #6B3B57;
  --blush: #F3D9D0;
  --mauve: #E3C6D4;
  --ivory: #FBF3EE;
  --hairline: #D9BCB2;
  --white: #FFFFFF;
  --danger: #A6433B;
  --ok: #5c7a5c;
  --radius: 14px;
  --shadow: 0 10px 28px rgba(43, 38, 32, 0.08);
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-text: 'Jost', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-text);
  font-weight: 400;
  background: var(--ivory);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  padding-bottom: 90px;
}

body.cover-page {
  overflow: hidden;
  padding-bottom: 0;
}
body.cover-page.menu-active {
  overflow: auto;
  padding-bottom: 90px;
}

a { color: inherit; text-decoration: none; }

/* ==================== Cover screen ==================== */
.cover {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ivory);
  overflow: hidden;
  transition: opacity .55s ease, transform .55s ease;
}
body.menu-active .cover {
  opacity: 0;
  transform: translateY(-28px) scale(.97);
  pointer-events: none;
}

.cover-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
}

.cover-emblem {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cover-twig {
  position: absolute;
  z-index: 0;
  color: var(--accent2);
  pointer-events: none;
  width: 46%;
  height: auto;
}
.cover-twig--tl { top: -12%; left: -18%; transform: rotate(-16deg); opacity: .55; }
.cover-twig--tr { top: -16%; right: -20%; width: 40%; color: var(--accent); transform: scaleX(-1) rotate(-22deg); opacity: .5; }
.cover-twig--bl { bottom: -14%; left: -16%; width: 40%; color: var(--accent); transform: rotate(198deg); opacity: .45; }
.cover-twig--br { bottom: -18%; right: -18%; transform: scaleX(-1) rotate(204deg); opacity: .4; }

.cover-logo {
  position: relative;
  z-index: 1;
  width: min(360px, 60vw);
  height: auto;
  cursor: pointer;
  display: block;
  filter: drop-shadow(0 14px 30px rgba(107, 59, 87, .16));
  transition: transform .35s ease;
}
.cover-logo:hover,
.cover-logo:focus-visible {
  transform: scale(1.02);
}

.cover-tagline {
  margin-top: 22px;
  font-family: var(--font-text);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--mocha);
}

.cover-hint {
  margin-top: 40px;
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--hairline);
}

/* ==================== Menu / app screens ==================== */
.menu-screen {
  opacity: 1;
  transition: opacity .5s ease;
}
body.cover-page .menu-screen {
  opacity: 0;
  pointer-events: none;
}
body.cover-page.menu-active .menu-screen {
  opacity: 1;
  pointer-events: auto;
  transition: opacity .5s ease .12s;
}

.topbar {
  background: linear-gradient(135deg, var(--blush) 0%, var(--ivory) 100%);
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--accent2);
  letter-spacing: 0.01em;
}
.topbar .subtitle {
  font-family: var(--font-text);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--mocha);
  margin-top: 5px;
}
.topbar .back {
  display: inline-block;
  margin-bottom: 10px;
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--accent);
}

.container {
  max-width: 640px;
  margin: 0 auto;
  padding: 18px 16px 40px;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--hairline);
  padding: 18px 16px;
  margin-bottom: 14px;
}

.nav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 4px;
}
.nav-tile {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 14px 20px;
  text-align: center;
  border: 1px solid var(--hairline);
  transition: transform .2s ease, box-shadow .2s ease;
}
.nav-tile:active { transform: scale(.98); }
.nav-tile .icon {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
  line-height: 1;
}
.nav-tile .label {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--accent2);
  font-weight: 600;
}
.nav-tile .sub {
  font-family: var(--font-text);
  font-size: 11px;
  color: var(--mocha);
  margin-top: 4px;
  letter-spacing: .02em;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--accent2);
  font-weight: 600;
  margin: 0 0 12px 0;
}
h1 { font-size: 24px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

label {
  display: block;
  font-family: var(--font-text);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--mocha);
  margin: 14px 0 6px;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=tel], input[type=number], textarea, select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--hairline);
  border-radius: 10px;
  font-size: 15px;
  font-family: var(--font-text);
  background: var(--white);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}
textarea { resize: vertical; min-height: 90px; }

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .02em;
  cursor: pointer;
  background: var(--accent2);
  color: #fff;
  margin-top: 18px;
  min-height: 50px;
}
.btn:active { opacity: 0.85; }
.btn.secondary {
  background: var(--white);
  color: var(--accent2);
  border: 1.5px solid var(--accent2);
}
.btn.small {
  width: auto;
  padding: 9px 14px;
  font-size: 13px;
  margin-top: 0;
}
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.list-item {
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--hairline);
  padding: 14px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.list-item .main { flex: 1; min-width: 0; }
.list-item .title { font-family: var(--font-display); font-weight: 600; color: var(--accent2); font-size: 16px; }
.list-item .meta { font-family: var(--font-text); font-size: 12px; color: var(--mocha); margin-top: 3px; }
.list-item .actions { display: flex; gap: 8px; flex-shrink: 0; }
.icon-btn {
  background: var(--blush);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-text);
  font-size: 12px;
  cursor: pointer;
  color: var(--accent2);
}
.icon-btn.danger { background: #f2d9d6; color: var(--danger); }

.badge {
  display: inline-block;
  background: var(--blush);
  color: var(--accent2);
  font-family: var(--font-text);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  margin-right: 6px;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent2);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-family: var(--font-text);
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 100;
  max-width: 90%;
  text-align: center;
}
.toast.error { background: var(--danger); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--mocha);
  font-family: var(--font-text);
  font-size: 14px;
}

.wizard-steps {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.wizard-steps .dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--hairline);
}
.wizard-steps .dot.active { background: var(--accent2); }

.supplement-pick {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--blush);
}
.supplement-pick:last-child { border-bottom: none; }
.supplement-pick input[type=checkbox] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent2);
}
.supplement-pick .details { flex: 1; }
.supplement-pick .name { font-family: var(--font-text); font-weight: 500; font-size: 14px; color: var(--ink); }
.supplement-pick .cat { font-family: var(--font-text); font-size: 11px; color: var(--mocha); }
.supplement-extra {
  display: none;
  margin-top: 8px;
  gap: 8px;
  flex-direction: column;
}
.supplement-extra.open { display: flex; }

.photo-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumbs img {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--hairline);
}

.helper-text { font-family: var(--font-text); font-size: 12px; color: var(--mocha); margin-top: 4px; }

@media (min-width: 520px) {
  .nav-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .cover, .menu-screen, .cover-logo { transition: none; }
}

/* ==================== Login screen ==================== */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ivory);
  padding: 24px;
}
.login-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 360px;
}
.login-logo {
  width: 92px;
  height: auto;
  margin-bottom: 12px;
  filter: drop-shadow(0 6px 16px rgba(107, 59, 87, .16));
}
.login-tagline {
  font-family: var(--font-text);
  font-size: 10px;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--mocha);
  margin-bottom: 32px;
}
.login-card {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 26px 26px;
}
.login-card h1 {
  font-size: 20px;
  text-align: center;
  margin-bottom: 22px;
}
.login-card label:first-of-type { margin-top: 0; }
.login-error {
  margin-top: 14px;
  font-family: var(--font-text);
  font-size: 12px;
  color: var(--danger);
  text-align: center;
}
.login-error[hidden] { display: none; }
