:root {
  color-scheme: light;
  --page: #f4f0e9;
  --paper: rgba(255, 250, 243, .68);
  --glass: rgba(255, 255, 255, .48);
  --glass-strong: rgba(255, 255, 255, .66);
  --line: rgba(255, 255, 255, .72);
  --ink-1: #1f1710;
  --ink-2: #4a3f34;
  --ink-3: #82715f;
  --accent: #d9642a;
  --accent-2: #2e6b63;
  --accent-soft: rgba(217, 100, 42, .12);
  --amber-soft: rgba(192, 138, 62, .16);
  --up: #2f7a55;
  --down: #c0453c;
  --warn: #b77a16;
  --shadow: 0 14px 34px rgba(86, 52, 27, .12);
  --shadow-lg: 0 34px 88px -48px rgba(76, 45, 20, .42);
  --r: 22px;
  --r-sm: 14px;
  --nav-h: 74px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body {
  min-height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--ink-1);
  background:
    radial-gradient(220px 220px at 75% 4%, rgba(240, 177, 109, .52), transparent 70%),
    radial-gradient(280px 240px at 6% 18%, rgba(255, 255, 255, .52), transparent 68%),
    radial-gradient(260px 260px at 92% 84%, rgba(46, 107, 99, .14), transparent 70%),
    linear-gradient(145deg, #f7efe3 0%, #f4f0e9 48%, #eadccc 100%);
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; cursor: pointer; }
h1, h2, p { margin: 0; }
h1 { font-size: 25px; line-height: 1.18; letter-spacing: 0; }
h2 { font-size: 17px; line-height: 1.25; text-wrap: balance; }

.app-shell {
  width: min(100%, 480px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(var(--nav-h) + 22px + env(safe-area-inset-bottom));
  position: relative;
}
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, .25), transparent 32%),
    radial-gradient(160px 140px at 54% 12%, rgba(255, 255, 255, .28), transparent 70%);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 2px 14px;
  backdrop-filter: blur(14px);
}
main { position: relative; z-index: 2; }

.glass-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}
.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--accent);
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  font-size: 18px;
  font-weight: 850;
}
.icon-button.small { width: 38px; height: 38px; border-radius: 14px; box-shadow: none; }
.icon-button svg { width: 18px; height: 18px; display: block; }
.icon-button span { font-size: 13px; font-weight: 850; }

.install-banner, .offline-banner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, .62);
}
.install-banner[hidden], .offline-banner[hidden] { display: none; }
.install-banner strong, .offline-banner strong { display: block; font-size: 13px; color: var(--ink-1); }
.install-banner span, .offline-banner span { display: block; margin-top: 4px; font-size: 11px; font-weight: 650; color: var(--ink-3); }
.install-banner button {
  min-height: 38px;
  border: 0;
  border-radius: 15px;
  padding: 0 14px;
  color: #fffaf3;
  background: var(--accent);
  font-size: 13px;
  font-weight: 850;
}
.offline-banner { grid-template-columns: 82px 1fr; border-color: rgba(183, 122, 22, .24); background: rgba(255, 247, 233, .68); }

.view { display: none; gap: 14px; }
.view.active { display: grid; }
.view.slide-left { animation: slideLeft .18s ease-out; }
.view.slide-right { animation: slideRight .18s ease-out; }
@keyframes slideLeft { from { transform: translateX(22px); opacity: .72; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideRight { from { transform: translateX(-22px); opacity: .72; } to { transform: translateX(0); opacity: 1; } }

.hero-card {
  min-height: 148px;
  display: grid;
  grid-template-columns: 1fr 92px;
  gap: 14px;
  align-items: center;
  padding: 20px;
  background: linear-gradient(135deg, rgba(255, 244, 227, .72), rgba(217, 100, 42, .32)), var(--glass);
}
.card-label, .metric-label { display: block; color: var(--ink-3); font-size: 12px; font-weight: 750; }
.hero-number { display: flex; align-items: baseline; gap: 9px; margin-top: 8px; font-size: 34px; font-weight: 850; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-number small { color: var(--ink-2); font-size: 14px; font-weight: 800; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.soft-chip, .status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .70);
  border-radius: 999px;
  padding: 0 11px;
  color: #74421e;
  background: rgba(255, 255, 255, .42);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.status-pill { color: var(--accent); background: var(--accent-soft); }
.status-pill.warn { color: var(--warn); background: var(--amber-soft); }
.ring-meter { position: relative; display: grid; place-items: center; }
.ring-meter svg { width: 92px; height: 92px; transform: rotate(-90deg); }
.ring-base, .ring-value { fill: none; stroke-width: 10; }
.ring-base { stroke: rgba(255, 255, 255, .58); }
.ring-value { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 226; stroke-dashoffset: 174; transition: stroke-dashoffset .22s ease; }
.ring-meter strong { position: absolute; font-size: 16px; font-weight: 850; color: var(--ink-1); }

.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.metric-card { min-height: 104px; padding: 16px; }
.metric-card strong { display: block; margin-top: 9px; font-size: 28px; line-height: 1; font-weight: 850; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; margin-top: 8px; color: var(--ink-3); font-size: 11px; font-weight: 650; }
.section-card { padding: 18px; }
.compact-card { padding-bottom: 14px; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading.tight { margin-bottom: 12px; }
.section-heading p, .numbered-title p { margin-top: 5px; color: var(--ink-3); font-size: 12px; line-height: 1.45; font-weight: 550; text-wrap: pretty; }
.text-button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 850;
}

.alert-list, .purchase-list, .schedule-list, .mini-timeline, .order-list, .order-tabs { display: grid; gap: 10px; }
.alert-item, .purchase-item, .timeline-item, .schedule-item, .order-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  border-radius: 17px;
  padding: 12px;
  background: rgba(255, 255, 255, .36);
  border: 1px solid rgba(255, 255, 255, .54);
}
.timeline-item, .schedule-item {
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
}
.dot, .phase-tag {
  width: 46px;
  height: 46px;
  display: grid;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 15px;
  color: #fff9f2;
  background: linear-gradient(180deg, #bf8a2e 0%, #a97421 100%);
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 8px 16px rgba(76, 97, 140, .08);
  place-items: center;
}
.dot.warn, .phase-tag.warn { background: linear-gradient(180deg, #c99634 0%, #af7d23 100%); }
.dot.good, .phase-tag.good { background: linear-gradient(180deg, #4f8078 0%, #35695f 100%); }
.alert-item > div, .timeline-item > div, .schedule-item > div, .purchase-item > div, .order-item > div { min-width: 0; }
.alert-item strong, .timeline-item strong, .schedule-item strong, .purchase-item strong, .order-item strong { display: block; color: var(--ink-2); font-size: 13px; }
.alert-item > div > span, .timeline-item > div > span, .schedule-item > div > span, .purchase-item > div > span, .order-item > div > span { display: block; margin-top: 4px; color: var(--ink-3); font-size: 11px; font-weight: 600; line-height: 1.38; }
.timeline-item .meta, .schedule-item .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.timeline-item .meta b, .schedule-item .meta b { color: var(--accent); font-size: 11px; }
.timeline-item .meta span, .schedule-item .meta span { display: inline; margin-top: 0; color: var(--ink-3); font-size: 10px; font-weight: 650; line-height: 1.35; }

.order-item { width: 100%; border: 1px solid rgba(255, 255, 255, .54); text-align: left; }
.order-item.active { border-color: rgba(217, 100, 42, .38); background: rgba(217, 100, 42, .11); }
.order-item em { color: var(--accent); font-style: normal; font-size: 12px; font-weight: 850; white-space: nowrap; }
.order-name-field { margin-bottom: 12px; }
.order-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.order-actions button, .order-tabs button, .quick-grid button, .segmented-control button, .export-grid button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, .66);
  border-radius: 16px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, .38);
  font-weight: 850;
}
.order-actions button:last-child { color: var(--down); }
.order-tabs { grid-template-columns: 1fr 1fr; }
.scroll-tabs { display: flex; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x mandatory; }
.scroll-tabs button { min-width: 152px; scroll-snap-align: start; }
.order-tabs button { display: grid; align-content: center; text-align: left; padding: 9px 12px; min-height: 54px; }
.order-tabs button.active, .quick-grid button.active { color: var(--accent); border-color: rgba(217, 100, 42, .38); background: var(--accent-soft); }
.order-tabs button small, .quick-grid button small { margin-top: 4px; color: var(--ink-3); font-size: 10px; font-weight: 650; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-grid button { display: grid; align-content: center; text-align: left; padding: 10px 12px; }
.form-stack { display: grid; gap: 14px; }
.numbered-title { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; margin-bottom: 16px; }
.numbered-title > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-weight: 850; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: grid; gap: 7px; }
label.wide, .wide { grid-column: 1 / -1; }
label span { color: var(--ink-3); font-size: 12px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, .66);
  border-radius: var(--r-sm);
  padding: 0 12px;
  color: var(--ink-1);
  background: rgba(255, 255, 255, .40);
  outline: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
input:focus, select:focus { border-color: rgba(217, 100, 42, .55); box-shadow: 0 0 0 3px var(--accent-soft); }

.resource-strip { display: grid; gap: 10px; }
.resource-strip div, .resource-card, .cost-row {
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 17px;
  padding: 12px;
  background: rgba(255,255,255,.34);
}
.resource-strip span, .resource-card span { display: block; color: var(--ink-3); font-size: 11px; font-weight: 760; }
.resource-strip strong, .resource-card strong { display: block; margin-top: 5px; color: var(--ink-2); font-size: 13px; line-height: 1.35; }
.resource-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.resource-card strong { color: var(--accent); font-size: 18px; font-variant-numeric: tabular-nums; }
.resource-card small { display: block; margin-top: 5px; color: var(--ink-3); font-size: 10px; font-weight: 650; line-height: 1.35; }

.sticky-summary {
  position: sticky;
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, .66);
}
.sticky-summary span { display: block; color: var(--ink-3); font-size: 11px; font-weight: 700; }
.sticky-summary strong { display: block; margin-top: 4px; color: var(--ink-2); font-size: 13px; }
.primary-button { min-height: 44px; border: 0; border-radius: 17px; padding: 0 16px; color: #fffaf3; background: var(--accent); box-shadow: 0 14px 30px rgba(217, 100, 42, .28); font-weight: 850; }

.segmented-control { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; padding: 5px; border-radius: 18px; background: rgba(255,255,255,.28); border: 1px solid rgba(255,255,255,.48); }
.segmented-control button { min-height: 36px; border-radius: 14px; box-shadow: none; }
.segmented-control button.active { color: var(--accent); background: var(--accent-soft); border-color: rgba(217,100,42,.3); }
.segmented-control.allocation-mode { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented-control.allocation-mode button {
  min-height: 44px;
  font-size: 12px;
  font-weight: 850;
  color: var(--ink-2);
  background: rgba(255,255,255,.42);
}
.segmented-control.allocation-mode button.active {
  color: #d9642a;
  background: rgba(217,100,42,.14);
  border-color: rgba(217,100,42,.36);
  box-shadow: 0 10px 18px rgba(217,100,42,.10);
}
.progress-line { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .42); }
.progress-line span { display: block; width: 23%; height: 100%; border-radius: inherit; background: var(--accent); transition: width .22s ease; }
.timeline-item, .schedule-item {
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: start;
}
.timeline-item .dot, .schedule-item .phase-tag {
  width: 46px;
  height: 46px;
  align-self: start;
}
.timeline-item > div, .schedule-item > div { min-width: 0; }
.timeline-item .meta, .schedule-item .meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
.timeline-item .meta b, .schedule-item .meta b { color: var(--accent); font-size: 11px; }
.timeline-item .meta span, .schedule-item .meta span { display: inline; margin-top: 0; color: var(--ink-3); font-size: 10px; font-weight: 650; line-height: 1.35; }

.cost-hero { display: grid; gap: 18px; padding: 20px; background: linear-gradient(135deg, rgba(255, 244, 227, .72), rgba(46, 107, 99, .16)), var(--glass); }
.cost-hero strong { display: block; margin-top: 8px; font-size: 34px; line-height: 1; font-weight: 850; }
.cost-hero span { display: block; margin-top: 8px; color: var(--ink-3); font-size: 12px; font-weight: 700; }
.cost-bars { display: grid; gap: 12px; }
.cost-bars label { display: grid; grid-template-columns: 50px 1fr; align-items: center; gap: 10px; }
.cost-bars label span { color: var(--ink-2); }
.cost-bars i { display: block; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #e4a06e); }
.purchase-item { grid-template-columns: auto 1fr; }
.cost-breakdown { display: grid; gap: 10px; }
.cost-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cost-row span { display: grid; gap: 3px; color: var(--ink-2); font-size: 13px; font-weight: 800; }
.cost-row small { color: var(--ink-3); font-size: 10px; font-weight: 650; }
.cost-row strong { color: var(--accent); font-size: 14px; font-variant-numeric: tabular-nums; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.export-grid button { min-height: 48px; }

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 30;
  width: min(calc(100% - 28px), 452px);
  height: var(--nav-h);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 8px;
  background: rgba(255, 255, 255, .66);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px) saturate(140%);
}
.bottom-nav button { display: grid; place-items: center; gap: 3px; min-width: 0; border: 0; border-radius: 19px; color: var(--ink-3); background: transparent; font-size: 11px; font-weight: 800; }
.bottom-nav button span { font-size: 15px; line-height: 1; }
.bottom-nav button.active { color: var(--accent); background: var(--accent-soft); }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  align-items: end;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  background: rgba(36, 24, 16, .22);
  backdrop-filter: blur(8px);
}
.sheet-backdrop[hidden] { display: none; }
.output-sheet {
  width: min(100%, 452px);
  margin: 0 auto;
  padding: 10px 16px 18px;
  background: rgba(255,255,255,.76);
  animation: sheetIn .18s ease-out;
  max-height: min(88dvh, 820px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
@keyframes sheetIn { from { transform: translateY(24px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 42px; height: 5px; border-radius: 99px; margin: 2px auto 14px; background: rgba(130,113,95,.32); }
.sheet-grid { grid-template-columns: 1fr 1fr; }
.sheet-grid button { min-height: 52px; text-align: center; }
.export-note {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 247, 233, .82);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 650;
}
.export-log {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.export-log-item, .export-log-empty {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.58);
  background: rgba(255,255,255,.34);
}
.export-log-item strong {
  display: block;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.35;
}
.export-log-item span, .export-log-empty {
  display: block;
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.4;
  font-weight: 650;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: min(360px, calc(100% - 36px));
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
  color: var(--ink-1);
  background: rgba(255, 255, 255, .76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  font-size: 13px;
  font-weight: 750;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 360px) {
  .app-shell { padding-inline: 12px; }
  .field-grid, .metric-grid, .resource-grid { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr; }
  .ring-meter { justify-self: start; }
  .export-grid { grid-template-columns: 1fr 1fr; }
}

@media print {
  body { background: #f8f6f2; }
  .topbar, .bottom-nav, .sticky-summary, .install-banner, .offline-banner, .sheet-backdrop { display: none !important; }
  .app-shell { width: 100%; max-width: none; padding: 12px; }
  .view { display: grid !important; break-after: page; }
  .glass-card { background: rgba(255,255,255,.8); box-shadow: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.result-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.result-card, .summary-card, .analysis-card, .ingredient-card, .day-card {
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 17px;
  padding: 14px;
  background: rgba(255,255,255,.34);
}
.result-card strong { display: block; margin-top: 8px; color: var(--accent); font-size: 18px; font-weight: 850; line-height: 1.15; }
.result-card p { margin-top: 8px; color: var(--ink-3); font-size: 11px; line-height: 1.45; font-weight: 650; }
.result-card.warn strong { color: var(--warn); }
.result-eyebrow { display: block; color: var(--ink-3); font-size: 11px; font-weight: 800; }

.detail-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(88px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scroll-snap-type: x mandatory;
}
.detail-tabs button {
  min-height: 42px;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 16px;
  color: var(--ink-2);
  background: rgba(255,255,255,.38);
  font-weight: 850;
  scroll-snap-align: start;
}
.detail-tabs button.active {
  color: var(--accent);
  border-color: rgba(217, 100, 42, .38);
  background: var(--accent-soft);
}
.detail-panel { display: none; gap: 12px; }
.detail-panel.active { display: grid; }
.detail-panel.slide-left { animation: slideLeft .18s ease-out; }
.detail-panel.slide-right { animation: slideRight .18s ease-out; }

.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tool-grid button {
  min-height: 50px;
  border: 1px solid rgba(255,255,255,.66);
  border-radius: 16px;
  color: var(--ink-2);
  background: rgba(255,255,255,.38);
  font-weight: 850;
}

.day-card { display: grid; gap: 10px; }
.day-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.day-head strong { display: block; color: var(--ink-1); font-size: 14px; font-weight: 850; }
.day-head span { display: block; margin-top: 3px; color: var(--ink-3); font-size: 11px; font-weight: 650; }
.day-card h3 { color: var(--ink-2); font-size: 15px; line-height: 1.3; }
.day-card p { color: var(--ink-3); font-size: 12px; line-height: 1.45; }
.day-chip-row { margin-top: 2px; }
.day-foot { display: flex; flex-direction: column; gap: 4px; }
.day-foot small { color: var(--ink-2); font-size: 11px; font-weight: 760; }
.day-foot span { color: var(--ink-3); font-size: 10px; font-weight: 650; line-height: 1.35; }

.summary-grid, .analysis-grid, .ingredient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.summary-card span, .analysis-card span, .ingredient-card span { display: block; color: var(--ink-3); font-size: 11px; font-weight: 760; }
.summary-card strong, .analysis-card strong, .ingredient-card strong { display: block; margin-top: 5px; color: var(--accent); font-size: 18px; font-weight: 850; line-height: 1.15; }
.summary-card small, .analysis-card small, .ingredient-card small { display: block; margin-top: 6px; color: var(--ink-3); font-size: 10px; line-height: 1.4; font-weight: 650; }
.summary-card em, .ingredient-card em { display: block; margin-top: 6px; color: var(--ink-2); font-size: 10px; font-style: normal; font-weight: 750; line-height: 1.4; }
.summary-strip { margin-top: 12px; }
.analysis-grid { margin-bottom: 12px; }
.analysis-card strong { font-size: 19px; }

.feasibility-card { display: grid; gap: 12px; }
.feasibility-grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.feasibility-item {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.34);
}
.feasibility-item.good { border-color: rgba(46,107,99,.18); }
.feasibility-item.warn { border-color: rgba(183,122,22,.20); }
.feasibility-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255,255,255,.58);
  font-size: 10px;
  font-weight: 850;
}
.feasibility-item.good .feasibility-badge { color: #2e6b63; background: rgba(46, 107, 99, .12); }
.feasibility-item.warn .feasibility-badge { color: #b77a16; background: rgba(183, 122, 22, .14); }
.feasibility-item strong { color: var(--ink-1); font-size: 13px; line-height: 1.35; }
.feasibility-item small { color: var(--ink-3); font-size: 10px; line-height: 1.45; font-weight: 650; }

@media (max-width: 420px) {
  .result-grid, .summary-grid, .analysis-grid, .ingredient-grid { grid-template-columns: 1fr; }
  .feasibility-grid { grid-template-columns: 1fr; }
  .tool-grid { grid-template-columns: 1fr 1fr; }
  .detail-tabs { grid-template-columns: repeat(5, minmax(80px, 1fr)); }
}

/* Layout and control fixes */
.topbar {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.topbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.topbar-subtitle {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, .68);
  border-radius: 20px;
  background: rgba(250, 252, 255, .68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(136%);
}
.topbar-actions .icon-button {
  width: 58px;
  height: 58px;
  padding: 7px 8px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(242, 247, 255, .86));
  box-shadow: 0 12px 24px rgba(76, 97, 140, .14);
}
.topbar-actions .icon-button.small {
  width: 58px;
  height: 58px;
}
.topbar-actions .icon-button svg {
  width: 18px;
  height: 18px;
  margin-top: 1px;
}
.topbar-actions .icon-button span {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 800;
}
.topbar-orderbar {
  display: grid;
  gap: 8px;
}
.order-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.order-nav .scroll-tabs {
  flex: 1;
  min-width: 0;
}
.order-nav .icon-button.small {
  flex: 0 0 auto;
}
.topbar-order-label {
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 750;
}
.global-order-tabs {
  gap: 8px;
}
.global-order-tabs button {
  min-width: 118px;
  text-align: center;
}
.icon-button {
  display: grid;
  place-items: center;
  gap: 2px;
  text-align: center;
  line-height: 1;
  padding: 8px 11px;
  color: var(--ink-1);
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(240,245,255,.82));
  border: 1px solid rgba(122, 141, 183, .18);
  box-shadow: 0 10px 22px rgba(76, 97, 140, .12);
}
.icon-button svg {
  width: 17px;
  height: 17px;
  display: block;
}
.icon-button span {
  display: block;
  line-height: 1;
  transform: none;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.icon-button.small {
  width: 58px;
  height: 58px;
  border-radius: 18px;
}
.icon-button.small span {
  font-size: 11px;
}
.order-tabs button,
.quick-grid button,
.tool-grid button,
.export-grid button,
.segmented-control button {
  justify-items: center;
  text-align: center;
}
.order-tabs button,
.quick-grid button,
.tool-grid button {
  align-content: center;
}
.order-tabs button small,
.quick-grid button small {
  display: block;
  text-align: center;
}
.resource-actions,
.sheet-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.resource-actions p,
.sheet-actions p {
  margin: 0;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  font-weight: 650;
}
.resource-actions .primary-button,
.sheet-actions .primary-button {
  width: 100%;
}
.compact-resource {
  margin-top: 10px;
}
.resource-sheet-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.resource-sheet-grid {
  margin-top: 8px;
}
.resource-sheet-summary .resource-strip {
  margin-top: 0;
}
.resource-sheet-summary .resource-strip strong {
  word-break: break-word;
}
.resource-warning {
  border: 1px solid rgba(192, 138, 62, .18);
  border-radius: 17px;
  padding: 12px;
  background: rgba(255, 247, 233, .7);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 650;
}
.resource-warning strong {
  display: block;
  margin-bottom: 4px;
  color: var(--warn);
  font-size: 13px;
}
.resource-card small {
  line-height: 1.45;
}
.resource-card.warn strong {
  color: var(--warn);
}
.view,
.detail-panel {
  transition: opacity .22s cubic-bezier(.16,1,.3,1), transform .22s cubic-bezier(.16,1,.3,1);
}
.view.slide-left,
.detail-panel.slide-left {
  animation-duration: .22s;
}
.view.slide-right,
.detail-panel.slide-right {
  animation-duration: .22s;
}
#mainContent {
  touch-action: pan-y;
}
@media (max-width: 420px) {
  .topbar-head {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-actions {
    justify-content: flex-end;
    width: fit-content;
    align-self: flex-end;
  }
  .topbar-actions .icon-button {
    min-width: 54px;
    padding-inline: 9px;
  }
  .global-order-tabs button {
    min-width: 104px;
  }
  .resource-actions .primary-button,
  .sheet-actions .primary-button {
    min-height: 46px;
  }
}
