@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Thai:wght@300;400;500;600;700&display=swap');

:root {
  --brand: #0ea5e9;
  --brand-dark: #0369a1;
  --brand-soft: #e0f2fe;
}

* { box-sizing: border-box; }

body {
  font-family: 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: #0f172a;
  margin: 0;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #e2e8f0; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

.tab {
  display: inline-block; text-decoration: none;
  padding: .5rem 1rem; border-radius: .6rem .6rem 0 0; cursor: pointer;
  font-weight: 500; font-size: .85rem; white-space: nowrap;
  border: 1px solid transparent; border-bottom: none; color: #64748b;
  background: transparent; transition: background .15s, color .15s;
}
.tab:hover { background: #e2e8f0; color: #334155; }
.tab.active {
  background: #fff; color: var(--brand-dark); border-color: #cbd5e1; font-weight: 600;
  box-shadow: inset 0 3px 0 0 var(--brand);
}

.sec-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; color: #0f172a; }

.card { background: #fff; border: 1px solid #e2e8f0; border-radius: .75rem; }

/* ⚠️ Tailwind มี utility `.grid { display:grid }` — ต้องบังคับกลับเป็น table
   ไม่งั้น thead/tbody จะกลายเป็น block แล้วคอลัมน์หัวตารางไม่ตรงกับตัวตาราง */
table.grid { display: table; border-collapse: separate; border-spacing: 0; width: 100%; font-size: .8rem; }
table.grid > thead { display: table-header-group; }
table.grid > tbody { display: table-row-group; }
table.grid > colgroup { display: table-column-group; }
table.grid > colgroup > col { display: table-column; }
table.grid tr { display: table-row; }
table.grid th, table.grid td { display: table-cell; }
table.grid th, table.grid td { border-bottom: 1px solid #e2e8f0; border-right: 1px solid #f1f5f9; padding: .4rem .5rem; }
table.grid thead th {
  position: sticky; top: 0; z-index: 5; background: #f8fafc;
  font-weight: 600; color: #334155; text-align: center; white-space: nowrap;
}
table.grid tbody tr:hover { background: #f8fafc; }
.sticky-col {
  position: sticky; left: 0; z-index: 4; background: #fff;
  border-right: 2px solid #e2e8f0 !important; font-weight: 500;
}
thead .sticky-col { z-index: 6; background: #f8fafc; }

.slot-break { background: repeating-linear-gradient(45deg, #fef3c7, #fef3c7 6px, #fde68a 6px, #fde68a 12px); }
.cell-0 { color: #cbd5e1; }
.cell-neg { color: #dc2626; font-weight: 600; }
.cell-hi { background: #dbeafe; font-weight: 600; color: #1d4ed8; }

.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem;
  border-radius: 999px; font-size: .7rem; font-weight: 500; }

.zone-card { border-left-width: 5px; border-left-style: solid; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; background: #f1f5f9;
  border: 1px solid #e2e8f0; border-radius: 999px; padding: .15rem .5rem .15rem .6rem;
  font-size: .75rem; margin: .12rem;
}
.chip button { color: #94a3b8; font-weight: 700; line-height: 1; }
.chip button:hover { color: #dc2626; }

input.cell, select.cell {
  width: 100%; border: 1px solid transparent; background: transparent;
  border-radius: .35rem; padding: .2rem .35rem; font-size: .8rem;
  font-family: inherit; color: inherit;
}
input.cell:hover, select.cell:hover { border-color: #cbd5e1; background: #fff; }
input.cell:focus, select.cell:focus { outline: none; border-color: var(--brand); background: #fff; }

.ts { font-size: .6rem; color: #94a3b8; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #cbd5e1; break-inside: avoid; }
}

/* ============================================================
   HK-THEME 2026-08-03 — ปรับหน้าตาให้เข้ากับแอป housekeeping-pm
   (ฟอนต์ Segoe UI · พื้นเทา #f5f5f5 · ม่วง #7c3aed · มุมโค้งน้อย
    เส้นขอบ #e0e0e0 · ตัดเงา) — แก้เฉพาะสไตล์ ไม่แตะโครงสร้าง/ตรรกะ
   ============================================================ */
:root{
  --brand:#7c3aed; --brand-dark:#6d28d9; --brand-soft:#ede9fe;
  --hk-bg:#f5f5f5; --hk-card:#fff; --hk-border:#e0e0e0;
  --hk-text:#212121; --hk-text2:#757575;
}
body{
  font-family:'Segoe UI',Tahoma,sans-serif !important;
  background:var(--hk-bg) !important; color:var(--hk-text) !important;
}
/* กล่อง/การ์ด: มุมโค้งน้อยลง ตัดเงา ใช้เส้นขอบสีเดียวกับแอปหลัก */
.bg-white{ background:var(--hk-card) !important; }
[class*="rounded-2xl"],[class*="rounded-xl"]{ border-radius:8px !important; }
[class*="rounded-lg"]{ border-radius:6px !important; }
[class*="shadow"]{ box-shadow:0 1px 3px rgba(0,0,0,.04) !important; }
[class*="border-slate-2"],[class*="border-slate-3"]{ border-color:var(--hk-border) !important; }
/* ตัวหนังสือ */
[class*="text-slate-9"],[class*="text-slate-8"]{ color:var(--hk-text) !important; }
[class*="text-slate-5"],[class*="text-slate-4"]{ color:var(--hk-text2) !important; }
/* ปุ่มหลัก/แท็บ ใช้ม่วงของแอปหลัก
   ⚠️ ใช้ ~= (จับคลาสแบบเป๊ะ) ห้ามใช้ *= เพราะ "bg-sky-5" จะไปโดน bg-sky-50
      (สีอ่อนพื้นหลังตาราง) ทำให้ช่องวันกลายเป็นม่วงทึบ */
.tab.active{ color:var(--brand) !important; border-color:var(--hk-border) !important; }
[class~="bg-sky-500"],[class~="bg-sky-600"],[class~="bg-sky-700"],
[class~="bg-blue-500"],[class~="bg-blue-600"],[class~="bg-blue-700"],
[class~="bg-cyan-600"],[class~="bg-indigo-600"]{ background:var(--brand) !important; }
[class~="text-sky-600"],[class~="text-sky-700"],[class~="text-blue-600"],
[class~="text-blue-700"],[class~="text-cyan-700"],[class~="text-indigo-700"]{ color:var(--brand) !important; }
[class~="bg-sky-600"]:hover,[class~="bg-sky-700"]:hover,
[class~="bg-blue-600"]:hover{ background:var(--brand-dark) !important; }
/* สีอ่อน (50/100) = พื้นหลังตาราง/ป้าย ปล่อยไว้ตามเดิม ห้ามทับ */
/* input/select ให้เป็นทรงเดียวกับแอปหลัก */
input,select,textarea,button{ font-family:inherit !important; }
input:not([type=checkbox]):not([type=radio]),select,textarea{
  border-radius:4px !important; border:1px solid var(--hk-border) !important;
}

/* เมื่อถูกฝังในแอปอื่น (iframe): ไม่ต้องมีแถบลอยตาม
   เพราะแอปแม่มีแถบหัวของตัวเองอยู่แล้ว — ลอย 2 ชั้นจะทับกัน */
html.is-embed header.sticky{ position:static !important; box-shadow:none !important; }
html.is-embed body{ background:#f5f5f5 !important; }
