/* ============================================================================
   Little Green OS — "Botanical Craft" Design System (v14.0)
   Guided by UI/UX Pro Max: Organic Biophilic + Financial & Operations SaaS
   Zero emoji icons (Lucide SVG), WCAG AA/AAA contrast, Mobile-First Touch >=44px
   ============================================================================ */

:root {
  /* Botanical Craft Palette */
  --bg: #f4f6f3;
  --bg-subtle: #ebefe9;
  --surface: #ffffff;
  --surface-hover: #f9fbf8;
  --sidebar-top: #0b2d1a;
  --sidebar-bot: #103d24;
  --pine: #0f3d24;
  --pine-mid: #166534;
  --emerald: #16a34a;
  --emerald-soft: #e7f6ec;
  --emerald-border: #bbf7d0;

  /* Ink & Borders */
  --ink: #111c16;
  --ink-2: #334239;
  --muted: #5a6b61;
  --subtle: #7c8d83;
  --line: #dfe5dc;
  --line-strong: #c9d4c5;

  /* Semantic Accents */
  --sky: #0284c7;
  --sky-soft: #e0f2fe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --violet: #6d28d9;
  --violet-soft: #f3e8ff;

  /* Layout & Shadows */
  --nav-w: 248px;
  --topbar-h: 60px;
  --tab-h: 64px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 61, 36, 0.04);
  --shadow-md: 0 4px 16px -4px rgba(15, 61, 36, 0.08), 0 1px 3px rgba(15, 61, 36, 0.04);
  --shadow-lg: 0 18px 40px -12px rgba(11, 45, 26, 0.18);
  --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  --font-mono: "Fira Code", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  max-width: 100vw;
  overflow-x: hidden;
}

a { color: var(--pine-mid); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, .num, .kpi-val, .price-txt {
  font-variant-numeric: tabular-nums;
}
.mono { font-family: var(--font-mono); }

/* Lucide Icon Defaults */
.lucide, [data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 1.85;
  flex-shrink: 0;
  vertical-align: middle;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ============================================================================
   App Shell: Sidebar + Top Bar + Main Content
   ============================================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
  max-width: 100vw;
}

.sidebar {
  width: var(--nav-w);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--sidebar-top) 0%, var(--sidebar-bot) 100%);
  color: #e6f2ea;
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 8px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #22c55e, #15803d);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
  overflow: hidden;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 14.5px; font-weight: 800; letter-spacing: 0.3px; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #9bc7ab; font-weight: 500; }

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(187, 224, 200, 0.52);
  padding: 12px 11px 5px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: rgba(235, 246, 239, 0.84);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 160ms ease, color 160ms ease;
  text-align: left;
}
.nav-item-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.09); color: #fff; }
.nav-item.active {
  background: #ffffff;
  color: var(--pine);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.nav-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #d9f3e2;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-pill {
  background: var(--emerald-soft);
  color: var(--pine-mid);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.conn-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: #cbe7d5;
}
.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #facc15;
  flex-shrink: 0;
}
.conn-pill.ok .conn-dot { background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.conn-pill.ok { background: rgba(34, 197, 94, 0.16); color: #dcfce7; }

/* Main Column */
.main-wrap {
  margin-left: var(--nav-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Sticky Top Utility Bar */
.topbar {
  height: var(--topbar-h);
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 246, 243, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mobile-brand-mini { display: none; align-items: center; gap: 8px; font-weight: 800; font-size: 14.5px; color: var(--pine); }

.cmd-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 240px;
  max-width: 360px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.cmd-trigger:hover { border-color: var(--pine-mid); box-shadow: var(--shadow-sm); }
.kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
}

.topbar-right { display: flex; align-items: center; gap: 8px; }

.main-content {
  padding: 22px 24px 48px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.view-section { display: none; animation: fadeIn 180ms ease; }
.view-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================================
   Page Headers, Cards, Bento Grids
   ============================================================================ */

.page-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.page-hdr h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
.page-hdr p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-subtle);
}
.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Grids (Always minmax(0, 1fr) so mobile NEVER clips!) */
.bento-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.bento-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr); gap: 16px; align-items: start; }
.grid-eq-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 11px; }
.bento-4 > *, .bento-3 > *, .grid-2 > *, .grid-eq-2 > *, .grid-form > * { min-width: 0; }

/* KPI Bento Cards */
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-ico.green { background: var(--emerald-soft); color: var(--pine-mid); }
.kpi-ico.sky { background: var(--sky-soft); color: var(--sky); }
.kpi-ico.amber { background: var(--amber-soft); color: var(--amber); }
.kpi-ico.red { background: var(--red-soft); color: var(--red); }
.kpi-ico.violet { background: var(--violet-soft); color: var(--violet); }
.kpi-val { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; color: var(--ink); line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* Weather Forecast Strip */
.weather-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.wx-day {
  background: var(--surface-hover);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 150ms ease;
}
.wx-day.today { border-color: var(--pine-mid); background: var(--emerald-soft); }
.wx-day.rain_day { border-color: #7dd3fc; background: #f0f9ff; }
.wx-day.watch { border-color: #fcd34d; background: #fffbeb; }
.wx-date { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.wx-temp { font-size: 13px; font-weight: 800; color: var(--ink); }
.wx-rain { font-size: 11px; font-weight: 600; color: var(--sky); }

/* ============================================================================
   Buttons, Inputs, Badges, Tabs
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 13.2px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 150ms ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, #16a34a, #15803d); color: #fff; box-shadow: 0 2px 10px rgba(22, 163, 74, 0.25); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-dark { background: var(--pine); color: #fff; }
.btn-dark:hover { background: #14532d; }
.btn-sky { background: var(--sky); color: #fff; }
.btn-violet { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: #fff; }
.btn-outline { background: #fff; color: var(--pine); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--pine-mid); background: var(--emerald-soft); }
.btn-ghost { background: var(--bg); color: var(--ink-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-subtle); color: var(--ink); }
.btn-danger { background: var(--red-soft); color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: #fecaca; }
.btn-sm { min-height: 34px; padding: 5px 10px; font-size: 12.2px; border-radius: 8px; }
.btn-icon { width: 38px; min-height: 38px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label.fl { display: block; font-size: 11.8px; font-weight: 700; color: var(--muted); margin-bottom: 5px; }
input[type="text"], input[type="number"], input[type="password"], input[type="tel"], input[type="email"], input[type="date"], input[type="time"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1.2px solid var(--line-strong);
  border-radius: 10px;
  font-size: 13.8px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.14);
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.2px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}
.b-green { background: var(--emerald-soft); color: #166534; }
.b-sky { background: var(--sky-soft); color: #0369a1; }
.b-amber { background: var(--amber-soft); color: #92400e; }
.b-red { background: var(--red-soft); color: #b91c1c; }
.b-violet { background: var(--violet-soft); color: #6d28d9; }
.b-gray { background: var(--bg-subtle); color: var(--ink-2); }

/* Segmented Filter Tabs */
.seg-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: var(--bg-subtle);
  border-radius: 11px;
  border: 1px solid var(--line);
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 150ms ease;
}
.seg-btn.active {
  background: #fff;
  color: var(--pine);
  box-shadow: var(--shadow-sm);
}

/* Alerts */
.alert {
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 12.8px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.alert.green { background: var(--emerald-soft); border-color: var(--emerald-border); color: #14532d; }
.alert.sky { background: var(--sky-soft); border-color: #bae6fd; color: #0c4a6e; }
.alert.amber { background: var(--amber-soft); border-color: #fde68a; color: #78350f; }
.alert.red { background: var(--red-soft); border-color: #fecaca; color: #991b1b; }

/* ============================================================================
   List Rows, Job Cards, Tables, Progress Bars
   ============================================================================ */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  margin-bottom: 9px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.list-item:hover { border-color: var(--pine-mid); box-shadow: var(--shadow-sm); background: var(--surface-hover); }
.list-item.selected { border: 1.8px solid var(--emerald); background: #f4fbf6; }

.route-badge {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--pine);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 9px 10px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1.5px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--bg-subtle); vertical-align: middle; }
tr:hover td { background: var(--surface-hover); }
.num { text-align: right; white-space: nowrap; }

.prog-track {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}
.prog-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--emerald);
  transition: width 300ms ease;
}
.prog-fill.warn { background: var(--amber); }
.prog-fill.danger { background: var(--red); }

/* Checklist */
.chk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin-bottom: 7px;
  background: #fff;
  cursor: pointer;
}
.chk-item.done { background: var(--emerald-soft); border-color: var(--emerald-border); color: var(--muted); text-decoration: line-through; }
.chk-item input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--emerald); cursor: pointer; }

/* ============================================================================
   V13 Quoting Live Strip, Satellite Map & Photo Grids
   ============================================================================ */

.live-strip {
  background: linear-gradient(135deg, #0b2d1a 0%, #166534 100%);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
  box-shadow: 0 10px 26px -8px rgba(15, 61, 36, 0.35);
}
.live-price { font-size: 34px; font-weight: 800; line-height: 1.05; letter-spacing: -0.8px; text-align: left; }
.metric-chip {
  background: rgba(255, 255, 255, 0.14);
  padding: 6px 11px;
  border-radius: 9px;
  font-size: 12.2px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.metric-chip.ok { background: rgba(74, 222, 128, 0.22); color: #dcfce7; }
.metric-chip.warn { background: #dc2626; color: #fff; }

.map-shell {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 410px;
  border-radius: 13px;
  overflow: hidden;
  border: 1.5px solid var(--line-strong);
  background: #0f172a;
}
.map-shell canvas { width: 100%; height: 100%; display: block; }
.map-zoom-fab { position: absolute; top: 10px; right: 10px; z-index: 10; display: flex; flex-direction: column; gap: 6px; }
.map-zoom-fab button {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid rgba(255,255,255,0.24);
  background: rgba(15, 23, 42, 0.85); color: #fff; font-size: 18px; font-weight: 800; cursor: pointer;
}

.target-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.t-chip {
  padding: 6px 11px; border-radius: 999px; border: 1.2px solid var(--line-strong);
  background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--ink-2);
}
.t-chip.active { background: var(--pine); color: #fff; border-color: var(--pine); }

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: 13px;
  padding: 20px 16px;
  text-align: center;
  background: var(--surface-hover);
  cursor: pointer;
  transition: all 150ms ease;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--emerald); background: var(--emerald-soft); }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 9px; margin-top: 10px; }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #0f172a; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px;
  border-radius: 50%; border: none; background: rgba(220, 38, 38, 0.92); color: #fff; font-weight: 800; cursor: pointer;
}

.svc-block { border: 1.2px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.svc-block.on { border-color: #86efac; background: #fafdfb; }
.svc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.svc-toggle { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 13.8px; cursor: pointer; }
.svc-toggle input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--emerald); cursor: pointer; }
.svc-body { margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line); }
.hedge-row { background: var(--surface-hover); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.sticky-col { position: sticky; top: calc(var(--topbar-h) + 16px); }
.msg-box {
  background: var(--surface-hover); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 13px; font-size: 12.5px; white-space: pre-wrap; margin-bottom: 8px;
}

/* ============================================================================
   Slide-Over Drawer, Modal & Cmd+K Command Palette
   ============================================================================ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(11, 45, 26, 0.42);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
}
.overlay.open { display: flex; }

.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 75;
  background: rgba(11, 45, 26, 0.36);
  backdrop-filter: blur(3px);
  display: none;
  justify-content: flex-end;
}
.drawer-overlay.open { display: flex; }
.drawer-panel {
  width: min(560px, 100vw);
  height: 100%;
  background: #fff;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideLeft 180ms ease;
}
@keyframes slideLeft { from { transform: translateX(30px); opacity: 0.5; } to { transform: translateX(0); opacity: 1; } }
.drawer-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.drawer-body {
  padding: 18px 20px 32px;
  overflow-y: auto;
  flex: 1;
}

.modal-box {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-hdr {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 16px 18px 20px; overflow-y: auto; }

.cmd-box {
  width: min(580px, calc(100vw - 24px));
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  margin-top: -12vh;
}
.cmd-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}
.cmd-input-row input { border: none; min-height: 28px; padding: 0; font-size: 15px; box-shadow: none !important; }
.cmd-results { max-height: 360px; overflow-y: auto; padding: 8px; }
.cmd-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 13.2px;
}
.cmd-row:hover { background: var(--emerald-soft); color: var(--pine); }

/* Toast Notification */
.toast-rack {
  position: fixed;
  right: 18px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--pine);
  color: #fff;
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeIn 180ms ease;
}
.toast.err { background: var(--red); }

/* Chart Wrapper */
.chart-box { position: relative; height: 250px; width: 100%; }

/* Mobile Frosted Bottom Tab Bar */
.bottom-tabs { display: none; }

/* ============================================================================
   Responsive Breakpoints (iPad <= 1080px, iPhone <= 780px)
   ============================================================================ */

@media (max-width: 1120px) {
  .bento-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .sticky-col { position: static; }
  :root { --nav-w: 214px; }
}

@media (max-width: 820px) {
  .sidebar { display: none; }
  .main-wrap { margin-left: 0; width: 100%; }
  .mobile-brand-mini { display: flex; }
  .cmd-trigger { min-width: 0; padding: 7px 10px; }
  .cmd-trigger span.cmd-hint, .kbd { display: none; }
  .topbar { padding: 0 12px; }
  .main-content { padding: 14px 12px calc(var(--tab-h) + env(safe-area-inset-bottom) + 22px); }
  .card { padding: 14px; }
  .bento-3, .grid-eq-2 { grid-template-columns: minmax(0, 1fr); }
  .weather-strip { grid-template-columns: repeat(7, minmax(74px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
  .map-shell { height: 320px; }
  .live-price { font-size: 28px; }
  .toast-rack { right: 12px; left: 12px; bottom: calc(var(--tab-h) + 14px); }

  .bottom-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding: 5px 4px max(6px, env(safe-area-inset-bottom));
  }
  .tab-btn {
    border: none;
    background: transparent;
    color: var(--subtle);
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10.5px;
    font-weight: 700;
    padding: 6px 2px;
    cursor: pointer;
    min-height: 46px;
  }
  .tab-btn.active { color: var(--pine-mid); }
}

@media (max-width: 560px) {
  .bento-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 12px 13px; }
  .kpi-val { font-size: 21px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .list-item { flex-direction: column; align-items: stretch; gap: 8px; }
  .page-hdr h1 { font-size: 19.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
