:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #18212f;
  --muted: #617086;
  --line: #dce4ef;
  --brand: #176b87;
  --brand-strong: #0f4b5f;
  --accent: #d95d39;
  --ok: #1f8a5b;
  --shadow: 0 18px 50px rgba(24, 33, 47, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav a,
.link-button {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  text-decoration: none;
}

main {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42px 0 64px;
}

.auth-shell,
.hero,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  align-items: center;
  gap: clamp(24px, 5vw, 56px);
  padding: clamp(26px, 6vw, 64px);
}

.hero {
  padding: clamp(24px, 5vw, 48px);
}

.hero.compact {
  padding: 28px;
}

h1 {
  margin: 8px 0 12px;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.panel h1,
.hero.compact h1 {
  font-size: clamp(28px, 4vw, 42px);
}

p {
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.form {
  display: grid;
  gap: 16px;
  padding: 22px;
  box-shadow: none;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

button,
.button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 800;
  padding: 10px 16px;
  text-decoration: none;
}

button:hover,
.button:hover {
  background: var(--brand-strong);
}

.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.card span,
.muted {
  color: var(--muted);
}

.card strong {
  font-size: 20px;
  line-height: 1.22;
}

.panel {
  padding: clamp(18px, 4vw, 30px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #eaf6f2;
  color: var(--ok);
  font-size: 13px;
  font-weight: 800;
  padding: 4px 10px;
}

.error {
  color: #a12929;
}

.mapper-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}

.mapper-mode {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.mapper-mode .active {
  background: #123744;
}

.mapper-shell {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f7;
  overflow: auto;
}

.mapper-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 14px;
  user-select: none;
}

.map-canvas {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.map-canvas img {
  display: block;
  width: 100%;
  max-width: none;
  border-radius: 6px;
}

.map-canvas svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.map-canvas polygon,
.map-canvas rect,
.map-canvas ellipse,
.map-canvas polyline {
  vector-effect: non-scaling-stroke;
}

.mapper-stage circle,
.mapper-stage polygon,
.mapper-stage polyline {
  pointer-events: auto;
}

.mapper-stage circle {
  cursor: grab;
}

.mapper-stage circle:active {
  cursor: grabbing;
}

.preview-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.preview-head h2 {
  font-size: 18px;
  margin: 0;
}

.map-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 14px;
  min-height: 160px;
  overflow: auto;
  padding: 14px;
}

.hover-map {
  display: inline-block;
  line-height: 0;
  max-width: 100%;
  position: relative;
}

.hover-map img {
  display: block;
  height: auto;
  max-width: 100%;
}

.hover-map svg {
  inset: 0;
  position: absolute;
  width: 100%;
  height: 100%;
}

.hover-map a polygon,
.hover-map a rect,
.hover-map a ellipse {
  cursor: help;
  fill: rgba(217, 93, 57, 0.16);
  stroke: rgba(217, 93, 57, 0.72);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.hover-map a:focus polygon,
.hover-map a:focus rect,
.hover-map a:focus ellipse,
.hover-map a:hover polygon,
.hover-map a:hover rect,
.hover-map a:hover ellipse {
  fill: rgba(217, 93, 57, 0.34);
  stroke: #d95d39;
}

@media (max-width: 820px) {
  .auth-shell,
  .mapper-controls {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
