:root {
  --bg: #0b1220;
  --surface: #131c2f;
  --surface-soft: #1b2740;
  --muted: #93a3b8;
  --text: #e7eef8;
  --primary: #2d8cff;
  --success: #1abc9c;
  --danger: #f87171;
  --warning: #f59e0b;
  --line: rgba(255,255,255,0.08);
}

html[data-theme="light"] {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f1f5ff;
  --muted: #5d6f87;
  --text: #0e1728;
  --primary: #246bff;
  --line: rgba(25, 38, 80, 0.08);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 250px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  font-weight: 700;
  font-size: 1.2rem;
  margin-bottom: 20px;
}

.sidebar a {
  display: block;
  color: var(--text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-weight: 500;
}

.sidebar a:hover {
  background: rgba(45, 140, 255, 0.18);
}

.content {
  flex: 1;
  padding: 20px;
}

.page-header h1 {
  font-size: 1.3rem;
  margin-bottom: 2px;
}

.card,
.glass-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
}

.form-control,
.form-select {
  background: var(--surface-soft);
  border-color: var(--line);
  color: var(--text);
}

.modal-content {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.modal-header,
.modal-footer {
  border-color: var(--line);
}

.modal-title,
.modal .form-label,
.modal .text-secondary,
.modal .btn-link {
  color: var(--text) !important;
}

.modal .btn-close {
  filter: invert(1) grayscale(1);
}

html[data-theme="light"] .modal .btn-close {
  filter: none;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(36,107,255,.22);
  background: var(--surface-soft);
  color: var(--text);
}

.table-modern {
  color: var(--text);
}

.table-modern thead th {
  border-bottom-color: var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: .85rem;
}

.table-modern tbody td {
  border-top-color: var(--line);
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .75rem;
  background: rgba(45,140,255,.16);
  color: var(--text);
}

.stat-card {
  min-height: 92px;
}

.skeleton {
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.booking-board {
  overflow: auto;
  min-height: 540px;
}

.booking-board-empty {
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.booking-board-grid {
  display: grid;
  grid-template-columns: 80px repeat(var(--field-count), minmax(220px, 1fr));
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.booking-header-cell {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 64px;
  padding: 10px;
  font-weight: 600;
}

.booking-header-cell:last-child {
  border-right: none;
}

.field-header-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: .8rem;
  color: var(--muted);
}

.field-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.time-column {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.time-slot {
  height: 42px;
  border-bottom: 1px solid var(--line);
  padding: 4px 8px;
  color: var(--muted);
  font-size: .8rem;
}

.field-column {
  position: relative;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.01), transparent);
}

.field-column:last-child {
  border-right: none;
}

.field-slot {
  height: 42px;
  border-bottom: 1px solid var(--line);
}

.field-slot:hover {
  background: rgba(45,140,255,.07);
}

.booking-card {
  position: absolute;
  left: 6px;
  right: 6px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.25);
  padding: 8px;
  color: #fff;
  font-size: .78rem;
  cursor: grab;
  box-shadow: 0 8px 18px rgba(0,0,0,.25);
  transition: transform .12s ease, box-shadow .12s ease;
  z-index: 3;
  touch-action: none;
}

.booking-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0,0,0,.35);
}

.booking-card .booking-title {
  font-size: .83rem;
  font-weight: 700;
}

.booking-card .booking-meta {
  opacity: .9;
  margin-top: 2px;
}

.booking-status {
  display: inline-block;
  margin-top: 4px;
  font-weight: 600;
  background: rgba(0,0,0,.2);
  border-radius: 999px;
  padding: 2px 7px;
}

.booking-resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  cursor: ns-resize;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  touch-action: none;
}

.booking-card-touch-drag {
  opacity: .88;
  box-shadow: 0 14px 26px rgba(0,0,0,.35);
  z-index: 8;
}

.autocomplete-list {
  margin-top: 4px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  max-height: 180px;
  overflow-y: auto;
}

.autocomplete-item {
  padding: 9px 11px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.autocomplete-item:hover {
  background: rgba(45,140,255,.14);
}

.quick-customer-box {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--surface-soft);
}

.customer-list-item {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.customer-list-item:hover {
  background: rgba(45,140,255,.12);
}

@media (max-width: 992px) {
  .app-shell { display: block; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
  }
  .sidebar .brand {
    margin-right: 10px;
    margin-bottom: 0;
    white-space: nowrap;
  }
  .sidebar a { white-space: nowrap; margin-bottom: 0; }
  .booking-board-grid {
    grid-template-columns: 62px repeat(var(--field-count), minmax(180px, 1fr));
  }
  .time-slot,
  .field-slot {
    height: 36px;
  }
}
