/* =========================================================================
   GOLDEN SADDLE LODGE — AUTHENTIC KASPI PAY & KASPI TRAVEL DESIGN SYSTEM
   ========================================================================= */

:root {
  /* Clean Kaspi Neutral Canvas */
  --bg-page: #f4f5f7;
  --card-bg: #ffffff;
  --border-color: #e5e7eb;
  --border-hover: #d1d5db;
  --text-main: #111827;
  --text-secondary: #374151;
  --text-muted: #6b7280;

  /* Signature Kaspi Red & Functional Accents */
  --kaspi-red: #f14635;
  --kaspi-red-hover: #dc2626;
  --kaspi-dark: #1f2937;
  --kaspi-dark-hover: #111827;
  --kaspi-whatsapp: #16a34a;
  --kaspi-whatsapp-hover: #15803d;
  --status-green: #059669;
  --status-green-bg: #ecfdf5;
  --status-red: #dc2626;
  --status-red-bg: #fef2f2;
  --lodge-gold: #b45309;
  --lodge-gold-light: #fef3c7;

  /* Border-radius design scale (Kaspi Precision: 4 levels) */
  --radius-xs:  4px;
  --radius-sm:  6px;   /* tags, micro-badges, sub-chips */
  --radius-md:  8px;   /* inputs, buttons, steppers, standard controls */
  --radius-lg: 10px;   /* cards, table wrappers, panels */
  --radius-xl: 14px;   /* modals, bottom sheets */
}

html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

#mainContainer {
  touch-action: pan-y;
  overscroll-behavior-y: contain;
  overflow-wrap: anywhere;
}

@media (max-width: 1023px) {
  #mainContainer {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 24px);
  }
}

/* =========================================================================
   KASPI TYPOGRAPHY SYSTEM (Kaspi.kz Authentic Native Stack)
   ========================================================================= */
html, body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  line-height: 1.45;
}

/* Kaspi Headings: disciplined, crisp hierarchy (600 SemiBold, no heavy bulk) */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: #0f172a;
}

h1 {
  letter-spacing: -0.024em;
}

/* Kaspi Weight Calibration: tame screaming 900/800 down to elegant Kaspi SemiBold (600) */
.font-black {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.font-extrabold {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.font-bold {
  font-weight: 600;
}

b, strong {
  font-weight: 600;
}

/* Kaspi Uppercase Eyebrow / Label Tracking: airy, sophisticated, legible (500 Medium) */
.uppercase, [class*="uppercase"] {
  letter-spacing: 0.04em;
}

label.uppercase, label[class*="uppercase"] {
  font-weight: 600;
  color: #475569;
}

/* Micro-labels and small meta-text (10px–12px) */
.text-\[10px\], .text-\[11px\], .text-xs {
  letter-spacing: -0.002em;
}

/* High-precision Tabular Numbers for prices in Tenge (₸), room numbers, and dates */
.tnum, [class*="tabular-nums"], td, .pms-cell {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* =========================================================================
   KASPI CARDS — Crisp 10px radius, 1px border, subtle shadow
   ========================================================================= */
.kaspi-card {
  background: var(--card-bg);
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.kaspi-card-interactive {
  cursor: pointer;
}

.kaspi-card-interactive:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.kaspi-card-interactive:active {
  transform: scale(0.99);
}

/* =========================================================================
   KASPI BUTTONS — Clean 8px radius, crisp typography, no heavy gradients
   ========================================================================= */
.btn-kaspi {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s ease;
  cursor: pointer;
  border: none;
  user-select: none;
  text-decoration: none;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.2;
}

.btn-kaspi:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-kaspi:disabled,
.btn-kaspi[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: none !important;
}

/* 1. Official Kaspi Red Primary Button */
.btn-kaspi-red,
.btn-kaspi-primary {
  background: #f14635;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(241, 70, 53, 0.2);
  border: 1px solid #e03626;
}

.btn-kaspi-red:hover,
.btn-kaspi-primary:hover {
  background: #dc2626;
  box-shadow: 0 3px 8px rgba(241, 70, 53, 0.28);
}

.btn-kaspi-red:active:not(:disabled),
.btn-kaspi-primary:active:not(:disabled) {
  background: #b91c1c;
  transform: scale(0.98);
}

/* 2. Neutral Dark Slate Button */
.btn-lodge-brown,
.btn-dark {
  background: #1f2937;
  color: #ffffff;
  border: 1px solid #111827;
}

.btn-lodge-brown:hover,
.btn-dark:hover {
  background: #111827;
}

/* 3. Official WhatsApp Action Button */
.btn-kaspi-whatsapp {
  background: #16a34a;
  color: #ffffff;
  border: 1px solid #15803d;
}

.btn-kaspi-whatsapp:hover {
  background: #15803d;
}

.btn-kaspi-whatsapp:active:not(:disabled) {
  background: #166534;
  transform: scale(0.98);
}

/* 4. Kaspi Green / Success Button */
.btn-kaspi-success,
.btn-kaspi-green {
  background: #059669;
  color: #ffffff;
  border: 1px solid #047857;
}

.btn-kaspi-success:hover,
.btn-kaspi-green:hover {
  background: #047857;
}

.btn-kaspi-success:active:not(:disabled),
.btn-kaspi-green:active:not(:disabled) {
  background: #065f46;
  transform: scale(0.98);
}

/* 5. Kaspi Neutral Secondary Button */
.btn-kaspi-secondary,
.btn-kaspi-subtle {
  background: #f3f4f6;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}

.btn-kaspi-secondary:hover,
.btn-kaspi-subtle:hover {
  background: #e5e7eb;
  color: #111827;
}

.btn-kaspi-secondary:active:not(:disabled),
.btn-kaspi-subtle:active:not(:disabled) {
  background: #d1d5db;
  transform: scale(0.98);
}

/* 6. Outline Button */
.btn-kaspi-outline {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #1f2937;
}

.btn-kaspi-outline:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-kaspi-outline:active:not(:disabled) {
  background: #f3f4f6;
  transform: scale(0.98);
}

/* Auto-width & inline support for buttons */
.btn-kaspi[style*="width: auto"],
.btn-kaspi.btn-inline,
.btn-kaspi.w-auto,
.btn-kaspi[class*="w-auto"] {
  width: auto;
  display: inline-flex;
}

/* Button size modifiers for balanced layout, modals & tables */
.btn-kaspi.text-sm,
.btn-kaspi-compact,
.btn-kaspi-sm {
  min-height: 36px;
  font-size: 13px;
  border-radius: 8px;
  padding: 0 12px;
}

.btn-kaspi.text-xs,
.btn-kaspi-xs,
.btn-kaspi[class*="py-1"],
.btn-kaspi[class*="py-1.5"] {
  min-height: 32px;
  font-size: 12px;
  border-radius: 8px;
  padding: 0 10px;
  font-weight: 600;
}

.btn-kaspi[class*="py-2"],
.btn-kaspi[class*="py-2.5"] {
  min-height: 36px;
  border-radius: 8px;
  padding: 0 12px;
}

/* =========================================================================
   KASPI SERVICE ICONS / QUICK ACTIONS (Clean 42x42 square tiles)
   ========================================================================= */
.kaspi-circle-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease;
  padding: 4px;
}

.kaspi-circle-btn:active {
  transform: scale(0.95);
}

.kaspi-circle-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 6px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.12s ease;
}

.kaspi-circle-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.45;
  transition: transform 0.15s ease;
}

.kaspi-circle-btn:hover .kaspi-circle-icon {
  border-color: var(--border-hover);
  background: #f9fafb;
}

.kaspi-circle-btn:hover .kaspi-circle-icon svg {
  transform: scale(1.08);
}

.kaspi-circle-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.2;
}

/* =========================================================================
   KASPI INPUTS & CONTROLS (Clean 8px radius, crisp 1px border)
   ========================================================================= */
.kaspi-input {
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: #ffffff;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
  width: 100%;
  outline: none;
  transition: all 0.12s ease;
}

.kaspi-input:focus,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  background: #ffffff;
  outline: none;
  border-color: var(--kaspi-red);
  box-shadow: 0 0 0 2px rgba(241, 70, 53, 0.15);
}

/* Hide number input spinners for clean layout & no width distortion */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Card & Modal text wrap safeguards against ultra-long words/emails */
.kaspi-card,
.modal-content {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kaspi-input.text-xs,
.kaspi-input-sm,
.kaspi-input[class*="py-1"],
.kaspi-input[class*="py-2"] {
  height: 36px;
  min-height: 36px;
  font-size: 13px;
  border-radius: 8px;
  padding-left: 10px;
  padding-right: 10px;
}

select.kaspi-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234b5563' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding-right: 32px;
  cursor: pointer;
}

/* Mobile input stabilization (Prevents iOS Safari auto-zoom from displacing/floating page layout) */
@media (max-width: 640px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .kaspi-input,
  .kaspi-input.text-xs,
  .kaspi-input-sm,
  .kaspi-input[class*="py-1"],
  .kaspi-input[class*="py-2"] {
    font-size: 16px;
  }
}

/* Stepper Buttons (Crisp Kaspi standard) */
.kaspi-stepper-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.12s;
  user-select: none;
}

.kaspi-stepper-btn:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.kaspi-stepper-btn:active {
  transform: scale(0.95);
  background: #cbd5e1;
}

/* =========================================================================
   ROOM CARDS & STATUS BADGES
   ========================================================================= */
.kaspi-room-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all 0.12s ease;
  margin-bottom: 10px;
}

.kaspi-room-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.room-select-card {
  background: #ffffff;
  border-radius: 10px;
  border: 1.5px solid var(--border-color);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
}

.room-select-card:hover {
  border-color: var(--border-hover);
}

.room-select-card.selected {
  border-color: var(--kaspi-red);
  background: #fef2f2;
  box-shadow: 0 2px 8px rgba(241, 70, 53, 0.12);
}

/* Status Badges */
.kaspi-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-free {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.badge-occupied {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.badge-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-danger {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* =========================================================================
   BOTTOM NAVIGATION BAR — AUTHENTIC KASPI FLAT MINIMALIST STYLE
   ========================================================================= */
.kaspi-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  min-height: 56px;
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  padding: 4px 4px calc(env(safe-area-inset-bottom, 0px)) 4px;
  z-index: 50;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.03);
}

@media (min-width: 768px) {
  .kaspi-bottom-bar {
    max-width: 672px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 14px 14px 0 0;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
  }
}

@media (min-width: 1024px) {
  .kaspi-bottom-bar {
    display: none;
  }
}

/* =========================================================================
   DESKTOP LATERAL SIDEBAR (≥1024px)
   ========================================================================= */
.desktop-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
  }
}

.desktop-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s ease;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  text-decoration: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.desktop-nav-item:hover {
  background: #f9fafb;
  color: #111827;
  border-color: #e5e7eb;
}

.desktop-nav-item:active {
  transform: scale(0.98);
}

.desktop-nav-item.active {
  background: #fef2f2;
  color: #dc2626;
  font-weight: 600;
  border-color: #fecaca;
  border-left: 3px solid #f14635;
}

.desktop-nav-item .nav-icon {
  font-size: 17px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.desktop-nav-item .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.45;
  transition: stroke 0.12s ease;
}

.desktop-nav-item.active .nav-icon svg {
  stroke: var(--kaspi-red);
}

.kaspi-nav-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.12s ease;
  user-select: none;
  flex: 1;
  max-width: 80px;
  min-height: 48px;
  background: transparent;
  border: none;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.kaspi-nav-tab:focus-visible {
  outline: 2px solid var(--kaspi-red);
  outline-offset: -2px;
}

.kaspi-nav-tab:active {
  transform: scale(0.94);
}

.kaspi-nav-icon {
  font-size: 19px;
  line-height: 1;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kaspi-nav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.45;
  transition: stroke 0.12s ease, transform 0.12s ease;
}

.kaspi-nav-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.12s ease;
}

/* Active Tab State — Signature Kaspi Red */
.kaspi-nav-tab.active {
  color: var(--kaspi-red);
}

.kaspi-nav-tab.active .kaspi-nav-label {
  color: var(--kaspi-red);
  font-weight: 600;
}

.kaspi-nav-tab.active .kaspi-nav-icon {
  transform: translateY(-1px);
}

.kaspi-nav-tab.active .kaspi-nav-icon svg {
  stroke: var(--kaspi-red);
}

/* Center Plus Tab */
.kaspi-nav-tab-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  cursor: pointer;
  padding: 0 4px;
  user-select: none;
  flex: 1;
  max-width: 76px;
  background: transparent;
  border: none;
  -webkit-tap-highlight-color: transparent;
}

.kaspi-center-plus-circle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--kaspi-red);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(241, 70, 53, 0.28);
  margin-top: -6px;
  border: 2px solid #ffffff;
  transition: transform 0.12s ease;
}

.kaspi-plus-symbol {
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
  margin-top: -1px;
}

.kaspi-nav-tab-center:active .kaspi-center-plus-circle {
  transform: scale(0.92);
}

.kaspi-nav-tab-center .kaspi-nav-label {
  color: var(--kaspi-red);
  font-weight: 600;
  font-size: 12px;
}

/* =========================================================================
   MODALS & BOTTOM SHEETS
   ========================================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

@media (min-width: 641px) {
  .modal-overlay {
    backdrop-filter: blur(3px);
  }
}

.modal-content {
  background: #ffffff;
  border-radius: 24px;
  border: 1px solid var(--border-color);
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
  max-width: 520px;
  box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.2);
}

/* Bottom Sheet layout on mobile */
@media (max-width: 640px) {
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-content {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    max-height: 85vh;
  }
}

/* Mobile Bottom Sheet Drag Handle */
.bottom-sheet-handle {
  display: none;
}

@media (max-width: 640px) {
  .bottom-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    background-color: #cbd5e1;
    border-radius: 9999px;
    margin: 0 auto 14px auto;
    flex-shrink: 0;
  }
}

/* =========================================================================
   NATIVE HTML5 <dialog> MODALS & BOTTOM SHEETS
   ========================================================================= */
dialog.pms-dialog {
  border: none;
  background: transparent;
  padding: 0;
  margin: auto;
  max-height: 92vh;
  max-width: 95vw;
  width: max-content;
  overflow: visible;
  color: inherit;
}

dialog.pms-dialog::backdrop {
  background: rgba(15, 23, 42, 0.65);
}

@media (min-width: 641px) {
  dialog.pms-dialog::backdrop {
    backdrop-filter: blur(3px);
  }
}

@media (max-width: 640px) {
  dialog.pms-dialog {
    margin-bottom: 0;
    margin-top: auto;
    width: 100vw;
    max-width: 100vw;
    max-height: 85vh;
  }
  dialog.pms-dialog .modal-content {
    width: 100%;
    max-width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 12px));
  }
}

/* Wizard step cards sizing */
#screen-new_booking .kaspi-card {
  /* Natural height adapts to content without blank gaps */
}

/* =========================================================================
   MODAL CLOSE BUTTON — Sleek Kaspi square button (WCAG / Touch friendly)
   ========================================================================= */
.modal-close-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
}

.modal-close-btn:active {
  transform: scale(0.94);
  background: #e2e8f0;
}

/* =========================================================================
   WCAG 2.1 AA TAP TARGETS (>= 44x44px for mobile controls)
   ========================================================================= */
@media (max-width: 640px) {
  .pms-grid-nav-btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .pms-chip-btn {
    min-height: 42px;
    padding-left: 12px;
    padding-right: 12px;
    display: inline-flex;
    align-items: center;
  }
  .pms-date-picker-input {
    min-height: 44px;
  }
}

/* =========================================================================
   SKELETON LOADING ANIMATION
   ========================================================================= */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #f0ece6 25%, #e8e3dc 50%, #f0ece6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 12px;
}

/* =========================================================================
   PMS LEGEND (Шахматка: легенда статусов)
   ========================================================================= */
.pms-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  border-radius: 0 0 16px 16px;
}

.pms-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pms-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Hide scrollbar & enable smooth touch momentum scrolling */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

/* =========================================================================
   LOCALIZED RUSSIAN CALENDAR & DATE-TIME PICKER
   ========================================================================= */
.calendar-widget {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 14px;
  user-select: none;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.calendar-nav-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.calendar-weekdays .weekend {
  color: #c53030;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  height: 38px;
  width: 100%;
  max-width: 40px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
  background: transparent;
  color: #1e293b;
  border: 1.5px solid transparent;
  box-sizing: border-box;
  user-select: none;
}

.calendar-day:hover:not(.empty):not(.disabled):not(.check-in):not(.check-out) {
  background: #f1f5f9;
  color: #0f172a;
}

.calendar-day.empty {
  cursor: default;
  pointer-events: none;
}

.calendar-day.weekend {
  color: #dc2626;
}

.calendar-day.weekend:hover:not(.disabled):not(.check-in):not(.check-out) {
  background: #fef2f2;
}

.calendar-day.today:not(.check-in):not(.check-out) {
  border-color: #cbd5e1;
  background: #f8fafc;
  font-weight: 600;
}

.calendar-day.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  background: #f14635;
  border-radius: 50%;
}

.calendar-day.check-in.today::after,
.calendar-day.check-out.today::after {
  background: #ffffff;
}

.calendar-day.check-in {
  background: #f14635;
  color: #ffffff;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(241, 70, 53, 0.35);
}

.calendar-day.check-out {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}

.calendar-day.disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
  background: transparent;
  color: #94a3b8;
}

.date-box-active {
  border-color: var(--kaspi-red);
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(241, 70, 53, 0.15);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fadeIn {
  animation: fadeIn 0.18s ease-out forwards;
}

/* =========================================================================
   PMS ROOM CHESSBOARD & BOOKING GRID (MOBILE & DESKTOP OPTIMIZED)
   ========================================================================= */

.pms-grid-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  position: relative;
}

.pms-grid-scroll::-webkit-scrollbar {
  height: 8px;
}

.pms-grid-scroll::-webkit-scrollbar-track {
  background: #f8fafc;
  border-radius: 4px;
}

.pms-grid-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.pms-grid-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.pms-table {
  border-collapse: separate;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
}

.pms-table tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 52px;
}

/* Sticky Room Column (Left) */
.pms-sticky-room {
  position: sticky;
  left: 0;
  z-index: 25;
  background: #ffffff;
  border-right: 2px solid #e2e8f0;
  box-shadow: 4px 0 10px -2px rgba(0, 0, 0, 0.06);
  min-width: 100px;
  max-width: 110px;
  width: 100px;
  will-change: transform;
  transform: translateZ(0);
}

@media (min-width: 768px) {
  .pms-sticky-room {
    min-width: 145px;
    max-width: 160px;
    width: 150px;
  }
}

/* Sticky Header Row (Top) */
.pms-sticky-header th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
  will-change: transform;
  transform: translateZ(0);
}

.pms-sticky-header .pms-sticky-room {
  z-index: 30; /* Corner cell highest z-index */
  background: #f1f5f9;
}

/* Cell Sizing & Styling */
.pms-cell {
  min-width: 60px;
  width: 68px;
  height: 52px;
  padding: 4px;
  border-right: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
  text-align: center;
  vertical-align: middle;
  transition: background-color 0.12s ease;
  position: relative;
}

@media (min-width: 768px) {
  .pms-cell {
    min-width: 74px;
    width: 80px;
    height: 56px;
    padding: 5px;
  }
}

/* Ultra-compact mode for very small phones (iPhone SE, 375px and below) */
@media (max-width: 374px) {
  .pms-cell {
    min-width: 48px;
    width: 52px;
    height: 46px;
    padding: 3px;
    font-size: 12px;
  }
  .pms-sticky-room {
    min-width: 90px;
    max-width: 96px;
    width: 90px;
  }
  .pms-booking-pill {
    font-size: 12px;
    border-radius: 6px;
  }
}

/* Weekend Column Tint */
.pms-col-weekend {
  background-color: #f8fafc;
}

/* Today Column Highlight */
.pms-col-today {
  background-color: #fffbfa;
  border-left: 2px solid #fecaca;
  border-right: 2px solid #fecaca;
}

.pms-header-today {
  background-color: #fef2f2;
  color: var(--kaspi-red);
  border-left: 2px solid #f87171;
  border-right: 2px solid #f87171;
}

/* PMS Floating Today Jump Button */
.pms-floating-today-btn {
  position: absolute;
  bottom: 24px;
  right: 16px;
  z-index: 35;
  background: #ffffff;
  color: var(--kaspi-red);
  border: 1.5px solid #fca5a5;
  box-shadow: 0 4px 14px rgba(241, 70, 53, 0.2);
  border-radius: 9999px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pms-floating-today-btn:hover {
  background: #fff5f5;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(241, 70, 53, 0.28);
}

.pms-floating-today-btn:active {
  transform: scale(0.96);
}

/* Free Cell Hover */
.pms-cell-free {
  cursor: pointer;
  user-select: none;
}

.pms-cell-free:hover {
  background-color: #ecfdf5;
}

.pms-cell-free:hover .pms-add-icon {
  opacity: 1;
  transform: scale(1.15);
}

.pms-add-icon {
  opacity: 0;
  font-size: 14px;
  font-weight: 600;
  color: #2d7a4d;
  transition: all 0.12s ease;
}

/* Booking Cards/Pills inside cells */
.pms-booking-pill {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3px 4px;
  font-size: 12px;
  line-height: 1.15;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: none;
}

.pms-booking-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.14);
}

.pms-booking-pill:active {
  transform: scale(0.97);
}

/* Status variants — flat solid colors (no gradients in 52px cells) */
.pms-pill-in_house {
  background: #1d4ed8;
  color: #ffffff;
  border: 1px solid #1e3a8a;
}

.pms-pill-confirmed {
  background: #047857;
  color: #ffffff;
  border: 1px solid #064e3b;
}

.pms-pill-new {
  background: #d97706;
  color: #ffffff;
  border: 1px solid #92400e;
}

.pms-pill-turnover {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #991b1b;
  border-left: 3px solid #fbbf24; /* gold stripe — пересменка */
}

.pms-pill-departing {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1; /* убрали dashed — было визуальным мусором */
}

/* =========================================================================
   KASPI NOTIFICATION TOAST SYSTEM (Desktop & Mobile Precision)
   ========================================================================= */
.pms-toast-container {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Mobile default: centered above Kaspi bottom bar */
  bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px);
  left: 12px;
  right: 12px;
  max-width: 420px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  .pms-toast-container {
    bottom: 24px;
    right: 24px;
    left: auto;
    width: 360px;
    max-width: calc(100vw - 48px);
    margin: 0;
  }
}

.pms-toast {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left-width: 4px;
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pmsToastIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.pms-toast.hiding {
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
}

.pms-toast-success,
.pms-toast-cleaning {
  border-left-color: #10b981;
}

.pms-toast-error {
  border-left-color: var(--kaspi-red, #f14635);
}

.pms-toast-warning {
  border-left-color: #f59e0b;
}

.pms-toast-info {
  border-left-color: #3b82f6;
}

.pms-toast-booking {
  border-left-color: #6366f1;
}

.pms-toast-kitchen {
  border-left-color: #ea580c;
}

.pms-toast-invoice {
  border-left-color: #059669;
}

.pms-toast-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-md, 8px);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pms-toast-content {
  flex: 1;
  min-width: 0;
  padding-top: 1px;
}

.pms-toast-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pms-toast-message {
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  line-height: 1.35;
  margin-top: 2px;
  word-break: break-word;
}

.pms-toast-link {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--kaspi-red, #f14635);
  margin-top: 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.pms-toast-link:hover {
  color: var(--kaspi-red-hover, #dc2626);
}

.pms-toast-close {
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  border-radius: var(--radius-sm, 6px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
  margin-left: 2px;
}

.pms-toast-close:hover {
  color: #334155;
  background-color: #f1f5f9;
}

.pms-toast-close:active {
  transform: scale(0.92);
}

@keyframes pmsToastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =========================================================================
   NOTIFICATION TARGET HIGHLIGHT
   ========================================================================= */
@keyframes pmsPulseHighlight {
  0% {
    box-shadow: 0 0 0 0 rgba(241, 70, 53, 0.5);
    background-color: rgba(254, 242, 242, 0.8);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(241, 70, 53, 0);
    background-color: rgba(254, 226, 226, 0.9);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(241, 70, 53, 0);
  }
}

.pms-pulse-highlight {
  animation: pmsPulseHighlight 1.6s ease-in-out 2;
  border-color: var(--kaspi-red) !important;
}

/* =========================================================================
   ACCESSIBILITY: PREFERS-REDUCED-MOTION
   ========================================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .pms-toast {
    animation: none;
    transition: opacity 0.1s linear;
  }
  .pms-toast.hiding {
    transform: none;
  }
}



/* Acceptance fixes: a single dialog scroll area and accessible action sizes. */
body:has(dialog.pms-dialog[open]) { overflow: hidden; }
dialog.pms-dialog { overflow: hidden; }
dialog.pms-dialog > .modal-content { max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; }
dialog.pms-dialog form { overflow: visible; flex-shrink: 0; }
@media (max-width: 768px) {
  #userHeaderBar button, #pwaInstallBanner button {
    min-height: 44px !important; min-width: 44px !important;
  }
  header button, #screen-grid button, #screen-kitchen button, dialog button {
    min-height: 44px; min-width: 44px;
  }
  #screen-grid [class*="flex"]:has(> button) { flex-wrap: wrap; }
}

#screen-kitchen .kaspi-card { overflow-wrap: anywhere; }

/* Shared touch sizing also covers screens outside modal forms. */
@media (max-width: 1023px), (pointer: coarse) {
  #mainContainer button, #mainContainer a[href], #mainContainer [role="button"],
  #mainContainer select, #mainContainer textarea,
  #mainContainer input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    min-height: 44px;
  }
  #mainContainer button, #mainContainer a[href], #mainContainer [role="button"] { min-width: 44px; }
  #mainContainer a.btn-kaspi { display: inline-flex; align-items: center; justify-content: center; }
  header button, header select { min-width: 44px; min-height: 44px; }
  #screen-today > div > .flex, #screen-today .kaspi-card > .flex { flex-wrap: wrap; gap: 8px; }
}
#notifBadge { min-width: 20px; width: auto; padding: 0 4px; }
.kaspi-room-card { overflow-wrap: anywhere; }
@media (max-width: 1023px) {
  .kaspi-bottom-bar { height: auto; min-height: calc(64px + env(safe-area-inset-bottom, 0px)); padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
  #mainContainer { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  .pms-toast-container { bottom: calc(80px + env(safe-area-inset-bottom, 0px) + 12px); }
  .kaspi-nav-tab { min-width: 0; flex: 1 1 0; padding-inline: 0; }
  .kaspi-nav-label { white-space: normal; overflow-wrap: anywhere; text-align: center; }
  #mainContainer .app-screen > .flex { flex-wrap: wrap; gap: 8px; }
  #mainContainer .app-screen > .flex > div { min-width: 0; }
  #screen-users .user-card-heading { flex-wrap: wrap; }
  #screen-users .user-card-heading > div { min-width: 0; }
  #screen-users .user-card-heading > .text-right { text-align: left; }
  #screen-users .user-card-heading > div:first-child > .flex { flex-wrap: wrap; }
  #screen-users .user-card-heading > .text-right > span { display: inline-block; }
}
@media (max-width: 359px) {
  header > div { padding-left: 8px !important; padding-right: 8px !important; gap: 4px !important; }
  header > div > button { gap: 4px !important; }
  header > div > button > div { max-width: 56px; }
  header > div > button img { width: 28px; height: 28px; }
}

/* r41: component selectors must outrank .btn-kaspi and input variants. */
dialog.pms-dialog > .modal-content { overflow-wrap: anywhere; }
@media (max-width: 768px) {
  dialog.pms-dialog .modal-content button, dialog.pms-dialog .modal-content a.btn-kaspi, dialog.pms-dialog .modal-content select,
  dialog.pms-dialog .modal-content textarea,
  dialog.pms-dialog input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
    min-height: 44px;
  }
  dialog.pms-dialog .modal-content button { min-width: 44px; flex-shrink: 0; }
  dialog.pms-dialog input, dialog.pms-dialog select, dialog.pms-dialog textarea { min-width: 0; }
  .pms-toast-close { min-width: 44px; min-height: 44px; }
  #bookingDateModal > .modal-content { padding-left: 5px; padding-right: 5px; }
  #bookingDateModal .calendar-grid { gap: 0; }
  #bookingDateModal .calendar-day { min-height: 44px; min-width: 44px; }
  #screen-new_booking button, #screen-new_booking select, #screen-new_booking textarea,
  #screen-new_booking input:not([type="checkbox"]):not([type="radio"]) { min-height: 44px; }
  #screen-new_booking button { min-width: 44px; flex-shrink: 0; }
  #screen-new_booking input, #screen-new_booking select { min-width: 0; }
  #screen-new_booking input[type="number"] { min-width: 44px; }
  #screen-new_booking label:has(input[type="checkbox"]),
  dialog.pms-dialog label:has(input[type="checkbox"]) { min-height: 44px; }
  #wizStaffQuartersContainer > :last-child { flex-wrap: wrap; }
  #wizStaffQuartersNote { flex-basis: 100%; }
  #payerForm > :last-child { flex-wrap: wrap; gap: 12px; }
  #screen-new_booking .wizard-meal-grid { grid-template-columns: 1fr; }
  #screen-new_booking .wizard-meal-grid > div {
    flex-direction: row; justify-content: space-between; gap: 8px;
  }
  #screen-new_booking .wizard-meal-grid > div > span { margin-bottom: 0; }
  #screen-new_booking .wizard-staff-gender { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Print only the reconciliation document, in normal paginated flow. */
@media print {
  @page { size: A4; margin: 12mm; }
  html:has(#reconciliationModal[open]) { background: white !important; }
  body:has(#reconciliationModal[open]) {
    display: block !important; overflow: visible !important;
    height: auto !important; min-height: 0 !important; padding: 0 !important;
    background: white !important;
  }
  body:has(#reconciliationModal[open]) > :not(#reconciliationModal) { display: none !important; }
  #reconciliationModal[open] {
    position: static !important; display: block !important; overflow: visible !important;
    width: 100% !important; max-width: none !important; height: auto !important;
    max-height: none !important; margin: 0 !important;
  }
  #reconciliationModal::backdrop { background: transparent !important; }
  #reconciliationModal > .modal-content {
    max-width: none !important; max-height: none !important; height: auto !important;
    overflow: visible !important; padding: 0 !important; border: 0; border-radius: 0; box-shadow: none;
  }
  #reconciliationModal .bottom-sheet-handle, #reconciliationModal button { display: none !important; }
  #reconciliationModal .overflow-x-auto { overflow: visible !important; border: 0; }
  #reconciliationModal table { table-layout: fixed; width: 100%; font-size: 12px; }
  #reconciliationModal thead { display: table-header-group; }
  #reconciliationModal tfoot { display: table-row-group; }
  #reconciliationModal tr { break-inside: avoid; }
  #reconciliationModal th, #reconciliationModal td { padding: 8px 5px; }
  #reconciliationModal th:first-child { width: 6%; }
  #reconciliationModal th:nth-child(2) { width: 31%; }
  #reconciliationModal .reconciliation-parties { break-inside: avoid; }
}
