:root {
  --blue-dark: #1A3A5C;
  --blue-mid: #2563A8;
  --teal: #0E7490;
  --green: #166534;
  --green-bg: #DCFCE7;
  --orange: #9A3412;
  --orange-bg: #FEF3C7;
  --red: #991B1B;
  --red-bg: #FEE2E2;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-700: #374151;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-700);
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
}

a {
  color: var(--blue-mid);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--blue-dark);
  margin-bottom: 0.5rem;
}

/* Navbar */
nav {
  background: white;
  box-shadow: var(--shadow);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--blue-dark);
  text-decoration: none !important;
}

.nav-links {
  display: flex;
  gap: 16px;
  align-items: center;
}

.menu-mobile-btn {
  display: none;
}

@media (max-width: 600px) {
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 60px;
    left: 0;
    background: white;
    padding: 16px;
    box-shadow: var(--shadow);
  }

  .nav-links.active {
    display: flex;
  }

  .menu-mobile-btn {
    display: block;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--blue-dark);
  }
}

/* Credits Badge */
.credits-badge {
  background: var(--green);
  color: white;
  padding: 4px 8px;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-weight: bold;
  text-align: center;
  text-decoration: none !important;
  transition: opacity 0.2s, background 0.2s;
}

.btn-primary {
  background: var(--blue-mid);
  color: white;
}

.btn-primary:active {
  background: var(--blue-dark);
}

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-success {
  background: var(--green);
  color: white;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 1.125rem;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 16px;
  border-bottom: 1px solid var(--gray-100);
  font-weight: bold;
  font-size: 1.1rem;
}

.card-body {
  padding: 16px;
}

.card-footer {
  padding: 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
}

/* Badges */
.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: bold;
  display: inline-block;
}

.badge-pending {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-deposited {
  background: #DBEAFE;
  color: var(--blue-dark);
}

.badge-picked_up {
  background: var(--green-bg);
  color: var(--green);
}

.badge-expired {
  background: var(--red-bg);
  color: var(--red);
}

.badge-cancelled {
  background: var(--orange-bg);
  color: var(--orange);
}

.shop-open {
  color: var(--green);
  font-weight: bold;
}

.shop-open::before {
  content: '🟢 ';
}

.shop-closed {
  color: var(--red);
  font-weight: bold;
}

.shop-closed::before {
  content: '🔴 ';
}

.shop-full {
  color: var(--orange);
  font-weight: bold;
}

.shop-full::before {
  content: '⚡ ';
}

/* PIN */
.pin-display {
  font-family: monospace;
  font-size: 3rem;
  letter-spacing: 0.5em;
  color: var(--blue-dark);
  text-align: center;
  background: var(--gray-50);
  border: 2px dashed var(--gray-700);
  padding: 16px;
  border-radius: var(--radius);
  margin: 16px 0;
}

.qr-container {
  padding: 16px;
  border: 1px solid var(--gray-100);
  display: inline-block;
  background: white;
  border-radius: var(--radius);
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-success {
  background: var(--green-bg);
  color: var(--green);
}

.alert-error {
  background: var(--red-bg);
  color: var(--red);
}

.alert-warning {
  background: var(--orange-bg);
  color: var(--orange);
}

.alert-info {
  background: #DBEAFE;
  color: var(--blue-dark);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #D1D5DB;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 1rem;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-error {
  color: var(--red);
  font-size: 0.875rem;
  margin-top: 4px;
}

.form-hint {
  color: var(--gray-700);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.table th,
.table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--gray-100);
}

.table th {
  background: var(--gray-50);
}

.table-hover tr:hover {
  background: var(--gray-50);
}

/* Capacity Bar */
.capacity-container {
  background: var(--gray-100);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.capacity-bar {
  background: var(--blue-mid);
  height: 100%;
  width: 0;
  transition: width 0.5s ease;
}

.capacity-text {
  font-size: 0.75rem;
  color: var(--gray-700);
  text-align: right;
  margin-top: 4px;
}

/* Stars Rating */
.stars {
  display: inline-flex;
  flex-direction: row-reverse;
}

.stars input {
  display: none;
}

.stars label {
  font-size: 2rem;
  color: #D1D5DB;
  cursor: pointer;
  padding: 0 4px;
}

.stars input:checked~label,
.stars label:hover,
.stars label:hover~label {
  color: #FBBF24;
}

.section-title {
  border-left: 4px solid var(--blue-mid);
  padding-left: 12px;
  margin: 24px 0 16px 0;
}

.pin-ready {
  border-color: var(--green) !important;
  background: var(--green-bg) !important;
  outline: none;
}

.page-header {
  padding: 24px 0;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 24px;
}

.page-content {
  padding-bottom: 48px;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-4 {
  margin-bottom: 16px;
}

/* Map Area */
#map {
  height: 70vh;
  width: 100%;
  border-radius: var(--radius);
}

.map-layout {
  display: flex;
  gap: 16px;
}

.map-list {
  width: 350px;
  overflow-y: auto;
  height: 70vh;
}

.map-container {
  flex-grow: 1;
}

@media (max-width: 768px) {
  .map-layout {
    flex-direction: column;
  }

  .map-list {
    width: 100%;
    height: 40vh;
  }

  #map {
    height: 50vh;
  }
}

footer {
  background: white;
  padding: 24px 0;
  margin-top: 48px;
  text-align: center;
  color: var(--gray-700);
  border-top: 1px solid var(--gray-100);
}

footer a {
  margin: 0 8px;
}

/* Dashboard Ring Chart */
.ring-chart {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(var(--chart-color) var(--pct), var(--gray-100) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.ring-chart::before {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  background-color: white;
  border-radius: 50%;
}

.ring-content {
  position: relative;
  z-index: 10;
  text-align: center;
}

.ring-content .big-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--blue-dark);
  line-height: 1;
}

.ring-content .small-label {
  font-size: 0.75rem;
  color: var(--gray-700);
}

/* Status Badges for Dashboard Cards */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  gap: 4px;
}

.status-pill.danger {
  background: var(--red-bg);
  color: var(--red);
}

.status-pill.warning {
  background: var(--orange-bg);
  color: var(--orange);
}

.status-pill.safe {
  background: var(--green-bg);
  color: var(--green);
}

/* Timeline Cards (Mobile First) */
.timeline-card {
  background: white;
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: transform 0.2s, box-shadow 0.2s;
}

.timeline-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.timeline-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.timeline-icon.blue {
  background: #DBEAFE;
  color: var(--blue-mid);
}

.timeline-body {
  flex-grow: 1;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}

.timeline-title {
  font-weight: bold;
  color: var(--blue-dark);
  margin-bottom: 2px;
}

.timeline-subtitle {
  font-size: 0.85rem;
  color: var(--gray-700);
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  text-align: center;
  border: 1px solid var(--gray-100);
}

.kpi-card .number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--blue-dark);
  line-height: 1.2;
}

.kpi-card .label {
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-top: 8px;
  font-weight: 500;
}