:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1d2330;
  --muted: #667085;
  --border: #e4e7ec;
  --accent: #1a73e8;
  --danger: #d92d20;
  --ok: #067647;
  --warn: #b54708;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 16px; margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.hidden { display: none !important; }
.pre { white-space: pre-wrap; }

/* ---------- top bar (fixed at the top while the page scrolls) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 1500;
  display: flex; align-items: center; gap: 20px; padding: 8px 18px; min-height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: 0 1px 3px rgba(16, 24, 40, .06);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 700; white-space: nowrap; }
.brand span, .brand h1 { color: var(--text); }
.brand:hover { text-decoration: none; }
.brand.big { justify-content: center; }
.brand.big h1 { font-size: 20px; }
.mainnav { display: flex; align-items: center; gap: 4px; flex: 1; flex-wrap: wrap; }
.mainnav > a, .menu-btn {
  padding: 7px 11px; border-radius: 8px; color: var(--text); font: inherit; font-size: 14px;
  background: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.mainnav > a:hover, .menu-btn:hover { background: var(--bg); text-decoration: none; }
.mainnav > a.active, .menu-btn.active { background: #e8f0fe; color: var(--accent); }
.menu-btn { font-weight: 600; letter-spacing: .02em; }
.badge { background: #fef0c7; color: var(--warn); border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* dropdown menus (ADMIN and the user icon) */
.menu { position: relative; }
.menu-panel {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 240px; z-index: 1600;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, .14);
}
.menu.open > .menu-panel { display: block; }
.menu-panel.right { left: auto; right: 0; }
.menu-panel a, .menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px;
  color: var(--text); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left;
}
.menu-panel a:not(:has(small)) { flex-direction: row; }
.menu-panel a:has(small) { flex-direction: column; align-items: flex-start; gap: 1px; }
.menu-panel a small { color: var(--muted); font-size: 12px; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--bg); text-decoration: none; }
.menu-panel a.active { background: #e8f0fe; color: var(--accent); }
.menu-panel form { margin: 0; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }
.menu-panel button { color: var(--danger); }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-head small { color: var(--muted); }
.menu-head .badge { align-self: flex-start; margin: 4px 0 0; }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border); cursor: pointer;
  background: #e8f0fe; color: var(--accent); display: grid; place-items: center; padding: 0;
}
.avatar-btn:hover, .avatar-btn.active, .menu.open > .avatar-btn { border-color: var(--accent); box-shadow: 0 0 0 3px #e8f0fe; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 14px; padding: 7px 13px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text); white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn.wide { width: 100%; }

input[type=text], input[type=search], input[type=password], input[type=number], input[type=tel], input[type=date], select, textarea {
  font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--panel); color: var(--text); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c6dafc; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.inline { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.inline input { width: auto; }
.field-error { color: var(--danger); font-size: 12px; font-weight: 400; }
.form-actions { margin-top: 16px; display: flex; justify-content: flex-end; }

/* ---------- pages ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 20px 18px 40px; }
.page.narrow { max-width: 560px; }
.page.wide { max-width: 1400px; }
/* page fills the screen under the header; only the table scrolls (customers list) */
.page.fill { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-bottom: 18px; }
.card.table-wrap.scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.page.fill .page-head { flex: none; }
.page-head form.inline { flex-wrap: nowrap; }
.page-head form.inline input, .page-head form.inline select { width: auto; min-width: 0; }
.page-head form.inline input[type=search] { width: 220px; }
.table-wrap.scroll thead th { position: sticky; top: 0; z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
.page > h1 { margin-bottom: 8px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.empty-state { padding: 40px 20px; text-align: center; color: var(--muted); margin: 0; }

.flash-wrap:empty { display: none; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash p { margin: 2px 0; }
.flash.success { background: #ecfdf3; color: var(--ok); border: 1px solid #abefc6; }
.flash.error { background: #fef3f2; color: var(--danger); border: 1px solid #fecdca; }

.tag {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: #fff; background: var(--muted);
}

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table select { width: auto; }
.table input[type=password] { width: 150px; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: block; background: var(--bg); }
.disabled-row td { opacity: .55; }
.table .sno { width: 56px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; padding-right: 8px; }
.nowrap { white-space: nowrap; }
.inline-block { display: inline-block; margin: 0; }
.name-edit { flex-wrap: nowrap; }
.name-edit input { width: 150px; padding: 4px 8px; }
.admin-grid .inline input[type=password] { width: 130px; }

/* ---------- roles management ---------- */
.view-grid.admin-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.perm-table th.perm-col { text-align: center; text-transform: none; letter-spacing: 0; font-size: 12px; min-width: 92px; line-height: 1.25; }
.perm-table td.perm-col { text-align: center; }
.perm-table .role-cell { min-width: 220px; }
.perm-table .role-cell input { margin: 6px 0 2px; padding: 5px 8px; font-size: 13px; }
.check { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; }
.check:hover { background: var(--bg); }
.check input { width: 18px; height: 18px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.check input:disabled { cursor: not-allowed; }
.new-role { margin-top: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.perm-pick { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; }
.perm-pick legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.perm-option { display: flex; flex-direction: row; gap: 10px; align-items: flex-start; padding: 6px; border-radius: 8px; cursor: pointer; font-weight: normal; }
.perm-option:hover { background: var(--bg); }
.perm-option input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.perm-option span { display: flex; flex-direction: column; }

/* ---------- login ---------- */
.center-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(380px, 100%); text-align: center; padding: 28px; }
.login-card form { text-align: left; margin: 16px 0; }

/* ---------- map page ---------- */
body.app { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.layout { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--border); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.stat { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); }
.filters { display: flex; flex-direction: column; gap: 8px; padding: 0 12px 12px; border-bottom: 1px solid var(--border); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; cursor: pointer;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); color: var(--text);
}
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.chip[aria-pressed=false] { opacity: .45; text-decoration: line-through; }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list li:hover, .list li.active { background: #eef4ff; }
.list li .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; }
.list li .name { font-weight: 600; font-size: 14px; }
.list li .meta { font-size: 12px; color: var(--muted); }
.list .empty { display: block; color: var(--muted); padding: 24px 12px; text-align: center; cursor: default; }
.map-wrap { position: relative; min-height: 0; }
.map { position: absolute; inset: 0; }
.map-message {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  color: var(--muted); padding: 24px; background: #eef1f5; font-size: 14px; line-height: 1.6;
}
.map-message b { color: var(--text); }

/* Leaflet map bits */
.map, .mini-map, .detail-map { isolation: isolate; }  /* keep Leaflet's z-indexes inside the map */
.leaflet-container { font: inherit; background: #eef1f5; }
.pin-icon { background: none; border: none; }
.pin-icon svg { display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.map-note { background: rgba(255,255,255,.92); padding: 4px 8px; border-radius: 6px; font-size: 12px; color: var(--warn); }
.leaflet-popup-content { margin: 12px 14px; }

.info { font: 13px/1.5 system-ui, sans-serif; color: var(--text); }
.info img { width: 100%; max-height: 150px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; display: block; }
.info h3 { margin: 0 0 4px; font-size: 15px; }
.info .tag { margin: 2px 0 4px; }

/* ---------- customer form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.form-grid > .flash { grid-column: 1 / -1; margin: 0; }
.dropzone {
  position: relative; display: grid; place-items: center; min-height: 200px; border: 2px dashed var(--border);
  border-radius: var(--radius); cursor: pointer; overflow: hidden; background: #fafbfc; text-align: center;
  color: var(--muted); font-weight: 400;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: #f0f6ff; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone img { max-width: 100%; max-height: 280px; display: block; }
.dropzone img:not(.hidden) + span {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6);
  color: #fff; padding: 3px 10px; border-radius: 999px; font-size: 12px;
}
.gps-status { margin-top: 10px; font-size: 13px; padding: 0; border-radius: 8px; }
.gps-status:not(:empty) { padding: 8px 12px; }
.gps-status.ok { background: #ecfdf3; color: var(--ok); }
.gps-status.warn { background: #fffaeb; color: var(--warn); }
.gps-status.err { background: #fef3f2; color: var(--danger); }
.gps-status.busy { background: var(--bg); color: var(--muted); }
.hint { display: block; font-size: 12px; color: var(--ok); margin-top: 4px; font-weight: normal; }
.gps-status.info { background: #eff6ff; color: #1a56db; }
.gps-status.busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -2px;
  border: 2px solid #c6dafc; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* save progress overlay */
.overlay { position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center; background: rgba(16,24,40,.55); }
.overlay-card {
  position: relative; width: min(360px, 90vw); background: var(--panel); border-radius: 16px; padding: 26px 24px 20px;
  text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.overlay-card h2 { margin: 12px 0 12px; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: #e8f0fe; }
.ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .25s ease; }
.ring-pct { position: absolute; top: 26px; left: 0; right: 0; height: 120px; display: grid; place-items: center; font-size: 26px; font-weight: 700; }
.overlay .bar { height: 8px; background: #e8f0fe; border-radius: 4px; overflow: hidden; }
.overlay .bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }
.overlay p { margin: 10px 0 0; min-height: 1.3em; }

.interest { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }

.mini-map { height: 260px; border-radius: var(--radius); margin-top: 12px; background: #eef1f5; position: relative; overflow: hidden; }

/* ---------- customer view ---------- */
.view-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.photo { width: 100%; max-height: 420px; object-fit: contain; border-radius: 10px; background: var(--bg); margin-bottom: 14px; }
.details { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.detail-map { height: 480px; position: relative; }

@media (max-width: 900px) {
  .form-grid, .view-grid { grid-template-columns: 1fr; }
  body.app { height: auto; overflow: auto; }
  .page.fill { flex: none; }
  .card.table-wrap.scroll { max-height: 75vh; }
  .page-head form.inline { flex-wrap: wrap; }
  .form-row, .view-grid.admin-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: 60vh auto; }
  .sidebar { order: 2; border-right: none; border-top: 1px solid var(--border); }
  .map-wrap { order: 1; }
  .list { max-height: none; }
}

/* ---------- confirmation modal ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 14px; width: min(420px, calc(100vw - 32px));
  box-shadow: 0 24px 60px rgba(16, 24, 40, .3); color: var(--text);
}
dialog.modal::backdrop { background: rgba(16, 24, 40, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .14s ease-out; }
@keyframes modal-in { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-box { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
.modal-icon {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 20px; background: #e8f0fe; color: var(--accent);
}
dialog.modal.danger .modal-icon { background: #fee4e2; color: var(--danger); }
.modal-title { font-size: 17px; margin: 2px 0 0; }
.modal-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.modal-input span { color: var(--text); }
.modal-input input { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.08); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }

/* ---------- ADMIN button + approvals bell in the header ---------- */
.mainnav > a.admin-btn {
  margin-left: 6px; font-weight: 600; letter-spacing: .03em; gap: 6px;
  border: 1px solid var(--border); background: var(--panel);
}
.mainnav > a.admin-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--panel); }
.mainnav > a.admin-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.bell {
  position: relative; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); margin-right: 4px;
}
.bell:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.bell-count {
  position: absolute; top: 1px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center;
  border: 2px solid var(--panel);
}

/* ---------- admin area: left navigation + content ---------- */
.admin-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.admin-side { background: var(--panel); border-right: 1px solid var(--border); padding: 16px 10px; overflow-y: auto; }
.admin-side-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 10px 10px; font-weight: 600; }
.admin-links { display: flex; flex-direction: column; gap: 2px; }
.admin-side a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); font-size: 14px;
}
.admin-side a svg { color: var(--muted); flex: none; }
.admin-side a span { flex: 1; }
.admin-side a:hover { background: var(--bg); text-decoration: none; }
.admin-side a.active { background: #e8f0fe; color: var(--accent); font-weight: 600; }
.admin-side a.active svg { color: var(--accent); }
.count { background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }
.admin-main { overflow-y: auto; padding: 20px 24px 40px; min-width: 0; }
.back { display: inline-block; margin-bottom: 10px; font-size: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.tabs a:not(.active) .count { background: var(--muted); }

/* ---------- approvals ---------- */
.pending-flag { display: inline-flex; vertical-align: -3px; cursor: help; }
.pending-text { color: #a15c00; font-size: 12px; font-weight: 600; }
.approved-text { color: var(--ok); font-size: 12px; }
.audit, .audit-cell { font-size: 12px; color: var(--muted); line-height: 1.5; }
.audit { margin-top: 4px; }
.audit-cell b { color: var(--text); font-weight: 600; }
.pending-banner {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: 14px; border-radius: 10px;
  background: #fffaeb; border: 1px solid #fedf89; color: #7a4a00; font-size: 14px;
}
.pending-banner > div { flex: 1; }
.pending-banner .pending-flag svg { width: 26px; height: 26px; }
.approval-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: #7a4a00; background: #fffaeb;
  border: 1px solid #fedf89; border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; }
.change { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #e8f0fe; color: var(--accent); }
.change.create { background: #ecfdf3; color: var(--ok); }
.change.delete { background: #fef3f2; color: var(--danger); }
.status { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #fef0c7; color: #93370d; }
.status.approved { background: #ecfdf3; color: var(--ok); }
.status.rejected { background: #fef3f2; color: var(--danger); }
.status.withdrawn { background: var(--bg); color: var(--muted); }
h1 .change, h1 .status { font-size: 13px; }
.audit-card { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; font-size: 14px; padding: 12px 16px; }
.review-grid { margin-bottom: 16px; }
.compare th[scope=row] { width: 130px; font-size: 13px; color: var(--muted); text-transform: none; letter-spacing: 0; background: none; font-weight: 500; }
.compare tr.changed td { background: #fffaeb; }
.compare tr.changed td:last-child { background: #ecfdf3; font-weight: 600; }
.legend-note { padding: 8px 14px; margin: 0; }
.photo-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.photo-pair figure { margin: 0; }
.photo-pair .photo { margin-bottom: 4px; max-height: 300px; }
.decide { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.decide form, .decide p { margin: 0; }
.decide form:empty { display: none; }
.btn.approve { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.approve:hover { filter: brightness(1.1); color: #fff; }

/* pending marker on map pins */
.pin-icon { position: relative; }
.pin-flag { position: absolute; top: -8px; right: -10px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.info .pending-text { margin: -2px 0 6px; }

@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { border-right: none; border-bottom: 1px solid var(--border); padding: 8px; }
  .admin-links { flex-direction: row; flex-wrap: wrap; }
  .admin-side-title { display: none; }
}

/* ---------- History (activity log) ---------- */
.history-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 14px; margin-bottom: 14px; }
.history-filters label { min-width: 140px; }
.history-filters label.grow { flex: 1; min-width: 200px; }
.history-filters .filter-actions { display: flex; gap: 6px; }
.table.history td { vertical-align: middle; }
.history-filters input, .history-filters select { height: 38px; box-sizing: border-box; margin-top: 4px; }
.details-cell { max-width: 420px; color: var(--muted); }
.act { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--bg); color: var(--text); }
.act.sign_in { background: #f2f4f7; color: #344054; }
.act.customers { background: #e8f0fe; color: var(--accent); }
.act.approvals { background: #ecfdf3; color: var(--ok); }
.act.users { background: #f4ebff; color: #6941c6; }
.act.roles { background: #fef0c7; color: #93370d; }
.act.account { background: #f2f4f7; color: #344054; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.btn.disabled { opacity: .4; pointer-events: none; }
.history-link { margin-left: 6px; font-family: inherit; }

/* roles: grouped header + submit / edit / delete selections */
.perm-table .group-row th { text-align: center; border-bottom: 1px solid var(--border); background: #f2f4f7; }
.perm-table th.group { font-size: 11px; letter-spacing: .06em; }
.perm-table th.actions-group, .perm-table th.action-col, .perm-table td.action-col { background: #f5f8ff; }
.perm-table td.action-col { text-align: center; padding: 8px 6px; }
.mode-select { width: auto; min-width: 150px; font-size: 13px; padding: 5px 8px; font-weight: 600; }
.mode-select.none { color: var(--muted); }
.mode-select.approval { color: #93370d; background: #fffaeb; border-color: #fedf89; }
.mode-select.direct { color: var(--ok); background: #ecfdf3; border-color: #abefc6; }
.action-option { display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px; border-radius: 8px; font-weight: normal; }
.action-option > span { display: flex; flex-direction: column; }

/* wide tables inside cards scroll sideways instead of being cut off (the card's overflow:hidden won before) */
.card.table-wrap { overflow-x: auto; }
/* roles table: role name pinned left, Save / Delete pinned right, so they are always reachable */
.perm-table .pin-left { position: sticky; left: 0; z-index: 3; background: var(--panel); box-shadow: 1px 0 0 var(--border); }
.perm-table .pin-right { position: sticky; right: 0; z-index: 3; background: var(--panel); box-shadow: -1px 0 0 var(--border); white-space: nowrap; }
.perm-table thead .pin-left, .perm-table thead .pin-right { background: #f2f4f7; }
.perm-table td.pin-right .btn + form { margin-left: 4px; }
.perm-table th.perm-col { min-width: 78px; }
.mode-select { min-width: 140px; }
