/* =========================================================================
   OneRanks GBP Manager -- admin design system
   Light UI, fixed left sidebar, card-based content.
   Palette is deliberately close to Google's own product surfaces (this is a
   Google Business Profile tool, so it should feel native to that world), but
   every value below is checked for WCAG 2.1 AA contrast on white:
     #1f2328 / #fff = 15.4:1   #5f6368 / #fff = 5.9:1
     #1a73e8 / #fff =  4.6:1   #c5221f / #fff = 5.9:1
   ========================================================================= */
:root {
  --bg:#f1f3f4;
  --surface:#ffffff;
  --surface-2:#f8f9fa;
  --border:#e0e3e7;
  --border-strong:#c9cdd3;
  --text:#1f2328;
  --text-2:#3c4043;
  --muted:#5f6368;
  --accent:#1a73e8;
  --accent-hover:#1765cc;
  --accent-soft:#e8f0fe;
  --ok:#137333;
  --ok-soft:#e6f4ea;
  --warn:#b06000;
  --warn-soft:#fef7e0;
  --danger:#c5221f;
  --danger-soft:#fce8e6;
  --shadow:0 1px 2px rgba(60,64,67,.10), 0 1px 3px 1px rgba(60,64,67,.06);
  --radius:12px;
  --sidebar-w:252px;
}
* { box-sizing:border-box; }
html, body { height:100%; }
body {
  margin:0; background:var(--bg); color:var(--text);
  font-family:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size:14px; line-height:1.5; -webkit-font-smoothing:antialiased;
}
a { color:var(--accent); }

/* ---------- App shell ---------- */
.app { display:flex; min-height:100vh; }

.sidebar {
  width:var(--sidebar-w); flex:0 0 var(--sidebar-w);
  background:var(--surface); border-right:1px solid var(--border);
  position:sticky; top:0; height:100vh; overflow-y:auto;
  display:flex; flex-direction:column;
}
.sidebar .brand {
  display:flex; align-items:center; gap:10px;
  padding:18px 18px 14px; font-weight:700; font-size:15px; color:var(--text);
  text-decoration:none; letter-spacing:-.01em;
}
.sidebar .brand .mark {
  width:30px; height:30px; flex:0 0 30px; border-radius:8px;
  background:var(--accent); color:#fff; display:flex; align-items:center;
  justify-content:center; font-size:13px; font-weight:700;
}
.sidebar .brand .brand-text small { display:block; font-weight:500; font-size:11px; color:var(--muted); }

.sidebar-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-close-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f3b8b6;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
body.nav-open {
  overflow: hidden;
}

.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  flex: 0 0 38px;
  transition: all 0.15s ease;
}
.mobile-menu-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
.mobile-menu-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.nav-group { padding:6px 0 2px; }
.nav-group > .nav-title {
  padding:10px 22px 6px; font-size:11px; font-weight:600; letter-spacing:.07em;
  text-transform:uppercase; color:#80868b;
}
.nav-item {
  display:flex; align-items:center; gap:11px;
  min-height:44px; padding:10px 12px; margin:1px 10px;   /* 44px keeps every row a comfortable touch target */
  border-radius:9px; color:var(--text-2); text-decoration:none; font-size:14px;
}
.nav-item:hover { background:var(--surface-2); color:var(--text); }
.nav-item:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.nav-item.active { background:var(--accent-soft); color:var(--accent); font-weight:600; }
/* Base for every gbp_icon() anywhere. The icon paths are strokes with no fill,
   so without fill:none they render as solid black blobs -- which is exactly what
   happened in .card-head, the one context that had no rule of its own.
   Specific contexts below only override the size. */
.ico { display:inline-flex; flex:none; }
.ico svg { width:18px; height:18px; display:block; fill:none; stroke:currentColor;
  stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.card-head > .ico svg { width:20px; height:20px; color:var(--muted); }

.nav-item .ico { width:20px; height:20px; flex:0 0 20px; display:block; }
.nav-item .ico svg { width:20px; height:20px; display:block; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.nav-item .label { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.nav-item.soon { color:#80868b; }
.nav-item .chip-soon {
  flex:0 0 auto;
  font-size:9.5px; font-weight:700; letter-spacing:.05em; text-transform:uppercase;
  background:var(--surface-2); color:#80868b; border:1px solid var(--border);
  border-radius:20px; padding:2px 6px;
}
.sidebar-foot { margin-top:auto; border-top:1px solid var(--border); padding:12px 10px; }
.sidebar-foot .who { display:block; padding:0 12px 8px; font-size:12px; color:var(--muted);
  word-break:break-all; text-decoration:none; }
.sidebar-foot a.who:hover { color:var(--accent); text-decoration:underline; }

/* ---------- Content column ---------- */
.content { flex:1; min-width:0; display:flex; flex-direction:column; }
.topbar {
  background:var(--surface); border-bottom:1px solid var(--border);
  min-height:60px; padding:0 28px; display:flex; align-items:center; gap:16px;
  position:sticky; top:0; z-index:20;
}
.topbar h1 { font-size:18px; font-weight:600; margin:0; letter-spacing:-.01em; }
.topbar .spacer { flex:1; }
.admin-main { padding:22px 28px 48px; width:100%; max-width:1320px; }
/* The topbar renders the page's <h1>. Pages written before the sidebar layout
   still print their own duplicate title as the first heading -- hide it (display:none
   also removes it from the accessibility tree, so screen readers get exactly one h1).
   Each page drops its own <h1> as it gets converted. */
.admin-main > h1:first-child { display:none; }

/* Legacy top nav class kept so nothing 404s if an old page still emits it */
.admin-nav { display:none; }

/* ---------- Cards ---------- */
.card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius); padding:20px; margin-bottom:16px; box-shadow:var(--shadow);
}
.card > h1:first-child, .card > h2:first-child, .card > h3:first-child { margin-top:0; }
.card h3 { font-size:15px; font-weight:600; margin:0 0 14px; }
.card-head { display:flex; align-items:center; gap:10px; margin:0 0 14px; }
.card-head h3 { margin:0; flex:1; }
.card-sub { color:var(--muted); font-size:12.5px; margin:0 0 14px; }
.card.accent-danger { border-color:#f3b8b6; background:var(--danger-soft); }
.card.accent-ok { border-color:#b7dfc4; background:var(--ok-soft); }
.card.accent-warn { border-color:#f2d99b; background:var(--warn-soft); }
h1 { font-size:22px; font-weight:600; letter-spacing:-.015em; margin:0 0 16px; }
h2 { font-size:18px; font-weight:600; margin:0 0 10px; }

/* ---------- Layout helpers ---------- */
.grid-2 { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(0,1fr); gap:16px; align-items:start; }
.grid-2 > * { min-width:0; }
.muted { color:var(--muted); }
.small { font-size:12.5px; }

/* ---------- KPI tiles ---------- */
.kpi-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(158px,1fr)); gap:14px; margin-bottom:16px; }
.kpi {
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:16px 18px; box-shadow:var(--shadow); display:flex; flex-direction:column; gap:2px;
}
.kpi .k-label { color:var(--muted); font-size:11.5px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; }
.kpi .k-num { font-size:28px; font-weight:600; line-height:1.15; letter-spacing:-.02em; }
.kpi .k-num.sm { font-size:17px; font-weight:600; }
.kpi .k-sub { font-size:12px; color:var(--muted); }
.kpi.is-alert { border-color:#f2d99b; background:var(--warn-soft); }
.kpi.is-alert .k-num { color:var(--warn); }
.kpi.is-good .k-num { color:var(--ok); }
.kpi.kpi-score { flex-direction:row; align-items:center; gap:14px; }
.kpi-score .k-body { min-width:0; }

/* ---------- Health ring ---------- */
.score-ring {
  width:74px; height:74px; flex:0 0 74px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; position:relative;
  background:conic-gradient(var(--ring-color,var(--accent)) calc(var(--pct,0)*1%), #e6e8eb 0);
}
.score-ring::before { content:""; position:absolute; inset:7px; border-radius:50%; background:var(--surface); }
.score-ring .score-num { position:relative; font-size:21px; font-weight:600; letter-spacing:-.02em; }

/* ---------- Bars ---------- */
.bar-row { display:flex; align-items:center; gap:12px; margin-bottom:10px; font-size:13px; }
.bar-row:last-child { margin-bottom:0; }
.bar-row .bar-label { width:158px; flex:0 0 158px; color:var(--muted); }
.bar-track { flex:1; min-width:0; background:#e9ebee; border-radius:999px; height:8px; overflow:hidden; }
.bar-fill { height:100%; background:var(--accent); border-radius:999px; }
.bar-fill.ok { background:var(--ok); }
.bar-fill.warn { background:#f9ab00; }
.bar-val { width:58px; flex:0 0 58px; text-align:right; font-variant-numeric:tabular-nums; color:var(--text); }

/* ---------- Quick action tiles ---------- */
.quick-actions { display:grid; grid-template-columns:repeat(auto-fit,minmax(132px,1fr)); gap:10px; }
.tile {
  display:flex; flex-direction:column; align-items:flex-start; gap:8px;
  min-height:76px; padding:13px 14px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:10px;
  color:var(--text); text-decoration:none; font-size:13px; font-weight:500; line-height:1.35;
}
.tile:hover { border-color:var(--accent); background:var(--accent-soft); color:var(--accent); }
.tile:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.tile .ico svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.tile.disabled { opacity:.62; cursor:not-allowed; }
.tile.disabled:hover { border-color:var(--border); background:var(--surface-2); color:var(--text); }

/* ---------- Link list (Your business on Google) ---------- */
.link-list { display:flex; flex-direction:column; gap:2px; }
.link-list a, .link-list span.dead {
  display:flex; align-items:center; gap:11px; min-height:44px; padding:9px 10px;
  border-radius:9px; text-decoration:none; color:var(--text); font-size:13.5px;
}
.link-list a:hover { background:var(--surface-2); }
.link-list a:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }
.link-list .ico svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; color:var(--muted); }
.link-list .go { margin-left:auto; color:var(--muted); font-size:16px; line-height:1; }
.link-list span.dead { color:var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; margin-top:6px; }
th, td { text-align:left; padding:11px 12px; border-bottom:1px solid var(--border); font-size:13.5px; vertical-align:top; }
th { color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.04em; white-space:nowrap; }
tbody tr:hover td { background:var(--surface-2); }
tr:last-child td { border-bottom:none; }

/* ---------- Forms ---------- */
label { display:block; font-size:13px; color:var(--muted); margin-bottom:5px; font-weight:500; }
input, textarea, select {
  width:100%; padding:10px 12px; min-height:42px;
  background:var(--surface); border:1px solid var(--border-strong); color:var(--text);
  border-radius:9px; margin-bottom:14px; font-size:14px; font-family:inherit;
}
input:focus, textarea:focus, select:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(26,115,232,.16); }
input:disabled, textarea:disabled, select:disabled { background:var(--surface-2); color:var(--muted); cursor:not-allowed; }
textarea { min-height:96px; resize:vertical; }
select { appearance:none; background-image:url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 11px center; background-size:16px; padding-right:36px; }
input[type=checkbox], input[type=radio] { width:auto; min-height:0; margin:0 8px 0 0; }

.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  min-height:42px; padding:10px 18px; background:var(--accent); color:#fff;
  border:1px solid transparent; border-radius:9px; cursor:pointer;
  text-decoration:none; font-size:14px; font-weight:500; font-family:inherit;
}
.btn:hover { background:var(--accent-hover); }
.btn:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.btn.ghost { background:var(--surface); color:var(--accent); border-color:var(--border-strong); }
.btn.ghost:hover { background:var(--accent-soft); border-color:var(--accent); }
.btn.danger { background:var(--danger); }
.btn.danger:hover { background:#a5201d; }
.btn.sm { min-height:34px; padding:6px 13px; font-size:13px; }
.btn-row { display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

/* ---------- Badges ---------- */
.badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:600; border:1px solid transparent; }
.badge.ok { background:var(--ok-soft); color:var(--ok); border-color:#b7dfc4; }
.badge.warn { background:var(--danger-soft); color:var(--danger); border-color:#f3b8b6; }
.badge.info { background:var(--accent-soft); color:var(--accent); border-color:#c3d9f8; }
.badge.neutral { background:var(--surface-2); color:var(--muted); border-color:var(--border); }

/* ---------- Legacy stat-row (still used by some pages) ---------- */
.stat-row { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:16px; }
.stat .num { font-size:24px; font-weight:600; letter-spacing:-.02em; }
.stat .label { color:var(--muted); font-size:12.5px; }

/* ---------- Profile bar ---------- */
.profile-bar { display:flex; align-items:flex-start; gap:20px; flex-wrap:wrap; }
.profile-bar .p-main { flex:1; min-width:240px; }
.profile-bar h2 { margin:0 0 3px; font-size:19px; }
.profile-bar .p-meta { color:var(--muted); font-size:13px; }
.profile-bar .p-switch { width:250px; flex:0 0 250px; }
.profile-bar .p-switch select { margin-bottom:0; }
.profile-header { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:20px; }

/* ---------- Review block ---------- */
.review-block .stars { color:#f9ab00; letter-spacing:2px; font-size:15px; }
.review-block .rv-text { margin:8px 0 12px; color:var(--text-2); }
.review-block .rv-reply { background:var(--surface-2); border-left:3px solid var(--ok); padding:10px 12px; border-radius:0 8px 8px 0; color:var(--muted); font-size:13px; }

/* ---------- Empty states ---------- */
.empty { text-align:center; padding:26px 16px; color:var(--muted); }
.empty .em-title { color:var(--text); font-weight:600; margin-bottom:5px; font-size:14px; }

/* ---------- Login ---------- */
.login-box { max-width:380px; margin:72px auto; }
body.bare { background:var(--bg); }
body.bare .admin-main { max-width:none; padding:0 20px; }

/* ---------- Info page: one row per field, each with its own editor ---------- */
.info-row { border-bottom:1px solid var(--border); }
.info-row:last-child { border-bottom:none; }
.info-row.is-open { background:var(--surface-2); border-radius:10px; margin:4px -8px; padding:0 8px; }
.info-head { display:flex; align-items:flex-start; gap:14px; padding:16px 4px; }
.info-head > .ico { flex:0 0 20px; margin-top:2px; }
.info-head > .ico svg { width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.7;
  stroke-linecap:round; stroke-linejoin:round; color:var(--muted); display:block; }
.info-body { flex:1; min-width:0; }
.info-label { font-size:12px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin-bottom:4px; }
.info-value { font-size:14px; color:var(--text); word-break:break-word; }
.info-value > div + div { margin-top:3px; }
.info-head > .btn { flex:0 0 auto; margin-top:2px; }
.info-edit { padding:4px 4px 20px 38px; border-top:1px dashed var(--border); margin-top:-4px; }
.info-edit > form > label:first-of-type { margin-top:14px; }
.field-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:0 14px; }
.hours-table { width:auto; margin:0; }
.hours-table td { border:none; padding:1px 16px 1px 0; font-size:13px; }
.hours-table tr:hover td { background:none; }
.id-list { display:flex; flex-direction:column; gap:12px; }
.id-list .id-label { display:block; font-size:11.5px; font-weight:600; letter-spacing:.04em;
  text-transform:uppercase; color:var(--muted); margin-bottom:3px; }
.id-list code { font-size:12.5px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:6px; padding:4px 8px; display:inline-block; word-break:break-all; user-select:all; }

/* ---------- Media: tabs, photo grid, upload queue ---------- */
/* Tabs are real links, so they work without JS and each one is bookmarkable.
   The active one is marked by colour AND weight AND an underline -- colour
   alone would leave a colour-blind user with no way to tell which is current. */
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); margin:0 0 18px; overflow-x:auto; }
.tab { display:inline-block; padding:11px 16px; min-height:44px; box-sizing:border-box;
  color:var(--muted); text-decoration:none; font-size:14px; font-weight:500; white-space:nowrap;
  border-bottom:2px solid transparent; margin-bottom:-1px; border-radius:8px 8px 0 0; }
.tab:hover { color:var(--text); background:var(--surface-2); }
.tab.active { color:var(--accent); font-weight:600; border-bottom-color:var(--accent); }
.tab:focus-visible { outline:2px solid var(--accent); outline-offset:-2px; }

.media-toolbar { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin:0; }
.media-toolbar select { width:auto; min-width:240px; max-width:100%; margin:0; }

/* auto-fill (not auto-fit) so three photos in a wide row stay photo-sized
   instead of stretching to fill the whole card. */
.photo-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(168px, 1fr)); gap:14px; }
.photo { margin:0; background:var(--surface-2); border:1px solid var(--border); border-radius:10px; overflow:hidden; }
.photo-frame { position:relative; }
.photo img { display:block; width:100%; height:132px; object-fit:cover; background:var(--border); }
.photo a:focus-visible img { outline:2px solid var(--accent); outline-offset:-2px; }
.photo-blank { height:132px; display:flex; align-items:center; justify-content:center;
  color:var(--muted); font-size:12px; background:var(--border); }
.photo figcaption { padding:8px 10px 10px; line-height:1.45; }

/* "Video" marker, bottom-left of the frame, away from the delete corner. */
.photo-tag { position:absolute; left:6px; bottom:6px; display:inline-flex; align-items:center; gap:4px;
  padding:3px 8px 3px 6px; border-radius:999px; font-size:11px; font-weight:600; color:#fff;
  background:rgba(0,0,0,.62); pointer-events:none; }
.photo-tag .ico svg { width:13px; height:13px; }

/* Icon-only delete, top-right of the frame.
   Kept permanently visible instead of appearing on hover: there is no hover on a
   phone, and the scrim behind it keeps the icon readable over a light photo. */
.photo-del { position:absolute; top:6px; right:6px; margin:0; }
.icon-btn { display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; padding:0; border-radius:8px; cursor:pointer;
  background:rgba(255,255,255,.92); border:1px solid rgba(0,0,0,.14);
  box-shadow:0 1px 3px rgba(0,0,0,.24); color:var(--muted); }
.icon-btn .ico svg { width:17px; height:17px; stroke:currentColor; }
.icon-btn:hover { background:#fff; color:var(--text); }
.icon-btn.danger:hover { background:var(--danger); border-color:var(--danger); color:#fff; }
.icon-btn:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }

.queue-thumb { width:56px; height:56px; object-fit:cover; border-radius:6px;
  border:1px solid var(--border); display:block; background:var(--surface-2); }
.queue-thumb-video { display:flex; align-items:center; justify-content:center; color:var(--muted); }
.queue-thumb-video .ico svg { width:22px; height:22px; stroke:currentColor; }

/* Photo / Video switch on the upload form. Real radios underneath, so it is
   keyboard- and screen-reader-navigable; the chrome is only paint. */
.seg { display:inline-flex; gap:4px; padding:4px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:10px; margin:0 0 16px; }
.seg-opt { margin:0; font-weight:500; }
.seg-opt input { position:absolute; opacity:0; width:1px; height:1px; }
.seg-opt span { display:inline-flex; align-items:center; gap:7px; padding:8px 15px; min-height:36px;
  box-sizing:border-box; border-radius:7px; font-size:13.5px; color:var(--muted); cursor:pointer; }
.seg-opt span .ico svg { width:16px; height:16px; stroke:currentColor; }
.seg-opt input:checked + span { background:var(--surface); color:var(--text); font-weight:600;
  box-shadow:0 1px 2px rgba(0,0,0,.09); }
.seg-opt input:focus-visible + span { outline:2px solid var(--accent); outline-offset:1px; }

@media (max-width:640px) {
  .photo-grid { grid-template-columns:repeat(auto-fill, minmax(132px, 1fr)); }
  .media-toolbar select { min-width:0; flex:1 1 100%; }
}

/* ---------- Responsive System ---------- */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
  .mobile-menu-btn { display: inline-flex; }
  .sidebar-close-btn { display: inline-flex; }

  /* Off-canvas mobile drawer navigation */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 275px;
    flex: 0 0 275px;
    height: 100vh;
    height: 100dvh;
    z-index: 1000;
    box-shadow: 4px 0 28px rgba(0, 0, 0, 0.22);
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.open {
    transform: translateX(0);
  }

  .content {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    padding: 0 18px;
    min-height: 58px;
    gap: 12px;
  }

  .admin-main {
    padding: 20px 18px 42px;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    min-height: 54px;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 16px;
  }

  .breadcrumb {
    font-size: 13px;
    max-width: calc(100vw - 80px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .breadcrumb a, .breadcrumb span {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-main {
    padding: 14px 12px 36px;
  }

  /* Cards & Headings */
  .card {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 12px;
  }
  h1 { font-size: 19px; margin-bottom: 12px; }
  h2 { font-size: 16px; margin-bottom: 8px; }

  /* Metrics & KPIs */
  .kpi-row, .stat-row, .prof-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .kpi { padding: 12px 14px; }
  .kpi .k-num { font-size: 22px; }
  .stat-card { padding: 14px 12px; }
  .stat-val { font-size: 22px; }

  /* Toolbars & Action Bars */
  .page-head, .biz-toolbar, .posts-header, .schedule-topbar, .reviews-topbar, .insights-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .page-head > *, .biz-toolbar > *, .posts-header > *, .schedule-topbar > *, .reviews-topbar > *, .insights-toolbar > * {
    width: 100%;
  }

  /* Buttons & Actions */
  .btn-row, .prof-actions, .pub-nav-links {
    gap: 8px;
    width: 100%;
  }
  .btn-row > .btn, .prof-actions > .btn, .prof-actions > .btn-primary, .prof-actions > .btn-ghost {
    flex: 1 1 calc(50% - 8px);
    min-width: 120px;
    justify-content: center;
    text-align: center;
  }

  /* Profile Overview */
  .prof-header {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }
  .prof-map {
    width: 100%;
    flex: 0 0 auto;
  }
  .prof-cols {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Auto-responsive Tables */
  .table-wrap, .card:has(> table), .card:has(> .table-clean) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table, .table-clean {
    min-width: 520px;
  }

  /* Bars & Info */
  .bar-row .bar-label { width: 110px; flex: 0 0 110px; }
  .info-edit { padding-left: 4px; }
  .profile-bar .p-switch { width: 100%; flex: 1 1 100%; }

  /* Catalog / Products / Services */
  .catalog-nav { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .catalog-tab { padding: 8px 14px; font-size: 13px; white-space: nowrap; }
  #priceInputsWrap { grid-template-columns: 1fr !important; }

  /* Modals */
  .bulk-modal-card, .qr-modal-card {
    max-width: 95vw;
    padding: 16px;
  }
  .bulk-grid-item {
    grid-template-columns: 1fr;
  }
  .bulk-img-preview {
    height: 140px;
  }
}

@media (max-width: 480px) {
  .kpi-row, .stat-row, .prof-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .stat-card {
    padding: 12px 8px;
  }
  .stat-val {
    font-size: 20px;
  }
  .btn-row > .btn, .prof-actions > .btn, .prof-actions > .btn-primary, .prof-actions > .btn-ghost {
    flex: 1 1 100%;
  }
  .biz-grid, .prod-grid, .posts-grid, .tools-grid {
    grid-template-columns: 1fr;
  }
  .geo-coords {
    grid-template-columns: 1fr;
  }
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media print { .sidebar, .topbar { display:none; } }

/* =========================================================================
   Location-first navigation — new components
   ========================================================================= */

/* --- Location context card in sidebar ------------------------------------ */
.loc-context {
  display:flex; align-items:flex-start; gap:10px;
  margin:10px 12px 0; padding:10px 12px;
  background:var(--accent-soft); border-radius:10px;
  border:1px solid #c2d7fb;
}
.loc-context .ico svg { width:16px; height:16px; color:var(--accent); }
.loc-meta { display:flex; flex-direction:column; gap:1px; overflow:hidden; }
.loc-name {
  font-size:13px; font-weight:600; color:var(--text);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.loc-city { font-size:11px; color:var(--muted); }
.loc-change {
  display:flex; align-items:center; gap:6px;
  margin:4px 12px 10px; padding:4px 10px;
  font-size:12px; color:var(--muted); text-decoration:none;
  border-radius:6px;
}
.loc-change:hover { background:var(--surface-2); color:var(--accent); }
.loc-change .ico svg { width:13px; height:13px; }

/* --- Breadcrumb in topbar ------------------------------------------------ */
.breadcrumb {
  display:flex; align-items:center; gap:6px;
  font-size:14px; flex:1;
}
.breadcrumb a { color:var(--accent); text-decoration:none; }
.breadcrumb a:hover { text-decoration:underline; }
.breadcrumb span { color:var(--muted); }
.breadcrumb span:last-child { color:var(--text); font-weight:600; }
.bc-sep { color:var(--border-strong); font-size:16px; }

/* --- Businesses grid page ------------------------------------------------ */
.biz-toolbar {
  display:flex; align-items:center; gap:12px;
  margin-bottom:24px; flex-wrap:wrap;
}
.biz-search {
  display:flex; align-items:center; gap:6px; flex:1; min-width:200px;
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  padding:6px 12px;
}
.biz-search input {
  flex:1; border:none; outline:none; font-size:14px; background:transparent; color:var(--text);
}
.biz-search button {
  background:none; border:none; cursor:pointer; padding:0; color:var(--muted);
}
.biz-grid {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(300px, 1fr)); gap:20px;
}
.biz-card {
  background:var(--surface); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden;
  display:flex; flex-direction:column;
  transition:box-shadow .15s ease;
}
.biz-card:hover { box-shadow:0 4px 12px rgba(60,64,67,.18); }
.biz-card--suspended { border:2px solid var(--danger); }
.biz-card-map { height:160px; overflow:hidden; background:var(--surface-2); }
.biz-card-map img { width:100%; height:100%; object-fit:cover; }
.biz-card-map-placeholder {
  width:100%; height:100%; display:flex; align-items:center; justify-content:center;
  color:var(--border-strong);
}
.biz-card-map-placeholder .ico svg { width:48px; height:48px; }
.biz-card-body { padding:16px; flex:1; }
.biz-card-header { display:flex; align-items:flex-start; gap:10px; margin-bottom:6px; }
.biz-name { margin:0; font-size:15px; font-weight:600; flex:1; }
.biz-status {
  font-size:11px; font-weight:600; padding:3px 8px; border-radius:20px; white-space:nowrap;
}
.biz-status--active   { background:var(--ok-soft);   color:var(--ok); }
.biz-status--suspended{ background:var(--danger-soft); color:var(--danger); }
.biz-addr { margin:4px 0 8px; font-size:12px; color:var(--muted); }
.biz-meta { margin-bottom:8px; }
.biz-rating { display:flex; align-items:center; gap:5px; font-size:13px; }
.biz-rating .ico svg { width:14px; height:14px; color:#fbbc04; fill:#fbbc04; stroke:#fbbc04; }
.biz-stats {
  display:flex; gap:10px; flex-wrap:wrap;
  padding-top:8px; border-top:1px solid var(--border);
}
.biz-stat {
  display:flex; align-items:center; gap:4px;
  font-size:12px; color:var(--muted);
}
.biz-stat .ico svg { width:13px; height:13px; }
.biz-card-foot { padding:12px 16px; border-top:1px solid var(--border); }
.btn-manage {
  width:100%; padding:9px; border-radius:8px;
  background:var(--accent); color:#fff; border:none; cursor:pointer;
  font-size:13px; font-weight:600; display:flex; align-items:center;
  justify-content:center; gap:6px; transition:background .15s;
}
.btn-manage:hover { background:var(--accent-hover); }
.btn-manage .ico svg { width:15px; height:15px; }

/* --- Profile Overview page ----------------------------------------------- */
.prof-header {
  display:flex; gap:24px; align-items:flex-start;
  background:var(--surface); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:24px; margin-bottom:20px; flex-wrap:wrap;
}
.prof-info { flex:1; min-width:220px; }
.prof-title-row { display:flex; align-items:center; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
.prof-name { margin:0; font-size:22px; font-weight:700; }
.prof-addr, .prof-detail { margin:6px 0; font-size:13px; color:var(--muted); display:flex; align-items:center; gap:6px; }
.prof-addr .ico svg, .prof-detail .ico svg { width:15px; height:15px; }
.prof-rating { display:flex; align-items:center; gap:8px; margin-top:10px; font-size:15px; }
.star--on  { color:#fbbc04; }
.star--off { color:var(--border-strong); }
.prof-map { flex:0 0 320px; border-radius:10px; overflow:hidden; position:relative; }
.prof-map img { width:100%; height:180px; object-fit:cover; display:block; }
.map-link {
  display:block; text-align:center; padding:6px; font-size:12px;
  background:var(--surface-2); color:var(--accent); text-decoration:none;
}
.prof-stats {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(130px,1fr)); gap:14px;
  margin-bottom:20px;
}
.stat-card {
  background:var(--surface); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:18px 20px; text-align:center;
}
.stat-val { font-size:28px; font-weight:700; color:var(--accent); }
.stat-lbl { font-size:12px; color:var(--muted); margin-top:4px; }
.prof-actions {
  display:flex; gap:10px; flex-wrap:wrap; margin-bottom:24px;
}
.prof-cols {
  display:grid; grid-template-columns:1fr 1fr; gap:20px;
}
@media(max-width:860px){ .prof-cols { grid-template-columns:1fr; } }
.prof-col {
  background:var(--surface); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:20px;
}
.col-head {
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:14px; padding-bottom:10px; border-bottom:1px solid var(--border);
}
.col-head h3 { margin:0; font-size:15px; font-weight:600; }
.col-head a { font-size:12px; }

/* Review mini card */
.review-mini { padding:10px 0; border-bottom:1px solid var(--border); }
.review-mini:last-child { border-bottom:none; }
.review-mini-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:4px; }
.rm-name { font-weight:600; font-size:13px; }
.rm-stars .star--on, .rm-stars .star--off { font-size:12px; }
.rm-comment { margin:4px 0; font-size:13px; color:var(--text-2); }
.rm-date { font-size:11px; }
.chip-warn { font-size:11px; padding:2px 7px; border-radius:20px; background:var(--warn-soft); color:var(--warn); font-weight:600; }
.chip-ok   { font-size:11px; padding:2px 7px; border-radius:20px; background:var(--ok-soft);   color:var(--ok);   font-weight:600; }

/* Post mini card */
.post-mini { display:flex; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); align-items:flex-start; }
.post-mini:last-child { border-bottom:none; }
.pm-thumb { width:60px; height:60px; object-fit:cover; border-radius:8px; flex:0 0 60px; }
.pm-body { flex:1; overflow:hidden; }
.chip-type { font-size:10px; font-weight:700; padding:2px 6px; border-radius:4px; background:var(--accent-soft); color:var(--accent); letter-spacing:.04em; }
.pm-text { margin:4px 0 2px; font-size:13px; }
.pm-status { font-size:11px; }

/* --- Empty state ---------------------------------------------------------- */
.empty-state {
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:60px 20px; text-align:center; gap:14px;
}
.empty-icon .ico svg { width:56px; height:56px; color:var(--border-strong); }
.empty-state h2 { margin:0; font-size:18px; }
.empty-state p { margin:0; color:var(--muted); max-width:320px; }

/* --- Alert --------------------------------------------------------------- */
.alert { padding:12px 16px; border-radius:10px; margin-bottom:16px; font-size:13px; }
.alert-info { background:var(--accent-soft); color:var(--accent); border:1px solid #c2d7fb; }

/* --- General buttons ----------------------------------------------------- */
.btn-primary {
  display:inline-flex; align-items:center; gap:7px;
  padding:9px 18px; border-radius:9px;
  background:var(--accent); color:#fff; text-decoration:none;
  font-size:13px; font-weight:600; border:none; cursor:pointer;
  transition:background .15s;
}
.btn-primary:hover { background:var(--accent-hover); color:#fff; }
.btn-ghost {
  display:inline-flex; align-items:center; gap:7px;
  padding:9px 16px; border-radius:9px;
  background:var(--surface); color:var(--text-2); text-decoration:none;
  font-size:13px; font-weight:500; border:1px solid var(--border); cursor:pointer;
  transition:border-color .15s, background .15s;
}
.btn-ghost:hover { border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
.btn-primary .ico svg, .btn-ghost .ico svg { width:15px; height:15px; }
.muted { color:var(--muted); }
