/* ============================================================
   DESIGN TOKENS — change these to re-skin the whole app
   ============================================================ */
:root {
  --bg: #07090d;
  --panel: #11161f;
  --panel-2: #161d28;
  --line: #232c3a;
  --txt: #e8edf5;
  --muted: #8b98ab;
  --faint: #5d6878;
  --accent: #3ddc84; /* claim / money green */
  --danger: #ff5470; /* steal red */
  --gold: #ffc93c;
  --radius: 14px;
  --head-h: 56px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas,
    monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
/* One-screen app: the page itself never scrolls, columns do. */
html,
body {
  height: 100%;
  overflow: hidden;
}
body {
  background: radial-gradient(
      900px 500px at 15% -10%,
      #14283a 0%,
      transparent 60%
    ),
    radial-gradient(700px 500px at 95% 0%, #23153a 0%, transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
}
::selection {
  background: rgba(61, 220, 132, 0.3);
}

/* scrollbars inside panels */
.plist::-webkit-scrollbar,
.form::-webkit-scrollbar,
.col-map::-webkit-scrollbar {
  width: 8px;
}
.plist::-webkit-scrollbar-thumb,
.form::-webkit-scrollbar-thumb,
.col-map::-webkit-scrollbar-thumb {
  background: #232c3a;
  border-radius: 99px;
}

/* ---------- Top bar ---------- */
header {
  flex: none;
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 9, 13, 0.78);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: none;
}
.logo {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 25px;
  letter-spacing: -0.5px;
}
.flag {
  width: 33px;
  height: 22px;
  border-radius: 3px;
  overflow: hidden;
  display: block;
  object-fit: contain;
}

/* nav */
.nav {
  display: flex;
  gap: 4px;
  flex: none;
}
.nav a {
  font-size: 12.5px;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover {
  background: #151b25;
  color: var(--txt);
}
.nav a.active {
  color: var(--txt);
  background: #172032;
}

.stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}
.stats b {
  color: var(--txt);
  font-size: 13px;
}
.stats .g b {
  color: var(--accent);
}
.stats .y b {
  color: var(--gold);
}

.live-stats {
  flex: none;
  background: #141a24;
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 7px 12px;
  font-family: var(--mono);
  font-size: 12px;
  transition: border-color 0.15s ease;
}
.live-stats:hover {
  border-color: #35415a;
}

/* ---------- Layout: 3 columns, exactly one screen ---------- */
main {
  flex: 1;
  min-height: 0; /* lets children scroll instead of growing the page */
  display: grid;
  gap: 14px;
  padding: 14px;
  /* Wider left listing per the reference layout. */
  grid-template-columns: 420px minmax(0, 1fr) 330px;
  align-items: stretch;
}

.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chead {
  flex: none;
  padding: 18px 18px 12px;
}
.chead.center {
  text-align: center;
}
.card h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--txt);
}
.card p.sub {
  margin: 5px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---------- Left column: filter chips + project list ---------- */
.chips {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.chip {
  background: #131924;
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 7px 13px;
  border-radius: 99px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.chip:hover {
  color: var(--txt);
}
.chip.active {
  color: var(--accent);
  border-color: #235c3d;
  background: #10241a;
}
.region-filter {
  width: 100%;
  max-width: none;
  background: #131924;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 7px 28px 7px 10px;
  cursor: pointer;
}
.region-filter:focus {
  outline: 2px solid rgba(30, 181, 58, 0.35);
  outline-offset: 1px;
}

.plist {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 14px 6px;
  display: grid;
  gap: 10px;
  align-content: start;
}

/* Listing rows: logo tile on the left, price pinned to the top-right,
   description and stat row spanning the body column beneath the title. */
.pcard {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 4px 13px;
  align-items: start;
  width: 100%;
  text-align: left;
  background: #0e1319;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  color: inherit;
  transition: border-color 0.15s ease;
}
.pcard[hidden] {
  display: none;
}
.pcard:hover {
  border-color: #35415a;
}
.pcard.top-1 {
  border-color: rgba(255, 201, 60, 0.7);
  background: #191812;
}
.pcard.top-2 {
  border-color: rgba(248, 113, 113, 0.82);
  background: #211416;
}
.pcard.top-3 {
  border-color: rgba(234, 151, 91, 0.62);
  background: #1a1512;
}
.pcard.top-1 .pprice { color: var(--gold); }
.pcard.top-2 .pprice { color: #f87171; }
.pcard.top-3 .pprice { color: #ea975b; }
.pcard.free {
  opacity: 0.72;
}
.pico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.plogo,
.mlogo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: inherit;
}
.optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.pbody {
  min-width: 0;
}
.ptitle {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdesc {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 5px;
  /* Two lines, then ellipsis — keeps every row the same height. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pstats {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px 14px;
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}
.pstat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.pstat .si {
  font-size: 10px;
  opacity: 0.8;
}
.pprice {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  white-space: nowrap;
}
.pprice.free {
  color: var(--faint);
  font-weight: 400;
}
.badge {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 99px;
  border: 1px solid currentColor;
  flex: none;
}
.badge.hot {
  color: var(--gold);
}
.badge.new {
  color: var(--accent);
}
.badge.rank-badge {
  color: var(--gold);
}
.badge.empty-b {
  color: var(--faint);
}

.empty {
  color: var(--muted);
  font-size: 12.5px;
  padding: 10px 6px;
  font-family: var(--mono);
}

.col-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}

/* ---------- Map ---------- */
.col-map {
  overflow-y: auto;
}
.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0 12px;
  display: flex;
}
/* The SVG fills the pane and zoom is done via viewBox, so zooming out
   never pushes geometry outside the canvas. */
#map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: default;
  touch-action: none;
  user-select: none;
}
#map.dragging {
  cursor: grabbing;
}
.zoom {
  position: absolute;
  top: 0;
  right: 16px;
  display: grid;
  gap: 6px;
  z-index: 5;
}
.zoom button {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #141a24;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.zoom button i {
  pointer-events: none;
}
.zoom button:hover {
  color: var(--txt);
  border-color: #35415a;
}

/* All regions stay dark — ownership is shown by pins/labels, not fill. */
.region {
  fill: #1b2432;
  stroke: #0a0d12;
  stroke-width: 2;
  transition: fill 0.18s ease, stroke 0.18s ease, stroke-width 0.18s ease;
  cursor: pointer;
}
.region.owned {
  fill: #222d3e;
}
.region:hover {
  fill: #2c384a;
  stroke: #8494ad;
  stroke-width: 1;
}
.region.active {
  stroke: var(--accent);
  stroke-width: 2.5;
}
.water {
  fill: #0f2a3a;
  stroke: #0a0d12;
  stroke-width: 1.5;
}

/* map pins — the only accented thing on the map */
.pin {
  cursor: pointer;
}
/* Geometry (size, rx, stroke-width, font-size) is set as presentation
   attributes in main.js so pins can rescale on zoom — CSS would override it. */
.pin-bg {
  fill: #172032;
  stroke: #38455c;
}
.pin.owned .pin-bg {
  fill: white;
  stroke: var(--accent);
}
.pin-ico {
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}
.pin-logo {
  /* Corners come from the userSpaceOnUse clipPath in main.js —
     border-radius has no effect on an SVG <image>. */
  pointer-events: none;
}

/* ---------- Legend ---------- */
.legend-box {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 11px 16px 13px;
}
.legend-title {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
  font-weight: 600;
}
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 6px 14px;
}
.legend div {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
  min-width: 0;
}
.legend span.nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* ---------- Right column: form ---------- */
.form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 16px 16px;
  display: grid;
  gap: 11px;
  align-content: start;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: #0b0f15;
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 10px 12px;
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: #4b5566;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field.err input,
.field.err select {
  border-color: var(--danger);
}
.field input.err {
  border-color: var(--danger);
}
.bid-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: stretch;
}
.bid-control input {
  border-radius: 0;
  text-align: center;
  -moz-appearance: textfield;
}
.bid-control input::-webkit-outer-spin-button,
.bid-control input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.bid-step {
  border: 1px solid var(--line);
  background: #141a24;
  color: var(--txt);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.bid-step:first-child {
  border-radius: 10px 0 0 10px;
}
.bid-step:last-child {
  border-radius: 0 10px 10px 0;
}
.bid-step:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  font-size: 12.5px;
  transition: transform 0.12s ease, filter 0.18s ease;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn:active {
  transform: translateY(1px);
}
.btn.claim {
  background: var(--accent);
  color: #06210f;
}
.btn.steal {
  background: var(--danger);
  color: #2a0710;
}
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn.sm {
  width: auto;
  padding: 7px 12px;
  font-size: 10.5px;
}

/* ---------- Modal ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.72);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.overlay.open {
  display: flex;
}
.modal {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal .swatch {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  margin-bottom: 16px;
}
.mhead {
  display: flex;
  gap: 12px;
  align-items: center;
}
.micon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #172032;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex: none;
  overflow: hidden;
}
.micon .mlogo {
  display: block;
}
.modal h3 {
  margin: 0;
  font-size: 20px;
}
.modal .en {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  margin-top: 3px;
}
.mdesc {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.rows {
  margin: 16px 0 2px;
  display: grid;
  gap: 9px;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}
.row span:first-child {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  flex: none;
}
.row b {
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.money {
  color: var(--accent);
}
.actions {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.hint {
  color: var(--muted);
  font-size: 11.5px;
  margin: 2px 0 0;
  line-height: 1.5;
}

/* ---------- Map tooltip ---------- */
.map-tip {
  position: fixed;
  pointer-events: none;
  z-index: 40;
  background: rgba(10, 13, 20, 0.92);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  min-width: 150px;
  max-width: 220px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translate(14px, 14px);
  transition: opacity 0.12s ease;
}
.map-tip.visible {
  opacity: 1;
}
.map-tip-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-tip-row {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-top: 3px;
}
.map-tip-row b {
  color: var(--accent);
  font-weight: 700;
}
.map-tip-row.steal b {
  color: var(--danger);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 18px);
  background: #131a24;
  border: 1px solid var(--line);
  color: var(--txt);
  padding: 11px 18px;
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 60;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Narrow screens: allow normal page scrolling ---------- */
@media (max-width: 1180px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }
  main {
    grid-template-columns: 360px minmax(0, 1fr);
  }
  .col-side {
    grid-column: 1 / -1;
  }
  .plist,
  .form,
  .col-map {
    overflow: visible;
  }
  .plist {
    max-height: 460px;
    overflow-y: auto;
  }
  .map-wrap {
    min-height: 460px;
  }
}
@media (max-width: 820px) {
  main {
    grid-template-columns: 1fr;
  }
  header {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 12px;
  }
  .stats {
    order: 4;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }
}

/* ---------- Admin ---------- */
body:has(.admin-page), body:has(.admin-login-page) { overflow: auto; }
.admin-page, .admin-login-page { width: calc(100% - 48px); max-width: 1320px; margin: 0 auto; padding: 0 0 40px; }
.admin-page { display: block; flex: 0 0 auto; }
.admin-login-page { display: grid; grid-template-columns: 1fr; align-items: center; justify-items: center; min-height: 100vh; flex: 0 0 auto; padding: 28px 0; }
.admin-topline, .admin-section-head, .admin-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.admin-topline {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 20px;
  padding: 14px 0;
  background: rgba(7, 9, 13, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.admin-actions { flex: 0 0 auto; gap: 8px; }
.admin-page h1, .admin-login-panel h1 { margin: 2px 0 0; font-family: var(--mono); font-size: clamp(20px, 2.2vw, 26px); line-height: 1.15; }
.admin-page h2 { margin: 0; font-family: var(--mono); font-size: 17px; }
.admin-kicker { margin: 0; color: var(--accent); font: 10px var(--mono); letter-spacing: 1.2px; text-transform: uppercase; }
.admin-muted, .admin-back { color: var(--muted); font-size: 13px; }
.admin-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 13px; background: #141a24; color: var(--txt); font: 11px var(--mono); cursor: pointer; text-decoration: none; }
.admin-button:hover { border-color: #52627c; }
.admin-button.primary { background: var(--accent); border-color: var(--accent); color: #06210f; font-weight: 700; }
.admin-button.danger { color: var(--danger); border-color: #633040; }
.admin-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.admin-stats div, .admin-section, .admin-login-panel { background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid var(--line); border-radius: 10px; }
.admin-stats div { padding: 12px 14px; }
.admin-stats span { display: block; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .7px; }
.admin-stats strong { display: block; margin-top: 4px; color: var(--txt); font: 19px var(--mono); }
.admin-section { margin-bottom: 16px; padding: 18px 20px 20px; }
.admin-section-head { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); align-items: flex-end; }
.admin-count { color: var(--muted); font: 11px var(--mono); white-space: nowrap; }
.admin-form { display: grid; gap: 12px 14px; }
.admin-form label { display: grid; gap: 6px; color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .6px; }
.admin-form input, .admin-form select, .admin-form textarea, .admin-table input, .admin-table select, .admin-table textarea { width: 100%; min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: #0b0f15; color: var(--txt); padding: 9px 10px; font: 12px var(--mono); line-height: 1.2; }
.admin-form textarea, .admin-table textarea { resize: vertical; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus, .admin-table input:focus, .admin-table select:focus, .admin-table textarea:focus { outline: none; border-color: var(--accent); }
.admin-workspace { display: grid; grid-template-columns: minmax(290px, .72fr) minmax(0, 1.28fr); gap: 16px; align-items: start; }
.admin-workspace .admin-section { min-width: 0; margin-bottom: 0; }
.admin-create-card .admin-form { gap: 14px; }
.admin-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.submit-project { width: 100%; margin-top: 2px; gap: 7px; }
.project-list { display: grid; gap: 10px; }
.admin-project-card { position: relative; width: 100%; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: #0e1319; transition: border-color .15s ease; }
.admin-project-card:hover { border-color: #35415a; }
.admin-project-card.admin-top-1 { border-color: rgba(255, 201, 60, .7); background: #191812; }
.admin-project-card.admin-top-2 { border-color: rgba(248, 113, 113, .82); background: #211416; }
.admin-project-card.admin-top-3 { border-color: rgba(234, 151, 91, .62); background: #1a1512; }
.admin-project-card.admin-top-1 .admin-project-side > strong { color: var(--gold); }
.admin-project-card.admin-top-2 .admin-project-side > strong { color: #f87171; }
.admin-project-card.admin-top-3 .admin-project-side > strong { color: #ea975b; }
.admin-project-muted { opacity: .72; }
.admin-project-main { display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: 4px 24px; align-items: start; }
.admin-project-logo { width: 88px; height: 88px; display: grid; place-items: center; overflow: hidden; border: 2px solid #5865f2; border-radius: 22px; background: #111824; color: var(--muted); font: 34px var(--mono); }
.admin-top-2 .admin-project-logo { border-color: #f87171; }
.admin-top-3 .admin-project-logo { border-color: #2ca77e; }
.admin-project-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; border-radius: inherit; }
.admin-project-body { min-width: 0; padding-top: 3px; }
.admin-project-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.admin-project-title strong { overflow: hidden; color: var(--txt); font: 700 23px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.admin-project-description { display: -webkit-box; overflow: hidden; margin: 13px 0 0; color: var(--muted); font-size: 16px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.admin-project-stats { display: flex; flex-wrap: wrap; gap: 7px 18px; margin-top: 16px; color: var(--faint); font: 15px var(--mono); }
.admin-project-stats span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.admin-project-stats i { color: var(--faint); font-size: 14px; }
.admin-project-side { display: grid; justify-items: end; gap: 24px; min-width: 132px; }
.admin-project-side > strong { color: var(--accent); font: 700 25px var(--mono); white-space: nowrap; }
.admin-project-side .project-actions { gap: 6px; }
.admin-project-card .project-record { grid-column: 2 / -1; margin-top: 3px; }
.project-card { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 12, 18, .58); }
.project-card-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center; }
.project-logo { width: 42px; height: 42px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #111824; color: var(--accent); font: 18px var(--mono); font-weight: 700; }
.project-logo img { width: 100%; height: 100%; object-fit: cover; }
.project-identity { min-width: 0; display: grid; gap: 4px; }
.project-identity strong { overflow: hidden; color: var(--txt); font: 700 13px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.project-identity a { overflow: hidden; color: var(--accent); font: 10px var(--mono); text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.project-identity a:hover { text-decoration: underline; }
.project-actions { display: flex; gap: 6px; align-self: start; }
.project-actions form { display: contents; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; background: #141a24; color: var(--txt); cursor: pointer; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button.danger { color: var(--danger); }
.icon-button.danger:hover { border-color: var(--danger); }
.project-description { display: block; min-height: 38px; margin: 13px 0 11px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.project-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.project-details label { display: grid; gap: 4px; color: var(--faint); font: 9px var(--mono); letter-spacing: .5px; text-transform: uppercase; }
.project-details input, .project-details select { min-height: 32px; font-size: 11px; }
.project-summary { gap: 8px 14px; }
.project-summary span { display: grid; min-width: 0; gap: 3px; }
.project-summary small { color: var(--faint); font: 9px var(--mono); letter-spacing: .5px; text-transform: uppercase; }
.project-summary b { overflow: hidden; color: var(--txt); font: 11px var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.project-summary .status-paid { color: var(--accent); }
.project-summary .status-pending { color: var(--gold); }
.project-summary .status-failed, .project-summary .status-expired { color: var(--danger); }
.project-record { margin: 12px 0 0; color: var(--faint); font: 10px var(--mono); }
.project-record span { padding: 0 5px; color: var(--line); }
.admin-modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(2, 5, 9, .78); }
.admin-modal.open { display: flex; }
.admin-modal-panel { width: min(620px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow-y: auto; padding: 20px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.admin-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.admin-modal-head h3 { margin: 4px 0 0; color: var(--txt); font: 17px var(--mono); }
.edit-project-form { gap: 13px; }
.modal-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.project-grid { grid-template-columns: repeat(12, 1fr); align-items: end; }
.project-grid > label { grid-column: span 3; }
.project-grid > .col-2 { grid-column: span 2; }
.project-grid > .col-3 { grid-column: span 3; }
.project-grid > .col-4 { grid-column: span 4; }
.project-grid textarea { height: 36px; }
.project-grid .form-actions { grid-column: span 2; display: flex; align-items: flex-end; }
.project-grid .form-actions .admin-button { width: 100%; }
.admin-table-wrap { overflow-x: auto; margin: 0 -20px -20px; padding: 0 20px 4px; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.admin-table th { color: var(--faint); font: 10px var(--mono); text-align: left; text-transform: uppercase; letter-spacing: .7px; }
.admin-table th, .admin-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table th:first-child, .admin-table td:first-child { padding-left: 0; }
.admin-table th:last-child, .admin-table td:last-child { padding-right: 0; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table td { color: var(--muted); font-size: 12px; }
.admin-table td:first-child { width: 44px; color: var(--txt); font-family: var(--mono); white-space: nowrap; }

/* Project row: name+URL on line 1, description+logo on line 2. */
.project-cell { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.4fr); gap: 6px; min-width: 300px; }
.project-cell textarea { height: 36px; }
.region-cell { width: 70px; white-space: nowrap; }
.contact-cell { width: 170px; }
.amount-cell { width: 118px; }
.status-cell { width: 108px; }
.actions-cell { display: flex; gap: 6px; width: 168px; }
.actions-cell form { display: contents; }
.actions-cell .admin-button { flex: 1; padding: 8px 6px; }

.region-table { min-width: 0; }
.region-table td, .region-table th { padding: 8px 7px; }
.region-table .code-cell { width: 46px; color: var(--txt); font-family: var(--mono); }
.region-table .price-cell { width: 116px; }
.region-table .clicks-cell { width: 52px; text-align: right; font-family: var(--mono); }
.region-table .save-cell { width: 74px; }
.region-table .save-cell .admin-button { width: 100%; padding: 8px 6px; }
.region-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; }
.region-columns .admin-table-wrap { margin: 0; padding: 0; min-width: 0; }
.admin-empty { text-align: center; padding: 28px !important; }
.admin-login-panel { width: min(420px, 100%); padding: 28px; }
.admin-login-panel h1 { font-size: 25px; }
.admin-login-panel .admin-form { margin: 24px 0 18px; }
.admin-error { border: 1px solid #633040; background: #24131a; color: var(--danger); padding: 10px; border-radius: 7px; font-size: 12px; }
.admin-back { display: inline-block; margin-top: 4px; }
@media (max-width: 1180px) {
  .region-columns { grid-template-columns: 1fr; }
}
@media (max-width: 1040px) {
  .project-grid > label, .project-grid > .col-2, .project-grid > .col-3 { grid-column: span 4; }
  .project-grid > .col-4 { grid-column: span 6; }
  .project-grid .form-actions { grid-column: span 4; }
}
@media (max-width: 760px) {
  .admin-stats { grid-template-columns: 1fr; }
  .admin-workspace { grid-template-columns: 1fr; }
  .admin-page, .admin-login-page { width: calc(100% - 24px); }
  .admin-login-page { padding: 18px 0; }
  .admin-topline { flex-direction: column; align-items: flex-start; gap: 12px; }
  .admin-section-head { flex-direction: column; align-items: flex-start; gap: 6px; }
  .admin-actions { flex-wrap: wrap; width: 100%; }
  .admin-section { padding: 16px; }
  .admin-table-wrap { margin: 0 -16px -16px; padding: 0 16px 4px; }
  .project-grid > label, .project-grid > .col-2, .project-grid > .col-3, .project-grid > .col-4 { grid-column: span 6; }
  .project-grid .form-actions { grid-column: 1 / -1; }
  .project-cell { grid-template-columns: 1fr; }
  .admin-modal { padding: 12px; }
  .admin-modal-panel { max-height: calc(100vh - 24px); padding: 16px; }
  .modal-form-actions { flex-direction: column-reverse; }
  .modal-form-actions .admin-button { width: 100%; }
  .admin-project-card { padding: 13px; }
  .admin-project-main { grid-template-columns: 58px minmax(0, 1fr); gap: 4px 13px; }
  .admin-project-logo { width: 58px; height: 58px; border-radius: 16px; }
  .admin-project-title strong { font-size: 16px; }
  .admin-project-description { margin-top: 8px; font-size: 13px; }
  .admin-project-stats { grid-column: 1 / -1; margin-top: 11px; font-size: 11px; gap: 6px 12px; }
  .admin-project-side { display: contents; }
  .admin-project-side > strong { position: absolute; margin: 1px 0 0; right: 28px; font-size: 16px; }
  .admin-project-side .project-actions { position: absolute; right: 17px; margin-top: 67px; }
  .admin-project-card .project-record { grid-column: 1 / -1; }
}
