:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3f56;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #ff6b35;
  --accent2: #f7c948;
  --success: #3dd68c;
  --danger: #ff5c5c;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links { display: flex; gap: 1rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h2, .card h3 { margin-bottom: 0.75rem; font-size: 1.1rem; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.container-wide { max-width: 1280px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #e85d2c); color: #fff; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: #0f1419; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.9rem; }

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active { background: rgba(61, 214, 140, 0.2); color: var(--success); }
.badge-trial { background: rgba(247, 201, 72, 0.2); color: var(--accent2); }
.badge-expired { background: rgba(255, 92, 92, 0.2); color: var(--danger); }

.stat-card {
  background: var(--surface2);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}

.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--accent2); }
.stat-card .label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }

.offer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.offer-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.offer-card .distance {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--accent);
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
}

.offer-card h3 { margin: 0.5rem 0 0.25rem; font-size: 1rem; }
.offer-card .shop { color: var(--muted); font-size: 0.85rem; }
.offer-card .price { margin-top: 0.5rem; font-weight: 700; color: var(--success); }
.offer-card .discount { color: var(--accent); font-weight: 700; }

.hidden { display: none !important; }
.text-muted { color: var(--muted); font-size: 0.9rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  max-width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

#map {
  width: 100%;
  height: 320px;
  border-radius: var(--radius);
  background: var(--surface2);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.map-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 0 12px var(--accent);
}

.map-dot.user {
  background: #4dabf7;
  box-shadow: 0 0 12px #4dabf7;
  width: 18px;
  height: 18px;
}

.map-dot::after {
  content: attr(data-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: var(--surface);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  margin-bottom: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.map-dot:hover::after { opacity: 1; }

.location-map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 0;
  margin: 0.5rem 0;
}

.location-picker input[type="text"] {
  width: 100%;
}

.map-hint {
  font-size: 0.85rem;
  margin: 0.35rem 0 0.5rem;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.coords-display {
  font-size: 0.85rem;
}

.category-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.category-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border, #2a2a3a);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.category-option input {
  width: auto;
  margin: 0;
}

.category-option:has(input:checked) {
  border-color: var(--accent, #6c5ce7);
  background: rgba(108, 92, 231, 0.08);
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.input-row input {
  flex: 1;
}

.leaflet-container {
  font-family: var(--font);
  background: var(--surface2);
}

.campaign-intro {
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.campaign-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.campaign-card:last-child { margin-bottom: 0; }

.campaign-card h3 {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}

.campaign-card-header {
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.campaign-budget-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.budget-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.budget-bar-fill {
  height: 100%;
  background: var(--success);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.budget-bar.warning .budget-bar-fill { background: var(--accent2); }
.budget-bar.exhausted .budget-bar-fill { background: var(--danger); }

.campaign-footnote {
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.admin-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.admin-filters input,
.admin-filters select {
  width: auto;
  min-width: 140px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 36px;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.bar-label { color: var(--muted); text-transform: capitalize; }
.bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px;
}
.bar-value { text-align: right; font-weight: 600; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-panel {
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  margin: 0;
}

.detail-list {
  list-style: none;
  font-size: 0.9rem;
}

.detail-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.danger-zone {
  border: 1px solid rgba(255, 92, 92, 0.4);
  background: rgba(255, 92, 92, 0.08);
  border-radius: 8px;
  padding: 1rem;
}

.danger-zone h3 {
  color: var(--danger);
  margin-bottom: 0.5rem;
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.hero {
  text-align: center;
  padding: 3rem 1rem;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, #fff, var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { color: var(--muted); max-width: 520px; margin: 0 auto 2rem; font-size: 1.1rem; }

.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

.plan-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.plan-card.selected, .plan-card:hover { border-color: var(--accent); }
.plan-card .plan-price { font-size: 1.6rem; font-weight: 700; color: var(--accent2); }
.plan-card ul { list-style: none; margin-top: 0.75rem; }
.plan-card li { padding: 0.25rem 0; color: var(--muted); font-size: 0.9rem; }
.plan-card li::before { content: '✓ '; color: var(--success); }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.6rem; }
  header { flex-direction: column; gap: 1rem; }
}
