/* MapEngine platform (customer + admin). Brand tokens ported from the marketing site for visual consistency. */
:root {
  color-scheme: dark;
  --bg: #0c0f12;
  --bg-2: #10141a;
  --panel: #151a21;
  --panel-2: #1a2029;
  --line: #232b34;
  --line-2: #303b47;
  --text: #e8edf2;
  --muted: #9aa8b5;
  --dim: #66727e;
  --cyan: #43c6ee;
  --cyan-deep: #1f9ecb;
  --amber: #ffb454;
  --amber-deep: #e59a2f;
  --green: #4ade80;
  --red: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --max: 1280px;
  --gutter: clamp(16px, 4vw, 32px);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout shells ---------- */
.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.app-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.app-sidebar { background: var(--bg-2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.app-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; font: 600 1.0625rem/1 var(--display); }
.app-brand .brand-mark rect { fill: var(--line-2); }
.app-brand .m1 { fill: #14446c; } .app-brand .m2 { fill: #1a72a0; } .app-brand .m3 { fill: #1f9ecb; }
.app-brand .m4 { fill: #43c6ee; } .app-brand .m5 { fill: #f0c27a; } .app-brand .m6 { fill: #ffb454; }
.nav-section-label { padding: 14px 10px 6px; font: 600 .6875rem/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: .9375rem; font-weight: 500; transition: background .15s, color .15s; }
.nav-link:hover { background: var(--panel); color: var(--text); }
.nav-link.active { background: var(--panel-2); color: var(--text); box-shadow: inset 2px 0 0 var(--cyan); }
.app-main { min-width: 0; }
.app-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); background: rgba(12, 15, 18, .7); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 20; }
.app-content { padding: 28px var(--gutter) 60px; max-width: 1120px; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); }
.topbar-user strong { color: var(--text); font-weight: 600; }

/* mobile: sidebar collapses to a top bar */
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; align-items: center; border-right: none; border-bottom: 1px solid var(--line); }
  .app-brand { padding: 6px 10px; }
  .nav-section-label { display: none; }
  .nav-link { white-space: nowrap; }
}

/* ---------- auth pages (centered card) ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background-image: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(67, 198, 238, .07), transparent 70%); }
.auth-card { width: 100%; max-width: 400px; padding: 32px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--bg-2)); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8); }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; font: 600 1.125rem/1 var(--display); }
.auth-title { font-size: 1.375rem; text-align: center; }
.auth-subtitle { margin-top: 6px; text-align: center; color: var(--muted); font-size: .9375rem; }
.auth-form { margin-top: 24px; display: grid; gap: 16px; }
.auth-footer { margin-top: 20px; text-align: center; font-size: .875rem; color: var(--muted); }
.auth-footer a { color: var(--cyan); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field label { font-size: .8125rem; font-weight: 600; color: var(--text); }
.field .hint { font-size: .8125rem; color: var(--dim); }
.field .error-text { font-size: .8125rem; color: var(--red); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%; transition: border-color .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--red); }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--muted); }
.checkbox-row input { width: auto; }
form { display: contents; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 18px; border-radius: var(--radius-sm); font: 600 .875rem/1 var(--sans); text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: background .15s, border-color .15s, opacity .15s; }
.btn-primary { background: var(--cyan); color: #06121a; }
.btn-primary:hover { background: #6fd6f5; }
.btn-ghost { border-color: var(--line-2); color: var(--text); background: rgba(255, 255, 255, .02); }
.btn-ghost:hover { border-color: var(--cyan); }
.btn-danger { background: var(--red); color: #2a0d0d; }
.btn-danger:hover { background: #fb9a9a; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: .8125rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- cards / stat tiles ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--bg-2)); padding: 20px; }
.card-title { font-size: 1rem; font-weight: 600; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-tile { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--bg-2)); padding: 16px 18px; }
.stat-label { font: 500 .75rem/1 var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--dim); }
.stat-value { margin-top: 8px; font: 600 1.75rem/1 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 4px; font-size: .8125rem; color: var(--muted); }

/* ---------- badges / status pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font: 600 .75rem/1.4 var(--sans); white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: rgba(74, 222, 128, .12); color: var(--green); }
.badge-amber { background: rgba(255, 180, 84, .12); color: var(--amber); }
.badge-red { background: rgba(248, 113, 113, .12); color: var(--red); }
.badge-muted { background: rgba(154, 168, 181, .12); color: var(--muted); }
.badge-cyan { background: rgba(67, 198, 238, .12); color: var(--cyan); }

/* ---------- tables ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; padding: 11px 14px; background: var(--bg-2); color: var(--dim); font: 600 .6875rem/1 var(--mono); letter-spacing: .05em; text-transform: uppercase; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .015); }
.table-actions { display: flex; gap: 8px; justify-content: flex-end; }
.empty-state { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: 8px; opacity: .5; }

/* ---------- alerts / flash messages ---------- */
.alert { display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: .875rem; }
.alert-error { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); color: #fca5a5; }
.alert-success { background: rgba(74, 222, 128, .08); border-color: rgba(74, 222, 128, .3); color: #86efac; }
.alert-info { background: rgba(67, 198, 238, .08); border-color: rgba(67, 198, 238, .3); color: #7dd3ea; }
.alert-warn { background: rgba(255, 180, 84, .08); border-color: rgba(255, 180, 84, .3); color: #fbc783; }

/* ---------- misc ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.5rem; }
.section-title { font-size: 1.0625rem; margin-bottom: 14px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 20px; }
.divider { border: none; border-top: 1px solid var(--line); margin: 20px 0; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }
.filters-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filters-bar input, .filters-bar select { width: auto; min-width: 160px; }
.plan-card { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 22px; background: linear-gradient(180deg, var(--panel), var(--bg-2)); display: flex; flex-direction: column; gap: 12px; }
.plan-card.featured { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.plan-price { font: 600 2rem/1 var(--display); letter-spacing: -0.02em; }
.plan-price small { font-size: .9375rem; font-weight: 500; color: var(--muted); }
.plan-features { display: grid; gap: 8px; margin: 4px 0; }
.plan-features li { position: relative; padding-left: 22px; color: var(--muted); font-size: .875rem; }
.plan-features li::before { content: ""; position: absolute; left: 0; top: .6em; width: 10px; height: 2px; background: var(--cyan); }
