:root {
  --bg: #05030a;
  --bg-alt: #110b26;
  --accent: #f2b01e;
  --accent-soft: rgba(242, 176, 30, 0.14);
  --accent-strong: #ffcc4d;
  --fg: #f7f5ff;
  --fg-soft: #c3bde6;
  --danger: #ff4b5c;
  --success: #3ad17c;
  --border: rgba(255, 255, 255, 0.05);
  --radius: 10px;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.7);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #25124d 0, #05030a 55%, #000 100%);
  color: var(--fg);
}

body {
  display: flex;
}

/* App Layout */

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #190b38, #3b0c7a);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.logo-title {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--fg-soft);
}

.version {
  color: var(--accent-strong);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  min-height: 0;
}

/* Sidebar */

.sidebar {
  background: rgba(9, 4, 24, 0.98);
  border-right: 1px solid var(--border);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.sidebar h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.panel-section {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 0.6rem 0.7rem;
  background: rgba(14, 7, 33, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.panel-section label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.3rem;
  color: var(--fg-soft);
}

.panel-section label input,
.panel-section label select,
.panel-section label textarea {
  width: 100%;
  margin-top: 0.15rem;
}

.small {
  font-size: 0.75rem;
  color: var(--fg-soft);
}

/* Inputs */

input,
select,
textarea {
  background: rgba(5, 3, 20, 0.9);
  border-radius: 6px;
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  font-size: 0.8rem;
  color: var(--fg);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(242, 176, 30, 0.6);
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0.45rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  cursor: pointer;
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s ease;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1a0c0c;
  box-shadow: 0 12px 30px rgba(242, 176, 30, 0.5);
}

.btn.secondary {
  background: rgba(155, 76, 255, 0.2);
  border-color: rgba(155, 76, 255, 0.5);
}

.btn.ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg-soft);
}

.btn.circle {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  padding: 0;
}

.btn.small {
  font-size: 0.7rem;
  padding: 0.25rem 0.6rem;
}

.btn.full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

.btn:not(:disabled):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* Map */

.map-container {
  position: relative;
  min-height: 0;
}

#map {
  position: absolute;
  inset: 0;
}

/* Map overlays */

.map-overlay {
  position: absolute;
  z-index: 5;
}

.bottom-left {
  left: 0.75rem;
  bottom: 0.75rem;
}

.bottom-right {
  right: 0.75rem;
  bottom: 0.75rem;
}

.legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(5, 3, 15, 0.9);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--fg-soft);
}

.legend .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: inline-block;
}

.dot.merchant {
  background: #ffcc4d;
}

.dot.service {
  background: #4dd2ff;
}

.dot.event {
  background: #ff6bcb;
}

.dot.atm {
  background: #6bff8a;
}

/* Status badges */

.status {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.status-item {
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
}

.badge-pending {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.badge-ok {
  background: rgba(58, 209, 124, 0.15);
  color: var(--success);
}

.badge-error {
  background: rgba(255, 75, 92, 0.16);
  color: var(--danger);
}

/* Form */

.form.hidden {
  display: none;
}

/* Footer */

.footer {
  padding: 0.4rem 0.8rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--fg-soft);
  display: flex;
  justify-content: space-between;
  background: rgba(8, 3, 20, 0.95);
}

/* Responsive */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .sidebar {
    grid-row: 2;
  }

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

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .sidebar {
    position: absolute;
    inset: 56px 0 auto 0;
    max-height: calc(100vh - 56px);
    transform: translateY(-120%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateY(0);
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
