/* Weien Wong–aligned theme (night default + day) for Business Info Collect */

:root,
[data-theme="night"] {
  --bg: #070b10;
  --bg-elevated: #0d1117;
  --surface: #111820;
  --surface-2: #161b22;
  --ink: #f0f3f6;
  --text: #f0f3f6;
  --muted: #7d8590;
  --line: rgba(48, 54, 61, 0.8);
  --border: rgba(48, 54, 61, 0.8);
  --accent: #2ea043;
  --accent-bright: #3fb950;
  --accent-soft: rgba(46, 160, 67, 0.14);
  --link: #58a6ff;
  --blue: #388bfd;
  --danger: #f85149;
  --danger-soft: rgba(248, 81, 73, 0.14);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(7, 11, 16, 0.82);
  --table-head: #0d1117;
  --row-hover: rgba(56, 139, 253, 0.06);
  --selected: rgba(46, 160, 67, 0.12);
  --map-bg: #0d1117;
  --input-bg: #0d1117;
  --job-ok-bg: rgba(46, 160, 67, 0.12);
  --job-ok-border: rgba(46, 160, 67, 0.35);
  --job-ok-text: #3fb950;
  --banner-from: #0d1117;
  --banner-to: #161b22;
  --progress-fill: #3fb950;
  --radius: 12px;
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", var(--font);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --transition: 0.18s ease;
}

[data-theme="day"] {
  --bg: #f3f6fb;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --ink: #1a2332;
  --text: #1a2332;
  --muted: #6b7c93;
  --line: rgba(180, 190, 205, 0.65);
  --border: rgba(180, 190, 205, 0.65);
  --accent: #1a7f37;
  --accent-bright: #2ea043;
  --accent-soft: rgba(46, 160, 67, 0.1);
  --link: #0969da;
  --blue: #0969da;
  --danger: #cf222e;
  --danger-soft: rgba(207, 34, 46, 0.1);
  --shadow: 0 10px 30px rgba(20, 40, 80, 0.08);
  --header-bg: rgba(255, 255, 255, 0.88);
  --table-head: #f8fafc;
  --row-hover: #f4f7fb;
  --selected: rgba(46, 160, 67, 0.1);
  --map-bg: #e8eef6;
  --input-bg: #ffffff;
  --job-ok-bg: #e8f5ec;
  --job-ok-border: rgba(46, 160, 67, 0.35);
  --job-ok-text: #1a7f37;
  --banner-from: #0d1117;
  --banner-to: #1a7f37;
  --progress-fill: #2ea043;
}

* { box-sizing: border-box; }

/* .btn sets display:inline-flex — must not override the hidden attribute */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(46, 160, 67, 0.12), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(56, 139, 253, 0.1), transparent 50%),
    var(--bg);
}

button, input, select { font: inherit; }

a { color: var(--link); }

.shell { min-height: 100vh; }

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: max(0.9rem, env(safe-area-inset-top, 0px)) max(1.5rem, env(safe-area-inset-right, 0px)) 0.9rem max(1.5rem, env(safe-area-inset-left, 0px));
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
}

.brand-logo,
.logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}

.brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.brand span {
  color: var(--muted);
  font-size: 0.82rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.theme-toggle-btn {
  min-width: 6rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover { border-color: var(--blue); transform: translateY(-1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-dark { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.82rem;
  font-weight: 600;
}
.pill[hidden] { display: none !important; }
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-bright);
  animation: pulse 1.2s ease infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

.live-banner {
  margin: 1rem 1.5rem 0;
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(120deg, var(--banner-from), var(--banner-to));
  color: #ecfeff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(63, 185, 80, 0.25);
}
.live-banner[hidden] { display: none !important; }
.live-banner-main { flex: 1; min-width: 0; }
.live-banner p { margin: 0.25rem 0 0; opacity: 0.85; font-size: 0.9rem; }
.banner-stats { display: flex; gap: 1.1rem; text-align: right; }
.banner-count { text-align: right; }
.banner-count span {
  display: block;
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 500;
}
.banner-count small { opacity: 0.75; }

.progress-track {
  margin-top: 0.65rem;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--progress-fill);
  transition: width 0.35s ease;
}
.progress-bar-pulse { animation: progressPulse 1.1s ease-in-out infinite; }
@keyframes progressPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.progress-label {
  margin: 0.35rem 0 0 !important;
  font-size: 0.78rem !important;
  font-family: var(--mono);
  opacity: 0.8;
}

.user-progress {
  margin-top: 0.75rem;
  padding: 0.85rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--accent-soft);
}
.user-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  color: var(--text);
}
.user-progress .progress-track {
  background: rgba(127, 133, 144, 0.25);
  margin-top: 0.35rem;
}
.user-progress .progress-bar { background: var(--accent); }
.user-progress-meta {
  margin-top: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
}
.user-progress-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-top: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.user-progress-counts strong {
  color: var(--text);
  font-family: var(--mono);
  font-weight: 600;
}

.content {
  padding: 1.25rem max(1.5rem, env(safe-area-inset-right, 0px)) max(2rem, env(safe-area-inset-bottom, 0px)) max(1.5rem, env(safe-area-inset-left, 0px));
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(320px, 400px) 1fr;
  gap: 1.1rem;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.25rem;
  box-shadow: var(--shadow);
}

.fetch-panel h2,
.panel h2 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}
.metrics article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}
.metric-value {
  font-family: var(--mono);
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text);
}

.toolbar {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--input-bg);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(46, 160, 67, 0.25);
  border-color: var(--accent);
}
.btn:focus-visible,
.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  max-height: calc(100vh - 320px);
  max-height: calc(100dvh - 320px);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text);
}
th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
tr:hover td { background: var(--row-hover); }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 1rem !important;
}
.name-cell { font-weight: 600; max-width: 220px; }
.addr-cell { color: var(--muted); max-width: 280px; font-size: 0.86rem; }
td a { color: var(--link); text-decoration: none; font-weight: 500; }
td a:hover { text-decoration: underline; }

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.pager-compact {
  margin-top: 0.45rem;
  margin-bottom: 0.35rem;
  justify-content: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.pager-compact .btn {
  padding: 0.3rem 0.55rem;
  font-size: 0.78rem;
}
.pager-compact .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.drawer { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.drawer.open { pointer-events: auto; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 4, 9, 0.55);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer.open .drawer-backdrop { opacity: 1; }
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, 100%);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(104%);
  transition: transform 0.25s ease;
  overflow: auto;
  padding: 1.25rem 1.25rem 2rem;
}
.drawer.open .drawer-panel { transform: translateX(0); }

.drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.drawer-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.drawer-head p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.stack label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.55rem !important;
  color: var(--text) !important;
}
.check input { width: auto; }
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}
.hint code {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: var(--surface-2);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  color: var(--text);
}

.map-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
}
.map-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.45rem;
  padding: 0.65rem;
  border-bottom: 1px solid var(--border);
}
.picker-map {
  height: 260px;
  width: 100%;
  background: var(--map-bg);
}
.coords-readout {
  display: flex;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.row-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; }

.job-box {
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  background: var(--job-ok-bg);
  border: 1px solid var(--job-ok-border);
  color: var(--job-ok-text);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
}
.job-box.err {
  background: var(--danger-soft);
  border-color: rgba(248, 81, 73, 0.35);
  color: var(--danger);
}

.subhead {
  margin: 0.5rem 0 0.55rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.job-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.job-list li {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font-size: 0.84rem;
  color: var(--text);
}
.job-list strong { display: block; margin-bottom: 0.15rem; }
.job-meta { color: var(--muted); font-size: 0.78rem; }
.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 0.35rem;
  background: #7d8590;
}
.status-dot.running, .status-dot.queued { background: var(--accent-bright); }
.status-dot.completed { background: #3fb950; }
.status-dot.paused { background: #d29922; }
.status-dot.failed, .status-dot.cancelled { background: var(--danger); }

#picker-map .gm-style { border-radius: 0; }

.admin-page {
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: max(2rem, env(safe-area-inset-bottom, 0px));
}
.admin-login {
  max-width: 420px;
  margin: 2rem auto;
  padding: 1.35rem 1.35rem 1.25rem;
}
.admin-login h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}
.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 1.1rem;
  align-items: start;
  margin-bottom: 1.1rem;
}
.admin-metrics {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 1.25rem;
}

.city-job-table {
  max-height: min(520px, 55vh);
  margin-top: 0.35rem;
}

.campaign-params {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.55rem 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.campaign-params .param {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.campaign-params .param span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.campaign-params .param strong {
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  color: var(--text);
}

.campaign-list-table {
  max-height: min(320px, 40vh);
  margin-bottom: 0.5rem;
}
.campaign-list-table th,
.campaign-list-table td {
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  white-space: nowrap;
}
.campaign-list-table tr.is-selected td,
.user-job-table tr.is-current td {
  background: var(--selected);
}

.user-job-table th,
.user-job-table td {
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  white-space: nowrap;
}
.user-job-table .elapsed-cell {
  font-weight: 600;
  color: var(--accent-bright);
  min-width: 4.5rem;
}

.job-table {
  max-height: 280px;
  margin-bottom: 0.85rem;
}
.job-table th,
.job-table td,
.city-job-table th,
.city-job-table td {
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  white-space: nowrap;
}
.city-job-table td.addr-cell {
  white-space: normal;
  max-width: 200px;
}

.mono-cell {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.map-panel { margin-bottom: 1.5rem; }
.map-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.map-panel-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  color: var(--text);
}
.map-panel .map-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
}
.picker-map-lg {
  height: 420px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--map-bg);
}

.user-email {
  font-size: 0.85rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.referral-box,
.referral-bar {
  margin: 0.85rem 1.5rem 0;
  padding: 0.85rem 1.1rem;
  border: 1px solid rgba(46, 160, 67, 0.35);
  border-radius: 12px;
  background: var(--accent-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
}
.referral-bar-main {
  flex: 1 1 220px;
  min-width: 0;
}
.referral-bar-title {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  color: var(--accent-bright);
  margin-bottom: 0.15rem;
}
.referral-bar .muted {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
}
.referral-box .subhead {
  margin-top: 0;
  color: var(--accent-bright);
  text-transform: none;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  font-weight: 600;
}
.referral-box .muted { margin-bottom: 0.55rem; }
.referral-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex: 1 1 320px;
  min-width: 0;
}
.referral-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--link);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}
.referral-row .btn {
  flex-shrink: 0;
}
.referral-bar .hint {
  flex: 1 0 100%;
  margin: 0;
}

.auth-body { min-height: 100vh; }
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.65rem 1.5rem 1.4rem;
  box-shadow: var(--shadow);
}
.auth-card-header {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.25rem;
}
.auth-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.auth-subtitle,
.auth-hint,
.auth-footer {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0.35rem 0 0;
}
.auth-form { margin-top: 0.25rem; }
.auth-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}
.auth-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  background: var(--input-bg);
  color: var(--text);
}
.auth-form input:focus {
  outline: 2px solid rgba(46, 160, 67, 0.25);
  border-color: var(--accent);
}
.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.25rem;
}
.auth-hub-btn {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  text-decoration: none;
  margin-top: 0.55rem;
}
.auth-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
}
.auth-status {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.88rem;
}
.auth-footer a {
  color: var(--link);
  font-weight: 600;
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }
.auth-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.15rem 0 0.85rem;
}
.auth-card .btn-accent { text-decoration: none; }

.auth-theme-bar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
}

@media (max-width: 900px) {
  .layout-2 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .toolbar { grid-template-columns: 1fr; }
  .header {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .brand { min-width: 0; flex: 1 1 auto; }
  .brand span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .header-right {
    width: 100%;
    justify-content: flex-start;
  }
  .table-card { max-height: min(60vh, 480px); }
  .live-banner { flex-direction: column; align-items: flex-start; }
  .referral-bar { margin-left: 1rem; margin-right: 1rem; }
  .admin-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .map-panel .map-toolbar { grid-template-columns: 1fr; }
  .map-panel .map-toolbar .btn { width: 100%; min-height: 44px; }
  .picker-map-lg { height: min(360px, 50vh); }
  .map-panel-head {
    flex-direction: column;
    align-items: stretch;
  }
  .row-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .campaign-params {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 1rem max(0.85rem, env(safe-area-inset-right, 0px)) max(1.5rem, env(safe-area-inset-bottom, 0px)) max(0.85rem, env(safe-area-inset-left, 0px));
  }
  .panel {
    padding: 1rem 0.95rem 1.1rem;
  }
  .admin-login {
    margin: 1rem auto;
    width: 100%;
  }
  .stack label input,
  .stack label select,
  .admin-login input,
  .map-toolbar input {
    font-size: 16px;
  }
  .btn {
    min-height: 44px;
  }
  .campaign-params {
    grid-template-columns: 1fr;
  }
  .job-table th,
  .job-table td,
  .city-job-table th,
  .city-job-table td,
  .campaign-list-table th,
  .campaign-list-table td {
    padding: 0.65rem 0.7rem;
  }
  .pager-compact {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .pager-compact .btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
