/* ==========================================================================
   Precision Irrigation Dashboard — plain CSS
   Light / dark theme, responsive sidebar shell, cards, tables and charts.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f8fafc;
  --bg-soft: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --accent: #047857;
  --accent-strong: #065f46;
  --accent-bright: #10b981;
  --accent-soft: #ecfdf5;
  --accent-border: #a7f3d0;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --red-border: #fecaca;
  --blue: #1d4ed8;
  --blue-soft: #eff6ff;
  --blue-border: #bfdbfe;
  --purple: #7e22ce;
  --purple-soft: #faf5ff;
  --purple-border: #e9d5ff;
  --sky: #0369a1;
  --sky-soft: #f0f9ff;
  --sky-border: #bae6fd;

  --sidebar-w: 280px;
  --sidebar-w-collapsed: 84px;
  --radius: 16px;
  --radius-lg: 20px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", "Inter", system-ui, sans-serif;
}

html.dark {
  --bg: #0b0e14;
  --bg-soft: #11151d;
  --surface: #0f172a;
  --surface-2: #131a28;
  --surface-3: #1e293b;
  --text: #f1f5f9;
  --text-soft: #e2e8f0;
  --muted: #94a3b8;
  --muted-2: #64748b;
  --border: #1e293b;
  --border-strong: #334155;

  --accent: #34d399;
  --accent-strong: #6ee7b7;
  --accent-bright: #34d399;
  --accent-soft: rgba(16, 185, 129, 0.1);
  --accent-border: rgba(52, 211, 153, 0.32);

  --amber: #fbbf24;
  --amber-soft: rgba(245, 158, 11, 0.1);
  --amber-border: rgba(245, 158, 11, 0.3);
  --red: #f87171;
  --red-soft: rgba(239, 68, 68, 0.12);
  --red-border: rgba(239, 68, 68, 0.3);
  --blue: #93c5fd;
  --blue-soft: rgba(59, 130, 246, 0.12);
  --blue-border: rgba(59, 130, 246, 0.3);
  --purple: #d8b4fe;
  --purple-soft: rgba(168, 85, 247, 0.12);
  --purple-border: rgba(168, 85, 247, 0.3);
  --sky: #7dd3fc;
  --sky-soft: rgba(14, 165, 233, 0.12);
  --sky-border: rgba(14, 165, 233, 0.3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
::selection { background: rgba(16, 185, 129, 0.2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, 0.28); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, 0.45); }
* { scrollbar-width: thin; scrollbar-color: rgba(100, 116, 139, 0.28) transparent; }

/* ---------- Shell ---------- */
.sidebar {
  position: fixed;
  z-index: 40;
  top: 12px; left: 12px; bottom: 12px;
  width: var(--sidebar-w);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.25s ease;
  overflow: hidden;
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 10px 8px; }
.brand-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: #14532d; color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
}
.brand-text { min-width: 0; white-space: nowrap; transition: opacity 0.18s ease; }
.brand-text strong { display: block; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.sidebar-rule { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px; font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 650; box-shadow: inset 0 0 0 1px var(--accent-border); }
html.dark .nav-link.is-active { color: #a7f3d0; }
.nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-link .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-link .nav-dot { margin-left: auto; width: 6px; height: 6px; border-radius: 99px; background: var(--accent-bright); }
.nav-link:not(.is-active) .nav-dot { display: none; }
.sidebar-footer { padding-top: 8px; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.theme-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text-soft);
  font-size: 12px; font-weight: 550;
}
.theme-btn:hover { background: var(--surface-3); }
.theme-btn .theme-left { display: flex; align-items: center; gap: 9px; }
.theme-btn svg { width: 16px; height: 16px; }
.theme-switch { width: 28px; height: 16px; padding: 2px; border-radius: 99px; background: var(--border-strong); transition: background-color 0.2s ease; }
.theme-switch::after { content: ""; display: block; width: 12px; height: 12px; border-radius: 99px; background: #fff; transition: transform 0.2s ease; }
html.dark .theme-switch { background: var(--accent-bright); }
html.dark .theme-switch::after { transform: translateX(12px); }

body.sidebar-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-dot,
body.sidebar-collapsed .theme-btn .theme-label,
body.sidebar-collapsed .theme-switch { display: none; }
body.sidebar-collapsed .nav-link { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .theme-btn { justify-content: center; padding-inline: 0; }
body.sidebar-collapsed .sidebar-brand { flex-direction: column; justify-content: center; gap: 8px; }
body.sidebar-collapsed .sidebar-brand .icon-btn { transform: rotate(180deg); }

.page-main {
  min-height: 100vh;
  margin-left: calc(var(--sidebar-w) + 24px);
  padding: 24px;
  transition: margin-left 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
body.sidebar-collapsed .page-main { margin-left: calc(var(--sidebar-w-collapsed) + 24px); }
.page { width: 100%; max-width: 1200px; margin: 0 auto; }
.page.narrow { max-width: 900px; }
.page.wide { max-width: 1440px; }
.stack { display: flex; flex-direction: column; gap: 24px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 32px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.row-start { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.mobile-bar { display: none; }
.mobile-menu-btn {
  position: fixed; z-index: 50; top: 16px; left: 16px;
  width: 40px; height: 40px;
  display: none; place-items: center;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm);
}
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 35;
  background: rgba(2, 6, 23, 0.45); backdrop-filter: blur(4px);
}

/* ---------- Typography ---------- */
.eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--accent);
}
.eyebrow.purple { color: var(--purple); }
.eyebrow.amber { color: var(--amber); }
h1, .h1 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h2, .h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -0.015em; }
h3, .h3 { font-size: 1rem; font-weight: 650; }
.lead { font-size: 0.95rem; color: var(--muted); max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 650; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono-sm { font-family: ui-monospace, Menlo, monospace; font-size: 11px; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card.lg { padding: 24px; border-radius: var(--radius-lg); }
.card.sm { padding: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.soft { background: var(--surface-2); }
.card.hover:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transition: 0.2s ease; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.card-title { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.01em; }
.card-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-full { grid-column: 1 / -1; }

.kpi { position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--accent-bright); }
.kpi.amber::before { background: #f59e0b; }
.kpi.sky::before { background: #0ea5e9; }
.kpi.slate::before { background: #94a3b8; }
.kpi .kpi-label { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpi .kpi-value { margin-top: 6px; font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; }
.kpi .kpi-sub { margin-top: 3px; font-size: 11px; color: var(--muted); }

.stat { text-align: center; }
.stat .stat-value { font-size: 1.9rem; font-weight: 700; color: var(--accent); line-height: 1.1; }
.stat .stat-label { margin-top: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 8px 13px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface); color: var(--text-soft);
  font-size: 12px; font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent-strong); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent); border-color: transparent; }
html.dark .btn-primary { background: #059669; color: #fff; }
html.dark .btn-primary:hover { background: #10b981; }
.btn-amber { background: #d97706; border-color: transparent; color: #fff; }
.btn-amber:hover { background: #b45309; }
.btn-danger { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { min-height: 30px; padding: 5px 9px; font-size: 11px; border-radius: 9px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-group { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 12px; }
.btn-group > button { min-height: 30px; padding: 5px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; white-space: nowrap; }
.btn-group > button:hover { color: var(--text); }
.btn-group > button.is-active { background: var(--surface); box-shadow: var(--shadow-sm); color: var(--text); }
html.dark .btn-group > button.is-active { background: var(--border-strong); }

/* ---------- Forms ---------- */
.select, .input {
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  font-size: 12px; font-weight: 500;
}
.select:focus, .input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
label.field .select { text-transform: none; letter-spacing: 0; font-size: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 8px; background: var(--surface-3); font-size: 11px; font-weight: 550; color: var(--text-soft); cursor: pointer; }
.check input { accent-color: #10b981; }
input[type="range"] { accent-color: #10b981; width: 100%; }
.slider-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 550; color: var(--text-soft); }
.slider-label b { color: var(--accent); font-weight: 650; }
.slider-wrap { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Badges / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border: 1px solid transparent; border-radius: 99px;
  font-size: 10px; font-weight: 650; line-height: 1.5;
  white-space: nowrap;
}
.badge.green { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.badge.amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.badge.red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.badge.blue { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue); }
.badge.purple { background: var(--purple-soft); border-color: var(--purple-border); color: var(--purple); }
.badge.sky { background: var(--sky-soft); border-color: var(--sky-border); color: var(--sky); }
.badge.slate { background: var(--surface-3); border-color: var(--border); color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 99px; background: currentColor; flex: 0 0 6px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 11px; font-weight: 600; color: var(--muted);
}

/* ---------- Callouts ---------- */
.callout { padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: 12px; color: var(--text-soft); }
.callout.amber { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber); }
.callout.red { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.callout.blue { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue); }
.callout.green { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.callout ul { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.callout li { display: flex; gap: 8px; }
.callout li::before { content: "•"; color: currentColor; opacity: 0.7; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.table-wrap.flush { border: 0; border-radius: 0; }
table.data { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; }
table.data th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 12px;
  background: var(--surface-3); color: var(--muted);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  white-space: nowrap;
}
table.data td { padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text-soft); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.is-selected { background: var(--accent-soft); }
table.data tr.is-selected td { color: var(--accent-strong); font-weight: 600; }
.table-empty { padding: 20px; text-align: center; font-size: 12px; color: var(--muted-2); }
.min-w-720 { min-width: 720px; }

/* ---------- Progress bars / rings ---------- */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent-bright), var(--accent-strong)); transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1); }
.bar.amber > span { background: linear-gradient(90deg, #fbbf24, #d97706); }
.bar-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 6px; }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.ring .ring-value { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.ring .ring-label { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; min-height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); }
.chart .axis-line { stroke: var(--border-strong); stroke-width: 1; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .series-line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .series-area { stroke: none; }
.chart .bar-rect { transition: opacity 0.15s ease; }
.chart .bar-rect:hover { opacity: 0.75; }
.chart .ref-line { stroke: #ef4444; stroke-dasharray: 4 4; stroke-width: 1.4; }
.chart .axis-label { font-size: 10px; font-weight: 600; text-anchor: middle; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; font-size: 10px; color: var(--muted); }
.chart .legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart .legend i { width: 14px; height: 2px; border-radius: 2px; font-style: normal; }
.chart-tooltip {
  position: fixed; z-index: 80; pointer-events: none;
  padding: 6px 9px; border-radius: 8px;
  background: rgba(15, 23, 42, 0.94); color: #f8fafc;
  font-size: 11px; line-height: 1.45; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  opacity: 0; transform: translate(-50%, -110%); transition: opacity 0.1s ease;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip b { color: #a7f3d0; }
.theme-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--muted); }
.theme-legend span { display: inline-flex; align-items: center; gap: 6px; }
.theme-legend i { width: 12px; height: 12px; border-radius: 3px; font-style: normal; }

/* ---------- Collapse / helper ---------- */
details.disclosure { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); padding: 10px 12px; }
details.disclosure > summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-soft); }
details.disclosure[open] > summary { margin-bottom: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- Home ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.page-header h1 { margin-top: 4px; font-size: 1.25rem; }
.page-header p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.hero-note { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.metric-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.metric span { display: block; font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.metric b { display: block; margin-top: 4px; font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }

/* ---------- Farmer ---------- */
.farmer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plot-card { padding: 0; overflow: hidden; }
.plot-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.plot-top.needs-water { background: var(--amber-soft); }
.plot-top.ok { background: var(--accent-soft); }
.plot-top h3 { text-transform: capitalize; font-size: 1.05rem; }
.plot-top p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px; color: #fff; font-size: 12px; font-weight: 700; background: #059669; }
.status-pill.warn { background: #d97706; }
.status-pill svg { width: 15px; height: 15px; }
.plot-body { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 22px; }
.readings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.reading { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.reading span { display: block; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.reading b { display: block; margin-top: 2px; font-size: 1rem; font-weight: 650; }
.reading.green b { color: var(--accent); }
.reading.amber b { color: var(--amber); }
.amount-box { padding: 13px 15px; border: 1px solid var(--amber-border); border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }
.amount-box b { font-size: 1.2rem; }

/* ---------- Simulator ---------- */
.sim-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 22px; align-items: start; }
.sim-panel { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.sim-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sim-fields .full { grid-column: 1 / -1; }
.sim-result { padding: 22px; border-radius: var(--radius); color: #fff; background: #047857; }
.sim-result.warn { background: #d97706; }
.sim-result .sim-prob { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.sim-result .cutoff { text-align: right; }
.sim-result .meter { position: relative; width: 110px; height: 8px; margin-top: 6px; border-radius: 99px; background: rgba(255, 255, 255, 0.3); }
.sim-result .meter > i { display: block; height: 100%; border-radius: 99px; background: #fff; }
.sim-result .meter::after { content: ""; position: absolute; top: -2px; bottom: -2px; left: 50%; width: 1px; background: rgba(255, 255, 255, 0.9); }
.sim-note { color: rgba(255, 255, 255, 0.8); font-size: 12px; }

/* ---------- Docs ---------- */
.doc-section { display: flex; gap: 14px; align-items: flex-start; }
.doc-icon { font-size: 24px; line-height: 1.1; }
.doc-models, .doc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.doc-tile { padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.doc-tile b { display: block; font-size: 12px; }
.doc-tile p { margin-top: 4px; font-size: 11px; color: var(--muted); }
.doc-tile .why { margin-top: 6px; color: var(--accent); font-weight: 550; }
.doc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.doc-list li { display: flex; gap: 9px; font-size: 12px; color: var(--text-soft); }
.doc-list li::before { content: ""; width: 6px; height: 6px; margin-top: 7px; border-radius: 99px; background: var(--accent-bright); flex: 0 0 6px; }
.doc-steps { counter-reset: step; }
.doc-steps li { display: flex; gap: 10px; font-size: 12px; color: var(--text-soft); }
.doc-steps li::before { counter-increment: step; content: counter(step); width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 11px; }
.glossary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.glossary .doc-tile b { color: var(--accent); }

/* ---------- Progress ---------- */
.phase-card { display: flex; flex-direction: column; height: 100%; }
.phase-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.phase-id { display: flex; align-items: center; gap: 11px; min-width: 0; }
.phase-icon { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; background: var(--accent-soft); font-size: 20px; }
.phase-id h3 { font-size: 14px; }
.phase-id p { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.phase-detail { margin-top: 14px; font-size: 12px; color: var(--text-soft); flex: 1; }
.phase-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.phase-metrics div { padding: 8px 6px; border: 1px solid var(--border); border-radius: 10px; text-align: center; background: var(--surface-2); }
.phase-metrics b { display: block; font-size: 12px; }
.phase-metrics span { display: block; font-size: 9px; color: var(--muted); }
.overall-grid { grid-template-columns: 1fr 2fr; }
.active-phase { display: flex; align-items: center; gap: 12px; }
.active-icon { position: relative; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: #f59e0b; color: #fff; font-size: 23px; }
.active-icon::after { content: ""; position: absolute; top: -2px; right: -2px; width: 11px; height: 11px; border-radius: 99px; background: #fbbf24; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.55; transform: scale(0.9); } }
.next-list { display: flex; flex-direction: column; gap: 10px; }
.next-item { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.next-item span { font-size: 19px; }
.next-item b { display: block; font-size: 12px; }
.next-item p { font-size: 11px; color: var(--muted); }

/* ---------- Research deck ---------- */
.page-main.deck-main { padding: 0; }
.deck-page { height: calc(100dvh - 48px); min-height: 560px; display: flex; flex-direction: column; overflow: hidden; }
.deck-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60; background: rgba(226, 232, 240, 0.55); }
.deck-progress > i { display: block; height: 100%; background: var(--accent); transition: width 0.45s ease; }
.deck-counter { position: fixed; top: 14px; right: 24px; z-index: 55; padding: 5px 11px; border: 1px solid var(--accent-border); border-radius: 99px; background: var(--surface); color: var(--accent); font-size: 11px; font-weight: 600; box-shadow: var(--shadow-sm); }
.deck-banner { position: fixed; top: 14px; left: calc(var(--sidebar-w) + 70px); z-index: 55; max-width: min(30rem, calc(100vw - 26rem)); padding: 7px 11px; border: 1px solid var(--accent-border); border-radius: 11px; background: var(--surface); color: var(--accent); font-size: 10.5px; box-shadow: var(--shadow-sm); }
body.sidebar-collapsed .deck-banner { left: calc(var(--sidebar-w-collapsed) + 70px); }
.deck-present { position: fixed; top: 54px; right: 24px; z-index: 55; }
.deck-scroll { flex: 1; overflow-y: auto; scroll-snap-type: y mandatory; scroll-behavior: smooth; padding-top: 32px; }
.deck-track { width: 100%; max-width: 1000px; margin: 0 auto; }
.deck-slide { min-height: calc(100dvh - 6rem); display: flex; align-items: center; padding: 16px 20px 40px; scroll-snap-align: start; }
.deck-card { width: 100%; border-radius: 24px; padding: 28px 34px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.deck-card.hero { border-color: var(--accent-border); }
.deck-title { text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52vh; }
.deck-title .tag { display: inline-flex; align-items: center; gap: 7px; padding: 5px 14px; border-radius: 99px; background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-strong); font-size: 11px; font-weight: 650; }
.deck-title h2 { margin-top: 18px; font-size: clamp(1.8rem, 4.4vw, 3rem); line-height: 1.12; letter-spacing: -0.03em; }
.deck-title p { margin-top: 14px; max-width: 62ch; color: var(--muted); font-size: clamp(0.9rem, 1.5vw, 1.05rem); }
.deck-sources { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 22px; }
.deck-sources span { padding: 4px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.deck-content h2 { font-size: clamp(1.35rem, 2.6vw, 1.9rem); margin-bottom: 18px; }
.deck-content h2 .eyebrow { display: block; margin-bottom: 4px; }
.deck-block { display: flex; gap: 13px; margin-bottom: 14px; }
.deck-block::before { content: ""; width: 7px; height: 7px; margin-top: 7px; flex: 0 0 7px; border-radius: 99px; background: var(--accent-bright); }
.deck-block b { display: block; font-size: 13px; }
.deck-block p { margin-top: 2px; font-size: 12px; color: var(--muted); }
.deck-block ul { margin-top: 5px; display: flex; flex-direction: column; gap: 4px; }
.deck-block li { display: flex; gap: 7px; font-size: 11px; color: var(--muted); }
.deck-block li::before { content: "•"; color: var(--accent); }
.deck-pillars, .deck-highlights { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.deck-pillar { padding: 14px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface-2); text-align: center; }
.deck-pillar span { font-size: 22px; }
.deck-pillar b { display: block; margin-top: 4px; font-size: 12px; }
.deck-pillar p { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.deck-flow { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; margin-bottom: 16px; }
.deck-flow span { padding: 7px 12px; border: 1px solid var(--accent-border); border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 600; }
.deck-flow i { color: var(--accent); font-style: normal; }
.deck-layers { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.deck-layer { display: flex; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.deck-layer .n { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.deck-layer b { font-size: 12px; }
.deck-layer p { font-size: 10.5px; color: var(--muted); }
.deck-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.deck-column { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); }
.deck-column h3 { font-size: 12px; margin-bottom: 8px; }
.deck-column li { display: flex; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.deck-column li::before { content: ""; width: 4px; height: 4px; margin-top: 7px; flex: 0 0 4px; border-radius: 99px; background: var(--accent); }
.deck-grid-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.deck-note { margin-top: 14px; padding: 11px 14px; border: 1px solid var(--amber-border); border-radius: 10px; background: var(--amber-soft); color: var(--amber); font-size: 11px; }
.deck-table { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; }
.deck-table table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: 11.5px; }
.deck-table th { padding: 9px 12px; background: var(--surface-3); color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; text-align: left; }
.deck-table td { padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text-soft); }
.deck-subitems { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.deck-subitems div { padding: 11px 13px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); font-size: 11px; }
.deck-sources-list { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; font-size: 11px; }
.deck-sources-list summary { cursor: pointer; font-weight: 600; color: var(--text-soft); }
.deck-sources-list ul { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; padding-left: 16px; list-style: disc; color: var(--muted); }
.deck-sources-list a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.deck-footer { padding: 24px 0 40px; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- Scenarios ---------- */
.scenario-chart { height: 230px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.scenario-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

/* ---------- Visualization ---------- */
.viz-header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.viz-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.steps { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step { display: flex; align-items: center; gap: 10px; flex: 1 1 200px; cursor: pointer; }
.step-n { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: var(--surface-3); color: var(--muted-2); font-size: 12px; font-weight: 700; }
.step.is-active .step-n { background: var(--accent-strong); color: #fff; box-shadow: 0 0 16px rgba(16, 185, 129, 0.35); }
.step.is-done .step-n { background: var(--accent-soft); color: var(--accent); }
.step b { display: block; font-size: 12px; }
.step p { font-size: 10.5px; color: var(--muted); }
.step-arrow { color: var(--muted-2); }
.viz-schematic { padding: 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.viz-svg { width: 100%; height: auto; }
.viz-svg .link-path { animation: dash 1.2s linear infinite; }
.viz-svg[data-phase="collect"] .sensor-group.is-active .sensor-pulse { stroke: #10b981; opacity: 0.95; }
.viz-svg[data-phase="process"] .nn-node { animation: nn-pulse 0.8s ease-in-out infinite alternate; }
.viz-svg[data-phase="process"] .model-group { filter: drop-shadow(0 0 7px rgba(16, 185, 129, 0.55)); }
@keyframes nn-pulse { from { opacity: 0.45; } to { opacity: 1; } }
.viz-legend { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--muted); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend i { width: 10px; height: 10px; border-radius: 99px; }
.log-feed { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.log-entry { display: flex; gap: 9px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.log-entry i { width: 6px; height: 6px; margin-top: 6px; flex: 0 0 6px; border-radius: 99px; background: #f59e0b; }
.log-entry.process i { background: #a855f7; }
.log-entry.deliver i { background: #10b981; }
.log-entry p { flex: 1; font-size: 11px; color: var(--text-soft); }
.log-entry time { font-family: ui-monospace, Menlo, monospace; font-size: 9.5px; color: var(--muted-2); }
.explainer { display: flex; flex-direction: column; gap: 12px; }
.explainer li { display: flex; gap: 11px; }
.explainer .ico { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; border-radius: 11px; background: var(--surface); border: 1px solid var(--border); font-size: 17px; }
.explainer b { display: block; font-size: 12px; }
.explainer p { margin-top: 2px; font-size: 11px; color: var(--muted); }

/* ---------- 3D field ---------- */
.f3d { display: flex; flex-direction: column; gap: 12px; }
.f3d-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sm); }
.f3d-bar .f3d-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.f3d-cluster { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.f3d-chip { padding: 5px 8px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-3); color: var(--text-soft); font-size: 10.5px; font-weight: 600; }
.f3d-chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.f3d-chip.is-active { background: var(--accent-strong); border-color: transparent; color: #fff; }
.f3d-chip.is-amber { background: #d97706; border-color: transparent; color: #fff; }
.f3d-chip .sub { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.2); font-size: 9px; }
.f3d-chip:not(.is-active) .sub.sand { background: rgba(245, 158, 11, 0.18); color: var(--amber); }
.f3d-chip:not(.is-active) .sub.mud { background: rgba(14, 165, 233, 0.16); color: var(--sky); }
.f3d-chip:not(.is-active) .sub.loam { background: rgba(16, 185, 129, 0.14); color: var(--accent); }
.f3d-fps { padding: 5px 8px; border: 1px solid var(--accent-border); border-radius: 9px; background: var(--accent-soft); color: var(--accent); font: 600 10px ui-monospace, Menlo, monospace; }
.f3d-zoom { display: flex; align-items: center; gap: 4px; padding: 2px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-3); }
.f3d-zoom button { padding: 4px 7px; border: 0; border-radius: 7px; background: transparent; color: var(--text-soft); font-size: 10.5px; font-weight: 700; }
.f3d-zoom button:hover { background: var(--surface); }
.f3d-zoom span { padding: 0 4px; color: var(--muted); font: 10px ui-monospace, Menlo, monospace; }
.f3d-cambar { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr); gap: 12px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.f3d-cambar .f3d-cluster { gap: 4px; }
.f3d-cambar .f3d-chip { padding: 4px 7px; font-size: 10px; }
.f3d-orient { display: flex; align-items: center; gap: 8px; }
.f3d-orient b { font-size: 10px; white-space: nowrap; }
.f3d-orient input[type="range"] { height: 5px; }
.f3d-layers { display: flex; justify-content: flex-end; gap: 4px; flex-wrap: wrap; }
.f3d-layers .check { background: var(--surface-3); }
.f3d-layers .telemetry { background: var(--accent-soft); border: 1px solid var(--accent-border); }
.f3d-layers .telemetry span { color: var(--accent); font-weight: 650; }
.f3d-viewport { position: relative; height: 680px; overflow: hidden; border: 1px solid var(--border); border-radius: 22px; background: #0b192c; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.45); cursor: grab; user-select: none; touch-action: none; }
.f3d-viewport.is-dragging { cursor: grabbing; }
.f3d-canvas { width: 100%; height: 100%; }
.f3d-canvas canvas { display: block; width: 100%; height: 100%; }
.f3d-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.f3d-links path.telemetry { fill: none; stroke-dasharray: 6 6; }
.f3d-links path.actuation { fill: none; stroke-dasharray: 4 6; }
.f3d-links path.terminal { fill: none; stroke-dasharray: 7 5; }
@keyframes dash { to { stroke-dashoffset: -24; } }
.f3d-links path.animated { animation: dash 1s linear infinite; }
.f3d-links text { font: 700 9.5px var(--font); fill: #fde68a; }
.f3d-links rect { fill: rgba(15, 23, 42, 0.92); stroke: #fbbf24; }
.f3d-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.f3d-label { position: absolute; z-index: 12; display: none; }
.f3d-label.is-visible { display: block; }
.f3d-label.sensor { z-index: 20; transform: translate(-50%, -115%); }
.f3d-label.valve { z-index: 10; transform: translate(-50%, 18%); }
.f3d-label.soil { z-index: 10; transform: translate(-50%, -50%); }
.f3d-label.gateway { z-index: 30; transform: translate(-50%, -115%); }
.f3d-sensor-btn { display: flex; align-items: center; gap: 6px; white-space: nowrap; padding: 3px 8px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 10px; background: rgba(15, 23, 42, 0.75); color: #e2e8f0; font-size: 10px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); backdrop-filter: blur(8px); }
.f3d-sensor-btn i { width: 6px; height: 6px; border-radius: 99px; background: #34d399; }
.f3d-sensor-btn.is-active { border-color: #fbbf24; }
.f3d-sensor-btn.is-active i { background: #fbbf24; animation: ping 1.2s infinite; }
.f3d-sensor-btn.is-focused { border-color: #34d399; background: rgba(6, 78, 59, 0.9); color: #fff; box-shadow: 0 0 0 2px rgba(52, 211, 153, 0.4); }
@keyframes ping { 50% { opacity: 0.35; transform: scale(1.6); } }
.f3d-valve-btn { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border: 1px solid #475569; border-radius: 7px; background: rgba(15, 23, 42, 0.85); color: #cbd5e1; font-size: 9px; font-weight: 700; }
.f3d-valve-btn.is-open { border-color: #38bdf8; background: rgba(8, 47, 73, 0.9); color: #bae6fd; }
.f3d-valve-btn .state { padding: 0 4px; border-radius: 4px; background: #334155; color: #cbd5e1; font-size: 8px; }
.f3d-valve-btn.is-open .state { background: #0ea5e9; color: #fff; }
.f3d-soil-tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 6px; background: rgba(28, 25, 23, 0.8); color: #e7e5e4; font-size: 9px; font-weight: 600; }
.f3d-soil-tag.sand { border-color: rgba(251, 191, 36, 0.5); background: rgba(69, 26, 3, 0.8); color: #fde68a; }
.f3d-soil-tag.mud { border-color: rgba(56, 189, 248, 0.5); background: rgba(8, 47, 73, 0.85); color: #bae6fd; }
.f3d-gateway-tag { max-width: 230px; padding: 7px 10px; border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 11px; background: rgba(15, 23, 42, 0.8); color: #f1f5f9; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); backdrop-filter: blur(8px); }
.f3d-gateway-tag.is-processing { border-color: #34d399; background: rgba(2, 44, 34, 0.9); }
.f3d-gateway-tag .title { display: flex; align-items: center; gap: 5px; color: #6ee7b7; font-size: 10px; font-weight: 800; letter-spacing: 0.03em; }
.f3d-gateway-tag .title i { width: 7px; height: 7px; border-radius: 99px; background: #34d399; animation: pulse 1.4s infinite; }
.f3d-gateway-tag .model { margin-top: 1px; font-size: 9px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.f3d-hud { position: absolute; z-index: 30; padding: 8px 11px; border: 1px solid rgba(255, 255, 255, 0.14); border-radius: 13px; background: rgba(2, 6, 23, 0.72); color: #e2e8f0; backdrop-filter: blur(10px); }
.f3d-hud.left { top: 12px; left: 12px; max-width: 460px; pointer-events: none; }
.f3d-hud.left .badge-line { display: flex; align-items: center; gap: 7px; color: #6ee7b7; font-size: 10.5px; font-weight: 700; }
.f3d-hud.left p { margin-top: 2px; font-size: 9.5px; color: #cbd5e1; }
.f3d-hud.right { top: 12px; right: 12px; }
.f3d-hud.right label { display: block; margin-bottom: 3px; color: #34d399; font-size: 8.5px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.f3d-hud.right select { padding: 4px 7px; border: 1px solid #334155; border-radius: 7px; background: #0f172a; color: #fff; font-size: 10px; font-weight: 600; }
.f3d-inspector { position: absolute; z-index: 35; right: 12px; bottom: 12px; width: min(500px, calc(100% - 24px)); padding: 14px; border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 16px; background: rgba(2, 6, 23, 0.92); color: #fff; box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4); backdrop-filter: blur(16px); display: none; }
.f3d-inspector.is-visible { display: block; }
.f3d-inspector .insp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.f3d-inspector .insp-badge { padding: 2px 8px; border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 99px; background: rgba(16, 185, 129, 0.18); color: #6ee7b7; font-size: 9px; font-weight: 700; }
.f3d-inspector .insp-actions { display: flex; gap: 3px; }
.f3d-inspector .insp-actions button { padding: 2px 7px; border: 0; border-radius: 6px; background: rgba(255, 255, 255, 0.1); color: #e2e8f0; font-size: 9.5px; font-weight: 600; }
.f3d-inspector .insp-actions button.is-active { background: #059669; color: #fff; }
.f3d-inspector h3 { margin-top: 7px; font-size: 13px; font-weight: 700; }
.f3d-inspector .hw { margin-top: 3px; font-size: 10px; color: #cbd5e1; }
.f3d-inspector .hw b { color: #6ee7b7; }
.f3d-inspector .insp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; }
.f3d-inspector .insp-grid div { padding: 6px; border-radius: 8px; background: rgba(255, 255, 255, 0.05); }
.f3d-inspector .insp-grid span { display: block; font-size: 8px; color: #94a3b8; }
.f3d-inspector .insp-grid b { display: block; font-size: 10px; color: #6ee7b7; }
.f3d-inspector .insp-grid .amber { color: #fcd34d; }
.f3d-inspector .insp-grid .sky { color: #7dd3fc; text-decoration: underline; }
.f3d-hud.tour { top: 14px; left: 50%; transform: translateX(-50%); z-index: 40; display: none; align-items: center; gap: 10px; padding: 9px 14px; border-color: rgba(244, 63, 94, 0.7); background: rgba(2, 6, 23, 0.92); }
.f3d-hud.tour.is-visible { display: flex; }
.f3d-hud.tour .rec { display: flex; align-items: center; gap: 6px; color: #fb7185; font: 800 10.5px ui-monospace, Menlo, monospace; letter-spacing: 0.05em; }
.f3d-hud.tour .rec i { width: 10px; height: 10px; border-radius: 99px; background: #f43f5e; animation: ping 1.1s infinite; }
.f3d-hud.tour .chapter { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; font-weight: 700; }
.f3d-hud.tour button { padding: 4px 8px; border: 0; border-radius: 7px; background: #e11d48; color: #fff; font-size: 10px; font-weight: 700; }
.tour-tag { padding: 2px 7px; border: 1px solid rgba(52, 211, 153, 0.3); border-radius: 5px; background: rgba(16, 185, 129, 0.2); color: #6ee7b7; font-size: 9px; font-weight: 700; }
.f3d-modal { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; padding: 16px; }
.f3d-modal.is-visible { display: flex; }
.f3d-modal .backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, 0.8); backdrop-filter: blur(8px); }
.f3d-modal .panel { position: relative; z-index: 1; width: min(780px, 100%); max-height: 90vh; overflow-y: auto; padding: 22px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 22px; background: rgba(15, 23, 42, 0.97); color: #f8fafc; box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5); }
.f3d-modal .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.f3d-modal .panel-head h2 { font-size: 16px; }
.f3d-modal .panel-head p { font-size: 10.5px; color: #94a3b8; }
.f3d-modal .close { width: 30px; height: 30px; border: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.1); color: #cbd5e1; }
.f3d-modal .chapters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.f3d-modal .chapter { padding: 8px 10px; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 9px; background: rgba(255, 255, 255, 0.04); }
.f3d-modal .chapter .ch-top { display: flex; justify-content: space-between; gap: 8px; font-size: 10px; }
.f3d-modal .chapter b { color: #6ee7b7; }
.f3d-modal .chapter time { color: #94a3b8; font-family: ui-monospace, Menlo, monospace; font-size: 9px; }
.f3d-modal .chapter p { margin-top: 3px; font-size: 9.5px; color: #cbd5e1; }
.f3d-modal .panel-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.f3d-modal .deliverable { padding: 14px; border: 1px solid rgba(52, 211, 153, 0.4); border-radius: 13px; background: rgba(2, 44, 34, 0.4); margin-top: 14px; }
.f3d-modal .deliverable .tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.f3d-modal .deliverable h3 { margin-top: 6px; font-size: 13px; }
.f3d-modal .deliverable p { margin-top: 2px; font-size: 10.5px; color: #cbd5e1; }
.f3d-modal .deliverable .actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.f3d-modal .deliverable .actions button { border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08); color: #f1f5f9; }

/* ---------- Sticker ---------- */
.sticker { position: fixed; z-index: 30; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 8px; cursor: grab; user-select: none; touch-action: none; }
.sticker.is-hidden { left: 16px; bottom: 56px; right: auto; }
.sticker:active { cursor: grabbing; }
.sticker .sticker-row { display: flex; align-items: center; gap: 5px; }
.sticker .sticker-label { padding: 3px 8px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 12px; background: rgba(255, 255, 255, 0.7); color: #1e293b; font-size: 9px; font-weight: 550; box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.18); backdrop-filter: blur(12px); }
html.dark .sticker .sticker-label { background: rgba(15, 17, 23, 0.85); color: #f1f5f9; border-color: #334155; }
.sticker .sticker-hide { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 99px; background: rgba(255, 255, 255, 0.85); color: #475569; font-size: 12px; }
.sticker .sticker-img { width: 48px; height: 48px; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 99px; overflow: hidden; background: rgba(255, 255, 255, 0.5); box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.25); backdrop-filter: blur(16px); transition: transform 0.18s ease; }
.sticker .sticker-img:hover { transform: scale(1.06); }
.sticker .sticker-img img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.sticker .sticker-show { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, 0.4); border-radius: 99px; background: rgba(255, 255, 255, 0.9); color: #334155; font-size: 15px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); backdrop-filter: blur(12px); }
html.dark .sticker .sticker-show { background: rgba(15, 23, 42, 0.9); color: #f1f5f9; border-color: #334155; }

/* ---------- Footer ---------- */
.page-footer { padding: 26px 0 8px; text-align: center; font-size: 11px; color: var(--muted-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f3d-cambar { grid-template-columns: 1fr; }
  .f3d-layers { justify-content: flex-start; }
  .deck-grid-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-130%); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
  .sidebar.is-mobile-open { transform: translateX(0); }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-w); }
  body.sidebar-collapsed .brand-text, body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .theme-btn .theme-label, body.sidebar-collapsed .theme-switch { display: block; }
  body.sidebar-collapsed .nav-link { justify-content: flex-start; padding-inline: 12px; }
  body.sidebar-collapsed .theme-btn { justify-content: space-between; padding-inline: 12px; }
  .page-main, body.sidebar-collapsed .page-main { margin-left: 0; padding: 72px 16px 24px; }
  .mobile-menu-btn { display: grid; }
  body.drawer-open .mobile-menu-btn { display: none; }
  .sidebar-backdrop.is-open { display: block; }
  .page-main.deck-main { padding: 64px 0 0; }
  .deck-page { height: calc(100dvh - 64px); }
  .deck-banner { display: none; }
  .sim-grid { grid-template-columns: 1fr; }
  .overall-grid { grid-template-columns: 1fr; }
  .deck-columns, .deck-subitems { grid-template-columns: 1fr; }
  .f3d-viewport { height: 560px; }
}
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-row { grid-template-columns: 1fr; }
  .plot-body { grid-template-columns: 1fr; }
  .deck-pillars, .deck-highlights { grid-template-columns: 1fr; }
  .deck-card { padding: 20px; }
  .f3d-hud.left { max-width: calc(100% - 180px); }
}
@media (max-width: 680px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .page-header { align-items: flex-start; }
  .glossary, .doc-models, .doc-metrics, .sim-fields { grid-template-columns: 1fr; }
  .readings { grid-template-columns: 1fr 1fr; }
  .f3d-viewport { height: 480px; border-radius: 16px; }
  .f3d-hud.left { display: none; }
  .f3d-hud.right { max-width: 170px; }
  .f3d-hud.tour { width: calc(100% - 24px); flex-wrap: wrap; justify-content: center; }
  .f3d-hud.tour .chapter { max-width: 170px; }
  .f3d-modal .chapters { grid-template-columns: 1fr; }
  .deck-counter { right: 12px; }
  .deck-present { right: 12px; top: 52px; }
  .deck-slide { padding: 12px 10px 30px; }
  .deck-card { padding: 16px; }
  .sticker .sticker-img { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
