/* Gotra Bali — spa-ui tokens, palet Usadha (hangat lontar) */
:root {
  --spa-dark: #1a1209;
  --spa-brown-dark: #5c3310;
  --spa-brown: #7a4419;
  --spa-brown-mid: #a0622a;
  --spa-brown-light: #c8935a;
  --spa-tan: #e8c9a0;
  --spa-cream: #f5ede0;
  --spa-white: #fefaf5;
  --spa-gold: #c9a227;
  --spa-gold-light: #e0c056;
  --spa-pastel1: #edd9b8;
  --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); }

/* Login */
body.login-page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  overflow-x: hidden;
}
.login-bg-slider {
  flex: 1 1 58%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(201,162,39,0.25), transparent 50%),
    linear-gradient(160deg, #3d280f 0%, #7a4419 45%, #1a1209 100%);
}
.login-bg-slider::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(232,201,160,0.06) 24px, rgba(232,201,160,0.06) 25px),
    repeating-linear-gradient(90deg, transparent, transparent 24px, rgba(232,201,160,0.06) 24px, rgba(232,201,160,0.06) 25px);
  opacity: 0.7;
}
.login-slide-caption {
  position: absolute;
  bottom: 2.5rem;
  left: 2.5rem;
  z-index: 2;
  color: rgba(254,250,245,0.95);
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-style: italic;
  text-shadow: 0 2px 12px rgba(26,18,9,0.4);
  max-width: 70%;
}
.login-wrapper {
  flex: 0 0 42%;
  max-width: 520px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  background: linear-gradient(180deg, var(--spa-cream) 0%, var(--spa-white) 100%);
  box-shadow: -8px 0 40px rgba(26,18,9,0.08);
}
.login-card {
  background: rgba(254,250,245,0.97);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 60px rgba(26,18,9,0.18), 0 0 0 1px rgba(201,162,39,0.3);
}
.login-logo { text-align: center; margin-bottom: 1.4rem; }
.login-logo .brand-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--spa-brown-dark), var(--spa-brown-mid));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 8px 20px rgba(74,44,10,0.35);
}
.login-logo .brand-icon i { font-size: 2rem; color: var(--spa-gold-light); }
.hua-brand-name {
  font-family: 'Playfair Display', serif;
  font-size: 2rem; font-weight: 700;
  color: var(--spa-brown-dark);
  letter-spacing: 3px; margin: 4px 0 0;
}
.hua-brand-location {
  font-size: 0.72rem; font-weight: 500;
  color: var(--spa-brown-mid);
  letter-spacing: 2px; text-transform: uppercase;
}
.login-logo .portal-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid));
  color: white; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  padding: 3px 14px; border-radius: 20px; margin-top: 8px;
}
.portal-alert-danger {
  background: #ffebee; color: #c62828;
  border-radius: 10px; padding: 10px 12px;
  font-size: 0.82rem; margin-bottom: 1rem;
}
.btn-spa-login {
  width: 100%;
  background: linear-gradient(135deg, var(--spa-brown-dark), var(--spa-brown-mid));
  color: #fff; border: none; border-radius: 10px;
  padding: 12px; font-weight: 600; letter-spacing: 0.5px;
}
.btn-spa-login:hover { filter: brightness(1.08); color: #fff; }

/* Sidebar */
.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;
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  transition: var(--transition);
}
.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); flex-shrink: 0;
}
.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; flex-shrink: 0;
}
.sidebar-header .brand-icon-sm i { color: white; font-size: 1.1rem; }
.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.62rem;
  letter-spacing: 0.8px; text-transform: uppercase;
}
.toggle-btn {
  margin-left: auto; background: none; border: none;
  color: var(--spa-tan); cursor: pointer; padding: 4px;
}
.toggle-btn:hover { color: var(--spa-gold); }
.sidebar-nav {
  flex: 1; min-height: 0; overflow-y: auto; padding: 0.75rem 0;
  scrollbar-width: thin;
}
.nav-group { margin-bottom: 2px; }
.nav-group-header, .nav-single {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; color: var(--spa-tan);
  cursor: pointer; user-select: none;
}
.nav-group-header:hover, .nav-single:hover {
  background: rgba(201,162,39,0.12); color: var(--spa-gold-light);
}
.nav-group-header.active, .nav-single.active {
  background: rgba(201,162,39,0.18); color: var(--spa-gold);
}
.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-label { flex: 1; font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; }
.nav-arrow { font-size: 0.7rem; transition: transform 0.3s; }
.nav-group-header.open .nav-arrow { transform: rotate(90deg); }
.nav-children { overflow: hidden; max-height: 0; transition: max-height 0.35s ease; }
.nav-children.open { max-height: 1200px; }
.nav-child-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 52px; color: var(--spa-pastel1);
  font-size: 0.8rem; cursor: pointer;
}
.nav-child-item:hover { background: rgba(201,162,39,0.1); color: var(--spa-cream); }
.nav-child-item.active {
  background: linear-gradient(90deg, rgba(201,162,39,0.25), transparent);
  color: var(--spa-gold-light);
  border-left: 3px solid var(--spa-gold);
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-arrow,
.sidebar.collapsed .brand-text,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .user-info { display: none; }
.sidebar-footer {
  padding: 1rem; border-top: 1px solid rgba(201,162,39,0.2); flex-shrink: 0;
}
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.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: white; font-size: 0.9rem; flex-shrink: 0;
}
.user-name { color: var(--spa-cream); font-size: 0.8rem; font-weight: 600; }
.user-role { color: var(--spa-gold-light); font-size: 0.68rem; }

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
  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; gap: 1rem;
  position: sticky; top: 0; z-index: 900;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.page-title {
  flex: 1; font-size: 1rem; font-weight: 600;
  color: var(--spa-brown-dark); font-family: 'Playfair Display', serif;
}
.header-btn, .user-dropdown-btn {
  background: var(--spa-cream); border: 1px solid var(--spa-pastel1);
  border-radius: 10px; color: var(--spa-brown); cursor: pointer;
}
.header-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
}
.user-dropdown-btn {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
}
.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; flex-wrap: wrap;
}
.card-spa .card-header-spa h5 { margin: 0; font-size: 0.95rem; 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;
}
.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.gold { background: linear-gradient(135deg, #f5e8c0, #e8cc80); color: #8B6914; }
.stat-icon.blue { background: linear-gradient(135deg, #c8daf0, #a8c4e8); color: #1565c0; }
.stat-value { font-size: 1.45rem; font-weight: 700; color: var(--spa-brown-dark); line-height: 1.1; }
.stat-label { font-size: 0.75rem; color: #888; margin-top: 4px; }

.kpn-dash-welcome {
  background: linear-gradient(135deg, #f8ecd8 0%, #faf8f3 45%, #fdeee4 100%);
  border-radius: 16px; padding: 24px 28px; margin-bottom: 18px;
  border: 1px solid #e8c9a0;
}
.kpn-dash-welcome h2 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--spa-brown-dark); font-size: 1.55rem; margin: 0 0 8px;
}

.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; border: none; white-space: nowrap;
}
.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(232,201,160,0.2); }
.table-spa tbody td { padding: 9px 12px; vertical-align: middle; }
.table-spa tfoot td {
  padding: 9px 12px; background: rgba(232,201,160,0.15); font-weight: 600;
  border-top: 2px solid rgba(200,147,90,0.3);
}
.table-spa-jurnal { font-size: 0.63rem; }
.table-spa-jurnal thead th { padding: 5px 7px; font-size: 0.62rem; }
.table-spa-jurnal tbody td,
.table-spa-jurnal tfoot td { padding: 4px 7px; white-space: nowrap; }
.table-spa-jurnal tbody td.col-uraian {
  white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis;
}
.table-spa-jurnal .badge-spa { font-size: 0.55rem; padding: 1px 6px; }
.table-spa-jurnal .btn-spa-sm { padding: 2px 6px; font-size: 0.62rem; }
.table-spa-jurnal tr.is-void td { color: #888; text-decoration: line-through; }
.table-spa-jurnal tr.is-void td.col-aksi,
.table-spa-jurnal tr.is-void td.col-bukti { text-decoration: none; }
.spa-void-switch { font-size: 0.72rem; color: var(--spa-brown-dark); white-space: nowrap; }
.spa-void-switch .form-check-input { cursor: pointer; }

.btn-spa {
  border: none; border-radius: 7px; padding: 6px 14px;
  font-size: 0.8rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: var(--transition); 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: white; }
.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: white; }
.btn-spa-danger { background: linear-gradient(135deg, #b71c1c, #e53935); color: white; }
.btn-spa-warning { background: linear-gradient(135deg, #e65100, #f57c00); color: white; }
.btn-spa-info { background: linear-gradient(135deg, #1565c0, #1976d2); color: white; }
.btn-spa-gold { background: linear-gradient(135deg, var(--spa-gold), var(--spa-brown-mid)); color: white; }
.btn-spa-sm { padding: 4px 10px; font-size: 0.75rem; }

.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-active, .badge-paid, .badge-done { background: #e8f5e9; color: #2e7d32; }
.badge-pending { background: #fff8e1; color: #e65100; }
.badge-cancel, .badge-inactive { background: #ffebee; color: #c62828; }
.badge-void { background: #424242; color: #eee; }

.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(200,147,90,0.3);
  border-radius: 8px; background: var(--spa-white);
  color: var(--spa-dark); font-size: 0.83rem;
}
.form-spa-control-sm { padding: 5px 10px; font-size: 0.78rem; }
.form-spa-control:focus {
  outline: none; border-color: var(--spa-brown-mid);
  box-shadow: 0 0 0 3px rgba(160,98,42,0.12);
}
.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: white; 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 { background: var(--spa-white); }
.modal-spa .modal-footer { background: var(--spa-cream); border-radius: 0 0 16px 16px; }

.spa-spinner {
  display: inline-block; width: 18px; height: 18px;
  border: 2px solid rgba(122,68,25,0.25);
  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: 340px;
}
.toast-item {
  background: var(--spa-white); 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; }

.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999;
}
.sidebar-overlay.show { display: block; }

.text-brown { color: var(--spa-brown); }
.mono { font-family: 'Courier New', monospace; }
.main-footer {
  padding: 12px 1.5rem; font-size: 0.75rem; color: #888;
  background: var(--spa-white); border-top: 1px solid rgba(200,147,90,0.15);
}

body.print-page { background: #fff; margin: 0; }
.print-toolbar { padding: 12px 20px; background: var(--spa-cream); border-bottom: 1px solid rgba(200,147,90,0.2); }
.print-sheet { max-width: 900px; margin: 24px auto; padding: 8px 28px 32px; }
.print-head { text-align: center; margin-bottom: 18px; border-bottom: 2px solid var(--spa-brown); padding-bottom: 12px; }
.print-head h2 { font-size: 1.2rem; margin: 10px 0 0; }
.print-foot { margin-top: 28px; font-size: 0.75rem; color: #888; border-top: 1px solid rgba(200,147,90,0.2); padding-top: 8px; }

@media print {
  .no-print, .print-toolbar, .sidebar, .top-header, .main-footer { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body, body.print-page { background: #fff; }
  .print-sheet { margin: 0; max-width: none; padding: 0; }
  .table-spa thead th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); width: var(--sidebar-width); }
  .main-content, .main-content.expanded { margin-left: 0; }
  body.login-page { flex-direction: column; }
  .login-bg-slider { min-height: 180px; flex: none; }
  .login-wrapper { max-width: none; min-height: auto; }
}
