/* ============================================================
   Laand — application design system
   Soft clinical white · deep sage accent · soft elevation.
   Hanken Grotesk (display) · Inter (UI/body) · JetBrains Mono.
   Shares the token language of the landing page; left sidebar shell.
   ============================================================ */

:root {
  /* Neutrals — soft clinical white family */
  --bg:         #f4f5f2;
  --paper:      #f4f5f2;   /* legacy alias */
  --surface:    #ffffff;
  --surface-2:  #f8f9f6;
  --ink:        #14150f;
  --ink-2:      #3f413a;
  --muted:      #6f7268;
  --dim:        #a7a99f;
  --line:       #e4e5df;
  --line-2:     #d3d5cc;

  /* Accent — deep soft sage (used with intent) */
  --accent:      #4f7a48;
  --accent-ink:  #335730;   /* darker, for text/links on light */
  --accent-soft: #e7efe2;   /* pale sage wash */
  --on-accent:   #ffffff;
  --focus:       rgba(79, 122, 72, 0.22);
  --hover:       #eef1ea;

  /* Semantic */
  --danger:      #b3402f;
  --danger-soft: #f3e0db;

  /* Material — soft rounding + layered low-opacity elevation */
  --radius:      14px;
  --radius-sm:   9px;
  --radius-lg:   20px;
  --radius-pill: 999px;
  --shadow-sm:   0 1px 2px rgba(20,21,15,0.04), 0 2px 5px -2px rgba(20,21,15,0.06);
  --shadow:      0 1px 2px rgba(20,21,15,0.03), 0 12px 28px -14px rgba(20,21,15,0.16);
  --shadow-lg:   0 2px 6px rgba(20,21,15,0.04), 0 30px 60px -24px rgba(20,21,15,0.22);
  --shadow-accent: 0 1px 2px rgba(20,21,15,0.05), 0 10px 22px -10px rgba(79,122,72,0.42);

  /* Curated surface treatment — what makes a panel feel like material, not a flat
     fill. Used together: a soft light cascading from top-left, faint film grain,
     and an inset top highlight on raised controls. Kept deliberately subtle. */
  --grad-surface: linear-gradient(155deg, #ffffff 0%, #fcfcfa 55%, #f5f6f1 100%);
  --grad-surface-2: linear-gradient(155deg, #fbfcf9 0%, #f7f8f4 60%, #f1f2ed 100%);
  --hi-top: inset 0 1px 0 rgba(255,255,255,0.9);   /* top-edge highlight → "lifted" */
  /* 2% film grain (tiling SVG noise). Painted as a fixed overlay in body::after. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --sidebar-w:  244px;
  --content-pad: 30px;
  --nav-h:      56px;       /* mobile topbar height */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Film grain — a single faint texture over the whole app so surfaces read as
   material rather than flat color. ~2.5%; pointer-events:none so it's invisible
   to interaction. This is the "curated, not blanket" layer. */
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: var(--grain);
  background-size: 200px 200px;
  opacity: 0.025;
  pointer-events: none;
  z-index: 2147483646;
}
@media print { body::after { display: none; } }

::selection { background: var(--accent-soft); color: var(--accent-ink); }
a { color: inherit; text-decoration: none; }

/* ---- Typography roles ---- */
.font-mono, .mono, code, .tms, .address-mono {
  font-family: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
}
.font-serif, .serif, .display-serif { font-family: 'Hanken Grotesk', sans-serif; }
.tabular-nums, td, th, [data-num], .num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

h1, h2, h3, .display, .headline { font-family: 'Hanken Grotesk', sans-serif; }
.display {
  font-weight: 700;
  font-size: clamp(2.0rem, 4.6vw, 3.1rem);
  line-height: 1.0;
  letter-spacing: -0.038em;
}
.display-serif {
  font-weight: 700;
  font-size: clamp(2.0rem, 4.8vw, 3.2rem);
  line-height: 1.0;
  letter-spacing: -0.035em;
}
.headline {
  font-weight: 650;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow-accent { color: var(--accent-ink); }
.lede {
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 62ch;
}

.section-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.divider { height: 1px; background: var(--line); border: none; }

.text-ec-muted { color: var(--muted); }
.text-ec-dim { color: var(--dim); }
.text-accent { color: var(--accent-ink); }

/* ============================================================
   App shell — left sidebar + main column
   ============================================================ */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; align-self: flex-start;
  width: var(--sidebar-w); flex-shrink: 0;
  height: 100vh; height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 16px 14px 14px;
  z-index: 50;
  transition: width 190ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* Rows clip their labels (never wrap), so as the rail width animates the labels reveal/hide
   smoothly instead of wrapping + reflowing. Icons are flex-shrink:0 and never move. */
.sb-item, .sb-wallet, .sb-cart, .sb-account { overflow: hidden; }
.sb-item > span, .sb-wallet-meta, .sb-account-meta { white-space: nowrap; min-width: 0; }

/* brand + live */
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 4px 6px; margin-bottom: 14px; }
.sb-head-right { display: inline-flex; align-items: center; gap: 8px; }
/* collapse toggle is a normal footer row (.sb-item) under Dark mode — its chevron flips when collapsed */
.sb-item.sb-collapse svg { transition: transform 200ms ease; }
@media (max-width: 860px) { .sb-collapse { display: none; } }   /* mobile sidebar is a slide-over, not collapsible */

/* Desktop collapsed → a thin icon rail. Only labels/meta hide; the icons AND the logo stay
   exactly where they are — no re-centering, no padding change — so the width just animates
   closed with nothing shifting or reflowing. */
@media (min-width: 861px) {
  .app.sidebar-collapsed { --sidebar-w: 66px; }
  .app.sidebar-collapsed .status-label,
  .app.sidebar-collapsed .sb-item > span,
  .app.sidebar-collapsed .sb-item .sb-badge,
  .app.sidebar-collapsed .sb-wallet-meta,
  .app.sidebar-collapsed .sb-account-meta,
  .app.sidebar-collapsed .sb-account-caret,
  .app.sidebar-collapsed .sb-theme .sb-switch { display: none; }
  /* collapsed: the LIVE indicator shrinks to just its dot, pinned to the rail's top-right */
  .app.sidebar-collapsed .sb-live { position: absolute; top: 12px; right: 12px; gap: 0; z-index: 2; }
  /* the notification badge is shown via an inline style, so force it off when collapsed —
     the mini live dot is the only indicator on the rail */
  .app.sidebar-collapsed .sb-item .sb-badge { display: none !important; }
  .app.sidebar-collapsed .sb-item.sb-collapse svg { transform: rotate(180deg); }
  /* the account popup needs real width when the rail is thin — anchor it left, over the main column */
  .app.sidebar-collapsed .sb-acct-pop { left: 0; right: auto; width: 194px; }
}
.sb-brand { display: inline-flex; align-items: center; }
.sb-brand img { height: 30px; width: auto; display: block; }
.sb-live { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); display: inline-block; }
.status-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* nav */
.sb-section { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); padding: 4px 11px; margin: 6px 0 2px; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 13.5px; font-weight: 500; letter-spacing: -0.01em;
  cursor: pointer; transition: background 130ms ease, color 130ms ease;
}
.sb-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); transition: color 130ms ease; }
.sb-item:hover { background: var(--surface-2); color: var(--ink); }
.sb-item:hover svg { color: var(--ink-2); }
.sb-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.sb-item.active svg { color: var(--accent); }
.sb-item .sb-badge { margin-left: auto; }

/* footer cluster */
.sb-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-foot-divider { height: 1px; background: var(--line); margin: 8px 6px; }
/* sidebar wallet styles are inlined in base.html's <head> (always-fresh, no-store) so they
   apply on first paint regardless of style.css cache — see there. */

.sb-account-wrap { position: relative; }
.sb-account {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 9px; border-radius: var(--radius-sm); border: none; background: transparent;
  cursor: pointer; text-align: left; font-family: inherit; transition: background 130ms ease;
}
.sb-account:hover { background: var(--surface-2); }
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; letter-spacing: 0.02em;
}
.sb-account-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sb-account-name { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-account-email { font-size: 10.5px; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-account-caret { color: var(--dim); flex-shrink: 0; transition: transform 140ms ease; }
.sb-account-wrap.open .sb-account-caret { transform: rotate(180deg); }
/* account popup — opens UPWARD (the row sits at the sidebar foot): Account & Settings + Sign out */
.sb-acct-pop { position:absolute; bottom:calc(100% + 6px); left:0; right:0; display:none; flex-direction:column; gap:2px;
  background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 12px 34px rgba(0,0,0,0.18); padding:6px; z-index:50; }
.sb-account-wrap.open .sb-acct-pop { display:flex; }
.sb-acct-popitem { display:flex; align-items:center; gap:10px; width:100%; box-sizing:border-box; padding:9px 11px; border-radius:8px;
  background:none; border:none; text-align:left; cursor:pointer; font-family:inherit; font-size:13px; font-weight:500; color:var(--ink); text-decoration:none; }
.sb-acct-popitem:hover { background:var(--surface-2); }
.sb-acct-popitem svg { width:16px; height:16px; color:var(--muted); flex-shrink:0; }
.sb-acct-signout, .sb-acct-signout svg { color:#c0392b; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

#content { padding: var(--content-pad) 32px; max-width: 1280px; margin: 0 auto; width: 100%; }

/* Mobile topbar (hidden on desktop) */
.topbar { display: none; }
.sb-overlay { display: none; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: -0.005em;
  color: var(--ink); border: 1px solid var(--line);
  background-color: var(--surface); background-image: linear-gradient(180deg, #ffffff 0%, #f6f7f3 100%);
  padding: 9px 16px; border-radius: var(--radius-sm); cursor: pointer;
  /* layered depth: a hairline contact shadow + a soft cast + an inset top highlight */
  box-shadow: 0 1px 1.5px rgba(20,21,15,0.05), 0 2px 5px -1px rgba(20,21,15,0.07), var(--hi-top);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 180ms ease, color 140ms ease, transform 120ms cubic-bezier(0.2,0.8,0.2,1);
}
.btn:hover { background-image: linear-gradient(180deg, #ffffff 0%, #eef0ea 100%); border-color: var(--line-2); box-shadow: 0 1px 1.5px rgba(20,21,15,0.06), 0 6px 14px -3px rgba(20,21,15,0.12), var(--hi-top); transform: translateY(-1px); }
.btn:active { transform: translateY(0); box-shadow: 0 1px 1.5px rgba(20,21,15,0.06), inset 0 1px 2px rgba(20,21,15,0.06); }
.btn-primary, .btn.primary {
  border-color: transparent; color: var(--on-accent);
  background-color: var(--accent); background-image: linear-gradient(180deg, #5a8551 0%, #4f7a48 58%, #477040 100%);
  box-shadow: 0 1px 2px rgba(20,21,15,0.08), 0 8px 18px -6px rgba(79,122,72,0.5), inset 0 1px 0 rgba(255,255,255,0.22);
}
.btn-primary:hover, .btn.primary:hover { color: var(--on-accent); background-image: linear-gradient(180deg, #517a49 0%, #466e40 58%, #3d6238 100%); box-shadow: 0 1px 2px rgba(20,21,15,0.1), 0 12px 26px -8px rgba(79,122,72,0.55), inset 0 1px 0 rgba(255,255,255,0.18); transform: translateY(-1px); }
.btn-primary:active, .btn.primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(20,21,15,0.1), inset 0 1px 3px rgba(20,21,15,0.18); }
.btn-ink { color: var(--surface); border-color: var(--ink); background-color: var(--ink); background-image: linear-gradient(180deg, #26271f 0%, #14150f 100%); box-shadow: 0 1px 2px rgba(20,21,15,0.12), 0 8px 18px -6px rgba(20,21,15,0.4), inset 0 1px 0 rgba(255,255,255,0.08); }
.btn-ink:hover { background-image: linear-gradient(180deg, #14150f 0%, #000 100%); border-color: #000; color: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); border-color: transparent; box-shadow: none; transform: none; }
.btn-lg { font-size: 14px; padding: 12px 22px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger); border-color: transparent; color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: #9a3526; border-color: transparent; color: #fff; }

.btn-xs {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: var(--radius-pill); cursor: pointer; transition: all 120ms ease;
}
.btn-xs:hover { color: var(--ink); border-color: var(--line-2); background: var(--surface-2); }

/* ---- Inputs ---- */
input, textarea, select {
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-family: inherit; font-size: 14px; padding: 10px 13px; border-radius: var(--radius-sm);
  outline: none; width: 100%; transition: border-color 140ms ease, box-shadow 140ms ease;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
label { font-size: 11px; font-weight: 600; color: var(--ink-2); letter-spacing: 0.01em; }

/* ---- Panels / cards ---- */
.panel {
  border: 1px solid var(--line); background-color: var(--surface); background-image: var(--grad-surface);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm), var(--hi-top);
}
.card {
  border: 1px solid var(--line); background-color: var(--surface); background-image: var(--grad-surface);
  border-radius: var(--radius); box-shadow: var(--shadow-sm), var(--hi-top);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.card-hover:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }

/* ---- Pills / badges ---- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: var(--radius-pill);
}
.pill-accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.pill-ink { color: var(--on-accent); background: var(--ink); border-color: var(--ink); }
.pill-danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* ---- App tab bar: the one segmented two/three-mode switcher used at the top of each
   panel (Laand: Discovery/Renewals · My Laand: All/Individual). One rule = one size everywhere. ---- */
.app-tabbar { flex-shrink: 0; display: flex; gap: 4px; margin: 14px 18px 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.app-tabbtn { flex: 1; padding: 9px 6px; border: none; background: transparent; border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--muted); transition: background 120ms ease, color 120ms ease; }
.app-tabbtn:hover:not(.active):not(.on) { color: var(--ink); }
.app-tabbtn.active, .app-tabbtn.on { background: var(--surface-2); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; }
th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--line); font-weight: 500;
}
td { padding: 10px 11px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; }
.positive { color: var(--accent-ink); } .negative { color: var(--danger); } .neutral { color: var(--muted); }

/* ---- Account dropdown (opens upward from the sidebar) ---- */
.user-menu-wrap { position: relative; }
.user-dropdown {
  display: none; position: absolute; bottom: calc(100% + 10px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden;
}
.user-dropdown.open { display: block; }
.user-dropdown-header { padding: 14px; }
.user-dropdown-name { font-size: 13px; font-weight: 600; }
.user-dropdown-email { font-size: 11px; color: var(--muted); margin-top: 2px; }
.user-dropdown-divider { height: 1px; background: var(--line); }
.user-dropdown-item { display: block; padding: 11px 14px; font-size: 12.5px; color: var(--ink-2); transition: background 120ms; }
.user-dropdown-item:hover { background: var(--surface-2); color: var(--ink); }
.user-dropdown-danger:hover { color: var(--danger); }

/* ---- Bell (mobile topbar) ---- */
.nav-bell { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm); color: var(--ink-2); transition: background 120ms, color 120ms; }
.nav-bell:hover { background: var(--surface-2); color: var(--ink); }
/* notification unread badge — flows to the right of the Notifications row (not pinned to the
   sidebar corner). margin-left:auto from .sb-item .sb-badge does the pushing. */
#bell-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: var(--radius-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ---- Motion ---- */
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.6s infinite; border-radius: var(--radius-sm); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.rise { animation: rise 520ms cubic-bezier(0.22, 1, 0.36, 1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Grid helpers ---- */
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---- Consolidated zone-stat panel ----
   One compact, bordered unit with hairline internal dividers — replaces the row of
   separate gapped stat boxes so a zone's whole profile reads in less vertical space.
   Shared by the Laand zone-detail and the My Laand zone-focus, identical on desktop
   and mobile (the map-vs-data balance lives here). 3 columns; wrap to 2 rows for 6 stats. */
.zpanel { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line);
  border-radius: 11px; overflow: hidden; background: var(--surface); }
.zpanel > div { padding: 8px 11px 9px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.zpanel > div:nth-child(-n+3) { border-top: none; }
.zpanel > div:nth-child(3n+1) { border-left: none; }
.zpanel b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--ink); }
.zpanel span { display: block; margin-top: 2px; font-size: 8.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
/* z4 — a single clean row of 4 KPIs (the focused-zone property stats). Tighter than the
   3-up panel so the table below it isn't pushed down. */
.zpanel.z4 { grid-template-columns: repeat(4, 1fr); }
.zpanel.z4 > div { border-top: none; padding: 6px 11px 7px; }
.zpanel.z4 b { font-size: 14px; }
.zpanel.z4 > div:nth-child(4) { border-left: 1px solid var(--line); }
@media (max-width: 560px) { .zpanel b { font-size: 16px; } .zpanel span { font-size: 9px; }
  .zpanel.z4 { grid-template-columns: repeat(2, 1fr); }
  .zpanel.z4 > div:nth-child(-n+2) { border-top: none; } .zpanel.z4 > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .zpanel.z4 > div:nth-child(2n+1) { border-left: none; } .zpanel.z4 > div:nth-child(4) { border-left: 1px solid var(--line); } }

/* ---- Global discovery list kit (shared: Laand + My Laand) ----
   The one look for every "browse-and-pick" panel: filter chips, a search box, a
   sortable column table, and a pager tally. Column GRIDS are set per-use (the
   columns are content-specific — homes vs zones), but the typography, spacing,
   sticky header, hover, and theming all live here so the two tabs read 1:1 and
   there's a single place to restyle. Token-driven → correct in light + dark.
   (My Laand still ships equivalent `.li-*` rules inline; folding it onto this kit
   is the safe next step.) */
.lz-chips { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:10px; }
.lz-fchip { padding:5px 9px; border-radius:7px; border:1px solid var(--line); background:var(--surface); cursor:pointer;
  font-family:inherit; font-size:10px; font-weight:600; color:var(--ink-2); transition:background 120ms ease, color 120ms ease, border-color 120ms ease; }
.lz-fchip:hover { border-color:var(--line-2,#cfcfca); }
.lz-fchip.on { background:var(--ink); color:var(--surface); border-color:var(--ink); }
.lz-search { width:100%; box-sizing:border-box; padding:9px 13px; border:1px solid var(--line); border-radius:10px;
  font-size:13px; font-family:inherit; margin:0 0 11px; background:var(--surface); color:var(--ink); transition:border-color 140ms ease, box-shadow 140ms ease; }
.lz-search:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--focus,rgba(79,122,72,0.12)); }
.lz-search::placeholder { color:var(--dim,#a7a99f); }
.lz-thead, .lz-trow { display:grid; gap:10px; align-items:center; }
.lz-thead { position:sticky; top:0; z-index:2; background:var(--surface); padding:0 9px 7px; margin-bottom:2px; border-bottom:1px solid var(--line); }
.lz-th { font:700 9px 'JetBrains Mono',monospace; letter-spacing:0.04em; text-transform:uppercase; color:var(--muted); overflow:hidden; white-space:nowrap;
  background:none; border:none; padding:3px 0; cursor:pointer; display:flex; align-items:center; gap:3px; min-width:0; text-align:left; }
.lz-th:hover { color:var(--ink); }
.lz-th.on { color:var(--accent-ink); }
.lz-th .ar { font-size:7px; }
.lz-th.static { cursor:default; }
.lz-th.static:hover { color:var(--muted); }
.lz-trow { padding:8px 9px; border-radius:8px; cursor:pointer; transition:background 110ms ease; }
.lz-trow:hover { background:var(--surface-2,#fafaf8); }
.lz-c-name { display:flex; align-items:center; gap:8px; min-width:0; }
.lz-c-name .dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.lz-c-name .nm { flex:1 1 auto; min-width:0; font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lz-c-num { font-size:11px; font-variant-numeric:tabular-nums; color:var(--ink-2); text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lz-c-tag { font-size:10px; color:var(--accent-ink); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lz-pager { display:flex; align-items:center; justify-content:center; gap:14px; padding:15px 0 6px; }
.lz-pager-tally { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.lz-more { padding:10px 16px; background:var(--surface); border:1px solid var(--line); border-radius:9px; font-family:inherit;
  font-size:11px; font-weight:600; color:var(--ink-2); cursor:pointer; }
.lz-more:hover { border-color:var(--line-2,#cfcfca); }
.lz-empty { font-size:11.5px; color:var(--muted); line-height:1.55; padding:18px 2px; text-align:center; }

/* ═══ Panel heading (.panel-head) ══════════════════════════════════════════
   The ONE title+subtitle that sits atop every workflow view — Laand (Discovery /
   Renewals & bidding) and My Laand (All zones / Individual zones). Same size, same
   rhythm everywhere; the generous gap below the subtitle breaks each page's content
   up so nothing feels cramped. Shape:  <div class="panel-head">
     <div class="panel-head-t">Title</div><div class="panel-head-s">Subtitle.</div></div> */
.panel-head { margin: 0 0 20px; }
.panel-head-t { font-size:15px; font-weight:700; letter-spacing:-0.02em; color:var(--ink); line-height:1.2; }
.panel-head-s { font-size:11px; color:var(--muted); margin-top:3px; line-height:1.45; }
@media (max-width: 700px) { .panel-head-t { font-size:18px; } .panel-head-s { font-size:11.5px; } }

/* ═══ Global data table (.gt) ══════════════════════════════════════════════
   EVERY data table in the app is this ONE component. Shape:
     <div class="gt" style="--gt-cols:<grid-template-columns>">
       <div class="gt-head">
         <button class="gt-th" data-…>LABEL<span class="ar">▼</span></button> …
       </div>
       <div class="gt-body">
         <div class="gt-row" data-…> <cell> … </div> …
       </div>
     </div>
   The header sits OUTSIDE the scroll, so the scrollbar always starts BELOW it;
   head + body both reserve a stable gutter so columns stay aligned to the pixel.
   Per-table differences are ONLY --gt-cols (+ optional --gt-gap) and the cell
   contents — never the chrome. Height: .gt fills a flex-column parent
   (min-height:0). In normal page flow, set style="--gt-max:<px>" to cap the body
   so it still scrolls internally instead of growing the page. */
.gt { display:flex; flex-direction:column; min-height:0; }
.gt-head, .gt-row { display:grid; grid-template-columns:var(--gt-cols); gap:var(--gt-gap,10px); align-items:center; }
.gt-head { flex:0 0 auto; padding:7px 9px; background:color-mix(in srgb, var(--surface) 95%, #000); border-bottom:1px solid var(--line);
  overflow:hidden; scrollbar-gutter:stable; }
.gt-head:empty { display:none; }
.gt-body { flex:1 1 auto; min-height:0; max-height:var(--gt-max,none); overflow-y:auto; scrollbar-gutter:stable; }
.gt-th { font:700 9px 'JetBrains Mono',monospace; letter-spacing:0.04em; text-transform:uppercase; color:var(--muted);
  overflow:hidden; white-space:nowrap; background:none; border:none; padding:3px 0; cursor:pointer;
  display:flex; align-items:center; gap:3px; min-width:0; text-align:left; }
.gt-th:hover { color:var(--ink); }
.gt-th.on { color:var(--accent-ink); }
.gt-th .ar { font-size:7px; }
.gt-th.static { cursor:default; }
.gt-th.static:hover { color:var(--muted); }
.gt-row { padding:10px 9px; min-height:46px; box-sizing:border-box; border-bottom:1px solid var(--line); cursor:pointer; transition:background 110ms ease; }   /* universal row rhythm: every row lands at 46px whether it holds text or pills */
.gt-row:hover { background:var(--surface-2,#fafaf8); }
.gt-row:last-child { border-bottom:none; }
.gt-body > .gt-empty { font-size:11.5px; color:var(--muted); line-height:1.55; padding:18px 2px; text-align:center; }
.gt-pager { display:flex; align-items:center; justify-content:center; gap:14px; padding:13px 0 4px; }
.gt-pager-tally { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
/* shared cell helpers (name-with-dot, numeric, accent tag) */
.gt-name { display:flex; align-items:center; gap:8px; min-width:0; }
.gt-name .dot { width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.gt-name .nm { flex:1 1 auto; min-width:0; font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.gt-num { font-size:11px; font-variant-numeric:tabular-nums; color:var(--ink-2); text-align:left; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gt-tag { font-size:10px; color:var(--accent-ink); font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Global contextual back button (‹ Label) — one green style across Laand + My Laand, with
   room to breathe under the tab switcher above it. */
.zback { display:inline-flex; align-items:center; gap:5px; background:none; border:none;
  padding:3px 2px 12px 0; margin:0; cursor:pointer; font-family:inherit; font-size:11px; font-weight:700;
  text-transform:uppercase; letter-spacing:0.05em; color:var(--sage,#4f7a48); }
.zback:hover { color:#335730; }
/* Zone identity — THE one way a zone renders in any table: bold zip, muted qualifier.
   Pair with a separate City column where city matters; status never rides in this cell. */
.gt-zone { display:flex; align-items:baseline; gap:6px; min-width:0; }
.gt-zone b { font-size:12.5px; font-weight:800; color:var(--ink); font-variant-numeric:tabular-nums; flex-shrink:0; }
.gt-zone em { font-style:normal; font-size:10.5px; color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0; }

/* ═══ Global map workspace (.mapws) ════════════════════════════════════════
   A data panel beside a map — the ONE shell shared by Laand + My Laand.
   Desktop (≥1080): panel | map side-by-side (panel ordered to the left).
   ≤1079: stacked — map on top (46vh), panel directly below it.
   ≤860: edge-to-edge — panel touches the map, card chrome stripped (no black gap).
   The panel is a flex column: a pinned head + its own scrolling body inside. */
.mapws { position:relative; display:flex; gap:14px; height:calc(100dvh - var(--content-pad,24px) * 2); }
.mapws-map { flex:1 1 0; min-width:0; position:relative; background:#eceae6; border:1px solid var(--line);
  border-radius:var(--radius); overflow:hidden; box-shadow:var(--shadow-sm); }
.mapws-panel { flex:0 0 clamp(420px,46%,800px); display:flex; flex-direction:column;
  background-color:var(--surface); background-image:var(--grad-surface); border:1px solid var(--line);
  border-radius:var(--radius); box-shadow:var(--shadow-sm), var(--hi-top); overflow:hidden; }
@media (min-width:1080px) { .mapws-panel { order:-1; } }
@media (max-width:1079px) {
  .mapws { flex-direction:column; height:auto; }
  .mapws-map { height:46vh; flex:none; }
  .mapws-panel { flex:none; max-height:none; }
}
@media (max-width:860px) {
  .mapws { gap:0; }
  .mapws-map { border:none; border-radius:0; box-shadow:none; }
  .mapws-panel { border-left:none; border-right:none; border-radius:0; box-shadow:none; }
}

/* Global map legend — the floating key over any .mapws map (Laand + My Laand). Content
   differs per tab; the chrome + round color dots are shared. */
.map-legend { position:absolute; right:12px; top:12px; z-index:20; display:flex; flex-direction:column; gap:4px;
  background:rgba(255,255,255,0.94); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); border:1px solid #dddddb;
  border-radius:9px; padding:8px 11px; font-size:9px; color:var(--ink-2); text-transform:uppercase; letter-spacing:0.05em;
  box-shadow:0 1px 6px rgba(0,0,0,0.07); }
.map-legend .lg { display:inline-block; width:10px; height:10px; border-radius:50%; vertical-align:-1px; margin-right:6px;
  border:1px solid rgba(0,0,0,0.15); }
:root[data-theme="dark"] .map-legend { background:rgba(28,29,23,0.92); border-color:#3b3c32; box-shadow:0 1px 8px rgba(0,0,0,0.45); }
@media (max-width:560px) {
  .map-legend { gap:3px; padding:6px 9px; font-size:8px; }
  .map-legend .lg { width:8px; height:8px; margin-right:5px; }
}

/* ---- Legacy surfaces (token-driven, re-skinned by the new :root) ---- */
.strategy-nav { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
  overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
.strategy-nav::-webkit-scrollbar { display: none; }
.strategy-tab { font-family: 'JetBrains Mono', monospace; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  padding: 9px 13px; cursor: pointer; border-bottom: 2px solid transparent; transition: color 120ms, border-color 120ms; flex-shrink: 0; }
.strategy-tab:hover { color: var(--ink); }
.strategy-tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.portfolio-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.strategy-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color 140ms, box-shadow 140ms, transform 140ms; }
.strategy-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-2px); }
.strategy-card .card-name { font-family: 'Hanken Grotesk', sans-serif; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.strategy-card .card-status { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.strategy-card .card-status.active { color: var(--accent-ink); }
.strategy-card .card-status.paused { color: var(--muted); }
.strategy-card .card-stats { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.strategy-card .card-stat-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.strategy-card .card-stat-value { font-size: 14px; font-variant-numeric: tabular-nums; }
.process-card { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color 120ms, box-shadow 120ms; }
.process-card:hover { border-color: var(--line-2); box-shadow: var(--shadow-sm); }
.process-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.process-dot.running { background: var(--accent); animation: pulse 2.4s ease-in-out infinite; }
.process-dot.idle { background: var(--dim); }
.process-dot.error { background: var(--danger); }
.table-compact td { padding: 6px 9px; font-size: 11px; }
.table-compact th { padding: 6px 9px; font-size: 9px; }

/* ---- Chat (ops) ---- */
.chat-page { display: flex; height: calc(100dvh - var(--content-pad) * 2); margin: calc(-1 * var(--content-pad)) -32px; background: var(--surface-2); border-radius: 0; }
.chat-page-sidebar { width: 250px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--surface); flex-shrink: 0; }
.chat-page-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-sidebar-header { padding: 14px; border-bottom: 1px solid var(--line); }
.chat-new-btn { display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 11px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink-2); font-family: inherit; font-size: 12px; cursor: pointer; transition: all 120ms; }
.chat-new-btn:hover { background: var(--bg); border-color: var(--line-2); color: var(--ink); }
.chat-history-list { flex: 1; overflow-y: auto; padding: 6px 0; }
.chat-history-item { padding: 11px 14px; cursor: pointer; transition: background 120ms; border-left: 2px solid transparent; }
.chat-history-item:hover { background: var(--surface-2); }
.chat-history-item.active { background: var(--surface-2); border-left-color: var(--accent); }
.chat-history-title { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-history-time { font-size: 10px; color: var(--dim); margin-top: 3px; }
.chat-icon-btn { width: 28px; height: 28px; background: transparent; border: none; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: all 120ms; }
.chat-icon-btn:hover { color: var(--ink); background: var(--surface-2); }
.chat-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.chat-welcome-title { font-family: 'Hanken Grotesk', sans-serif; font-weight: 650; font-size: 19px; margin-bottom: 6px; letter-spacing: -0.02em; }
.chat-welcome-sub { font-size: 12px; color: var(--muted); margin-bottom: 20px; max-width: 280px; line-height: 1.5; }
.chat-messages { flex: 1; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.chat-msg { display: flex; flex-direction: column; gap: 4px; }
.chat-msg-user { align-items: flex-end; } .chat-msg-ai { align-items: flex-start; }
.chat-msg-label { font-family: 'JetBrains Mono', monospace; font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; padding: 0 4px; }
.chat-label-ai { color: var(--accent-ink); } .chat-label-user { color: var(--muted); }
.chat-msg-bubble { max-width: 85%; padding: 11px 14px; border-radius: var(--radius); font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }
.chat-msg-user .chat-msg-bubble { background: var(--ink); color: var(--on-accent); border-bottom-right-radius: 5px; }
.chat-msg-ai .chat-msg-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm); }
.chat-input-area { padding: 14px; flex-shrink: 0; }
.chat-input-wrap { display: flex; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 4px 4px 14px; transition: border-color 160ms, box-shadow 160ms; box-shadow: var(--shadow-sm); }
.chat-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.chat-input-wrap textarea { flex: 1; background: transparent; border: none; font-size: 13px; resize: none; min-height: 24px; max-height: 120px; padding: 7px 0; box-shadow: none; }
.chat-input-wrap textarea:focus { box-shadow: none; }
.chat-send-btn { width: 34px; height: 34px; background: var(--accent); border: none; border-radius: var(--radius-sm); color: var(--on-accent);
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 120ms; box-shadow: var(--shadow-accent); }
.chat-send-btn:hover { background: var(--accent-ink); }

/* ---- Hamburger (mobile topbar) ---- */
.hamburger { display: none; flex-direction: column; justify-content: center; gap: 3px; width: 38px; height: 38px;
  background: none; border: none; cursor: pointer; padding: 9px; -webkit-tap-highlight-color: transparent; }
.hamburger span { display: block; width: 17px; height: 1.6px; border-radius: 2px; background: var(--ink-2); transition: all 200ms ease; }

/* ============================================================
   Responsive — sidebar collapses to an off-canvas drawer
   ============================================================ */
@media (max-width: 860px) {
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; height: 100%; width: 280px;
    transform: translateX(-100%); transition: transform 260ms cubic-bezier(0.2,0.8,0.2,1);
    box-shadow: var(--shadow-lg);
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .sb-overlay {
    display: block; position: fixed; inset: 0; background: rgba(20,21,15,0.34);
    opacity: 0; visibility: hidden; transition: opacity 220ms ease, visibility 220ms ease; z-index: 49;
    -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
  }
  .app.nav-open .sb-overlay { opacity: 1; visibility: visible; }

  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    height: calc(var(--nav-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    position: sticky; top: 0; z-index: 40;
    background: rgba(244,245,242,0.85);
    -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar-brand img { height: 26px; width: auto; display: block; }
  .topbar-right { display: flex; align-items: center; gap: 4px; }
  .hamburger { display: flex; }

  #content { padding: 18px 16px; max-width: none; }
  .panel { padding: 16px; }
  .chat-page { height: calc(100dvh - var(--nav-h) - 36px); margin: -18px -16px; }
}

/* ============================================================
   DARK THEME — set html[data-theme="dark"] (an early <head> script does this
   from localStorage 'laand:theme' to avoid a flash). The app is token-driven, so
   flipping these :root vars re-skins every surface; the rest below patches the
   few places that use literal hex (the polish gradients, the map, map chrome).
   ============================================================ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:         #121310;
  --paper:      #121310;
  --surface:    #1c1d17;
  --surface-2:  #24251e;
  --ink:        #f1f2ea;
  --ink-2:      #cdcfc4;
  --muted:      #9a9c8f;
  --dim:        #6d6f64;
  --line:       #2d2e26;
  --line-2:     #3b3c32;

  --accent:      #6fa765;   /* sage, brightened so it reads on dark */
  --accent-ink:  #9fcf94;   /* light sage for text/links */
  --accent-soft: #243021;   /* deep sage wash for selected states */
  --on-accent:   #11140d;   /* near-black text on the bright sage button */
  --focus:       rgba(111,167,101,0.34);
  --hover:       #24251e;
  --danger:      #e0795f;
  --danger-soft: #3a2019;

  --shadow-sm:   0 1px 2px rgba(0,0,0,0.45), 0 2px 6px -2px rgba(0,0,0,0.5);
  --shadow:      0 1px 2px rgba(0,0,0,0.45), 0 14px 30px -14px rgba(0,0,0,0.65);
  --shadow-lg:   0 2px 6px rgba(0,0,0,0.5), 0 32px 64px -24px rgba(0,0,0,0.72);
  --shadow-accent: 0 1px 2px rgba(0,0,0,0.45), 0 10px 22px -10px rgba(111,167,101,0.4);
  --hi-top:      inset 0 1px 0 rgba(255,255,255,0.05);

  --grad-surface:   linear-gradient(155deg, #212219 0%, #1c1d17 55%, #181913 100%);
  --grad-surface-2: linear-gradient(155deg, #1d1e17 0%, #191a14 60%, #151610 100%);
}
/* slightly more visible grain on dark */
:root[data-theme="dark"] body::after { opacity: 0.045; }

/* Buttons use literal hex for their depth gradients → re-cut for dark */
:root[data-theme="dark"] .btn {
  background-color: var(--surface); background-image: linear-gradient(180deg, #292a21 0%, #1f201a 100%);
  border-color: var(--line-2); color: var(--ink);
  box-shadow: 0 1px 1.5px rgba(0,0,0,0.45), 0 2px 5px -1px rgba(0,0,0,0.5), var(--hi-top);
}
:root[data-theme="dark"] .btn:hover { background-image: linear-gradient(180deg, #31322a 0%, #26271f 100%); border-color: #4a4b41; box-shadow: 0 1px 1.5px rgba(0,0,0,0.5), 0 6px 14px -3px rgba(0,0,0,0.55), var(--hi-top); }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn.primary {
  background-image: linear-gradient(180deg, #79b46e 0%, #6fa765 58%, #5f9456 100%); color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(0,0,0,0.45), 0 8px 18px -6px rgba(111,167,101,0.45), inset 0 1px 0 rgba(255,255,255,0.2);
}
:root[data-theme="dark"] .btn-primary:hover, :root[data-theme="dark"] .btn.primary:hover { background-image: linear-gradient(180deg, #85be7a 0%, #79b46e 58%, #6aa05f 100%); color: var(--on-accent); }
:root[data-theme="dark"] .btn-ink { background-image: linear-gradient(180deg, #2d2e25 0%, #222319 100%); border-color: var(--line-2); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.45), 0 8px 18px -6px rgba(0,0,0,0.5), var(--hi-top); }
:root[data-theme="dark"] .btn-ink:hover { background-image: linear-gradient(180deg, #353629 0%, #292a20 100%); border-color: #4a4b41; }

/* The 2D map: invert the light Carto Positron tiles into a dark map (+hue-rotate
   keeps greens green-ish). Satellite/Live opt out via .sat-on{filter:none!important}
   in basemap.js, so imagery stays true-color. */
:root[data-theme="dark"] #tr-map, :root[data-theme="dark"] #li-map { background: #15161a; }
/* Softer dark base: lift brightness + drop contrast so it's a mid-charcoal (not
   near-black) — zone outlines and the heat shading read clearly against it. */
:root[data-theme="dark"] #tr-map canvas,
:root[data-theme="dark"] #li-map canvas { filter: invert(1) hue-rotate(180deg) brightness(1.08) contrast(0.72) saturate(0.72); }

/* Floating map chrome → dark translucent over the dark map (high specificity beats
   the templates' literal rgba(255,255,255,…)). */
:root[data-theme="dark"] .tr-legend,
:root[data-theme="dark"] .li-legend,
:root[data-theme="dark"] .li-float .li-chip,
:root[data-theme="dark"] .bm-layers,
:root[data-theme="dark"] .bm-time { background: rgba(26,27,21,0.92); border-color: var(--line-2); color: var(--ink-2); }
:root[data-theme="dark"] .li-chip-title b { color: var(--ink); }
:root[data-theme="dark"] .bm-lyr.on { color: var(--bg); }          /* active toggle: dark text on the light --ink pill */
:root[data-theme="dark"] .maplibregl-popup-content { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
:root[data-theme="dark"] .maplibregl-ctrl-group { background: var(--surface); }
:root[data-theme="dark"] .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
:root[data-theme="dark"] .maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(0.92); }   /* dark +/- glyphs → light */
:root[data-theme="dark"] #tr-map .maplibregl-ctrl-attrib, :root[data-theme="dark"] #li-map .maplibregl-ctrl-attrib { background: rgba(26,27,21,0.7); }

/* Sidebar dark-mode toggle switch (the control itself; markup in base.html) */
.sb-switch { margin-left: auto; width: 30px; height: 17px; border-radius: 999px; background: var(--line-2); position: relative; flex-shrink: 0; transition: background 160ms ease; }
.sb-knob { position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.3); transition: transform 160ms cubic-bezier(0.2,0.8,0.2,1); }
:root[data-theme="dark"] .sb-switch { background: var(--accent); }
:root[data-theme="dark"] .sb-knob { transform: translateX(13px); background: #11140d; }

/* ============================================================
   My Laand zone-ownership cards → Discovery-style list rows. Matches territory's
   .tr-row2 (thin-line row · bold name + right indicator · muted dot-separated
   sub-line). Scoped via #li-body so it overrides the template's inline .li-zcard
   styles WITHOUT editing the (concurrently-edited) leads-intel.html.
   ============================================================ */
#li-body .li-zcard {
  border: none; border-bottom: 1px solid var(--line); border-radius: 8px;
  /* bleed the row 12px into the body padding so the hover fill + divider span wider
     than the content — the status badge gets real breathing room from the edge,
     while the content stays aligned with the section headers. */
  padding: 12px; margin: 0 -12px; box-shadow: none;
  background: none; background-image: none;
}
#li-body .li-zcard:hover { background: var(--surface-2); border-color: var(--line); box-shadow: none; }
#li-body .li-zcard:last-child { border-bottom: none; }
#li-body .li-zcard-top { align-items: baseline; }
#li-body .li-zcard .nm { font-weight: 600; font-size: 12.5px; }
#li-body .li-zcard .badge { font-size: 9px; padding: 2px 7px; }
/* the four stat columns collapse into one muted, dot-separated sub-line */
#li-body .li-zcard-stats { gap: 0; margin-top: 3px; font-size: 10px; color: var(--muted); flex-wrap: wrap; }
#li-body .li-zcard-stats > span + span::before { content: "·"; margin: 0 6px; color: var(--dim); }
#li-body .li-zcard-stats b { display: inline; font-weight: 600; font-size: 10px; color: var(--ink-2); }
#li-body .li-zcard-stats .cap { display: inline; margin-left: 3px; font-size: 10px; text-transform: none; letter-spacing: 0; color: var(--muted); }

/* Laand standing card: drop the redundant "zones held" KPI (the My Zones tab
   already shows holdings) and let Balance + Cart fill the row. Scoped via
   #tr-standing so it beats the template's inline 3-col grid without editing the
   concurrently-edited territory.html. */
#tr-standing .tr-acct-stats { grid-template-columns: repeat(2, 1fr); }
#tr-standing .tr-acct-stat:has(#tr-zones) { display: none; }

/* ============================================================
   DARK-MODE COMPONENT FIXES — many components were authored with hardcoded LIGHT
   literals (#fafaf8 hovers, cream/blue badges, #f0f0ee hairlines, ink-bg CTAs)
   that don't re-skin. Patch them with [data-theme="dark"] overrides so the whole
   app (esp. the dossier + feed) reads correctly in dark. (From the desktop QA audit.)
   ============================================================ */
/* near-white hover fills → dark hover */
:root[data-theme="dark"] .li-row:hover,
:root[data-theme="dark"] .li-trow:hover,
:root[data-theme="dark"] .li-more:hover,
:root[data-theme="dark"] button.li-stat:hover,
:root[data-theme="dark"] .tr-row2:hover,
:root[data-theme="dark"] .tr-cta.ghost:hover,
:root[data-theme="dark"] button.ml-sum:hover,
:root[data-theme="dark"] .lt-x:hover { background: var(--surface-2); }
:root[data-theme="dark"] button.li-stat:hover,
:root[data-theme="dark"] .li-more:hover,
:root[data-theme="dark"] .tr-cta.ghost:hover,
:root[data-theme="dark"] button.ml-sum:hover { border-color: var(--line-2); }

/* ink-background CTAs/badges: --ink flips light, so #fff text goes invisible → dark text */
/* primary action buttons use an ink bg that flips to a stark near-white button in
   dark — make them sage so they match .btn-primary and the brand accent */
:root[data-theme="dark"] .lt-go,
:root[data-theme="dark"] .li-cta-pop .cp-go,
:root[data-theme="dark"] .li-blastbtn,
:root[data-theme="dark"] .li-cta:not(.ghost),
:root[data-theme="dark"] .tr-cta:not(.ghost) { background: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] .tp-badge.tp-yours { color: var(--surface); }
:root[data-theme="dark"] .li-cta.ghost { border-color: var(--line-2); }
/* zone subtab bar: dark inset track, lighter active pill */
:root[data-theme="dark"] .li-subtabs { background: var(--bg); }
:root[data-theme="dark"] .li-subtab.on { background: var(--surface-2); color: var(--ink); }
/* segmented controls (Discovery / My Zones, blast-mode): dark inset track + lifted active pill */
:root[data-theme="dark"] .tr-tabs,
:root[data-theme="dark"] .li-mode { background: var(--bg); }
:root[data-theme="dark"] .tr-tab.active,
:root[data-theme="dark"] .li-mode button.on { background: var(--surface-2); color: var(--ink); }
:root[data-theme="dark"] .tr-tab-n { color: var(--muted); }
/* standing-card / filter-chip / region-select / back-chip HOVERS (were #fafaf8 / #cfcfca / #bdbdb8) */
:root[data-theme="dark"] button.tr-acct-stat:hover,
:root[data-theme="dark"] .tr-chip-f:hover { background: var(--surface-2); border-color: var(--line-2); }
:root[data-theme="dark"] .tr-select:hover,
:root[data-theme="dark"] .li-chip-back:hover { border-color: var(--line-2); }
/* selected filter chips use an ink bg that flips light in dark → sage, clearly "on" */
:root[data-theme="dark"] .tr-chip-f.on,
:root[data-theme="dark"] .li-fchip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* opportunity badges (Laand + My Laand feed rows) */
:root[data-theme="dark"] .opp-warm { background: rgba(201,138,43,0.20); color: #d8a24a; }
:root[data-theme="dark"] .opp-watch { background: rgba(90,107,134,0.26); color: #9fb0cf; }
:root[data-theme="dark"] .opp-hot { background: var(--accent); }

/* pipeline pills */
:root[data-theme="dark"] .li-row .pipe { background: var(--surface-2); color: var(--muted); }
:root[data-theme="dark"] .pipe.contacted,
:root[data-theme="dark"] .pipe.nm { background: rgba(47,109,240,0.22); color: #9bc0ff; }
:root[data-theme="dark"] .pipe.lost { background: rgba(179,64,47,0.26); color: #e79a8d; }

/* dossier — stat cells, signal chips, hero accent, hairlines */
:root[data-theme="dark"] .li-d-cell { border-color: var(--line); }
:root[data-theme="dark"] .li-d-hero,
:root[data-theme="dark"] .li-d-hero.band-cold { border-left-color: var(--line-2); }
:root[data-theme="dark"] .li-chip-s { background: var(--surface-2); }
:root[data-theme="dark"] .li-chip-s.k-occupancy { background: var(--line); color: var(--ink-2); }
:root[data-theme="dark"] .li-chip-s.k-value,
:root[data-theme="dark"] .li-chip-s.k-owner { background: rgba(90,107,134,0.22); color: #9fb0cf; }
:root[data-theme="dark"] .li-chip-s.k-age,
:root[data-theme="dark"] .li-chip-s.k-permit { color: var(--accent-ink); }
:root[data-theme="dark"] .li-chip-s.k-flood { color: #d79a45; }
:root[data-theme="dark"] .li-chip-s.k-tenure { color: #6f9cf5; }
:root[data-theme="dark"] .li-d-row,
:root[data-theme="dark"] .li-permit,
:root[data-theme="dark"] .li-bidrow,
:root[data-theme="dark"] .li-camp,
:root[data-theme="dark"] .zp-foot { border-bottom-color: var(--line); }
:root[data-theme="dark"] .li-h-ct,
:root[data-theme="dark"] .li-d-lm span,
:root[data-theme="dark"] .zp-badge.occ { background: var(--surface-2); }

/* Laand (territory) tooltip + rows */
:root[data-theme="dark"] .tp-badge { background: var(--line-2); color: var(--ink-2); }
:root[data-theme="dark"] .tp-badge.tp-open { color: var(--accent-ink); background: rgba(111,167,101,0.18); }
:root[data-theme="dark"] .tr-row2 .st.yours { color: var(--accent-ink); }
:root[data-theme="dark"] .tr-row2-sub .hot { color: #d98a5e; }
:root[data-theme="dark"] .tr-act-dot.open,
:root[data-theme="dark"] .tr-act-dot.yours { background: var(--accent); }
:root[data-theme="dark"] .tr-bidrow.top .bl,
:root[data-theme="dark"] .tr-co-sumrow.disc { color: var(--accent-ink); }
:root[data-theme="dark"] .tr-row2,
:root[data-theme="dark"] .tr-ladder td,
:root[data-theme="dark"] .tr-bidrow,
:root[data-theme="dark"] .tr-pulse,
:root[data-theme="dark"] .tr-co-item,
:root[data-theme="dark"] .tp-foot { border-bottom-color: var(--line); }
:root[data-theme="dark"] .tr-cta.ghost,
:root[data-theme="dark"] .tr-tip { border-color: var(--line-2); }

/* Mail tab */
:root[data-theme="dark"] .ml-camp.hero .ml-camp-name { color: var(--accent-ink); }
:root[data-theme="dark"] .ml-camp-pill,
:root[data-theme="dark"] .ml-pastbadge { background: var(--surface-2); }
:root[data-theme="dark"] .ml-camp-pill.nm { color: var(--accent-ink); background: rgba(111,167,101,0.18); }
:root[data-theme="dark"] .ml-pill.q { color: #e0a85a; background: rgba(201,138,43,0.20); }
:root[data-theme="dark"] .ml-tr,
:root[data-theme="dark"] .ml-zrow,
:root[data-theme="dark"] .ml-item { border-color: var(--line); }
:root[data-theme="dark"] .ml-lose,
:root[data-theme="dark"] .ml-camp.open,
:root[data-theme="dark"] .ml-list.open { border-color: var(--line-2); }
/* the 4x6 postcard proof is a print preview — keep it white stock in dark too */
:root[data-theme="dark"] .ml-card { background: #fff; border-color: #d8d8d6; }

/* Settings trial badge + onboarding warn box */
:root[data-theme="dark"] .bl-status.trialing { background: rgba(184,134,47,0.18); color: #d8a24a; }
:root[data-theme="dark"] .warn { background: var(--danger-soft); border-color: var(--line-2); }

/* sidebar LIVE dot uses Tailwind config hexes, not tokens → brighten for dark */
:root[data-theme="dark"] .bg-ec-green { background: var(--accent) !important; }
:root[data-theme="dark"] .bg-ec-red { background: var(--danger) !important; }

/* Mobile topbar was a hardcoded LIGHT frosted bar → dark frosted bar in dark mode.
   The brand glyph is a currentColor SVG loaded via <img> (so CSS color can't reach
   it — it paints black); invert it to white in dark wherever it appears (topbar,
   sidebar, auth/standalone pages). */
:root[data-theme="dark"] .topbar { background: rgba(18,19,16,0.86); }
:root[data-theme="dark"] img[src*="laand-glyph"] { filter: invert(1) brightness(1.15); }

/* Map: pulsing ring marker on the focused address (placed by openDossier) */
.map-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px rgba(255,255,255,0.85); pointer-events: none; }
.map-pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--accent); animation: map-pulse 1.5s ease-out infinite; }
@keyframes map-pulse { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(2.6); opacity: 0; } }
:root[data-theme="dark"] .map-pulse { box-shadow: 0 0 0 2px rgba(0,0,0,0.5); }

/* ══ GLOBAL ASSET DECK — shared page scaffolding used by the Mail / My Laand / Laand
      panels (and any future tab). One source of truth: the same page header, mono
      section eyebrow, card container, small modal, field and toast everywhere.
      Complements the existing shared kit: .zpanel (KPIs), .app-tabbar (segments),
      .lz-* (filter chips, search, sortable tables). Token-only → dark-mode safe. ══ */
.pagehead { margin-bottom: 14px; }
.pagehead h1 { font-family: 'Hanken Grotesk', sans-serif; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); margin: 0; }
.pagehead .sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* mono section eyebrow with an optional right-side action */
.sect-lab { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: 700 9.5px 'JetBrains Mono', monospace; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 9px; }
.sect-lab:first-child { margin-top: 0; }
.sect-lab .act { font: 600 10px 'Inter', sans-serif; letter-spacing: 0.02em; text-transform: none;
  color: var(--accent-ink); background: none; border: none; cursor: pointer; padding: 0; }
.sect-lab .act:hover { text-decoration: underline; }

/* bordered content card */
.cardbox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 15px 17px; }

/* ── Shared list primitives (promoted from the My Laand tab so EVERY page uses one
      section rhythm + one row) — .li-h section divider + .li-trow list row. My Laand's
      inline copies still win on that page; every other page (Account, …) uses these. ── */
.li-h { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin: 24px 0 10px; }
.li-h:first-child { margin-top: 2px; }   /* a section header opening a panel doesn't push down */
.li-h.mt { margin-top: 22px; }
/* .li-h.row carries a right-aligned badge or .act button — the sect-lab role, folded
   into li-h so there's ONE section-header class app-wide. */
.li-h.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.li-h .act { font: 600 10px 'Inter', sans-serif; letter-spacing: 0.02em; text-transform: none; color: var(--accent-ink); background: none; border: none; cursor: pointer; padding: 0; }
.li-h .act:hover { text-decoration: underline; }
.li-trow { display: flex; align-items: center; gap: 11px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.li-trow:last-child { border-bottom: none; }
.li-trow.tap { cursor: pointer; }
.li-trow.tap:hover { background: var(--surface-2); }
.li-tdate { flex: 0 0 46px; font-size: 10.5px; font-weight: 700; color: var(--dim); font-variant-numeric: tabular-nums; text-transform: uppercase; letter-spacing: 0.02em; }
.li-tmid { flex: 1 1 0; min-width: 0; }
.li-tmid .ad { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-tmid .sub { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.li-tprice { flex-shrink: 0; font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }

/* segmented control used OUTSIDE a panel head (the in-panel variant keeps its margins) */
.app-tabbar.flush { margin: 0 0 18px; }

/* small centered modal */
.modal-scrim { position: fixed; inset: 0; background: rgba(20,21,15,0.5); display: none; z-index: 90;
  align-items: center; justify-content: center; padding: 20px; }
.modal-scrim.on { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; width: 100%;
  max-width: 400px; padding: 20px; box-shadow: 0 24px 70px rgba(0,0,0,0.3); }
.modal-box h3 { font-family: 'Hanken Grotesk', sans-serif; font-weight: 800; font-size: 17px; margin: 0 0 4px; color: var(--ink); }
.modal-box p { color: var(--muted); font-size: 12px; margin: 0 0 14px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions .go, .modal-actions .no { flex: 1; padding: 10px; border-radius: 9px; font-size: 11.5px; font-weight: 700; cursor: pointer; font-family: inherit; min-height: 44px; }
.modal-actions .go { background: var(--ink); color: var(--surface); border: none; }
.modal-actions .no { background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }

/* text field */
.field { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; font-size: 13px; font-family: inherit; color: var(--ink); background: var(--surface); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.field::placeholder { color: var(--dim); }

/* toast */
.app-toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink);
  color: var(--surface); font-size: 12px; padding: 11px 20px; border-radius: 10px; z-index: 1200;
  max-width: 90vw; box-shadow: 0 8px 28px rgba(0,0,0,0.25); }
.lz-fchip .n { opacity: 0.65; margin-left: 3px; font-variant-numeric: tabular-nums; }

/* phone: chips + search grow to comfortable touch targets on EVERY tab */
@media (max-width: 560px) {
  .lz-fchip { padding: 8px 11px; font-size: 11px; }
  .lz-search { padding: 12px 13px; font-size: 14px; }
}

/* phone: list rows meet the 44px touch minimum everywhere the kit is used */
@media (max-width: 560px) {
  .lz-trow { min-height: 44px; box-sizing: border-box; align-content: center; }
}
