/* KodKlean CookBook — UI kit styles.
   Lifted from the Recipe App codebase (css/style.css + 01-dashboard.css).
   Tokens come from the house design system. */
/* tokens loaded separately via _ds/colors_and_type.css */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg-deep);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
  min-height: 100vh;
}
.tnum { font-variant-numeric: tabular-nums; font-family: var(--font-num); }

/* ---------- Shell ---------- */
.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 96px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(15,23,42,0.12);
}
.shell.is-dark { background: #0A1812; }

/* ---------- Header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 30;
  background: rgba(246,247,244,0.88);
  backdrop-filter: saturate(140%) blur(14px);
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 20px;
}
.hdr.on-dark { background: transparent; }
.hdr-back {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--text);
}
.hdr-back svg { width: 20px; height: 20px; }
.hdr-titles { flex: 1; min-width: 0; }
.hdr-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.on-dark .hdr-title { color: #fff; }
.hdr-sub { font-size: 13px; color: var(--muted); margin: 1px 0 0; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--border);
  font-size: 12px; font-weight: 600; color: var(--primary-ink);
  box-shadow: var(--shadow-xs);
}
.on-dark .status-pill { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.85); }
.status-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,0.18); }

.page { padding: 12px 20px 24px; }
.page.dash { padding: 12px 20px 24px; }

/* ---------- Bottom nav ---------- */
.nav {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 40;
  height: 68px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 26px;
  box-shadow: var(--shadow-nav);
  display: grid; grid-template-columns: repeat(6, 1fr);
  align-items: stretch; padding: 6px; gap: 1px;
}
.is-dark .nav { background: rgba(15,28,22,0.92); border-color: rgba(255,255,255,0.06); box-shadow: 0 10px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.05); }
.navtab {
  background: transparent; border: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); border-radius: 16px; min-height: 54px;
  transition: color .18s, background .18s, transform .12s;
}
.navtab:active { transform: scale(0.95); }
.navtab svg { width: 21px; height: 21px; }
.navtab .lbl { font-size: 10px; font-weight: 600; }
.navtab.active { background: var(--primary-soft); color: var(--primary-ink); }
.is-dark .navtab { color: rgba(255,255,255,0.42); }
.is-dark .navtab.active { background: linear-gradient(180deg, rgba(52,211,153,0.18), rgba(52,211,153,0.06)); color: #6EE7B7; }

/* ---------- Buttons ---------- */
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .06s, background .15s, border-color .15s;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 1px 2px rgba(15,86,32,.18), inset 0 -1px 0 rgba(0,0,0,.10); }
.btn-soft { background: var(--primary-soft); color: var(--primary-ink); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.input {
  width: 100%; min-height: 48px; padding: 0 14px; font-size: 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  outline: none; font-variant-numeric: tabular-nums; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,163,74,0.16); }
.search { position: relative; }
.search .input { padding-left: 42px; border-radius: 14px; }
.search .si { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search .si svg { width: 18px; height: 18px; }

/* ---------- Cards / badges ---------- */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-xs); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; background: #F1F2EE; color: var(--muted); }
.badge-green { background: var(--primary-soft); color: var(--primary-ink); }
.badge-yellow { background: var(--warning-soft); color: var(--warning-ink); }
.badge-red { background: var(--danger-soft); color: var(--danger-ink); }

.section-h { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 10px; }
.section-h h2 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.section-h .link { color: var(--primary-dark); font-size: 13px; font-weight: 600; background: none; border: 0; }

/* ---------- Chips ---------- */
.chip-row { display: flex; gap: 6px; overflow-x: auto; margin: 0 -20px 14px; padding: 2px 20px 6px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip { flex-shrink: 0; padding: 7px 13px; border-radius: var(--r-pill); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; border: 1px solid var(--border); }
.chip.active { background: var(--text); color: #fff; border-color: var(--text); }

/* ---------- Recipe list card ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.lcard { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-xs); transition: transform .08s, box-shadow .15s; }
.lcard:active { transform: scale(0.99); }
.lcard-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lcard-title { font-size: 15.5px; font-weight: 700; margin: 0 0 3px; letter-spacing: -0.01em; }
.lcard-sub { font-size: 12.5px; color: var(--muted); margin: 0; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.metric { display: flex; flex-direction: column; gap: 2px; }
.metric + .metric { border-left: 1px solid var(--border-soft); padding-left: 12px; }
.metric-label { font-size: 11px; color: var(--muted); font-weight: 500; }
.metric-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.metric-value.big { font-size: 18px; font-weight: 800; }
.metric-value.ok { color: var(--primary-ink); }
.metric-value.warn { color: var(--warning-ink); }

/* ============ DASHBOARD (dark premium) ============ */
.dash-shell {
  background:
    radial-gradient(60% 40% at 80% -10%, rgba(52,211,153,0.28) 0%, transparent 60%),
    radial-gradient(50% 35% at 10% 12%, rgba(167,139,250,0.18) 0%, transparent 70%),
    radial-gradient(70% 50% at 50% 110%, rgba(251,191,36,0.10) 0%, transparent 60%),
    #0A1812;
  color: #fff;
  min-height: 100vh;
}
.hero { display: flex; align-items: flex-start; gap: 14px; padding: 4px 0 14px; }
.hero-body { flex: 1; min-width: 0; }
.hero-eyebrow { display: inline-flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; color: rgba(167,243,208,0.85); margin-bottom: 8px; }
.hero-dot { width: 6px; height: 6px; border-radius: 50%; background: #34D399; box-shadow: 0 0 12px rgba(52,211,153,0.7); }
.hero-title { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 4px; line-height: 1.05; background: linear-gradient(180deg, #FFFFFF 0%, #D1FAE5 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-sub { font-size: 12.5px; margin: 0; color: rgba(255,255,255,0.55); }
.hero-sub strong { color: #34D399; font-weight: 700; }
.hero-btn { width: 44px; height: 44px; flex-shrink: 0; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.10); border-radius: 14px; color: rgba(255,255,255,0.85); display: inline-flex; align-items: center; justify-content: center; }
.hero-btn svg { width: 20px; height: 20px; }

.gp-banner { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: linear-gradient(135deg, rgba(16,185,129,0.16) 0%, rgba(16,185,129,0.04) 100%); border: 1px solid rgba(52,211,153,0.18); border-radius: 20px; margin-bottom: 18px; position: relative; overflow: hidden; color: #fff; }
.gp-ring { width: 58px; height: 58px; position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.gp-ring-num { position: absolute; inset: 0; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-num); font-size: 18px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.gp-ring-num span { font-size: 10px; opacity: 0.7; margin-left: 1px; }
.gp-body { flex: 1; min-width: 0; }
.gp-label { font-size: 12px; color: rgba(255,255,255,0.6); margin-bottom: 6px; font-weight: 500; }
.gp-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.gp-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gp-chip.good { background: rgba(52,211,153,0.16); color: #6EE7B7; }
.gp-chip.warn { background: rgba(251,191,36,0.16); color: #FCD34D; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.statc { position: relative; overflow: hidden; text-align: left; border: 0; cursor: pointer; padding: 14px 14px 13px; border-radius: 22px; min-height: 124px; display: flex; flex-direction: column; color: #fff; }
.statc-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.statc-icon { width: 38px; height: 38px; border-radius: 12px; background: rgba(0,0,0,0.22); display: inline-flex; align-items: center; justify-content: center; }
.statc-icon svg { width: 20px; height: 20px; }
.statc-value { font-family: var(--font-num); font-size: 38px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: rgba(255,255,255,0.96); text-shadow: 0 2px 12px rgba(0,0,0,0.25); }
.statc-label { font-size: 14.5px; font-weight: 700; color: #fff; margin: 6px 0 2px; }
.statc-sub { font-size: 11px; font-weight: 500; color: rgba(255,255,255,0.66); }
.statc-shine { position: absolute; top: -40%; left: -20%; width: 80%; height: 60%; background: radial-gradient(closest-side, rgba(255,255,255,0.18), transparent 70%); pointer-events: none; }
.statc.emerald { background: linear-gradient(135deg, #065F46 0%, #047857 55%, #10B981 100%); box-shadow: 0 10px 30px rgba(6,95,70,0.36), inset 0 1px 0 rgba(255,255,255,0.12); }
.statc.amber { background: linear-gradient(135deg, #7C2D12 0%, #9A3412 50%, #F59E0B 110%); box-shadow: 0 10px 30px rgba(124,45,18,0.36), inset 0 1px 0 rgba(255,255,255,0.12); }
.statc.rose { background: linear-gradient(135deg, #831843 0%, #9D174D 50%, #EC4899 110%); box-shadow: 0 10px 30px rgba(131,24,67,0.36), inset 0 1px 0 rgba(255,255,255,0.12); }
.statc.violet { background: linear-gradient(135deg, #4C1D95 0%, #5B21B6 50%, #8B5CF6 110%); box-shadow: 0 10px 30px rgba(76,29,149,0.36), inset 0 1px 0 rgba(255,255,255,0.12); }

.dsection-h { display: flex; align-items: flex-end; justify-content: space-between; margin: 0 4px 12px; }
.dsection-h h2 { font-size: 15.5px; font-weight: 700; margin: 0; color: #fff; }
.dsection-h p { font-size: 11.5px; margin: 2px 0 0; color: rgba(255,255,255,0.45); }
.dsection-link { background: transparent; border: 0; color: #6EE7B7; font-size: 12px; font-weight: 600; }

/* market mini rows */
.mkt-card { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 18px; padding: 6px 4px; margin-bottom: 22px; }
.mkt-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.mkt-row + .mkt-row { border-top: 1px solid rgba(255,255,255,0.05); }
.mkt-name { font-size: 13.5px; font-weight: 600; color: #fff; flex: 1; }
.mkt-spark { width: 72px; height: 26px; flex: none; }
.mkt-price { font-size: 14px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; font-family: var(--font-num); width: 52px; text-align: right; }
.mkt-delta { font-size: 11px; font-weight: 700; width: 50px; text-align: right; font-variant-numeric: tabular-nums; }
.mkt-delta.up { color: #FCA5A5; }
.mkt-delta.down { color: #6EE7B7; }

/* quick actions */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 22px; }
.qa { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); color: #fff; font-size: 13.5px; font-weight: 600; text-align: left; }
.qa-icon { width: 36px; height: 36px; border-radius: 11px; background: rgba(52,211,153,0.14); color: #6EE7B7; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.qa-icon svg { width: 18px; height: 18px; }

/* insight callout (dark) */
.insight { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 20px; background: linear-gradient(135deg, rgba(52,211,153,0.14), rgba(52,211,153,0.03)); border: 1px solid rgba(52,211,153,0.2); }
.insight-icon { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(180deg, #10B981, #047857); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: 0 4px 14px rgba(16,185,129,0.4); }
.insight-icon svg { width: 22px; height: 22px; }
.insight-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: #ECFDF5; }
.insight-desc { margin: 0; font-size: 12.5px; color: rgba(255,255,255,0.62); line-height: 1.5; }

/* ---------- Detail page ---------- */
.detail-hero { margin: -12px -20px 16px; padding: 24px 20px 20px; background: linear-gradient(150deg, var(--primary) 0%, var(--primary-deep) 100%); color: #fff; }
.detail-hero h1 { font-size: 24px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.02em; }
.detail-hero .sub { font-size: 13px; opacity: 0.85; }
.detail-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 16px; }
.macro { background: rgba(255,255,255,0.14); border-radius: 14px; padding: 10px 8px; text-align: center; }
.macro .v { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.macro .l { font-size: 10.5px; opacity: 0.8; margin-top: 2px; }
.ing-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border-soft); }
.ing-row:last-child { border-bottom: 0; }
.ing-dot { width: 30px; height: 30px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ing-dot svg { width: 16px; height: 16px; }
.ing-name { flex: 1; font-size: 14.5px; font-weight: 600; }
.ing-qty { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.step-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 9px 0; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-ink); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.step-text { font-size: 14px; line-height: 1.5; padding-top: 2px; }

/* ---------- Calculator tiles ---------- */
.calc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calc-tile { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 16px 14px; min-height: 128px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px; text-align: left; box-shadow: var(--shadow-xs); transition: transform .08s; }
.calc-tile:active { transform: scale(0.98); }
.calc-tile-icon { width: 38px; height: 38px; border-radius: 12px; background: var(--primary-soft); color: var(--primary-dark); display: inline-flex; align-items: center; justify-content: center; }
.calc-tile-icon svg { width: 20px; height: 20px; }
.calc-tile-icon.amber { background: var(--tint-amber); color: #B45309; }
.calc-tile-icon.blue { background: var(--tint-blue); color: #1D4ED8; }
.calc-tile-icon.violet { background: var(--tint-violet); color: #6D28D9; }
.calc-tile-name { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.calc-tile-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.calc-tile.featured { grid-column: 1 / -1; min-height: 90px; flex-direction: row; align-items: center; gap: 14px; background: radial-gradient(120% 140% at 100% 0%, rgba(22,163,74,0.12) 0%, rgba(22,163,74,0) 55%), linear-gradient(135deg, #F0FDF4 0%, #FFFFFF 60%); border-color: #BBF7D0; }
.calc-tile.featured .calc-tile-icon { width: 44px; height: 44px; background: linear-gradient(180deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,0.32); }
.calc-tile.featured .calc-tile-body { flex: 1; }
.calc-tile.featured .calc-tile-name { color: var(--primary-ink); }

.summary-panel { background: linear-gradient(180deg, var(--primary-soft) 0%, var(--surface) 100%); border: 1px solid #BBF7D0; border-radius: var(--r-md); padding: 14px 16px; margin-top: 14px; }
.summary-panel h4 { margin: 0 0 8px; font-size: 13px; color: var(--primary-ink); font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; font-variant-numeric: tabular-nums; }
.summary-grid .lbl { color: var(--muted); font-size: 12.5px; }
.summary-grid .val { text-align: right; font-weight: 700; font-size: 14px; }
