/* =========================================================
   ລະບົບຕິດຕາມການເຂົ້າ-ອອກວຽກ ດ່ານເກັບເງິນ
   ໂທນສີ: ຟ້າມືອາຊີບ + ພື້ນຂາວ + ສີໄມ້ກັ້ນດ່ານ (ເຫຼືອງອຳພັນ)
   ========================================================= */

:root {
  /* ---- ສີຫຼັກ (ຟ້າ) ---- */
  --green:      #0D6EFD;   /* ຊື່ຕົວແປຄົງເດີມ ເພື່ອບໍ່ໃຫ້ໜ້າອື່ນພັງ */
  --green-dk:   #0A4CB4;
  --green-lt:   #E7F1FF;

  /* ---- ສີສະຖານະ ---- */
  --amber:      #E39B12;
  --amber-dk:   #B87A05;
  --amber-lt:   #FDF1DC;
  --amber-ink:  #8A5B00;
  --red:        #B3261E;
  --red-lt:     #FBEAE9;
  --ok:         #12805C;

  /* ---- ພື້ນ ແລະ ຕົວໜັງສື ---- */
  --ink:        #0F172A;
  --muted:      #64748B;
  --line:       #E2E8F0;
  --paper:      #FFFFFF;   /* ພື້ນຫຼັງລະບົບ ຂາວ 100% */
  --card:       #FFFFFF;   /* ພື້ນຫຼັງກາດ */
  --soft:       #F1F5F9;   /* ພື້ນອ່ອນ ໃຊ້ແຍກກ່ອງພາຍໃນກາດ */
  --soft-2:     #F8FAFC;   /* ພື້ນອ່ອນກວ່າ ໃຊ້ໃນຊ່ອງກອກຂໍ້ມູນ */

  /* ---- ໂຄງສ້າງ ---- */
  --radius:     14px;
  --radius-sm:  10px;
  --shadow:     0 1px 3px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);
  --shadow-lg:  0 20px 40px -15px rgba(15,23,42,.35);

  /* ---- ຕົວອັກສອນ ---- */
  --lao: "Noto Sans Lao", "Phetsarath OT", "Saysettha OT", "Lao UI",
         "Leelawadee UI", "Segoe UI", system-ui, sans-serif;

  /* ---- ສີປະຈຳທີມ ---- */
  --tA: #1D4ED8;   /* ຟ້າເຂັ້ມ */
  --tB: #0F766E;   /* ຂຽວອົມຟ້າເຂັ້ມ */
  --tC: #B45309;   /* ສົ້ມນ້ຳຕານເຂັ້ມ */
  --tD: #6D28D9;   /* ມ່ວງເຂັ້ມ */

}

/* ລັອກບໍ່ໃຫ້ Dark Mode ຂອງເຄື່ອງປ່ຽນພື້ນເປັນສີເຂັ້ມ */
@media (prefers-color-scheme: dark) {
  :root {
    --ink:      #0F172A;
    --muted:    #64748B;
    --line:     #E2E8F0;
    --paper:    #FFFFFF;
    --card:     #FFFFFF;
    --soft:     #F1F5F9;
    --soft-2:   #F8FAFC;
    --green-lt: #E7F1FF;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--lao);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  padding-bottom: env(safe-area-inset-bottom);
}

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

h1 { font-size: 1.35rem; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 700; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 4px; }

.mono   { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .85em; }
.subtle { color: var(--muted); font-size: .87rem; font-style: normal; }
.center { text-align: center; }
.empty  { color: var(--muted); text-align: center; padding: 28px 12px; margin: 0; }

/* =========================================================
   ແຖບເທິງ
   ========================================================= */
.topbar {
  background: var(--green-dk);
  color: #fff;
  padding-top: env(safe-area-inset-top);
  position: sticky; top: 0; z-index: 40;
}
.topbar-in {
  max-width: 100%; margin: 0;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px;
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 20px; height: 20px; border-radius: 4px; flex: none;
  background: repeating-linear-gradient(135deg, var(--amber) 0 5px, #fff 5px 10px);
}
.brand-mark.big { width: 44px; height: 44px; border-radius: 10px; }
.brand-text { font-size: .98rem; }

.topnav { display: none; gap: 2px; margin-left: 10px; flex: 1; }
.topnav a { color: rgba(255,255,255,.82); padding: 7px 12px; border-radius: 8px; font-size: .92rem; }
.topnav a:hover { background: rgba(255,255,255,.12); text-decoration: none; color: #fff; }
.topnav a.on { background: rgba(255,255,255,.18); color: #fff; font-weight: 600; }
.navsep { width: 1px; background: rgba(255,255,255,.25); margin: 6px 8px; }

.topright { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.bell { color: #fff; position: relative; display: flex; }
.bell .dot {
  position: absolute; top: -5px; right: -6px; background: var(--amber); color: #23180a;
  font-size: .62rem; font-weight: 700; font-style: normal;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: grid; place-items: center; padding: 0 4px;
}
.who { color: #fff; display: none; line-height: 1.2; text-align: right; }
.who-name { display: block; font-size: .86rem; font-weight: 600; }
.who-code { display: block; font-size: .72rem; opacity: .75; }
.out {
  color: #fff; border: 1px solid rgba(255,255,255,.35); padding: 4px 11px;
  border-radius: 20px; font-size: .82rem;
}
.out:hover { background: rgba(255,255,255,.12); text-decoration: none; }

/* =========================================================
   ແຖບຍ່ອຍຜູ້ດູແລ
   ========================================================= */
.subbar { background: var(--green); position: sticky; top: 0; z-index: 30; }
.subbar-in {
  max-width: 100%; margin: 0; padding: 0 20px;
  display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.subbar-in::-webkit-scrollbar { display: none; }
.subbar a {
  color: rgba(255,255,255,.85); padding: 10px 13px; font-size: .88rem; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.subbar a:hover { text-decoration: none; color: #fff; }
.subbar a.on { color: #fff; border-bottom-color: var(--amber); font-weight: 600; }

/* =========================================================
   ພື້ນທີ່ເນື້ອໃນ (ປັບໃຫ້ດຶງຕາຕະລາງຂຶ້ນມາຕິດ)
   ========================================================= */
.wrap {
  max-width: 100%; margin: 0;
  padding: 18px 20px calc(88px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; 
  gap: 6px;
}
.page-head {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  gap: 12px; 
  flex-wrap: wrap;
  margin-bottom: 0;
  padding-bottom: 0;
}

.page-head h1 {
  margin: 0;
  line-height: 1.2; /* ຫຼຸດຄວາມສູງຂອງແຖວ <h1> ບໍ່ໃຫ້ມີພື້ນທີ່ຫວ່າງດ້ານເທິງ-ລຸ່ມ */
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 8px !important; /* ເພີ່ມໄລຍະຫ່າງດ້ານລຸ່ມຂອງແຕ່ລະ Card */
}

/* ປັບໄລຍະຫ່າງຂອງ Card ສ່ວນ "ວັນລາໃນເດືອນນີ້" ໃຫ້ແຍກຈາກ Grid ດ້ານລຸ່ມ */
.card .card {
  margin-bottom: 8px;
}

.card-title { 
  margin: 0 0 4px; /* ຫຼຸດໄລຍະຫ່າງລະຫວ່າງ "ໃບລາຂອງຂ້ອຍ" ຫາ ຕາຕະລາງ */
  font-size: 1rem; 
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.card-head .card-title { margin: 0; }
.note { margin: 8px 0 0; font-size: .88rem; color: var(--muted); }

.sec-head { margin-bottom: 12px; }
.sec-head .card-title { margin: 0 0 3px; }
.sec-sub { margin: 0; color: var(--muted); font-size: .84rem; }

/* =========================================================
   ໜ້າເຂົ້າສູ່ລະບົບ
   ========================================================= */
body.login-body {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 55%, #1E40AF 100%);
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px 16px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--card); border-radius: 20px; padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.login-head { text-align: center; margin-bottom: 26px; }
.login-head .brand-mark { margin: 0 auto 14px; display: block; }
.login-head h1 { font-size: 1.32rem; line-height: 1.3; }
.login-head p { margin: 6px 0 0; color: var(--muted); font-size: .88rem; }

.login-card form { display: flex; flex-direction: column; gap: 18px; }
.login-card .fld { gap: 6px; }
.login-card .fld > span { font-size: .88rem; font-weight: 600; color: #334155; }
.login-card .fld input {
  padding: 12px 16px; border-radius: 10px; font-size: .95rem;
  background: var(--soft-2);
}
.login-card .fld input:focus {
  background: var(--card); border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(13,110,253,.18);
}
.login-card .btn-lg {
  margin-top: 4px; padding: 13px; max-width: none; border-radius: 10px; font-size: 1rem;
}
.login-note { margin: 24px 0 0; font-size: .82rem; color: var(--muted); text-align: center; line-height: 1.45; }
.install-hint { color: rgba(255,255,255,.85); font-size: .82rem; text-align: center; margin-top: 20px; }

/* ປຸ່ມເບິ່ງ PIN ໃນຊ່ອງລະຫັດ */
.input-wrapper { position: relative; display: flex; align-items: center; }
.toggle-pin {
  position: absolute; right: 12px; background: none; border: none;
  color: var(--muted); cursor: pointer; padding: 4px; font-size: .8rem;
  display: flex; align-items: center;
}
/* =========================================================
   ຮີໂຣ: ໂມງ + ປຸ່ມກົດວຽກ
   ========================================================= */
.hero {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 5px;
  background: repeating-linear-gradient(135deg, var(--amber) 0 14px, var(--green) 14px 28px);
}
.hero.state-working { background: linear-gradient(120deg, var(--green-lt) 0%, var(--card) 55%); }
.hero.state-ready   { background: linear-gradient(120deg, var(--green-lt) 0%, var(--card) 55%); }

.hero-grid {
  display: flex; flex-direction: column; align-items: center;
  gap: 22px; max-width: 460px; margin: 0 auto;
}
.hero-info { text-align: center; width: 100%; }

.clock-date {
  color: var(--muted); font-size: .82rem; margin-bottom: 14px;
  letter-spacing: .04em;
}

.clock-row {
  display: inline-flex; align-items: stretch; gap: 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; margin: 0 auto;
  box-shadow: 0 3px 14px rgba(15,23,42,.08);
}
.clock-time {
  font-size: clamp(2.2rem, 9vw, 2.9rem); font-weight: 700; line-height: 1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  padding: 12px 18px; display: flex; align-items: center;
}
.clock-time span { font-size: .5em; font-weight: 600; color: var(--green); margin-left: 2px; }

.cr-badge {
  display: flex; flex-direction: column; justify-content: center;
  padding: 10px 18px; min-width: 118px; text-align: center;
}
.cr-badge b { display: block; font-size: .88rem; font-weight: 700; line-height: 1.25; }
.cr-badge i { display: block; font-style: normal; font-size: .72rem; opacity: .85; margin-top: 2px; }
.cr-badge.live { background: var(--green); color: #fff; }
.cr-badge.ready { background: var(--green); color: #fff; }
.cr-badge.wait { background: linear-gradient(135deg, #1D4ED8, #1E3A8A); color: #fff; }
.cr-badge.rest { background: var(--soft); color: var(--muted); }

.hero-meta {
  margin: 14px 0 0; font-size: .88rem; color: var(--muted);
  display: flex; gap: 7px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.hero-meta b { color: var(--ink); }
.hero-meta .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.state-working .hero-meta .dot { background: var(--ok); animation: beat 1.6s ease-in-out infinite; }
.state-ready   .hero-meta .dot { background: var(--amber); animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none !important; } }

/* ---- ນັບຖອຍຫຼັງ ---- */
.countdown {
  margin: 16px auto 0; padding: 9px 20px; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: .86rem;
  display: flex; gap: 8px; align-items: center; justify-content: center;
  flex-wrap: wrap; width: fit-content; max-width: 100%;
}
.countdown b {
  color: var(--ink); font-size: 1.15rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.countdown.big {
  background: var(--soft); color: var(--muted);
  border: 1px solid var(--line); box-shadow: none;
}
.countdown.big b { color: var(--ink); font-size: 1.4rem; }
.countdown.warn { background: var(--green-lt); color: var(--green-dk); font-weight: 600; }
.countdown.warn b { color: var(--green-dk); }

/* ---- ແຖບຄວາມຄືບໜ້າຂອງກະ ---- */
.shift-progress { margin: 16px auto 0; max-width: 360px; width: 100%; }
.sp-bar {
  position: relative; height: 30px; border-radius: 999px;
  background: var(--soft); overflow: hidden;
}
.sp-bar > span {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width .6s ease;
}
.sp-bar em {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-style: normal; font-size: .86rem; font-weight: 700; color: var(--ink);
  font-variant-numeric: tabular-nums; text-shadow: 0 1px 3px rgba(255,255,255,.85);
}
.sp-info {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: .76rem; color: var(--muted);
}
#spLeft { font-weight: 700; color: var(--green); }

/* ---- ຄໍລຳປຸ່ມ ---- */
.hero-action {
  text-align: center; width: 100%;
  padding-top: 22px; border-top: 1px solid var(--line);
}
.hero-action .btn-lg { max-width: 340px; }
.clock-hint { color: var(--muted); font-size: .8rem; margin: 12px 0 0; }
.done-mark {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 15px 28px; border-radius: 14px;
  background: var(--green-lt); color: var(--green-dk); font-weight: 700; font-size: 1rem;
}
.done-mark span {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--green); color: #fff; display: grid; place-items: center; font-size: .85rem;
}

@media (min-width: 760px) {
  .hero { padding: 36px 28px 32px; }
  .clock-time { font-size: 3.1rem; padding: 14px 22px; }
  .cr-badge { padding: 12px 22px; min-width: 132px; }
  .cr-badge b { font-size: .92rem; }
}
@media (max-width: 620px) {
  .hero { padding: 22px 16px; }
  .clock-time { padding: 10px 14px; }
  .cr-badge { padding: 8px 13px; min-width: 100px; }
}

/* ---- ນັບຖອຍຫຼັງ ---- */
.countdown {
  margin: 14px auto 0; padding: 8px 18px; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: .88rem;
  display: flex; gap: 7px; align-items: center; justify-content: center;
  flex-wrap: wrap; width: fit-content; max-width: 100%;
}
.countdown b {
  color: var(--ink); font-size: 1.08rem; font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.countdown.warn { background: var(--green-lt); color: var(--green-dk); font-weight: 600; }
.countdown.warn b { color: var(--green-dk); }
.hero-shift .countdown { margin-top: 14px; }

/* ---- ຄວາມຄືບໜ້າຂອງກະ ---- */
.shift-progress { margin: 18px auto 0; max-width: 380px; }
.sp-bar { height: 9px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.sp-bar span {
  display: block; height: 100%; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--amber));
  transition: width .6s ease;
}
.sp-info {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 8px; font-size: .78rem; color: var(--muted);
}
.sp-info b { color: var(--ink); }
#spLeft { font-weight: 700; color: var(--green); }

.worked-since { margin-top: 10px; color: var(--muted); font-size: .88rem; }
.worked-since b, #elapsed { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- ປຸ່ມກົດວຽກ ---- */
.clock-actions { margin-top: 24px; }
.clock-hint { color: var(--muted); font-size: .8rem; margin: 12px 0 0; }
.done-mark {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 26px; border-radius: 14px;
  background: var(--green-lt); color: var(--green-dk); font-weight: 600; font-size: .95rem;
}
.done-mark span {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  background: var(--green); color: #fff;
  display: grid; place-items: center; font-size: .85rem;
}

@keyframes beat { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.4); opacity: .45; } }
.state-working .hs-badge .pulse,
.state-ready .hs-badge .pulse { animation: beat 1.6s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none !important; } }

@media (max-width: 620px) {
  .hero { padding: 24px 14px 22px; }
  .hs-time { font-size: 1.7rem; }
}

/* =========================================================
   ປຸ່ມ
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: inherit; font-size: .92rem; font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: filter .15s, transform .05s, background .15s;
}
.btn:hover { text-decoration: none; background: var(--soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-dk); border-color: var(--green-dk); }
.btn-danger  { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-lt); }
.btn-ghost   { background: transparent; }
.btn-sm      { padding: 5px 11px; font-size: .82rem; }
.btn-lg      { padding: 16px 30px; font-size: 1.1rem; width: 100%; max-width: 340px; border-radius: 14px; }
.btn-in  { background: var(--green); border-color: var(--green); color: #fff;
           box-shadow: 0 6px 20px rgba(13,110,253,.3); }
.btn-in:hover { background: var(--green-dk); border-color: var(--green-dk); }
.btn-out { background: var(--green); border-color: var(--green); color: #fff;
           box-shadow: 0 6px 20px rgba(13,110,253,.3); }
.btn-out:hover { background: var(--green-dk); border-color: var(--green-dk); }
.btn.is-busy { opacity: .6; pointer-events: none; }

/* =========================================================
   ຟອມ
   ========================================================= */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: .84rem; color: var(--muted); font-weight: 600; }
.fld input, .fld select, .fld textarea, .mini-input {
  font-family: inherit; font-size: 1rem; color: var(--ink);
  padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--soft-2); width: 100%; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.fld input:focus, .fld select:focus, .fld textarea:focus, .mini-input:focus {
  border-color: var(--green); background: var(--card);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}
.fld textarea { resize: vertical; }

.chk { display: flex; align-items: center; gap: 9px; font-size: .9rem; }
.chk input { width: 20px; height: 20px; accent-color: var(--green); flex: none; }
.chk-box {
  margin-top: 14px; margin-bottom: 14px; padding: 13px 15px; align-items: flex-start;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card);
  cursor: pointer;
}
.chk-box:hover { border-color: var(--green); }
.chk-box span { display: block; }
.chk-box i { display: block; font-style: normal; color: var(--muted); font-size: .82rem; margin-top: 2px; }

.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.sticky-actions { position: sticky; bottom: 76px; }

/* Container ຫຼັກທີ່ຄຸມ ຫົວຂໍ້ ແລະ Filter Bar ເພື່ອໃຫ້ຢູ່ແຖວດຽວກັນ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between; /* ດັນຫົວຂໍ້ໄປຊ້າຍ, ດັນ filter-bar ໄປຂວາ */
  gap: 16px;
  margin-bottom: 8px;           /* ໄລຍະຫ່າງລະຫວ່າງ Header ກັບ Card ສະຫຼຸບ */
}

.page-header h2 {
  margin: 0;                     /* ລ້າງ margin ຂອງ <h2> ອອກເພື່ອໃຫ້ບ່ອນເຄິ່ງກັນ */
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Filter Bar Style */
.filter-bar {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ໃຫ້ Container ຍ່ອຍໃນ Desktop ສະແດງເປັນ Flex ແນວນອນຕໍ່ກັນ */
.filter-bar-dates,
.filter-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.filter-bar .fld { 
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  flex: 0 1 auto;
}

.filter-bar .fld span {
  white-space: nowrap;
  font-size: 0.9rem;
  color: var(--ink);
}

.filter-bar input[type="date"],
.filter-bar input[type="text"] {
  background-color: #ffffff !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: 38px !important;
  padding: 0 12px;
  box-sizing: border-box;
}

.filter-bar .btn {
  height: 38px !important;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  white-space: nowrap;
  gap: 6px; /* ເພີ່ມໄລຍະຫ່າງລະຫວ່າງ Icon ກັບ ຕົວໜັງສື */
}

/* ຈັດຂະໜາດໄອຄອນໃນປຸ່ມ */
.filter-bar .btn i {
  font-size: 0.9rem;
}

/* =========================================================
   Responsive Design ສໍາລັບໂທລະສັບ (Mobile Style)
   ========================================================= */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  /* ຈັດ Filter Bar ເປັນ Flexbox ແນວຕັ້ງ */
  .filter-bar {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  /* 1. ແຖວຄູ່ Date Inputs: ຢູ່ແຖວດຽວກັນ 2 ຄໍລຳ (50% / 50%) */
  .filter-bar-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .filter-bar .fld {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
  }

  .filter-bar .fld span {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted, #64748b);
  }

  .filter-bar input[type="date"] {
    width: 100% !important;
    height: 40px !important;
  }

  /* 2. ແຖວຄູ່ Buttons: ຢູ່ແຖວດຽວກັນ 2 ຄໍລຳ (50% / 50%) */
  .filter-bar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .filter-bar .btn {
    width: 100% !important;
    height: 40px !important;
    font-size: 0.85rem;
    padding: 0 8px !important;
  }
}

.mini-input { width: 130px; padding: 5px 9px; font-size: .82rem; }

.save-bar {
  position: sticky; bottom: 12px; z-index: 20; margin-top: 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 15px; border-radius: var(--radius); background: var(--card);
  border: 1px solid var(--line); box-shadow: 0 -2px 16px rgba(15,23,42,.12);
}
.save-bar .btn { padding: 11px 26px; }

/* =========================================================
   ຂໍ້ຄວາມແຈ້ງ
   ========================================================= */
.flash {
  padding: 11px 14px; border-radius: var(--radius-sm); font-size: .92rem;
  border: 1px solid transparent;
}
.flash-ok   { background: var(--green-lt); color: var(--green-dk); border-color: rgba(13,110,253,.22); }
.flash-err  { background: var(--red-lt);   color: var(--red);      border-color: rgba(179,38,30,.25); }
.flash-warn { background: var(--amber-lt); color: var(--amber-ink);border-color: rgba(138,91,0,.25); }

/* =========================================================
   ປ້າຍສະຖານະ
   ========================================================= */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem;
  font-weight: 600; font-style: normal; background: var(--soft);
  color: var(--muted); border: 1px solid var(--line); white-space: nowrap;
}
.pill-ok    { background: var(--green-lt); color: var(--green-dk); border-color: transparent; }
.pill-warn  { background: var(--amber-lt); color: var(--amber-ink); border-color: transparent; }
.pill-bad   { background: var(--red-lt); color: var(--red); border-color: transparent; }
.pill-live  { background: var(--amber); color: #23180a; border-color: transparent; }
.pill-wait  { background: var(--soft); color: #475569; border-color: transparent; }
.pill-muted { background: transparent; }
.v-warn { color: var(--amber-ink); font-weight: 700; }
.v-bad  { color: var(--red); font-weight: 700; }

.team-chip {
  display: inline-block; min-width: 22px; text-align: center; font-style: normal;
  background: var(--green); color: #fff; border-radius: 6px;
  padding: 1px 7px; font-size: .76rem; font-weight: 700;
}
.team-chip.big { font-size: .95rem; padding: 3px 10px; }

/* ສີປະຈຳທີມ */
.team-A { --tc: var(--tA); }
.team-B { --tc: var(--tB); }
.team-C { --tc: var(--tC); }
.team-D { --tc: var(--tD); }
.team-dot { background: var(--tc, var(--muted)); }

/* =========================================================
   ແຖບ 24 ຊົ່ວໂມງ ແລະ ລາຍການກະ
   ========================================================= */
/* ---- ເສັ້ນເວລາ 24 ຊົ່ວໂມງ ---- */
.timeline { margin-bottom: 18px; }
.tl-track {
  position: relative; display: flex; gap: 4px;
  padding: 4px; background: var(--soft-2);
  border: 1px solid var(--line); border-radius: 12px;
}
.tl-seg {
  flex: 1; height: 40px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--line);
  display: grid; place-items: center; transition: transform .15s;
}
.tl-h { font-size: .74rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.tl-seg.on { background: var(--green); border-color: var(--green); }
.tl-seg.on .tl-h { color: #fff; font-weight: 700; }
.tl-seg.on.done { background: var(--ok); border-color: var(--ok); }
.tl-seg.on.live { background: var(--amber); border-color: var(--amber); }
.tl-seg.on.live .tl-h { color: #23180a; }
.tl-seg.now { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--amber); z-index: 2; }

.tl-now {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--red); border-radius: 2px; z-index: 3; pointer-events: none;
}
.tl-now::before {
  content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
}
.tl-scale {
  display: flex; justify-content: space-between;
  margin-top: 6px; font-size: .68rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- ລາຍການກະ ---- */
.shift-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }

@media (min-width: 620px) {
  .shift-list { grid-template-columns: repeat(2, 1fr); }
}
.shift-list li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 13px 15px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.sh-mark {
  width: 4px; align-self: stretch; min-height: 34px; flex: none;
  border-radius: 99px; background: var(--line);
}
.shift-list li.is-done  .sh-mark { background: var(--ok); }
.shift-list li.is-live  .sh-mark { background: var(--amber); }
.shift-list li.is-leave { opacity: .6; }
.shift-list li.is-live  { border-color: var(--amber); background: var(--amber-lt); }

.sh-main { flex: 1; min-width: 150px; }
.sh-time {
  display: block; font-size: 1rem; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em;
}
.sh-name { display: block; font-style: normal; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.sh-name b { color: var(--green); }
.sh-stat { margin-left: auto; }

/* =========================================================
   ສະຖິຕິ
   ========================================================= */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 8px; }

.stat {
  background: #ffffff; /* ປ່ຽນເປັນສີຂາວ */
  border-radius: var(--radius-sm); 
  padding: 13px;
  text-align: center; 
  border: 1px solid var(--line, #e2e8f0);
  
  /* ເພີ່ມ shadow ໃຫ້ກ່ອງເບິ່ງນູນລອຍຂຶ້ນມາ */
  box-shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.06), 
              0 2px 4px -1px rgba(15, 23, 42, 0.04);
  
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Effect ເວລາ Mouse Hover ໃຫ້ລອຍຂຶ້ນເລັກນ້ອຍ */
.stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px -4px rgba(15, 23, 42, 0.1);
}

.stat b { display: block; font-size: 1.5rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .78rem; color: var(--muted); font-weight: 600; }

.stat { position: relative; overflow: hidden; }
.stat::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--line);
}
.stat.ok::before   { background: var(--green); }
.stat.warn::before { background: var(--amber); }
.stat.bad::before  { background: var(--red); }

/* ກ່ອງເຕືອນ / ສະຖານະຕ່າງໆ */
.stat.warn { background: var(--amber-lt); border-color: rgba(245, 158, 11, 0.2); } 
.stat.warn b { color: var(--amber-ink); }

.stat.bad  { background: var(--red-lt); border-color: rgba(239, 68, 68, 0.2); }   
.stat.bad b  { color: var(--red); }

.stat.ok   { background: var(--green-lt); border-color: rgba(34, 197, 94, 0.2); } 
.stat.ok b   { color: var(--green-dk); }

/* =========================================================
   ຕາຕະລາງ
   ========================================================= */
.table-scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .89rem; }

/* 1. ປັບ Padding ເທິງ-ລຸ່ມ ຫຼຸດຈາກ 9px ເຫຼືອ 5px ເພື່ອໃຫ້ຕາຕະລາງຮັດກຸມຂຶ້ນ */
.tbl th, .tbl td { 
  padding: 5px 10px; 
  text-align: left; 
  border-bottom: 1px solid var(--line); 
  vertical-align: middle; /* ແນມເຫັນຂໍ້ມູນຢູ່ເຄິ່ງກາງແນວຕັ້ງ */
}

.tbl thead th {
  font-size: .89rem;
  color: #111827;
  font-weight: 700;
  border-bottom: 2px solid var(--line); 
  white-space: nowrap;
  padding-top: 1px;    /* ຫຼຸດໄລຍະຫ່າງດ້ານເທິງຂອງຫົວຕາຕະລາງ */
  padding-bottom: 6px; /* ຫຼຸດໄລຍະຫ່າງດ້ານລຸ່ມຂອງຫົວຕາຕະລາງ */
}
.tbl tbody tr:hover { background: var(--soft-2); }
.tbl .row-off { opacity: .5; }
.tbl .row-on { background: var(--green-lt); }
.row-acts { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.row-acts form { display: inline; }
.decide-form { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

.tbl-grid td.cell { text-align: center; }
.tbl-grid .rowhead { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl-grid thead th i { display: block; font-style: normal; font-weight: 400; font-size: .68rem; }

/* ---- ຕາຕະລາງກະຂອງຮອບ ---- */
.sched-grid { font-size: .82rem; }
.sched-grid thead th { text-align: center; padding: 6px 4px; }
.sched-grid thead th b { display: block; font-size: .9rem; color: var(--ink); }
.sched-grid thead th i { color: var(--muted); }
.sched-grid thead th.is-today { background: var(--amber); border-radius: 8px 8px 0 0; }
.sched-grid thead th.is-today b, .sched-grid thead th.is-today i { color: #23180a; }
.sched-grid .corner { background: transparent; }
.sched-grid .rowhead {
  background: var(--soft); border-radius: 8px 0 0 8px; padding: 6px 10px;
}
.sched-grid td.cell { padding: 4px; vertical-align: middle; }
.sched-grid td.is-today { background: #FFF8E9; }

/* ---- ຊ່ອງທີມໃນຕາຕະລາງ: ພື້ນສີເຂັ້ມ ຕົວໜັງສືຂາວ ---- */
.cell-in {
  display: block; padding: 8px; border-radius: 8px; line-height: 1.3;
  background: var(--tc, var(--green));
  border-left: none;
  text-align: left;
}
.cell-in b {
  display: block; text-align: center; color: #fff;
  font-size: .95rem; font-weight: 700; letter-spacing: .02em;
}
.cell-names { display: block; margin-top: 4px; }

.cell-names span {
  display: block; font-size: .76rem; line-height: 1.45;
  color: #fff; font-weight: 600;
  text-shadow: 0 1px 2px rgba(0,0,0,.35);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sched-grid td.cell { min-width: 138px; padding: 3px; }

/* =========================================================
   ລາຍການຮອບຕາຕະລາງ
   ========================================================= */
.block-list { display: flex; flex-direction: column; gap: 9px; }
.blk {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 13px 15px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card);
}
.blk.on { border-color: var(--green); background: var(--green-lt); }
.blk.past { opacity: .62; }
.blk-no { text-align: center; min-width: 46px; flex: none; }
.blk-no b { display: block; font-size: 1.45rem; font-weight: 700; line-height: 1; }
.blk-no i { font-style: normal; font-size: .66rem; color: var(--muted); }
.blk-main { flex: 1; min-width: 190px; }
.blk-date { font-weight: 700; font-size: .96rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.blk-meta {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-top: 4px; font-size: .82rem; color: var(--muted);
}
.blk-acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.blk-acts form { display: inline; }

/* =========================================================
   ຄໍລຳທີມ ແລະ ສະມາຊິກ
   ========================================================= */
.team-cols { display: grid; grid-template-columns: 1fr; gap: 11px; margin-bottom: 6px; }
.team-col { border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.team-col.is-rest { opacity: .72; }

.tc-head {
  background: var(--tc, var(--green));
  border-bottom: none;
}
.tc-head b, .tc-head span { color: #fff; }
.tc-head span { opacity: .85; }

.tc-head b { color: var(--tc, var(--green)); }
.tc-head span { font-size: .76rem; color: var(--muted); }
.tc-body { padding: 9px; display: flex; flex-direction: column; gap: 7px; }
.tc-body .empty { padding: 10px; font-size: .84rem; }

.member-grid { display: grid; grid-template-columns: 1fr; gap: 9px; margin-bottom: 14px; }
.member {
  display: flex; align-items: center; gap: 10px; background: var(--soft);
  padding: 8px 11px; border-radius: var(--radius-sm);
}
.member > span { flex: 1; font-size: .9rem; }
.member i { display: block; font-style: normal; font-size: .74rem; color: var(--muted); }
.member select {
  width: 130px; padding: 6px 9px; font-family: inherit; font-size: .86rem;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}

/* =========================================================
   ປະຕິທິນ
   ========================================================= */
.cal { display: grid; grid-template-columns: 1fr; gap: 6px; }
.cal-day {
  display: flex; gap: 12px; align-items: center;
  padding: 9px 11px; border-radius: var(--radius-sm); background: var(--soft);
  border-left: 3px solid transparent;
}
.cal-day.today { border-left-color: var(--amber); background: #FFF8E9; }
.cal-day.off { opacity: .65; }
.cal-date { min-width: 42px; text-align: center; }
.cal-date b { display: block; font-size: 1.1rem; line-height: 1.1; }
.cal-date i { font-style: normal; font-size: .68rem; color: var(--muted); }
.cal-body { display: flex; gap: 6px; flex-wrap: wrap; }
.cal-off { color: var(--muted); font-size: .85rem; }
.cal-shift {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: 9px; padding: 8px 12px; font-size: .84rem;
  font-variant-numeric: tabular-nums; min-width: 200px; width: 100%;
}
.cal-shift > span:first-child { display: flex; align-items: baseline; gap: 6px; font-weight: 600; flex-wrap: wrap; }
.cal-shift i {
  font-style: normal; color: #fff; font-weight: 700; font-size: .72rem;
  background: var(--green); border-radius: 6px; padding: 1px 7px;
}
.cal-shift em {
  font-style: normal; color: var(--muted); font-weight: 500; font-size: .76rem;
  margin-left: 2px;
}
.cs-status {
  font-style: normal; font-weight: 700; font-size: .68rem;
  letter-spacing: .01em; padding: 3px 10px; border-radius: 999px;
  background: var(--soft); color: var(--muted); flex: none;
}
.cal-shift.is-plan   { border-left-color: var(--line); }
.cal-shift.is-plan   .cs-status { background: var(--soft); color: var(--muted); }
.cal-shift.is-done   { background: var(--green-lt); border-color: transparent; border-left-color: var(--ok); }
.cal-shift.is-done   .cs-status { background: var(--ok); color: #fff; }
.cal-shift.is-live   { background: var(--amber-lt); border-color: transparent; border-left-color: var(--amber); }
.cal-shift.is-live   .cs-status { background: var(--amber); color: #23180a; }
.cal-shift.is-leave  { background: var(--soft); color: #475569; border-left-color: #94a3b8; }
.cal-shift.is-leave  .cs-status { background: #94a3b8; color: #fff; }
.cal-shift.is-missed { background: var(--red-lt); border-color: transparent; border-left-color: var(--red); }
.cal-shift.is-missed .cs-status { background: var(--red); color: #fff; }

.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; font-size: .78rem; color: var(--muted); }
.lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }
.lg-plan  { background: var(--card); border: 1px solid var(--line); }
.lg-done  { background: var(--green-lt); }
.lg-live  { background: var(--amber); }
.lg-leave  { background: var(--soft); }
.lg-missed { background: var(--red-lt); border: 1px solid var(--red); }

/* =========================================================
   ກຣາຟແທ່ງ
   ========================================================= */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.bar-col {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; gap: 4px;
}
.bar { width: 100%; max-width: 26px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 3px; }
.bar-late { background: var(--amber); }
.bar-col i { font-style: normal; font-size: .62rem; color: var(--muted); }

/* =========================================================
   ຕົວເລືອກແບບກາດ (ໜ້າຕັ້ງຄ່າ)
   ========================================================= */
.opt-grid { display: grid; grid-template-columns: 1fr; gap: 9px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start; cursor: pointer;
  padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); transition: border-color .15s, background .15s;
}
.opt:hover { border-color: var(--green); }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-mark {
  width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--line);
  flex: none; margin-top: 2px; display: grid; place-items: center;
}
.opt-mark::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: transparent; }
.opt.on { border-color: var(--green); background: var(--green-lt); }
.opt.on .opt-mark { border-color: var(--green); }
.opt.on .opt-mark::after { background: var(--green); }
.opt-body { display: block; }
.opt-t { display: block; font-weight: 700; font-size: .95rem; }
.opt-tag {
  font-style: normal; font-size: .68rem; font-weight: 700; margin-left: 7px;
  background: var(--amber); color: #23180a; padding: 1px 8px; border-radius: 999px;
  vertical-align: 2px;
}
.opt-d { display: block; color: var(--muted); font-size: .83rem; margin-top: 2px; }

.panel {
  margin-top: 16px; padding: 15px; border-radius: var(--radius-sm);
  background: var(--soft-2); border: 1px solid var(--line);
}
.panel.is-off { display: none; }
.panel-t { margin: 0 0 12px; font-size: .88rem; font-weight: 700; color: var(--muted); }
.panel .fld input, .panel .fld textarea { background: var(--card); }
.inline-act { flex-direction: row; align-items: center; gap: 12px; flex-wrap: wrap; }

.ip-now {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 11px; padding: 9px 12px; background: var(--card);
  border: 1px dashed var(--line); border-radius: var(--radius-sm); font-size: .85rem;
}
.ip-now span { color: var(--muted); }
.ip-now b { font-size: .95rem; }

/* =========================================================
   ອື່ນໆ
   ========================================================= */
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-label { font-weight: 700; min-width: 130px; text-align: center; }

.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  padding: 7px 14px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--muted); font-size: .87rem; white-space: nowrap;
}
.tabs a:hover { text-decoration: none; border-color: var(--green); color: var(--green); }
.tabs a.on { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }

.shift-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.shift-box { background: var(--soft); border-radius: var(--radius-sm); padding: 11px 13px; }
.sb-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 7px; }
.sb-head b { font-variant-numeric: tabular-nums; }
.sb-head span { color: var(--muted); font-size: .8rem; }
.shift-box ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.shift-box li { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.sb-name { flex: 1; }

.leave-mini { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.leave-mini li {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
  background: var(--soft); padding: 9px 12px; border-radius: var(--radius-sm); font-size: .9rem;
}

.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif-list li { display: flex; gap: 11px; padding: 11px 12px; border-radius: var(--radius-sm); background: var(--soft); }
.notif-list li.unread { background: var(--green-lt); }
.nf-icon { font-size: 1.15rem; }
.nf-body b { display: block; font-size: .95rem; }
.nf-body p { margin: 3px 0; font-size: .88rem; color: var(--muted); }
.nf-body i { font-style: normal; font-size: .74rem; color: var(--muted); }

.kv { margin: 0; display: grid; gap: 8px; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px dashed var(--line); padding-bottom: 7px;
}
.kv dt { color: var(--muted); font-size: .87rem; margin: 0; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* =========================================================
   ແຖບລຸ່ມ (ມືຖື)
   ========================================================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 14px rgba(15,23,42,.06);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px 6px; color: var(--muted); font-size: .68rem; position: relative;
}
.tabbar a:hover { text-decoration: none; }
.tabbar a.on { color: var(--green); font-weight: 700; }
.tabbar svg { width: 22px; height: 22px; }
.tabdot {
  position: absolute; top: 6px; right: calc(50% - 14px);
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber);
}

/* =========================================================
   ຈໍໃຫຍ່ (Desktop & Tablet)
   ========================================================= */
@media (min-width: 768px) {
  body { font-size: 15.5px; }
  .topnav { display: flex; }
  .who { display: block; }
  .tabbar { display: none; }
  .wrap { padding-bottom: 40px; }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .fld-wide { grid-column: 1 / -1; }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .cal { grid-template-columns: repeat(2, 1fr); }
  .shift-grid { grid-template-columns: repeat(3, 1fr); }
  .member-grid { grid-template-columns: repeat(2, 1fr); }
  .team-cols { grid-template-columns: repeat(2, 1fr); }
  .opt-grid { grid-template-columns: repeat(2, 1fr); }
  .sticky-actions { position: static; }
  .save-bar { position: static; box-shadow: none; }
  .alert-row { grid-template-columns: repeat(2, 1fr); }
  .hl-row { grid-template-columns: 1.6fr 1fr; }
  .mini-stat-grid { grid-template-columns: repeat(5, 1fr); }
  .mstat { flex-direction: column; text-align: center; padding: 14px 8px; }
}

@media (min-width: 1040px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
  .cal { grid-template-columns: repeat(3, 1fr); }
  .member-grid { grid-template-columns: repeat(4, 1fr); }
  .team-cols { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   ມືຖື (Mobile Style)
   ========================================================= */
@media (max-width: 620px) {
  .card { padding: 14px; }
  .table-scroll { margin: 0 -14px; padding: 0 14px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }

  .tbl tr {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    padding: 14px 16px;
    box-shadow: var(--shadow);
  }
  .tbl tbody tr:hover { background: var(--card); }

  .tbl td {
    border: none;
    border-bottom: 1px solid var(--soft);
    padding: 9px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: .92rem;
    font-weight: 600;
    color: var(--ink);
    text-align: right;
  }
  .tbl td:last-child { border-bottom: none; padding-top: 12px; }
  .tbl td:empty { display: none; }

  .tbl td::before {
    content: attr(data-l);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
    flex: none;
    text-align: left;
  }

  .tbl td[data-l="ລຳດັບ"] {
    font-size: .8rem;
    color: var(--green);
    font-weight: 700;
    padding-top: 0;
  }

  .tbl td:not([data-l]) {
    justify-content: flex-end;
    padding-top: 12px;
  }
  .tbl td:not([data-l])::before { content: none; }

  /* ຕາຕະລາງກະ */
  .tbl-grid { font-size: .76rem; }
  .tbl-grid thead { display: table-header-group; }
  .tbl-grid, .tbl-grid tbody, .tbl-grid tr, .tbl-grid td { display: revert; }
  .tbl-grid tr { background: none; padding: 0; margin: 0; box-shadow: none; border: none; }
  .tbl-grid td { border-bottom: 1px solid var(--line); padding: 5px 3px; }
  .tbl-grid td::before { content: none; }

  .blk {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 16px;
  }
  .blk-no {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: 6px;
    text-align: left;
    min-width: 0;
  }
  .blk-no b { font-size: 1.1rem; }
  .blk-no i { font-size: .74rem; }
  .blk-main { min-width: 0; }
  .blk-date {
    font-size: 1.05rem;
    gap: 6px;
  }
  .blk-meta {
    gap: 8px 12px;
    margin-top: 6px;
    font-size: .8rem;
  }
  .blk-acts {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--line);
  }
  .blk-acts .btn,
  .blk-acts form { width: 100%; }
  .blk-acts .btn { width: 100%; }
  .save-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .save-bar .btn { width: 100%; }

  /* UI ມືຖືອື່ນໆ */
  .page-head {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .page-head h1 {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---- ຄຳທັກທາຍ (ໜ້າຫຼັກ) ---- */
  .greet {
    flex-wrap: nowrap;
    gap: 10px;
    align-items: center;
  }
  .greet > div:first-child {
    min-width: 0;
    flex: 1;
  }
  .greet-hi {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .greet-name {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .greet-block {
    flex: none;
    padding: 8px 14px;
  }
  .greet-block span { font-size: .78rem; }
  .greet-block i { font-size: .64rem; white-space: nowrap; }
  .month-nav {
    flex: none;
    gap: 4px;
  }
  .month-label {
    min-width: 0;
    font-size: .82rem;
    white-space: nowrap;
  }
  .stat-grid { gap: 10px; }
  .stat { padding: 15px 10px; }
  .stat b { font-size: 1.7rem; }

  /* ---- ບັດວັນທີ່ໃນປະຕິທິນ (ຕາຕະລາງກະຂອງຂ້ອຍ) ---- */
  .cal-day { align-items: flex-start; }

  .cal-shift {
    min-width: 0;
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 7px 10px;
    font-size: .78rem;
  }
  .cal-shift > span:first-child {
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    gap: 4px;
  }
  .cal-shift > span:first-child > span:first-of-type {
    flex: none;
    white-space: nowrap;
  }
  .cal-shift i {
    flex: none;
    white-space: nowrap;
    font-size: .7rem;
  }
  .cal-shift em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .7rem;
  }
  .cs-status {
    flex: none;
    font-size: .62rem;
    padding: 3px 7px;
  }

  .greet-name { font-size: 1.15rem; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .quick { padding: 12px 4px; font-size: .72rem; }
  .q-ico { font-size: 1.25rem; }
  .week-strip { gap: 6px; }
  .wd { flex: 0 0 68px; min-width: 68px; }
  .wd-shift { font-size: .62rem; padding: 3px 2px; }
  .wd-head b { font-size: .92rem; }

  .pager { gap: 4px; }
  .pg { min-width: 34px; height: 34px; padding: 0 8px; font-size: .82rem; }

  /* Modal ມືຖື */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box { max-width: none; max-height: 92dvh; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; }

  /* 💡 ແກ້ໄຂ: ໃຫ້ລາຍຊື່ສະແດງໃນມືຖື ແຕ່ປັບຂະໜາດໃຫ້ສະອາດຕາ */
  .sched-grid .cell-in .cell-names {
    display: block !important;
    margin-top: 3px;
  }
  .sched-grid .cell-in .cell-names span {
    font-size: .65rem !important;
    line-height: 1.2;
  }

  /* ---- ບັດບັນທຶກເວລາ (Attendance card) ---- */
  .tbl-att tr {
    padding: 0;
    overflow: hidden;
    border-left: 4px solid var(--line);
  }
  .tbl-att tr:has(.pill-ok)   { border-left-color: var(--ok); }
  .tbl-att tr:has(.pill-warn) { border-left-color: var(--amber); }
  .tbl-att tr:has(.pill-bad)  { border-left-color: var(--red); background: var(--red-lt); }
  .tbl-att tr:has(.pill-wait) { border-left-color: var(--muted); }

  .tbl-att td[data-l="ພະນັກງານ"] {
    background: var(--soft-2);
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
  }
  .tbl-att td[data-l="ພະນັກງານ"]::before { content: none; }
  .tbl-att td[data-l="ພະນັກງານ"] i { display: block; margin-top: 2px; font-size: .78rem; color: var(--muted); font-weight: 600; }

  .tbl-att td { padding: 8px 16px; }
  .tbl-att td[data-l="ວັນທີ"] { font-weight: 700; color: var(--ink); }
  .tbl-att td[data-l="ກະ"] { font-weight: 700; color: var(--green-dk); }

  .tbl-att td[data-l="ກະ"]::before,
  .tbl-att td[data-l="ເຂົ້າ"]::before,
  .tbl-att td[data-l="ອອກ"]::before,
  .tbl-att td[data-l="ສະຖານະ"]::before {
    color: var(--ink);
    font-size: .92rem;
    font-weight: 600;
  }

  .tbl-att td[data-l="ຊົ່ວໂມງ"] { font-weight: 700; }
  .tbl-att td[data-l="ຊ້າ"]:not(:empty) { color: var(--amber-ink); font-weight: 700; }

  .tbl-att td[data-l="ວິທີ"] {
    align-items: flex-start;
    text-align: right;
    font-size: .84rem;
  }
  .tbl-att td[data-l="ວິທີ"] i { display: block; margin-top: 2px; }

  .tbl-att td[data-l="ຊ້າ"],
  .tbl-att td[data-l="ຊົ່ວໂມງ"],
  .tbl-att td[data-l="ວິທີ"] { display: none; }

  .tbl-att td[data-l="ສະຖານະ"] {
    padding-top: 12px; padding-bottom: 12px;
    border-top: 1px dashed var(--line);
  }

  .tbl-att td:not([data-l]) {
    padding: 12px 16px 14px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .tbl-att td:not([data-l]) form,
  .tbl-att td:not([data-l]) button {
    width: 100%;
  }
}

/* ---- ຂໍ້ຄວາມສະຫຼຸບຊ່ວງວັນທີ ---- */
.range-note {
  margin: 0; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--green-lt); color: var(--green-dk); font-size: .86rem; font-weight: 600;
}
.range-note:empty { display: none; }

/* ---- ຊ່ອງເລືອກສະມາຊິກ ---- */
.slot { display: flex; }
.slot select {
  width: 100%; padding: 9px 10px; font-family: inherit; font-size: .86rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink);
}
.slot select:focus {
  border-color: var(--green); box-shadow: 0 0 0 3px rgba(13,110,253,.15); outline: none;
}
.tc-add { margin: 0 9px 10px; width: calc(100% - 18px); border-style: dashed; }

/* ---- ຫົວທີມ ---- */
.tc-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding: 9px 12px;
  background: var(--tc, var(--green));
  border-bottom: none;
}
.tc-head b { color: #fff; font-size: .95rem; }
.tc-head span { color: #fff; font-size: .76rem; opacity: .85; }

/* ---- ຊ່ອງທີມໃນຕາຕະລາງກະ ---- */
.sched-grid td.cell { min-width: 140px; padding: 3px; }
.sched-grid .cell-in {
  display: block; padding: 8px 9px; border-radius: 8px;
  background: var(--tc, #1E3A8A); border-left: none;
  text-align: center;
}
.sched-grid .cell-in b {
  display: block; text-align: center;
  color: #ffffff !important;
  font-size: .98rem; font-weight: 700; letter-spacing: .03em;
}
.sched-grid .cell-in .cell-names { display: block; margin-top: 5px; }
.sched-grid .cell-in .cell-names span {
  display: block; text-align: center;
  color: #ffffff !important;
  font-size: .77rem; font-weight: 600; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sec-head-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; flex-wrap: wrap;
}
.sec-head-row .card-title { margin: 0; }
.sec-head-row .sec-sub { margin: 0; }

.sched-grid .rowhead { text-align: center; line-height: 1.3; }
.sched-grid .rowhead b { display: block; font-size: .86rem; font-weight: 700; }
.sched-grid .rowhead i {
  display: block; font-style: normal; font-size: .68rem;
  font-weight: 400; color: var(--muted);
}

/* ---- ແຖວປຸ່ມການກະທຳ ---- */
.action-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}

/* ---- ປ໋ອບອັບ (Modal) ---- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal[hidden] { display: none; }
.modal-back { position: absolute; inset: 0; background: rgba(15,23,42,.55); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; width: 100%; max-width: 640px;
  max-height: 90dvh; overflow-y: auto;
  background: var(--card); border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(15,23,42,.35);
  animation: pop .16s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal-box { animation: none; } }

.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--card); border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h2 { margin: 0 0 3px; font-size: 1.08rem; }
.modal-x {
  border: none; background: var(--soft); color: var(--muted); cursor: pointer;
  width: 32px; height: 32px; border-radius: 50%; font-size: 1rem; flex: none;
  display: grid; place-items: center; font-family: inherit;
}
.modal-x:hover { background: var(--line); color: var(--ink); }

.modal-body { padding: 18px 20px; }

.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  padding-top: 14px; border-top: 1px solid var(--line); margin-top: 4px;
}

.head-acts { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- ແບ່ງໜ້າ ---- */
.pager {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  flex-wrap: wrap; margin-top: 16px; padding-top: 14px;
  border-top: 1px solid var(--line);
}
.pg {
  min-width: 38px; height: 38px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--card); color: var(--ink);
  font-size: .88rem; font-weight: 600; text-decoration: none;
}
a.pg:hover { border-color: var(--green); color: var(--green); text-decoration: none; }
.pg.on { background: var(--green); border-color: var(--green); color: #fff; }
.pg.off { color: var(--line); cursor: not-allowed; }
.pg.dots { border: none; background: none; color: var(--muted); min-width: 20px; padding: 0; }

/* ---- ຄຳທັກທາຍ ---- */
.greet {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dk) 100%);
  color: #fff;
  padding: 24px 20px 26px;
  margin: -18px -20px 0;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(10,76,180,.25);
}
.greet-hi { margin: 0; color: rgba(255,255,255,.75); font-size: .88rem; }
.greet-name { margin: 4px 0 0; font-size: 1.4rem; color: #fff; letter-spacing: -.01em; }
.greet-block {
  text-align: center; padding: 9px 20px; border-radius: 10px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
}
.greet-block span { display: block; font-size: .85rem; font-weight: 700; }
.greet-block i { display: block; font-style: normal; font-size: .72rem; opacity: .85; margin-top: 2px; }

/* ---- ນັບຖອຍຫຼັງ ---- */
.countdown {
  margin: 12px auto 0; padding: 9px 18px; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: .9rem;
  display: flex; gap: 7px; align-items: center; justify-content: center;
  flex-wrap: wrap; width: fit-content;
}
.countdown b { color: var(--ink); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.countdown.warn { background: var(--green-lt); color: var(--green-dk); font-weight: 600; }
.countdown.warn b { color: var(--green-dk); }

/* ---- ຄວາມຄືບໜ້າຂອງກະ ---- */
.shift-progress { margin: 18px auto 0; max-width: 420px; }
.sp-bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.sp-bar span {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--green), var(--amber));
  border-radius: 99px; transition: width .6s ease;
}
.sp-info {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 7px; font-size: .78rem; color: var(--muted);
}
.sp-info b { color: var(--ink); }
#spLeft { font-weight: 700; color: var(--green); }

/* ---- ແຖບແຈ້ງເຕືອນສຳຄັນ ---- */
.alert-row { display: grid; grid-template-columns: 1fr; gap: 99px; }
.alert {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 15px; border-radius: var(--radius-sm);
  background: var(--amber-lt); color: var(--amber-ink);
  border: 1px solid rgba(138,91,0,.2); font-size: .9rem;
}
.alert:hover { text-decoration: none; filter: brightness(.98); }
.alert.ok { background: var(--green-lt); color: var(--green-dk); border-color: rgba(13,110,253,.2); }
.al-icon { font-size: 1.15rem; }

/* ---- ປຸ່ມທາງລັດ ---- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.quick {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 15px 8px; border-radius: var(--radius-sm);
  background: var(--card); border: 1px solid var(--line);
  color: var(--ink); font-size: .8rem; font-weight: 600; text-align: center;
  box-shadow: var(--shadow);
}
.quick:hover { text-decoration: none; border-color: var(--green); color: var(--green); }
.q-ico { font-size: 1.4rem; }
.q-dot {
  position: absolute; top: 8px; right: 12px; font-style: normal;
  background: var(--amber); color: #23180a; font-size: .62rem; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
  display: grid; place-items: center;
}

/* ---- 7 ວັນຂ້າງໜ້າ ---- */
.week-strip { 
  display: flex; 
  gap: 8px; 
  overflow-x: auto; /* ເປີດໃຫ້ Scroll ແນວນອນໃນ Mobile */
  padding-bottom: 6px; 
  -webkit-overflow-scrolling: touch; /* ເຮັດໃຫ້ Scroll ໃນ iOS ລື່ນ */
  scroll-snap-type: x mandatory; 
}

/* ເຮັດໃຫ້ Scrollbar ງາມຕາ */
.week-strip::-webkit-scrollbar { height: 4px; }
.week-strip::-webkit-scrollbar-thumb { background: var(--line, #cbd5e1); border-radius: 4px; }

.wd {
  flex: 0 0 calc((100% - 48px) / 7); /* ໃນ PC ແບ່ງ 7 ວັນພໍດີ */
  min-width: 72px;                   /* ໃນ Mobile ບັງຄັບຂະໜາດຂັ້ນຕ່ຳ ບໍ່ໃຫ້ຖືກບີບ */
  border: 1px solid var(--line); 
  border-radius: var(--radius-sm);
  overflow: hidden; 
  text-align: center; 
  background: var(--card);
  transition: transform .15s, box-shadow .15s;
  scroll-snap-align: start;
}

.wd.off { opacity: .68; }
.wd.leave { opacity: 1; }
.wd.today {
  border-color: var(--green); 
  box-shadow: 0 4px 14px rgba(13,110,253,.22);
  transform: translateY(-2px);
}

.wd-head { padding: 9px 4px 7px; background: var(--soft-2); position: relative; }
.wd.today .wd-head { background: linear-gradient(160deg, var(--green), var(--green-dk)); }
.wd-head i {
  display: block; font-style: normal; font-size: .68rem;
  color: var(--muted); letter-spacing: .02em;
}
.wd.today .wd-head i { color: rgba(255,255,255,.8); font-weight: 600; }
.wd-head b {
  display: block; font-size: 1.3rem; font-weight: 700;
  line-height: 1.3; font-variant-numeric: tabular-nums;
}
.wd.today .wd-head b { color: #fff; }
.wd-head em {
  display: block; font-style: normal; font-size: .6rem; font-weight: 700;
  color: #fff; background: rgba(255,255,255,.22);
  border-radius: 999px; padding: 1px 8px; margin: 3px auto 0; width: fit-content;
}

.wd-body {
  padding: 10px 4px 12px; 
  display: flex; 
  flex-direction: column;
  gap: 5px; 
  align-items: center; 
  justify-content: center; 
  min-height: 64px;
}
.wd-ico { font-size: 1.15rem; line-height: 1; }

.wd-shift {
  display: block; 
  font-size: .68rem; /* ປັບຂະໜາດຟອນເວລາໃຫ້ພໍດີກັບກ່ອງ */
  font-weight: 700;
  background: var(--green-lt); 
  color: var(--green-dk);
  border-radius: 6px; 
  padding: 4px 2px; 
  width: 100%;
  font-variant-numeric: tabular-nums; 
  letter-spacing: -.02em;
  white-space: nowrap; /* ປ້ອງກັນບໍ່ໃຫ້ເວລາພັນແຖວ */
}
.wd.today .wd-shift { background: var(--card); border: 1px solid rgba(13,110,253,.35); }
.wd-team { font-size: .64rem; font-weight: 700; color: var(--muted); letter-spacing: .02em; }
.wd-tag { font-size: .74rem; color: var(--muted); font-weight: 500; }
.wd-tag.leave { color: var(--red); font-weight: 700; }
/* ---- ຈຸດເດັ່ນ: ອັດຕາ + ຊົ່ວໂມງລວມ ---- */
.hl-row { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 18px; }
.hl-box {
  border-radius: var(--radius-sm); padding: 16px 18px;
  border: 1px solid var(--line); background: var(--soft-2);
}
.rate-box .rate-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.rate-top span { font-size: .86rem; color: var(--muted); font-weight: 600; }
.rate-top b { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-bar { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.rate-bar span { display: block; height: 100%; border-radius: 99px; transition: width .6s ease; }
.good { color: var(--ok); } .rate-bar .good { background: var(--ok); }
.mid  { color: var(--amber-ink); } .rate-bar .mid { background: var(--amber); }
.low  { color: var(--red); } .rate-bar .low { background: var(--red); }
.rate-box .subtle { margin: 9px 0 0; font-size: .8rem; }
.rate-box .subtle b { color: var(--ink); }

.hours-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; background: linear-gradient(160deg, var(--green-lt), var(--soft-2));
  border-color: rgba(13,110,253,.18);
}
.hb-ico { font-size: 1.3rem; margin-bottom: 2px; }
.hours-box b {
  font-size: 2rem; font-weight: 700; color: var(--green-dk);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.hours-box b i { font-style: normal; font-size: .5em; font-weight: 600; margin-left: 3px; }
.hours-box > span { font-size: .8rem; color: var(--muted); margin-top: 3px; }

/* ---- ລາຍລະອຽດ 5 ຢ່າງ ---- */
.mini-stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.mstat {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 13px; border-radius: var(--radius-sm);
  background: var(--soft); border: 1px solid transparent;
}
.ms-ico { font-size: 1.15rem; flex: none; }
.mstat div { display: flex; flex-direction: column; }
.mstat b { font-size: 1.15rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.mstat span { font-size: .74rem; color: var(--muted); }
.mstat.warn { background: var(--amber-lt); } .mstat.warn b { color: var(--amber-ink); }
.mstat.bad  { background: var(--red-lt); }   .mstat.bad b  { color: var(--red); }
.mstat.ok   { background: var(--green-lt); } .mstat.ok b   { color: var(--green-dk); }

/* ---- ໝາຍກະຂອງຕົນເອງ ---- */
.sched-grid .cell-in.is-mine {
  outline: 3px solid var(--amber); outline-offset: -3px;
  position: relative;
}
.sched-grid .cell-in.is-mine::after {
  content: "★"; position: absolute; top: 2px; right: 4px;
  color: var(--amber); font-size: .7rem;
}
.lg-mine { background: transparent; border: 3px solid var(--amber); }

/* ---- ແຖວທີມພັກ ---- */
.rest-row { background: var(--soft-2); }
.rest-label { color: var(--muted); }
.sched-grid .cell-in.cell-rest {
  background: var(--soft) !important;
  border-left-color: var(--line) !important;
}
.sched-grid .cell-in.cell-rest b { color: var(--muted) !important; }
.sched-grid .cell-in.cell-rest .cell-names span { color: var(--muted) !important; }
.lg-rest {
  background: repeating-linear-gradient(135deg, var(--muted) 0 3px, transparent 3px 6px);
  opacity: .55; border: none;
}
.legend-note { margin-top: 8px; }

.cal-shift em { display: block; font-style: normal; font-size: .68rem; color: var(--muted); margin-top: 2px; }
.today-tag {
  font-style: normal; font-size: .68rem; font-weight: 700;
  color: var(--amber-ink); background: var(--amber-lt);
  border-radius: 999px; padding: 2px 9px; margin-left: 7px;
}

/* ---- ແຖບສະຫຼຸບຂໍ້ມູນ (Summary Bar) ---- */
.summary-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow);
}
.sb-label { font-size: .86rem; font-weight: 700; color: var(--ink); white-space: nowrap; }
.sb-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sb-form input[type="date"] {
  padding: 6px 9px; font-size: .84rem; border: 1px solid var(--line);
  border-radius: 7px; background: var(--soft-2); color: var(--ink); font-family: inherit;
}
.sb-to { font-size: .8rem; color: var(--muted); }
.sb-acts { display: flex; gap: 6px; margin-left: auto; }

@media (max-width: 768px) {
  .summary-bar { flex-direction: column; align-items: stretch; }
  .sb-label { text-align: center; }
  .sb-form { justify-content: center; }
  .sb-acts { margin-left: 0; justify-content: center; }
}
/* Custom Summary Modern Grid Layout */
.stat-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.summary-hero-box {
  background: var(--bg-surface, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 12px;
  padding: 1.25rem;
}

.shb-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.shb-title {
  font-weight: 600;
  color: #475569;
}

.shb-badge {
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
}
.shb-badge.good { color: #16a34a; background: #dcfce7; }
.shb-badge.mid  { color: #d97706; background: #fef3c7; }
.shb-badge.low  { color: #dc2626; background: #fee2e2; }

.shb-progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.shb-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.shb-fill.good { background: #16a34a; }
.shb-fill.mid  { background: #d97706; }
.shb-fill.low  { background: #dc2626; }

.shb-sub {
  font-size: 0.875rem;
  color: #64748b;
}

/* Metric Cards Grid Layout */
.summary-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.mstat-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mstat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.ms-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  background: #f1f5f9;
  flex-shrink: 0;
}

/* Highlights Alert State */
.mstat-card.is-warning { border-color: #fcd34d; background: #fffbeb; }
.mstat-card.is-danger  { border-color: #fca5a5; background: #fef2f2; }
.mstat-card.is-success { border-color: #86efac; background: #f0fdf4; }

.ms-content {
  display: flex;
  flex-direction: column;
}

.ms-val {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
}

.ms-val small {
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
}

.ms-lbl {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 2px;
}
.ms-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

/* ສີໄອຄອນແຍກຕາມປະເພດ */
.ms-icon-wrap.primary { background: #eff6ff; color: #2563eb; } /* ສີຟ້າ */
.ms-icon-wrap.success { background: #f0fdf4; color: #16a34a; } /* ສີຂຽວ */
.ms-icon-wrap.warning { background: #fffbeb; color: #d97706; } /* สีน້ຳຕານ/ເຫຼືອງ */
.ms-icon-wrap.danger  { background: #fef2f2; color: #dc2626; } /* ສີແດງ */
.ms-icon-wrap.info    { background: #f0f9ff; color: #0284c7; } /* ສີຟ້າອ່ອນ */
.ms-icon-wrap.accent  { background: #faf5ff; color: #9333ea; } /* ສີມ່ວງ */

/* ເອັບເຟັກຕອນ Hover */
.mstat-card:hover .ms-icon-wrap {
  transform: scale(1.08);
}

/* =========================================================
   ພິມ / PDF
   ========================================================= */
@media print {
  .topbar, .subbar, .tabbar, .filter-bar, .tabs,
  .btn, .form-actions, .save-bar { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; }
  .wrap { padding: 0; max-width: none; gap: 10px; }
  .table-scroll { overflow: visible; margin: 0; padding: 0; }
  .tbl { font-size: .8rem; }
}