/* ============================================================
   MAPHERO — Maps Technology Solutions · console concept
   Visual language: nautical chart sheets (graticule, bearings).
   ============================================================ */

:root {
  /* ground & surfaces */
  --abyss: #060B16;
  --chart: #0C1526;
  --chart-2: #12203A;
  --chart-3: #182A4A;
  --line: rgba(139, 170, 214, 0.13);
  --line-strong: rgba(139, 170, 214, 0.26);

  /* ink */
  --sand: #EADFC7;           /* display headings — warm paper ink */
  --ink: #C9D6E8;            /* body */
  --muted: #7E95B5;          /* secondary */
  --faint: #52698C;          /* tertiary / ticks */

  /* brand accent (UI) */
  --current: #06B4EF;
  --current-deep: #048BBE;
  --current-dim: rgba(6, 180, 239, 0.14);

  /* data & status (validated on dark surface) */
  --data: #0894C9;
  --good: #1FA98B;
  --warn: #BD8827;
  --bad: #D25462;

  /* type */
  --f-display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
  --f-body: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r: 14px;
  --r-sm: 9px;
  --sidebar-w: 248px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--abyss);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- the chart-sheet ground: faint graticule ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(139, 170, 214, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139, 170, 214, 0.045) 1px, transparent 1px);
  background-size: 96px 96px;
  z-index: 0;
}

::selection { background: var(--current-dim); color: var(--sand); }

a { color: var(--current); text-decoration: none; }
a:hover { color: #4FCBF4; }

:focus-visible {
  outline: 2px solid var(--current);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============ type helpers ============ */

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.eyebrow .tick { color: var(--current); }

h1, h2, h3 { font-family: var(--f-display); color: var(--sand); font-weight: 600; }

.mono { font-family: var(--f-mono); }

/* ============ app shell ============ */

.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

/* ---- sidebar : the chart margin ---- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border-inline-end: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 21, 38, 0.92), rgba(6, 11, 22, 0.88));
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 0;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 22px 20px;
  border-bottom: 1px solid var(--line);
}

.brand-logo { width: 148px; height: auto; display: block; }

.brand-glyph {
  width: 36px; height: 36px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--sand);
}

.brand-name b { color: var(--current); font-weight: 700; }

.brand-sub {
  font-family: var(--f-mono);
  font-size: 7.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-transform: uppercase;
  margin-top: 1px;
}

.nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }

.nav-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }

.nav-item:hover { background: rgba(139, 170, 214, 0.07); color: var(--ink); }

.nav-item.active {
  background: var(--current-dim);
  color: var(--sand);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -12px;
  top: 50%;
  translate: 0 -50%;
  width: 3px; height: 60%;
  background: var(--current);
  border-radius: 2px;
}

.nav-item .coord {
  margin-inline-start: auto;
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--faint);
  letter-spacing: 0.06em;
}

.nav-item.active .coord { color: var(--current); }

.userblock {
  margin: 0 12px;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 11px;
}

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--current-deep), var(--chart-3));
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--sand);
  flex-shrink: 0;
}

.userblock .uname { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.userblock .uorg { font-size: 11.5px; color: var(--faint); }

.logout-btn {
  margin-inline-start: auto;
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: grid;
  place-items: center;
}
.logout-btn:hover { color: var(--bad); background: rgba(210, 84, 98, 0.1); }
.logout-btn svg { width: 16px; height: 16px; }

/* ---- main column ---- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 11, 22, 0.7);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .crumbs {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--faint);
  text-transform: uppercase;
}
.topbar .crumbs b { color: var(--muted); font-weight: 500; }

.topbar .spacer { flex: 1; }

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  padding: 6px 12px;
  border-radius: 100px;
}
.plan-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); }

/* ---- content ---- */

.content { padding: 34px; max-width: 1280px; width: 100%; margin: 0 auto; }

.page-head { margin-bottom: 28px; }

.page-head h1 {
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.015em;
  margin-top: 6px;
  line-height: 1.15;
}

.page-head .lede { color: var(--muted); margin-top: 8px; max-width: 60ch; }

/* ============ components ============ */

.card {
  background: linear-gradient(180deg, rgba(18, 32, 58, 0.55), rgba(12, 21, 38, 0.85));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  position: relative;
}

.card:hover { border-color: var(--line-strong); }

.card .card-eyebrow { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(2, 1fr); }
.grid.c3 { grid-template-columns: repeat(3, 1fr); }
.grid.c4 { grid-template-columns: repeat(4, 1fr); }

/* buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.15s ease;
  white-space: nowrap;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--current);
  color: #04121D;
  box-shadow: 0 0 0 0 rgba(6, 180, 239, 0);
}
.btn-primary:hover { background: #2BC2F3; box-shadow: 0 4px 22px rgba(6, 180, 239, 0.28); color: #04121D; }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--current); color: var(--sand); }

.btn-quiet { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn-quiet:hover { color: var(--sand); }

.btn-sm { font-size: 13px; padding: 7px 14px; }

.btn-danger { background: transparent; border-color: rgba(210,84,98,.4); color: var(--bad); }
.btn-danger:hover { background: rgba(210,84,98,.1); }

/* inputs */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }

.field label {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  font-family: var(--f-body);
  font-size: 15px;
  color: var(--sand);
  background: rgba(6, 11, 22, 0.6);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--current); box-shadow: 0 0 0 3px var(--current-dim); }

/* status chips — always icon + label, never color alone */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { color: #4CC9AE; border-color: rgba(31, 169, 139, 0.35); background: rgba(31, 169, 139, 0.08); }
.chip.warn { color: #DBA94D; border-color: rgba(189, 136, 39, 0.35); background: rgba(189, 136, 39, 0.08); }
.chip.bad  { color: #E37E89; border-color: rgba(210, 84, 98, 0.35); background: rgba(210, 84, 98, 0.08); }
.chip.info { color: #4FCBF4; border-color: rgba(6, 180, 239, 0.35); background: rgba(6, 180, 239, 0.08); }
.chip.neutral { color: var(--muted); border-color: var(--line-strong); background: rgba(139,170,214,.05); }

/* tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: rgba(12, 21, 38, 0.6); }

table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }

thead th {
  font-family: var(--f-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: start;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(139, 170, 214, 0.045); }

td.num, th.num { font-family: var(--f-mono); font-size: 13px; text-align: end; }

/* meters — usage bars: one hue + neutral track, 4px rounded data end */

.meter { display: flex; flex-direction: column; gap: 6px; }

.meter-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.meter-head .m-name { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.meter-head .m-val { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); }
.meter-head .m-val b { color: var(--sand); font-weight: 600; }

.meter-track {
  height: 6px;
  background: rgba(139, 170, 214, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--data);
  width: 0;
  transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.meter-fill.hot { background: var(--warn); }
.meter-fill.crit { background: var(--bad); }

/* dial (bearing gauge) */

.dial-card { display: flex; flex-direction: column; gap: 14px; }

.dial-wrap { display: flex; align-items: center; gap: 18px; }

.dial { width: 92px; height: 92px; flex-shrink: 0; }

.dial .track { stroke: rgba(139, 170, 214, 0.14); }
.dial .sweep { stroke: var(--data); transition: stroke-dashoffset 1.1s cubic-bezier(0.22, 1, 0.36, 1); }
.dial .sweep.hot { stroke: var(--warn); }
.dial .sweep.crit { stroke: var(--bad); }

.dial-num {
  font-family: var(--f-mono);
  font-size: 19px;
  font-weight: 600;
  fill: var(--sand);
}
.dial-pct { font-family: var(--f-mono); font-size: 9px; fill: var(--faint); letter-spacing: 0.1em; }

.dial-meta .d-name { font-family: var(--f-display); font-size: 16px; font-weight: 600; color: var(--sand); }
.dial-meta .d-quota { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.dial-meta .d-link { font-size: 13px; margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; }

/* stat tiles */

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .s-label { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.stat .s-value { font-family: var(--f-display); font-size: 32px; font-weight: 650; color: var(--sand); letter-spacing: -0.01em; line-height: 1.1; }
.stat .s-value small { font-size: 16px; color: var(--muted); font-weight: 500; }
.stat .s-delta { font-family: var(--f-mono); font-size: 11.5px; }
.stat .s-delta.up { color: #4CC9AE; }
.stat .s-delta.down { color: #E37E89; }

/* chart figure */

.fig { position: relative; }
.fig svg { display: block; width: 100%; height: auto; }
.fig .axis-label { font-family: var(--f-mono); font-size: 10px; fill: var(--faint); }
.fig .gridline { stroke: rgba(139, 170, 214, 0.09); }

.tooltip {
  position: absolute;
  pointer-events: none;
  background: #0A1322;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  color: var(--ink);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 30;
  white-space: nowrap;
}
.tooltip b { color: var(--sand); }
.tooltip .t-date { color: var(--faint); font-size: 10px; display: block; margin-bottom: 2px; }

/* ============ reveal animation ============ */

.rv { opacity: 0; translate: 0 14px; transition: opacity 0.55s ease, translate 0.55s cubic-bezier(0.22, 1, 0.36, 1); }
.rv.in { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; translate: none; transition: none; }
  .meter-fill, .dial .sweep { transition: none; }
  html { scroll-behavior: auto; }
}

/* ============ corner coordinates (sheet frame) ============ */

.sheet-coord {
  position: fixed;
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--faint);
  z-index: 5;
  pointer-events: none;
  user-select: none;
}
.sheet-coord.tr { top: 10px; inset-inline-end: 14px; }
.sheet-coord.br { bottom: 10px; inset-inline-end: 14px; }

/* ============ auth (login) ============ */

.auth-shell { display: grid; grid-template-columns: minmax(420px, 540px) 1fr; min-height: 100vh; position: relative; z-index: 1; }

.auth-panel {
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(12, 21, 38, 0.9), rgba(6, 11, 22, 0.96));
  border-inline-end: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.auth-panel .auth-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 400px; width: 100%; margin: 0 auto; }

.auth-panel h1 { font-size: 30px; letter-spacing: -0.01em; margin: 10px 0 6px; }
.auth-panel .lede { color: var(--muted); margin-bottom: 30px; }

.auth-map { position: relative; overflow: hidden; }
.auth-map #ambientMap { position: absolute; inset: 0; }
.auth-map .map-veil {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(6, 11, 22, 0.72), rgba(6, 11, 22, 0.18) 42%, rgba(6, 11, 22, 0.35));
  pointer-events: none;
  z-index: 2;
}
.auth-map .map-caption {
  position: absolute;
  bottom: 26px;
  inset-inline-end: 30px;
  z-index: 3;
  text-align: end;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: rgba(234, 223, 199, 0.75);
  text-transform: uppercase;
}
.auth-map .map-caption b { display: block; font-size: 13px; color: var(--sand); letter-spacing: 0.06em; }

.divider {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em;
  color: var(--faint); text-transform: uppercase;
  margin: 20px 0;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ============ pricing ============ */

.plan-card { display: flex; flex-direction: column; gap: 16px; padding: 26px; }

.plan-card.featured {
  border-color: rgba(6, 180, 239, 0.45);
  background: linear-gradient(180deg, rgba(6, 180, 239, 0.09), rgba(12, 21, 38, 0.85));
  box-shadow: 0 12px 44px rgba(6, 180, 239, 0.1);
}

.plan-price { font-family: var(--f-display); font-size: 38px; font-weight: 650; color: var(--sand); letter-spacing: -0.02em; }
.plan-price small { font-family: var(--f-mono); font-size: 12px; color: var(--muted); font-weight: 400; letter-spacing: 0.06em; }

.quota-list { list-style: none; display: flex; flex-direction: column; }
.quota-list li {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px; color: var(--muted);
}
.quota-list li:last-child { border-bottom: none; }
.quota-list li b { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink); font-weight: 500; }

/* ============ map studio cards ============ */

.map-card { overflow: hidden; padding: 0; display: flex; flex-direction: column; transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.15s ease; }
.map-card:hover { transform: translateY(-3px); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.45); border-color: rgba(6, 180, 239, 0.4); }

.map-thumb { height: 150px; position: relative; overflow: hidden; background: var(--chart-2); }
.map-thumb svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-thumb .zoom-tag {
  position: absolute; top: 10px; inset-inline-end: 10px;
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.1em;
  color: var(--sand); background: rgba(6, 11, 22, 0.75);
  padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line-strong);
}

.map-card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.map-card-body .m-title { font-family: var(--f-display); font-size: 17px; font-weight: 600; color: var(--sand); }
.map-card-body .m-meta { font-family: var(--f-mono); font-size: 11px; color: var(--faint); display: flex; gap: 14px; flex-wrap: wrap; }
.map-card-body .m-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }

/* ============ token / customer blocks ============ */

.token-row-code {
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--current);
  background: rgba(6, 180, 239, 0.07);
  border: 1px solid rgba(6, 180, 239, 0.2);
  padding: 3px 8px;
  border-radius: 6px;
}

/* ============ settings ============ */

.setting-row {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .sr-main { flex: 1; }
.setting-row .sr-title { font-weight: 600; color: var(--sand); font-size: 14.5px; }
.setting-row .sr-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ============ cover page ============ */

.cover { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 60px 40px 80px; }

.cover-hero { padding: 40px 0 56px; border-bottom: 1px solid var(--line); margin-bottom: 44px; position: relative; }

.cover-hero h1 {
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 18px 0 20px;
}
.cover-hero h1 em { font-style: normal; color: var(--current); }

.cover-hero .lede { font-size: 17px; color: var(--muted); max-width: 56ch; }

.cover-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.cover-card { padding: 22px; display: flex; flex-direction: column; gap: 8px; min-height: 150px; transition: transform 0.16s ease, border-color 0.15s ease; color: var(--ink); }
.cover-card:hover { transform: translateY(-3px); border-color: rgba(6, 180, 239, 0.45); color: var(--ink); }
.cover-card .cc-num { font-family: var(--f-mono); font-size: 10.5px; color: var(--current); letter-spacing: 0.14em; }
.cover-card .cc-title { font-family: var(--f-display); font-size: 19px; font-weight: 600; color: var(--sand); }
.cover-card .cc-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.cover-card .cc-go { margin-top: auto; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--current); }

/* ============ city map canvas (Style Studio + Map Editor) ============ */

.citymap {
  /* style-preset variables — presets swap these */
  --cm-bg: #0B1424;
  --cm-water: #0E3A55;
  --cm-park: #12333A;
  --cm-road-main: #06B4EF;
  --cm-road-casing: #06263B;
  --cm-road-sec: #29506E;
  --cm-road-res: #1B3350;
  --cm-building: #14243E;
  --cm-label: #A9BDD8;
  --cm-poi: #E7B54A;
  --cm-zones: #06B4EF;
  --cm-depots: #EADFC7;
  --cm-font: "Instrument Sans", system-ui, sans-serif;
  display: block; width: 100%; height: 100%;
}

.citymap * { transition: fill 0.45s ease, stroke 0.45s ease; }

.cm-bg { fill: var(--cm-bg); }
.cm-water, .citymap ellipse.cm-water { fill: var(--cm-water); }
.cm-water-line { fill: none; stroke: var(--cm-water); stroke-width: 16; stroke-linecap: round; }
.cm-park { fill: var(--cm-park); }
.cm-roads-res path { fill: none; stroke: var(--cm-road-res); stroke-width: 1.6; }
.cm-roads-sec path { fill: none; stroke: var(--cm-road-sec); stroke-width: 3.4; stroke-linecap: round; }
.cm-roads-main-casing path { fill: none; stroke: var(--cm-road-casing); stroke-width: 11; stroke-linecap: round; }
.cm-roads-main path { fill: none; stroke: var(--cm-road-main); stroke-width: 6; stroke-linecap: round; }
.cm-buildings rect { fill: var(--cm-building); }
.cm-poi circle { fill: var(--cm-bg); stroke: var(--cm-poi); stroke-width: 1.6; }
.cm-poi text { fill: var(--cm-poi); font: 600 9px var(--f-mono); }
.cm-labels text { fill: var(--cm-label); font-family: var(--cm-font); }
.cm-district { font-size: 17px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; }
.citymap.cm-ar .cm-district { letter-spacing: 0; }
.cm-minor { font-size: 11px; font-style: italic; opacity: 0.75; }
.cm-road { font-size: 11.5px; letter-spacing: 0.06em; }
.cm-zones path { fill: var(--cm-zones); fill-opacity: 0.13; stroke: var(--cm-zones); stroke-width: 2; stroke-dasharray: 7 5; }
.cm-depots circle { fill: var(--cm-depots); stroke: var(--cm-bg); stroke-width: 2.5; }
.cm-drawing circle { fill: var(--current); stroke: #fff; stroke-width: 1.5; }
.cm-drawing path, .cm-drawing polyline { fill: rgba(6,180,239,0.14); stroke: var(--current); stroke-width: 2; }
.cm-drawing polyline.cm-line { fill: none; }

.citymap [data-layer].cm-selected { filter: drop-shadow(0 0 7px rgba(6, 180, 239, 0.9)); }

/* ============ full-viewport tool frame (editor / studio) ============ */

.tool-shell { display: flex; flex-direction: column; height: 100vh; position: relative; z-index: 1; }

.tool-top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 11, 22, 0.85);
  backdrop-filter: blur(6px);
  flex-shrink: 0;
}
.tool-top .back {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--muted); text-transform: uppercase;
}
.tool-top .back:hover { color: var(--sand); }
.tool-top .t-name { font-family: var(--f-display); font-size: 16px; font-weight: 650; color: var(--sand); }
.tool-top .spacer { flex: 1; }

.tool-body { display: flex; flex: 1; min-height: 0; }

.tool-panel {
  width: 330px; flex-shrink: 0;
  border-inline-end: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 21, 38, 0.92), rgba(6, 11, 22, 0.9));
  overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 18px;
}
.tool-panel.end { border-inline-end: none; border-inline-start: 1px solid var(--line); }

.tool-canvas { flex: 1; position: relative; min-width: 0; background: #060B16; }
.tool-canvas .canvas-holder { position: absolute; inset: 0; }
.tool-canvas .canvas-hint {
  position: absolute; bottom: 14px; left: 50%; translate: -50% 0;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em;
  color: var(--sand); background: rgba(6, 11, 22, 0.85);
  border: 1px solid var(--line-strong); border-radius: 100px;
  padding: 6px 14px; pointer-events: none; white-space: nowrap;
  opacity: 0; transition: opacity 0.2s ease;
}
.tool-canvas .canvas-hint.show { opacity: 1; }

.panel-title {
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

/* preset swatch cards */
.preset-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.preset {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: none; cursor: pointer; padding: 8px; text-align: start;
  display: flex; flex-direction: column; gap: 7px;
  transition: border-color 0.15s ease, transform 0.12s ease;
}
.preset:hover { transform: translateY(-1px); border-color: var(--muted); }
.preset.on { border-color: var(--current); box-shadow: 0 0 0 3px var(--current-dim); }
.preset .p-chip { height: 34px; border-radius: 6px; display: flex; overflow: hidden; }
.preset .p-chip i { flex: 1; }
.preset .p-name { font-size: 12px; font-weight: 600; color: var(--ink); }
.preset.on .p-name { color: var(--sand); }

/* option rows */
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.opt-row:last-child { border-bottom: none; }
.opt-row .o-name { font-size: 13.5px; color: var(--ink); }

.swatch-row { display: flex; gap: 7px; }
.swatch-btn {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.swatch-btn.on { border-color: var(--sand); box-shadow: 0 0 0 2px var(--abyss), 0 0 0 3.5px var(--current); }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: 100px; padding: 2px; }
.seg button {
  font-family: var(--f-mono); font-size: 10.5px; background: none; border: none;
  color: var(--muted); padding: 4px 11px; border-radius: 100px; cursor: pointer;
}
.seg button.on { background: var(--current-dim); color: var(--sand); }

.switch {
  width: 34px; height: 19px; border-radius: 100px; flex-shrink: 0;
  border: 1px solid var(--line-strong); background: rgba(139, 170, 214, 0.12);
  position: relative; cursor: pointer; transition: background 0.18s ease, border-color 0.18s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; inset-inline-start: 2px;
  width: 13px; height: 13px; border-radius: 50%; background: var(--muted);
  transition: translate 0.18s ease, background 0.18s ease;
}
.switch[aria-checked="true"] { background: var(--current-dim); border-color: var(--current); }
.switch[aria-checked="true"]::after { translate: 15px 0; background: var(--current); }

/* editor layer rows */
.layer-group { display: flex; flex-direction: column; gap: 2px; }
.layer-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid transparent; font-size: 13px; color: var(--ink);
}
.layer-row:hover { background: rgba(139, 170, 214, 0.06); }
.layer-row.on { background: var(--current-dim); border-color: rgba(6, 180, 239, 0.35); color: var(--sand); }
.layer-row .l-eye {
  background: none; border: none; color: var(--muted); cursor: pointer;
  display: grid; place-items: center; padding: 2px;
}
.layer-row .l-eye.off { color: var(--faint); opacity: 0.5; }
.layer-row .l-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.layer-row .l-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-row .l-type { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.08em; color: var(--faint); }

.inspector { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.inspector[hidden] { display: none; }
.inspector .input { padding: 8px 11px; font-size: 13.5px; }
.inspector input[type="range"] { width: 100%; accent-color: var(--current); }
.inspector .insp-label { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.13em; color: var(--faint); text-transform: uppercase; display: flex; justify-content: space-between; }

/* editor toolbar */
.draw-tools { display: flex; gap: 5px; }
.draw-tools .dt {
  flex: 1; display: grid; place-items: center; padding: 8px 0;
  background: none; border: 1px solid var(--line-strong); border-radius: 7px;
  color: var(--muted); cursor: pointer; transition: all 0.13s ease;
}
.draw-tools .dt:hover { color: var(--sand); border-color: var(--muted); }
.draw-tools .dt.on { background: var(--current-dim); border-color: var(--current); color: var(--current); }
.draw-tools .dt svg { width: 15px; height: 15px; }

/* bundle chips & meters */
.bundle-bar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 26px; }
.bundle-pill {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 14px; background: rgba(12, 21, 38, 0.6);
}
.bundle-pill .b-k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.13em; color: var(--faint); }
.bundle-pill .b-v { font-family: var(--f-display); font-size: 15px; font-weight: 650; color: var(--sand); }
.bundle-pill .b-v small { color: var(--muted); font-weight: 500; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.stepper button {
  width: 34px; height: 34px; background: none; border: none;
  color: var(--current); font-size: 17px; cursor: pointer;
}
.stepper button:disabled { color: var(--faint); cursor: default; }
.stepper button:hover:not(:disabled) { background: var(--current-dim); }
.stepper .q { min-width: 40px; text-align: center; font-family: var(--f-mono); font-size: 15px; font-weight: 600; color: var(--sand); }

@media (max-width: 900px) {
  .tool-panel { width: 270px; }
  .preset-grid { grid-template-columns: 1fr; }
}

/* ============ responsive ============ */

@media (max-width: 1100px) {
  .grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .grid.c3 { grid-template-columns: repeat(2, 1fr); }
  .cover-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-map { display: none; }
  .content { padding: 22px 18px; }
  .topbar { padding: 14px 18px; flex-wrap: wrap; gap: 10px; }
  .topbar .crumbs { width: 100%; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .cover-grid { grid-template-columns: 1fr; }
  .cover { padding: 36px 22px 60px; }
  .sheet-coord { display: none; }
}
