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

:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #f59e0b;
  --success: #10b981;
  --border: #e2e8f0;
  --row-hover: #f8fafc;
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 50%, #ecfdf5 100%);
  min-height: 100vh;
  color: var(--text);
  padding: 24px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  background: var(--panel);
  padding: 18px 24px;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

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

.filters {
  display: flex;
  gap: 10px;
}

.input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.btn {
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #f1f5f9;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover {
  background: #d97706;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 8px;
}

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

.stat-card {
  background: var(--panel);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid var(--primary);
}

.stat-card.arrivals { border-left-color: var(--success); }
.stat-card.stayover { border-left-color: var(--warning); }
.stat-card.departures { border-left-color: var(--danger); }

.stat-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
}

.table-wrap {
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

.data-table thead {
  background: #f8fafc;
}

.data-table th {
  text-align: left;
  padding: 14px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
  background: var(--row-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.actions-col,
.actions {
  white-space: nowrap;
}

.actions {
  display: flex;
  gap: 6px;
}

.empty {
  text-align: center;
  padding: 40px !important;
  color: var(--muted);
}

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-arrived { background: #d1fae5; color: #065f46; }
.badge-confirmed { background: #dbeafe; color: #1e40af; }
.badge-checkedout { background: #fee2e2; color: #991b1b; }
.badge-default { background: #e2e8f0; color: #334155; }

.type-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.type-Arrivals { background: #dcfce7; color: #166534; }
.type-StayOver { background: #fef3c7; color: #92400e; }
.type-Departures { background: #fee2e2; color: #991b1b; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: pop 0.18s ease-out;
}

.modal-lg {
  max-width: 920px;
}

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

.inner-toolbar {
  margin-bottom: 16px;
}

.all-requests-list {
  max-height: 60vh;
  overflow-y: auto;
}

.req-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  gap: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.req-card:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.req-card-info {
  flex: 1;
  min-width: 0;
}

.req-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.req-card-title {
  font-weight: 700;
  font-size: 15px;
}

.req-card-sub {
  font-size: 12px;
  color: var(--muted);
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.req-card-guest {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 4px;
}

.req-card-guest .muted {
  display: inline;
}

.req-card-notes {
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
  margin-top: 4px;
}

.req-card-time {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

.req-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.req-type-Cab { background: #dbeafe; color: #1e40af; }
.req-type-BirthdayCake { background: #fce7f3; color: #9d174d; }
.req-type-CelebrationDecoration { background: #fef3c7; color: #92400e; }
.req-type-default { background: #e2e8f0; color: #334155; }

@keyframes pop {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 0 4px;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-group-wide {
  grid-column: span 2;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

textarea.input {
  resize: vertical;
  font-family: inherit;
}

.existing-requests {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.existing-requests:empty {
  display: none;
}

.existing-requests h4 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.req-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  gap: 10px;
}

.req-item-info {
  flex: 1;
  min-width: 0;
}

.req-item-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 2px;
}

.req-item-info p {
  font-size: 13px;
  color: var(--muted);
  word-break: break-word;
}

.req-item-info time {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  font-size: 14px;
  font-weight: 500;
  z-index: 2000;
  animation: slideIn 0.2s ease-out;
}

.toast.hidden { display: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

@media (max-width: 640px) {
  body { padding: 14px; }
  .grid { grid-template-columns: 1fr; }
  .form-group-wide { grid-column: span 1; }
  .topbar { flex-direction: column; gap: 14px; align-items: stretch; }
}
