/* ============================================================
   匠人厨房 · 家庭菜谱
   Sheikah Slate — 希卡石板
   Breath of the Wild aesthetic.
   Ancient stone · Warm parchment · Sheikah blue glow.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  /* Parchment surfaces — warm, aged paper */
  --bg-primary: #F5F0E6;
  --bg-surface: #FFFDF5;
  --bg-elevated: #F0EBDD;
  --bg-input: #FBF8F0;

  /* Sheikah blue — the only accent */
  --accent: #4A90D9;
  --accent-soft: #3A7BC8;
  --accent-glow: #7BB8E8;
  --accent-subtle: rgba(74, 144, 217, 0.08);
  --accent-glow-ring: 0 0 0 3px rgba(74, 144, 217, 0.12);

  /* Stone tones — for the device frame */
  --stone-dark: #2D2820;
  --stone-mid: #4A4438;
  --stone-light: #8B8578;

  /* Nature semantic — muted earth versions */
  --green: #5A8A4A;
  --green-soft: #4A7A3D;
  --green-subtle: rgba(90, 138, 74, 0.1);
  --danger: #C0553A;
  --danger-subtle: rgba(192, 85, 58, 0.08);
  --warning: #C4A35A;
  --warning-subtle: rgba(196, 163, 90, 0.12);

  /* Ink on parchment — text hierarchy */
  --text-primary: #2D2418;
  --text-secondary: #6B5E4A;
  --text-muted: #9B8E7A;
  --text-quaternary: #C4BAAA;

  /* Delicate borders — like ruled lines on old paper */
  --border: #E0D8C8;
  --border-light: #EBE5D8;
  --border-rule: #DDD4C0;

  /* Radii — soft, organic */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Shadows — soft and warm, never harsh */
  --shadow-sm: 0 1px 2px rgba(45, 36, 24, 0.04);
  --shadow-card: 0 2px 8px rgba(45, 36, 24, 0.05);
  --shadow-elevated: 0 8px 24px rgba(45, 36, 24, 0.08);
  --shadow-glow: 0 0 20px rgba(74, 144, 217, 0.15);

  /* Layout */
  --nav-height: 80px;
  --safe-top: 54px;
  --safe-bottom: 34px;
  --phone-width: 430px;
  --phone-height: 932px;

  /* Typography */
  --font-display: 'Noto Serif SC', 'STSong', 'SimSun', 'Songti SC', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Monaco', 'Consolas', monospace;
}

/* ============================================================
   RESET & GLOBAL
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: #1E1B16;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   PHONE FRAME — Dark Sheikah Stone
   ============================================================ */
.phone-frame {
  width: 454px;
  background: #2D2820;
  border-radius: 52px;
  padding: 12px;
  position: relative;
  box-shadow:
    0 0 0 1px #3D3830,
    0 0 0 4px #1E1B16,
    0 30px 80px rgba(0,0,0,0.5),
    0 10px 30px rgba(0,0,0,0.3);
  /* Subtle stone texture */
  background-image:
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(0,0,0,0.08) 0%, transparent 50%),
    linear-gradient(180deg, #302B23 0%, #2A251E 50%, #2D2820 100%);
}

/* ---- Screen — Glowing Parchment ---- */
.phone-screen {
  width: var(--phone-width);
  height: var(--phone-height);
  background-color: var(--bg-primary);
  border-radius: 41px;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.06),
    0 0 0 1px rgba(0,0,0,0.2);
  /* Parchment texture */
  background-image:
    repeating-linear-gradient(180deg, transparent, transparent 2px, rgba(139,126,106,0.025) 2px, rgba(139,126,106,0.025) 3px),
    radial-gradient(ellipse at 50% 30%, rgba(255,252,245,0.5) 0%, transparent 70%);
}

/* ---- Dynamic Island — Sheikah Sensor ---- */
.dynamic-island {
  position: absolute;
  top: 11px;
  left: 50%;
  transform: translateX(-50%);
  width: 126px;
  height: 36px;
  background: #1E1B16;
  border-radius: 20px;
  z-index: 1000;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 0 12px rgba(74,144,217,0.06);
}

/* ---- Status Bar ---- */
.status-bar-time {
  position: absolute;
  top: 16px;
  left: 32px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  z-index: 999;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
}

.status-bar-icons {
  position: absolute;
  top: 16px;
  right: 32px;
  display: flex;
  gap: 6px;
  align-items: center;
  z-index: 999;
}

.status-bar-icons .sb-signal { font-size: 10px; letter-spacing: -1px; color: var(--text-secondary); }
.status-bar-icons .sb-wifi  { font-size: 11px; color: var(--text-secondary); }
.status-bar-icons .sb-batt  { font-size: 10px; letter-spacing: -2px; color: var(--text-secondary); }

/* ---- Home Indicator — etched line ---- */
.home-indicator {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: rgba(45,36,24,0.3);
  border-radius: 100px;
  z-index: 1000;
}

/* ============================================================
   APP CONTAINER
   ============================================================ */
#app {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: transparent;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

#app > main {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

#app > main::-webkit-scrollbar { width: 0; }
#app > main { scrollbar-width: none; }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
  line-height: 1.3;
}
h2 { font-size: 1.35rem; font-weight: 900; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.9rem; color: var(--text-secondary); letter-spacing: 0.05em; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease;
}
a:hover { color: var(--accent-glow); }

p { color: var(--text-secondary); line-height: 1.7; }

/* ---- Loading ---- */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
}

/* ============================================================
   SHEIKAH TAB BAR
   ============================================================ */
.bottom-nav {
  order: 1;
  flex-shrink: 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: var(--nav-height);
  padding: 6px 12px 20px;
  background: rgba(245,240,230,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border);
  position: relative;
  z-index: 100;
}

.bottom-nav::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.3;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.58rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 4px 0;
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  min-width: 52px;
  gap: 5px;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-icon {
  font-size: 0.85rem;
  line-height: 1;
  transition: all 0.3s ease;
  opacity: 0.5;
}

.nav-item .nav-label {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.nav-item.router-link-active {
  color: var(--accent);
}

.nav-item.router-link-active .nav-icon {
  opacity: 1;
  text-shadow: 0 0 8px rgba(74,144,217,0.4);
}

.nav-item.router-link-active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

.nav-item:active { opacity: 0.5; }

/* ============================================================
   LAYOUT
   ============================================================ */
.page-container {
  padding: 12px 18px 0;
  animation: pageEnter 0.4s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.page-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 24px;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pageEnterUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,144,217,0); }
  50%      { box-shadow: 0 0 0 4px rgba(74,144,217,0.08); }
}

/* ---- App Header ---- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 14px;
  margin-bottom: 4px;
}

.app-header h2 {
  color: var(--text-primary);
  font-size: 1.55rem;
  font-weight: 900;
  margin: 0;
}

.app-header .header-subtitle {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-body);
  letter-spacing: 0.04em;
  display: block;
  margin-top: 1px;
}

/* ============================================================
   AUTH CARD — Sheikah Slate activation
   ============================================================ */
.auth-card {
  width: 100%;
  max-width: 320px;
  padding: 2.2rem 1.6rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-card);
  animation: scaleIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
  position: relative;
}

/* Sheikah eye mark — subtle decorative circle */
.auth-card::before {
  content: '';
  display: block;
  width: 24px;
  height: 24px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  margin: 0 auto 0.8rem;
  opacity: 0.6;
  box-shadow: 0 0 12px rgba(74,144,217,0.15);
}

.auth-card h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 0.3rem;
}

.auth-card .brand-mark {
  display: none;
}

.auth-card .brand-tagline {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8rem;
  margin-bottom: 1.5rem;
  letter-spacing: 0.04em;
}

.auth-card .test-hint {
  text-align: center;
  margin-top: 1rem;
  font-size: 0.65rem;
  color: var(--text-quaternary);
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border-light);
  letter-spacing: 0.02em;
}

/* ============================================================
   CARDS — Parchment notes style
   ============================================================ */
.meal-card,
.pantry-item,
.shopping-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  margin-bottom: 0;
  background: var(--bg-surface);
  transition: all 0.2s ease;
  animation: pageEnterUp 0.35s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  position: relative;
}

.meal-card:first-child,
.pantry-item:first-child,
.shopping-item:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
  border-top: 0.5px solid var(--border);
}

.meal-card:last-child,
.pantry-item:last-child,
.shopping-item:last-child {
  border-radius: 0 0 var(--radius) var(--radius);
  border-bottom: 0.5px solid var(--border);
}

.meal-card:only-child,
.pantry-item:only-child,
.shopping-item:only-child {
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
}

.meal-card + .meal-card,
.pantry-item + .pantry-item,
.shopping-item + .shopping-item {
  border-top: 0.5px solid var(--border-light);
}

.meal-card + .meal-card:last-child,
.pantry-item + .pantry-item:last-child,
.shopping-item + .shopping-item:last-child {
  border-bottom: 0.5px solid var(--border);
}

/* Staggered reveal */
.meal-card:nth-child(1) { animation-delay: 0.03s; }
.meal-card:nth-child(2) { animation-delay: 0.06s; }
.meal-card:nth-child(3) { animation-delay: 0.09s; }
.meal-card:nth-child(4) { animation-delay: 0.12s; }
.meal-card:nth-child(5) { animation-delay: 0.15s; }

.meal-card:active,
.pantry-item:active,
.shopping-item:active {
  background: var(--bg-elevated);
}

.meal-info {
  flex: 1;
  min-width: 0;
}

.meal-info strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1px;
  letter-spacing: 0.02em;
}

.meal-info small {
  display: block;
  color: var(--text-muted);
  font-size: 0.73rem;
  line-height: 1.4;
}

.meal-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  margin-left: 0.75rem;
}

/* ============================================================
   RECIPE GRID — like field notes
   ============================================================ */
.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.recipe-card {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
  text-decoration: none;
  color: inherit;
  animation: pageEnterUp 0.4s cubic-bezier(0.25, 0.1, 0.25, 1) both;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:nth-child(1) { animation-delay: 0.03s; }
.recipe-card:nth-child(2) { animation-delay: 0.06s; }
.recipe-card:nth-child(3) { animation-delay: 0.09s; }
.recipe-card:nth-child(4) { animation-delay: 0.12s; }
.recipe-card:nth-child(5) { animation-delay: 0.15s; }
.recipe-card:nth-child(6) { animation-delay: 0.18s; }

.recipe-card:active {
  transform: scale(0.97);
}

.recipe-card:hover {
  border-color: var(--accent-soft);
  box-shadow: var(--shadow-glow);
}

.recipe-card-img {
  width: 100%;
  height: 108px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.recipe-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recipe-card-emoji {
  font-size: 1.6rem;
  opacity: 0.35;
}

.recipe-card-body {
  padding: 0.6rem 0.7rem;
}

.recipe-card-body strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.02em;
}

.recipe-card-body small {
  color: var(--text-muted);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

/* ============================================================
   RECIPE DETAIL
   ============================================================ */
.recipe-hero-image {
  margin-top: 0.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 260px;
  border: 0.5px solid var(--border);
}

.recipe-hero-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-meta {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  align-items: center;
}

.recipe-description-box {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.85rem;
  line-height: 1.7;
  margin-top: 0.75rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.2rem 0 0.5rem;
  padding-bottom: 0.3rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-rule);
}

/* ============================================================
   FORMS — Clean Sheikah inputs
   ============================================================ */
label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
  margin-top: 0.65rem;
}

label:first-of-type { margin-top: 0.15rem; }

input,
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: var(--bg-input);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  transition: all 0.25s ease;
  outline: none;
  -webkit-appearance: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--accent-glow-ring);
}

input::placeholder,
textarea::placeholder { color: var(--text-quaternary); }

input[type="date"] { color-scheme: light; }

input[type="search"] {
  border-radius: 8px;
  padding-left: 0.85rem;
  background: var(--bg-input);
  font-size: 0.83rem;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B8E7A' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 2rem;
  appearance: none;
}

textarea {
  resize: vertical;
  min-height: 96px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
}

.form-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.form-row > * { flex: 1; }
.form-row button { flex: 0; }

/* ---- Checkbox ---- */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  border-radius: 4px;
  cursor: pointer;
}

/* ============================================================
   BUTTONS — Clean Sheikah geometry
   ============================================================ */
button,
.btn,
[role="button"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: none;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* Primary — Sheikah blue */
button:not(.outline):not(.ghost):not(.danger),
.btn-primary,
[role="button"]:not(.outline):not(.danger) {
  background: var(--accent);
  color: #FFF;
}

button:not(.outline):not(.ghost):not(.danger):active {
  background: var(--accent-soft);
  transform: scale(0.97);
  box-shadow: var(--shadow-glow);
}

/* Outline */
button.outline,
.btn-outline,
[role="button"].outline {
  background: transparent;
  border: 0.5px solid var(--border);
  color: var(--text-primary);
}

button.outline:active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  transform: scale(0.97);
}

/* Ghost — subtle text only */
button.ghost {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.25rem 0.55rem;
  font-weight: 500;
}

button.ghost:active { color: var(--accent); opacity: 0.7; }

/* Danger */
button.danger,
.btn-danger {
  background: transparent;
  border: 0.5px solid var(--danger);
  color: var(--danger);
}

button.danger:active {
  background: var(--danger-subtle);
}

/* Small */
button.small,
.btn-small,
[role="button"].small {
  padding: 0.25rem 0.7rem;
  font-size: 0.72rem;
  border-radius: 5px;
}

/* Icon only */
button.icon-only {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.95rem;
}

/* Full width */
button.full,
.btn-full { width: 100%; }

/* Disabled */
button:disabled,
button[aria-busy="true"] {
  opacity: 0.35;
  pointer-events: none;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge.green {
  background: var(--green-subtle);
  color: var(--green);
}

.badge.warning {
  background: var(--warning-subtle);
  color: var(--warning);
}

.badge.danger {
  background: var(--danger-subtle);
  color: var(--danger);
}

/* ============================================================
   ALERTS & MESSAGES
   ============================================================ */
.alert-warning {
  background: var(--warning-subtle);
  color: var(--warning);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.error-msg {
  background: var(--danger-subtle);
  color: var(--danger);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  font-weight: 500;
  margin: 0.6rem 0;
  border-left: 2px solid var(--danger);
}

.success-msg {
  background: var(--green-subtle);
  color: var(--green);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.76rem;
  margin: 0.6rem 0;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-hint {
  color: var(--text-quaternary);
  font-size: 0.8rem;
  padding: 2rem 1rem;
  text-align: center;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
}

/* ============================================================
   CATEGORY TABS — like Sheikah rune selections
   ============================================================ */
.category-tabs {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0 1px;
}

.category-tab {
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.25s ease;
  user-select: none;
  white-space: nowrap;
  border: 0.5px solid transparent;
  -webkit-tap-highlight-color: transparent;
}

.category-tab:active { opacity: 0.6; }

.category-tab.active {
  background: var(--accent);
  color: #FFF;
  border-color: transparent;
  font-weight: 600;
}

/* ---- Meal Type Tabs (segmented control) ---- */
.meal-type-tabs {
  display: flex;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 0.5px solid var(--border);
}

.meal-type-tab {
  flex: 1;
  text-align: center;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.25s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.meal-type-tab.active {
  background: var(--accent);
  color: #FFF;
  font-weight: 600;
}

.meal-type-tab + .meal-type-tab {
  border-left: 0.5px solid var(--border);
}

/* ============================================================
   CALENDAR — ancient lunar calendar feel
   ============================================================ */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 4px;
}

.calendar-header {
  text-align: center;
  font-weight: 600;
  font-size: 0.65rem;
  padding: 0.4rem 0;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.calendar-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: var(--font-display);
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  -webkit-tap-highlight-color: transparent;
}

.calendar-cell:active { background: var(--bg-elevated); }

.calendar-cell.other-month {
  color: var(--text-quaternary);
  opacity: 0.4;
}

.calendar-cell.today {
  color: var(--accent);
  font-weight: 700;
}

.calendar-cell.has-meals::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 4px rgba(74,144,217,0.3);
}

.calendar-cell.selected {
  background: var(--accent);
  color: #FFF;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(74,144,217,0.25);
}

.calendar-cell.selected.has-meals::after { background: #FFF; }

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.month-nav h3 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 700;
}

/* ============================================================
   PANTRY & SHOPPING ITEMS
   ============================================================ */
.pantry-item.low-stock {
  background: var(--warning-subtle);
}

.pantry-item.expiring {
  background: var(--danger-subtle);
}

.pantry-item.low-stock.expiring {
  background: var(--danger-subtle);
}

.shopping-item {
  cursor: pointer;
  user-select: none;
}

.shopping-item.purchased {
  opacity: 0.35;
}

.shopping-item.purchased .meal-info strong,
.shopping-item.purchased .meal-info small {
  text-decoration: line-through;
  text-decoration-color: var(--accent);
}

.shopping-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  margin-right: 0.5rem;
  cursor: pointer;
}

/* ============================================================
   INGREDIENT & STEP LISTS
   ============================================================ */
.ingredient-list {
  list-style: none;
  padding: 0;
}

.ingredient-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 0.5px solid var(--border-light);
  font-size: 0.83rem;
}

.ingredient-list li:last-child { border-bottom: none; }

.step-list {
  padding-left: 1.1rem;
}

.step-list li {
  margin-bottom: 0.55rem;
  line-height: 1.65;
  color: var(--text-secondary);
  font-size: 0.83rem;
}

.step-list li::marker {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-display);
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */
.upload-zone {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  margin-bottom: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-input);
  -webkit-tap-highlight-color: transparent;
}

.upload-zone:active {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

/* ============================================================
   DATE PICKER ROW
   ============================================================ */
.date-picker-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.date-picker-row input { flex: 1; }

.search-bar { margin-bottom: 0.75rem; }

/* ============================================================
   ADMIN STATS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 1rem;
}

.stat-card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  text-align: center;
}

.stat-card .stat-num {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1.1;
}

.stat-card .stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.15rem;
}

.stat-card.warning .stat-num { color: var(--warning); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30,27,22,0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  width: 100%;
  max-width: 300px;
  box-shadow: var(--shadow-elevated);
  border: 0.5px solid var(--border);
  animation: scaleIn 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.modal-card h4 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  text-align: center;
  letter-spacing: 0.03em;
}

/* ============================================================
   SECTION DIVIDERS
   ============================================================ */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-rule);
}

.section-header:first-child {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.section-header h4 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* ---- Meal Section ---- */
.meal-section { margin-bottom: 1rem; }

.meal-section h4 {
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.muted  { color: var(--text-muted); }
.accent { color: var(--accent); }
.warning { color: var(--warning); }
.text-sm { font-size: 0.76rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

.gap-sm { gap: 0.5rem; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 500px) {
  body {
    padding: 0;
    background: var(--bg-primary);
  }

  .phone-frame {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
    background-image: none;
  }

  .phone-screen {
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    background-image:
      repeating-linear-gradient(180deg, transparent, transparent 2px, rgba(139,126,106,0.02) 2px, rgba(139,126,106,0.02) 3px);
  }

  .dynamic-island { display: none; }
  .status-bar-time,
  .status-bar-icons { display: none; }
  .home-indicator { bottom: 6px; }
  #app { padding-top: 0; }
}

@media (min-width: 501px) and (max-width: 520px) {
  .phone-frame {
    width: 440px;
    border-radius: 44px;
    padding: 10px;
  }

  .phone-screen {
    width: 420px;
    height: 880px;
    border-radius: 35px;
  }

  .dynamic-island {
    width: 120px;
    height: 32px;
    top: 10px;
  }
}
