/* ระบบสีและองค์ประกอบพื้นฐาน — ธีมเดโม: ขาว-น้ำเงิน ทันสมัย
   (ตัวแปรชุด --green คือ "สีหลัก" ของระบบ — เดโมนี้กำหนดเป็นน้ำเงิน) */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --ink: #15243b;
  --muted: #5a6a82;
  --line: #dde5f0;
  --line2: #b9c6da;
  --green: #1a5fd6;        /* สีหลัก (น้ำเงิน) */
  --green-soft: #e8f0fd;
  --green-ink: #12459f;
  --amber: #b07d10;
  --amber-soft: #fdf3dc;
  --amber-ink: #855e0b;
  --red: #c03a30;
  --red-soft: #fdecea;
  --red-ink: #97281f;
  --blue: #6d28d9;         /* ป้าย SAP (ม่วงคราม ให้ต่างจากสีหลัก) */
  --blue-soft: #f1ebfd;
  --blue-ink: #5b21b6;
  --chip: #eaf0f8;
  --success: #169c68;      /* จอเขียวยืนยันบันทึก */
  --shadow: 0 1px 2px rgba(21, 36, 59, .05), 0 4px 14px rgba(21, 36, 59, .05);
  --mono: "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Noto Sans Thai", -apple-system, "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a { color: var(--green-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 80px; }
.container-wide { max-width: 1280px; }

/* แถบหัว 2 ชั้น — ชั้นบน = 3 มุมมองหลัก (น้ำเงินเด่น) · ชั้นล่าง = เมนูย่อยของมุมมองนั้น (จางกว่า) */
.topbar2 { position: sticky; top: 0; z-index: 30; }

.topbar-main {
  background: linear-gradient(90deg, #103680 0%, #1a5fd6 100%);
  padding: 11px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar-main .brand { font-weight: 700; color: #fff; font-size: 16px; }
.topbar-main .brand:hover { text-decoration: none; }
.topbar-main .brand-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; background: rgba(255,255,255,.22); color: #fff; border-radius: 5px; padding: 1px 6px; vertical-align: 2px; }
.topbar-main .spacer { flex: 1; }
.topbar-main .views { display: flex; gap: 5px; flex-wrap: wrap; background: rgba(255,255,255,.13); border-radius: 999px; padding: 4px; }
.topbar-main .views a { font-size: 14.5px; font-weight: 600; padding: 7px 18px; border-radius: 999px; color: #d7e4fb; white-space: nowrap; transition: background .12s, color .12s; }
.topbar-main .views a:hover { text-decoration: none; color: #fff; background: rgba(255,255,255,.14); }
.topbar-main .views a.cur { background: #fff; color: var(--green-ink); box-shadow: 0 2px 9px rgba(9,21,48,.3); }

.topbar-sub {
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 7px 20px;
}
.topbar-sub nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar-sub nav a { padding: 5px 13px; border-radius: 999px; font-size: 14px; color: var(--muted); }
.topbar-sub nav a:hover { background: var(--chip); text-decoration: none; color: var(--ink); }
.topbar-sub nav a.active { background: var(--green-soft); color: var(--green-ink); font-weight: 600; }
@media (max-width: 620px) {
  .topbar-main .views { width: 100%; justify-content: center; }
  .topbar-main .views a { flex: 1; text-align: center; padding: 7px 10px; }
}

h1 { font-size: 26px; line-height: 1.4; margin-bottom: 4px; }
h2 { font-size: 19px; margin: 22px 0 10px; }
.lede { color: var(--muted); margin-bottom: 18px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; margin-bottom: 16px; box-shadow: var(--shadow); }

table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 15px; }
.tbl th { background: var(--chip); text-align: left; font-size: 13px; padding: 9px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl-wrap { overflow-x: auto; border-radius: 14px; box-shadow: var(--shadow); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 0.95em; }

.badge { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 1px 11px; white-space: nowrap; }
.badge.open { background: var(--chip); color: var(--muted); }
.badge.in_progress { background: var(--amber-soft); color: var(--amber-ink); }
.badge.done { background: var(--green-soft); color: var(--green-ink); }
.badge.cancelled { background: var(--red-soft); color: var(--red-ink); }
.badge.sap { background: var(--blue-soft); color: var(--blue-ink); }
.badge.manual { background: var(--chip); color: var(--muted); }

button, .btn {
  font: inherit;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 9px;
  padding: 8px 18px;
  cursor: pointer;
  font-size: 15px;
  display: inline-block;
}
button:hover, .btn:hover { filter: brightness(1.06); text-decoration: none; }
button:disabled { opacity: 0.5; cursor: default; }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); }
.btn-danger { background: var(--surface); color: var(--red-ink); border: 1px solid var(--red); }
.btn-sm { padding: 3px 12px; font-size: 13.5px; border-radius: 7px; }

input, select, textarea {
  font: inherit;
  padding: 8px 12px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--green); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: auto; }
label { display: block; font-size: 14px; font-weight: 600; margin: 12px 0 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.hint { font-size: 13px; color: var(--muted); }

.err { background: var(--red-soft); color: var(--red-ink); border: 1px solid var(--red); border-radius: 9px; padding: 9px 14px; margin: 10px 0; font-size: 14.5px; }
.ok-note { background: var(--green-soft); color: var(--green-ink); border: 1px solid var(--green); border-radius: 9px; padding: 9px 14px; margin: 10px 0; font-size: 14.5px; }

/* แถบความคืบหน้าต่อขั้นตอน */
.prog { display: flex; gap: 4px; align-items: center; }
.prog .cell { min-width: 46px; text-align: center; border-radius: 7px; font-size: 11.5px; padding: 2px 4px; border: 1px solid var(--line); background: var(--surface); line-height: 1.5; }
.prog .cell b { display: block; font-size: 12px; font-family: var(--mono); }
.prog .cell.done { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
.prog .cell.wip { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-ink); }
.prog .cell.todo { color: var(--muted); }

.bar { height: 7px; border-radius: 99px; background: var(--chip); overflow: hidden; }
.bar b { display: block; height: 100%; border-radius: 99px; background: var(--green); }
.bar b.warn { background: var(--amber); }

/* หน้ายิงสแกน (kiosk) — ตัวใหญ่สำหรับหน้างาน */
.kiosk { max-width: 720px; margin: 0 auto; padding: 20px 16px 90px; font-size: 19px; }
.kiosk h1 { font-size: 24px; }
.kiosk input.scan-input { font-size: 30px; padding: 18px 20px; text-align: center; font-family: var(--mono); }
.kiosk input.qty-input { font-size: 42px; padding: 14px 20px; text-align: center; font-family: var(--mono); }
.kiosk .big-btn { width: 100%; font-size: 24px; padding: 16px; border-radius: 14px; margin-top: 14px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.keypad button { font-size: 28px; padding: 14px 0; background: var(--surface); color: var(--ink); border: 1px solid var(--line2); border-radius: 12px; }
.flash-ok { position: fixed; inset: 0; background: var(--success); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; z-index: 50; text-align: center; padding: 24px; }
.flash-err { position: fixed; inset: 0; background: var(--red); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; z-index: 50; text-align: center; padding: 24px; }
.flash-sub { font-size: 19px; font-weight: 400; margin-top: 12px; opacity: 0.95; }
.quick-notes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.quick-notes button { background: var(--surface); color: var(--ink); border: 1px solid var(--line2); border-radius: 999px; padding: 6px 16px; font-size: 16px; }
.quick-notes button.sel { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); font-weight: 600; }

.kv-row { display: flex; flex-wrap: wrap; gap: 8px 26px; }
.kv b { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kv span { font-weight: 600; }

.login-box { max-width: 430px; margin: 7vh auto 0; padding: 0 16px 80px; }
.login-box .brand-big { text-align: center; font-size: 22px; font-weight: 700; color: var(--green-ink); margin-bottom: 16px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.stat { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 13px 17px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.stat span { font-size: 22px; font-weight: 700; }
.stat small { color: var(--muted); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- กราฟหน้าแรกผู้บริหาร ---------- */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }
.chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 12.5px; color: var(--muted); align-items: center; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- แจ้งเตือนความครบถ้วนของข้อมูล (แสดงเฉพาะเมื่อพบปัญหา) ---------- */
.health-warn { background: var(--amber-soft); border: 1px solid var(--amber); color: var(--amber-ink); border-radius: 12px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; font-weight: 600; display: grid; gap: 4px; }

.hero { background: linear-gradient(135deg, #0c2050 0%, #123a8f 52%, #1a5fd6 100%); color: #f2f6fd; border-radius: 20px; padding: 40px 34px 34px; margin-bottom: 22px; box-shadow: 0 10px 34px rgba(18, 58, 143, .25); }
.hero h1 { color: #fff; font-size: 31px; }
.hero .sub { color: #c6d7f5; max-width: 780px; margin-top: 6px; }
.hero .flow { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 18px; font-size: 14px; }
.hero .flow span { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); padding: 3px 12px; border-radius: 999px; white-space: nowrap; }
.hero .flow .arrow { background: none; border: none; opacity: .7; padding: 3px 0; }

.role-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 14px 0 6px; }
.role-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px 22px 20px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.role-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(18, 58, 143, .16); }
.role-card .icon { font-size: 34px; width: 58px; height: 58px; display: flex; align-items: center; justify-content: center; background: var(--green-soft); border-radius: 16px; }
.role-card h3 { font-size: 18px; margin-top: 4px; }
.role-card .num { position: absolute; top: 18px; right: 20px; font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--line2); }
.role-card p { font-size: 14px; color: var(--muted); flex: 1; }
.role-card a.enter { display: block; text-align: center; width: 100%; font-size: 16.5px; font-weight: 600; padding: 12px; border-radius: 12px; background: var(--green); color: #fff; }
.role-card a.enter:hover { text-decoration: none; filter: brightness(1.07); }

.try-steps { counter-reset: step; }
.try-steps li { list-style: none; position: relative; padding: 0 0 14px 44px; }
.try-steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 2px; width: 28px; height: 28px; border-radius: 99px; background: var(--green); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.try-steps li:not(:last-child)::after { content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 2px; width: 1.5px; background: var(--line2); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip-row button { background: var(--surface); color: var(--green-ink); border: 1px dashed var(--line2); border-radius: 999px; padding: 4px 14px; font-size: 15px; font-family: var(--mono); }
.chip-row button:hover { border-color: var(--green); }

.cred-table td, .cred-table th { padding: 6px 12px; }

/* ช่องความคืบหน้าที่มีของเสีย — จุดแดงเล็กมุมช่อง */
.prog .cell.has-defect { position: relative; }
.prog .cell.has-defect::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 99px; background: var(--red); }

/* คิวงานหน้าจุดสแกน */
.queue-list { display: grid; gap: 8px; margin-top: 10px; }
.queue-item { display: flex; gap: 12px; align-items: baseline; width: 100%; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line2); border-radius: 12px; padding: 10px 16px; font-size: 16px; }
.queue-item .mono { font-weight: 700; color: var(--green-ink); }
.queue-item span:nth-child(2) { flex: 1; color: var(--muted); font-size: 14px; }
.queue-item b { color: var(--amber-ink); font-weight: 600; white-space: nowrap; }
.queue-item:hover { border-color: var(--green); }

/* ส่วนของเสีย/งานแก้/เวลาเครื่องใน kiosk */
.extras-toggle { width: 100%; margin-top: 14px; background: var(--surface); color: var(--muted); border: 1px dashed var(--line2); border-radius: 12px; padding: 10px 16px; font-size: 16px; text-align: left; }
.extras-toggle.open { border-style: solid; color: var(--ink); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.extras-toggle b { margin-left: 8px; }
.extras-box { border: 1px solid var(--line2); border-top: none; border-radius: 0 0 12px 12px; padding: 12px 16px 16px; background: var(--surface); }
.extras-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 560px) { .extras-grid { grid-template-columns: 1fr; } }
.extras-grid input { font-size: 22px; text-align: center; font-family: var(--mono); }

/* overlay แจ้งปัญหาหน้างาน */
.issue-overlay { position: fixed; inset: 0; background: rgba(20, 28, 24, .55); z-index: 55; display: flex; align-items: center; justify-content: center; padding: 18px; }
.issue-box { background: var(--surface); border-radius: 16px; padding: 22px; width: 100%; max-width: 560px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }

/* กราฟแท่งอย่างง่าย (หน้ารายงาน) */
.chart { display: flex; align-items: flex-end; gap: 6px; min-height: 170px; overflow-x: auto; padding-top: 18px; }
.chart-col { flex: 1; min-width: 42px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0; }
.chart-bar { width: 70%; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bar.defect { background: var(--red); border-radius: 4px 4px 0 0; margin-bottom: 1px; }
.chart-lbl { font-size: 11px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
.chart-val { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }

/* แถบปฏิทิน 14 วัน (หน้า ETA) */
.cal-day { border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; font-size: 12px; text-align: center; min-width: 74px; line-height: 1.5; background: var(--surface); color: var(--muted); }
.cal-day b { display: block; font-size: 12px; }
.cal-day span { display: block; font-family: var(--mono); font-size: 11.5px; }
.cal-day.work { background: var(--green-soft); border-color: var(--green); color: var(--green-ink); }
.cal-day.off { opacity: .75; }
.cal-day.ot { box-shadow: 0 0 0 2px var(--amber); }

/* ตารางอัตราผลิต (หน้า ETA) */
.rate-grid { display: grid; gap: 6px; }
.rate-row { display: flex; gap: 12px; align-items: center; font-size: 14.5px; }

/* ---------- ตัวสลับ 6 มุมมอง (จอแคบให้เลื่อนแนวนอนได้) ---------- */
@media (max-width: 900px) {
  .topbar-main .views a { padding: 6px 11px; font-size: 13.5px; }
}
@media (max-width: 620px) {
  .topbar-main .views { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; -webkit-overflow-scrolling: touch; }
  .topbar-main .views a { flex: 0 0 auto; }
}

/* ---------- การ์ดใหญ่หน้าแรกเจ้าของ ---------- */
.own-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin: 14px 0; }
.own-card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow); color: var(--ink); transition: transform .12s ease, box-shadow .12s ease; }
.own-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 22px rgba(18, 58, 143, .14); }
.own-card b { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.own-card span { font-size: 27px; font-weight: 700; line-height: 1.5; }
.own-card small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.55; }

/* ---------- แถบเวลา ทำจริง/รอ/หยุด ---------- */
.tbar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--chip); }
.tbar i { display: block; height: 100%; }
.t-wait { background: #b9c6da; }
.t-work { background: var(--success); }
.t-pause { background: var(--red); }
.tbar-lbl { font-size: 12px; color: var(--muted); margin-top: 3px; }
.legend { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.legend .lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin: 0 4px 0 10px; }
.wow-head { background: linear-gradient(90deg, #103680, #1a5fd6); color: #fff; border-radius: 14px; padding: 14px 20px; margin: 4px 0 16px; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline; }
.wow-head b { font-size: 20px; }
.wow-head span { font-size: 13.5px; opacity: .9; }

/* ป้ายสถานะเล็ก */
.chip { display: inline-block; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 2px 11px; white-space: nowrap; }
.chip-run { background: var(--green-soft); color: var(--green-ink); }
.chip-pause { background: var(--red-soft); color: var(--red-ink); }
.chip-done { background: #e2f6ec; color: #0d7a4f; }
.chip-part { background: var(--amber-soft); color: var(--amber-ink); }
.badge.rework { background: var(--amber-soft); color: var(--amber-ink); }

/* ป้ายกำหนดส่ง — สีตาม "เหลือกี่วัน" */
.due { display: inline-flex; flex-direction: column; line-height: 1.45; }
.due .due-date { font-size: 13.5px; }
.due b { font-size: 12px; font-weight: 700; }
.due-late b { color: var(--red-ink); }
.due-soon b { color: var(--amber-ink); }
.due-ok b { color: var(--green-ink); }

/* ---------- สลิปกำไร ---------- */
.slip { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; max-width: 620px; box-shadow: var(--shadow); font-size: 16.5px; }
.slip-line { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px dashed var(--line2); }
.slip-line b { font-size: 17px; }
.slip-top { border-bottom: 2px solid var(--ink); font-weight: 700; }
.slip-total { border-top: 2px solid var(--ink); border-bottom: none; font-weight: 700; margin-top: 4px; color: var(--green-ink); font-size: 18px; }
.slip-total.slip-loss { color: var(--red-ink); }
.slip-note { font-size: 13.5px; color: var(--muted); padding-top: 8px; }

/* ---------- เงินรั่ว ---------- */
.big-num-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 18px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.big-num-card b { font-size: 30px; color: var(--red-ink); display: block; }
.big-num-card span { color: var(--muted); font-size: 13.5px; }
.leak-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.leak-lbl { width: 220px; font-size: 14.5px; }
.leak-amt { width: 110px; text-align: right; font-size: 16px; }
@media (max-width: 620px) { .leak-lbl { width: 130px; font-size: 13px; } }

/* ---------- โรงงานตอนนี้ ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.live-card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line2); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.live-card.live-run { border-left-color: var(--success); }
.live-card.live-paused { border-left-color: var(--red); background: #fffafa; }
.live-card.live-idle { opacity: .8; }
.live-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.live-wo { font-size: 14px; padding: 4px 0; }
.live-queue { margin-top: 8px; font-size: 12.5px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }

/* ---------- จอไฟแดง ---------- */
.flag-row { background: var(--red-soft); border: 1px solid var(--red); border-radius: 12px; padding: 10px 16px; margin-bottom: 10px; font-size: 14.5px; }
.flag-row.big { font-size: 16px; padding: 14px 18px; }
.flag-row b { color: var(--red-ink); }

/* ---------- งานทุกแผนกวันนี้ (ผจก.) ---------- */
.dept-item { font-size: 13.5px; padding: 3px 8px; border-radius: 8px; margin: 2px 0; }
.dept-item.g-paused { background: var(--red-soft); }
.dept-item.g-run { background: var(--green-soft); }
.dept-item.g-ready { background: var(--amber-soft); }
.dept-item.g-incoming { background: var(--chip); color: var(--muted); }

/* ---------- แถบ "งานวันนี้" ของหัวหน้าแผนก ---------- */
.today-group { margin-bottom: 22px; }
.today-group h2 { font-size: 17px; margin: 0 0 8px; padding-left: 12px; border-left: 5px solid var(--line2); }
.today-group.tg-paused h2 { border-left-color: var(--red); color: var(--red-ink); }
.today-group.tg-run h2 { border-left-color: var(--success); }
.today-group.tg-ready h2 { border-left-color: var(--amber); }
.today-item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line2); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; font-size: 16px; color: var(--ink); }
.today-item:hover { text-decoration: none; border-color: var(--green); }
.today-item .mono { font-weight: 700; color: var(--green-ink); }
.today-item .today-mid { flex: 1; color: var(--muted); font-size: 13.5px; min-width: 140px; }
.today-item b { font-weight: 600; white-space: nowrap; font-size: 14px; }
.today-item.ti-paused { border-left: 5px solid var(--red); }
.today-item.ti-run { border-left: 5px solid var(--success); }
.today-item.ti-ready { border-left: 5px solid var(--amber); }
.today-item.ti-incoming { border-left: 5px solid var(--line2); opacity: .85; }

/* ---------- ปุ่มหน้าสแกน 5 สถานะ ---------- */
.kiosk .btn-finish { background: var(--success); border-color: var(--success); }
.kiosk .btn-dayend { background: #123a8f; border-color: #123a8f; }
.kiosk .btn-pause { background: var(--surface); color: var(--amber-ink); border: 2px solid var(--amber); }
.state-note { border-radius: 12px; padding: 12px 16px; margin-top: 14px; font-weight: 600; font-size: 17px; }
.state-note span { font-weight: 400; font-size: 13.5px; color: var(--muted); }
.state-note.run { background: var(--green-soft); color: var(--green-ink); }
.state-note.pause { background: var(--red-soft); color: var(--red-ink); }
.quick-notes button.preason { font-size: 18px; padding: 10px 20px; }
.quick-notes button.preason.sel { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-ink); }

/* ---------- อื่นๆ ---------- */
.export-btn { font-size: 16px; font-weight: 700; padding: 10px 22px; background: #0d7a4f; border-color: #0d7a4f; }
.row-loss td { background: #fff6f5; }
.warn-txt { color: var(--red-ink); font-size: 11.5px; }
.alloc-row { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.alloc-row b { margin-left: auto; }
.dropzone { display: block; border: 2.5px dashed var(--line2); border-radius: 16px; padding: 34px 20px; text-align: center; cursor: pointer; margin: 0; font-weight: 400; }
.dropzone b { display: block; font-size: 18px; color: var(--green-ink); margin-bottom: 4px; }
.dropzone span { color: var(--muted); font-size: 13.5px; }
.dropzone.over { border-color: var(--green); background: var(--green-soft); }

/* ---------- จอวางแผนผลิต (สต๊อก FG) ---------- */
.plan-need { color: var(--red-ink); font-weight: 700; white-space: nowrap; }
.plan-ok { color: var(--green-ink); font-weight: 600; white-space: nowrap; }
