/* =====================================================================
   Traffic Management Center · Design System
   โทน: Indigo / Violet gradient · Navy sidebar · Lavender background
   ===================================================================== */
:root {
  --bg: #f3f1fc;
  --bg-2: #e9e6fb;
  --surface: #ffffff;
  --surface-2: #f8f7fe;
  --surface-3: #f1effd;
  --ink: #15183a;
  --ink-2: #4a4f78;
  --ink-3: #8c90b2;
  --line: #e7e5f4;
  --line-2: #d9d6ef;

  --primary: #5b4cf5;
  --primary-2: #7c5cff;
  --primary-ink: #3a2fc4;
  --primary-soft: #eeecff;
  --grad: linear-gradient(135deg, #4f46e5 0%, #6d4df2 45%, #a855f7 100%);
  --grad-soft: linear-gradient(135deg, #eef0ff 0%, #f3ecff 100%);

  --navy: #151947;
  --navy-2: #1e2466;
  --navy-3: #2a3180;

  --success: #10b981; --success-soft: #dcfaee; --success-ink: #047857;
  --warn: #f59e0b;    --warn-soft: #fff3d6;    --warn-ink: #92400e;
  --danger: #ef4444;  --danger-soft: #ffe4e4;  --danger-ink: #b91c1c;
  --info: #3b82f6;    --info-soft: #e3edff;    --info-ink: #1d4ed8;
  --pink: #ec4899;    --pink-soft: #fde6f2;    --pink-ink: #be185d;

  --m: #0ea5e9; --m-soft: #dff3fe; --m-ink: #0369a1;   /* เช้า = ฟ้า */
  --a: #f97316; --a-soft: #ffead5; --a-ink: #c2410c;   /* บ่าย = ส้ม */
  --n: #6d3fe0; --n-soft: #ece4ff; --n-ink: #4c1d95;
  --o: #9ca3af; --o-soft: #f0f1f5; --o-ink: #6b7280;

  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 26px;
  --sh-sm: 0 1px 2px rgba(40, 30, 120, .06), 0 1px 1px rgba(40, 30, 120, .04);
  --sh: 0 12px 32px -14px rgba(60, 45, 170, .22), 0 2px 6px rgba(60, 45, 170, .05);
  --sh-lg: 0 30px 60px -20px rgba(55, 40, 160, .35), 0 8px 18px -8px rgba(55, 40, 160, .12);
  --sh-glow: 0 10px 30px -8px rgba(91, 76, 245, .55);

  --font: 'Noto Sans Thai', 'Prompt', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-d: 'Prompt', 'Noto Sans Thai', system-ui, sans-serif;
  --sb-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--ink);
  background: var(--bg); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-d); margin: 0; letter-spacing: -.01em; line-height: 1.3; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; }
::selection { background: #d9d3ff; }
.ic { flex-shrink: 0; display: inline-block; vertical-align: middle; }
[hidden] { display: none !important; }

/* ---------- พื้นหลังเคลื่อนไหว ---------- */
.bg-fx { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background:
  radial-gradient(1200px 600px at 100% -10%, #e4dcff 0%, transparent 60%),
  radial-gradient(900px 500px at -10% 110%, #dfe6ff 0%, transparent 60%), var(--bg); }
.bg-fx span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: float 18s ease-in-out infinite; }
.bg-fx span:nth-child(1) { width: 420px; height: 420px; background: #c7b8ff; top: -120px; right: 8%; }
.bg-fx span:nth-child(2) { width: 360px; height: 360px; background: #bcd2ff; bottom: -140px; left: 20%; animation-delay: -6s; animation-duration: 22s; }
.bg-fx span:nth-child(3) { width: 260px; height: 260px; background: #f5c6f0; top: 40%; right: -80px; animation-delay: -11s; opacity: .35; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, -30px) scale(1.08); } 66% { transform: translate(-30px, 25px) scale(.95); } }

/* ---------- ปุ่ม ---------- */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; cursor: pointer;
  font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--ink); background: var(--surface);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s, color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { color: #fff; background: var(--grad); background-size: 160% 160%; box-shadow: var(--sh-glow); }
.btn.primary:hover { background-position: 100% 0; box-shadow: 0 14px 34px -8px rgba(91, 76, 245, .65); }
.btn.soft { background: var(--primary-soft); color: var(--primary-ink); }
.btn.soft:hover { background: #e3dfff; }
.btn.ghost { background: transparent; border-color: var(--line-2); color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface); border-color: #c8c3ea; color: var(--ink); }
.btn.outline { background: var(--surface); border-color: var(--line); box-shadow: var(--sh-sm); }
.btn.danger { background: var(--danger-soft); color: var(--danger-ink); }
.btn.danger:hover { background: #ffd3d3; }
.btn.success { background: linear-gradient(135deg, #10b981, #14b8a6); color: #fff; box-shadow: 0 10px 26px -10px rgba(16, 185, 129, .6); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; gap: 5px; }
.btn.block { width: 100%; }
.btn.lg { height: 48px; font-size: 15px; border-radius: 14px; }
.btn .spinner { width: 16px; height: 16px; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: ripple .6s ease-out; pointer-events: none; }
@keyframes ripple { to { transform: scale(2.4); opacity: 0; } }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: #cfc8ff; transform: translateY(-1px); box-shadow: var(--sh); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.plain { border-color: transparent; background: transparent; }
.icon-btn.pin-on { color: var(--primary-ink); background: var(--primary-soft); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin-once { animation: spin .6s ease; }

/* ---------- ฟอร์ม ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .lbl { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, input[type=text], input[type=password], input[type=email], input[type=date], input[type=month], input[type=tel], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 13px; min-height: 42px; outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
select { appearance: none; padding-right: 36px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238c90b2' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 4px rgba(124, 92, 255, .15); }
.input-ic { position: relative; }
.input-ic > .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-ic > input { padding-left: 40px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }

.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d6d4e8; border-radius: 99px; cursor: pointer; transition: .25s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .25s var(--ease); box-shadow: 0 2px 4px rgba(0, 0, 0, .15); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }

.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: 12px; border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all .2s var(--ease); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-sm), 0 4px 12px -6px rgba(91, 76, 245, .4); }
.seg.swap-mode { display: flex; width: 100%; max-width: 480px; }
.seg.swap-mode button { flex: 1; justify-content: center; padding: 10px 14px; font-size: 14px; }
.seg.swap-mode .count { min-width: 20px; height: 20px; border-radius: 99px; padding: 0 6px; font-size: 11px; display: inline-grid; place-items: center; background: var(--danger, #ef4444); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; transition: all .2s var(--ease); white-space: nowrap; }
.chip:hover { border-color: #cbc4ff; color: var(--primary-ink); }
.chip.active { border-color: transparent; background: var(--grad); color: #fff; box-shadow: var(--sh-glow); }
.chip .cnt { background: rgba(0, 0, 0, .08); border-radius: 99px; padding: 0 7px; font-size: 11px; }
.chip.active .cnt { background: rgba(255, 255, 255, .25); }

/* ---------- การ์ด ---------- */
.card {
  background: var(--surface); border: 1px solid rgba(231, 229, 244, .9); border-radius: var(--r-lg);
  box-shadow: var(--sh); padding: 20px; position: relative; min-width: 0;
}
.card.flat { box-shadow: var(--sh-sm); }
.card.glass { background: rgba(255, 255, 255, .72); backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3); }
.card.hover { transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; font-weight: 400; font-family: var(--font); }
.card-head .link { font-size: 13px; font-weight: 600; color: var(--primary); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.h-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.bold { font-weight: 600; }
.tc { text-align: center; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-3); }
.empty .e-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center; background: var(--grad-soft); color: var(--primary-2); }
.empty b { display: block; color: var(--ink-2); font-size: 15px; margin-bottom: 2px; }

/* ---------- Badge ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.nodot::before { display: none; }
.b-pending { background: var(--warn-soft); color: var(--warn-ink); }
.b-approved { background: var(--success-soft); color: var(--success-ink); }
.b-rejected { background: var(--danger-soft); color: var(--danger-ink); }
.b-cancelled { background: var(--o-soft); color: var(--o-ink); }
.b-news { background: var(--primary-soft); color: var(--primary-ink); }
.b-alert { background: var(--warn-soft); color: var(--warn-ink); }
.b-incident { background: var(--danger-soft); color: var(--danger-ink); }
.b-hol { background: var(--pink-soft); color: var(--pink-ink); }
.b-team { background: var(--navy); color: #fff; font-family: var(--font-d); }
.role-admin { background: #ffe9d6; color: #b45309; }
.role-sup { background: var(--primary-soft); color: var(--primary-ink); }
.role-op { background: #dcf5f4; color: #0f766e; }
.role-user { background: var(--o-soft); color: var(--o-ink); }
.role-otm { background: #fff3c4; color: #8a5a00; }
.role-lvm { background: #dcf5ec; color: #0f7a55; }

.team-tag { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; font-family: var(--font-d); font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0; }
.team-A { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.team-B { background: linear-gradient(135deg, #0ea5e9, #3b82f6); }
.team-C { background: linear-gradient(135deg, #10b981, #14b8a6); }
.team-D { background: linear-gradient(135deg, #f59e0b, #f97316); }

/* ---------- Avatar ---------- */
.avatar { width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-family: var(--font-d); font-size: calc(var(--s) * .42); flex-shrink: 0; box-shadow: 0 0 0 2px #fff, 0 4px 10px -4px rgba(60, 45, 170, .4); user-select: none; }
.avatar.sq { border-radius: 30%; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; background: #fff; }
.pf-avatar { position: relative; flex-shrink: 0; display: inline-block; }
.pf-cam { position: absolute; right: -4px; bottom: -4px; width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; background: var(--grad); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 14px rgba(91, 76, 245, .4); transition: transform .2s var(--ease); z-index: 1; }
.pf-cam:hover { transform: scale(1.1); }
.pf-cam:disabled { opacity: .8; cursor: wait; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person .p-txt { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.person .p-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .p-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Shift chip ---------- */
.chip-shift { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; white-space: nowrap; line-height: 1; }
.chip-shift b { font-weight: 600; }
.chip-shift small, .hero .h-box .v .chip-shift small { font-size: 11px; color: inherit; font-weight: 600; font-family: var(--font); opacity: 1; margin-left: 2px; }
.chip-shift.s-morning { background: var(--m-soft); color: var(--m-ink); }
.chip-shift.s-afternoon { background: var(--a-soft); color: var(--a-ink); }
.chip-shift.s-night { background: #ede9fe; color: #5b21b6; }
.chip-shift.s-off { background: var(--o-soft); color: var(--o-ink); }
.chip-shift.s-ma { background: linear-gradient(90deg, var(--m-soft), var(--a-soft)); color: var(--a-ink); box-shadow: inset 0 0 0 1px rgba(249, 115, 22, .25); }
.chip-shift.s-an { background: linear-gradient(90deg, var(--a-soft), #ede9fe); color: #6b21a8; box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .2); }
.chip-shift.s-mn { background: linear-gradient(90deg, var(--m-soft), #ede9fe); color: #5b21b6; box-shadow: inset 0 0 0 1px rgba(124, 58, 237, .2); }
.chip-shift.s-none { background: transparent; color: var(--ink-3); }
.chip-shift.lg { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.chip-shift.xs { height: 26px; width: 26px; padding: 0; border-radius: 8px; font-weight: 700; font-size: 12px; font-family: var(--font-d); }
.chip-shift.swapped { box-shadow: inset 0 0 0 2px #f472b6; }
.chip-shift.swapped::after { content: ''; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: #ec4899; border: 2px solid #fff; }
.ot-dot { font-style: normal; font-size: 9px; font-weight: 800; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; border-radius: 5px; padding: 2px 4px; margin-left: 3px; letter-spacing: .02em; }
.chip-shift.xs .ot-dot { position: absolute; top: -7px; right: -9px; padding: 1px 3px; font-size: 8px; margin: 0; }

/* ---------- Alert box ---------- */
.alert-box { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.55; align-items: flex-start; }
.alert-box .ic { margin-top: 2px; }
.alert-box ul { margin: 4px 0 0; padding-left: 18px; }
.alert-box.ok { background: var(--success-soft); color: var(--success-ink); }
.alert-box.err { background: var(--danger-soft); color: var(--danger-ink); }
.alert-box.warn { background: var(--warn-soft); color: var(--warn-ink); }
.alert-box.info { background: var(--primary-soft); color: var(--primary-ink); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1.5px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; border: 0; background: none; padding: 10px 14px 12px; font-size: 14px; font-weight: 600; color: var(--ink-3); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary-ink); }
.tab.active::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1.5px; height: 3px; border-radius: 3px 3px 0 0; background: var(--grad); }
.tab .count { min-width: 20px; height: 20px; border-radius: 99px; padding: 0 6px; font-size: 11px; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--ink-2); }
.tab.active .count { background: var(--primary); color: #fff; }

/* ---------- Progress ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--grad); transition: width 1s var(--ease); position: relative; overflow: hidden; }
.progress > i::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent); animation: shimmer 2s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #22c55e; position: relative; flex-shrink: 0; }
.live-dot::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .7; } to { transform: scale(3); opacity: 0; } }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; font-weight: 600; color: var(--ink-3); font-size: 12.5px; background: var(--surface-2); padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .15s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tr.me td { background: #f6f3ff; }

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, #eeecf8 25%, #f7f6fd 50%, #eeecf8 75%); background-size: 200% 100%; animation: skel 1.3s infinite; border-radius: 10px; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Animations ---------- */
.fade-up { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: fadeUp .55s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; } .stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; } .stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; } .stagger > *:nth-child(6) { animation-delay: .27s; }
.stagger > *:nth-child(n+7) { animation-delay: .3s; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }

/* =====================================================================
   LAYOUT
   ===================================================================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 12px auto 12px 12px; width: var(--sb-w); z-index: 40; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy) 0%, #191e55 55%, #1c2160 100%); color: #cfd3f5;
  border-radius: 24px; padding: 18px 14px; box-shadow: 0 30px 60px -25px rgba(21, 25, 71, .6); overflow: hidden;
}
.sidebar::before { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(124, 92, 255, .45), transparent 70%); top: -120px; left: -80px; pointer-events: none; }
.sb-brand { position: relative; display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
/* โลโก้กล้อง + เอฟเฟค: วงแสงหมุน, แสงวิ่งผ่าน, กล้องส่าย, จุด LIVE กระพริบ */
.logo-orb.fx { position: relative; isolation: isolate; overflow: visible; }
.logo-orb.fx::before { content: ""; position: absolute; inset: -3px; border-radius: 17px; z-index: -2; background: conic-gradient(from var(--lg-a), #22d3ee, #a855f7, #ec4899, #6366f1, #22d3ee); animation: logoSpin 4s linear infinite; }
.logo-orb.fx::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .5) 48%, transparent 66%) no-repeat, var(--grad); background-size: 260% 100%, 100% 100%; animation: logoShine 3.6s ease-in-out infinite; }
.logo-orb.fx .ic { filter: drop-shadow(0 2px 4px rgba(30, 20, 90, .45)); animation: logoPan 4.5s ease-in-out infinite; }
@property --lg-a { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes logoSpin { to { --lg-a: 360deg; } }
@keyframes logoShine { 0%, 55% { background-position: 130% 0; } 100% { background-position: -30% 0; } }
@keyframes logoPan { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
.logo-orb.fx .live-dot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; z-index: 2; animation: logoLive 1.6s ease-out infinite; }
@keyframes logoLive { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); } 100% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } }
@media (prefers-reduced-motion: no-preference) {
  .page.no-anim .logo-orb.fx .ic { animation: logoPan 4.5s ease-in-out infinite !important; }
}
.logo-orb { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad); box-shadow: 0 10px 25px -6px rgba(124, 92, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .3); flex-shrink: 0; animation: orb 5s ease-in-out infinite; }
@keyframes orb { 0%, 100% { box-shadow: 0 10px 25px -6px rgba(124, 92, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .3); } 50% { box-shadow: 0 10px 35px -2px rgba(168, 85, 247, .9), inset 0 1px 0 rgba(255, 255, 255, .3); } }
.sb-brand b { display: block; color: #fff; font-family: var(--font-d); font-size: 15px; font-weight: 600; letter-spacing: .01em; line-height: 1.25; white-space: nowrap; }
.sb-brand small { display: block; font-size: 12px; color: #9aa0d6; }
.sb-nav { position: relative; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; scrollbar-width: none; }
.sb-sec { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #6f76b5; padding: 14px 12px 6px; font-weight: 600; }
.nav-item { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 13px; color: #c3c8ee; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .2s var(--ease); text-decoration: none !important; }
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav-item.active { color: #fff; background: linear-gradient(135deg, rgba(99, 88, 255, .95), rgba(139, 92, 246, .85)); box-shadow: 0 10px 24px -10px rgba(124, 92, 255, .9), inset 0 1px 0 rgba(255, 255, 255, .15); }
.nav-item .nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: #ef4444; box-shadow: 0 2px 6px rgba(239, 68, 68, .45); color: #fff; font-size: 10.5px; line-height: 1; font-weight: 700; display: grid; place-items: center; animation: pop .4s var(--ease); }
.sb-live { position: relative; margin: 12px 2px; padding: 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); }
.sb-live .t { font-size: 12px; color: #9aa0d6; display: flex; align-items: center; gap: 7px; }
.sb-live .v { font-family: var(--font-d); color: #fff; font-size: 20px; font-weight: 600; margin-top: 4px; display: flex; align-items: baseline; gap: 8px; }
.sb-live .v small { font-size: 12px; color: #9aa0d6; font-weight: 400; font-family: var(--font); }
.sb-live .progress { background: rgba(255, 255, 255, .1); height: 6px; margin-top: 10px; }
.wave { display: block; width: 100%; height: 30px; margin-top: 6px; }
.wave path { stroke-dasharray: 6 0; animation: waveMove 3s linear infinite; }
@keyframes waveMove { from { transform: translateX(0); } to { transform: translateX(-40px); } }
.sb-user { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); cursor: pointer; transition: background .2s; }
.sb-user:hover { background: rgba(255, 255, 255, .1); }
.sb-user .person .p-name { color: #fff; font-size: 13.5px; }
.sb-user .person .p-sub { color: #9aa0d6; }
.sb-user .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); }
.sb-user .icon-btn { background: transparent; border-color: rgba(255, 255, 255, .12); color: #c3c8ee; margin-left: auto; }
.sb-user .icon-btn:hover { color: #fff; background: rgba(255, 90, 122, .25); border-color: transparent; box-shadow: none; }
.sb-overlay { display: none; }

.main { flex: 1; min-width: 0; margin-left: calc(var(--sb-w) + 24px); padding: 12px 24px 40px 12px; }
.topbar { position: sticky; top: 12px; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 16px 12px 22px; margin-bottom: 22px; border-radius: 20px; background: rgba(255, 255, 255, .75); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--sh); }
.menu-btn { display: none !important; }
.tb-title { min-width: 0; flex: 1; }
.tb-title h1 { font-size: 22px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-title p { margin: 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.tb-search { position: relative; }
.tb-search input { width: 200px; height: 40px; min-height: 40px; padding: 0 12px 0 38px; border-radius: 12px; background: var(--surface-2); }
.tb-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.bell-dot { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px; background: linear-gradient(135deg, #ff5a7a, #ef4444); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; animation: pop .4s var(--ease); }
.icon-btn.ring .ic { animation: ring 1s ease; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(18deg); } 30% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 60% { transform: rotate(-8deg); } 75% { transform: rotate(4deg); } }
/* สถานที่ปฏิบัติงาน (ลาดกระบัง / พัทยา) */
.site-seg { padding: 3px; border-radius: 11px; }
.site-seg button { padding: 5px 11px; font-size: 12.5px; }
.site-tag { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--primary-soft, #ede9fe); color: var(--primary-ink, #4c3fd6); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
@media (max-width: 640px) {
  .site-seg button { padding: 5px 8px; }
  .site-seg button .ic { display: none; }
  .site-tag { padding: 0 9px; }
  .site-tag .ic { display: none; }
}
.demo-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 99px; background: var(--warn-soft); color: var(--warn-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }

.page { animation: pageIn .45s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Notification panel ---------- */
.notif-panel { position: fixed; top: 84px; right: 24px; width: 380px; max-width: calc(100vw - 24px); max-height: min(560px, calc(100vh - 110px)); z-index: 60; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--sh-lg); transform-origin: top right; animation: panelIn .25s var(--ease); overflow: hidden; }
@keyframes panelIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
.notif-panel .np-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.notif-panel .np-head h3 { font-size: 16px; }
.notif-panel .np-list { overflow-y: auto; padding: 6px; }
.notif-item { display: flex; gap: 12px; padding: 12px; border-radius: 14px; cursor: pointer; transition: background .15s; position: relative; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: #f6f4ff; }
.notif-item.unread::after { content: ''; position: absolute; right: 12px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.notif-item .n-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.notif-item b { display: block; font-size: 13.5px; font-weight: 600; padding-right: 14px; }
.notif-item p { margin: 1px 0 2px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.notif-item time { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Bottom nav (mobile) ---------- */
.bottom-nav { display: none; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: all; display: flex; align-items: flex-start; gap: 12px; width: 340px; max-width: calc(100vw - 36px); padding: 13px 14px; border-radius: 16px; background: rgba(255, 255, 255, .95); backdrop-filter: blur(12px); border: 1px solid var(--line); box-shadow: var(--sh-lg); animation: toastIn .4s var(--ease); }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }
.toast .t-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; background: var(--primary-soft); color: var(--primary); }
.toast.t-success .t-ic { background: var(--success-soft); color: var(--success); }
.toast.t-error .t-ic { background: var(--danger-soft); color: var(--danger); }
.toast.t-warn .t-ic { background: var(--warn-soft); color: var(--warn); }
.toast .t-body { flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; padding-top: 1px; }
.toast .t-body b { display: block; color: var(--ink); font-size: 14px; margin-bottom: 1px; }
.toast .t-x { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 4px; border-radius: 6px; }
.toast .t-x:hover { background: var(--surface-3); color: var(--ink); }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(21, 25, 71, .38); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; transition: opacity .22s; }
.modal-back.show { opacity: 1; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; box-shadow: var(--sh-lg); transform: translateY(16px) scale(.97); transition: transform .3s var(--ease); overflow: hidden; }
.modal-back.show .modal { transform: none; }
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 780px; }
.modal.xl { max-width: 980px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px 24px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 18px; display: flex; align-items: center; gap: 10px; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 18px; border-top: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
@media (max-width: 480px) {
  .modal-foot { justify-content: flex-start; }
}
.confirm-msg { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.65; }

/* =====================================================================
   AUTH
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 48px 56px; display: flex; flex-direction: column; background: radial-gradient(900px 500px at 80% 10%, rgba(168, 85, 247, .55), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(59, 130, 246, .45), transparent 60%), linear-gradient(160deg, #141846 0%, #1d2270 60%, #2b2393 100%); }
.auth-hero .brand { display: flex; align-items: center; gap: 14px; position: relative; z-index: 2; }
.auth-hero .brand b { font-family: var(--font-d); font-size: 18px; display: block; }
.auth-hero .brand small { color: #aab0e8; font-size: 13px; }
.auth-hero .copy { position: relative; z-index: 2; margin-top: auto; max-width: 520px; }
.auth-hero h1 { font-size: clamp(30px, 3.6vw, 48px); font-weight: 700; line-height: 1.2; }
.auth-hero h1 span { background: linear-gradient(90deg, #a5b4fc, #e9d5ff, #f0abfc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero p { color: #c3c8f0; font-size: 15.5px; margin: 14px 0 26px; }
.auth-hero .feats { display: flex; flex-wrap: wrap; gap: 10px; }
.auth-hero .feat { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); font-size: 13.5px; backdrop-filter: blur(8px); }
.auth-hero .feat .ic { color: #c4b5fd; }
.orbit { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .1); left: 60%; top: 34%; transform: translate(-50%, -50%); }
.orbit.o1 { width: 300px; height: 300px; animation: spin 40s linear infinite; }
.orbit.o2 { width: 480px; height: 480px; animation: spin 60s linear infinite reverse; }
.orbit.o3 { width: 680px; height: 680px; border-style: dashed; opacity: .6; }
.orbit::before { content: ''; position: absolute; top: -6px; left: 50%; width: 12px; height: 12px; border-radius: 50%; background: #a78bfa; box-shadow: 0 0 20px #a78bfa; }
.orbit.o2::before { background: #60a5fa; box-shadow: 0 0 20px #60a5fa; }
.orbit.o3::before { display: none; }
.float-card { position: absolute; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 18px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(14px); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .5); animation: bob 6s ease-in-out infinite; }
.float-card b { display: block; font-size: 14px; }
.float-card small { color: #c3c8f0; font-size: 12px; }
.float-card .fc-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.float-card.f1 { top: 16%; right: 10%; }
.float-card.f2 { top: 38%; left: 44%; animation-delay: -2s; }
.float-card.f3 { top: 24%; left: 12%; animation-delay: -4s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
.auth-side { display: grid; place-items: center; padding: 32px 24px; position: relative; }
.auth-card { width: 100%; max-width: 420px; padding: 34px 32px; border-radius: 28px; background: rgba(255, 255, 255, .82); backdrop-filter: blur(20px); border: 1px solid #fff; box-shadow: var(--sh-lg); animation: fadeUp .6s var(--ease) both; }
.auth-card h2 { font-size: 26px; font-weight: 600; }
.auth-card .lead { color: var(--ink-3); margin: 4px 0 22px; }
.auth-card .seg { width: 100%; margin-bottom: 22px; }
.auth-card .seg button { flex: 1; justify-content: center; }
.pw-wrap { position: relative; }
.pw-wrap .pw-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.pw-wrap input { padding-left: 40px; padding-right: 44px; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 6px; border-radius: 8px; }
.demo-box { margin-top: 22px; padding: 14px; border-radius: 16px; background: var(--grad-soft); border: 1px dashed #cdc5ff; }
.demo-box .t { font-size: 12.5px; color: var(--primary-ink); font-weight: 600; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.demo-box .chips { gap: 6px; }
.demo-box .chip { height: 30px; font-size: 12px; }
.pending-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.hero {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 26px 28px; color: #fff;
  background: radial-gradient(600px 300px at 100% 0%, rgba(236, 72, 153, .35), transparent 60%), radial-gradient(500px 300px at 0% 100%, rgba(59, 130, 246, .35), transparent 60%), linear-gradient(135deg, #3b2fd6 0%, #5b3df0 45%, #8b45f0 100%);
  box-shadow: 0 30px 60px -28px rgba(91, 61, 240, .75);
}
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .15); }
.hero::before { width: 320px; height: 320px; right: -80px; top: -120px; }
.hero::after { width: 200px; height: 200px; right: 40px; top: -40px; border-color: rgba(255, 255, 255, .1); }
.hero .h-top { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.hero .hello { font-size: 14px; color: #dcd6ff; }
.hero h2 { font-size: 26px; font-weight: 600; margin-top: 2px; }
.hero .date { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .18); font-size: 13.5px; backdrop-filter: blur(6px); }
.hero .h-bottom { position: relative; z-index: 1; margin-top: 22px; display: flex; gap: 14px; flex-wrap: wrap; align-items: stretch; }
.hero .h-box { flex: 1; min-width: 200px; padding: 14px 16px; border-radius: 16px; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16); backdrop-filter: blur(8px); }
.hero .h-box .k { font-size: 12.5px; color: #d8d2ff; display: flex; align-items: center; gap: 6px; }
.hero .h-box .v { font-family: var(--font-d); font-size: 20px; font-weight: 600; margin-top: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .h-box .v small { font-family: var(--font); font-size: 13px; font-weight: 400; color: #e4dfff; }
.hero .progress { background: rgba(255, 255, 255, .18); margin-top: 10px; height: 6px; }
.hero .progress > i { background: linear-gradient(90deg, #fff, #e9d5ff); }
.hero .chip-shift.s-night { background: #ede9fe; color: #5b21b6; }
/* กล่องย่อยใน hero: ตัวหนังสือและไอคอนใหญ่/เด่นขึ้น */
.hero .h-box { padding: 16px 18px; }
.hero .h-box .k { font-size: 15px; font-weight: 600; color: #fff; gap: 8px; letter-spacing: .1px; text-shadow: 0 1px 8px rgba(20, 10, 80, .25); }
.hero .h-box .k svg { width: 20px; height: 20px; stroke-width: 2.2; opacity: .95; }
.hero .h-box .v { margin-top: 10px; font-size: 22px; }
.hero .h-box .v .chip-shift { height: 38px; padding: 0 16px; gap: 7px; border-radius: 12px; font-size: 16px; box-shadow: 0 6px 16px rgba(20, 10, 80, .22); }
.hero .h-box .v .chip-shift svg { width: 19px; height: 19px; }
.hero .h-box .v .chip-shift b { font-weight: 700; }
.hero .h-box .v .chip-shift small { font-size: 14px; }
.hero .h-box .v .team-tag { width: 34px; height: 34px; border-radius: 11px; font-size: 16px; box-shadow: 0 4px 12px rgba(20, 10, 80, .25); }
.hero .h-box .v small { font-size: 16px; font-weight: 600; color: #fff; }
.hero .h-box .v .lv-tag { height: 28px; padding: 0 11px; font-size: 13.5px; }
@media (max-width: 640px) {
  .hero .h-box .k { font-size: 14px; }
  .hero .h-box .v .chip-shift { height: 34px; padding: 0 13px; font-size: 15px; }
  .hero .h-box .v small { font-size: 15px; }
}

.kpi { display: flex; align-items: center; gap: 14px; padding: 18px; }
.kpi .kpi-ic { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; flex-shrink: 0; }
.kpi .kpi-val { font-family: var(--font-d); font-size: 26px; font-weight: 600; line-height: 1.1; }
.kpi .kpi-val small { font-size: 13px; color: var(--ink-3); font-weight: 400; margin-left: 4px; font-family: var(--font); }
.kpi .kpi-label { font-size: 13px; color: var(--ink-3); }
.kpi .kpi-split { font-size: 12px; white-space: nowrap; }
.kpi .kpi-split b { color: var(--ink); }
.ic-violet { background: linear-gradient(135deg, #ede9ff, #e0d8ff); color: #6d4df2; }
.ic-blue { background: linear-gradient(135deg, #e2edff, #d6e4ff); color: #2563eb; }
.ic-amber { background: linear-gradient(135deg, #fff3d6, #ffe8b8); color: #d97706; }
.ic-green { background: linear-gradient(135deg, #dcfaee, #c9f5e2); color: #059669; }
.ic-pink { background: linear-gradient(135deg, #fde6f2, #fbd5e9); color: #db2777; }
.ic-red { background: linear-gradient(135deg, #ffe4e4, #ffd2d2); color: #dc2626; }

.shift-now { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.sn-card { position: relative; border-radius: 18px; padding: 16px; background: var(--surface-2); border: 1.5px solid var(--line); transition: all .25s var(--ease); min-width: 0; }
.sn-card:hover { transform: translateY(-3px); box-shadow: var(--sh); background: #fff; }
.sn-card.live { background: #fff; border-color: transparent; box-shadow: 0 0 0 2px var(--primary-2), 0 18px 40px -18px rgba(91, 76, 245, .55); }
.sn-card .sn-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.sn-card .sn-live { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: #16a34a; background: #dcfce7; border-radius: 99px; padding: 3px 9px; letter-spacing: .04em; }
.sn-card .sn-team { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 10px; }
.sn-card .sn-people { display: flex; flex-direction: column; gap: 8px; }
.sn-card .sn-people .person .p-name { font-size: 13px; }
.sn-card .progress { margin-top: 12px; height: 6px; }

.week-strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; }
.ws-day { text-align: center; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid transparent; cursor: pointer; transition: all .2s var(--ease); min-width: 0; }
.ws-day:hover { background: #fff; box-shadow: var(--sh); transform: translateY(-2px); }
.ws-day.today { border-color: var(--primary-2); background: #fff; }
.ws-day.hol { background: var(--pink-soft); }
.ws-day .d1 { font-size: 11.5px; color: var(--ink-3); }
.ws-day .d2 { font-family: var(--font-d); font-size: 18px; font-weight: 600; margin: 2px 0 6px; }
.ws-day .chip-shift { padding: 0 6px; font-size: 11.5px; height: 24px; max-width: 100%; }
.ws-day .chip-shift .ic { display: none; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.click { cursor: pointer; border-radius: 12px; padding: 12px 10px; margin: 0 -6px; transition: background .15s; }
.list-item.click:hover { background: var(--surface-2); }
.li-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-main span { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.date-box { width: 48px; flex-shrink: 0; text-align: center; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.date-box .m { background: var(--grad); color: #fff; font-size: 10.5px; font-weight: 600; padding: 2px 0; }
.date-box .d { font-family: var(--font-d); font-size: 18px; font-weight: 600; padding: 2px 0 3px; }

/* =====================================================================
   SCHEDULE
   ===================================================================== */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav h2 { font-size: 20px; font-weight: 600; min-width: 170px; text-align: center; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; }

.matrix-wrap { overflow: auto; max-height: calc(100vh - 290px); min-height: 300px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--sh); }
table.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
table.matrix th, table.matrix td { padding: 0; text-align: center; border-bottom: 1px solid var(--line); }
table.matrix thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); height: 54px; min-width: 38px; font-weight: 500; color: var(--ink-3); cursor: pointer; transition: background .15s; }
table.matrix thead th:hover { background: var(--primary-soft); }
table.matrix thead th .dw { display: block; font-size: 11px; }
table.matrix thead th .dn { display: block; font-family: var(--font-d); font-size: 15px; color: var(--ink); font-weight: 600; }
table.matrix thead th.we .dw { color: #e11d48; }
table.matrix thead th.hol { background: var(--pink-soft); }
table.matrix thead th.hol .dn { color: var(--pink-ink); }
table.matrix thead th.today { background: var(--grad); }
table.matrix thead th.today .dw, table.matrix thead th.today .dn { color: #fff; }
table.matrix th.name-h, table.matrix td.name-cell { position: sticky; left: 0; z-index: 2; background: var(--surface); text-align: left; border-right: 1px solid var(--line); min-width: 210px; max-width: 210px; padding: 7px 12px; }
table.matrix th.name-h { z-index: 4; background: var(--surface-2); cursor: default; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
table.matrix td.name-cell .person .p-name { font-size: 13px; }
table.matrix td.cell { height: 44px; min-width: 38px; }
table.matrix td.cell.hol { background: rgba(253, 230, 242, .45); }
table.matrix td.cell.today { background: rgba(124, 92, 255, .07); }
table.matrix tr.me td.name-cell { background: #f6f3ff; }
table.matrix tr.me td.name-cell::before { content: ''; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
table.matrix tr.team-row td { position: sticky; left: 0; background: var(--surface-3); padding: 7px 12px; text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
table.matrix tr.team-row td .row { position: sticky; left: 12px; width: max-content; }
table.matrix tbody tr:not(.team-row):hover td { background-color: #faf9ff; }
table.matrix tbody tr:not(.team-row):hover td.name-cell { background: #f3f0ff; }

.cal { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--sh); overflow: hidden; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 12px 6px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-dow.we { color: #e11d48; }
.cal-day { position: relative; min-height: 108px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; transition: background .15s; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day:hover { background: var(--surface-2); }
.cal-day.other { background: #fbfbfe; }
.cal-day.other > * { opacity: .4; }
.cal-day .dn { font-family: var(--font-d); font-weight: 600; font-size: 14px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; }
.cal-day .blk.swap-with, .cal-day .blk.cover-with { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
/* เวรที่เข้าแทนคนลา (ได้ OT) */
.blk.cover-with { color: #b45309; display: inline-flex; align-items: center; gap: 3px; background: linear-gradient(135deg, rgba(245, 158, 11, .16), rgba(239, 68, 68, .13)); border-radius: 7px; padding: 1px 6px; font-weight: 600; }
.blk.cover-with .ic { flex: none; }
/* ช่องตารางรวมของคนที่ลา (มีคนเข้าแทนแล้ว) */
.matrix td.cell.on-leave { position: relative; }
.matrix td.cell.on-leave .chip-shift { opacity: .45; }
.lv-dot { font-style: normal; position: absolute; top: 1px; right: 2px; font-size: 8px; font-weight: 800; background: #fce7f3; color: #be185d; border-radius: 5px; padding: 1px 3px; line-height: 1.4; }
.cal-day.today .dn { background: linear-gradient(135deg, #ec4899, #db2777); color: #fff; box-shadow: 0 4px 12px rgba(219, 39, 119, .35); }
.cal-day.today { background: #fff5fa !important; box-shadow: inset 0 0 0 2px #ec4899; position: relative; z-index: 1; }
.cal-day.today::before { content: 'วันนี้'; position: absolute; top: 6px; right: 6px; padding: 1px 7px; border-radius: 99px; background: #fce7f3; color: #be185d; font-size: 10.5px; font-weight: 700; line-height: 1.6; }
.cal-day.today.sel::before { display: none; }
@media (max-width: 640px) { .cal-day.today::before { display: none; } }
.cal-day.hol { background: linear-gradient(180deg, #fff0f7, #fff); }
.cal-day .hol-name { font-size: 11px; color: var(--pink-ink); line-height: 1.3; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-day .chip-shift { align-self: flex-start; max-width: 100%; }
.cal-day .blk { font-size: 10.5px; color: var(--ink-3); }

.day-shifts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.day-shift { border-radius: 16px; padding: 14px; border: 1.5px solid var(--line); background: var(--surface-2); min-width: 0; }
.day-shift .ds-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
/* โพสต์: ปุ่มรับทราบ 🫡 + ความคิดเห็น */
.post-social { margin-top: 14px; border-top: 1px solid var(--line, #eceaf7); }
.ps-stats { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px 8px; }
.ps-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 2px 0; font: inherit; font-size: 13px; color: var(--ink-3); cursor: pointer; text-align: left; }
.ps-link:hover:not(:disabled) { color: var(--primary); text-decoration: underline; }
.ps-link:disabled { cursor: default; }
.ps-link b { color: var(--ink-2); }
.ps-emo-sm { display: inline-grid; place-items: center; flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; font-size: 14px; line-height: 1; background: linear-gradient(135deg, #fef3c7, #fbbf24); box-shadow: 0 2px 8px rgba(245, 158, 11, .4); }
.ps-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 6px 0; border-top: 1px solid var(--line, #eceaf7); }
.ps-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border: 0; border-radius: 12px; background: transparent; font: inherit; font-size: 14.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .2s ease, color .2s ease, transform .15s ease; }
.ps-btn:hover { background: var(--surface-2, #f4f2fd); }
.ps-btn:active { transform: scale(.95); }
.ps-btn:disabled { opacity: .7; }
.ps-emo { font-size: 22px; line-height: 1; filter: grayscale(1); opacity: .65; transition: filter .25s ease, opacity .25s ease, transform .25s ease; }
.ps-btn.ack:hover .ps-emo { filter: none; opacity: 1; transform: rotate(-12deg) scale(1.15); }
.ps-btn.ack.on { color: #b45309; background: linear-gradient(135deg, #fffbeb, #fef3c7); }
.ps-btn.ack.on .ps-emo { filter: none; opacity: 1; }
.ps-btn.ack.pop .ps-emo { animation: ackPop .7s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes ackPop { 0% { transform: scale(.3); } 45% { transform: scale(1.55) rotate(-20deg); } 70% { transform: scale(.9) rotate(6deg); } 100% { transform: scale(1) rotate(0); } }
.ps-btn.on-c { color: var(--primary); }
.ps-comments { display: flex; flex-direction: column; gap: 10px; padding: 10px 0 4px; border-top: 1px solid var(--line, #eceaf7); }
.pc { display: flex; gap: 8px; align-items: flex-start; }
.pc-main { min-width: 0; flex: 1; }
.pc-bubble { display: inline-block; max-width: 100%; padding: 8px 12px; border-radius: 16px; background: var(--surface-2, #f4f2fd); font-size: 14px; line-height: 1.55; word-break: break-word; }
.pc-bubble b { display: block; font-size: 13px; }
.pc-meta { display: flex; gap: 12px; padding: 2px 12px 0; font-size: 12px; color: var(--ink-3); }
.pc-meta button { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.pc-meta button:hover { color: #ef4444; }
.pc-input { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 3px 3px 3px 14px; border-radius: 99px; background: var(--surface-2, #f4f2fd); border: 1px solid transparent; transition: border-color .2s ease, background .2s ease; }
.pc-input:focus-within { border-color: var(--primary-2, #8b7cf6); background: #fff; }
.pc-input input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; box-shadow: none !important; outline: none; font: inherit; font-size: 14px; min-height: 34px; height: 34px; padding: 0 !important; }
.pc-input button { flex-shrink: 0; width: 34px; height: 34px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; cursor: pointer; }
/* หลอดพลังงาน + เคาท์ดาวน์ในกล่องตำแหน่ง (หน้าภาพรวม) */
.hero .h-energy { flex-basis: 100%; order: -1; } /* กล่องใหญ่ขึ้นก่อน กล่องเล็ก 2 กล่องอยู่ด้านล่าง */
.h-energy .en-top { display: flex; align-items: center; gap: 22px; }
.h-energy .en-info { display: flex; flex-direction: column; gap: 6px; }
.h-energy .en-team { font-family: var(--font-d); font-size: 24px; font-weight: 700; line-height: 1.2; color: #fff; text-shadow: 0 2px 10px rgba(20, 10, 80, .3); }
.h-energy .en-role { display: flex; align-items: center; gap: 7px; font-size: 15.5px; font-weight: 600; color: #ece8ff; line-height: 1.3; }
.h-energy .en-role svg { width: 17px; height: 17px; flex-shrink: 0; }
.h-energy .en-av { position: relative; flex-shrink: 0; }
.h-energy .en-av .avatar { border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 4px rgba(255, 255, 255, .18), 0 10px 26px rgba(20, 10, 80, .35); }
.h-energy .en-av .team-tag { position: absolute; right: 0; bottom: 0; width: 34px !important; height: 34px !important; font-size: 16px !important; border-radius: 11px !important; border: 2px solid #fff; }
.h-energy .en-info { flex: 1; min-width: 0; }
/* ตัวเลขนับถอยหลังกว้างคงที่ (พอดีกับ 00:00:00) ชิดขวา → ตัวเลขเปลี่ยนแล้วข้อความข้าง ๆ ไม่ขยับ */
.h-energy .en-right { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.h-energy .en-name { font-family: var(--font-d); font-size: 22px; font-weight: 700; line-height: 1.2; color: #fff; text-shadow: 0 2px 12px rgba(20, 10, 80, .3); overflow-wrap: anywhere; }
.h-energy .en-info .v { margin-top: 2px; }
.h-energy .en-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 480px) {
  /* มือถือ: รูปโปรไฟล์เล็กลงอยู่ซ้าย · ข้อความชิดซ้ายข้างรูป */
  .h-energy .en-top { gap: 14px; align-items: center; }
  .h-energy .en-av .avatar { width: 78px !important; height: 78px !important; font-size: 32px !important; border-width: 2px; box-shadow: 0 0 0 3px rgba(255, 255, 255, .18), 0 8px 18px rgba(20, 10, 80, .35); }
  .h-energy .en-av .team-tag { width: 24px !important; height: 24px !important; font-size: 12px !important; border-radius: 8px !important; right: -2px; bottom: -2px; }
  .h-energy .en-info { gap: 3px; align-items: flex-start; text-align: left; }
  .h-energy .en-team { font-size: 20px; }
  .h-energy .en-role { font-size: 12.5px; gap: 5px; }
  .h-energy .en-role svg { width: 14px; height: 14px; }
  .h-energy .en-row { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 2px; margin-top: 2px; }
  .h-energy .en-right { flex-basis: auto; width: auto; flex-direction: column; align-items: flex-start; text-align: left; gap: 0; margin-left: 0; padding-right: 0; }
  .h-energy .en-state { font-size: 12.5px; white-space: nowrap; }
  .h-energy .en-name { font-size: 17px; }
}
.h-energy .en-state { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; color: #fff; }
/* หลอดพลังงาน: ม่วงไล่ฟ้าตามธีมเว็บ (สีสว่างกว่าพื้นหลัง + กรอบขาวบาง ให้ไม่กลืนกับการ์ดสีม่วง) · ปุ่ม ⚡เปอร์เซ็นต์ที่ปลายหลอด · เวลาที่เหลือด้านขวา */
.h-energy { --en-a: #c084fc; --en-b: #22d3ee; --en-glow: 34, 211, 238; }
.h-energy.on.low { --en-a: #fda4af; --en-b: #ef4444; --en-glow: 248, 113, 113; }
.h-energy .en-bar { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.h-energy .en-track { position: relative; flex: 1; min-width: 0; height: 12px; border-radius: 99px; background: rgba(12, 10, 48, .55);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .28); }
.h-energy .en-track i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 99px;
  background: linear-gradient(90deg, var(--en-a), var(--en-b)); box-shadow: 0 0 12px rgba(var(--en-glow), .75); transition: width .9s linear; }
.h-energy .en-knob { position: absolute; top: 50%; left: 30px; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 1px;
  height: 30px; padding: 0 12px 0 8px; border-radius: 99px; background: linear-gradient(135deg, var(--en-a), var(--en-b)); color: #fff;
  text-shadow: 0 1px 3px rgba(30, 20, 90, .45);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 16px 5px rgba(var(--en-glow), .7), 0 0 38px 10px rgba(var(--en-glow), .35); transition: left .9s linear; }
.h-energy .en-knob svg { width: 15px; height: 15px; fill: #fff; filter: drop-shadow(0 1px 2px rgba(30, 20, 90, .4)); }
.h-energy .en-pct { font-family: var(--font-d); font-size: 17px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.h-energy .en-left { flex-shrink: 0; font-family: var(--font-d); font-size: 16px; font-weight: 600; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; text-shadow: 0 2px 10px rgba(20, 10, 80, .35); }
.h-energy .en-sub { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: #e4dfff; }
/* การ์ดแลกหลายวัน: คั่นแต่ละวัน */
.swap-card .swap-row + .swap-row { border-top: 1px dashed var(--line, #e7e5f4); margin-top: 10px; padding-top: 10px; }
/* ฟีดการแลกเวรวันนี้ */
.swap-feed .feed { display: flex; flex-direction: column; max-height: 460px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line, #e7e5f4); }
.feed-item:last-child { border-bottom: 0; }
.feed-av { position: relative; flex-shrink: 0; }
.feed-ic { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; border: 2px solid #fff; background: var(--primary); }
.f-ok .feed-ic { background: #22c55e; }
.f-no .feed-ic { background: #ef4444; }
.f-cancel .feed-ic { background: #94a3b8; }
.feed-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 14px; line-height: 1.45; }
.feed-main time { font-size: 12px; color: var(--ink-3); }
.feed-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.feed-state { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 99px; }
.feed-state.fs-wait { background: #ede9fe; color: #5b21b6; }
.feed-state.fs-now { background: #dcfce7; color: #166534; }
.feed-state.fs-done { background: #f1f5f9; color: #64748b; }
.ds-title { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-round { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; font-weight: 700; line-height: 1; }
.ds-round.s-morning { background: var(--m-soft); color: var(--m-ink); }
.ds-round.s-afternoon { background: var(--a-soft); color: var(--a-ink); }
.ds-round.s-night { background: #ede9fe; color: #5b21b6; }
.day-shift .ds-list { display: flex; flex-direction: column; gap: 10px; }
.off-line { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: var(--o-soft); color: var(--o-ink); font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* =====================================================================
   SWAP
   ===================================================================== */
.rules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rule { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.rule b { display: block; font-size: 13.5px; }
.rule span { font-size: 12.5px; color: var(--ink-3); }
.step { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.step:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 36px; bottom: 4px; width: 2px; background: linear-gradient(var(--line-2), transparent); }
.step-num { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: #fff; font-family: var(--font-d); font-weight: 600; flex-shrink: 0; box-shadow: var(--sh-glow); }
.step-body { flex: 1; min-width: 0; }
.step-body > .lbl { display: block; margin: 5px 0 10px; font-size: 14px; color: var(--ink); }
.pick-list { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.pick { flex-shrink: 0; min-width: 76px; text-align: center; padding: 8px 6px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); cursor: pointer; transition: all .2s var(--ease); }
.pick:hover { border-color: #cbc4ff; transform: translateY(-2px); }
.pick.active { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
.pick .d1 { font-size: 11px; color: var(--ink-3); }
.pick .d2 { font-family: var(--font-d); font-weight: 600; font-size: 16px; }
.pick .chip-shift { height: 22px; font-size: 11px; padding: 0 7px; margin-top: 4px; }
.pick .chip-shift .ic { display: none; }
.people-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pp { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; transition: all .2s var(--ease); min-width: 0; }
.pp:hover { border-color: #cbc4ff; background: #fff; }
.pp.active { border-color: var(--primary-2); background: #fff; box-shadow: 0 0 0 3px rgba(124, 92, 255, .18); }
.pp .chip-shift { margin-left: auto; }
.pp.disabled { opacity: .5; cursor: not-allowed; }
.owe-strip { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(135deg, #fff7ed, #ffe4e6); border: 1.5px solid #fdba74; color: #9a3412; font-size: 14.5px; line-height: 1.5; }
.owe-strip > svg { flex-shrink: 0; }
.owe-strip b { color: #7c2d12; }
.owe-strip .owe-n { display: inline-block; margin-left: 4px; padding: 1px 10px; border-radius: 99px; background: #ea580c; color: #fff; font-size: 12.5px; font-weight: 700; }
.owe-strip .small { color: #9a3412; }
.people-pick.one-col { grid-template-columns: 1fr; }

.preview { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 4px 0 14px; }
.pv-col { border-radius: 16px; padding: 14px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.pv-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; font-size: 13px; }
.pv-row .dt { color: var(--ink-2); min-width: 90px; }
.pv-arrow { color: var(--primary-2); animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }

.swap-card { padding: 16px 18px; }
.swap-card + .swap-card { margin-top: 12px; }
.swap-parties { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.swap-parties .x-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--grad-soft); color: var(--primary); flex-shrink: 0; }
.swap-card.pending .x-ic .ic { animation: spin 6s linear infinite; }
.swap-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 14px; }
.swap-detail .sd { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.swap-reason { margin-top: 10px; font-size: 13px; color: var(--ink-2); padding: 10px 12px; border-left: 3px solid #d6ceff; background: #faf9ff; border-radius: 0 10px 10px 0; }
.swap-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; justify-content: flex-end; }

/* =====================================================================
   POSTS
   ===================================================================== */
.composer .cp-top { display: flex; gap: 12px; align-items: center; cursor: text; }
.composer .cp-fake { flex: 1; height: 46px; border-radius: 14px; background: var(--surface-2); border: 1.5px solid var(--line); display: flex; align-items: center; padding: 0 16px; color: var(--ink-3); transition: all .2s; }
.composer .cp-fake:hover { border-color: #cbc4ff; background: #fff; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; padding: 16px; text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer; transition: all .2s; background: var(--surface-2); }
.dropzone:hover, .dropzone.over { border-color: var(--primary-2); background: var(--primary-soft); color: var(--primary-ink); }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 8px 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.file-chip button { border: 0; background: none; color: var(--ink-3); cursor: pointer; padding: 2px; display: grid; }

.post { padding: 0; overflow: hidden; }
.post + .post { margin-top: 16px; }
.post .p-strip { height: 4px; background: var(--grad); }
.post.cat-alert .p-strip { background: linear-gradient(90deg, #f59e0b, #f97316); }
.post.cat-incident .p-strip { background: linear-gradient(90deg, #ef4444, #ec4899); }
.post .p-in { padding: 18px 20px; }
.post-head { display: flex; align-items: center; gap: 12px; }
.post-head .person { flex: 1; }
.post-title { font-size: 17px; font-weight: 600; margin: 14px 0 6px; font-family: var(--font-d); display: flex; align-items: center; gap: 8px; }
.post-body { color: var(--ink-2); font-size: 14px; line-height: 1.7; word-break: break-word; }
.post-body.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.pinned-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--primary-ink); background: var(--primary-soft); border-radius: 99px; padding: 3px 9px; flex-shrink: 0; }
.post.is-pinned { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft); }
.pager-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pg-btn { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer; display: inline-grid; place-items: center; transition: all .2s var(--ease); }
.pg-btn:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary-ink); }
.pg-btn.active { border-color: transparent; background: var(--grad); color: #fff; box-shadow: var(--sh-glow); cursor: default; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-gap { min-width: 20px; text-align: center; color: var(--ink-3); font-weight: 600; }
.pg-info { text-align: center; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 480px) {
  .pager { gap: 4px; }
  .pg-btn { min-width: 34px; height: 34px; padding: 0 6px; font-size: 13px; }
  .posts-side { display: none; }
}
.post.is-pinned .p-strip { background: linear-gradient(90deg, #f59e0b, #eab308); }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.att-img { position: relative; aspect-ratio: 4/3; border-radius: 12px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; border: 1px solid var(--line); }
.att-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.att-img:hover img { transform: scale(1.06); }
.att-files { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.att-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; transition: all .2s; min-width: 0; text-align: left; font: inherit; color: inherit; width: 100%; }
.att-file:hover { border-color: #cbc4ff; background: #fff; }
.att-file .fx { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #fff; background: var(--grad); flex-shrink: 0; }
.att-file .fx.pdf { background: linear-gradient(135deg, #ef4444, #f97316); }
.att-file .fx.doc, .att-file .fx.docx { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.att-file .fx.xls, .att-file .fx.xlsx { background: linear-gradient(135deg, #059669, #10b981); }
.att-file .fn { flex: 1; min-width: 0; }
.att-file .fn b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-file .fn small { color: var(--ink-3); font-size: 12px; }
.post-actions { display: flex; gap: 6px; align-items: center; }
.lightbox img { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; border-radius: 12px; }

/* รูปในโพสต์แบบเฟซบุ๊ก: 1 รูปเต็ม · 2 รูปคู่ · 3 รูป (ใหญ่ 1 + เล็ก 2) · 4 รูป 2×2 · 5 รูปขึ้นไป บน 2 ล่าง 3 (+N) */
.att-grid.collage { grid-template-columns: repeat(6, 1fr); gap: 4px; border-radius: 14px; overflow: hidden; }
.att-grid.collage .att-img { grid-column: span 2; aspect-ratio: 1 / 1; border: 0; border-radius: 0; }
.att-grid.collage.n1 .att-img { grid-column: span 6; aspect-ratio: 4 / 3; }
.att-grid.collage.n2 .att-img, .att-grid.collage.n4 .att-img { grid-column: span 3; }
.att-grid.collage.n3 .att-img:first-child { grid-column: span 6; aspect-ratio: 2 / 1; }
.att-grid.collage.n3 .att-img:not(:first-child) { grid-column: span 3; }
.att-grid.collage.n5 .att-img:nth-child(-n+2) { grid-column: span 3; }
.att-img[data-extra]::after { content: attr(data-extra); position: absolute; inset: 0; display: grid; place-items: center; background: rgba(15, 12, 40, .5); color: #fff; font-family: var(--font-d); font-size: clamp(22px, 5vw, 36px); font-weight: 700; pointer-events: none; }

/* ดูรูปเต็ม + เลื่อนดูรูปถัดไป */
.lightbox .modal-body { padding: 12px; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: min(60vh, 420px); background: #0d0b1a; border-radius: 14px; overflow: hidden; touch-action: pan-y; }
.lb-stage img { border-radius: 0; user-select: none; -webkit-user-drag: none; }
.lb-spin { position: absolute; color: #fff; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s; }
.lb-nav:hover { background: rgba(255, 255, 255, .3); }
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-count { font-size: 13px; font-weight: 600; color: var(--ink-3); background: var(--surface-3); border-radius: 99px; padding: 2px 10px; }
@media (max-width: 480px) {
  .lb-nav { width: 38px; height: 38px; }
  .lb-nav.prev { left: 6px; }
  .lb-nav.next { right: 6px; }
}
/* บนมือถือ modal ทั่วไปเลื่อนขึ้นมาจากล่างจอ แต่รูปภาพให้อยู่กึ่งกลางจอพอดีแทน */
@media (max-width: 640px) {
  .modal-back:has(.lightbox) { align-items: center; padding: 16px; }
  .modal.lightbox { border-radius: 24px; max-height: calc(100vh - 32px); }
}

/* =====================================================================
   CHAT
   ===================================================================== */
.chat { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100vh - 130px); min-height: 480px; padding: 0; overflow: hidden; }
.chat-side { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; background: rgba(248, 247, 254, .6); }
.chat-side .cs-head { padding: 16px; border-bottom: 1px solid var(--line); }
.chat-side .cs-head h3 { font-size: 17px; margin-bottom: 12px; }
.conv-list { overflow-y: auto; padding: 8px; flex: 1; }
.conv { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 14px; cursor: pointer; transition: background .15s; position: relative; min-width: 0; }
.conv:hover { background: #fff; }
.conv.active { background: #fff; box-shadow: var(--sh); }
.conv.active::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.conv .c-main { flex: 1; min-width: 0; }
.conv .c-top { display: flex; justify-content: space-between; gap: 6px; }
.conv .c-top b { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .c-top time { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.conv .c-last { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.conv.unread .c-last { color: var(--ink); font-weight: 600; }
.conv .c-badge { min-width: 18px; height: 18px; border-radius: 99px; padding: 0 5px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.cs-sec { font-size: 11.5px; font-weight: 600; color: var(--ink-3); padding: 12px 10px 4px; letter-spacing: .03em; }

.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: linear-gradient(180deg, #fff, #fbfaff); }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .85); }
.chat-head .back { display: none; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.day-sep { align-self: center; margin: 14px 0 8px; font-size: 11.5px; color: var(--ink-3); background: var(--surface-3); padding: 3px 12px; border-radius: 99px; }
.msg { display: flex; gap: 8px; max-width: 76%; align-items: flex-end; animation: msgIn .3s var(--ease) both; }
/* ข้อความสถานะจากระบบ (แลกผลัด / วันลา) */
.msg-sys { align-self: center; max-width: 88%; margin: 6px 0; padding: 8px 14px; border-radius: 14px; text-align: center;
  background: linear-gradient(135deg, rgba(139, 92, 246, .10), rgba(59, 130, 246, .10)); border: 1px dashed rgba(139, 92, 246, .35);
  color: var(--ink-2); font-size: 12.5px; line-height: 1.55; animation: msgIn .3s var(--ease) both; }
.msg-sys small { display: block; margin-top: 2px; font-size: 10.5px; color: var(--ink-3); }
.msg-sys .sys-who { display: block; margin-bottom: 3px; font-size: 11.5px; font-weight: 700; color: var(--primary); }
/* ปฏิทินเลือกวันแลกคืน (หน้าจัดการแลกผลัด) */
.sw-cal .cal-day { min-height: 60px; padding: 4px 5px; cursor: pointer; gap: 3px; }
.sw-cal .cal-day .dn { width: 22px; height: 22px; font-size: 12px; }
.sw-cal .cal-day.past { cursor: not-allowed; opacity: .45; }
.sw-cal .cal-day.is-d1 { box-shadow: inset 0 0 0 2px #f59e0b; }
.sw-cal .cal-day.sel { box-shadow: inset 0 0 0 2px var(--primary); background: var(--primary-soft, #ede9fe); opacity: 1; }
.sw-cal .cal-day.today::before { display: none; }

/* สถานะออนไลน์ */
.av-wrap { position: relative; display: inline-flex; flex: none; }
.on-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  background: #22c55e; border: 2px solid var(--surface, #fff); box-shadow: 0 0 0 2px rgba(34, 197, 94, .25); animation: onPulse 2s ease-in-out infinite; }
.on-dot.static { position: static; display: inline-block; width: 8px; height: 8px; border-width: 0; box-shadow: none; animation: none; vertical-align: 0; }
@keyframes onPulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, .25); } 50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, .12); } }
.on-txt { color: #16a34a; font-weight: 700; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-sm); font-size: 14px; line-height: 1.55; word-break: break-word; min-width: 0; }
.msg.me .bubble { background: var(--grad); color: #fff; border-color: transparent; border-radius: 18px 18px 6px 18px; box-shadow: 0 8px 20px -10px rgba(91, 76, 245, .7); }
.msg.me .bubble a { color: #fff; text-decoration: underline; }
.msg .meta { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; padding-bottom: 3px; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.msg:not(.me) .meta { align-items: flex-start; }
.msg .meta .read { color: var(--primary); display: inline-flex; }
.msg .bubble .att-img { width: 220px; max-width: 100%; margin: 2px 0 4px; }
.msg .bubble .att-file { margin: 2px 0 4px; background: rgba(255, 255, 255, .9); color: var(--ink); }
.msg .avatar { --s: 28px !important; }
.msg.cont .avatar { visibility: hidden; }
.chat-compose { padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
.chat-compose .cc-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-compose textarea { min-height: 44px; max-height: 140px; resize: none; border-radius: 14px; padding: 11px 14px; }
.chat-compose .send { width: 44px; height: 44px; border-radius: 14px; padding: 0; flex-shrink: 0; }
.chat-empty { flex: 1; display: grid; place-items: center; text-align: center; padding: 30px; color: var(--ink-3); }
.chat-empty .big { width: 96px; height: 96px; border-radius: 30px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--sh-glow); animation: bob 5s ease-in-out infinite; }

/* =====================================================================
   HOLIDAYS / ADMIN / PROFILE
   ===================================================================== */
.hol-item { display: flex; align-items: center; gap: 14px; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.hol-item:last-child { border-bottom: 0; }
.hol-item.past { opacity: .5; }
.hol-item.next { background: linear-gradient(90deg, #fff0f7, transparent); border-radius: 12px; }
.hol-item .date-box .m { background: linear-gradient(135deg, #ec4899, #f43f5e); }
.ot-hours { font-family: var(--font-d); font-weight: 600; font-size: 16px; color: var(--primary-ink); }
.team-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.team-card { border-radius: 18px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.team-card .tc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.team-card .tc-head b { font-family: var(--font-d); font-size: 16px; }
.team-card .tc-list { display: flex; flex-direction: column; gap: 10px; }
.user-cell-actions { display: flex; gap: 8px; align-items: center; }
.tbl select { min-height: 34px; padding: 5px 30px 5px 10px; font-size: 13px; border-radius: 10px; background-position: right 8px center; }
.profile-hero { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.profile-hero .avatar { box-shadow: 0 0 0 4px #fff, 0 16px 30px -10px rgba(91, 76, 245, .6); }
.profile-hero h2 { font-size: 24px; }
.rot-preview { display: grid; grid-template-columns: 60px repeat(16, minmax(30px, 1fr)); gap: 4px; align-items: center; font-size: 11px; overflow-x: auto; }
.rot-preview .h { text-align: center; color: var(--ink-3); }
.rot-preview .chip-shift.xs { width: 100%; }

/* =====================================================================
   REPORT (แบบฟอร์มชั่วคราว)
   ===================================================================== */
.report-stage { background: #e9e7f3; border-radius: 16px; padding: 20px; overflow: auto; }
.report-paper { width: 794px; min-height: 1123px; margin: 0 auto; background: #fff; color: #111; padding: 64px 72px; font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; font-size: 16px; line-height: 1.75; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); position: relative; }
.report-paper h1 { font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; text-align: center; font-size: 22px; font-weight: 700; margin: 6px 0 2px; }
.report-paper .rp-org { text-align: center; font-size: 15px; color: #333; }
.report-paper .rp-logo { width: 64px; height: 64px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: #1e2466; color: #fff; }
.report-paper .rp-meta { display: flex; justify-content: space-between; margin: 26px 0 14px; font-size: 15px; }
.report-paper p { margin: 0 0 10px; text-indent: 48px; text-align: justify; }
.report-paper table { width: 100%; border-collapse: collapse; margin: 14px 0 18px; font-size: 15px; }
.report-paper th, .report-paper td { border: 1px solid #444; padding: 7px 10px; text-align: center; }
.report-paper th { background: #f1f1f6; font-weight: 700; }
.report-paper .rp-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px 30px; margin-top: 44px; text-align: center; font-size: 15px; }
.report-paper .rp-sign .line { margin-top: 36px; }
.report-paper .rp-stamp { position: absolute; top: 60px; right: 60px; border: 3px solid #16a34a; color: #16a34a; font-weight: 700; padding: 6px 14px; border-radius: 10px; transform: rotate(8deg); font-size: 15px; text-align: center; line-height: 1.3; }
.report-paper .rp-stamp small { display: block; font-size: 11px; font-weight: 500; }
.report-paper .rp-foot { position: absolute; left: 72px; right: 72px; bottom: 36px; font-size: 11.5px; color: #777; display: flex; justify-content: space-between; border-top: 1px solid #ddd; padding-top: 8px; }
.export-host { position: fixed; left: -20000px; top: 0; background: #fff; padding: 24px; width: max-content; }
.export-host table.matrix th, .export-host table.matrix td { position: static !important; }
.export-host .chip-shift.swapped::after, .export-host .progress > i::after { display: none; }
.page.no-anim, .page.no-anim * { animation: none !important; }

/* =====================================================================
   RESPONSIVE
   ===================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shift-now { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tb-search { display: none; }
}
@media (max-width: 1080px) {
  .g-main, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { min-height: 340px; padding: 32px 28px; }
  .auth-hero .float-card, .auth-hero .orbit.o3 { display: none; }
  .auth-hero .copy { margin-top: 60px; }
  .auth-side { margin-top: -60px; }
}
@media (max-width: 900px) {
  :root { --sb-w: 280px; }
  .sidebar { inset: 0 auto 0 0; border-radius: 0 24px 24px 0; transform: translateX(-105%); transition: transform .35s var(--ease); }
  body.sb-open .sidebar { transform: none; }
  .sb-overlay { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(21, 25, 71, .4); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  body.sb-open .sb-overlay { opacity: 1; pointer-events: all; }
  /* เว้นขอบบนให้พ้นติ่งกล้อง / Dynamic Island ของ iPhone (safe-area) */
  .main { margin-left: 0; padding: calc(10px + env(safe-area-inset-top)) 12px 96px; }
  .sidebar { padding-top: calc(18px + env(safe-area-inset-top)); }
  body::before { content: ''; position: fixed; left: 0; right: 0; top: 0; height: env(safe-area-inset-top); z-index: 31; background: rgba(238, 236, 252, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); pointer-events: none; }
  .menu-btn { display: inline-grid !important; }
  .topbar { top: calc(8px + env(safe-area-inset-top)); padding: 10px 10px 10px 12px; gap: 10px; margin-bottom: 16px; border-radius: 18px; }
  .tb-title h1 { font-size: 18px; }
  .tb-title p { display: none; }
  .tb-actions .btn-new, .demo-pill { display: none; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 35; padding: 8px 6px; border-radius: 22px; background: rgba(255, 255, 255, .9); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); border: 1px solid #fff; box-shadow: 0 16px 40px -14px rgba(40, 30, 120, .35); }
  .bn-item { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 14px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-decoration: none !important; background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; }
  .bn-item.active { color: var(--primary); }
  .bn-item.active .ic { transform: translateY(-1px); }
  .bn-item .nav-badge { position: absolute; top: 2px; left: 55%; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: #ef4444; border: 2px solid #fff; box-sizing: content-box; color: #fff; font-size: 10px; font-weight: 700; line-height: 1; display: grid; place-items: center; }
  .bn-fab { justify-content: center; }
  .bn-item.bn-fab { overflow: visible; }
  .bn-fab .fab { width: 50px; height: 50px; margin-top: -26px; border-radius: 17px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--sh-glow); border: 3px solid #fff; }
  #toasts { top: auto; bottom: 96px; left: 12px; right: 12px; }
  .toast { width: 100%; max-width: none; }
  .notif-panel { top: 70px; right: 12px; left: 12px; width: auto; }
  .chat { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 190px); }
  .chat.has-thread .chat-side { display: none; }
  .chat:not(.has-thread) .chat-main { display: none; }
  .chat-head .back { display: inline-grid; }
  .msg { max-width: 88%; }
  .matrix-wrap { max-height: calc(100vh - 330px); }
  .day-shifts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .g-2, .g-4, .form-grid, .preview { grid-template-columns: minmax(0, 1fr); }
  .g-4.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpi { padding: 14px; gap: 10px; flex-direction: column; align-items: flex-start; }
  .kpi .kpi-ic { width: 40px; height: 40px; border-radius: 12px; }
  .kpi .kpi-val { font-size: 22px; }
  .shift-now, .team-cards { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; border-radius: 18px; }
  .hero { padding: 20px; border-radius: 22px; }
  .hero h2 { font-size: 21px; }
  .week-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .month-nav h2 { font-size: 17px; min-width: 130px; }
  .toolbar { gap: 8px; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; justify-content: center; }
  .cal-day { min-height: 74px; padding: 5px 3px; gap: 3px; align-items: center; }
  .cal-day .dn { width: 24px; height: 24px; font-size: 12.5px; }
  .cal-day .chip-shift { align-self: center; height: 22px; padding: 0 5px; font-size: 11px; }
  .cal-day .chip-shift .ic, .cal-day .blk, .cal-day .hol-name { display: none; }
  .cal-day.hol::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); }
  .cal-dow { padding: 8px 2px; font-size: 11.5px; }
  .modal-back { padding: 0; align-items: end; }
  .modal { max-width: none !important; border-radius: 24px 24px 0 0; max-height: 92vh; }
  .modal-body { padding: 16px; }
  .auth-card { padding: 26px 20px; border-radius: 24px; }
  .auth-hero h1 { font-size: 28px; }
  .chat-msgs { padding: 14px 12px; }
  .tbl-cards thead { display: none; }
  .tbl-cards, .tbl-cards tbody, .tbl-cards tr, .tbl-cards td { display: block; width: 100%; }
  .tbl-cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tbl-cards td { border: 0 !important; padding: 4px 0 !important; }
  .tbl-cards td[data-l]::before { content: attr(data-l); display: inline-block; min-width: 90px; font-size: 12px; color: var(--ink-3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
/* =====================================================================
   POST CATEGORIES · LEAVE · MOTORCADE
   ===================================================================== */
.b-general { background: var(--primary-soft); color: var(--primary-ink); }
.b-equipment { background: var(--warn-soft); color: var(--warn-ink); }
.b-activity { background: var(--success-soft); color: var(--success-ink); }
.post.cat-equipment .p-strip { background: linear-gradient(90deg, #f59e0b, #f97316); }
.post.cat-activity .p-strip { background: linear-gradient(90deg, #10b981, #14b8a6); }
.post-time { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); }
.post-time .ic { color: var(--primary-2); }
.cat-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); cursor: pointer; transition: all .2s var(--ease); }
.cat-card + .cat-card { margin-top: 10px; }
.cat-card:hover { background: #fff; border-color: #cbc4ff; }
.cat-card.active { background: #fff; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(124, 92, 255, .15); }
.cat-card .cnt { margin-left: auto; font-family: var(--font-d); font-weight: 600; font-size: 18px; }

.lv-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.lv-personal { background: var(--info-soft); color: var(--info-ink); }
.lv-sick { background: var(--pink-soft); color: var(--pink-ink); }
.lv-vacation { background: var(--warn-soft); color: var(--warn-ink); }
.lv-rules { margin: 0 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); }
.mail-text { width: 100%; min-height: 300px; padding: 12px 14px; resize: vertical; font-family: inherit; font-size: 13.5px; line-height: 1.75; }
.chip-shift.s-work { background: var(--success-soft); color: var(--success-ink); }
.leave-cal .cal-day { min-height: 100px; user-select: none; }
.leave-cal .cal-day.day-off { background: repeating-linear-gradient(135deg, #f7f7fb 0 6px, #efeff5 6px 12px); cursor: not-allowed; }
.leave-cal .cal-day.day-off .dn { color: var(--ink-3); }
.leave-cal .cal-day.has-leave { background: linear-gradient(180deg, #eaf2ff, #fff); }
.leave-cal .cal-day.has-leave.lv-s { background: linear-gradient(180deg, #ffeef6, #fff); }
.leave-cal .cal-day.has-leave.lv-v { background: linear-gradient(180deg, #fff5e3, #fff); }
.leave-cal .cal-day.sel { background: #f1eeff; box-shadow: inset 0 0 0 2px var(--primary-2); }
.leave-cal .cal-day.sel::after { content: '✓'; position: absolute; top: 7px; right: 8px; width: 20px; height: 20px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; animation: pop .3s var(--ease); }
.leave-cal .cal-day:not(.day-off):hover { background: #f6f4ff; }
.leave-cal .cal-day.past { cursor: not-allowed; }
.leave-cal .cal-day.past .dn, .leave-cal .cal-day.past .chip-shift { opacity: .5; }
.leave-cal .cal-day.past:not(.day-off):not(.has-leave):hover { background: #fff; }
.sel-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.cf-days { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.cf-day { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.55; }
.cf-body, .cf-body .small { display: block; }
.cf-tag { flex-shrink: 0; margin-top: 2px; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--primary-soft); color: var(--primary-ink); }
.cf-tag.ret { background: var(--pink-soft); color: var(--pink-ink); }
.info-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 0; font-size: 14px; }
.info-list dt { color: var(--ink-3); }
.info-list dd { margin: 0; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.hr-banner { align-items: center; }
.hr-banner a { font-weight: 700; color: inherit; text-decoration: underline; }

/* ตารางขบวนเสด็จ: 1 โพสต์ต่อแถว เต็มความกว้าง ให้เห็นตารางครบ */
.mc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.mc-imgs { display: grid; gap: 10px; margin-top: 14px; }
.mc-img { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); cursor: zoom-in; min-height: 120px; }
.mc-img img { display: block; width: 100%; height: auto; }
.sheet-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 10px; background: var(--surface-2); }
.sheet-box .sheet-tabs { margin-top: 8px; max-width: 100%; overflow-x: auto; }
.sheet-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: #fff; margin-top: 10px; }
.sheet-wrap table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.sheet-wrap td, .sheet-wrap th { border: 1px solid var(--line); padding: 6px 10px; white-space: nowrap; }
.sheet-wrap tr:first-child td { background: var(--surface-3); font-weight: 600; position: sticky; top: 0; }
.expire-pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px; background: var(--warn-soft); color: var(--warn-ink); font-size: 12px; font-weight: 600; }
@media (max-width: 640px) {
  .mc-grid { grid-template-columns: minmax(0, 1fr); }
  .leave-cal .cal-day { min-height: 76px; }
  .leave-cal .lv-tag { padding: 0 4px; height: 18px; font-size: 10px; }
  .leave-cal .lv-tag .ic { display: none; }
  .leave-cal .cal-day.sel::after { width: 16px; height: 16px; font-size: 10px; top: 4px; right: 4px; }
}

/* ---------- ปฏิทินเลือกวันแลกคืน ---------- */
.rc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.rc-head .month-nav h2 { font-size: 16px; min-width: 130px; }
.swap-cal { box-shadow: none; }
.swap-cal .cal-day { min-height: 92px; }
.swap-cal .cal-day.pickable { cursor: pointer; }
.swap-cal .cal-day.pickable:hover { background: #f1eeff; }
.swap-cal .cal-day.is-d1 { outline: 2px dashed var(--primary-2); outline-offset: -3px; }
.swap-cal .cal-day.d1-cover { background: #fff0f7; cursor: help; }
/* ---------- การ์ด KPI ที่คลิกได้ / แจ้งเตือนคำขอใหม่ ---------- */
.kpi.kpi-link { cursor: pointer; position: relative; }
.kpi .kpi-arrow { margin-left: auto; color: var(--ink-3); display: grid; place-items: center; transition: transform .2s var(--ease); }
.kpi.kpi-link:hover .kpi-arrow { transform: translateX(3px); color: var(--primary); }
.kpi.kpi-alert { border: 1.5px solid #f472b6; animation: kpiBlink 1.4s ease-in-out infinite; }
.kpi.kpi-alert .kpi-ic { animation: kpiShake 1.4s ease-in-out infinite; }
.kpi.kpi-alert .kpi-val { color: #db2777; }
.kpi .kpi-new { position: absolute; top: 10px; right: 12px; padding: 2px 9px; border-radius: 99px; background: linear-gradient(135deg, #ec4899, #db2777); color: #fff; font-size: 11px; font-weight: 700; animation: kpiBadge 1.4s ease-in-out infinite; }
@keyframes kpiBlink {
  0%, 100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, .45), var(--sh-sm); background: #fff; }
  50% { box-shadow: 0 0 0 8px rgba(236, 72, 153, 0), 0 10px 26px rgba(236, 72, 153, .25); background: #fff0f7; }
}
@keyframes kpiShake { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-12deg); } 80% { transform: rotate(10deg); } 90% { transform: rotate(-6deg); } }
@keyframes kpiBadge { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .75; transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .kpi.kpi-alert, .kpi.kpi-alert .kpi-ic, .kpi .kpi-new { animation: none; } }

/* ---------- ประกาศล่าสุด: มีโพสต์ใหม่ที่ยังไม่อ่าน ---------- */
.new-posts-badge { display: inline-block; margin-left: 8px; padding: 2px 10px; border-radius: 99px; background: linear-gradient(135deg, #ec4899, #db2777); color: #fff; font-size: 11.5px; font-weight: 700; vertical-align: middle; animation: kpiBadge 1.4s ease-in-out infinite; }
.card:has(.new-posts-badge) { border: 1.5px solid #f472b6; animation: kpiBlink 1.4s ease-in-out infinite; }
.list-item.is-new { background: #fff0f7; border-radius: 12px; }
.list-item.is-new .li-main b::after { content: 'ใหม่'; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: #db2777; color: #fff; font-size: 10.5px; font-weight: 700; vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) { .card:has(.new-posts-badge), .new-posts-badge { animation: none; } }
/* การกระพริบแจ้งเตือนต้องทำงานต่อ แม้หน้าถูก re-render แบบเงียบ (.page.no-anim ปิดแอนิเมชันอื่นทั้งหมด) */
@media (prefers-reduced-motion: no-preference) {
  .page.no-anim .kpi.kpi-alert, .page.no-anim .card:has(.new-posts-badge) { animation: kpiBlink 1.4s ease-in-out infinite !important; }
  .page.no-anim .kpi.kpi-alert .kpi-ic { animation: kpiShake 1.4s ease-in-out infinite !important; }
  .page.no-anim .kpi .kpi-new, .page.no-anim .new-posts-badge { animation: kpiBadge 1.4s ease-in-out infinite !important; }
}

/* ---------- Hero หน้าภาพรวม: เอฟเฟกต์เคลื่อนไหว ---------- */
.hero { background-size: 220% 220% !important; isolation: isolate; }
.hero .hero-fx { position: absolute; inset: 0; overflow: hidden; border-radius: inherit; pointer-events: none; z-index: 0; }
.hero .orb { position: absolute; border-radius: 50%; filter: blur(38px); opacity: .5; mix-blend-mode: screen; }
.hero .orb.o1 { width: 230px; height: 230px; left: -50px; top: -70px; background: #60a5fa; }
.hero .orb.o2 { width: 270px; height: 270px; right: 6%; bottom: -130px; background: #f0abfc; }
.hero .orb.o3 { width: 170px; height: 170px; left: 42%; top: 18%; background: #a78bfa; opacity: .42; }
.hero .sweep { position: absolute; top: -20%; bottom: -20%; width: 38%; left: -70%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .16), transparent); transform: skewX(-18deg); }
.hero .spark { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px 2px rgba(255, 255, 255, .8); opacity: 0; }
.hero .wave-hand { display: inline-block; transform-origin: 70% 70%; }
.hero .h-box { transition: transform .25s var(--ease), background .25s ease, box-shadow .25s ease; }
.hero .h-box:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .19); box-shadow: 0 12px 26px rgba(20, 10, 80, .25); }
@media (prefers-reduced-motion: no-preference) {
  .hero, .page.no-anim .hero { animation: heroShift 16s ease-in-out infinite !important; }
  .hero::before, .page.no-anim .hero::before { animation: heroRing 9s ease-in-out infinite !important; }
  .hero::after, .page.no-anim .hero::after { animation: heroRing 7s ease-in-out infinite reverse !important; }
  .hero .orb.o1, .page.no-anim .hero .orb.o1 { animation: heroFloat1 12s ease-in-out infinite !important; }
  .hero .orb.o2, .page.no-anim .hero .orb.o2 { animation: heroFloat2 14s ease-in-out infinite !important; }
  .hero .orb.o3, .page.no-anim .hero .orb.o3 { animation: heroFloat3 10s ease-in-out infinite !important; }
  .hero .sweep, .page.no-anim .hero .sweep { animation: heroSweep 7s ease-in-out infinite !important; }
  .hero .spark, .page.no-anim .hero .spark { animation: heroTwinkle 3.6s ease-in-out infinite !important; animation-delay: var(--d, 0s) !important; }
  .hero .wave-hand, .page.no-anim .hero .wave-hand { animation: heroWave 2.8s ease-in-out infinite !important; }
  .hero .h-box { animation: heroRise .6s var(--ease) both; }
  .hero .h-box:nth-child(2) { animation-delay: .08s; }
  .hero .h-box:nth-child(3) { animation-delay: .16s; }
}
@keyframes heroShift { 0%, 100% { background-position: 0% 40%; } 50% { background-position: 100% 60%; } }
@keyframes heroRing { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: .55; } }
@keyframes heroFloat1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(90px, 50px) scale(1.15); } }
@keyframes heroFloat2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-110px, -40px) scale(.9); } }
@keyframes heroFloat3 { 0%, 100% { transform: translate(0, 0); } 33% { transform: translate(-60px, 30px); } 66% { transform: translate(50px, -20px); } }
@keyframes heroSweep { 0%, 55% { left: -70%; } 100% { left: 130%; } }
@keyframes heroTwinkle { 0%, 100% { opacity: 0; transform: scale(.4); } 50% { opacity: .95; transform: scale(1.2); } }
@keyframes heroWave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } }
@keyframes heroRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.cal-owner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 10px; border-radius: 14px; background: var(--primary-soft); border: 1px solid #ddd6ff; }
.cal-owner > div { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.cal-owner b { font-size: 15px; color: var(--primary-ink); }
.swap-cal .cal-day.sel { background: #efeaff; }
.swap-cal .cal-day .blk { font-size: 10.5px; }

/* ---------- รายงานแลกผลัด (A4 แนวนอน ตามแบบฟอร์มหน่วยงาน) ---------- */
.shift-report { width: 1123px; min-height: 794px; margin: 0 auto; background: #fff; color: #111; padding: 110px 76px 60px; font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); }
.shift-report h1 { font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; font-size: 22px; font-weight: 600; text-align: center; margin: 0 0 26px; letter-spacing: 0; white-space: nowrap; }
.shift-report table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 16px; }
.shift-report th, .shift-report td { border: 1px solid #222; padding: 8px 6px; text-align: center; vertical-align: middle; word-break: break-word; }
.shift-report th { font-weight: 700; height: 40px; }
.shift-report td { height: 56px; }
.shift-report .sr-center { text-align: center; font-weight: 700; font-size: 17px; margin: 56px 0 18px; }
.shift-report .sr-note { font-size: 16px; margin: 44px 0 0; }

/* ---------- แบบฟอร์มรายการเสด็จฯ (พรีวิวไฟล์ Excel) ---------- */
.mc-form { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px 16px 14px; margin-top: 12px; font-family: 'Sarabun', 'Noto Sans Thai', sans-serif; color: #111; }
.mcf-title { text-align: center; font-weight: 700; font-size: 17px; line-height: 1.55; }
.mcf-update { text-align: right; font-style: italic; font-size: 12.5px; color: #555; margin: 2px 0 4px; }
.mcf-scroll { overflow-x: auto; margin-top: 8px; }
.mcf-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14px; }
.mcf-table th, .mcf-table td { border: 1px solid #333; padding: 6px 7px; vertical-align: middle; text-align: center; overflow-wrap: anywhere; overflow: hidden; }
.mcf-table th { word-break: keep-all; overflow-wrap: normal; font-size: 13px; padding: 6px 4px; }
.mcf-table th { font-weight: 700; background: #f4f4f8; }
.mcf-table td.c-name { text-align: left; }
.mcf-table td.c-note { font-size: 12.5px; line-height: 1.4; }
.mcf-table td.c-date { white-space: normal; }
.mcf-table tr.is-past td { color: #9a9aa8; }
/* แถววันนี้ = สีเหลือง + ป้าย "วันนี้" กะพริบเบา ๆ (รายการที่มี * แสดงเหมือนแถวปกติ) */
.mcf-table tr.is-today td { background: #fff1a8; color: #111; font-weight: 600; animation: mcToday 2.4s ease-in-out infinite; }
.mcf-table tr.is-today td:first-child { box-shadow: inset 5px 0 0 #f59e0b; }
.mcf-table .today-tag { display: block; width: max-content; margin: 4px auto 0; padding: 2px 10px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; font-family: var(--font); letter-spacing: .3px; box-shadow: 0 0 0 0 rgba(239, 68, 68, .6); animation: mcTag 1.6s ease-out infinite; }
.mcf-table .today-tag::before { content: '● '; }
@keyframes mcToday { 0%, 100% { background: #fff1a8; } 50% { background: #ffe066; } }
@keyframes mcTag { 0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .55); } 70% { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); } 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); } }
@media (prefers-reduced-motion: reduce) { .mcf-table tr.is-today td, .mcf-table .today-tag { animation: none; } }
.mcf-table .mtb { display: inline-block; padding: 0 6px; border-radius: 6px; background: #e3f4e8; color: #137333; font-weight: 700; font-size: 11.5px; }
.mcf-foot { margin-top: 10px; font-size: 13.5px; font-weight: 600; line-height: 1.75; }
.mcf-foot div + div { padding-left: 78px; }
.mcf-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--ink-3); font-family: var(--font); }
.mcf-legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid #ccc; }
.mcf-legend .lg-today::before { background: #fff1a8; border-color: #f59e0b; }
.mcf-legend .lg-past::before { background: #fff; border-color: #bbb; }
@media (max-width: 640px) { .mcf-foot div + div { padding-left: 0; } }
/* จอ PC: ตารางย่อพอดีกล่อง เห็นทั้งแผ่น · จอแคบ (มือถือ): คงความกว้างขั้นต่ำแล้วเลื่อนซ้าย-ขวา */
@media (max-width: 900px) { .mcf-table { min-width: 860px; } }

@media print {
  .sidebar, .topbar, .bottom-nav, #toasts { display: none !important; }
  .main { margin: 0; padding: 0; }
}
