:root {
  --spa-dark: #0a1628;
  --spa-brown-dark: #0d2847;
  --spa-brown: #1565c0;
  --spa-brown-mid: #1976d2;
  --spa-brown-light: #42a5f5;
  --spa-tan: #90caf9;
  --spa-cream: #e3f2fd;
  --spa-white: #f8fbff;
  --spa-pastel1: #bbdefb;
  --spa-gold: #f57c00;
  --spa-gold-light: #ffb74d;
  --sidebar-width: 260px;
  --header-height: 60px;
  --transition: all 0.3s ease;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  background: var(--spa-cream);
  color: var(--spa-dark);
  margin: 0;
  padding: 0;
  font-size: 14px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--spa-brown-dark);
}

a { color: var(--spa-brown); text-decoration: none; }
a:hover { color: var(--spa-gold); }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--spa-dark) 0%, var(--spa-brown-dark) 100%);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
}
.sidebar.collapsed { width: 64px; }

.sidebar-header {
  padding: 1.2rem 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(201,162,39,0.2);
  min-height: var(--header-height);
}

.sidebar-header .brand { display: flex; align-items: center; gap: 10px; overflow: hidden; flex: 1; min-width: 0; }
.sidebar-header .brand-icon-sm {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
}
.sidebar-header .brand-text {
  color: var(--spa-cream);
  font-size: 1.05rem;
  font-weight: 600;
  font-family: 'Playfair Display', serif;
  white-space: nowrap;
}
.sidebar-header .brand-sub {
  color: var(--spa-gold-light);
  font-size: 0.65rem;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.toggle-btn {
  margin-left: auto;
  background: none; border: none;
  color: var(--spa-pastel1);
  cursor: pointer; padding: 4px; font-size: 1.1rem;
}
.toggle-btn:hover { color: var(--spa-gold); }

.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 0;
}

.nav-single {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  color: var(--spa-tan);
  transition: var(--transition);
}
.nav-single:hover { background: rgba(201,162,39,0.12); color: var(--spa-gold-light); }
.nav-single.active { background: rgba(201,162,39,0.18); color: var(--spa-gold); }
.nav-single .nav-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.07);
  border-radius: 8px; flex-shrink: 0; font-size: 0.85rem;
}
.nav-single .nav-label { flex: 1; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; }

.sidebar.collapsed .nav-label,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .brand-sub { display: none; }
.sidebar.collapsed .nav-single { justify-content: center; padding: 10px; }
.sidebar.collapsed .nav-single .nav-icon { margin: 0; }

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(201,162,39,0.2); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user .user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.9rem; flex-shrink: 0;
}
.sidebar-user .user-name { color: var(--spa-cream); font-size: 0.8rem; font-weight: 600; }
.sidebar-user .user-role { color: var(--spa-gold-light); font-size: 0.68rem; }
.sidebar.collapsed .sidebar-user .user-info { display: none; }

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}
.main-content.expanded { margin-left: 64px; }

.top-header {
  height: var(--header-height);
  background: var(--spa-white);
  border-bottom: 1px solid rgba(200,147,90,0.2);
  display: flex; align-items: center;
  padding: 0 1.5rem;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  gap: 1rem;
}
.page-title {
  font-size: 1rem; font-weight: 600;
  color: var(--spa-brown-dark);
  font-family: 'Playfair Display', serif;
}
.breadcrumb-nav { font-size: 0.75rem; color: #999; }
.breadcrumb-nav a { color: var(--spa-brown-mid); }
.breadcrumb-nav span.sep { margin: 0 6px; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-dropdown-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--spa-cream);
  border: 1px solid var(--spa-pastel1);
  border-radius: 10px; padding: 6px 12px; cursor: pointer;
}
.user-dropdown-btn .avatar-sm {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid));
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.75rem; font-weight: 700;
}
.content-body { flex: 1; padding: 1.5rem; }

.card-spa {
  background: var(--spa-white);
  border: 1px solid rgba(200,147,90,0.15);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  margin-bottom: 1.2rem;
}
.card-spa .card-header-spa {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(200,147,90,0.15);
  display: flex; align-items: center; gap: 10px;
  border-radius: 14px 14px 0 0;
}
.card-spa .card-header-spa h5 { margin: 0; font-size: 0.9rem; font-weight: 700; color: var(--spa-brown-dark); }
.card-spa .card-header-spa .header-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--spa-tan), var(--spa-pastel1));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--spa-brown); font-size: 0.85rem;
}
.card-spa .card-body-spa { padding: 1.25rem; }

.stat-card {
  background: var(--spa-white);
  border-radius: 14px;
  padding: 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  border: 1px solid rgba(200,147,90,0.15);
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.brown { background: linear-gradient(135deg, var(--spa-tan), var(--spa-pastel1)); color: var(--spa-brown-dark); }
.stat-icon.green { background: linear-gradient(135deg, #c8e6c8, #a8d8a8); color: #2e7d32; }
.stat-icon.blue { background: linear-gradient(135deg, #c8daf0, #a8c4e8); color: #1565c0; }
.stat-icon.gold { background: linear-gradient(135deg, #f5e8c0, #e8cc80); color: #8B6914; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--spa-brown-dark); line-height: 1; }
.stat-label { font-size: 0.75rem; color: #888; margin-top: 4px; }

.table-spa { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.table-spa thead th {
  background: linear-gradient(135deg, var(--spa-brown-dark), var(--spa-brown));
  color: var(--spa-tan);
  padding: 10px 12px; text-align: left; font-weight: 600; white-space: nowrap; border: none;
}
.table-spa thead th:first-child { border-radius: 8px 0 0 0; }
.table-spa thead th:last-child { border-radius: 0 8px 0 0; }
.table-spa tbody tr { border-bottom: 1px solid rgba(200,147,90,0.1); }
.table-spa tbody tr:hover { background: rgba(187,222,251,0.35); }
.table-spa tbody td { padding: 9px 12px; color: var(--spa-dark); vertical-align: middle; }

.btn-spa {
  border: none; border-radius: 7px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: var(--transition);
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.btn-spa:hover { transform: translateY(-1px); text-decoration: none; }
.btn-spa-primary { background: linear-gradient(135deg, var(--spa-brown-dark), var(--spa-brown-mid)); color: #fff; }
.btn-spa-secondary { background: var(--spa-cream); border: 1px solid var(--spa-pastel1); color: var(--spa-brown); }
.btn-spa-success { background: linear-gradient(135deg, #2e7d32, #43a047); color: #fff; }
.btn-spa-danger { background: linear-gradient(135deg, #b71c1c, #e53935); color: #fff; }
.btn-spa-warning { background: linear-gradient(135deg, #e65100, #f57c00); color: #fff; }
.btn-spa-info { background: linear-gradient(135deg, #1565c0, #1976d2); color: #fff; }
.btn-spa-gold { background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid)); color: #fff; }
.btn-spa-sm { padding: 4px 10px; font-size: 0.75rem; }
.btn-spa:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.badge-spa {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600;
}
.badge-open { background: #e3f2fd; color: #1565c0; }
.badge-confirmed, .badge-done, .badge-paid, .badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-cancel, .badge-inactive { background: #ffebee; color: #c62828; }
.badge-void { background: #424242; color: #eee; }
.badge-pending { background: #fff8e1; color: #e65100; }

.form-spa-label {
  font-size: 0.8rem; font-weight: 600;
  color: var(--spa-brown-dark);
  margin-bottom: 4px; display: block;
}
.form-spa-control {
  width: 100%; padding: 8px 12px;
  border: 1.5px solid rgba(21,101,192,0.25);
  border-radius: 8px; background: var(--spa-white);
  color: var(--spa-dark); font-size: 0.83rem;
}
.form-spa-control:focus {
  outline: none;
  border-color: var(--spa-brown-mid);
  box-shadow: 0 0 0 3px rgba(21,101,192,0.12);
}
.form-spa-control-sm { padding: 5px 8px; font-size: 0.78rem; }
.form-spa-group { margin-bottom: 1rem; }

.modal-spa .modal-content {
  border-radius: 16px;
  border: 1px solid rgba(200,147,90,0.2);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-spa .modal-header {
  background: linear-gradient(135deg, var(--spa-brown-dark), var(--spa-brown));
  color: #fff; border-radius: 16px 16px 0 0; border-bottom: none;
}
.modal-spa .modal-header .modal-title { font-family: 'Playfair Display', serif; font-size: 1rem; }
.modal-spa .modal-header .btn-close { filter: brightness(10); }
.modal-spa .modal-body { padding: 1.5rem; background: var(--spa-white); }
.modal-spa .modal-footer { background: var(--spa-cream); border-radius: 0 0 16px 16px; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; }
.sidebar-overlay.show { display: block; }

.spa-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(21,101,192,0.2);
  border-top-color: var(--spa-brown);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-spa {
  position: fixed; top: 70px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; max-width: 360px;
}
.toast-item {
  background: var(--spa-white);
  border: 1px solid rgba(200,147,90,0.2);
  border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-left: 4px solid var(--spa-gold);
}
.toast-item.success { border-left-color: #43a047; }
.toast-item.error { border-left-color: #e53935; }
.toast-item.warning { border-left-color: #f57c00; }

.pair-panes-wrap.folded { display: none; }
.pair-fold-btn .fa-chevron-down { transition: transform 0.2s; }
.pair-fold-btn.open .fa-chevron-down { transform: rotate(180deg); }
.field-check-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-check-label input[type="checkbox"] { margin: 0; }
.pair-field:disabled { background: #f3f3f3; color: #999; }
.pair-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pair-pane {
  border: 1px solid rgba(21,101,192,0.18);
  border-radius: 12px;
  padding: 10px;
  background: var(--spa-cream);
  min-height: 220px;
}
.pair-pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.pair-pane-list {
  max-height: 280px;
  overflow: auto;
  background: var(--spa-white);
  border-radius: 8px;
  border: 1px solid rgba(21,101,192,0.12);
}
.pair-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(21,101,192,0.08);
}
.pair-item:last-child { border-bottom: none; }
.pair-item .nm { font-weight: 600; color: var(--spa-brown-dark); }
@media (max-width: 768px) {
  .pair-grid { grid-template-columns: 1fr; }
}
.host-card .host-meta { font-size: 0.78rem; color: #666; }
.table-spa tr.row-disabled td { opacity: 0.55; }
.table-spa tr.row-not-ready td { background: #fff8e1; }
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--spa-dark), var(--spa-brown-dark) 55%, #0a1628);
  padding: 1.5rem;
}
.login-card {
  width: 100%; max-width: 420px;
  background: var(--spa-white);
  border-radius: 18px;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 1.5rem; }
.login-brand .icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.3rem;
}

.text-brown { color: var(--spa-brown); }
.mono { font-family: 'Courier New', monospace; }
.rounded-spa { border-radius: 12px; }

.xfer-progress-wrap { margin: 4px 0 12px; }
.xfer-progress {
  height: 18px;
  background: rgba(21,101,192,0.12);
  border-radius: 999px;
  overflow: hidden;
}
.xfer-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--spa-brown-mid), var(--spa-gold));
  border-radius: 999px;
  transition: width 0.25s ease;
}
.xfer-progress-meta { font-size: 0.8rem; color: #666; margin-top: 6px; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .content-body { padding: 1rem; }
}
