/* ===========================================================
   Temecula Dental CRM — design system
   =========================================================== */
:root {
  /* dark (default) */
  --bg:            #0a0e17;
  --bg-grad:       radial-gradient(1200px 600px at 78% -10%, #16203a 0%, rgba(10,14,23,0) 60%);
  --surface-1:     #10151f;   /* sidebar / panels */
  --surface-2:     #161c29;   /* cards */
  --surface-3:     #1c2434;   /* inputs / hover */
  --surface-4:     #222c40;
  --border:        rgba(255,255,255,.075);
  --border-strong: rgba(255,255,255,.14);
  --ring:          rgba(91,140,255,.45);

  --text:          #f3f6fc;
  --text-2:        #c2ccdf;   /* readable secondary */
  --text-3:        #8b97b0;   /* muted, still legible */

  --accent:        #5b8cff;
  --accent-2:      #82a6ff;
  --accent-weak:   rgba(91,140,255,.14);
  --gold:          #f5c451;
  --gold-weak:     rgba(245,196,81,.14);
  --green:         #37d99a;
  --amber:         #ffb454;
  --purple:        #b98cff;
  --red:           #ff6f6f;
  --grey:          #7d8aa3;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.5);

  --r-lg: 16px; --r: 12px; --r-sm: 9px; --r-pill: 999px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.4,0,.2,1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg:            #eef1f7;
    --bg-grad:       radial-gradient(1200px 600px at 78% -10%, #dfe8ff 0%, rgba(238,241,247,0) 60%);
    --surface-1:     #ffffff;
    --surface-2:     #ffffff;
    --surface-3:     #eef2f9;
    --surface-4:     #e4eaf4;
    --border:        rgba(18,32,60,.10);
    --border-strong: rgba(18,32,60,.16);
    --ring:          rgba(47,107,240,.35);
    --text:          #131a2b;
    --text-2:        #414d66;
    --text-3:        #6c7890;
    --accent:        #2f6bf0;
    --accent-2:      #1f57d6;
    --accent-weak:   rgba(47,107,240,.10);
    --gold:          #c98a12;
    --gold-weak:     rgba(201,138,18,.12);
    --green:         #12a06a;
    --amber:         #d9820a;
    --purple:        #7d4bd4;
    --red:           #e0483f;
    --grey:          #6c7890;
    --shadow-sm: 0 1px 2px rgba(20,40,80,.08);
    --shadow:    0 8px 24px rgba(20,40,80,.10);
    --shadow-lg: 0 24px 60px rgba(20,40,80,.18);
    color-scheme: light;
  }
}
:root[data-theme="dark"]  { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  background-image: var(--bg-grad);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); background-clip: padding-box; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-rows: auto auto 1fr; height: 100vh; }

/* ---------- Header ---------- */
header.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 11px 20px;
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1100;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(145deg, #5b8cff, #7a5cff);
  box-shadow: 0 4px 14px rgba(91,140,255,.4), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-text h1 { font-size: 15.5px; margin: 0; font-weight: 700; letter-spacing: -0.02em; }
.brand-text span { font-size: 11.5px; color: var(--text-3); font-weight: 450; }

.kpis {
  display: flex; align-items: stretch; gap: 0;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 2px; box-shadow: var(--shadow-sm);
}
.kpi {
  padding: 5px 15px; display: flex; flex-direction: column; align-items: flex-start;
  position: relative; min-width: 58px;
}
.kpi + .kpi::before { content: ""; position: absolute; left: 0; top: 18%; height: 64%; width: 1px; background: var(--border); }
.kpi b { font-size: 18px; font-weight: 750; line-height: 1.1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi small { font-size: 9.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .7px; font-weight: 600; margin-top: 1px; }
.kpi.gold b { color: var(--gold); } .kpi.green b { color: var(--green); } .kpi.accent b { color: var(--accent-2); }

.topbar .spacer { flex: 1; }
.searchbox {
  display: flex; align-items: center; gap: 8px; background: var(--surface-3);
  border: 1px solid var(--border); border-radius: var(--r-pill); padding: 8px 15px; width: 260px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.searchbox input { background: none; border: none; color: var(--text); outline: none; width: 100%; font-size: 13px; }
.searchbox input::placeholder { color: var(--text-3); }
.searchbox svg { color: var(--text-3); flex: none; }

.btn {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff; border: none; border-radius: var(--r-sm);
  padding: 9px 15px; font-size: 12.5px; font-weight: 650; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  box-shadow: 0 3px 10px rgba(91,140,255,.32), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .08s var(--ease), filter .15s var(--ease);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { color: var(--text); border-color: var(--border-strong); filter: none; background: var(--surface-4); }

/* ---------- Filter bar ---------- */
.filterbar {
  display: flex; align-items: center; gap: 12px; padding: 9px 18px;
  background: var(--surface-1); border-bottom: 1px solid var(--border); z-index: 15; min-height: 52px;
}
.fbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; flex: 1; min-width: 0; }
.fbar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.fbar-right .count { font-size: 12px; color: var(--text-3); font-weight: 550; white-space: nowrap; }
.fbar-right .count b { color: var(--text); font-weight: 700; }

.fpill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  border-radius: var(--r-pill); padding: 7px 13px; font-size: 12.5px; font-weight: 600; line-height: 1;
  transition: all .13s var(--ease);
}
.fpill:hover { border-color: var(--border-strong); color: var(--text); }
.fpill .chev { color: var(--text-3); transition: transform .15s var(--ease); }
.fpill.open .chev { transform: rotate(180deg); }
.fpill.on { background: var(--accent-weak); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); color: var(--accent-2); }
.fpill .cnt { background: var(--accent); color: #fff; border-radius: var(--r-pill); font-size: 10.5px; font-weight: 700; min-width: 17px; height: 17px; padding: 0 5px; display: inline-grid; place-items: center; }

.popover {
  position: fixed; z-index: 1200; background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 12px; min-width: 190px; max-width: 300px; max-height: 60vh; overflow-y: auto;
  animation: popIn .14s var(--ease);
}
@keyframes popIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.popover .filter-row { display: flex; flex-direction: column; gap: 6px; }

.filter-label { font-size: 10px; text-transform: uppercase; letter-spacing: .9px; color: var(--text-3); margin-bottom: 7px; font-weight: 700; }
.filter-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Body split ---------- */
.body { display: grid; grid-template-columns: 384px minmax(0, 1fr); min-height: 0; }

/* ---------- List column ---------- */
.listcol { background: var(--surface-1); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; position: relative; z-index: 2; }

.chip {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  border-radius: var(--r-pill); padding: 6px 12px; font-size: 12px; font-weight: 550; user-select: none;
  transition: all .13s var(--ease); line-height: 1;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px var(--accent-weak); }
.chip.tier-a.active { background: var(--gold); border-color: var(--gold); color: #241a00; box-shadow: 0 2px 10px var(--gold-weak); }

select.mini {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--r-sm); padding: 8px 30px 8px 11px; font-size: 12.5px; outline: none; font-weight: 550;
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b97b0' stroke-width='2.5' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center;
}
select.mini:hover { border-color: var(--border-strong); }

.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); }
.toolbar .count { font-size: 12px; color: var(--text-3); font-weight: 550; }
.toolbar .count b { color: var(--text); font-weight: 700; }

.list {
  overflow-y: auto; flex: 1; min-height: 0; padding: 10px 12px 28px;
  display: flex; flex-direction: column; gap: 9px;
}

.group-head {
  flex: 0 0 auto; width: 100%;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--gold);
  padding: 14px 4px 4px; display: flex; align-items: center; gap: 8px; font-weight: 750;
}
.group-head::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.group-head.b { color: var(--text-3); }
.group-head.b::before { background: var(--text-3); box-shadow: none; }
.group-head .n { margin-left: auto; color: var(--text-3); font-weight: 650; }

/* ---------- Lead card ---------- */
.card {
  flex: 0 0 auto; width: 100%;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 13px 12px 15px; margin: 0; cursor: pointer;
  position: relative; overflow: hidden;
  transition: border-color .13s var(--ease), transform .08s var(--ease), box-shadow .15s var(--ease);
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--grey); }
.card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.card.bl-new::before { background: var(--accent); } .card.bl-contacted::before { background: var(--amber); }
.card.bl-demo::before { background: var(--purple); } .card.bl-won::before { background: var(--green); } .card.bl-lost::before { background: var(--grey); }

.card-top { display: flex; gap: 11px; align-items: flex-start; }
.avatar {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-size: 13px; font-weight: 750; letter-spacing: -0.02em; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.avatar.a { box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 0 0 2px var(--gold); }
.card-body { min-width: 0; flex: 1; }
.card .name { font-weight: 650; font-size: 13.5px; letter-spacing: -0.01em; line-height: 1.3; color: var(--text);
  display: flex; align-items: center; gap: 6px; }
.card .name .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 11.5px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .subline { font-size: 11.5px; color: var(--text-3); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.card .tags { display: flex; gap: 5px; margin-top: 9px; flex-wrap: wrap; }
.rating { color: var(--gold); font-weight: 650; display: inline-flex; align-items: center; gap: 3px; }
.rating .rc { color: var(--text-3); font-weight: 500; }
.dotsep { color: var(--border-strong); }

.tag { font-size: 10px; padding: 3px 8px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); font-weight: 600; line-height: 1; }
.tag.star { background: var(--gold-weak); color: var(--gold); border-color: transparent; }
.tag.hot { background: rgba(255,111,111,.14); color: var(--red); border-color: transparent; }
.tag.ai { background: rgba(185,140,255,.15); color: var(--purple); border-color: transparent; }
.tag.pms { background: var(--accent-weak); color: var(--accent-2); border-color: transparent; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.s-new { background: var(--accent); } .s-contacted { background: var(--amber); }
.s-demo { background: var(--purple); } .s-won { background: var(--green); } .s-lost { background: var(--grey); }

.empty-state { flex: 0 0 auto; width: 100%; text-align: center; color: var(--text-3); padding: 50px 20px; font-size: 13px; }

/* ---------- Map ---------- */
/* isolation:isolate contains Leaflet's internal z-index stack (panes/controls go up
   to ~1000) inside this box, so nothing from the map can paint over app chrome. */
.mapwrap { position: relative; min-height: 0; isolation: isolate; z-index: 1; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.map-legend {
  position: absolute; bottom: 16px; left: 16px; z-index: 500;
  background: color-mix(in srgb, var(--surface-1) 92%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--r); padding: 11px 14px; font-size: 11.5px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 5px;
}
.map-legend .lg-title { font-weight: 700; font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin-bottom: 3px; }
.map-legend .row { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 500; }
.map-legend .sw { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.leaflet-tooltip.pin-tip { font-weight: 650; background: var(--surface-1); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); border-radius: 7px; padding: 4px 9px; }
.leaflet-tooltip.pin-tip::before { display: none; }

/* ---------- Detail: centered modal popup ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(6,10,20,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .24s var(--ease);
}
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 50%; left: 50%; width: 540px; max-width: calc(100vw - 40px); max-height: 88vh;
  background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, -50%) scale(.96); opacity: 0; pointer-events: none;
  transition: transform .3s var(--ease), opacity .22s var(--ease);
  z-index: 1600; display: flex; flex-direction: column; overflow: hidden;
}
.drawer.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.drawer-body { overflow-y: auto; overflow-x: hidden; flex: 1; padding: 0; overscroll-behavior: contain; }

.dhead { padding: 20px 22px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 3;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, var(--surface-1)), color-mix(in srgb, var(--surface-1) 96%, transparent));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.dhead .top { display: flex; gap: 13px; align-items: flex-start; }
.dhead .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
.dhead h2 { margin: 0; font-size: 19px; line-height: 1.22; letter-spacing: -0.02em; font-weight: 750; }
.dhead .sub { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }
.drawer-close { position: absolute; top: 16px; right: 16px; background: var(--surface-3); border: 1px solid var(--border); color: var(--text-2); border-radius: 9px; width: 32px; height: 32px; font-size: 17px; display: grid; place-items: center; transition: all .13s var(--ease); }
.drawer-close:hover { background: var(--surface-4); color: var(--text); }
.badges { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: var(--r-pill); letter-spacing: -0.01em; }
.badge.tier-A { background: var(--gold-weak); color: var(--gold); }
.badge.tier-B { background: var(--surface-3); color: var(--text-2); }
.badge.tier-X { background: rgba(255,111,111,.13); color: var(--red); }
.badge.hot { background: rgba(255,111,111,.13); color: var(--red); }
.badge.prio { background: var(--accent-weak); color: var(--accent-2); }

.dbody { padding: 6px 22px 40px; }

.linkrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.linkrow a {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 9px 13px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 7px;
  color: var(--text); font-weight: 600; transition: all .13s var(--ease); box-shadow: var(--shadow-sm);
}
.linkrow a:hover { border-color: var(--accent); color: var(--accent-2); text-decoration: none; transform: translateY(-1px); }
.linkrow a svg { color: var(--text-3); }
.linkrow a:hover svg { color: var(--accent); }

/* headline stat tiles in the dossier */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 13px; box-shadow: var(--shadow-sm); }
.stat b { display: block; font-size: 19px; font-weight: 750; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { display: block; font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .5px; font-weight: 650; margin-top: 4px; }
.stat.accent { background: linear-gradient(160deg, var(--accent-weak), var(--surface-2)); border-color: color-mix(in srgb, var(--accent) 30%, var(--border)); }
.stat.accent b { color: var(--accent-2); }
.stat-caption { font-size: 10.5px; color: var(--text-3); margin-top: 8px; font-style: italic; }

.tag.calls { background: rgba(55,217,154,.14); color: var(--green); border-color: transparent; }

.section { margin-top: 24px; }
.section h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .9px; color: var(--text-3); margin: 0 0 11px; font-weight: 750;
  display: flex; align-items: center; gap: 9px; }
.section h3::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.kv { display: grid; grid-template-columns: 124px 1fr; gap: 9px 12px; font-size: 13px; align-items: baseline; }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; word-break: break-word; color: var(--text); font-weight: 500; }
.kv dd.empty { color: var(--text-3); font-style: italic; font-weight: 400; }
.kv dd a { font-weight: 600; }

.pill { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--surface-3); border: 1px solid var(--border); margin: 0 4px 4px 0; font-weight: 600; }
.pill.verify { color: var(--amber); background: rgba(255,180,84,.1); border-color: transparent; }
.pill.confirmed { color: var(--green); background: rgba(55,217,154,.12); border-color: transparent; }

.notesbox { font-size: 12.5px; color: var(--text-2); line-height: 1.6; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.sources-list { font-size: 11.5px; display: flex; flex-direction: column; gap: 4px; }
.sources-list a { word-break: break-all; color: var(--text-3); }
.sources-list a:hover { color: var(--accent-2); }

/* ---------- CRM ---------- */
.crm { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin-top: 24px; box-shadow: var(--shadow-sm); }
.crm h3 { margin: 0 0 13px; }
.crm h3::after { display: none; }
.status-picker { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; margin-bottom: 15px; flex-wrap: wrap; gap: 2px; }
.status-picker button { border: none; background: transparent; color: var(--text-3); border-radius: var(--r-pill); padding: 7px 13px; font-size: 12px; font-weight: 650; transition: all .13s var(--ease); }
.status-picker button:hover { color: var(--text); }
.status-picker button.on.st-new { background: var(--accent); color: #fff; }
.status-picker button.on.st-contacted { background: var(--amber); color: #2a1900; }
.status-picker button.on.st-demo { background: var(--purple); color: #fff; }
.status-picker button.on.st-won { background: var(--green); color: #04220f; }
.status-picker button.on.st-lost { background: var(--grey); color: #fff; }

.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.field-row label { font-size: 12px; color: var(--text-3); width: 78px; font-weight: 550; }
.field-row input[type=date] { background: var(--surface-1); border: 1px solid var(--border); color: var(--text); border-radius: var(--r-sm); padding: 8px 11px; font-size: 12.5px; font-family: inherit; }
.field-row input[type=date]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

.notes textarea { width: 100%; background: var(--surface-1); border: 1px solid var(--border); color: var(--text); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; resize: vertical; min-height: 52px; font-family: inherit; line-height: 1.5; }
.notes textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }
.note-log { margin-top: 11px; display: flex; flex-direction: column; gap: 7px; }
.note-item { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 11px; font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.note-item .ts { font-size: 10.5px; color: var(--text-3); display: block; margin-bottom: 3px; font-weight: 600; }
.note-item .del { float: right; color: var(--text-3); cursor: pointer; font-weight: 700; padding: 0 2px; }
.note-item .del:hover { color: var(--red); }

.footer-note { font-size: 11px; color: var(--text-3); margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); line-height: 1.6; }

/* ---------- Leaflet theming ---------- */
.leaflet-container { background: var(--surface-2) !important; font-family: var(--font); }
.leaflet-bar { border: none !important; box-shadow: var(--shadow) !important; }
.leaflet-bar a { background: var(--surface-1); color: var(--text-2); border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--surface-3); color: var(--text); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface-1) 80%, transparent) !important; color: var(--text-3) !important; font-size: 9.5px; }
.leaflet-control-attribution a { color: var(--text-3) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) { .kpis { display: none; } }
@media (max-width: 920px) {
  .body { grid-template-columns: 1fr; grid-template-rows: 52% 48%; }
  .listcol { border-right: none; border-bottom: 1px solid var(--border); }
  .drawer { width: calc(100vw - 24px); max-height: 90vh; }
  .brand-text span { display: none; }
}
