/* Jikia parking - clean UI */
:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --ink: #1a1f2e;
  --ink-soft: #3d4659;
  --muted: #6b7280;
  --line: #e5e1db;
  --line-strong: #d1ccc4;
  --brand: #1e4d8c;
  --brand-d: #163a6b;
  --brand-light: #eef3fa;
  --accent: #c8956c;
  --free: #2d8a4e;
  --free-bg: #e8f5ec;
  --held: #c77700;
  --held-bg: #fef6e8;
  --reserved: #c0392b;
  --reserved-bg: #fdeeed;
  --mine: #1e4d8c;
  --shadow: 0 12px 40px rgba(26, 31, 46, 0.08);
  --shadow-sm: 0 2px 8px rgba(26, 31, 46, 0.06);
  --radius: 14px;
  --radius-lg: 20px;
  --font: "Noto Sans Georgian", system-ui, sans-serif;
  --header-h: 60px;
  --max: 960px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(circle at 10% 0%, rgba(30, 77, 140, 0.06) 0%, transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(200, 149, 108, 0.08) 0%, transparent 40%);
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-h);
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-back {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.topbar-back:hover { border-color: var(--brand); color: var(--brand); }

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.session-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--brand-light);
  color: var(--brand);
}

/* Steps */
.steps {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 20px;
}

.steps-list {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: var(--max);
  display: flex;
  gap: 8px;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step-text {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 28px;
}

.step::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line-strong);
}

.step::after {
  content: "";
  position: absolute;
  top: 10px;
  left: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  background: var(--line);
}

.step:last-child::after { display: none; }

.step.active .step-text { color: var(--brand); font-weight: 700; }
.step.active::before {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(30, 77, 140, 0.15);
}

.step.done .step-text { color: var(--free); }
.step.done::before {
  content: "✓";
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  background: var(--free-bg);
  border-color: var(--free);
  color: var(--free);
}
.step.done::after { background: var(--free); }

/* Main */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 20px 48px;
}

body.map-mode main {
  max-width: 1280px;
  padding: 20px 16px 16px;
}

body.map-mode .steps { display: none; }

.screen { display: none; }
.screen.active { display: block; animation: in 0.3s ease; }

@keyframes in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active, .spinner { animation: none; }
}

/* Typography helpers */
.eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 8px;
}

.eyebrow.success { color: var(--free); }
.map-eyebrow { margin-bottom: 4px; }

h1 {
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.2;
}

h2.map-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.lede {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0 0 24px;
  line-height: 1.6;
}

.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }

/* Split register layout */
.layout-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.panel-info {
  padding: 12px 8px 0 0;
}

.info-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-list li {
  position: relative;
  padding: 10px 0 10px 28px;
  font-size: 15px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}

.info-list li:last-child { border-bottom: none; }

.info-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.info-list a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.info-list a:hover { color: var(--brand-dark, #163a6e); }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.card.center { text-align: center; }
.card-form { padding: 32px; }
.card-queue, .card-done { max-width: 480px; margin: 0 auto; padding: 36px 28px; }

.card-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--brand-light);
}

.card-icon.wait {
  background: linear-gradient(135deg, var(--brand-light), var(--held-bg));
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm0 18c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8zm.5-13H11v6l5.2 3.2.8-1.3-4.5-2.7V7z'/%3E%3C/svg%3E") center / 28px no-repeat;
  background-color: var(--brand);
}

/* Forms */
form { display: grid; gap: 16px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  font-size: 16px;
  background: #fff;
  min-height: 48px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder { color: #a8a29e; }
input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 77, 140, 0.12);
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius);
  padding: 12px 20px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}

.btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.btn:active:not(:disabled) { transform: scale(0.98); }

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover:not(:disabled) { background: var(--brand-d); }

.btn.primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.ghost {
  background: var(--bg);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.btn.ghost:hover:not(:disabled) { background: var(--line); }

.btn.icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-soft);
}

.btn.block { width: 100%; }

.btn.danger {
  background: #fff;
  color: var(--reserved);
  border: 1px solid #f5c6c2;
}

.btn.danger.solid {
  background: var(--reserved);
  color: #fff;
  border: none;
}

.form-error {
  background: var(--reserved-bg);
  color: #922b21;
  border: 1px solid #f5c6c2;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  margin: 0;
}

.code-input {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.verify-resend {
  text-align: center;
  margin: 16px 0 0;
}

.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:disabled {
  color: var(--muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Queue */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.queue-big {
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  line-height: 1;
}

.queue-label { font-size: 14px; color: var(--muted); margin-top: 8px; }

.open-at { font-size: 17px; font-weight: 700; color: var(--brand); margin: 8px 0; }

.status-hero { margin: 20px 0; }

.queue-progress {
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  margin: 24px 0 16px;
  overflow: hidden;
}

.queue-progress-bar {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width 0.5s ease;
  width: 0;
}

.queue-meta {
  text-align: left;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.7;
}

.queue-meta b { color: var(--ink-soft); }

/* Map */
.map-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
}

.lg { display: inline-flex; align-items: center; gap: 6px; }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

.dot.free { background: var(--free); }
.dot.held { background: var(--held); }
.dot.reserved { background: var(--reserved); }
.dot.mine { background: var(--mine); }

.map-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: calc(100dvh - var(--header-h) - 100px);
  min-height: 420px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #faf9f7;
}

.building-filter { display: flex; gap: 6px; flex-wrap: wrap; }

.bf-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  min-height: 36px;
}

.bf-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.zoom-controls { display: flex; gap: 6px; }

.map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #ddd9d3;
  cursor: grab;
  touch-action: none;
}

.map-wrap.dragging { cursor: grabbing; }

.map-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.map-stage img {
  display: block;
  width: 2448px;
  max-width: none;
  user-select: none;
  pointer-events: none;
}

.hotspots { position: absolute; inset: 0; }

.spot {
  position: absolute;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}

.spot.free { background: rgba(45, 138, 78, 0.85); }
.spot.free:hover {
  background: var(--free);
  transform: scale(1.12);
  box-shadow: 0 4px 12px rgba(45, 138, 78, 0.4);
  z-index: 5;
}

.spot.held { background: rgba(199, 119, 0, 0.88); cursor: not-allowed; }
.spot.reserved { background: rgba(192, 57, 43, 0.88); cursor: not-allowed; }

.spot.mine {
  background: var(--mine);
  box-shadow: 0 0 0 3px rgba(30, 77, 140, 0.4);
  z-index: 6;
}

.map-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26, 31, 46, 0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

.map-actionbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  background: #faf9f7;
}

.ab-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.ab-spot {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.ab-timer {
  font-size: 14px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.ab-timer.urgent { color: var(--reserved); font-weight: 700; }

.actionbar-buttons { display: flex; gap: 10px; }

/* Done */
.check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--free-bg);
  color: var(--free);
  font-size: 32px;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin: 0 auto 12px;
  border: 2px solid #b8e6c8;
}

.check.cancelled {
  background: var(--reserved-bg);
  color: var(--reserved);
  border-color: #f5c6c2;
}

.done-spot {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.03em;
}

.done-deadline {
  display: inline-block;
  margin: 10px 0 14px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--held-bg);
  color: var(--held);
  font-size: 13px;
  font-weight: 600;
}

.done-box {
  margin: 16px 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.done-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.done-row:last-child { border-bottom: none; }
.done-row:nth-child(even) { background: #faf9f7; }

.done-row dt { margin: 0; color: var(--muted); font-weight: 500; }
.done-row dd { margin: 0; font-weight: 700; text-align: right; }

.done-actions { margin-top: 20px; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 31, 46, 0.5);
}

.modal-card {
  position: relative;
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-actions .btn { flex: 1; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 60;
  max-width: min(400px, calc(100% - 32px));
  text-align: center;
  box-shadow: var(--shadow);
}

.toast.err { background: var(--reserved); }
.toast.ok { background: var(--free); }

/* Admin */
html.admin-page-root, html.admin-page-root body.admin-page {
  width: 100%;
  min-height: 100%;
}

body.admin-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

body.admin-page .admin-wrap {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(16px, 3vw, 40px) 32px;
}

body.admin-page .admin-wrap:has(#gate:not([hidden])) {
  display: flex;
  align-items: center;
  justify-content: center;
}

body.admin-page #panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.admin-page .stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

body.admin-page .stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

body.admin-page .stat .n { font-size: 1.75rem; font-weight: 800; }
body.admin-page .stat .l { font-size: 13px; color: var(--muted); }
body.admin-page .stat.reserved .n { color: var(--held); }
body.admin-page .stat.sold .n { color: var(--free); }
body.admin-page .stat.cancelled .n { color: var(--reserved); }
body.admin-page .stat.free .n { color: var(--brand); }

body.admin-page .controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

body.admin-page .controls input,
body.admin-page .controls select {
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  min-height: 44px;
}

body.admin-page .controls input[type="search"] {
  flex: 1 1 260px;
  min-width: 0;
}

body.admin-page .table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

body.admin-page table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

body.admin-page th,
body.admin-page td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

body.admin-page th {
  background: #faf9f7;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  position: sticky;
  top: 0;
}

body.admin-page tbody tr:hover { background: #faf9f7; }

body.admin-page .pill {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

body.admin-page .pill.reserved { background: var(--held-bg); color: #92400e; }
body.admin-page .pill.sold { background: var(--free-bg); color: #166534; }
body.admin-page .pill.cancelled { background: var(--reserved-bg); color: #922b21; }

body.admin-page .row-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 220px;
}

body.admin-page .row-actions-main {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

body.admin-page .mini {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

body.admin-page .mini.sold { background: var(--free); color: #fff; }
body.admin-page .mini.cancel { background: var(--reserved); color: #fff; }
body.admin-page .mini.delete { background: #4a4a4a; color: #fff; }
body.admin-page .mini:disabled { opacity: 0.4; cursor: not-allowed; }

body.admin-page .gate { width: min(400px, 100%); }
body.admin-page .empty { padding: 40px; text-align: center; color: var(--muted); }

/* Responsive */
@media (max-width: 768px) {
  .layout-split { grid-template-columns: 1fr; gap: 20px; }
  .panel-info { padding: 0; }
  .card-form { padding: 24px 20px; }
  .grid2 { grid-template-columns: 1fr; }
  .map-panel { height: calc(100dvh - var(--header-h) - 80px); }
  .map-actionbar { flex-wrap: wrap; }
  .actionbar-buttons { width: 100%; }
  .actionbar-buttons .btn { flex: 1; }
  .step-text { font-size: 10px; }
}

@media (max-width: 900px) {
  body.admin-page .controls input[type="search"] { flex: 1 1 100%; }
}
