:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

.safe-pt {
  padding-top: var(--safe-top);
}

.safe-pb {
  padding-bottom: var(--safe-bottom);
}

.safe-header {
  padding-top: var(--safe-top);
  min-height: calc(4rem + var(--safe-top));
}

.safe-back-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  font-family: "Prompt", Arial, sans-serif;
  background: #f2f4f8;
}

.container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6vh 20px 40px 20px;
}

@media (min-width: 768px) {
  .container {
    justify-content: center;
    padding: 20px;
  }
}

h1 {
  margin-bottom: 30px;
  color: #222;
  text-align: center;
}

.menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  width: 100%;
  max-width: 420px;
}

.menu button {
  height: 120px;
  border: none;
  border-radius: 18px;
  font-size: 24px;
  font-weight: bold;
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.chat-btn { background: #2563eb; }
.boss { background: #1e40af; }
.repair { background: #16a34a; }
.toilet { background: #ea580c; }
.inspect { background: #7c3aed; }

.menu button:active { transform: scale(0.97); }

.krk-hidden,
.claim-hidden { display: none; }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

select,
input[type="text"],
input[type="tel"],
input[type="date"],
textarea,
input[type="number"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

@media (max-width: 480px) {
  .menu { grid-template-columns: 1fr; }
  .menu button { height: 95px; font-size: 22px; }
}

/* CSS สำหรับปริ้น */
@media print {
  @page {
    size: A4 portrait;
    margin: 0; /* บังคับลบ 127.0.0.1, วันเวลา และชื่อหัวกระดาษทิ้ง 100% */
  }
  body {
    padding: 12mm !important;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  body * {
    visibility: hidden;
  }
  #job_detail_modal, #job_detail_modal * {
    visibility: visible;
  }
  #job_detail_modal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto !important;
    background: white !important;
    display: block !important;
    padding: 0 !important;
  }
  #job_detail_modal > div {
    max-height: none !important;
    overflow: visible !important;
    max-width: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }
  #job_detail_modal .bg-slate-800,
  #job_detail_modal button {
    display: none !important;
  }
  #modal_content {
    overflow: visible !important;
    max-height: none !important;
    padding: 15px 0 !important;
  }
  
  /* ให้สีพื้นหลังแสดงตอนปริ้น */
  .bg-slate-100 { background-color: #f1f5f9 !important; }
  .bg-emerald-50 { background-color: #ecfdf5 !important; }
  .bg-blue-50 { background-color: #eff6ff !important; }
  .bg-purple-50 { background-color: #faf5ff !important; }
  
  /* จัดการให้ Grid แสดงผลได้ตอนปริ้น */
  .print-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1rem !important;
  }
  
  /* จัดการรูปภาพให้ขึ้นหน้าใหม่ถ้ามีหลายรูป */
  .print-photo-section {
    page-break-before: always;
    break-before: page;
    margin-top: 15mm !important;
    padding-top: 5mm !important;
  }
  
  .print-photo-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important; /* 2 รูปต่อแถว */
    gap: 16px !important;
    page-break-inside: avoid !important;
  }
  
  .print-photo-grid a {
    display: block;
    page-break-inside: avoid;
  }
  
  .print-photo-grid img {
    width: 100% !important;
    height: 360px !important;
    max-height: 360px !important;
    object-fit: contain !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background-color: #f8fafc !important;
  }

  .overflow-x-auto {
    overflow: visible !important;
  }
}
/* Dark Mode Filter Inversion for legacy pages only (Excluding .dashboard-page and
   .native-dark-page). This filter:invert trick is being phased out in favor of pages that
   use real dark Tailwind color classes baked into their markup - see .native-dark-page below.
   Kept here as a fallback for any page not yet converted. */
body.dark-mode:not(.dashboard-page):not(.native-dark-page) {
  filter: invert(1) hue-rotate(180deg);
  background: #111 !important;
}

body.dark-mode:not(.dashboard-page):not(.native-dark-page) img,
body.dark-mode:not(.dashboard-page):not(.native-dark-page) canvas,
body.dark-mode:not(.dashboard-page):not(.native-dark-page) .modal-backdrop,
body.dark-mode:not(.dashboard-page):not(.native-dark-page) .menu button,
body.dark-mode:not(.dashboard-page):not(.native-dark-page) .dark-toggle-btn {
  filter: invert(1) hue-rotate(180deg);
}

body.dark-mode:not(.dashboard-page):not(.native-dark-page) .bg-white {
  background-color: #fff !important;
}

/* Native Dark Theme overrides for .dashboard-page and .native-dark-page - both use real
   dark Tailwind color classes directly in their markup (baked into the initial HTML, so
   there's no flash-of-light-content on load), so the filter:invert hack above must not
   apply to them - it would double-invert their already-dark colors back to light. */
body.dashboard-page,
body.native-dark-page {
  filter: none !important;
}

body.dashboard-page {
  background-color: #0b0f19 !important;
  color: #f8fafc !important;
}


