/* Dashboard — light operations console */

/* ---------- login ---------- */
.loginScreen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 22px; background:
    radial-gradient(1200px 600px at 80% -10%, #e7e9ff 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #e3f4ee 0%, transparent 55%),
    var(--bg);
}
.loginCard { width: min(420px, 100%); padding: 30px 28px; }
.loginMark {
  width: 46px; height: 46px; border-radius: 13px; background: var(--brand-600); color: #fff;
  font-weight: 800; font-size: 22px; display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; box-shadow: var(--shadow-2);
}
.loginMark span { color: #c7c4ff; }
.loginTitle { font-size: 24px; margin: 6px 0; }
.loginSub { font-size: 13px; margin: 0 0 18px; }
.pwWrap { position: relative; }
.pwToggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 6px 8px; border-radius: 8px; }
/* Bug #26 — password input needs right padding so text isn't hidden behind toggle */
.pwWrap .input { padding-right: 44px; }
.loginScreen .btn-block { margin-top: 16px; }
.loginErr { color: var(--bad-600); font-size: 13px; min-height: 18px; margin: 10px 0 0; font-weight: 600; }

/* ---------- app shell ---------- */
.app { max-width: 1180px; margin: 0 auto; padding: 0 18px 60px; }
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 18px;
  padding: 14px 4px; background: linear-gradient(var(--bg), rgba(236,239,245,.86));
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brandMark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--brand-600); color: #fff;
  font-weight: 800; font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.brandMark span { color: #c7c4ff; }
.brandMark.hasImage, .loginMark.hasImage {
  background-size: cover;
  background-position: center;
  color: transparent;
}
.brandMark.hasImage span, .loginMark.hasImage span { display: none; }
.brandName { font-weight: 700; font-size: 15px; }
.brandSub { font-size: 10px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; background: var(--surface-2); padding: 4px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.tab {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--ink-500);
  padding: 8px 16px; border-radius: 8px; transition: all .15s ease;
}
.tab:hover { color: var(--ink-900); }
.tab.is-active { background: var(--surface); color: var(--brand-700); box-shadow: var(--shadow-1); }
.topActions { margin-left: auto; }

/* ---------- panels ---------- */
.panel { display: none; padding-top: 22px; }
.panel.is-active { display: block; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.panelHead { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.panelTitle { font-size: 20px; }
.storeSearchCard { padding: 14px 16px; margin-bottom: 12px; }

/* ---------- stat cards ---------- */
.statGrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { appearance: none; text-align: left; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow-1); }
.stat[data-stat-action] { cursor: pointer; }
.stat[data-stat-action]:hover { border-color: var(--brand-600); }
.stat .k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-400); font-weight: 700; }
.stat .v { font-family: var(--font-mono); font-size: 30px; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; }
.stat.accent .v { color: var(--brand-600); }
.stat.ok .v { color: var(--ok-600); }
.stat.bad .v { color: var(--bad-600); }

/* ---------- live grid ---------- */
.liveGrid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.cardHead { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cardHead h3 { font-size: 15px; }

/* feed = signature element: monospace telemetry stream */
.feed { max-height: 560px; overflow: auto; }
.feedRow { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.feedRow:last-child { border-bottom: none; }
.feedTime { font-family: var(--font-mono); font-size: 13px; color: var(--ink-500); }
.feedWho { font-weight: 600; font-size: 14px; }
.feedWhere { font-size: 12.5px; color: var(--ink-400); margin-top: 1px; }
.feedRow.in { box-shadow: inset 3px 0 0 var(--ok-600); }
.feedRow.out { box-shadow: inset 3px 0 0 var(--bad-600); }

.visits { max-height: 560px; overflow: auto; padding: 6px 0; }
.visit { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.visit:last-child { border-bottom: none; }
.visitTop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.visitWho { font-weight: 600; font-size: 14px; }
.visitStore { font-size: 12.5px; color: var(--ink-400); }
.visitTime { font-family: var(--font-mono); font-size: 12px; color: var(--ink-500); margin-top: 4px; }

/* ---------- tables ---------- */
/* Bug #6 — overflow:hidden blocks horizontal scroll on iOS; use auto instead */
.tableWrap { overflow: auto; }
.tableWrap .tbl { display: table; }
.tableWrap .tbl th {
  position: static;
  top: auto;
}
.coordCell { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-500); }
.rowActions { display: flex; gap: 6px; justify-content: flex-end; }
.iconBtn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--surface);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--ink-500);
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
  /* Bug #8 — ensure minimum tap target via min-width/min-height on mobile (handled in @media) */
}
.iconBtn:hover { background: var(--surface-2); color: var(--ink-900); }
.iconBtn.danger:hover { color: var(--bad-600); border-color: var(--bad-600); }

/* ---------- filters ---------- */
.filterBar { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; padding: 14px 16px; margin-bottom: 14px; }
.filterBar .field label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-400); }
#fMin { width: 96px; }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .liveGrid { grid-template-columns: 1fr; }
  .statGrid { grid-template-columns: repeat(2, 1fr); }
}
/* Bug #4 — statGrid single column on very small phones */
@media (max-width: 380px) {
  .statGrid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  /* Bug #1 — topbar: topActions stays on row 1 beside brand, tabs wrap to row 2 */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 4px; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  /* Bug #1 — push topActions to order:2 so it stays beside brand cleanly */
  .topActions { order: 2; margin-left: auto; display: flex; gap: 4px; }
  /* Bug #2 — prevent tab labels from wrapping; use nowrap + ellipsis */
  .tab { flex: 1; text-align: center; font-size: 11px; padding: 6px 4px;
         white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
         min-width: 0; }
  /* Bug #3 — filterBar 5-col → 2-col on mobile, with equal-sized columns */
  .filterBar { grid-template-columns: 1fr 1fr; }
  .filterBar .field.grow { grid-column: span 1; }
  .filterBar label .lbl-detail { display: none; }
  #fMin { width: 100%; }
  /* Bug #5 — panelHead buttons should wrap on mobile */
  .panelHead { flex-direction: column; align-items: flex-start; }
  .panelHead .row { flex-wrap: wrap; width: 100%; }
  /* Bug #6 (retained) — explicit overflow-x on tableWrap */
  .tableWrap { overflow-x: auto; }
  .tbl { min-width: 640px; }
  /* Bug #8 — 44×44px minimum tap target for icon buttons */
  .iconBtn { width: 44px; height: 44px; font-size: 16px; }
  /* Bug #14 — remove nested scroll in feed/visits on mobile */
  .feed, .visits { max-height: none; overflow: visible; }
  /* Bug #15 — reduce map height on mobile */
  .map { height: 260px; }
  /* Bug #13 — fully stacked iconUploadRow on mobile */
  .iconUploadRow { grid-template-columns: 1fr !important; }
  .iconUploadRow em { grid-column: 1 !important; }
}



/* ---------- map ---------- */
.mapCard { margin-bottom: 14px; overflow: hidden; position: relative; }
.mapTools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* Bug #7 — cardHead flex-wrap so mapToggles don't overflow at 430px */
.cardHead { flex-wrap: wrap; gap: 8px; }
/* Bug #7 — mapToggles wraps with smaller gap; limit to 2 per row on mobile via flex-wrap */
.mapToggles { display: flex; gap: 8px; flex-wrap: wrap; }
.mapTgl { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-700); cursor: pointer; white-space: nowrap; }
.mapTgl input { accent-color: var(--brand-600); }
/* Bug #7 — on narrow mobile, collapse mapToggles into a more compact 2-per-row layout */
@media (max-width: 680px) {
  .cardHead h3 { width: 100%; }
  .mapTools { width: 100%; justify-content: flex-start; }
  .mapToggles { gap: 6px; }
  .mapTgl { font-size: 12px; }
}
.map { height: 420px; width: 100%; background: var(--surface-2); }
body.dark .map .leaflet-tile { filter: brightness(.74) contrast(1.08) saturate(.82); }
.mapCard.fs { position: fixed; inset: 12px; z-index: 7000; margin: 0; box-shadow: var(--shadow-3); }
.mapCard.fs .map { height: calc(100vh - 84px); }
.pickMap { height: 220px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); margin-top: 8px; }

/* leaflet marker chips */
.mk { border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.mk-in { background: var(--ok-600); }
.mk-out { background: var(--bad-600); }
.mk-store { background: var(--brand-600); border-radius: 4px; transform: rotate(45deg); }
.mkStorePretty {
  width: 20px;
  height: 20px;
  border-radius: 999px 999px 999px 4px;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.34);
  display: grid;
  place-items: center;
}
.mkStorePretty span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.95);
  display: block;
}
.mk-store-active { background: #86efac; }
.mk-store-hold { background: #fde68a; }
.mk-store-blacklist { background: #ef4444; }
.mk-store-deleted { background: #9ca3af; }
.mk-store-filtered {
  width: 24px;
  height: 24px;
  background: #ff2da1;
  border-color: #f8fafc;
  box-shadow:
    0 0 0 4px rgba(255,45,161,.28),
    0 0 0 8px rgba(34,211,238,.14),
    0 8px 18px rgba(2,6,23,.42);
}
.mk-store-filtered span {
  width: 8px;
  height: 8px;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(8,13,28,.22);
}
.storeClusterIcon {
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(15,23,42,.92);
  color: #f8fafc;
  border: 2px solid rgba(148,163,184,.76);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(2,6,23,.32);
}
.storeClusterIcon.is-filtered {
  background: #ff2da1;
  border-color: #f8fafc;
  color: #ffffff;
  box-shadow:
    0 0 0 4px rgba(255,45,161,.28),
    0 10px 24px rgba(2,6,23,.38);
}
.mk-sales {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--sales-color);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.mk-sales span {
  color: #fff;
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}
.myLocPin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #38bdf8;
  border: 3px solid #fff;
  box-shadow: 0 0 0 7px rgba(56,189,248,.24), 0 2px 10px rgba(0,0,0,.42);
}
.locateMapControl { margin-right: 12px !important; margin-bottom: -8px !important; }
.locateMapDot {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,.28);
  cursor: pointer;
  position: relative;
}
.locateMapDot::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 999px;
  background: #1a73e8;
  box-shadow: 0 0 0 5px rgba(26,115,232,.16);
}
.locateMapDot::after {
  content: "";
  position: absolute;
  left: 20px;
  top: 5px;
  width: 2px;
  height: 32px;
  background: rgba(26,115,232,.20);
  transform: rotate(45deg);
}
.locateMapDot.is-loading::before { animation: pulseLoc 1s ease-in-out infinite; }
.locateMapDot.is-on::before { background: #0ea5e9; }
@keyframes pulseLoc { 50% { transform: scale(.72); opacity: .62; } }
.mapLegend {
  position: absolute;
  left: 14px;
  bottom: 4px;
  z-index: 500;
  max-width: min(680px, calc(100% - 28px));
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(15,23,42,.78);
  color: #f8fafc;
  box-shadow: 0 12px 30px rgba(0,0,0,.24);
  backdrop-filter: blur(12px);
}
.mapLegend.legend-empty { display: none; }
.mapLegend.is-collapsed {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}
.map .leaflet-bottom.leaflet-right .leaflet-control-attribution {
  margin-right: 58px;
  margin-bottom: -2px;
  opacity: .72;
}
.mapLegend.is-collapsed .legendTitle,
.mapLegend.is-collapsed .legendList { display: none; }
.legendMinBtn {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.mapLegend.is-collapsed .legendMinBtn {
  width: 42px;
  height: 42px;
  border: 0;
  background: rgba(15,23,42,.92);
  color: #38bdf8;
  font-size: 20px;
}
.legendTitle {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(255,255,255,.74);
  padding-top: 2px;
}
.legendList {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  max-height: 74px;
  overflow: auto;
}
.legItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  border: 1px solid rgba(255,255,255,.14);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}
.legItem i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.72);
  flex: 0 0 auto;
}
.pillBtn { cursor: pointer; border: 0; font-family: inherit; }
.photoModalCard { width: min(780px, 100%); }
.photoModalBody { margin-top: 14px; }
.attendancePhotoPreview {
  display: block;
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: var(--r);
  background: #000;
}
.dangerSummary {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-700);
}
.dangerSummary b { color: var(--ink-900); }
.deleteVisitGrid {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 7px 12px;
  margin-top: 10px;
  align-items: center;
}
.deleteVisitGrid span {
  color: var(--ink-500);
  font-size: 12px;
  font-weight: 700;
}
.deleteVisitGrid b {
  min-width: 0;
  overflow-wrap: anywhere;
}
.dangerNote {
  margin-top: 12px;
  color: var(--bad-600);
  font-weight: 700;
}
.dangerCheck {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}
.btn-danger {
  background: var(--bad-600);
  border-color: var(--bad-600);
  color: #fff;
}
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.infoBody { margin-top: 14px; font-size: 14px; line-height: 1.5; color: var(--ink-700); }
.infoGrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.infoGrid > div { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm); padding: 12px; }
.infoGrid b { display: block; font-size: 20px; color: var(--ink-900); }
.infoGrid span { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-500); }
.brandSettingsCard { padding: 18px; }
.brandPreview { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.brandPreview img { width: 58px; height: 58px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); background: var(--surface-2); }
.brandPreviewName { font-size: 20px; font-weight: 800; color: var(--ink-900); }
.brandPreviewSub { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-500); }
.brandForm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.brandForm .grow { grid-column: 1 / -1; }
.iconUploadGrid { display: grid; gap: 8px; }
.iconUploadRow {
  display: grid;
  grid-template-columns: 110px auto auto minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.iconUploadRow span { font-weight: 800; color: var(--ink-900); }
.iconUploadRow em { font-style: normal; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) { .brandForm { grid-template-columns: 1fr; } }
/* Bug #13 — iconUploadRow: use 1fr on mobile for fully stacked layout (not 1fr 1fr) */
@media (max-width: 680px) { .iconUploadRow { grid-template-columns: 1fr; } .iconUploadRow em { grid-column: 1; } }
.leaflet-popup-content { font-family: var(--font-ui); font-size: 13px; }
.leaflet-popup-content b { font-weight: 700; }
.leaflet-popup.storePopup .leaflet-popup-content-wrapper {
  border-radius: 18px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(8,12,24,.96), rgba(22,28,45,.94));
  box-shadow: 0 22px 48px rgba(2,6,23,.38);
  color: #f8fafc;
}
.leaflet-popup.storePopup .leaflet-popup-tip { background: rgba(18,24,38,.96); }
.leaflet-popup.storePopup .leaflet-popup-content { margin: 0; min-width: 260px; }
.storePopupBody { min-width: 246px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.storePopupName { font-size: 16px; font-weight: 900; line-height: 1.18; padding-right: 28px; }
.storePopupCode {
  width: fit-content; max-width: 100%; border-radius: 999px; padding: 4px 9px;
  border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.07);
  font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase;
}
.storePopupMeta { font-size: 12px; font-weight: 650; color: rgba(203,213,225,.82); line-height: 1.45; }
.storePopupMeta a { color: #7dd3fc; font-weight: 850; text-decoration: none; }
.storePopupBody .unknownTools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.storeClusterPopup .clusterCsvLink {
  width: fit-content; border: 0; border-radius: 999px; padding: 7px 12px;
  background: rgba(99,102,241,.22); color: #eef2ff; font-weight: 900; cursor: pointer;
}
.clusterStoreList { max-height: 220px; overflow: auto; padding-right: 4px; display: grid; gap: 4px; }
.clusterStoreItem { font-size: 12.5px; font-weight: 700; color: rgba(248,250,252,.92); }
.clusterStoreItem span { opacity: .72; }
.clusterStoreBtn {
  appearance: none; border: 0; background: none; padding: 4px 0; color: rgba(248,250,252,.94);
  cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 800; text-align: left; width: 100%;
}
.clusterStoreBtn:hover { color: #a5b4fc; text-decoration: underline; }

/* ---------- avg box ---------- */
.avgBox { padding: 6px 0; max-height: 240px; overflow: auto; }
.avgRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--line); }
.avgRow:last-child { border-bottom: none; }
.avgStore { font-size: 13.5px; font-weight: 600; }
.avgBar { flex: 1; height: 6px; border-radius: 4px; background: var(--surface-2); margin: 0 10px; overflow: hidden; }
.avgBar > i { display: block; height: 100%; background: var(--brand-500); }
.avgVal { font-family: var(--font-mono); font-size: 13px; color: var(--ink-700); white-space: nowrap; }

.feedRow { cursor: pointer; }
.feedRow:hover { background: var(--surface-2); }
.visit { cursor: pointer; }
.visit:hover { background: var(--surface-2); }

/* ---------- dark theme ---------- */
body.dark {
  --bg: #0a0e17; --surface: #121826; --surface-2: #1a2233;
  --line: #232c40; --line-strong: #2e3950;
  --ink-900: #eef2fb; --ink-700: #c4cce0; --ink-500: #8a93ad; --ink-400: #6b748f;
}
body.dark .topbar { background: linear-gradient(var(--bg), rgba(10,14,23,.86)); }
body.dark .tab.is-active { background: var(--surface); color: #c7c4ff; }
body.dark .stat:not(.accent):not(.ok):not(.bad) .v { color: var(--ink-900); }
body.dark .map { background: #0b0f18; }

/* unknown-store recommendation in feed */
.unknownLine { margin-top: 5px; font-size: 12px; color: var(--ink-500); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.linkBtn { appearance: none; border: none; background: none; color: var(--brand-600); font-weight: 600; font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.linkBtn:hover { background: var(--brand-50); }

/* viewer (read-only) mode hides mutating controls */
body.is-viewer .rowActions, body.is-viewer .iconBtn { display: none !important; }

/* reminder banner */
.reminder { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--warn-50); color: var(--warn-700); border: 1px solid #f3d9a6; border-radius: var(--r);
  padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }
.reminder[hidden] { display: none !important; }
body.dark .reminder { background: #2a1f08; color: #f3c772; border-color: #4a3712; }
.backupProgress { min-width: 150px; color: var(--ink-500); font-size: 13px; font-weight: 700; }
.backupProgress[hidden] { display: none !important; }

/* duplicate-store warning */
.dupWarn { background: var(--bad-50); border: 1px solid #f3c0c0; border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px; }
body.dark .dupWarn { background: #2a1212; border-color: #5a2222; }
.dupHead { font-weight: 700; color: var(--bad-700); margin-bottom: 8px; font-size: 14px; }
.dupRow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.iconBtn[href] { text-decoration: none; font-size: 12px; width: auto; padding: 0 8px; }

/* red overlap badge on map (toko beririsan) */
.overlapBadge { background: var(--bad-600); color: #fff; font-weight: 800; font-size: 11px;
  min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px;
  border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); padding: 0 4px; }
#roleChip { letter-spacing: .04em; }

/* ---------- Griphub-inspired operations skin ---------- */
body.dark {
  --bg: #05070d;
  --surface: rgba(11, 16, 28, .88);
  --surface-2: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .16);
  --ink-900: #f3f6fc;
  --ink-700: #dfe6f4;
  --ink-500: #9aa8c1;
  --ink-400: #71809d;
  --brand-700: #0e9fb5;
  --brand-600: #31d3e6;
  --brand-500: #62e4ef;
  --brand-50: rgba(49, 211, 230, .14);
  --ok-600: #40d993;
  --ok-50: rgba(64, 217, 147, .13);
  --bad-600: #ff6b78;
  --bad-50: rgba(255, 107, 120, .13);
  --warn-600: #f6c66e;
  --warn-50: rgba(246, 198, 110, .13);
  --r-sm: 14px;
  --r: 20px;
  --r-lg: 24px;
  --shadow-1: 0 18px 48px rgba(0, 0, 0, .22), inset 0 1px 0 rgba(255, 255, 255, .05);
  --shadow-2: 0 24px 70px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 255, 255, .08);
  --shadow-3: 0 32px 90px rgba(0, 0, 0, .64), inset 0 1px 0 rgba(255, 255, 255, .08);
  --font-ui: "Manrope", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body.dark::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(680px 420px at 82% -8%, rgba(49, 211, 230, .15), transparent 68%),
    radial-gradient(720px 520px at -12% 72%, rgba(30, 82, 128, .15), transparent 64%),
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px),
    #05070d;
  background-size: auto, auto, 48px 48px, 48px 48px, auto;
}

body.dark .loginScreen {
  min-height: 100dvh;
  padding: 28px;
  background:
    radial-gradient(640px 360px at 50% 0%, rgba(49, 211, 230, .13), transparent 68%),
    radial-gradient(540px 440px at 100% 100%, rgba(52, 103, 164, .12), transparent 70%),
    transparent;
}
body.dark .loginCard {
  width: min(430px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 26px;
  background: rgba(11, 16, 28, .86);
  box-shadow: 0 32px 90px rgba(0, 0, 0, .62), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(24px);
}
body.dark .loginMark,
body.dark .brandMark {
  background: linear-gradient(145deg, #8cf2f5, #31d3e6 54%, #0b758e);
  color: #041219;
  box-shadow: 0 14px 34px rgba(49, 211, 230, .28);
}
body.dark .loginMark span,
body.dark .brandMark span { color: #073642; }
body.dark .loginTitle { font-size: 30px; letter-spacing: -.045em; }
body.dark .loginSub { color: var(--ink-500); }

body.dark .app { max-width: 1320px; padding-left: 28px; padding-right: 28px; }
body.dark .topbar {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 18px;
  background: rgba(8, 12, 21, .76);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .24), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(18px);
}
body.dark .brandName { color: var(--ink-900); letter-spacing: -.02em; }
body.dark .brandSub { color: var(--ink-500); }
body.dark .tabs {
  background: rgba(255, 255, 255, .035);
  border-color: rgba(255, 255, 255, .08);
  border-radius: 999px;
}
body.dark .tab { color: var(--ink-500); border-radius: 999px; }
body.dark .tab:hover { color: var(--ink-900); background: rgba(255, 255, 255, .045); }
body.dark .tab.is-active {
  color: #05151b;
  background: var(--brand-600);
  box-shadow: 0 8px 24px rgba(49, 211, 230, .22), inset 0 1px 0 rgba(255, 255, 255, .5);
}
body.dark .panel { padding-top: 36px; }
body.dark .dashboardHero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 0 32px;
}
body.dark .dashboardHero h1 {
  margin-top: 12px;
  color: var(--ink-900);
  font-size: clamp(38px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.065em;
  font-weight: 700;
}
body.dark .dashboardHero h1 span { color: var(--brand-600); }
body.dark .dashboardHero p { max-width: 520px; margin: 18px 0 0; color: var(--ink-500); font-size: 15px; line-height: 1.6; }
body.dark .heroSignal {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(64, 217, 147, .22);
  border-radius: 999px;
  color: var(--ink-900);
  background: rgba(64, 217, 147, .07);
  white-space: nowrap;
}
body.dark .heroSignal b, body.dark .heroSignal small { display: block; }
body.dark .heroSignal b { font-size: 13px; }
body.dark .heroSignal small { margin-top: 2px; color: var(--ink-500); font-size: 10px; }
body.dark .signalPulse { width: 9px; height: 9px; border-radius: 50%; background: var(--ok-600); box-shadow: 0 0 0 7px rgba(64, 217, 147, .12); animation: livePulse 1.8s infinite; }
body.dark .panelHead { padding: 14px 16px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 18px; background: rgba(11, 16, 28, .62); }
body.dark .card,
body.dark .filterBar,
body.dark .tableWrap {
  border-color: rgba(255, 255, 255, .11);
  background: rgba(11, 16, 28, .78);
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(18px);
}
body.dark .stat { border-color: rgba(255, 255, 255, .10); background: rgba(17, 24, 39, .72); box-shadow: none; }
body.dark .stat:hover { border-color: rgba(49, 211, 230, .45); transform: translateY(-2px); transition: transform .2s ease, border-color .2s ease; }
body.dark .stat .k { color: var(--ink-500); letter-spacing: .14em; }
body.dark .stat .v { color: var(--ink-900); font-size: 32px; }
body.dark .stat.accent .v { color: var(--brand-600); }
body.dark .cardHead { border-color: rgba(255, 255, 255, .08); }
body.dark .cardHead h3 { letter-spacing: -.025em; }
body.dark .filterBar { padding: 16px; }
body.dark .input, body.dark select.input, body.dark textarea.input {
  border-color: rgba(255, 255, 255, .12);
  background: rgba(5, 7, 13, .58);
  color: var(--ink-900);
}
body.dark .input:focus, body.dark select.input:focus, body.dark textarea.input:focus { border-color: var(--brand-600); box-shadow: 0 0 0 4px rgba(49, 211, 230, .13); }
body.dark .btn { border-radius: 999px; }
body.dark .btn:not(.btn-ghost):not(.btn-danger):not(.btn-quiet) { color: #041219; background: var(--brand-600); box-shadow: 0 12px 28px rgba(49, 211, 230, .18), inset 0 1px 0 rgba(255, 255, 255, .46); }
body.dark .btn-ghost { border-color: rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .045); color: var(--ink-700); }
body.dark .btn-ghost:hover { background: rgba(255, 255, 255, .085); }
body.dark .tbl th { background: #0b101c; color: var(--ink-500); }
body.dark .tbl td { color: var(--ink-700); border-color: rgba(255, 255, 255, .07); }
body.dark .tbl tbody tr:hover { background: rgba(255, 255, 255, .035); }
body.dark .feedRow, body.dark .visit { border-color: rgba(255, 255, 255, .07); }
body.dark .feedRow:hover, body.dark .visit:hover { background: rgba(255, 255, 255, .035); }
body.dark .map { background: #080d16; }

@media (max-width: 760px) {
  body.dark .app { padding-left: 14px; padding-right: 14px; }
  body.dark .topbar { margin-top: 8px; border-radius: 16px; }
  body.dark .dashboardHero { align-items: flex-start; flex-direction: column; padding-bottom: 24px; }
  body.dark .dashboardHero h1 { font-size: clamp(38px, 12vw, 56px); }
  body.dark .heroSignal { width: 100%; justify-content: flex-start; }
  body.dark .panel { padding-top: 24px; }
  body.dark .panelHead { padding: 12px; }
}
