:root {
  --bg: #080d17;
  --bg-accent: #0d2137;
  --topbar-bg: rgba(8, 13, 23, 0.86);
  --surface: #0f172a;
  --surface-2: #162036;
  --border: rgba(148, 163, 184, 0.16);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.18);
  --blue: #38bdf8;
  --amber: #f59e0b;
  --red: #ef4444;
  --badge-green-text: #34d399;
  --badge-amber-text: #fbbf24;
  --badge-red-text: #f87171;
  --badge-blue-text: #7dd3fc;
  --danger-text: #fca5a5;
  --alert-error-text: #fecaca;
  --alert-success-text: #a7f3d0;
  --radius: 14px;
}

[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-accent: #e0f2fe;
  --topbar-bg: rgba(255, 255, 255, 0.88);
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
  --text: #0f172a;
  --muted: #475569;
  --emerald: #059669;
  --emerald-glow: rgba(5, 150, 105, 0.16);
  --blue: #0284c7;
  --amber: #d97706;
  --red: #dc2626;
  --badge-green-text: #047857;
  --badge-amber-text: #b45309;
  --badge-red-text: #b91c1c;
  --badge-blue-text: #0369a1;
  --danger-text: #b91c1c;
  --alert-error-text: #991b1b;
  --alert-success-text: #065f46;
}

[data-theme="mint"] {
  --bg: #eef7f3;
  --bg-accent: #d1fae5;
  --topbar-bg: rgba(246, 253, 249, 0.9);
  --surface: #ffffff;
  --surface-2: #ecfdf5;
  --border: rgba(6, 95, 70, 0.12);
  --shadow: 0 10px 28px rgba(6, 78, 59, 0.06);
  --text: #06281e;
  --muted: #3b6355;
  --emerald: #059669;
  --emerald-glow: rgba(16, 185, 129, 0.22);
  --blue: #0284c7;
  --amber: #d97706;
  --red: #dc2626;
  --badge-green-text: #047857;
  --badge-amber-text: #b45309;
  --badge-red-text: #b91c1c;
  --badge-blue-text: #0369a1;
  --danger-text: #b91c1c;
  --alert-error-text: #991b1b;
  --alert-success-text: #065f46;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(circle at top right, var(--bg-accent) 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  transition: background 0.2s ease, color 0.2s ease;
}

.mono {
  font-family: 'JetBrains Mono', monospace;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.theme-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.theme-select:focus {
  border-color: var(--emerald);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald), #059669);
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  box-shadow: 0 0 20px var(--emerald-glow);
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-title .amp {
  color: var(--emerald);
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.nav-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.nav-tab {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 8px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.18s ease;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.active {
  background: var(--emerald);
  color: #032218;
}

.env-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--blue);
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--emerald);
  margin-bottom: 4px;
}

h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.rent-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .rent-grid {
    grid-template-columns: 1fr;
  }
}

.ad-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.14), rgba(56, 189, 248, 0.1));
  border: 1px solid rgba(16, 185, 129, 0.28);
  margin-bottom: 18px;
  font-size: 0.88rem;
}

.ad-chip {
  font-size: 0.68rem;
  font-weight: 800;
  background: var(--emerald);
  color: #032218;
  padding: 2px 7px;
  border-radius: 6px;
}

.slots-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.92rem;
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 10px;
}

.slot-tile {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  transition: border-color 0.15s;
}

.slot-tile.available {
  border-color: rgba(16, 185, 129, 0.35);
}

.slot-tile.empty {
  opacity: 0.48;
}

.slot-num {
  font-size: 0.76rem;
  color: var(--muted);
}

.slot-sn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 3px 0;
}

.slot-bat {
  font-size: 0.78rem;
  color: var(--emerald);
  font-weight: 600;
}

.pricing-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.price-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.price-label {
  display: block;
  font-size: 0.76rem;
  color: var(--muted);
}

.price-val {
  font-size: 1.15rem;
  color: var(--emerald);
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.85rem;
  font-weight: 600;
}

.req {
  color: var(--red);
}

input,
.select-input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 0.94rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
.select-input:focus {
  border-color: var(--emerald);
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

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

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

.btn-lg {
  padding: 13px 18px;
  font-size: 0.98rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--emerald), #059669);
  color: #ffffff;
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger-text);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.78rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--badge-green-text);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--badge-amber-text);
}

.badge-red {
  background: rgba(239, 68, 68, 0.16);
  color: var(--badge-red-text);
}

.badge-blue {
  background: rgba(56, 189, 248, 0.15);
  color: var(--badge-blue-text);
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ticket-details {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
}

.return-box {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.return-actions {
  display: flex;
  gap: 10px;
}

.return-actions .select-input {
  flex: 1;
}

.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.alert-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: var(--alert-error-text);
}

.alert-success {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--alert-success-text);
}

/* QR GRID */
.section-head {
  margin-bottom: 20px;
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.qr-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.qr-frame {
  background: #ffffff;
  padding: 12px;
  border-radius: 14px;
  display: inline-block;
}

.qr-frame img {
  width: 210px;
  height: 210px;
  display: block;
}

.qr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.ad-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  align-items: end;
}

/* ADMIN */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.kpi-card.warn {
  border-color: rgba(245, 158, 11, 0.35);
}

.kpi-card.danger {
  border-color: rgba(239, 68, 68, 0.35);
}

.kpi-card.ok {
  border-color: rgba(16, 185, 129, 0.35);
}

.kpi-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.kpi-val {
  font-size: 1.75rem;
  font-weight: 800;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-wrap {
  flex: 1;
  min-width: 250px;
}

.search-wrap input {
  width: 100%;
}

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

.pill {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.pill.active {
  background: var(--emerald);
  color: #032218;
  border-color: var(--emerald);
}

.table-wrap {
  overflow-x: auto;
}

.trace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.trace-table th,
.trace-table td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.trace-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-2);
  border: 1px solid var(--emerald);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 60;
  font-size: 0.9rem;
}

.settings-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch input:checked + .slider {
  background: var(--emerald);
  border-color: var(--emerald);
}

.switch input:checked + .slider::after {
  transform: translateX(22px);
  background: #ffffff;
}

.switch-label {
  font-weight: 700;
  font-size: 0.86rem;
  min-width: 30px;
}

.hours-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 520px) {
  .hours-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hour-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 11px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.hour-btn:hover {
  border-color: var(--emerald);
}

.hour-btn.active {
  background: var(--emerald-glow);
  border-color: var(--emerald);
  box-shadow: 0 0 0 1px var(--emerald);
}

.hour-btn .hr-label {
  font-weight: 700;
  font-size: 0.9rem;
}

.hour-btn .hr-price {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--emerald);
  font-weight: 600;
}

.pricing-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}
