:root {
  --bg: oklch(98% 0.004 240);
  --surface: oklch(100% 0 0);
  --fg: oklch(20% 0.02 240);
  --muted: oklch(50% 0.018 240);
  --border: oklch(90% 0.006 240);
  --accent: oklch(56% 0.12 170);
  --accent-soft: color-mix(in oklch, var(--accent) 14%, transparent);
  --fg-soft: color-mix(in oklch, var(--fg) 6%, transparent);
  --warn: oklch(68% 0.14 70);
  --warn-soft: color-mix(in oklch, var(--warn) 16%, transparent);
  --danger: oklch(58% 0.16 25);
  --danger-soft: color-mix(in oklch, var(--danger) 14%, transparent);
  --ok: oklch(56% 0.12 155);
  --ok-soft: color-mix(in oklch, var(--ok) 14%, transparent);
  --font-display: "Avenir Next", "Söhne", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 72px;
  --shadow: 0 8px 28px color-mix(in oklch, var(--fg) 8%, transparent);
  --shadow-sm: 0 2px 10px color-mix(in oklch, var(--fg) 6%, transparent);
}
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.app {
  min-height: 100%;
  max-width: 430px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 8px);
}
.app.no-tab { padding-bottom: calc(16px + var(--safe-b)); }
.status-bar {
  height: 54px;
  padding: 14px 22px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status-bar .icons { display: flex; gap: 6px; align-items: center; opacity: 0.85; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 20px 12px;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.topbar .sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.icon-btn {
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  transition: background 0.15s ease, transform 0.05s ease;
}
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 18px; height: 18px; }
.pad { padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.card-flat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.eyebrow {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}
.h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.muted { color: var(--muted); }
.meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  color: var(--surface);
  box-shadow: 0 8px 20px color-mix(in oklch, var(--accent) 28%, transparent);
}
.btn-primary:hover { background: color-mix(in oklch, var(--accent) 88%, black); }
.btn-secondary {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid transparent;
}
.btn-block { width: 100%; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.warn { background: var(--warn-soft); color: color-mix(in oklch, var(--warn) 80%, black); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.neutral { background: var(--fg-soft); color: var(--muted); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 550;
  color: var(--fg);
  white-space: nowrap;
}
.chip.active {
  border-color: color-mix(in oklch, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
  color: color-mix(in oklch, var(--accent) 70%, black);
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  height: calc(var(--tab-h) + var(--safe-b));
  padding: 8px 10px calc(8px + var(--safe-b));
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 20;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 48px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: 12px;
}
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--accent); }
.plant-thumb {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  background:
    linear-gradient(135deg, var(--accent-soft), var(--fg-soft)),
    var(--surface);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.plant-thumb.lg {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-lg);
}
.plant-thumb.xl {
  width: 100%;
  height: 220px;
  border-radius: var(--radius-xl);
}
.ph {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  background:
    linear-gradient(145deg, var(--accent-soft), var(--fg-soft)),
    var(--surface);
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 10px;
}
.section-label h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.answer {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.answer-block {
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.answer-block h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.answer-block.core {
  background: var(--accent-soft);
  border-color: color-mix(in oklch, var(--accent) 22%, var(--border));
}
.answer-block.core h4 { color: color-mix(in oklch, var(--accent) 75%, black); }
.answer-block.warn-b {
  background: var(--warn-soft);
  border-color: color-mix(in oklch, var(--warn) 25%, var(--border));
}
.answer-block.warn-b h4 { color: color-mix(in oklch, var(--warn) 75%, black); }
.answer-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--fg);
}
.answer-block li { margin: 4px 0; }
.answer-block li strong { font-weight: 700; }
.answer-block p { margin: 0; }
.fab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.action-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
  min-height: 108px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.05s ease, border-color 0.15s ease;
}
.action-tile:active { transform: translateY(1px); }
.action-tile .mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.action-tile .mark svg { width: 18px; height: 18px; }
.action-tile h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.action-tile p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--fg-soft);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}
.input, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
.input:focus, .textarea:focus {
  border-color: var(--accent);
  outline: 3px solid var(--accent-soft);
}
.textarea { min-height: 88px; resize: none; line-height: 1.5; }
.composer {
  position: sticky;
  bottom: calc(var(--tab-h) + var(--safe-b));
  margin-top: 12px;
  padding: 10px 0 4px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.composer-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 8px;
  box-shadow: var(--shadow);
}
.composer-inner .textarea {
  border: 0;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 8px;
  outline: none;
  box-shadow: none;
}
.composer-inner .textarea:focus { outline: none; border: 0; }
.send-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent);
  color: var(--surface);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.send-btn svg { width: 18px; height: 18px; }
.bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
}
.bubble.user {
  margin-left: auto;
  background: var(--fg);
  color: var(--surface);
  border-bottom-right-radius: 6px;
}
.bubble.ai {
  margin-right: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  width: 100%;
  max-width: 100%;
}
.room-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 96px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-shadow: var(--shadow-sm);
}
.room-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 80% 20%, var(--accent-soft), transparent 55%),
    linear-gradient(160deg, var(--fg-soft), transparent 60%);
  pointer-events: none;
}
.room-card > * { position: relative; }
.divider { height: 1px; background: var(--border); border: 0; margin: 4px 0; }
.back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 8px;
}
.back-row .title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 40;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hidden { display: none !important; }
