* { box-sizing: border-box; }

:root {
  --space-xs: 6px;
  --space-s: 10px;
  --space-m: 14px;
  --space-l: 18px;
  --space-xl: 22px;
  --space-xxl: 28px;
  --pad-top: calc(env(safe-area-inset-top, 0px) + var(--space-xl));
  --pad-top-mobile: calc(env(safe-area-inset-top, 0px) + 20px);
  --pad-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: auto;
  min-height: 100%;
  touch-action: pan-y;
  -ms-touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  overflow-y: auto;
}

body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.06), transparent 40%),
              radial-gradient(circle at 80% 0%, rgba(255, 173, 96, 0.15), transparent 40%),
              #0d1224;
  color: #e9eefc;
  font-family: 'Manrope', 'Space Grotesk', system-ui, -apple-system, sans-serif;
  touch-action: pan-y;
  overscroll-behavior: auto;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--pad-top) var(--space-l) calc(var(--space-l) + var(--pad-bottom));
  min-height: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-s);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: #97a8d6;
}

h1 {
  margin: 4px 0 0 0;
  font-size: 28px;
}

.hint {
  margin: 6px 0 0 0;
  color: #b6c4e5;
  font-size: 14px;
}

.brand-ikea {
  background: linear-gradient(120deg, #0051ba, #f7cb00, #0051ba);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ikeaFlow 3s ease-in-out infinite;
}

@keyframes ikeaFlow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.meta {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #97a8d6;
  font-weight: 700;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-m);
  align-content: start;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: var(--space-l);
  background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: 0 24px 60px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card.free {
  border-color: rgba(0, 210, 140, 0.25);
  background: linear-gradient(145deg, rgba(0, 210, 140, 0.12), rgba(0, 210, 140, 0.08));
}

.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 26px 80px rgba(0,0,0,0.4);
}

.card.reserved {
  border-color: rgba(255, 95, 109, 0.35);
  background: linear-gradient(145deg, rgba(255, 95, 109, 0.16), rgba(255, 95, 109, 0.1));
}

.card h3 {
  margin: 0 0 6px 0;
}

.card p {
  margin: 0;
  color: #b6c4e5;
  font-size: 14px;
}

.muted { color: #9bb0df; }

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #dce6ff;
}

.chip.free { border-color: rgba(0, 210, 140, 0.45); background: rgba(0, 210, 140, 0.12); }
.chip.reserved { border-color: rgba(255, 125, 125, 0.4); background: rgba(255, 95, 109, 0.14); }
.chip.total { border-color: rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.08); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.badge-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #dce6ff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #9bb0df;
}

.card a {
  color: #ffb48f;
  text-decoration: none;
  font-weight: 700;
}

.card a:hover { text-decoration: underline; }

.label { display: none; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  z-index: 20;
}

.hidden { display: none; }

.modal {
  background: #0f1730;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 18px;
  width: min(420px, 90vw);
  max-height: 90vh;
  overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal h2 { margin: 0; }
.modal p { margin: 0; color: #b6c4e5; }
.modal label { font-weight: 600; color: #dce6ff; }

.modal input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255,255,255,0.04);
  color: #e9eefc;
  font-size: 16px;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.solid, .ghost {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255,255,255,0.06);
  color: #e9eefc;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.solid {
  background: linear-gradient(135deg, #ff9f6e, #ff6b87);
  border-color: rgba(255, 255, 255, 0.22);
  color: #0c1120;
}

.solid:disabled { opacity: 0.6; cursor: not-allowed; }
.solid:hover:not(:disabled), .ghost:hover { transform: translateY(-1px); }

.error {
  color: #ff8b8b;
  font-size: 14px;
  margin-top: 2px;
}

.availability {
  margin: 6px 0;
  font-weight: 700;
  color: #dce6ff;
}

.reserved-list {
  margin: 6px 0 10px 0;
  padding: 0;
}

.reserved-list ul {
  list-style: none;
  padding-left: 0;
  margin: 4px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #dce6ff;
}

.reserved-list li {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.reserved-label {
  margin: 0;
  font-weight: 700;
  color: #dce6ff;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px 0;
}

.slider-row input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.slider-row span {
  min-width: 36px;
  text-align: right;
  font-weight: 700;
  color: #dce6ff;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9f6e, #ff6b87);
  border: 2px solid #0f1730;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
}

.slider-row input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff9f6e, #ff6b87);
  border: 2px solid #0f1730;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
}

.slider-row input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.toast {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px;
  z-index: 30;
  pointer-events: none;
}

.toast-content {
  pointer-events: all;
  background: rgba(15, 23, 48, 0.95);
  color: #e9eefc;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 14px 16px;
  width: min(720px, 94vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.45);
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  font-size: 14px;
}

.toast-text {
  flex: 1 1 auto;
  min-width: 220px;
}

.toast button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #e9eefc;
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 700;
  touch-action: manipulation;
  align-self: center;
}

.toast button:hover { background: rgba(255, 255, 255, 0.18); }
.toast.hidden { display: none; }

@media (max-width: 640px) {
  body { overflow: auto; }
  .page {
    padding: var(--pad-top-mobile) var(--space-m) calc(var(--space-m) + var(--pad-bottom));
    gap: var(--space-m);
  }
  .hero { flex-direction: column; align-items: flex-start; }
  h1 { font-size: 22px; }
  .grid {
    grid-template-columns: 1fr;
    gap: var(--space-s);
    align-content: start;
  }
  .card { padding: var(--space-m); }
  .modal {
    width: 92vw;
    padding: 14px;
    gap: 8px;
  }
  .modal h2 { font-size: 18px; }
  .modal p { font-size: 13px; }
  .modal input { font-size: 16px; }
  .actions { justify-content: space-between; }
  .toast-content { width: 94vw; justify-content: space-between; }
}
