/* Agroforestry Project Tracker — single stylesheet (no build step) */
:root {
  --brand: #1f6f43;
  --brand-dark: #154d2f;
  --brand-soft: #e7f2ea;
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #fcfcfb;
  --ink: #16201a;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --good: #0ca30c; --good-ink: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 1px 1px rgba(16, 24, 20, .04);
  --sidebar: 236px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  color: var(--ink);
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.02rem; } h4 { font-size: .95rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .tiny { font-size: .76rem; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--brand-dark); color: #dfeee4; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 10px; }
.sidebar .brand .logo { font-size: 26px; }
.sidebar .brand b { display: block; color: #fff; font-size: .98rem; }
.sidebar .brand span { font-size: .74rem; opacity: .75; }
.nav a { display: flex; align-items: center; gap: 10px; color: #dfeee4; padding: 9px 10px; border-radius: 8px; font-size: .93rem; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav .ico { width: 20px; text-align: center; }
.nav .sep { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; opacity: .55; padding: 14px 10px 4px; }
.sidebar .user-box { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
.sidebar .user-box b { color: #fff; display: block; }
.sidebar .user-box a { color: #bfe0c9; margin-right: 12px; }

.content { min-width: 0; }
.main { min-width: 0; padding: 22px 26px 80px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar .title h1 { margin: 0; }
.topbar .title .crumbs { font-size: .82rem; color: var(--muted); margin-bottom: 2px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.mobile-bar { display: none; }
.bottom-nav { display: none; }

/* ---------- Cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; min-width: 0; }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .kpis > .card + .card { margin-top: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: .82rem; }
.grid { display: grid; gap: 14px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; } .spanall { grid-column: 1 / -1; }
.section-gap { margin-top: 14px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: .78rem; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 1.65rem; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.kpi .value small { font-size: .85rem; font-weight: 500; color: var(--ink-2); margin-left: 3px; }
.kpi .foot { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.kpi .bar { height: 6px; background: #eeede8; border-radius: 4px; margin-top: 8px; overflow: hidden; }
.kpi .bar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.kpi.accent { background: linear-gradient(135deg, #1f6f43, #2b8a57); color: #fff; border: none; }
.kpi.accent .label, .kpi.accent .foot, .kpi.accent .value small { color: rgba(255,255,255,.85); }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: .72rem; color: var(--ink-2); gap: 3px; min-width: 130px; flex: 1 1 130px; max-width: 220px; }
.filters select, .filters input { padding: 6px 8px; font-size: .86rem; }
.filters .ftoggle { display: none; }
.filters .chips { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px; padding: 3px 10px; font-size: .78rem; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; padding: 0; font-size: .9rem; }

/* ---------- Forms ---------- */
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31,111,67,.25); border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label, .field { display: block; font-size: .84rem; color: var(--ink-2); font-weight: 500; }
.form-grid label > :is(input, select, textarea), .field > :is(input, select, textarea) { display: block; margin-top: 4px; }
.form-grid label > :is(.input-row, .seg-toggle), .field > :is(.input-row, .seg-toggle) { margin-top: 4px; }
.form-grid label > .hint, .field > .hint { display: block; margin-top: 3px; }
.form-grid h3 { margin: 10px 0 0; color: var(--ink); }
label .req { color: var(--critical); }
.input-row { display: flex; gap: 6px; }
.input-row > * { flex: 1; }
.input-row > .shrink { flex: 0 0 auto; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.hint { font-size: .76rem; color: var(--muted); font-weight: 400; }
.check { display: flex !important; flex-direction: row; align-items: center; gap: 8px; }
.check input { margin-top: 0 !important; }
.check input { width: auto; }

.lines-table { width: 100%; border-collapse: collapse; }
.lines-table th { font-size: .75rem; color: var(--ink-2); text-align: left; padding: 4px 6px; font-weight: 600; }
.lines-table td { padding: 4px 6px; vertical-align: top; }
.lines-table input, .lines-table select { padding: 6px 8px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: #f6f6f3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { color: var(--critical); border-color: #efc4c4; }
.btn.danger:hover { background: #fdf1f1; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: .82rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 1.05rem; padding: 4px 6px; border-radius: 6px; color: var(--ink-2); }
.icon-btn:hover { background: #f0f0ec; }

/* ---------- Tables ---------- */
.table-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.table-tools input[type=search] { max-width: 320px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .87rem; }
table.data th { background: #f7f7f4; text-align: left; font-weight: 600; color: var(--ink-2); font-size: .78rem; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
table.data th.sortable { cursor: pointer; user-select: none; }
table.data th.sortable:hover { color: var(--ink); }
table.data th .arrow { font-size: .7rem; margin-left: 3px; }
table.data td { padding: 8px 10px; border-bottom: 1px solid #efeee9; vertical-align: middle; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafaf7; }
table.data tr.click { cursor: pointer; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: .82rem; color: var(--ink-2); gap: 8px; flex-wrap: wrap; }
.tree-row td:first-child { padding-left: calc(10px + var(--lvl, 0) * 22px); }
.tree-row.lvl0 { background: #fbfbf8; font-weight: 600; }
.tree-toggle { border: 0; background: none; cursor: pointer; width: 18px; font-size: .75rem; color: var(--ink-2); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: #efeee9; color: var(--ink-2); white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.good { background: #e3f4e3; color: var(--good-ink); }
.badge.warning { background: #fff3d6; color: #7a5300; }
.badge.serious { background: #fde8de; color: #96391a; }
.badge.critical { background: #fbe3e3; color: #9b2424; }
.badge.info { background: #e3edfa; color: #1c5cab; }
.badge.brand { background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Detail views ---------- */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; }
.kv div { font-size: .9rem; }
.kv dt, .kv .k { font-size: .74rem; color: var(--muted); }
.kv .v { font-weight: 550; word-break: break-word; }
.profile-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); display: grid; place-items: center; font-weight: 700; font-size: 1.2rem; flex: 0 0 auto; }
.parcel-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; background: #fff; display: grid; grid-template-columns: 84px 1fr; gap: 12px; }
.parcel-card .thumb { width: 84px; height: 84px; border-radius: 8px; background: #eef1ec center/cover; display: grid; place-items: center; font-size: 28px; }
.parcel-card h4 { margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.species-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.species-pill { font-size: .78rem; border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; background: #fbfbf8; }
.species-pill b { font-variant-numeric: tabular-nums; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--brand); }
.timeline .t-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timeline .t-body { font-size: .86rem; color: var(--ink-2); margin-top: 4px; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #eef1ec; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.photo .size { position: absolute; left: 4px; bottom: 4px; background: rgba(0,0,0,.6); color: #fff; font-size: .68rem; padding: 1px 5px; border-radius: 4px; }
.photo .del { position: absolute; right: 4px; top: 4px; background: rgba(255,255,255,.92); border: 0; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; font-size: .8rem; }
.photo-add { border: 2px dashed var(--line-2); border-radius: 8px; aspect-ratio: 1; display: grid; place-items: center; text-align: center; font-size: .78rem; color: var(--ink-2); cursor: pointer; background: #fafaf7; padding: 6px; }
.photo-add:hover { border-color: var(--brand); color: var(--brand); }
.photo-add b { display: block; font-size: 1.5rem; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 3000; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; }

/* ---------- Map ---------- */
.map { height: 460px; border-radius: 8px; border: 1px solid var(--line); z-index: 0; }
.map.tall { height: calc(100vh - 220px); min-height: 420px; }
.map.small { height: 280px; }
.map-legend { background: rgba(255,255,255,.95); padding: 8px 10px; border-radius: 8px; font-size: .78rem; box-shadow: var(--shadow); line-height: 1.6; }
.map-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.map-popup { font-size: .84rem; min-width: 200px; }
.map-popup b { font-size: .92rem; }
.map-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 320px; }
.seg-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg-toggle button { border: 0; background: #fff; padding: 4px 10px; font-size: .78rem; cursor: pointer; color: var(--ink-2); }
.seg-toggle button + button { border-left: 1px solid var(--line-2); }
.seg-toggle button.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: .78rem; color: var(--ink-2); margin-bottom: 6px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Alerts ---------- */
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #efeee9; font-size: .88rem; }
.alert-list li:last-child { border: 0; }
.alert-list .count { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.alert-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: .85rem; flex: 0 0 auto; }
.alert-ico.critical { background: #fbe3e3; } .alert-ico.serious { background: #fde8de; } .alert-ico.warning { background: #fff3d6; } .alert-ico.info { background: #e3edfa; }

/* ---------- Notices, toast, modal ---------- */
.notice { border-radius: 8px; padding: 10px 12px; font-size: .87rem; margin: 10px 0; border: 1px solid; }
.notice.info { background: #eef4fc; border-color: #cfe0f5; color: #1c4f8f; }
.notice.warn { background: #fff8e6; border-color: #f4dfa6; color: #6f4c00; }
.notice.error { background: #fdf0f0; border-color: #f2c9c9; color: #8f2222; }
.notice.success { background: #ecf7ee; border-color: #c4e5cb; color: #1d5b31; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 4000; }
.toast { background: #1d2420; color: #fff; padding: 10px 14px; border-radius: 8px; font-size: .88rem; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 360px; animation: pop .2s ease-out; }
.toast.error { background: #8f2222; } .toast.success { background: var(--brand-dark); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; background: rgba(16,20,18,.45); display: grid; place-items: center; z-index: 2000; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(720px, 100%); max-height: 92vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.spinner { width: 26px; height: 26px; border: 3px solid #dfe5df; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty .big { font-size: 34px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }
.progress { height: 4px; background: #e6e9e4; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .2s; }

/* ---------- Auth ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #e7f2ea 0%, #f4f5f1 55%); }
.auth-card { background: #fff; border-radius: 16px; padding: 28px 26px; width: min(400px, 100%); box-shadow: 0 10px 40px rgba(20,60,35,.12); }
.auth-card h1 { font-size: 1.3rem; }
.auth-card .brand-mark { font-size: 40px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.auth-card label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.check-table { width: 100%; font-size: .85rem; margin: 10px 0; border-collapse: collapse; }
.check-table td { padding: 4px 0; border-bottom: 1px solid #f0f0ec; }
.check-table .ok { color: var(--good-ink); text-align: right; } .check-table .bad { color: var(--critical); text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 1500; transform: translateX(-100%); transition: transform .2s; }
  .app.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1400; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--brand-dark); color: #fff; position: sticky; top: 0; z-index: 1000; }
  .mobile-bar button { background: none; border: 0; color: #fff; font-size: 1.3rem; }
  .mobile-bar b { font-size: .95rem; }
  .main { padding: 14px 12px 90px; }
  .grid.c2, .grid.c3, .grid.c4, .form-grid, .form-grid.c3 { grid-template-columns: 1fr; }
  .span2, .span3 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 1.35rem; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); z-index: 1000; padding-bottom: env(safe-area-inset-bottom); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; padding: 7px 0 6px; font-size: .68rem; color: var(--ink-2); text-decoration: none; }
  .bottom-nav a span { font-size: 1.15rem; }
  .bottom-nav a.active { color: var(--brand); font-weight: 600; }
  .filters label { max-width: none; flex-basis: calc(50% - 8px); min-width: 0; }
  .filters .ftoggle { display: inline-flex; }
  .filters:not(.open) label, .filters:not(.open) [data-reset] { display: none; }
  .topbar .actions { width: 100%; }
  .topbar .title { min-width: 0; }
  .chart-box.tall { height: 380px; }
  .map { height: 360px; }
  .lines-table thead { display: none; }
  .lines-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; }
  .lines-table td { padding: 0; }
  .lines-table td[data-l]::before { content: attr(data-l); display: block; font-size: .7rem; color: var(--muted); }
  .topbar .actions .btn { padding: 7px 10px; }
  .toast-wrap { left: 12px; right: 12px; bottom: 76px; }
}
@media print {
  .sidebar, .bottom-nav, .mobile-bar, .topbar .actions, .filters { display: none !important; }
  .app { display: block; }
}

/* ---------- Donuts & deltas ---------- */
.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 14px; align-items: center; }
.chart-box.donut { height: 170px; }
.donut-legend { list-style: none; margin: 0; padding: 0; font-size: .82rem; }
.donut-legend li { display: grid; grid-template-columns: 12px 1fr auto 42px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid #f0efea; }
.donut-legend li:last-child { border: 0; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-legend b { font-variant-numeric: tabular-nums; font-weight: 600; }
.donut-legend .muted { text-align: right; font-variant-numeric: tabular-nums; }
.delta-up { color: var(--good-ink); font-weight: 650; }
.delta-down { color: var(--critical); font-weight: 650; }
@media (max-width: 1250px) and (min-width: 861px) { .donut-wrap { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .donut-wrap { grid-template-columns: 140px 1fr; } .chart-box.donut { height: 140px; } }

/* ---------- Monitoring map ---------- */
.main:has(.monitor) { padding: 0; }
.monitor { display: grid; grid-template-columns: 320px 1fr; height: 100vh; background: #0f1412; }
.mon-panel { background: #121815; color: #e9efe9; overflow-y: auto; padding: 16px 14px 30px; border-right: 1px solid #222b26; }
.mon-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.mon-head h2 { margin: 0; font-size: 1.45rem; color: #fff; }
.mon-head span { font-size: .78rem; color: #9fb0a5; }
.mon-clear { background: none; border: 0; color: #6fdc8c; cursor: pointer; font-size: .85rem; }
.mon-panel section { background: #1a221e; border-radius: 10px; padding: 12px; margin-top: 10px; }
.mon-panel h4 { margin: 0 0 8px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: #9fb0a5; font-weight: 600; }
.mon-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.mon-stat b { display: block; font-size: 1.25rem; color: #fff; font-weight: 650; font-variant-numeric: tabular-nums; }
.mon-stat span { font-size: .72rem; color: #9fb0a5; }
.mon-note { font-size: .7rem; color: #8a9a90; font-weight: 400; text-transform: none; letter-spacing: 0; }
.mon-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.mon-table th { color: #8a9a90; font-weight: 500; text-align: left; padding: 4px 4px; font-size: .7rem; }
.mon-table td { padding: 6px 4px; border-top: 1px solid #26302b; color: #dfe8e2; vertical-align: top; }
.mon-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.mon-table tbody tr { cursor: pointer; } .mon-table tbody tr:hover td { background: #222c27; }
.mon-bar { height: 3px; background: #26302b; border-radius: 2px; margin-bottom: 4px; }
.mon-bar i { display: block; height: 100%; background: #6fdc8c; border-radius: 2px; }
.mon-map { position: relative; min-width: 0; }
.mon-leaflet { position: absolute; inset: 0; z-index: 0; background: #0f1412; }
.mon-filters { position: absolute; top: 10px; left: 10px; right: 120px; z-index: 500; margin: 0 !important; background: rgba(18,24,21,.88) !important; border-color: #26302b !important; backdrop-filter: blur(4px); }
.mon-filters label { color: #b6c4bb !important; min-width: 110px !important; flex: 1 1 110px !important; }
.mon-filters select { background: #1a221e; color: #fff; border-color: #34403a; }
.mon-filters .btn { background: transparent; color: #6fdc8c; border-color: transparent; }
.mon-filters .chip { background: #24442f; color: #c9f2d4; }
.mon-colorby { position: absolute; bottom: 24px; right: 10px; z-index: 500; }
.mon-bubble div { border-radius: 50%; background: rgba(42,120,214,.85); border: 2px solid #fff; color: #fff; display: grid; place-content: center; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.4); cursor: pointer; line-height: 1.05; }
.mon-bubble b { font-size: .78rem; } .mon-bubble span { font-size: .6rem; opacity: .85; }
.mon-card { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 600; background: rgba(18,24,21,.96); color: #e9efe9; border-radius: 12px; padding: 14px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.mon-card-body { display: grid; grid-template-columns: 110px 1.3fr 1fr 1fr; gap: 16px; align-items: start; }
.mon-card h3 { margin: 2px 0 2px; color: #fff; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mon-card a { color: #6fdc8c; }
.mon-card .btn { color: var(--ink); } .mon-card .btn.primary { color: #fff; }
.mon-card-photo { width: 110px; height: 110px; border-radius: 10px; background: #26302b center/cover; display: grid; place-items: center; font-size: 34px; }
.mon-tag { font-size: .66rem; letter-spacing: .1em; color: #8a9a90; margin-bottom: 4px; }
.mon-line { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; padding: 2px 0; }
.mon-x { position: absolute; top: 8px; right: 10px; background: none; border: 0; color: #9fb0a5; font-size: 1rem; cursor: pointer; }
@media (max-width: 860px) {
  .monitor { grid-template-columns: 1fr; grid-template-rows: auto 70vh; height: auto; }
  .mon-panel { order: 2; }
  .mon-map { order: 1; height: 70vh; }
  .mon-filters { right: 10px; }
  .mon-card-body { grid-template-columns: 80px 1fr; }
  .mon-card-photo { width: 80px; height: 80px; }
  .mon-colorby { bottom: auto; top: 60px; }
}

.kpi-strip { margin-bottom: 4px; }

/* ---------- Demo mode ---------- */
.demo-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: #fff3d6; color: #6f4c00; border-bottom: 1px solid #f4dfa6; padding: 7px 18px; font-size: .82rem; }
.demo-bar b { background: #7a5300; color: #fff; padding: 2px 8px; border-radius: 4px; font-size: .72rem; letter-spacing: .06em; }
.demo-bar a { color: #6f4c00; text-decoration: underline; }
.demo-bar span { flex: 1; min-width: 200px; }
.content:has(.demo-bar) .monitor { height: calc(100vh - 36px); }
.demo-roles { display: grid; gap: 8px; margin-top: 14px; }
.demo-roles button { text-align: left; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; }
.demo-roles button small { color: var(--ink-2); font-weight: 400; white-space: normal; }
.demo-roles button.primary small { color: #dbeee1; }

/* ---------- Locations master ---------- */
.loc-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.loc-col { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 360px; max-height: 70vh; }
.loc-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #f7f7f4; border-radius: var(--radius) var(--radius) 0 0; }
.loc-search { margin: 8px; width: calc(100% - 16px); padding: 6px 8px; font-size: .84rem; }
.loc-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; }
.loc-list li { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 6px; cursor: pointer; font-size: .88rem; }
.loc-list li:hover { background: #f4f6f2; }
.loc-list li.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.loc-list li.off .nm { color: var(--muted); text-decoration: line-through; }
.loc-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-list .acts { display: none; }
.loc-list li:hover .acts, .loc-list li.on .acts { display: inline-flex; }
.loc-list .acts .icon-btn { font-size: .8rem; padding: 2px 4px; }
.loc-empty { color: var(--muted); font-size: .84rem; padding: 14px 12px; cursor: default !important; }
.loc-add { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.loc-add input { padding: 6px 8px; font-size: .84rem; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-chips .chip.off { opacity: .55; text-decoration: line-through; }
.loc-chips .chip button { margin-left: 2px; }
@media (max-width: 1100px) { .loc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .loc-grid { grid-template-columns: 1fr; } .loc-col { min-height: 0; max-height: 50vh; } .loc-list .acts { display: inline-flex; } }
