/* 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) 1fr; }
  .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(3, 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); }

/* ---------- พิมพ์ ---------- */
@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; }
}
