/* ============================================================
   Nourrir Table — visual system mirrored EXACTLY from
   nourrir-ops (the old portal). Every value is extracted
   from the live styles.css, not invented.
   ============================================================ */

/* -------------------- Brand tokens (extracted) -------------- */

:root {
  /* Backgrounds — note: the operations shell renders on a brighter
     cream (#FFFDF5) than the editorial cream (#F5EFE0). The brighter
     value is the one actually seen in mp-app / mp-body / mp-card. */
  --bg:          #FFFDF5;
  --cream:       #F5EFE0;
  --cream-soft:  #FBF7EC;
  --cream-edge:  #E8DFC8;
  --cream-deep:  #DDD3B8;

  /* Brand */
  --forest:      #3B542A;
  --forest-deep: #2A3D1E;
  --gold:        #B2914A;
  --gold-soft:   #C9A878;

  /* Text */
  --dark:        #1A1410;     /* primary text */
  --dark-soft:   #4A4036;     /* warm grey-brown — labels, muted */
  --ink:         #1a1a18;     /* mp-app body colour */
  --muted-1:     #5a5a52;     /* body sublines */
  --muted-2:     #7a7a70;     /* secondary text */
  --muted-3:     #9a9a90;     /* nav inactive, dim labels */

  /* Status */
  --status-amber: #B8862C;
  --status-red:   #8B3A1F;
  --status-green: #4A6B4C;

  /* Subtle dividers (forest tints) */
  --rule-08: rgba(59,84,42,0.08);
  --rule-12: rgba(59,84,42,0.12);
  --rule-15: rgba(59,84,42,0.15);
  --rule-20: rgba(59,84,42,0.20);
  --rule-25: rgba(59,84,42,0.25);

  /* Type */
  --serif: 'Cormorant Garamond', 'Times New Roman', serif;
  --sans:  'Jost', system-ui, sans-serif;

  --radius: 2px;

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --t-fast: 200ms;
}

/* -------------------- Reset + base -------------------------- */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

input, select, textarea {
  background: var(--cream-soft);
  border: 1px solid var(--cream-edge);
  border-radius: var(--radius);
  padding: 10px 12px;
  width: 100%;
  font-weight: 400;
  font-family: inherit;
  font-size: 14px;
  color: var(--dark);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1.4;
  transition: border-color 0.15s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--forest); }

label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dark-soft);
  margin-bottom: 6px;
  font-weight: 400;
}

/* -------------------- Top header (mp-header) ---------------- */

.mp-header {
  background: var(--forest);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.mp-wordmark {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--bg);
  letter-spacing: 0.04em;
  user-select: none;
  line-height: 1;
}
.mp-wordmark .dot { color: var(--gold); }

.mp-hdr-r {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-meta {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,253,245,0.55);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  margin-right: 5px;
  vertical-align: middle;
}

.signout-btn {
  background: transparent;
  border: 0.5px solid rgba(255,253,245,0.3);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.signout-btn:hover { border-color: var(--gold); color: var(--gold); }

.hamburger-btn {
  display: none;
  background: transparent;
  border: 0;
  color: var(--bg);
  padding: 6px;
  cursor: pointer;
}

/* -------------------- Tab nav (mp-nav.tabs) ----------------- */

.mp-nav {
  background: var(--bg);
  border-bottom: 0.5px solid var(--rule-12);
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 20px;
  scrollbar-width: none;
  position: sticky;
  top: 56px;
  z-index: 99;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.mp-nav::-webkit-scrollbar { display: none; }

.mp-ni {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-3);
  padding: 13px 12px 11px;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  transition: color 0.2s ease, border-color 0.2s ease;
  background: transparent;
  scroll-snap-align: start;
  flex-shrink: 0;
}
.mp-ni:hover { color: var(--forest); }
.mp-ni.is-active {
  color: var(--forest);
  border-bottom-color: var(--gold);
}

.mp-ni--bell {
  margin-left: auto;
  padding: 13px 12px 11px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bell-count {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 12px;
  text-align: left;
}
.bell-count.is-empty { display: none; }

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: 0;
  background: var(--forest);
  z-index: 200;
  padding: 56px 24px 24px;
  flex-direction: column;
  gap: 0;
  display: none;
  overflow-y: auto;
}
.drawer.is-open { display: flex; }
.drawer__close {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--bg);
  padding: 6px;
  background: transparent;
}
.drawer__brand {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  color: var(--bg);
  letter-spacing: 0.04em;
  margin-bottom: 24px;
}
.drawer__brand .dot { color: var(--gold); }
.drawer__link {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,253,245,0.7);
  padding: 14px 0;
  border-bottom: 0.5px solid rgba(255,253,245,0.08);
  cursor: pointer;
}
.drawer__link.is-active { color: var(--bg); }
.drawer__link:last-child { border-bottom: none; margin-top: auto; }

@media (max-width: 720px) {
  .mp-header { padding: 0 16px; }
  .live-meta { display: none; }
  .signout-btn { display: none; }
  .hamburger-btn { display: inline-flex; }
  /* Admin's nav collapses behind the hamburger drawer; the member
     portal keeps its horizontal-scroll nav. */
  .is-admin .mp-nav { display: none; }
}

/* -------------------- Page body container ------------------- */

.mp-body {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  background: var(--bg);
}
.mp-body--member {
  max-width: 560px;
}

@media (max-width: 720px) {
  .mp-body { padding: 20px 16px 60px; }
}

/* -------------------- Section header pattern ---------------- */

/* Block 1 of any section: gold label / Cormorant title / muted sub  */

.mp-sl {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 12px;
}

.mp-stitle {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  color: var(--forest);
  margin-bottom: 4px;
  letter-spacing: -0.005em;
  line-height: 1.2;
}

.mp-ssub {
  font-size: 12px;
  font-weight: 300;
  color: var(--muted-2);
  margin-bottom: 24px;
  line-height: 1.6;
}

/* When a section has a chip / select to the right of the title */
.mp-stitle-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin: 20px 0 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.mp-stitle-row .mp-sl { margin-bottom: 6px; }
.mp-stitle-row .mp-stitle { margin-bottom: 0; }

.mp-stitle-row + .mp-ssub { margin-top: 4px; }

/* Date chip / period chip */
.date-chip {
  display: inline-block;
  background: var(--cream-soft);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: var(--radius);
  white-space: nowrap;
}

/* Divider rule used between section groups */
.mp-div {
  height: 0.5px;
  background: rgba(59,84,42,0.10);
  margin: 22px 0;
  border: 0;
}

/* -------------------- Sub-tabs (Week/Month/All-time) -------- */

.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--cream-edge);
}
.sub-tabs button {
  padding: 10px 16px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dark-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
  font-family: var(--sans);
  background: transparent;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.sub-tabs button:hover { color: var(--forest); }
.sub-tabs button.is-active {
  color: var(--forest);
  border-bottom-color: var(--gold);
}

/* -------------------- Stat grid + cards --------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1080px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px)  { .stat-grid { grid-template-columns: 1fr; gap: 12px; } }

.stat {
  background: var(--cream-soft);
  border: 1px solid var(--cream-edge);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
}
.stat__label {
  font-size: 10px;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
  font-weight: 500;
}
.stat__value {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  line-height: 1;
  color: var(--forest);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.stat__value--small { font-size: 26px; }
.stat__sub {
  font-size: 11px;
  color: var(--dark-soft);
  margin-top: 10px;
  letter-spacing: 0.02em;
}
.stat__sub strong { color: var(--dark); font-weight: 500; }

.stat--feature {
  background: var(--forest);
  color: var(--bg);
  border-color: var(--forest);
}
.stat--feature .stat__label  { color: var(--gold); }
.stat--feature .stat__value  { color: var(--bg); }
.stat--feature .stat__sub    { color: rgba(255,253,245,0.7); }
.stat--feature .stat__sub strong { color: var(--gold-soft); }

.stat--gold {
  background: var(--cream-soft);
  border-color: var(--gold);
}
.stat--gold .stat__value { color: var(--gold); }

@media (max-width: 720px) {
  .stat { padding: 18px 18px; }
  .stat__value { font-size: 30px; }
  .stat__value--small { font-size: 22px; }
}

/* Inline mini-card (mp-card variant for member views) */
.mp-card {
  border: 0.5px solid var(--rule-15);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  background: var(--bg);
}

/* -------------------- Tables -------------------------------- */

.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dark-soft);
  font-weight: 400;
  padding: 14px 12px;
  border-bottom: 1px solid var(--cream-deep);
}
.tbl td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--cream-edge);
  font-weight: 400;
  vertical-align: middle;
}
.tbl tr:last-child td { border-bottom: none; }
.tbl td.numeric, .tbl th.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tbl td.serif {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--forest);
}

/* -------------------- Buttons ------------------------------- */

.btn {
  background: var(--forest);
  color: var(--bg);
  padding: 12px 22px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
  border-radius: var(--radius);
  font-family: var(--sans);
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
  display: inline-block;
}
.btn:hover { background: var(--forest-deep); }

.btn--secondary {
  background: transparent;
  color: var(--forest);
  border: 1px solid var(--forest);
}
.btn--secondary:hover { background: var(--forest); color: var(--bg); }

.btn--gold { background: var(--gold); color: var(--bg); }
.btn--gold:hover { background: #82602D; }

.btn--small { padding: 8px 14px; font-size: 10px; }

.btn:disabled { opacity: 0.4; cursor: default; }

/* -------------------- Form rows ----------------------------- */

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.form-row--3 { grid-template-columns: repeat(3, 1fr); }
.form-row--2 { grid-template-columns: repeat(2, 1fr); }
.form-row--1 { grid-template-columns: 1fr; }
@media (max-width: 720px) {
  .form-row, .form-row--3, .form-row--2 { grid-template-columns: 1fr; }
}

/* -------------------- Phase 2/3 placeholder ----------------- */

.phase-pending {
  margin-top: 48px;
  padding: 36px 0;
  text-align: center;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted-3);
}

/* -------------------- Empty / loading ----------------------- */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  color: var(--dark-soft);
  padding: 36px 16px;
}
.empty-state .glyph {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: var(--gold-soft);
  margin-bottom: 10px;
}
.empty-state p {
  font-size: 12px;
  letter-spacing: 0.06em;
}

.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted-3);
  padding: 36px 0;
}
.loading::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--forest);
  animation: dot-pulse 1.2s var(--ease) infinite;
}
@keyframes dot-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

/* -------------------- Allergen + FM tags -------------------- */

.dot-allergen {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--status-red);
  vertical-align: middle;
  margin: 0 4px 0 0;
}

.badge-fm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--sans);
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--gold);
  background: rgba(178,145,74,0.10);
  padding: 3px 8px;
  border-radius: var(--radius);
}

/* -------------------- Slide-in panel ------------------------ */

.slide-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 100vw);
  background: var(--bg);
  border-left: 1px solid var(--cream-edge);
  z-index: 150;
  padding: 32px 28px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 300ms var(--ease);
}
.slide-panel.is-open { transform: translateX(0); }
.slide-panel__close {
  position: absolute; top: 14px; right: 14px;
  color: var(--forest); padding: 6px;
}
.slide-panel__backdrop {
  position: fixed; inset: 0;
  background: rgba(26,20,16,0.32);
  z-index: 140;
  opacity: 0; pointer-events: none;
  transition: opacity 300ms var(--ease);
}
.slide-panel__backdrop.is-open { opacity: 1; pointer-events: auto; }

/* -------------------- Takeover (Sunday is set.) ------------- */

.takeover {
  position: fixed; inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 300ms var(--ease);
}
.takeover.is-open { opacity: 1; pointer-events: auto; }
.takeover__text {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.01em;
  color: var(--forest);
  text-align: center;
}
@media (max-width: 720px) {
  .takeover__text { font-size: 28px; }
}

/* -------------------- Lucide icons -------------------------- */

[data-lucide] {
  width: 16px; height: 16px;
  stroke-width: 1.5;
}

/* -------------------- Helpers ------------------------------- */

.is-hidden { display: none !important; }
.muted { color: var(--dark-soft); }
.gold-text { color: var(--gold); }
.serif-text { font-family: var(--serif); }
.tabular { font-variant-numeric: tabular-nums; }
