:root {
  --bg: #0f1720;
  --card: #18222d;
  --line: #263444;
  --text: #e6edf3;
  --muted: #8b9bab;
  --accent: #2f9e6e;
  --accent-2: #3fb984;
  --warn: #e0a640;
  --bad: #e5534b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }
h1, h2 { margin: 0 0 12px; font-weight: 600; }
h2 { font-size: 17px; }
code { background: #0b1118; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--bad); min-height: 1em; }
.warn { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

main { max-width: 760px; margin: 0 auto; padding: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; flex-wrap: wrap; }

input, textarea, select { width: 100%; background: #0b1118; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: inherit; }
input:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
input[type=checkbox] { width: auto; }
.num { width: 80px; padding: 6px 8px; }
.small-input { width: 160px; padding: 6px 10px; }
textarea { resize: vertical; margin: 8px 0; }

.btn { background: #233142; color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #2b3b4f; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 9px; font-size: 13px; }

.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.grid-form .btn { grid-column: 1 / -1; }
@media (min-width: 640px) { .grid-form { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); } .grid-form .btn { grid-column: auto; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 340px; display: grid; gap: 12px; }

/* Rezultate / liste */
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .main { min-width: 0; }
.list-item .title { font-weight: 600; }
.clickable { cursor: pointer; }
.clickable:hover .title { color: var(--accent-2); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: #233142; color: var(--muted); }
.pill.on { background: rgba(63,185,132,.15); color: var(--accent-2); }
.pill.off { background: rgba(229,83,75,.12); color: var(--bad); }

/* Detaliu cușcă */
.detail-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.detail-code { font-size: 28px; font-weight: 700; }
.nearest { margin: 12px 0; padding: 12px; border-radius: 10px; background: rgba(63,185,132,.1);
  border: 1px solid rgba(63,185,132,.35); }
.nearest.none { background: rgba(229,83,75,.08); border-color: rgba(229,83,75,.3); }
.nearest .big { font-size: 20px; font-weight: 700; }
.gw-row { display: grid; grid-template-columns: 1fr 120px; gap: 4px 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); align-items: center; }
.gw-row:last-child { border-bottom: 0; }
.gw-row.stale { opacity: .45; }
.gw-row .spark { grid-column: 1 / -1; height: 34px; width: 100%; }

.bar { height: 8px; background: #0b1118; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--bad), var(--warn), var(--accent-2));
  background-size: 300px 100%; transition: width .3s; }
.bar.big { height: 14px; margin: 14px 0 6px; }
.bar.big span { background-size: 100% 100%; }

/* Finder */
.status { font-weight: 600; }
.status.on { color: var(--accent-2); }
.status.off { color: var(--muted); }
.meter-card { text-align: center; }
.meter { --p: 0; --c: var(--muted); width: 220px; height: 220px; margin: 6px auto; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #0b1118 0); display: grid; place-items: center;
  transition: background .3s; }
.meter-inner { width: 180px; height: 180px; border-radius: 50%; background: var(--card); display: grid;
  place-content: center; }
.meter-rssi { font-size: 52px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.meter-dist { margin-top: 6px; font-weight: 600; }
.trend { font-size: 18px; font-weight: 700; min-height: 1.5em; }
.trend.up { color: var(--accent-2); }
.trend.down { color: var(--bad); }

.token-box { margin-top: 10px; padding: 12px; border-radius: 10px; background: #0b1118; border: 1px dashed var(--warn); }
.token-box pre { white-space: pre-wrap; word-break: break-all; margin: 8px 0 0; font-size: 13px; }

/* Tab-uri jos */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: #0b1118;
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; background: none; border: 0; color: var(--muted); padding: 14px 4px; font: inherit; font-size: 14px; cursor: pointer; }
.tabs button.active { color: var(--accent-2); font-weight: 600; box-shadow: inset 0 2px 0 var(--accent-2); }

.toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); background: #233142;
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.toast.error { border-color: var(--bad); color: #ffb4ae; }

/* Tipuri */
.type-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--tc) 18%, transparent);
  color: color-mix(in srgb, var(--tc) 70%, white); border: 1px solid color-mix(in srgb, var(--tc) 45%, transparent); }
.type-badge::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tc); }
.type-badge.big { font-size: 16px; padding: 6px 14px; margin-top: 6px; }
.type-badge .desc { font-weight: 400; opacity: .85; }
input[type=color] { padding: 2px; height: 42px; }
.type-form { margin-top: 10px; }

/* ---------- v3 ---------- */
[data-theme=light] {
  --bg: #f3f5f8; --card: #ffffff; --line: #dde3ea; --text: #17212b; --muted: #5d6b79;
  --accent: #23875b; --accent-2: #23875b;
}
[data-theme=light] input, [data-theme=light] textarea, [data-theme=light] select,
[data-theme=light] code, [data-theme=light] .bar, [data-theme=light] .token-box { background: #f6f8fa; }
[data-theme=light] .btn { background: #eef1f5; }
[data-theme=light] .btn.primary { background: var(--accent); color: #fff; }
[data-theme=light] .tabs { background: #fff; }
[data-theme=light] .pill { background: #eef1f5; }
[data-theme=light] .toast { background: #fff; }
[data-theme=light] .type-badge { color: color-mix(in srgb, var(--tc) 75%, black); }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  max-width: 760px; margin: 0 auto; padding: 12px 12px 0; }
.brand { font-weight: 800; font-size: 18px; }
.login-card input { margin: 0; }
.row.wrap { flex-wrap: wrap; justify-content: flex-end; }
select.small-input { width: auto; }

.asset-icon { display: inline-grid; place-items: center; flex: none; }
.asset-icon svg { width: 100%; height: 100%; }
.asset-icon.sm { width: 40px; height: 40px; }
.asset-icon.xl { width: 120px; height: 120px; }
.detail-card { position: relative; text-align: center; display: grid; justify-items: center; gap: 4px; }
.detail-card .close { position: absolute; top: 12px; right: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stats b { display: block; font-size: 22px; }
.stats span { font-size: 12px; color: var(--muted); }
.tabs button { font-size: 13px; }

/* ---------- v1.0 admin ---------- */
body { padding-bottom: 30px; }
.tabs { position: sticky; top: 0; bottom: auto; left: auto; right: auto; max-width: 1000px; margin: 10px auto 0;
  overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 12px; background: var(--card); z-index: 20; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; padding: 12px 14px; font-size: 14px; white-space: nowrap; }
.tabs button.active { box-shadow: inset 0 -3px 0 var(--accent-2); }
main { max-width: 1000px; }
.topbar { max-width: 1000px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-icon { width: 26px; height: 26px; color: var(--accent-2); display: inline-grid; }
.brand-icon svg, .login-logo svg { width: 100%; height: 100%; }
.login-logo { width: 72px; height: 72px; margin: 0 auto; color: var(--accent-2); }
.login-card { text-align: center; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; margin-left: 4px; }
.pending-banner { margin: 12px 0; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: color-mix(in srgb, var(--warn) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--bad); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.danger-text { color: var(--bad); }
.row.end { justify-content: flex-end; }
.wrap-row { flex-wrap: wrap; gap: 10px; }
.stack { display: grid; gap: 10px; text-align: left; }
.stack label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--muted); padding: 7px 12px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button.active { background: var(--card); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent-2) 20%, transparent); color: var(--accent-2); font-weight: 800; font-size: 14px; }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.list-item.feed { align-items: flex-start; }
.list-item.feed .main { flex: 1; }
.report { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.report .list-item { border-bottom: 0; }
.report-res { text-align: right; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--line); padding: 8px 6px; }
.table td { border-bottom: 1px solid var(--line); padding: 8px 6px; vertical-align: top; }
#bcList, #auditList { overflow-x: auto; }
.strike { text-decoration: line-through; color: var(--muted); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-box { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; display: grid; gap: 12px; }
.cred { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.cred b { font-size: 18px; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.profile-list { max-height: 50vh; overflow-y: auto; }
input[type=date] { padding: 6px 8px; }

/* ---------- settings, maintenance, locations ---------- */
.maint-banner { margin: 12px 0; padding: 12px 14px; border-radius: 12px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: color-mix(in srgb, var(--bad) 14%, var(--card)); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); }
.warn-badge { background: var(--warn); color: #2b2000; }
.switch-row { display: flex !important; align-items: center; gap: 12px; color: var(--text) !important; font-size: 15px !important; }
.switch { appearance: none; -webkit-appearance: none; width: 48px !important; height: 28px; border-radius: 99px; background: var(--line);
  position: relative; flex: none; cursor: pointer; transition: background .2s; padding: 0 !important; border: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch:checked { background: var(--bad); }
.switch:checked::after { transform: translateX(20px); }
.loc-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.loc-row:last-child { border-bottom: 0; }
.loc-row .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); font-weight: 800; font-size: 13px; }
.loc-row .nm { flex: 1; font-weight: 700; }
.loc-row.off .nm { color: var(--muted); text-decoration: line-through; }
.loc-chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }

/* ---------- FindMyCage: import, updates ---------- */
.brand-logo { width: 28px; height: 28px; border-radius: 8px; }
.login-logo img { width: 72px; height: 72px; border-radius: 18px; }
.import-drop { position: relative; border: 2px dashed var(--line); border-radius: 14px; padding: 20px; text-align: center; margin: 10px 0; transition: border-color .2s, background .2s; }
.import-drop.over { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 8%, transparent); }
.import-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.linkish { color: var(--accent-2); font-weight: 700; }
.imp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 14px 0; }
.imp-stats div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.imp-stats b { display: block; font-size: 22px; }
.imp-stats span { font-size: 12px; color: var(--muted); }
.imp-stats .ok b { color: var(--accent-2); } .imp-stats .fix b { color: var(--warn); } .imp-stats .bad b { color: var(--bad); }
.imp-list { max-height: 220px; overflow: auto; font-size: 13px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.imp-list div { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.imp-list div:last-child { border-bottom: 0; }
.progress { height: 10px; border-radius: 99px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s; }
.kind { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 99px; }
.kind.web { background: color-mix(in srgb, #4f8cf7 18%, transparent); color: #7fa9f9; }
.kind.apk { background: color-mix(in srgb, var(--accent-2) 18%, transparent); color: var(--accent-2); }
.rel-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rel-row:last-child { border-bottom: 0; }
.rel-row.off { opacity: .5; }

/* ---------- responsive polish (phones & tablets) ---------- */
.topbar { flex-wrap: wrap; row-gap: 8px; }
.topbar .row { flex-wrap: wrap; justify-content: flex-end; }
#bcList, #auditList { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#bcList .table, #auditList .table { min-width: 560px; }
.list-item > :first-child { flex: 1 1 auto; min-width: 0; }
.list-item > .row:last-child:not(:first-child) { flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; }
input, select, textarea { min-width: 0; max-width: 100%; }
.tabs { scroll-snap-type: x proximity; }
.tabs button { scroll-snap-align: start; }
@media (max-width: 600px) {
  .grid-form { grid-template-columns: 1fr; }
  .list-item { flex-wrap: wrap; align-items: flex-start; }
  .list-item > .row:last-child:not(:first-child) { flex: 1 1 100%; justify-content: flex-start; padding-left: 0; }
  .list-item.feed > .row:last-child { flex-basis: auto; }
  #meName { display: none; }
  .topbar .btn.sm { padding: 6px 10px; }
  .card { padding: 14px; }
  .seg { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
  #impMode { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .brand .muted { display: none; }
  .search-bar { flex-wrap: wrap; }
  .search-bar .btn { flex: 1 1 100%; }
}
.list-item.feed { flex-wrap: nowrap; }
.list-item.feed > :first-child { flex: none; }
.list-item.feed .main { flex: 1 1 auto; min-width: 0; }
.type-badge { white-space: nowrap; }
@media (max-width: 600px) { .list-item.feed > .btn { display: none; } }
.grid-form .btn { align-self: end; }

/* ---------- two-step sign-in ---------- */
.shield { font-size: 40px; text-align: center; line-height: 1; margin-bottom: 4px; }
#totpLogin h1, #enroll h1 { text-align: center; font-size: 22px; margin: 4px 0; }
#totpLogin .muted, #enroll .shield + h1 + .muted { text-align: center; }
.code-input { font-size: 26px !important; letter-spacing: 6px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.enroll-card { width: 100%; max-width: 440px; display: grid; gap: 12px; }
.qr-wrap { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: 14px; width: max-content; margin: 4px auto; }
.qr-wrap img { width: 220px; height: 220px; image-rendering: pixelated; display: block; }
.secret { text-align: center; font-size: 17px; letter-spacing: 1px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; cursor: pointer; word-break: break-all; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2, rgba(127,127,127,.06)); }
.codes span { text-align: center; font-size: 16px; padding: 4px; letter-spacing: 1px; }
.warn-note { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn, #f0b429) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn, #f0b429) 40%, transparent); }
.modal-box .code-input { width: 100%; }
#secReq:checked { background: var(--accent-2); }
@media (max-width: 600px) {
  .loc-row { flex-wrap: wrap; row-gap: 8px; }
  .loc-row .nm { flex: 1 1 auto; }
  .loc-row > .muted { flex: 1 1 100%; order: 3; padding-left: 36px; }
  .loc-row > .btn { order: 4; }
  .loc-row > .btn:first-of-type { margin-left: 36px; }
}
.keybox { white-space: pre-wrap; word-break: break-all; user-select: all; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; }

.pending-banner.alert { border-color: var(--bad, #e5484d); background: color-mix(in srgb, var(--bad, #e5484d) 12%, transparent); }
.pill.warn { background: color-mix(in srgb, var(--warn, #f0b429) 18%, transparent); color: var(--warn, #f0b429); border-color: color-mix(in srgb, var(--warn, #f0b429) 40%, transparent); }

.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 6px 0; }
.check-line input { width: auto; }
.fc-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.fc-dot.red { background: #ef4444; } .fc-dot.green { background: #22c55e; } .fc-dot.caddy { background: #3b82f6; }
.fc-feed { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 2px; font-size: 13.5px; }
.fc-feed b { font-variant-numeric: tabular-nums; }

.seen-line { font-size: 13px; color: var(--muted); margin-top: 6px; }
.batt { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #22c55e 14%, transparent); color: #22c55e; }
.batt.low { background: color-mix(in srgb, #ef4444 14%, transparent); color: #ef4444; }
.trk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 8px 0 12px; }
.trk-stats > div { display: flex; flex-direction: column; align-items: center; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line); text-align: center; }
.trk-stats b { font-size: 20px; } .trk-stats span { font-size: 12px; color: var(--muted); }
.small-h { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 4px 0; }
@media (max-width: 600px) { .trk-stats { grid-template-columns: 1fr 1fr; } }
.names3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 600px) { .names3 { grid-template-columns: 1fr; } }

/* =================================================================== Asset dashboard */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.dash-head h2 { margin: 0; }
.dash-head p { margin: 2px 0 0; }
.dash-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dash-site { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.dash-site select { border: 0; background: transparent; padding: 9px 6px; min-width: 130px; }
.rf-ico { display: inline-block; transition: transform .6s; }
#dashRefresh.spinning .rf-ico { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line);
  animation: kpiIn .5s cubic-bezier(.2,.8,.2,1) both; }
.kpi:nth-child(2) { animation-delay: .06s; } .kpi:nth-child(3) { animation-delay: .12s; } .kpi:nth-child(4) { animation-delay: .18s; }
@keyframes kpiIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.kpi::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent-2); opacity: .9; }
.kpi.good::before { background: #14b8a6; } .kpi.warn::before { background: #f59e0b; } .kpi.muted-k::before { background: #94a3b8; }
.kpi-lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.kpi-num { font-size: 32px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi-bar { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; }
.kpi-bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 1s cubic-bezier(.2,.8,.2,1); background: #14b8a6; }
.kpi.warn .kpi-bar i { background: #f59e0b; } .kpi.muted-k .kpi-bar i { background: #94a3b8; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 14px; margin-bottom: 14px; }
.chart-card { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.chart-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.chart-h.wrap { flex-wrap: wrap; align-items: center; }
.chart-h h3 { margin: 0; font-size: 16px; }
.donut-wrap { position: relative; width: min(240px, 100%); margin: 0 auto; }
.donut-wrap svg { width: 100%; height: auto; display: block; overflow: visible; }
.donut-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.donut-center b { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 12px; color: var(--muted); }
.dseg { transition: stroke-dasharray 1s cubic-bezier(.2,.8,.2,1), stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1), stroke-width .2s, opacity .2s; cursor: pointer; }
.dseg:hover, .dseg.hl { stroke-width: 34; }
#bars { width: 100%; height: auto; display: block; }
.bar-rect { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform .9s cubic-bezier(.2,.8,.2,1), opacity .2s; cursor: pointer; }
.bar-rect.on { transform: scaleY(1); }
.bar-rect:hover { opacity: .8; }
.axis text { fill: var(--muted); font-size: 11px; }
.axis line { stroke: var(--line); }
.bar-lbl { fill: var(--text); font-size: 11px; font-weight: 700; text-anchor: middle; opacity: 0; transition: opacity .4s .6s; }
.bar-lbl.on { opacity: 1; }
.grp-lbl { fill: var(--text); font-size: 13px; font-weight: 800; text-anchor: middle; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; }
.legend button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; padding: 3px 4px; border-radius: 8px; }
.legend button i { width: 10px; height: 10px; border-radius: 3px; }
.legend button.off { opacity: .35; text-decoration: line-through; }
.legend button b { font-variant-numeric: tabular-nums; }
.chart-tip { position: fixed; z-index: 50; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: #0b1117; color: #fff; font-size: 13px; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); transform: translate(-50%, calc(-100% - 12px)); max-width: 240px; }
.chart-tip b { font-weight: 800; }
.site-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 130px; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 10px; cursor: pointer; }
.site-row:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.site-row .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-row .tot { white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); }
.site-row .tot b { color: var(--text); font-size: 14px; }
.sbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: color-mix(in srgb, var(--text) 8%, transparent); }
.sbar i { display: block; height: 100%; width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.st-active { background: #14b8a6; } .st-recent { background: #f59e0b; } .st-stale { background: #64748b; } .st-never { background: #cbd5e1; }
.dash-export { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0; }
.dash-filters .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.dash-filters .chips button { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s; }
.dash-filters .chips button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.dash-filters input { flex: 1 1 200px; max-width: 280px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.red { background: #ef4444; } .dot.green { background: #22c55e; } .dot.caddy { background: #3b82f6; } .dot.other { background: #94a3b8; }
.unseen-wrap { overflow-x: auto; }
table.unseen { width: 100%; border-collapse: collapse; font-size: 14px; }
table.unseen th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.unseen td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.unseen tbody tr { animation: rowIn .35s ease both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
table.unseen .code { font-weight: 800; }
table.unseen .when b { display: block; }
table.unseen .when span { font-size: 12px; color: var(--muted); }
.tpill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap;
  background: color-mix(in srgb, var(--c, #94a3b8) 14%, transparent); color: var(--c, #94a3b8); }
.age { display: inline-block; font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-left: 6px; }
.age.a3 { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.age.a7 { background: color-mix(in srgb, #ef4444 14%, transparent); color: #ef4444; }
.age.never { background: color-mix(in srgb, #94a3b8 20%, transparent); color: var(--muted); }
.src { font-size: 12.5px; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.pager .pg { display: flex; gap: 6px; align-items: center; }
.empty-ok { text-align: center; padding: 28px 10px; color: var(--muted); }
.empty-ok b { display: block; font-size: 28px; margin-bottom: 6px; }
.skel { display: inline-block; height: 12px; width: 70%; border-radius: 6px; background: linear-gradient(90deg, var(--line), color-mix(in srgb, var(--text) 12%, transparent), var(--line)); background-size: 200% 100%; animation: skel 1.2s infinite; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi-num { font-size: 26px; }
  .site-row { grid-template-columns: 84px minmax(0, 1fr) auto; }
  table.unseen thead { display: none; }
  table.unseen, table.unseen tbody, table.unseen tr, table.unseen td { display: block; width: 100%; }
  table.unseen tr { padding: 10px 2px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  table.unseen td { border: 0; padding: 0; }
  table.unseen td.c-code { grid-area: 1 / 1; } table.unseen td.c-type { grid-area: 1 / 2; text-align: right; }
  table.unseen td.c-mac { grid-area: 2 / 1 / 3 / 3; font-size: 12.5px; color: var(--muted); }
  table.unseen td.c-when { grid-area: 3 / 1; } table.unseen td.c-site { grid-area: 3 / 2; text-align: right; font-size: 13px; align-self: start; }
  table.unseen td.c-src { grid-area: 4 / 1 / 5 / 3; font-size: 12px; }
  table.unseen td[colspan] { grid-area: 1 / 1 / 2 / 3; }
  .dash-filters input { max-width: none; }
}

/* =================================================================== Printable report */
.print-report { display: none; }
@media print {
  body.printing > *:not(#printReport) { display: none !important; }
  body.printing { background: #fff !important; color: #111 !important; }
  body.printing #printReport { display: block; }
  @page { margin: 14mm; }
}
.print-report { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #111; background: #fff; }
.pr-head { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid #111; padding-bottom: 10px; margin-bottom: 14px; }
.pr-head img { width: 40px; height: 40px; border-radius: 10px; }
.pr-head h1 { font-size: 20px; margin: 0; }
.pr-head p { margin: 2px 0 0; font-size: 12px; color: #555; }
.pr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.pr-kpis div { border: 1px solid #ccc; border-radius: 8px; padding: 8px 10px; }
.pr-kpis span { display: block; font-size: 10px; text-transform: uppercase; color: #555; letter-spacing: .3px; }
.pr-kpis b { font-size: 20px; }
.print-report h2 { font-size: 14px; margin: 16px 0 6px; }
.print-report table { width: 100%; border-collapse: collapse; font-size: 11px; }
.print-report th, .print-report td { border-bottom: 1px solid #ddd; padding: 5px 6px; text-align: left; }
.print-report th { background: #f3f4f6; font-size: 10px; text-transform: uppercase; }
.print-report tr { break-inside: avoid; }
.print-report .num { text-align: right; font-variant-numeric: tabular-nums; }
.pr-foot { margin-top: 14px; font-size: 10px; color: #666; }
.pr-charts { display: flex; gap: 16px; align-items: center; }
.pr-charts svg { width: 200px; height: auto; }
.pr-charts .bars { width: 360px; }

.print-report .bar-lbl, .print-report .grp-lbl { fill: #111; opacity: 1; }
.print-report .axis text { fill: #555; }
.print-report .axis line { stroke: #ccc; }
.print-report .pr-dt { font-size: 34px; font-weight: 900; fill: #111; }
.print-report .pr-ds { font-size: 13px; fill: #555; }
.print-report .dseg { transition: none; }
.print-report .bar-rect { transition: none; transform: scaleY(1); }

/* =================================================================== Missing MAC / Assign MACs */
.no-mac { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; font-family: inherit; }
.pill-filter { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-size: 13px; font-weight: 700;
  padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .2s, border-color .2s; }
.pill-filter b { background: #f59e0b; color: #111; border-radius: 999px; padding: 0 7px; font-size: 12px; }
.pill-filter.active { background: #f59e0b; border-color: #f59e0b; color: #111; }
.pill-filter.active b { background: #111; color: #fff; }
.pill-filter.none { opacity: .55; }
#assignText { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; margin: 8px 0; }
.as-sum { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; animation: kpiIn .4s ease both; }
.as-chip { font-size: 13px; font-weight: 700; padding: 5px 11px; border-radius: 999px; background: color-mix(in srgb, var(--text) 8%, transparent); }
.as-chip.ok { background: color-mix(in srgb, #22c55e 16%, transparent); color: #16a34a; }
.as-chip.bad { background: color-mix(in srgb, #ef4444 14%, transparent); color: #ef4444; }
.as-chip.warn { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #d97706; }
.as-list { margin-top: 10px; max-height: 260px; overflow: auto; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; }
.as-list > div { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.as-list > div:last-child { border-bottom: 0; }
.as-why { float: right; color: var(--muted); }

/* =================================================================== user permissions */
.perms { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 10px; margin: 0; display: grid; gap: 8px; }
.perms legend { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 0 6px; }
.perms .check-line { align-items: flex-start; }
.perms .check-line span { display: flex; flex-direction: column; }
.perms .check-line small { color: var(--muted); font-size: 12px; }
.perms .perms-admin { display: none; margin: 0; }
.perms.is-admin .check-line { opacity: .45; }
.perms.is-admin .perms-admin { display: block; }
.pill.perm { background: color-mix(in srgb, #8b5cf6 18%, transparent); color: #a78bfa; }

/* =================================================================== Damaged (admin) */
button.kpi { font: inherit; color: var(--text); text-align: left; cursor: pointer; transition: transform .15s, box-shadow .2s, border-color .2s; }
button.kpi:hover { transform: translateY(-2px); }
.dg-k::before { background: #94a3b8; } .dg-k.q::before { background: #ef4444; } .dg-k.a::before { background: #f59e0b; } .dg-k.x::before { background: #64748b; }
.dg-k.on { border-color: var(--accent-2); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-2) 35%, transparent); }
.dg-k.q .kpi-num { color: #ef4444; } .dg-k.a .kpi-num { color: #f59e0b; }
.dg-place { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 44px; grid-template-rows: auto auto; gap: 2px 10px; align-items: center; width: 100%;
  padding: 8px 6px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.dg-place:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.dg-pl-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dg-pl-name small { color: var(--muted); font-weight: 500; }
.dg-pl-bar { height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--text) 8%, transparent); overflow: hidden; }
.dg-pl-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c); transition: width 1s cubic-bezier(.2,.8,.2,1); }
.dg-place > b { text-align: right; font-variant-numeric: tabular-nums; }
.dg-pl-k { grid-column: 1 / -1; font-size: 11.5px; color: var(--c); font-weight: 700; padding-left: 15px; margin-top: -2px; }
.dg-table .c-photo { width: 56px; }
.dg-thumb { display: block; width: 46px; height: 46px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.dg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.dg-thumb:hover img { transform: scale(1.08); }
.dg-nophoto { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 10px; border: 1px dashed var(--line); color: var(--muted); }
.dg-place-txt { font-size: 13px; margin-top: 3px; }
.dg-table .c-act { white-space: nowrap; text-align: right; }
.dg-table .c-act .btn { margin-left: 4px; }
.dg-manage { margin-top: 14px; }
.dg-manage .card { margin: 0; }
.dg-site { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dg-site-h { padding: 7px 12px; font-weight: 800; font-size: 13px; background: color-mix(in srgb, var(--text) 5%, transparent); }
.dg-zone-row { display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dg-zone-row .grow { flex: 1; min-width: 140px; }
.dg-empty { margin: 0; padding: 8px 12px; }
.dg-add { gap: 6px; margin-top: 8px; }
.dg-add input { flex: 1 1 160px; }
#dgStatus, #dgZone { width: auto; min-width: 150px; }
@media (max-width: 760px) {
  table.unseen.dg-table tr { grid-template-columns: 56px 1fr auto; }
  table.dg-table td.c-photo { grid-area: 1 / 1 / 4 / 2; }
  table.dg-table td.c-code { grid-area: 1 / 2; } table.dg-table td.c-type { grid-area: 1 / 3; text-align: right; }
  table.dg-table td.c-mac { grid-area: 2 / 2 / 3 / 4; }
  table.dg-table td.c-place { grid-area: 3 / 2; } table.dg-table td.c-site { grid-area: 3 / 3; text-align: right; }
  table.dg-table td.c-note { grid-area: 4 / 1 / 5 / 4; font-size: 13px; }
  table.dg-table td.c-when { grid-area: 5 / 1 / 6 / 3; }
  table.dg-table td.c-act { grid-area: 5 / 3; }
  .dg-place { grid-template-columns: minmax(0, 1fr) 80px 36px; }
}
.pill.dmg { background: color-mix(in srgb, #ef4444 16%, transparent); color: #ef4444; }
/* print */
.pr-places { flex: 1; display: grid; gap: 5px; font-size: 11px; }
.pr-places div { display: grid; grid-template-columns: 170px 1fr 36px; gap: 8px; align-items: center; }
.pr-places i { display: block; height: 9px; border-radius: 5px; }
.pr-places b { text-align: right; }
.print-report .pr-thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; }

.dg-table td { padding: 8px 6px; }
.dg-table td.c-mac { font-size: 12.5px; white-space: nowrap; }
.dg-table td.c-when { white-space: nowrap; }
.dg-table td.c-when span { display: block; }
.dg-table td.c-note { max-width: 180px; }
.dg-table .tpill { white-space: nowrap; }
.dg-pl b { display: block; font-weight: 800; color: var(--c); }
.dg-pl small { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.dg-acts { display: flex; flex-direction: column; gap: 4px; align-items: stretch; }
.dg-table td.c-act .btn { margin: 0; white-space: nowrap; }
@media (max-width: 760px) { .dg-acts { flex-direction: row; justify-content: flex-end; } }
@media (max-width: 760px) { .dg-table td.c-when span { display: inline; } .dg-table td.c-when span + span::before { content: " · "; } }

.stack label.check-line { display: flex; align-items: flex-start; gap: 10px; color: var(--text); font-size: 14px; }
.stack label.check-line input[type=checkbox] { width: auto; margin-top: 3px; flex: none; }
.dg-pl small { white-space: nowrap; }
@media print {
  body.printing { min-width: 0 !important; width: auto !important; padding: 0 !important; margin: 0 !important; }
  body.printing #printReport { width: 100%; max-width: 100%; box-sizing: border-box; }
}
.print-report table { table-layout: fixed; word-break: break-word; }
.pr-charts > * { min-width: 0; }
.print-report svg { max-width: 100%; }
.pr-charts > svg:first-child { flex: 0 0 180px; width: 180px; }
.pr-charts > .bars { flex: 1 1 auto; width: auto !important; min-width: 0; }
