/* Masimo Cabins — Admin design system */
:root {
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --accent: #1e3a5f;
  --accent-hover: #152a45;
  --accent-soft: #e8eef5;
  --accent-muted: #94a3b8;
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-width: 248px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body.admin-app {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 20px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #1e3a5f 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.sidebar-brand-text strong {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-brand-text span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.55;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-active);
}

.sidebar-link.active svg { opacity: 1; }

.sidebar-foot {
  padding: 16px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: auto;
}

.sidebar-foot-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.4;
  margin-bottom: 8px;
  word-break: break-all;
}

.sidebar-link.logout {
  margin-top: 4px;
}

/* Main area */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px 0;
  flex-wrap: wrap;
}

.admin-header-text h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.admin-header-text p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-content {
  padding: 24px 32px 40px;
  flex: 1;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--border);
}

.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn.danger {
  border-color: #fecaca;
  color: var(--danger);
  background: var(--danger-bg);
}

.btn.danger:hover {
  background: #fee2e2;
}

.btn.whatsapp {
  background: #25d366;
  border-color: #25d366;
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn.whatsapp:hover {
  background: #1ebe57;
  border-color: #1ebe57;
  color: #fff;
}

.btn.sm {
  padding: 6px 12px;
  font-size: 0.82rem;
}

.btn.icon-only {
  padding: 8px 10px;
}

/* Toolbar / nav pills */
.toolbar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.toolbar-label {
  padding: 0 12px;
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 130px;
  text-align: center;
}

/* Alerts */
.admin-alert {
  margin: 0 32px 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.admin-alert.success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: #065f46;
}

.admin-alert.danger {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.admin-alert a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.admin-alert a:hover { text-decoration: underline; }

.tip-card {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: var(--accent-soft);
  border: 1px solid #c9d9ea;
  border-radius: var(--radius);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}

.tip-card strong {
  color: var(--accent);
  font-weight: 600;
}

.tip-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-padded {
  padding: 24px;
}

/* Forms */
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-family: var(--font);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
  -webkit-appearance: none;
}

textarea {
  resize: vertical;
  min-height: 88px;
  line-height: 1.5;
}

button.btn {
  font-family: var(--font);
  line-height: 1.2;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--accent-muted);
  opacity: 1;
}

.muted { color: var(--muted); font-size: 0.88rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin-top: 12px; }

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.icon-btn {
  border: none;
  background: var(--surface-2);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* Dialogs */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-lg);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

dialog form {
  padding: 28px;
}

dialog h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 700;
}

dialog menu {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 0;
  margin: 24px 0 0;
  list-style: none;
}

/* Status pills */
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid #c9d9ea;
  text-transform: capitalize;
}

.status-pill.status-pending,
.status-pill.header-status.status-pending {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fde68a;
}

.status-pill.status-approved,
.status-pill.header-status.status-approved {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.status-pill.status-cancelled,
.status-pill.header-status.status-cancelled {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: #fecaca;
}

.status-pill.header-status {
  text-transform: capitalize;
}

.status-pill.payment-unpaid {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fde68a;
}

.status-pill.payment-partial {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-pill.payment-paid {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-border);
}

.status-pill.payment-refunded {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--border);
}

.status-pill.payment-waived {
  background: #f5f3ff;
  color: #6d28d9;
  border-color: #ddd6fe;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Slide-over panel */
.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  overflow-y: auto;
  z-index: 200;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

.slide-panel[hidden] {
  display: none;
}

.slide-panel header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.slide-panel h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.slide-panel form {
  display: flex;
  flex-direction: column;
}

.slide-panel label:first-of-type {
  margin-top: 0;
}

.slide-panel label .muted {
  font-weight: 500;
}

.slide-panel input,
.slide-panel textarea {
  display: block;
}

.slide-panel .form-actions {
  margin-top: 24px;
  padding-top: 4px;
}

.slide-panel .form-actions .btn {
  flex: 1;
  min-height: 42px;
}

.slide-panel .form-actions .btn.primary {
  flex: 1.4;
}

.stay-summary {
  background: var(--accent-soft);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 4px;
  border: 1px solid #c9d9ea;
}

.price-preview {
  margin: 18px 0;
  padding: 16px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.price-preview strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.price-preview .total-amount {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin: 4px 0 8px;
  letter-spacing: -0.02em;
}

.price-preview .total-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.panel-backdrop[hidden] { display: none; }

/* Upload / misc shared */
.upload-link-box {
  margin-top: 14px;
  padding: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
}

.upload-link-box input {
  margin-top: 10px;
  font-size: 0.82rem;
}

.booking-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.upload-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.upload-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}

.upload-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
}

.upload-success {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
  color: #065f46;
}

.upload-error {
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
  color: var(--danger);
}

/* Page detail (documents list) */
.page-detail .admin-content {
  max-width: 720px;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.settings-content {
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-content .detail-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.settings-content .hint {
  margin: 0 0 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
}

.settings-content .danger-zone {
  border-color: #fecaca;
  background: #fffbfb;
}

.account-form,
.danger-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.account-form label {
  margin-top: 4px;
}

.account-form label:first-of-type {
  margin-top: 0;
}

.account-form label .muted {
  font-weight: 500;
  color: var(--muted);
}

.account-form .btn {
  align-self: flex-start;
  margin-top: 8px;
}

.danger-form label {
  font-size: 0.88rem;
  font-weight: 500;
}

.danger-form input[type="text"] {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.danger-form .btn {
  align-self: flex-start;
  margin-top: 4px;
}

@media (max-width: 960px) {
  .admin-shell {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 16px;
    gap: 8px;
  }

  .sidebar-brand {
    padding: 0;
    border: none;
    margin: 0;
    flex: 1;
    min-width: 140px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: none;
    width: 100%;
    order: 3;
  }

  .sidebar-link {
    flex: 1;
    justify-content: center;
    padding: 10px;
    font-size: 0.85rem;
  }

  .sidebar-link span { display: none; }

  .sidebar-foot { display: none; }

  .admin-header {
    padding: 20px 20px 0;
  }

  .admin-content {
    padding: 16px 20px 32px;
  }

  .admin-alert {
    margin: 0 20px;
  }
}

@media (max-width: 560px) {
  .toolbar { width: 100%; justify-content: center; }
  .admin-header { flex-direction: column; }
}

/* Login */
body.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #e8eef5 0%, var(--bg) 45%, #f8fafc 100%);
}

.login-shell {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.login-brand strong {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
}

.login-brand span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

.login-form label:first-of-type {
  margin-top: 0;
}

.login-card .admin-alert {
  margin: 0 0 20px;
}
