/* THE MAJCHA Farm — สไตล์หลัก */
:root {
  --bg: #f3f6f7;
  --surface: #ffffff;
  --surface-2: #f7fafa;
  --line: #e2e8ea;
  --text: #16242b;
  --muted: #62737b;
  --primary: #0f4c5c;
  --primary-2: #13677c;
  --primary-soft: #e3f0f2;
  --accent: #f0624d;
  --accent-soft: #fdebe7;
  --ok: #1d8a5b;
  --ok-soft: #e1f4ea;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --bad: #c83a3a;
  --bad-soft: #fbe6e6;
  --info: #2f6fb3;
  --info-soft: #e5eef9;
  --shadow: 0 1px 2px rgba(16, 36, 43, .06), 0 4px 16px rgba(16, 36, 43, .05);
  --radius: 14px;
  --side-w: 250px;
  --top-h: 60px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1518; --surface: #142126; --surface-2: #182930; --line: #24363d; --text: #e5eef0; --muted: #8fa4ab;
    --primary: #4fb3c8; --primary-2: #6cc6d8; --primary-soft: #16343c; --accent: #ff7a63; --accent-soft: #3a1f1a;
    --ok: #4cc58c; --ok-soft: #173327; --warn: #e3ac4f; --warn-soft: #3a2e17; --bad: #f07272; --bad-soft: #3a1b1b;
    --info: #7fb1ea; --info-soft: #182a3f; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0d1518; --surface: #142126; --surface-2: #182930; --line: #24363d; --text: #e5eef0; --muted: #8fa4ab;
    --primary: #4fb3c8; --primary-2: #6cc6d8; --primary-soft: #16343c; --accent: #ff7a63; --accent-soft: #3a1f1a;
    --ok: #4cc58c; --ok-soft: #173327; --warn: #e3ac4f; --warn-soft: #3a2e17; --bad: #f07272; --bad-soft: #3a1b1b;
    --info: #7fb1ea; --info-soft: #182a3f; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 'IBM Plex Sans Thai', 'Noto Sans Thai', 'Leelawadee UI', Tahoma, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.3; font-weight: 600; }
h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; } h4 { font-size: .98rem; }
p { margin: 0 0 .6em; }
small, .small { font-size: .82rem; }
.tiny { font-size: .75rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.accent { color: var(--accent); }
.grow { flex: 1; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap { gap: 8px; } .gap-lg { gap: 16px; }
.center-x { justify-content: center; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.hidden, [hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ic { flex: none; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s; white-space: nowrap;
}
.btn:hover { border-color: var(--primary-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: .88rem; border-radius: 8px; }
.btn.big { min-height: 50px; font-size: 1.05rem; }
.btn.block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.6); border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn:not(.primary):not(.accent):not(.ok):not(.danger).loading::after { border-color: var(--primary); border-top-color: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: inherit; cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; }

/* ---------- การ์ด ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card, .card + .grid, .grid + .card, .grid + .grid, .section + .section { margin-top: 14px; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }
.card.error { display: flex; gap: 12px; color: var(--bad); }
.card.flat { box-shadow: none; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; position: relative; }
.stat-l { font-size: .8rem; color: var(--muted); }
.stat-v { font-size: 1.45rem; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-s { font-size: .78rem; color: var(--muted); }
.stat-ic { position: absolute; right: 12px; top: 12px; color: var(--muted); opacity: .7; }
.stat.ok .stat-v { color: var(--ok); } .stat.warn .stat-v { color: var(--warn); } .stat.bad .stat-v { color: var(--bad); } .stat.accent .stat-v { color: var(--accent); }
a.stat:hover { border-color: var(--primary-2); }

/* ---------- ฟอร์ม ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field .lbl { font-size: .85rem; color: var(--muted); font-weight: 500; }
.field .hint { color: var(--muted); font-size: .76rem; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px var(--primary-soft); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.photo-in { display: inline-flex; gap: 8px; align-items: center; padding: 10px 14px; border: 1px dashed var(--line); border-radius: 10px; cursor: pointer; color: var(--muted); }
.photo-preview img { margin-top: 8px; max-width: 100%; max-height: 220px; border-radius: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .88rem; user-select: none; }
.chip.on, .chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input { display: none; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar select, .toolbar input { width: auto; min-width: 130px; flex: 0 1 auto; }
.toolbar .search { flex: 1 1 180px; }

/* ---------- ป้าย ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.b-gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.b-ok { background: var(--ok-soft); color: var(--ok); }
.b-warn { background: var(--warn-soft); color: var(--warn); }
.b-bad { background: var(--bad-soft); color: var(--bad); }
.b-info { background: var(--info-soft); color: var(--info); }
.b-primary { background: var(--primary-soft); color: var(--primary); }
.b-accent { background: var(--accent-soft); color: var(--accent); }

/* ---------- ตาราง / รายการ ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.r, th.r { text-align: right; }
table.wide { min-width: 720px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 500; }
.item .meta { font-size: .82rem; color: var(--muted); display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; }
.item.clickable { cursor: pointer; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty .ic { opacity: .35; margin-bottom: 6px; }
.empty p { margin: 0; font-weight: 500; }

/* ---------- avatar ---------- */
.avatar { display: inline-grid; place-items: center; border-radius: 50%; flex: none; background: hsl(var(--h, 190) 45% 88%); color: hsl(var(--h, 190) 45% 28%); font-weight: 600; object-fit: cover; }

/* ---------- แท็บ ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 auto; border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- โครงหน้าจอ ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.main { min-height: 100vh; padding-bottom: calc(var(--tab-h) + var(--safe-b)); }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 6px; padding: 0 12px 0 16px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 1.12rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bell i { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-style: normal; font-weight: 700; display: grid; place-items: center; }
.me { display: flex; align-items: center; gap: 8px; color: var(--text); padding: 4px; border-radius: 10px; }
.me span { display: flex; flex-direction: column; line-height: 1.2; }
.me small { color: var(--muted); }
.view { padding: 16px; max-width: 1180px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); height: calc(var(--tab-h) + var(--safe-b)); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; }
.tabbar a.on { color: var(--primary); font-weight: 600; }
.only-desk { display: none !important; }
.demo-bar { background: var(--warn-soft); color: var(--warn); font-size: .82rem; padding: 6px 12px; text-align: center; }
.demo-bar button { margin-left: 8px; background: none; border: 1px solid currentColor; color: inherit; border-radius: 6px; padding: 1px 8px; font: inherit; cursor: pointer; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); } /* minmax(0,…): ตารางกว้างเลื่อนในกล่อง .table-wrap ไม่ดันทั้งหน้า (g2-8) */
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto; }
  .main { padding-bottom: 24px; }
  .tabbar, .only-mob { display: none !important; }
  .only-desk { display: flex !important; }
  .view { padding: 22px 28px; }
  .top { padding: 0 20px 0 28px; }
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; color: var(--text); }
.brand img { border-radius: 9px; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand small { color: var(--muted); font-size: .75rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: .93rem; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-item em { margin-left: auto; font-style: normal; font-size: .68rem; color: var(--muted); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.nav-sep { margin: 14px 12px 4px; font-size: .72rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.side-foot { margin-top: auto; padding: 12px; color: var(--muted); }

/* ---------- เมนูมือถือ ---------- */
.me-card { display: flex; align-items: center; gap: 12px; color: var(--text); margin-bottom: 14px; }
.me-card div { flex: 1; display: flex; flex-direction: column; }
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.menu-sep { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); font-weight: 600; margin-top: 8px; }
.menu-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); text-align: center; font-size: .82rem; line-height: 1.3; min-height: 92px; justify-content: center; }
.menu-tile .ic { color: var(--primary); }
.menu-tile.soon { opacity: .6; }
@media (min-width: 600px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }

/* ---------- ล็อกอิน ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, var(--primary-soft), var(--bg)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px; box-shadow: var(--shadow); }
.auth-card h2 { margin-top: 12px; }
.auth-card .btn.big { width: 100%; }
.brand-big { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.brand-big img { border-radius: 14px; }
.brand-big div { display: flex; flex-direction: column; }
.brand-big b { font-size: 1.2rem; }
.brand-big small { color: var(--muted); }
.notice { display: flex; gap: 8px; align-items: flex-start; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: .86rem; margin-bottom: 10px; }
.notice.info { background: var(--info-soft); color: var(--info); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.demo-roles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.demo-roles .btn { flex-direction: column; min-height: 70px; font-size: .86rem; padding: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

/* ---------- modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(8, 20, 26, .45); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal-wrap.out { opacity: 0; transition: opacity .15s; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 18px 18px 0 0; display: flex; flex-direction: column; animation: up .2s ease-out; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; padding: 14px 12px 8px 18px; }
.modal-head h3 { flex: 1; margin: 0; }
.modal-body { padding: 6px 18px 12px; overflow-y: auto; }
.modal-body > * + * { margin-top: 12px; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); flex-wrap: wrap; }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { border-radius: 18px; } }
@keyframes up { from { transform: translateY(30px); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }

.modal .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.modal .stat { padding: 10px; }
.modal .stat-v { font-size: 1.15rem; }

/* ---------- toast ---------- */
#toasts { position: fixed; z-index: 200; left: 50%; transform: translateX(-50%); top: 12px; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: .92rem; animation: drop .2s ease-out; transition: opacity .3s, transform .3s; }
.toast-err { background: var(--bad); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } }

/* ---------- loading ---------- */
.loading-box { display: grid; place-items: center; padding: 48px; }
.loading-box.full { min-height: 100vh; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--primary-soft); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- แจ้งเตือน ---------- */
.notif-list { display: flex; flex-direction: column; gap: 6px; }
.notif { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px; color: var(--text); border: 1px solid var(--line); }
.notif.unread { background: var(--primary-soft); border-color: transparent; }
.notif span { font-size: .88rem; }
.notif small { color: var(--muted); font-size: .75rem; }

/* ---------- ลงเวลา ---------- */
.clock-hero { text-align: center; padding: 24px 16px; }
.clock-now { font-size: 3rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
.clock-btn { width: 180px; height: 180px; border-radius: 50%; border: 0; margin: 18px auto 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 1.15rem; font-weight: 600; color: #fff; cursor: pointer; box-shadow: 0 10px 30px rgba(15, 76, 92, .28); transition: transform .1s; }
.clock-btn:active { transform: scale(.97); }
.clock-btn.in { background: radial-gradient(circle at 30% 30%, #1a8aa3, var(--primary)); }
.clock-btn.out { background: radial-gradient(circle at 30% 30%, #ff8a73, var(--accent)); box-shadow: 0 10px 30px rgba(240, 98, 77, .3); }
.clock-btn.done { background: var(--surface-2); color: var(--muted); box-shadow: none; border: 1px solid var(--line); cursor: default; }
.clock-btn small { font-weight: 400; font-size: .8rem; opacity: .9; }
.geo { display: inline-flex; gap: 6px; align-items: center; font-size: .86rem; padding: 6px 12px; border-radius: 999px; }
.timeline { display: flex; justify-content: center; gap: 28px; margin-top: 12px; }
.timeline div { display: flex; flex-direction: column; }
.timeline b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }

/* ---------- ภารกิจ ---------- */
.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task .tick { flex: none; width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; margin-top: 1px; }
.task .tick:hover { border-color: var(--ok); }
.task.done .tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.doing .tick { border-color: var(--info); background: var(--info-soft); }
.task.done .t-title { text-decoration: line-through; color: var(--muted); }
.task .body { flex: 1; min-width: 0; cursor: pointer; }
.t-title { font-weight: 500; }
.task .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 4px 10px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.prio-urgent { border-left: 3px solid var(--bad); padding-left: 10px; }
.prio-high { border-left: 3px solid var(--warn); padding-left: 10px; }
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav b { min-width: 150px; text-align: center; }

/* ---------- ปฏิทิน ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; font-weight: 600; }
.cal .day { min-height: 74px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 5px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; overflow: hidden; font-size: .72rem; }
.cal .day.other { opacity: .4; }
.cal .day.today { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.cal .day.sel { background: var(--primary-soft); }
.cal .d-num { font-weight: 600; font-size: .82rem; }
.cal .pill { border-radius: 5px; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.5; }
.cal .dots { display: flex; gap: 3px; flex-wrap: wrap; }
.cal .dot { width: 7px; height: 7px; border-radius: 50%; }
@media (max-width: 600px) { .cal .day { min-height: 54px; } .cal .pill { display: none; } }
@media (min-width: 601px) { .cal .dots { display: none; } }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- สต๊อก ---------- */
.lot { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.lot:last-child { border-bottom: 0; }
.lot .qty { font-size: 1.25rem; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.lot .qty small { display: block; font-size: .72rem; font-weight: 400; color: var(--muted); }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--primary-2); border-radius: 999px; }
.progress.ready i { background: var(--ok); }
.cont-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cont { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.cont:hover { border-color: var(--primary-2); }
.cont.emptyc { border-style: dashed; background: transparent; }
.cont b { display: block; }
.pipeline { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pipe-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.pipe-col h4 { display: flex; justify-content: space-between; font-size: .88rem; }
.pipe-card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; cursor: pointer; font-size: .86rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 70px; gap: 10px; align-items: center; font-size: .86rem; padding: 4px 0; }
.bar-row .bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--primary-2); border-radius: 999px; }

/* ---------- เงินเดือน ---------- */
.slip { font-size: .92rem; }
.slip .line { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.slip .line.total { font-weight: 700; font-size: 1.05rem; border-bottom: 0; border-top: 2px solid var(--text); margin-top: 6px; padding-top: 10px; }
.slip .minus { color: var(--bad); }
.slip .plus { color: var(--ok); }

/* ---------- SOP ---------- */
.sop-body { font-size: 1rem; line-height: 1.75; max-width: 68ch; }
.sop-body ol, .sop-body ul { padding-left: 1.4em; margin: 0 0 .8em; }
.sop-body li { margin: .35em 0; }
.worker-actions { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.worker-actions a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 120px; border-radius: 16px; font-weight: 600; font-size: 1.05rem; color: #fff; background: var(--primary); text-align: center; padding: 12px; }
.worker-actions a.alt { background: var(--surface); color: var(--primary); border: 1px solid var(--line); }

/* ---------- พิมพ์ ---------- */
@media print {
  .side, .top, .tabbar, .demo-bar, .no-print, .toolbar, .tabs { display: none !important; }
  .main { padding: 0; } .view { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; color: #000; }
}

/* ---------- พักเที่ยง ---------- */
.break-card { margin-top: 14px; }
.break-card.done { display: flex; align-items: center; gap: 12px; }
.break-card.active { text-align: center; border-color: var(--accent); }
.break-count { font-size: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); line-height: 1.1; margin: 6px 0 2px; }
.break-card.over { background: var(--bad-soft); border-color: var(--bad); animation: pulse 1s ease-in-out infinite alternate; }
.break-card.over .break-count, .break-card.over #bMsg { color: var(--bad); font-weight: 600; }
@keyframes pulse { to { box-shadow: 0 0 0 6px color-mix(in srgb, var(--bad) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .break-card.over { animation: none; } }
.break-banner { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); z-index: 150; background: var(--bad); color: #fff; padding: 14px 16px; border-radius: 14px; font-weight: 600; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
@media (min-width: 900px) { .break-banner { left: auto; right: 24px; bottom: 24px; max-width: 420px; } }

/* ---------- ตัวเลือกแบบการ์ด (ประเภท OT) ---------- */
.seg-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; flex-direction: column; gap: 2px; padding: 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface, #fff); text-align: center; }
.choice span small { color: var(--muted); }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-soft); }
.choice input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.ot-split { display: flex; flex-wrap: wrap; gap: 4px; }
.ot-item { flex-wrap: wrap; }
.ot-item .body { flex: 1 1 60%; min-width: 0; }
.ot-actions { flex: 1 1 100%; display: flex; gap: 8px; justify-content: flex-end; }
@media (min-width: 720px) { .ot-actions { flex: 0 0 auto; } }
.shift-card.due { border: 2px solid var(--accent); background: var(--accent-soft); text-align: center; }
.shift-card.due .btn small { display: block; font-weight: 400; opacity: .85; }
.shift-card.ot { border-left: 4px solid var(--primary); }
.shift-btn { flex-direction: column; gap: 2px; white-space: normal; min-width: 0; height: auto; padding: 12px 8px; }
.shift-btn span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- บันทึกงานประจำวัน ---------- */
.wl-rows { display: flex; flex-direction: column; gap: 8px; }
.wl-row { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "time farm rm" "task task task" "qty qty qty"; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.wl-row .wl-time { grid-area: time; display: flex; align-items: center; gap: 4px; }
.wl-row .wl-time input { width: 7.2em; }
.wl-row select { grid-area: farm; min-width: 0; }
.wl-row .wl-task { grid-area: task; }
.wl-row .wl-qty { grid-area: qty; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.wl-row [data-rm] { grid-area: rm; }
@media (min-width: 900px) {
  .wl-row { grid-template-columns: auto 180px 1fr 220px auto; grid-template-areas: "time farm task qty rm"; align-items: center; }
}
.wl-att { margin-bottom: 10px; }
.wl-view .wl-line { display: grid; grid-template-columns: 100px 1fr; gap: 2px 10px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.wl-view .wl-line b { grid-column: 1 / -1; }
@media (min-width: 720px) { .wl-view .wl-line { grid-template-columns: 110px 170px 1fr auto; } .wl-view .wl-line b { grid-column: auto; } }
details.wl-item { display: block; }
details.wl-item summary { cursor: pointer; padding: 4px 0; }

/* ---------- KPI ---------- */
.kpi-table input.kpi-in { width: 6.5em; text-align: right; }
.kpi-total { font-size: 1.3rem; min-width: 3em; text-align: right; }
details.kpi-sum { margin-top: 10px; }
details.kpi-sum summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.kpi-rows { display: flex; flex-direction: column; gap: 8px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.kpi-row .kpi-name { grid-column: 1 / -1; }
.kpi-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi-cell small { color: var(--muted); font-size: .75rem; }
.kpi-cell input.kpi-in { width: 100%; text-align: right; }
@media (min-width: 720px) { .kpi-row { grid-template-columns: 1fr 70px 110px 100px 100px; align-items: center; } .kpi-row .kpi-name { grid-column: auto; } }
.kpi-sumline { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px; font-size: 1.05rem; }
.kpi-sumline b { font-size: 1.4rem; }
.wl-row { grid-template-columns: 1fr auto; grid-template-areas: "time rm" "farm farm" "task task" "qty qty"; }
.wl-row .wl-time input { flex: 1; width: auto; min-width: 0; }
@media (min-width: 900px) {
  .wl-row { grid-template-columns: auto 180px 1fr 220px auto; grid-template-areas: "time farm task qty rm"; align-items: center; }
  .wl-row .wl-time input { width: 7.2em; flex: none; }
}
.wl-row > *, .wl-row input, .wl-row select { min-width: 0; max-width: 100%; box-sizing: border-box; }
.wl-row select, .wl-row .wl-task, .wl-row .wl-qty input { width: 100%; }

/* ---------- บัญชีรายจ่าย / เงินสำรอง / สรุปกำไร ---------- */
.day-head { display: flex; justify-content: space-between; padding: 10px 2px 4px; border-bottom: 1px solid var(--line); margin-top: 6px; color: var(--muted); }
.day-head b { color: var(--text); }
.rcpt-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.rcpt { margin: 0; flex: 1 1 160px; }
.rcpt img { width: 100%; border-radius: 10px; }
.cash-act { flex: 1 1 100%; display: flex; gap: 8px; justify-content: flex-end; }
.card.cash-alert { border: 2px solid var(--warn); background: var(--warn-soft); }
.num.plus { color: var(--ok); } .num.minus { color: var(--bad); }
.fin-table td, .fin-table th { white-space: nowrap; }
.fin-table .fin-profit td { border-top: 2px solid var(--line); }
.fin-bars { display: flex; flex-direction: column; gap: 3px; }
.fin-bars i, .legend i { display: block; height: 8px; border-radius: 4px; }
.lg-in { background: var(--ok); } .lg-ex { background: var(--accent); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--muted); }
.legend i { width: 14px; display: inline-block; }
.fin-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fin-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fin-card > b { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-card.all { grid-column: 1 / -1; background: var(--primary-soft); }
.fin-line { display: flex; justify-content: space-between; gap: 6px; font-size: .85rem; }
.fin-line.total { border-top: 1px dashed var(--line); padding-top: 3px; font-size: .95rem; }
.fin-wide { display: none; }
@media (min-width: 900px) { .fin-cards { display: none; } .fin-wide { display: block; } }
.fin-table th:first-child, .fin-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }

/* ---------- ลูกค้า / ใบเสนอราคา / บิล ---------- */
.cust-code { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; height: 30px; padding: 0 8px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .85rem; letter-spacing: .03em; flex-shrink: 0; }
.cust-code.big { min-width: 64px; height: 44px; font-size: 1.05rem; }
.cust-card { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.5; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 16px; margin-top: 12px; }
.chg-row { display: grid; grid-template-columns: 1fr 76px 110px auto; gap: 6px; margin-bottom: 6px; align-items: center; }
.chg-row > * { min-width: 0; }
.qi-head { display: none; }
.qi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: var(--surface-2); align-items: center; }
.qi-row > * { min-width: 0; }
.qi-row [data-f=description] { grid-column: 1 / -1; }
.qi-row [data-f=lot_id] { grid-column: 1 / -1; }
.qi-row .qi-amt { text-align: right; align-self: center; }
.qi-row .qi-btns { display: flex; justify-content: flex-end; gap: 4px; }
.qi-row .qi-btns [data-up] svg { transform: rotate(90deg); }
.qi-row.qi-heading { background: var(--primary-soft); }
.qi-row.qi-heading [data-f=sex], .qi-row.qi-heading [data-f=quantity], .qi-row.qi-heading [data-f=unit_price], .qi-row.qi-heading [data-f=lot_id], .qi-row.qi-heading .qi-amt { display: none; }
.qi-row.qi-gift { background: var(--ok-soft); }
.qi-row.qi-gift [data-f=unit_price] { visibility: hidden; }
@media (min-width: 980px) {
  .qi-head { display: grid; grid-template-columns: 120px 1fr 118px 84px 100px 96px 210px 64px; gap: 6px; padding: 0 10px 4px; font-size: .78rem; color: var(--muted); }
  .qi-row { grid-template-columns: 120px 1fr 118px 84px 100px 96px 210px 64px; padding: 6px 10px; border-radius: 10px; margin-bottom: 4px; }
  .qi-row [data-f=description], .qi-row [data-f=lot_id] { grid-column: auto; }
}
.q-tot { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; max-width: 420px; margin-left: auto; }
.q-tot > div { display: flex; justify-content: space-between; padding: 3px 0; }
.q-tot .grand { font-size: 1.15rem; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; color: var(--primary); }
.q-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 14px 0 24px; }
.doc-frame { background: #e9edf2; border-radius: 12px; padding: 10px; overflow-x: auto; margin-top: 10px; }
.doc-frame .bill { box-shadow: 0 2px 12px rgba(0,0,0,.12); border-radius: 4px; }
.pack-h { padding: 8px 4px 4px; font-weight: 700; color: var(--primary); border-bottom: 1px solid var(--line); }
.slip-img { max-width: 260px; width: 100%; border-radius: 10px; margin-top: 8px; }
.doc-iframe { width: 100%; min-height: 70vh; border: 0; border-radius: 8px; background: #e9edf2; display: block; }
.doc-frame { padding: 0; }
@media (min-width: 980px) {
  .qi-head, .qi-row { grid-template-columns: 104px minmax(200px, 1fr) 104px 70px 88px 84px 170px 56px; }
}

/* PRICE LIST (pricelist.js): ป้ายเล็กเหนือแต่ละช่องบนมือถือ (ไม่มีหัวคอลัมน์) · คอม ซ่อนป้าย ใช้ .pl-head (g7-5) */
.pl-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.pl-f > small { font-size: .72rem; color: var(--muted); line-height: 1.2; }
.pl-f.pl-wide { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .pl-f > small { display: none; }
  .pl-f.pl-wide { grid-column: auto; }
}

/* PRICE LIST */
.pl-card { display: block; text-decoration: none; }
.pl-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.pl-head { display: none; }
.pl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--surface-2); }
.pl-row > * { min-width: 0; }
.pl-row [data-k=color] { grid-column: 1 / -1; }
.pl-row .pl-btns { display: flex; gap: 4px; justify-content: flex-end; grid-column: 1 / -1; }
@media (min-width: 900px) {
  .pl-head { display: grid; grid-template-columns: 150px 130px 1fr 90px 90px 70px; gap: 6px; padding: 0 8px 4px; font-size: .78rem; color: var(--muted); }
  .pl-row { grid-template-columns: 150px 130px 1fr 90px 90px 70px; padding: 4px 8px; margin-bottom: 3px; }
  .pl-row [data-k=color], .pl-row .pl-btns { grid-column: auto; }
}
.qi-pick { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; }
.qi-pick select { min-width: 0; }
.qi-row.qi-heading .qi-pick, .qi-row.qi-other .qi-pick { display: none; }
.qi-pick .pl-miss { grid-column: 1 / -1; }

/* ใบปิดงาน */
.cl-h { font-weight: 700; margin: 12px 0 6px; }
.cl-h .req { color: var(--bad); }
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.cl-add { display: grid; place-items: center; gap: 2px; aspect-ratio: 1; border: 2px dashed var(--line); border-radius: 12px; color: var(--muted); cursor: pointer; font-size: .8rem; text-align: center; }
.cl-add:hover { border-color: var(--primary); color: var(--primary); }
.cl-th { position: relative; aspect-ratio: 1; }
.cl-th img { width: 100%; height: 100%; object-fit: cover; border-radius: 12px; }
.cl-th .icon-btn { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.55); color: #fff; width: 26px; height: 26px; }
.cl-view a img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; }
.lb-row { display: grid; grid-template-columns: 70px 1fr 120px; gap: 6px; align-items: center; margin-bottom: 6px; }

/* STOCK READY */
.sr-head { display: none; }
.sr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; background: var(--surface-2); }
.sr-row > * { min-width: 0; }
.sr-row [data-k=color] { grid-column: 1 / -1; }
.sr-row .sr-btns { display: flex; gap: 6px; align-items: center; justify-content: flex-end; grid-column: 1 / -1; }
/* มือถือไม่มีหัวคอลัมน์ → ป้ายเล็กเหนือช่อง เพศ / อายุ / ขนาด / จำนวน */
.sr-f { display: flex; flex-direction: column; gap: 2px; min-width: 0; margin: 0; }
.sr-f small { display: block; font-size: .7rem; color: var(--muted); line-height: 1.2; }
@media (min-width: 900px) {
  .sr-head { display: grid; grid-template-columns: 130px 1fr 110px 100px 130px 100px 90px; gap: 6px; padding: 0 8px 4px; font-size: .78rem; color: var(--muted); }
  .sr-row { grid-template-columns: 130px 1fr 110px 100px 130px 100px 90px; padding: 4px 8px; margin-bottom: 3px; }
  .sr-row [data-k=color], .sr-row .sr-btns { grid-column: auto; }
  .sr-f small { display: none; }
}
.qi-avail { grid-column: 1 / -1; font-size: .78rem; color: var(--muted); }
.qi-avail.low { color: var(--bad); font-weight: 600; }
.qi-avail.off { color: #b26a00; font-weight: 600; }
.offlist { margin: .4rem 0 .6rem 1.1rem; padding: 0; }
.offlist li { margin: .2rem 0; }

/* ---------- ใบปิดงานแพ็ค ---------- */
.pk-group { margin-bottom: 16px; }
.pk-gh { font-size: 1rem; margin: 6px 2px 8px; padding-left: 10px; border-left: 4px solid var(--line); }
.pk-gh.bad { border-color: var(--bad); color: var(--bad); }
.pk-gh.warn { border-color: var(--warn); color: var(--warn); }
.pk-gh.info { border-color: var(--info); }
.pk-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.pk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pk-card.done { border-left: 4px solid var(--ok); }
.pk-top { display: flex; align-items: center; gap: 10px; }
.pk-top .grow { min-width: 0; }
.pk-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .88rem; }
.pk-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pk-need { background: var(--surface-2, var(--bg)); border-radius: 8px; padding: 5px 8px; }
.pk-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.pk-acts .btn.ok { flex: 1 1 100%; justify-content: center; min-height: 44px; font-size: 1rem; }
.pk-thumbs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pk-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.pk-more { font-size: .85rem; color: var(--muted); padding: 0 4px; }
.t-bad { color: var(--bad); }
.pt-info { margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--warn-soft); display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.pt-info svg { color: var(--warn); }
.pt-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-weight: 700; font-size: .8rem; }
/* ---------- โปรโมชั่น ---------- */
.promo-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.promo-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; opacity: .75; }
.promo-card.live { opacity: 1; border-color: var(--ok); }
.promo-card img, .promo-noimg { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--warn-soft); }
.promo-noimg { display: flex; align-items: center; justify-content: center; color: var(--warn); }
.promo-b { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- หน้าสมาชิกลูกค้า (member.html) ---------- */
.mb-body { background: var(--bg); }
.mb-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.mb-top b { display: block; letter-spacing: .04em; }
.mb-top small { color: var(--muted); font-size: .75rem; }
.mb-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; }
.mb-lang { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.mb-lang button { border: 0; background: transparent; padding: 4px 10px; font: inherit; font-size: .8rem; color: var(--muted); cursor: pointer; }
.mb-lang button.on { background: var(--primary); color: #fff; }
.mb-wrap { max-width: 560px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.mb-hero h1 { margin: 8px 0 2px; font-size: 1.5rem; }
.mb-hero p { margin: 0; color: var(--muted); }
.mb-seg { display: flex; background: var(--surface-2, var(--line)); border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 4px; }
.mb-seg button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.mb-seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.mb-card { border-radius: 20px; padding: 18px 20px; color: #fff; background: linear-gradient(135deg, #0f4c5c 0%, #16335e 60%, #3b2a63 100%); box-shadow: 0 10px 30px rgba(15,76,92,.25); position: relative; overflow: hidden; }
.mb-card::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; border: 18px solid rgba(255,255,255,.07); }
.mb-card-top { display: flex; justify-content: space-between; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.mb-card-top b { letter-spacing: .06em; font-size: 1rem; }
.mb-name { font-size: 1.15rem; font-weight: 600; margin: 6px 0 10px; }
.mb-pts { display: flex; align-items: baseline; gap: 8px; }
.mb-pts b { font-size: 3rem; line-height: 1; color: #ffd66b; }
.mb-sub { margin-top: 6px; font-size: .88rem; opacity: .9; }
.mb-exp { margin-top: 8px; display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; background: rgba(255,255,255,.14); padding: 4px 10px; border-radius: 99px; }
.mb-pending { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px 12px; }
.mb-pending p { margin: 4px 0; font-size: .88rem; opacity: .92; }
.mb-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mb-row:last-child { border-bottom: 0; }
.mb-row3 > span:first-child, .mb-row-h > span:first-child { flex: 1; }
.mb-row3 b, .mb-row-h span + span { width: 72px; text-align: right; }
.mb-row-h { font-size: .75rem; color: var(--muted); padding: 4px 0; }
.mb-pg { margin-top: 10px; }
.mb-pg-h { font-weight: 700; color: var(--primary); padding: 6px 0 2px; border-bottom: 2px solid var(--primary-soft); }
.mb-pg-h small { color: var(--muted); font-weight: 500; }
.mb-promo img { width: calc(100% + 32px); margin: -16px -16px 10px; aspect-ratio: 16/9; object-fit: cover; display: block; }
.mb-promo h3 { margin: 0 0 4px; }
.t-ok { color: var(--ok); }

/* ---------- หน้าสรุป (รายงาน) ---------- */
:root { --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948; --s-other: #9aa3ad; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #5f6b72; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --s-other: #5f6b72; }
.rp-tools input[type=month], .rp-tools input[type=number] { width: auto; }
.rp-tools .tabs { margin: 0; }
.rp-tools { flex-wrap: wrap; }
.rp-h { font-size: 1.15rem; margin: 4px 2px 12px; }
.rp-scroll { overflow-x: auto; }
.rp-t { width: 100%; border-collapse: collapse; font-size: .9rem; }
.rp-t th { text-align: left; font-size: .75rem; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rp-t td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.rp-t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rp-barh { width: 140px; }
.rp-t td:last-child { white-space: nowrap; }
.rp-bar { display: inline-block; width: 70px; height: 6px; background: var(--surface-2); border-radius: 4px; vertical-align: middle; overflow: hidden; }
.rp-bar > span { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.rp-pct { margin-left: 6px; color: var(--muted); font-size: .75rem; }
.rp-click { cursor: pointer; }
.rp-click:hover, .rp-click.on { background: var(--primary-soft); }
.rp-type { cursor: pointer; background: var(--surface-2); }
.rp-type .rp-caret svg { transition: transform .15s; vertical-align: -2px; margin-right: 4px; }
.rp-type.closed .rp-caret svg { transform: rotate(-90deg); }
.rp-color td:first-child { padding-left: 30px; }
.rp-color.hide { display: none; }
.rp-sale summary { cursor: pointer; padding: 2px 0 8px; }
.cz-wrap { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; justify-content: center; }
.cz-donut { position: relative; width: min(280px, 80vw); flex: none; }
.cz-donut svg { width: 100%; height: auto; display: block; }
.cz-donut path { stroke: var(--surface); stroke-width: 2; transition: opacity .15s; cursor: pointer; }
.cz-donut path.dim, .cz-legend li.dim { opacity: .3; }
.cz-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.cz-center b { font-size: 1.1rem; }
.cz-center small { color: var(--muted); }
.cz-tip { position: absolute; z-index: 3; background: var(--text); color: var(--surface); padding: 5px 9px; border-radius: 8px; font-size: .8rem; white-space: nowrap; pointer-events: none; }
.cz-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 240px; }
.cz-legend li { display: flex; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); transition: opacity .15s; }
.cz-legend small { width: 52px; text-align: right; color: var(--muted); }
.cz-sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; vertical-align: -1px; }
.cz-mt td, .cz-mt th { font-size: .8rem; }
/* แถบเมนูหน้าสรุป */
.sum-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sum-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: .88rem; }
.sum-nav a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tc-rank { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 50%; background: var(--surface-2); font-size: .8rem; }
.tc-rank.r1 { background: #f5c542; color: #3d2c00; } .tc-rank.r2 { background: #cfd6de; color: #26303a; } .tc-rank.r3 { background: #e0a878; color: #3a2210; }
.tc-barh { width: 150px; }
.tc-bar { width: 90px; }
.pf-bars { width: 140px; display: flex; flex-direction: column; gap: 2px; }
.pf-bars span { display: block; height: 6px; border-radius: 3px; min-width: 0; }
.k-in { background: var(--s1); } .k-cost { background: var(--s2); }
.pf-key { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pf-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.pf-barh { width: 150px; }

/* ลูกค้า: ยอดซื้อรายเดือน / รายปี */
.rp-t tr.on td { background: var(--primary-soft); font-weight: 600; }
.cb-t .cb-barh { width: 34%; }
.cb-t tr.muted td { color: var(--muted); }
.cb-t tfoot th { color: var(--text); border-top: 2px solid var(--line); border-bottom: 0; }
.cb-t .rp-bar { width: 100%; max-width: none; }

/* CRM */
.crm-h { margin: 14px 0 4px; font-size: .9rem; }
.crm-h:first-of-type { margin-top: 4px; }
.crm-k .body .small { margin: 2px 0; }
.crm-due .item { background: var(--accent-soft); border-radius: 10px; }
.fu-chips { margin-top: -4px; }
.fu-chips .chip { padding: 3px 10px; font-size: .8rem; }
.ck-thumbs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ck-thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.ck-ph { position: relative; display: inline-block; }
.ck-ph img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.ck-ph .icon-btn { position: absolute; top: -6px; right: -6px; background: var(--surface); border: 1px solid var(--line); width: 24px; height: 24px; }
.tier-vip { font-weight: 700; }
.crm-t td { vertical-align: middle; }

/* รูปโปรไฟล์ */
.av-edit { position: relative; flex: none; }
.av-edit .avatar { width: 100% !important; height: 100% !important; }
.av-edit .av-btn { position: absolute; right: -4px; bottom: -4px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; cursor: pointer; border: 2px solid var(--surface); }
.av-edit .av-del { position: absolute; right: -4px; top: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); color: var(--muted); border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; padding: 0; }
.av-edit.loading { opacity: .5; pointer-events: none; }
img.avatar { object-fit: cover; }

/* ตารางสิทธิ์ */
.pm-t td.c, .pm-t th.c { text-align: center; width: 84px; }
.pm-t input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; }
.pm-t .pm-g td { background: var(--surface-2); font-weight: 700; font-size: .8rem; color: var(--muted); }
.pm-t .pm-own { color: var(--ok); font-weight: 700; }
.pm-t .pm-lock { color: var(--muted); opacity: .6; }
.pm-t td svg { vertical-align: -2px; margin-right: 4px; color: var(--muted); }
.chip.sm { padding: 3px 9px; font-size: .78rem; cursor: default; }
.ra-chips { margin-top: 4px; }
.role-access { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }

/* ค้นหา */
.srch-box { display: flex; gap: 8px; align-items: center; }
.srch-box input { flex: 1; font-size: 1.05rem; }
.srch-res { margin-top: 10px; max-height: 60vh; overflow: auto; }
.srch-g { font-size: .78rem; font-weight: 700; color: var(--muted); margin: 12px 0 4px; }
.srch-it { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: inherit; }
.srch-it:hover, .srch-it.on { background: var(--primary-soft); }
.srch-it .ic { color: var(--muted); flex: none; }
.srch-it small { display: block; color: var(--muted); }
.srch-it mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 1px; }

/* แนบไฟล์ */
.files-btn { width: 100%; justify-content: center; }
.files-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.files-list:empty { display: none; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 6px 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: inherit; font-size: .85rem; }
.file-chip .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-chip small { color: var(--muted); }
.file-chip .icon-btn { width: 24px; height: 24px; min-height: 0; }
a.file-chip { padding-right: 10px; text-decoration: none; }

/* ฟอร์มในหน้าต่างไม่ล้นจอมือถือ (iPhone ช่องวันที่กว้างเกิน) */
.form-grid > * { min-width: 0; }
input, select, textarea { min-width: 0; max-width: 100%; }
input[type=date], input[type=time], input[type=month], input[type=datetime-local] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
input::-webkit-date-and-time-value { text-align: left; }
.modal { max-width: min(560px, 100vw); overflow-x: hidden; }
.modal.wide { max-width: min(860px, 100vw); }
.modal-body { overflow-x: hidden; }

/* รูป Routine work */
.wp-short { margin-bottom: 12px; }
.wp-cam { position: relative; margin-top: 8px; }
.wp-geo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wp-prev { width: 100%; border-radius: 12px; margin-top: 8px; }
.wp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.wp-it { padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); text-align: left; cursor: pointer; color: inherit; font: inherit; }
.wp-it img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.wp-it span { display: block; padding: 6px 8px; font-size: .82rem; }

/* ทีมเซล */
.card-sub { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); }

/* สต๊อก: โซน / นับปลา / ควรจัดการ */
.zone-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.zone { text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.zone:hover { border-color: var(--primary-2); }
.zone-n { font-size: 1.35rem; font-weight: 700; }
.zone-n small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.cont.overc { border-color: var(--bad); }
.qlot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.qlot-act { display: flex; gap: 6px; align-items: flex-end; flex-wrap: wrap; }
.qlot .qn { display: flex; flex-direction: column; font-size: .75rem; color: var(--muted); }
.qlot .qn input { width: 96px; min-height: 36px; padding: 6px 8px; text-align: right; }
.todo-card { border-left: 4px solid var(--warn); }
.todo-row { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .92rem; }
.todo-row:last-child { border-bottom: 0; }
.more-f { margin-top: 10px; }
.more-f summary { cursor: pointer; color: var(--primary); font-size: .9rem; padding: 6px 0; }
.st-t td a { color: inherit; font-weight: 600; }
.cz-count td input { min-height: 34px; padding: 4px 8px; }

/* สีประจำฟาร์ม */
.farm-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: var(--fc); background: color-mix(in srgb, var(--fc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--fc) 35%, transparent); white-space: nowrap; }
.farm-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--fc); flex: none; }
.tabs.farm-tabs .tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tabs.farm-tabs .tab i.fdot { width: 10px; height: 10px; border-radius: 50%; background: var(--fc); flex: none; }
.tabs.farm-tabs .tab.on { background: var(--fc); color: #fff; }
.tabs.farm-tabs .tab.on i.fdot { background: #fff; }
.farm-sheet { border-top: 4px solid var(--fc); border-radius: 12px; }
.item.fc-row { border-left: 4px solid var(--fc); padding-left: 10px; }
.item.fc-row .avatar { background: color-mix(in srgb, var(--fc) 15%, transparent); color: var(--fc); }
.btn.fc-btn { background: var(--fc); border-color: var(--fc); color: #fff; }
.fin-card.fc { border-top: 4px solid var(--fc); }
.fin-card.fc > b { color: var(--fc); }
.th-farm { color: var(--fc); white-space: nowrap; }
.th-farm::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--fc); margin-right: 5px; vertical-align: middle; }
.stat.fc { border-top: 4px solid var(--fc); }
.fc-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.fc-pick label { position: relative; cursor: pointer; }
.fc-pick input { position: absolute; opacity: 0; pointer-events: none; }
.fc-pick span { display: block; width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.fc-pick input:checked + span { border-color: var(--surface); box-shadow: 0 0 0 3px var(--c); }
.fc-pick input:focus-visible + span { outline: 2px solid var(--text); }
.farm-radios { display: flex; flex-wrap: wrap; gap: 8px; }
.farm-radios label { position: relative; cursor: pointer; }
.farm-radios input { position: absolute; opacity: 0; pointer-events: none; }
.farm-radios span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--fc) 40%, transparent); color: var(--fc); font-weight: 600; background: var(--surface); }
.farm-radios span i { width: 11px; height: 11px; border-radius: 50%; background: var(--fc); }
.farm-radios input:checked + span { background: var(--fc); border-color: var(--fc); color: #fff; }
.farm-radios input:checked + span i { background: #fff; }
.farm-radios input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 2px; }
.photo-box { display: flex; flex-direction: column; gap: 6px; }
.photo-box > .lbl { font-size: .86rem; color: var(--muted); }
.photo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.photo-btns .photo-in { flex: 1 1 140px; justify-content: center; color: var(--text); background: var(--surface); }
.photo-preview:empty { display: none; }
.photo-preview { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.photo-preview img { margin-top: 2px; }
/* iPhone ซูมหน้าจอเองเมื่อแตะช่องที่ตัวอักษรเล็กกว่า 16px → ทำให้หน้าเลยขอบจอ */
@media (pointer: coarse), (max-width: 700px) { input, select, textarea { font-size: 16px; } }
/* บันทึกงาน: รายการงานที่ทำเสร็จวันนี้ */
.wl-done { display: flex; flex-direction: column; }
.wl-done-it { display: flex; align-items: center; gap: 10px; padding: 10px 4px 10px 10px; border-bottom: 1px solid var(--line); border-left: 4px solid var(--fc); }
.wl-done-it:last-child { border-bottom: 0; }
.wl-done-it .body { flex: 1; min-width: 0; }
.wl-done-it .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .82rem; color: var(--muted); margin-top: 2px; align-items: center; }
.wl-tick { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ok, #16a34a) 15%, transparent); color: var(--ok, #16a34a); flex: none; }
.wl-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.wl-quick .chip { padding: 5px 10px; font-size: .82rem; }
.btn.danger-t { color: var(--bad); }
/* เงินสำรอง: วงเงินประจำ */
.cash-row { cursor: pointer; align-items: center; }
.cash-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.cash-bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; max-width: 220px; }
.cash-bar i { display: block; height: 100%; background: var(--ok, #16a34a); border-radius: 999px; }
.float-list { display: flex; flex-direction: column; gap: 6px; }
.float-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.float-row input { width: 120px; flex: none; text-align: right; }

/* ---------- วิธีใช้แอป ---------- */
.g-card .card-head h3 { font-size: 1.05rem; }
.g-step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.g-step:first-of-type { border-top: 0; }
.g-n { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.g-body { flex: 1; min-width: 0; }
.g-body p { margin: 4px 0 8px; line-height: 1.6; }
.g-list { margin: 4px 0 8px; padding-left: 18px; line-height: 1.7; }
.g-list .ic { vertical-align: -3px; }
.g-img { margin: 6px 0 10px; display: inline-block; max-width: min(100%, 300px); vertical-align: top; margin-right: 8px; }
.g-img img { width: 100%; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.08); cursor: zoom-in; display: block; }
.g-img figcaption { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 4px; }
.g-tip { margin: 10px 0 0; }
.help-link { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; }
.help-row { text-align: right; margin: -6px 0 6px; }
.row-hol td:first-child { border-left: 3px solid var(--accent); }
.row-leave td { background: var(--surface-2); }
.img-zoom { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.88); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.img-zoom img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.img-zoom .icon-btn { position: absolute; top: 14px; right: 14px; color: #fff; background: rgba(255,255,255,.15); }
.wl-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; flex: none; }
.wl-view .wl-line .wl-thumb { grid-column: 1 / -1; width: 72px; height: 72px; }
@media (min-width: 720px) { .wl-view .wl-line .wl-thumb { grid-column: auto; } }
.wl-row[data-photo]:not([data-photo=""]) .wl-task { background: linear-gradient(90deg, transparent 0 calc(100% - 26px), var(--primary-soft) calc(100% - 26px)); }
.wl-running { border: 2px solid var(--fc, var(--primary)); background: var(--primary-soft); }
.wl-live { width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center; background: var(--surface); color: var(--primary); flex: none; animation: wlpulse 1.6s ease-in-out infinite; }
@keyframes wlpulse { 50% { opacity: .45; } }
.wl-done-it.is-running { background: var(--primary-soft); }
.btn.danger-ghost { color: var(--bad); border-color: transparent; background: transparent; padding: 4px 8px; margin-left: 4px; }
.btn.danger-ghost:hover { background: var(--bad-soft, #fdecec); }
.pay-day { border-top: 1px solid var(--line); padding: 8px 0; }
.pay-day summary { cursor: pointer; padding: 4px 0; }
tr.row-sel td { background: var(--primary-soft); }
tr.clickable { cursor: pointer; }
.pay-sum td:first-child, .pay-sum th:first-child { min-width: 140px; }
.pay-day td:first-child { min-width: 90px; }

/* v0.29 OT เช้า/เย็น */
.ot-segs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; text-align: left; }
.ot-seg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: .9rem; }
.ot-seg.running { background: var(--primary-soft); }
.ot-segs-list { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.ok-t { color: var(--ok, #1a8a4a); }
.clock-btn.ot { background: radial-gradient(circle at 30% 30%, #b98cf0, #7a4fd1); box-shadow: 0 10px 30px rgba(122, 79, 209, .3); }

/* ---------- พ่อแม่พันธุ์ (0.30.0) ---------- */
:root { --male: #2f6fb3; --male-soft: #e5eef9; --female: #c2417a; --female-soft: #fbe7f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --male: #7fb1ea; --male-soft: #182a3f; --female: #f08ab6; --female-soft: #3a1b2a; } }
:root[data-theme="dark"] { --male: #7fb1ea; --male-soft: #182a3f; --female: #f08ab6; --female-soft: #3a1b2a; }
/* ชุด 1–7: ตัดขึ้นบรรทัดใหม่ (มือถือ 4+3) เห็นครบทุกชุด ไม่ต้องเลื่อน */
.bs-sets { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; padding-bottom: 6px; margin-bottom: 4px; }
.bs-set { border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  border-radius: 12px; padding: 8px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bs-set small { font-weight: 400; color: var(--muted); font-size: .72rem; font-variant-numeric: tabular-nums; }
.bs-set.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.bs-set.on small { color: #fff; opacity: .85; }
.bs-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 10px; }
.bs-sum h2 { font-size: 1.15rem; margin: 0 auto 0 0; }
.bs-pill { border-radius: 999px; padding: 3px 10px; font-size: .82rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bs-pill.m { background: var(--male-soft); color: var(--male); }
.bs-pill.f { background: var(--female-soft); color: var(--female); }
.bs-pill.d { background: var(--bad-soft); color: var(--bad); }
.bs-list { display: grid; gap: 10px; }
.bs-row { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); display: grid; gap: 10px; grid-template-columns: 1fr; }
.bs-kind { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bs-kind .t { font-size: .8rem; font-weight: 700; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary); padding: 2px 8px; border-radius: 6px; flex: 0 0 auto; }
.bs-kind .c { font-weight: 600; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bs-kind .icon-btn { width: 34px; height: 34px; flex: 0 0 auto; color: var(--muted); }
.bs-note { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.bs-lbl { font-size: .72rem; color: var(--muted); }
.bs-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bs-dates label { display: grid; gap: 2px; min-width: 0; }
.bs-date { position: relative; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 4px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: .85rem; text-align: center; }
.bs-date.has { border: 1px solid var(--ok); background: var(--ok-soft); color: var(--text); font-weight: 600; }
.bs-date input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; margin: 0; border: 0; opacity: 0; cursor: pointer; }
.bs-date:focus-within { box-shadow: 0 0 0 3px var(--primary-soft); }
.bs-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bs-cnt { display: flex; align-items: center; justify-content: space-between; gap: 4px; border-radius: 10px; padding: 4px; }
.bs-cnt.m { background: var(--male-soft); } .bs-cnt.f { background: var(--female-soft); }
.bs-cnt .n { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; line-height: 1.1; }
.bs-cnt.m .n { color: var(--male); } .bs-cnt.f .n { color: var(--female); }
.bs-cnt .n small { display: block; font-size: .68rem; font-weight: 500; }
.bs-cnt.pending .n { opacity: .6; }
.bs-step { width: 40px; height: 40px; border-radius: 9px; border: 0; background: var(--surface); color: var(--text); font: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer; }
.bs-step:disabled { opacity: .35; cursor: default; }
.bs-last { font-size: .75rem; color: var(--muted); }
.bs-last.dead { color: var(--bad); }
.bs-log .meta b { color: var(--text); }
.bs-d-m { color: var(--male); font-weight: 600; } .bs-d-f { color: var(--female); font-weight: 600; }
.bs-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.bs-table th, .bs-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.bs-table th:first-child, .bs-table td:first-child { text-align: left; }
.bs-table th { font-weight: 600; color: var(--muted); font-size: .8rem; }
@media (min-width: 760px) {
  .bs-row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(270px, 1.3fr); align-items: center; }
  .bs-row .bs-last { grid-column: 1 / -1; }
}
.bs-g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; } .bs-g2 > * { min-width: 0; }
.bs-cnt .n small { white-space: nowrap; }

/* วัสดุอุปกรณ์ + ปลากรอกกลับ (0.31.0) */
.t-warn { color: var(--warn); }
.fr-del { opacity: .55; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.sp-card { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--fc); border-radius: 14px; overflow: hidden; }
.sp-card[hidden] { display: none; }
.sp-cover { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.sp-cover img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.sp-info { padding: 10px 12px 4px; display: grid; gap: 4px; flex: 1; align-content: start; }
.sp-name { font-weight: 600; line-height: 1.3; }
.sp-qty { font-size: .9rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sp-qty b { font-size: 1.15rem; }
.sp-meta { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.sp-act { display: flex; gap: 6px; padding: 6px 12px 0; }
.sp-act .btn { flex: 1; justify-content: center; }
.sp-side { display: flex; align-items: center; padding: 2px 6px 6px 12px; }
@media (max-width: 640px) {
  .sp-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sp-info { padding: 8px 10px 2px; }
  .sp-act { padding: 6px 10px 0; flex-wrap: wrap; }
  .sp-act .btn { padding-left: 6px; padding-right: 6px; }
}

/* บัญชีรายจ่าย: แถบรวมตามฟาร์ม */
.farm-bar { padding: 6px 0; font-size: .88rem; }
.farm-bar .fb-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.farm-bar .fdot { width: 10px; height: 10px; border-radius: 50%; background: var(--fc); flex: none; }
.farm-bar .bar { display: block; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.farm-bar .bar i { display: block; height: 100%; background: var(--fc); border-radius: 999px; }

/* คู่มือ: หน้ารวมหัวข้อ + หน้าหัวข้อ */
.g-hero { margin-bottom: 14px; }
.g-sec { margin-bottom: 16px; }
.g-sec-h { font-size: .95rem; color: var(--muted); margin: 0 0 8px 2px; }
.g-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.g-topic { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: inherit; text-decoration: none; }
.g-topic:hover { border-color: var(--primary); }
.g-topic-ic { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); }
.g-topic-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.g-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.g-title { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; font-size: 1.25rem; }
.g-pager { display: flex; justify-content: space-between; gap: 8px; margin: 16px 0 8px; flex-wrap: wrap; }
.g-pager .btn { max-width: 100%; white-space: normal; text-align: left; }
.g-for { display: inline-flex; align-items: center; gap: 3px; font-size: .74rem; font-weight: 600; color: var(--accent, #7c3aed); background: var(--surface-2); border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: 2px; }

/* เงินสำรอง (cash.js): รายการรอกดรับเงิน → ปุ่ม "ไม่ได้รับ / ได้รับแล้ว" ขึ้นบรรทัดใหม่ ข้อความไม่ถูกบีบ (g4-1) */
.item.cash-pending { flex-wrap: wrap; }

/* ภารกิจ (taskkit): ช่องติ๊กของงานคนอื่น กดไม่ได้ → สีจาง */
.task .tick:disabled { opacity: .4; cursor: not-allowed; }
.task .tick:disabled:hover { border-color: var(--line); }

/* พนักงาน & สิทธิ์ (employees.js): ตารางสิทธิ์บนมือถือ → ชื่อเมนูไม่ถูกบีบ ทุกคอลัมน์อยู่ในจอ · ชื่อเมนูค้างไว้ถ้าต้องเลื่อนซ้าย-ขวา (g5-10) */
.pm-t td:first-child { min-width: 128px; }
.pm-t tr:not(.pm-g) > td:first-child, .pm-t th:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); }
@media (max-width: 640px) {
  .pm-t td.c, .pm-t th.c { width: auto; padding: 4px 2px; }
  .pm-t th.c { white-space: normal; font-size: .7rem; line-height: 1.2; }
}

/* ใบเสนอราคา / บิล (billing.js) + ฐานข้อมูลลูกค้า (customers.js) + การติดต่อ/เคลม (lib/crm.js): ป้าย/ยอด/ปุ่มท้ายแถว รวมเป็นกลุ่มเดียว
   มือถือ → ขึ้นบรรทัดใหม่ชิดขวา ชื่อลูกค้าไม่ถูกบีบ ป้ายไม่ล้นการ์ด ปุ่ม "ลบ" กดได้ (g6-3, g6-4) */
.item-tail { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px 10px; flex-shrink: 0; }
.item-tail .btn.danger-ghost { margin-left: 0; }
@media (max-width: 640px) {
  .item:has(> .item-tail) { flex-wrap: wrap; row-gap: 6px; }
  .item > .item-tail { flex: 1 1 100%; gap: 6px; }
}
/* ดูแลลูกค้า (crm.js) แท็บเกินรอบซื้อ: ชื่อลูกค้าไม่ถูกบีบเป็นคำละบรรทัด · ข้อความ "ยังไม่มีรอบ (…)" ตัดบรรทัดได้ (g6-9) */
.crm-t td:first-child { min-width: 9.5em; }
.crm-t .crm-nc { display: inline-block; min-width: 10.5em; white-space: normal; }
.crm-t td:nth-child(7) { white-space: nowrap; }
.crm-t td:nth-child(8) { min-width: 12em; }
/* บันทึกงานประจำวัน (worklog.js) แท็บวันนี้: ชื่อฟาร์มยาว + มีรูป ป้ายฟาร์มไม่ล้นไปทับปุ่มแก้/ลบ (g5-review) */
.wl-done-it .meta .farm-chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* แบบประเมิน DISC (v0.33.0) */
.disc-hero { border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.disc-big { font-size: 2.6rem; line-height: 1.05; font-weight: 700; }
.disc-bars { display: flex; flex-direction: column; gap: 8px; }
.disc-bar { display: grid; grid-template-columns: 112px 1fr 28px; gap: 10px; align-items: center; font-size: .92rem; }
.disc-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.disc-track { display: block; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.disc-track i { display: block; height: 100%; border-radius: 99px; transition: width .2s; }
.disc-detail { display: flex; flex-direction: column; gap: 6px; }
.disc-detail h4 { margin: 0; font-size: 1.08rem; }
.disc-detail p { margin: 0; }
.disc-ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 2px; }
.disc-hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.disc-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.disc-chip { border: 0; border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; text-align: left; font: inherit; color: var(--text); }
button.disc-chip { cursor: pointer; outline: 2px solid transparent; }
button.disc-chip.on { outline-color: var(--primary); }
.disc-quiz { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.disc-prog { display: flex; flex-direction: column; gap: 6px; }
.disc-q { margin: 0; font-size: 1.2rem; line-height: 1.4; }
.disc-opts { display: flex; flex-direction: column; gap: 10px; }
.disc-opt { font: inherit; font-size: 1rem; text-align: left; background: var(--surface); color: var(--text); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; min-height: 52px; }
.disc-opt:hover { border-color: var(--primary-2); }
.disc-opt.on { border-color: var(--primary); background: var(--primary-soft); }
.disc-dot { flex: none; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); margin-top: 2px; }
.disc-opt.on .disc-dot { border-color: var(--primary); background: var(--primary); box-shadow: inset 0 0 0 3px var(--surface); }
@media (prefers-reduced-motion: reduce) { .disc-track i { transition: none; } }

/* ---------- เงินเดือนคนงาน (035_farm_workers) ---------- */
.fw-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); margin-bottom: 12px; }
.fw-grid > .fw-card { border-top: 4px solid var(--fc, var(--line)); margin: 0; }
.fw-net { font-size: 1.25rem; }
.fw-lines { display: flex; flex-direction: column; margin-bottom: 8px; }
.fw-line { display: grid; grid-template-columns: 1fr auto 40px; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fw-line:last-child { border-bottom: 0; }
.fw-l { display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: center; min-width: 0; }
.fw-l .tiny { flex-basis: 100%; }
@media (max-width: 420px) { .fw-grid { grid-template-columns: 1fr; } }
/* บัญชีรายจ่าย (2026-10-14): สีตามหมวด + กราฟวงกลมมีป้ายรอบวง */
.exp-wait { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.exp-wait svg { color: var(--warn); }
.exp-cats { background: linear-gradient(160deg, color-mix(in srgb, #7c5cff 7%, var(--surface)), color-mix(in srgb, #1baf7a 7%, var(--surface))); }
.ep-pie { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; overflow: visible; }
.ep-slice { stroke: var(--surface); stroke-width: 2; }
.ep-line { fill: none; stroke-width: 1.2; opacity: .8; }
.ep-name { font-size: 12px; font-weight: 700; }
.ep-val { font-size: 11.5px; fill: var(--text); font-variant-numeric: tabular-nums; }
.ep-tot { font-size: 15px; font-weight: 700; fill: var(--text); }
.ep-sub { font-size: 9.5px; fill: var(--muted); }
.exp-av { width: 40px; height: 40px; background: color-mix(in srgb, var(--cc) 18%, var(--surface)) !important; color: var(--cc) !important; }
.exp-cat { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-weight: 600; color: var(--cc); background: color-mix(in srgb, var(--cc) 12%, transparent); }
.exp-cat::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--cc); }
.exp-day { background: color-mix(in srgb, var(--primary) 8%, var(--surface)); border-radius: 8px; padding: 6px 10px !important; border-bottom: 0 !important; }
/* สรุปรายรับ-รายจ่าย (2026-10-15): หยินหยาง รายรับเขียว / รายจ่ายแดง */
:root { --yy-in: #16a34a; --yy-ex: #dc2626; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --yy-in: #22c55e; --yy-ex: #ef4444; } }
:root[data-theme="dark"] { --yy-in: #22c55e; --yy-ex: #ef4444; }
.yy-card { background: linear-gradient(135deg, color-mix(in srgb, var(--yy-in) 8%, var(--surface)), var(--surface) 50%, color-mix(in srgb, var(--yy-ex) 8%, var(--surface))); }
.yy-wrap { display: flex; gap: 22px; align-items: center; justify-content: center; flex-wrap: wrap; }
.yy { width: min(220px, 62vw); height: auto; flex: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.12)); }
.yy .yy-in { fill: var(--yy-in); } .yy .yy-ex { fill: var(--yy-ex); }
.yy .yy-ring { fill: none; stroke: var(--surface); stroke-width: 3; }
.yy .yy-empty { fill: var(--surface-2); stroke: var(--line); stroke-dasharray: 6 5; }
.yy-side { display: flex; flex-direction: column; gap: 10px; min-width: 200px; flex: 1; max-width: 320px; }
.yy-big { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 12px; border-left: 6px solid; background: var(--surface); }
.yy-big span { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; font-size: .9rem; }
.yy-big b { font-size: 1.5rem; line-height: 1.25; }
.yy-big small { color: var(--muted); font-size: .78rem; }
.yy-big.in { border-color: var(--yy-in); } .yy-big.in span, .yy-big.in b { color: var(--yy-in); }
.yy-big.ex { border-color: var(--yy-ex); } .yy-big.ex span, .yy-big.ex b { color: var(--yy-ex); }
.yy-profit { margin-top: 16px; padding: 12px 16px; border-radius: 14px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; background: color-mix(in srgb, var(--yy-in) 14%, var(--surface)); }
.yy-profit span { font-weight: 600; } .yy-profit b { font-size: 1.7rem; color: var(--yy-in); margin-left: auto; } .yy-profit small { width: 100%; text-align: right; color: var(--muted); }
.yy-profit.loss { background: color-mix(in srgb, var(--yy-ex) 14%, var(--surface)); } .yy-profit.loss b { color: var(--yy-ex); }
.yy-cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 12px; }
.yy-cols > .card { margin: 0; }
.yy-src { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.yy-src:last-child { border-bottom: 0; }
.yy-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.yy-src.in .yy-ic { background: color-mix(in srgb, var(--yy-in) 15%, transparent); color: var(--yy-in); }
.yy-src.ex .yy-ic { background: color-mix(in srgb, var(--yy-ex) 15%, transparent); color: var(--yy-ex); }
.yy-sl { display: flex; justify-content: space-between; gap: 8px; }
.yy-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 4px 0 2px; }
.yy-bar i { display: block; height: 100%; border-radius: 99px; }
.yy-src.in .yy-bar i { background: var(--yy-in); } .yy-src.ex .yy-bar i { background: var(--yy-ex); }
.yy-farms { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.yy-farm { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); border-top: 4px solid var(--fc); background: var(--surface); font-size: .85rem; }
.yy-farm b { color: var(--fc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yy-farm .yy-fp { font-weight: 700; font-size: 1rem; border-top: 1px dashed var(--line); padding-top: 3px; }
.yy .yy-lt, .yy .yy-lp { fill: #fff; text-anchor: middle; font-weight: 700; paint-order: stroke; stroke: rgba(0,0,0,.18); stroke-width: 2px; }
.yy .yy-lt { font-size: 13px; } .yy .yy-lp { font-size: 15px; }
.yy-cols + .card { margin-top: 12px; }
/* สำรองขึ้น OneDrive (2026-10-15) */
.bk-cloud { background: linear-gradient(160deg, color-mix(in srgb, #0078d4 9%, var(--surface)), var(--surface)); border-top: 4px solid #0078d4; }
.bk-cloud.ok { border-top-color: var(--ok); background: linear-gradient(160deg, color-mix(in srgb, var(--ok) 9%, var(--surface)), var(--surface)); }
.bk-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--ok); color: #fff; }
.bk-logo.off { background: #0078d4; }
.bk-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.bk-facts > div { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.bk-bar { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px; }
.bk-bar > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bk-how { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.bk-how summary { cursor: pointer; }
.bk-code { text-align: center; padding: 14px; border-radius: 12px; background: var(--surface); border: 2px dashed #0078d4; }
.bk-uc { font-size: 2rem; font-weight: 800; letter-spacing: .12em; margin: 10px 0; color: #0078d4; }
.bk-st { width: 34px; height: 34px; }
.bk-st.ok { background: color-mix(in srgb, var(--ok) 16%, var(--surface)) !important; color: var(--ok) !important; }
.bk-st.error { background: color-mix(in srgb, var(--bad) 14%, var(--surface)) !important; color: var(--bad) !important; }
.bk-st.running { background: color-mix(in srgb, var(--warn) 16%, var(--surface)) !important; color: var(--warn) !important; }
@media (max-width: 560px) { .bk-facts { grid-template-columns: 1fr 1fr; } .bk-facts > div:last-child { grid-column: 1 / -1; } }
.help-row [data-cloudbk] { margin-right: 8px; vertical-align: middle; }

/* PRICE LIST ตารางรวม (pricelist.js fishTable) — ผู้ใช้ขอ 2026-10-18 */
.t-ok { color: var(--ok); }
.plt-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plt-ref { display: flex; flex-direction: column; gap: 2px; flex: 1 1 200px; min-width: 0; }
.plt-ref select { width: 100%; }
.plt-card { padding-bottom: 6px; }
.plt th, .plt td { padding: 7px 6px; }
.plt td b { font-weight: 600; overflow-wrap: anywhere; }
.plt .plt-sw { width: 64px; text-align: center; }

.plt tr.plt-off td:not(.plt-sw) { color: var(--muted); }
.plt tr.plt-off td b { text-decoration: line-through; text-decoration-color: var(--bad); }
.sw { position: relative; display: inline-block; width: 44px; height: 26px; cursor: pointer; vertical-align: middle; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 99px; background: var(--bad); transition: background .15s; }
.sw span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.sw input:checked + span { background: var(--ok); }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:disabled { cursor: default; }
.sw input:disabled + span { opacity: .75; }
.sw input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (max-width: 640px) { .plt .plt-sw { width: 54px; } }
.plt-bar > input[type=search] { flex: 2 1 220px; width: auto; min-width: 0; }
.plt-bar > select { flex: 1 1 150px; width: auto; min-width: 0; }
.plt-bar > .btn { flex: 0 0 auto; align-self: flex-end; }
@media (max-width: 640px) { .plt-bar > input[type=search] { flex-basis: 100%; } }
.plt .plt-in { width: 84px; max-width: 100%; padding: 6px 8px; text-align: right; font-variant-numeric: tabular-nums; }
.plt .plt-del { width: 40px; text-align: center; padding-left: 0; padding-right: 0; }
@media (max-width: 640px) { .plt .plt-in { width: 64px; padding: 6px; } .plt th, .plt td { padding: 7px 4px; } }
/* PRICE LIST: เลขห้อยสีแดง = ราคาเดิมก่อนแก้ (30 วัน) */
.plt .plt-pc { position: relative; display: inline-block; }
.plt-was { color: var(--bad); font-size: 10.5px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.plt .plt-pc .plt-was { position: absolute; top: -7px; right: -3px; background: var(--surface); padding: 0 2px; border-radius: 4px; pointer-events: auto; }
/* คู่มือ SOP: รูปประกอบหลายรูป (ผู้ใช้ขอ 2026-10-19) */
.sop-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.sop-photos a img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; display: block; background: var(--surface-2, #eef2f3); }
@media (max-width: 560px) { .sop-photos { grid-template-columns: repeat(2, 1fr); } }
/* ขายหน้าฟาร์ม (POS) — ผู้ใช้ขอ 2026-10-20 */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.pos-main { min-width: 0; }
.pos-cart { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; }
.pos-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.pos-bar > input[type=search] { flex: 1 1 220px; min-width: 0; }
.pos-sel { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.pos-sel select, .pos-sel input { width: 100%; }
.pos-types { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.pos-item { border: 1px solid var(--line); border-radius: 12px; padding: 8px; display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.pos-item.off { opacity: .55; }
.pos-color { font-weight: 600; overflow-wrap: anywhere; line-height: 1.3; }
.pos-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.pos-add { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2, #f3f6f7); cursor: pointer; font: inherit; color: inherit; line-height: 1.25; }
.pos-add span { font-size: .78rem; color: var(--muted); }
.pos-add.m { border-color: #9cc3e6; } .pos-add.f { border-color: #ebb3cd; }
.pos-add.has { background: var(--primary); border-color: var(--primary); color: #fff; }
.pos-add.has span { color: rgba(255,255,255,.85); }
.pos-add:disabled { cursor: not-allowed; }
.pos-add:active:not(:disabled) { transform: scale(.97); }
.pos-n { position: absolute; top: -7px; right: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--bad); color: #fff; font-style: normal; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.pos-lines { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pos-line { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pos-line b { overflow-wrap: anywhere; }
.pos-qty { display: flex; align-items: center; gap: 2px; }
.pos-qty input { width: 46px; text-align: center; padding: 4px; }
.pos-qty .icon-btn { width: 30px; height: 30px; font-size: 1.1rem; font-weight: 700; }
.pos-amt { min-width: 52px; text-align: right; }
.pos-sum { display: flex; justify-content: space-between; align-items: baseline; margin: 6px 0 10px; font-size: 1.05rem; }
.pos-sum b { font-size: 1.4rem; }
.pos-dock { display: none; }
.pos-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pos-co-total, .pos-co-net { display: flex; justify-content: space-between; align-items: baseline; }
.pos-co-total b { font-size: 1.2rem; }
.pos-co-net { padding: 10px 12px; border-radius: 12px; background: var(--surface-2, #f3f6f7); }
.pos-co-net b { font-size: 1.7rem; color: var(--primary); }
.pos-co-change { text-align: right; font-size: 1.05rem; min-height: 1.4em; margin: 6px 2px 4px; }
.pos-co-change b { font-size: 1.3rem; }
.pos-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.pos-stats > div { display: flex; flex-direction: column; background: var(--surface-2, #f3f6f7); border-radius: 12px; padding: 10px; }
.pos-stats b { font-size: 1.25rem; }
.slip-wrap { background: var(--surface-2, #eef2f3); border-radius: 12px; padding: 12px; display: flex; justify-content: center; max-height: 55vh; overflow: auto; }
.slip-img { width: 240px; max-width: 100%; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff; image-rendering: auto; }
.slip-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.slip-acts .btn { flex: 1 1 160px; }
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos-cart { display: none; }
  .pos-dock { display: block; position: fixed; left: 12px; right: 12px; bottom: calc(var(--tab-h, 60px) + var(--safe-b, 0px) + 10px); z-index: 30; }
  .pos-dock-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--primary); color: #fff; font: inherit; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }
  .pos-dock-btn b { font-size: 1.15rem; }
  .pos-dock-go { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: .9rem; }
  .pos-main { padding-bottom: 90px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (min-width: 901px) { .pos-dock { display: none !important; } }
/* POS: ลูกค้า แต้ม บุคคลนำพา ตอนคิดเงิน */
.pos-sec { border: 1px solid var(--border, #e3e8ea); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.pos-sec-h { display: flex; align-items: center; gap: 6px; font-weight: 600; margin-bottom: 8px; flex-wrap: wrap; }
.pos-sec-h .small { font-weight: 400; }
.pos-cust-find { display: flex; gap: 8px; }
.pos-cust-find input { flex: 1; min-width: 0; }
.pos-cust-res { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.pos-cust-opt { display: flex; align-items: center; gap: 6px; text-align: left; padding: 8px 10px; border: 1px solid var(--border, #e3e8ea); border-radius: 10px; background: var(--surface, #fff); color: inherit; font: inherit; cursor: pointer; }
.pos-cust-opt:hover { border-color: var(--primary); }
.pos-cust-new { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border, #e3e8ea); }
.pos-cust-card { display: flex; align-items: center; gap: 8px; }
.pos-pts { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.pos-pts select { max-width: 100%; }
#gInfo:not(:empty) { margin-top: 6px; }
.slip-img.w80 { width: 330px; }
.slip-paper { align-items: center; margin-top: 10px; }

/* เงินเดือนรายวัน (ผู้ใช้ขอ 2026-10-21): ตารางรายวันกว้างขึ้น สลิปแยกยอดแต่ละวันแล้วรวมด้านล่าง */
.pay-split { grid-template-columns: minmax(0, 1fr); } /* ตารางเต็มความกว้าง สลิปอยู่ด้านล่าง */
.slip-col { max-width: 620px; margin: 0 auto; }
.pay-days td:nth-child(7) { min-width: 130px; }
.pay-days tfoot td { background: var(--surface-2); }
.pay-days tfoot .pay-sum td { font-weight: 600; border-top: 1px dashed var(--line); }
.pay-days tfoot .pay-sum.total td { font-size: 1.02rem; font-weight: 700; border-top: 2px solid var(--text); }
.pay-days .minus, .slip .line .minus { color: var(--bad); }
.slip-sec { margin: 12px 0 2px; font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.slip .line.day { padding: 5px 0; align-items: flex-start; }
.slip .line.day > span:first-child { display: flex; flex-direction: column; gap: 1px; padding-right: 10px; }
.slip .line.day small { color: var(--muted); font-size: .8em; line-height: 1.35; }
.slip .line.day-sum { font-weight: 700; border-bottom: 2px solid var(--line); }
/* เงินเดือนคนงาน (ผู้ใช้ขอ 2026-10-21): ปุ่มรายได้สีเขียวอ่อน ปุ่มหักสีส้มอ่อน · แถวปุ่มใต้การ์ด (ลงรายการ / พิมพ์สลิป) */
.choice.fw-inc span { background: #ecf8e8; border-color: #b9e2ae; color: #24622f; }
.choice.fw-inc input:checked + span { background: #cdeec3; border-color: #3e9c4c; box-shadow: 0 0 0 2px rgba(62, 156, 76, .18); }
.choice.fw-ded span { background: #fff3e6; border-color: #f6cc9c; color: #8a4a0c; }
.choice.fw-ded input:checked + span { background: #ffdfbc; border-color: #e8862a; box-shadow: 0 0 0 2px rgba(232, 134, 42, .2); }
.choice.fw-inc span small, .choice.fw-ded span small { color: inherit; opacity: .75; }
.choice.fw-inc span, .choice.fw-ded span { height: 100%; box-sizing: border-box; }
.choice.fw-inc input:not(:checked) + span, .choice.fw-ded input:not(:checked) + span { opacity: .72; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .choice.fw-inc span { background: #183022; border-color: #2c5e3c; color: #9fe0b0; }
  :root:not([data-theme="light"]) .choice.fw-inc input:checked + span { background: #21452e; border-color: #4cc58c; }
  :root:not([data-theme="light"]) .choice.fw-ded span { background: #33240f; border-color: #6e4a1e; color: #f5c48f; }
  :root:not([data-theme="light"]) .choice.fw-ded input:checked + span { background: #4a3214; border-color: #f0a050; }
}
:root[data-theme="dark"] .choice.fw-inc span { background: #183022; border-color: #2c5e3c; color: #9fe0b0; }
:root[data-theme="dark"] .choice.fw-inc input:checked + span { background: #21452e; border-color: #4cc58c; }
:root[data-theme="dark"] .choice.fw-ded span { background: #33240f; border-color: #6e4a1e; color: #f5c48f; }
:root[data-theme="dark"] .choice.fw-ded input:checked + span { background: #4a3214; border-color: #f0a050; }
.fw-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* ทุนต่อตัว (ผู้ใช้ขอ 2026-10-21): เลขใหญ่ตัวเดียว + กราฟแท่ง 12 เดือน */
.fc-hero { position: relative; overflow: hidden; text-align: center; padding: 28px 18px 24px; background: radial-gradient(120% 90% at 50% 0%, var(--primary-soft) 0%, var(--surface) 70%); }
.fc-fish { width: 72px; height: 72px; margin: 0 auto 10px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(15, 76, 92, .25); }
.fc-lbl { font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.fc-num { font-size: clamp(3rem, 12vw, 4.6rem); font-weight: 800; line-height: 1.05; margin: 6px 0 2px; color: var(--text); font-variant-numeric: tabular-nums; }
.fc-num small { font-size: .45em; font-weight: 700; color: var(--muted); margin-right: 4px; vertical-align: .55em; }
.fc-num.none { color: var(--muted); }
.fc-unit { color: var(--muted); font-size: 1rem; }
.fc-delta { display: inline-flex; align-items: center; gap: 4px; margin-top: 12px; padding: 5px 12px; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.fc-delta.good { background: var(--ok-soft); color: var(--ok); }
.fc-delta.bad { background: var(--bad-soft); color: var(--bad); }
.fc-delta.same { background: var(--surface-2); color: var(--muted); }
.fc-delta .up { display: inline-flex; transform: rotate(180deg); }
.fc-note { margin-top: 12px; font-size: .8rem; color: var(--warn); }
.fc-chart { width: 100%; height: auto; display: block; overflow: visible; }
.fc-base { stroke: var(--line); stroke-width: 1; }
.fc-bar { fill: var(--primary-2); opacity: .32; transition: opacity .15s; }
.fc-bar.sel { fill: var(--primary); opacity: 1; }
.fc-col { cursor: pointer; outline: none; }
.fc-col:hover .fc-bar:not(.sel):not(.part), .fc-col:focus-visible .fc-bar:not(.sel):not(.part) { opacity: .6; }
.fc-col:focus-visible .fc-mo { text-decoration: underline; }
.fc-hit { fill: transparent; }
.fc-nodata { fill: var(--line); }
/* เดือนนี้ (ยังไม่จบ) = แท่งเส้นประ · รอยหักบนแท่ง = สูงเกินขอบกราฟ ตัดไว้ (ผู้ใช้ขอ 2026-10-21) */
.fc-bar.part { opacity: 1; fill-opacity: .16; stroke: var(--primary); stroke-width: 1.5; stroke-dasharray: 4 3; }
.fc-bar.part.sel { fill-opacity: .5; }
.fc-col:hover .fc-bar.part:not(.sel), .fc-col:focus-visible .fc-bar.part:not(.sel) { fill-opacity: .3; }
.fc-break { fill: none; stroke: var(--surface); stroke-width: 3; stroke-linecap: round; }
.fc-val { font-size: 15px; font-weight: 700; fill: var(--text); text-anchor: middle; }
.fc-mo { font-size: 12px; fill: var(--muted); text-anchor: middle; }
.fc-mo.sel { fill: var(--text); font-weight: 700; }
.fc-hint { margin: 8px 0 0; }
.fc-chart.narrow .fc-mo { font-size: 11.5px; } .fc-chart.narrow .fc-val { font-size: 15px; }

/* ความรับผิดชอบ (v0.43.0 ผู้ใช้ขอ 2026-10-21) */
.resp-num { display: flex; flex-direction: column; align-items: flex-end; min-width: 4.2em; }
.resp-num b { font-size: 1.5rem; line-height: 1.1; }
.resp-num small { font-size: .72rem; font-weight: 600; }
.resp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.resp-big { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.resp-big small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.resp-rows { display: flex; flex-direction: column; gap: 8px; }
.resp-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.resp-row .resp-score { font-size: 1.3rem; font-weight: 700; text-align: right; min-width: 2.6em; }
.resp-row .resp-bar { grid-column: 1 / -1; margin-top: 4px; background: var(--surface); }
