/* PRT KC-style home dashboard */

body.prt-kc-home .prt-page-head,
body.prt-kc-home .prt-kpi-row {
  display: none !important;
}

body.prt-kc-home .prt-main {
  padding-left: 0;
  padding-right: 0;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 992px) {
  body.prt-kc-home .prt-main {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-bottom: 1.5rem;
  }

  body.prt-kc-home .prt-kh-tabbar {
    display: none;
  }

  .prt-kh-wrap {
    max-width: 720px;
    margin: 0 auto;
  }
}

.prt-kh-role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(232, 197, 71, 0.18);
  color: var(--prt-night-gold-soft, #f5dfa0);
  border: 1px solid rgba(232, 197, 71, 0.35);
  white-space: nowrap;
}

html.dark .prt-kh-role-badge,
html.theme-dark .prt-kh-role-badge {
  background: rgba(232, 197, 71, 0.15);
  color: #f5dfa0;
  border-color: rgba(232, 197, 71, 0.28);
}

body.prt-kc-home .prt-mob-header {
  background: linear-gradient(135deg, #5c1a33 0%, #3d0f22 52%, #120810 100%);
  border-bottom: 1px solid rgba(232, 197, 71, 0.12);
}

.prt-kh-wrap {
  font-family: 'Kanit', system-ui, sans-serif;
}

.prt-kh-scroll {
  padding-bottom: 8px;
}

.prt-kh-status-block {
  padding: 8px 12px 6px;
}

.prt-kh-hero {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 140px 100px at 88% 22%, rgba(232, 197, 71, 0.22) 0%, transparent 72%),
    radial-gradient(ellipse 100px 80px at 92% 68%, rgba(92, 26, 51, 0.35) 0%, transparent 70%),
    linear-gradient(145deg, #120810 0%, #3d0f22 48%, #5c1a33 100%);
  box-shadow: 0 4px 18px rgba(61, 15, 34, 0.35), 0 1px 3px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(232, 197, 71, 0.14);
}

.prt-kh-hero-deco {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 30, 66, 0.05) 0%, rgba(7, 30, 66, 0.22) 100%);
  pointer-events: none;
}

.prt-kh-hero-brand {
  position: absolute;
  top: 18px;
  right: 14px;
  width: min(38%, 120px);
  text-align: right;
  pointer-events: none;
  z-index: 2;
  opacity: 0.94;
}

.prt-kh-hero-brand-main {
  display: block;
  font-size: clamp(9px, 2.6vw, 12px);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
}

.prt-kh-hero-brand-sub {
  display: block;
  font-size: clamp(14px, 4vw, 18px);
  font-weight: 800;
  color: #ffc107;
  letter-spacing: 0.06em;
  line-height: 1.1;
}

.prt-kh-hero-brand-rule {
  display: block;
  height: 2px;
  width: 100%;
  max-width: 48px;
  margin-top: 4px;
  margin-left: auto;
  background: #ffc107;
  border-radius: 1px;
}

.prt-kh-hero-inner {
  position: relative;
  z-index: 1;
  padding: 18px 16px 14px;
  color: #fff;
}

.prt-kh-hero-title {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.92;
  margin-bottom: 10px;
}

.prt-kh-hero-content {
  max-width: calc(100% - 100px);
}

.prt-kh-timeline {
  position: relative;
  --prt-kh-track-x: 11px;
  --prt-kh-track-scale: 0;
}

.prt-kh-timeline::before {
  content: '';
  position: absolute;
  left: calc(var(--prt-kh-track-x) - 1.5px);
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.16) 50%, rgba(255,255,255,0.06) 100%);
}

.prt-kh-timeline::after {
  content: '';
  position: absolute;
  left: calc(var(--prt-kh-track-x) - 1.5px);
  top: 8px;
  width: 3px;
  height: calc(100% - 16px);
  border-radius: 3px;
  background: linear-gradient(180deg, #86efac 0%, #4ade80 38%, #2dd4bf 72%, #22d3ee 100%);
  transform: scaleY(var(--prt-kh-track-scale));
  transform-origin: top center;
  transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

/* Sup: สรุปสถานะทีม ไม่ใช่ progress ขั้นตอน — ซ่อนเส้นเขียว */
body.prt-role-sup .prt-kh-timeline::after {
  display: none !important;
}

body.prt-role-sup .prt-kh-step.done .prt-kh-node,
body.prt-role-sup .prt-kh-step.current .prt-kh-node {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.prt-kh-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
}

.prt-kh-step:last-child {
  padding-bottom: 0;
}

.prt-kh-node {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: transparent;
  flex-shrink: 0;
  margin-top: 3px;
  margin-left: calc(var(--prt-kh-track-x) - 6.5px);
  position: relative;
  z-index: 1;
}

.prt-kh-step.done .prt-kh-node {
  background: #4ade80;
  border-color: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.55);
}

.prt-kh-step.current .prt-kh-node {
  background: #fff;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
}

.prt-kh-step-body {
  flex: 1;
  min-width: 0;
  margin-left: -6px;
}

.prt-kh-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.prt-kh-lbl {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

.prt-kh-val {
  font-size: 12px;
  font-weight: 700;
}

.prt-kh-sub,
.prt-kh-msg {
  font-size: 11px;
  opacity: 0.82;
  margin-top: 2px;
  line-height: 1.35;
}

.prt-kh-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.prt-kh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.prt-kh-dot.ok { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }
.prt-kh-dot.wait { background: #fbbf24; }
.prt-kh-dot.off { background: rgba(255,255,255,0.35); }

.prt-kh-checkin-embed {
  margin: 0 16px 16px;
  padding: 14px 14px 4px;
  border-radius: 16px;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed {
  background: #fff;
  box-shadow: 0 2px 12px rgba(61, 15, 34, 0.08);
  border: 1px solid rgba(92, 26, 51, 0.12);
  color: #1e293b;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed {
  background: var(--prt-night-card, #1a1420);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(232, 197, 71, 0.12);
  color: #f1f5f9;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-kh-section-title {
  color: #5c1a33;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-kh-section-sub {
  color: #64748b;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-today-banner {
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  border-color: #f9a8d4;
  color: #831843;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-today-banner.is-active {
  background: linear-gradient(135deg, #ecfdf5, #d1fae5);
  border-color: #34d399;
  color: #065f46;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .text-secondary,
html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-week-hint,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .text-secondary,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-week-hint {
  color: #c4b5c0 !important;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-kh-section-title,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-kh-section-title {
  color: #f5dfa0;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-today-banner,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-today-banner {
  background: linear-gradient(135deg, rgba(92, 26, 51, 0.65), rgba(26, 8, 18, 0.9));
  border-color: rgba(232, 197, 71, 0.4);
  color: #f5dfa0;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-today-banner.is-active,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-today-banner.is-active {
  background: linear-gradient(135deg, rgba(6, 95, 70, 0.55), rgba(4, 47, 46, 0.75));
  border-color: #34d399;
  color: #a7f3d0;
}

.prt-kh-checkin-embed .prt-ci-mobile-flow {
  margin: 0;
}

.prt-kh-checkin-embed .prt-ci-hub-btn {
  width: 100%;
}

.prt-kh-board-card--solo {
  grid-column: 1 / -1;
}

.prt-kh-board-grid--stack {
  grid-template-columns: 1fr;
}

.prt-kh-pulse {
  margin: 0 16px 12px;
  padding: 0 12px 12px;
}

.prt-kh-pulse-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e3eaf5;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.prt-kh-pulse-card.is-done {
  border-color: rgba(46, 125, 50, 0.35);
  box-shadow: 0 4px 20px rgba(46, 125, 50, 0.12);
}

.prt-kh-ring-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.prt-kh-ring {
  width: 64px;
  height: 64px;
  transform: rotate(-90deg);
}

.prt-kh-ring-bg {
  fill: none;
  stroke: #e8edf3;
  stroke-width: 5;
}

.prt-kh-ring-fg {
  fill: none;
  stroke: var(--prt-night-gold, #e8c547);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 175.93;
  stroke-dashoffset: 175.93;
  transition: stroke-dashoffset 0.45s ease, stroke 0.3s ease;
}

.prt-kh-pulse-card.is-done .prt-kh-ring-fg {
  stroke: #2e7d32;
}

.prt-kh-ring-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #5c1a33;
}

.prt-kh-pulse-card.is-done .prt-kh-ring-pct {
  color: #2e7d32;
}

.prt-kh-pulse-body {
  flex: 1;
  min-width: 0;
}

.prt-kh-pulse-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.prt-kh-pulse-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.3;
}

.prt-kh-pulse-sub {
  font-size: 12px;
  color: #64748b;
  margin-top: 4px;
  line-height: 1.4;
}

.prt-kh-pulse-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
  font-size: 10px;
  color: #64748b;
  text-align: center;
}

.prt-kh-pulse-stats b {
  display: block;
  font-size: 14px;
  color: #5c1a33;
  font-weight: 800;
}

.prt-kh-pulse-btn {
  display: block;
  margin-top: 10px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #5c1a33, #3d0f22);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(92, 26, 51, 0.28);
}

.prt-kh-leave-cta {
  padding: 0 12px 14px;
}
.prt-kh-leave-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  text-decoration: none;
  background: linear-gradient(135deg, #fdf2f8, #fce7f3);
  border: 1px solid #f9a8d4;
  color: #831843;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.12);
}
.prt-kh-leave-btn--sup {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
  border-color: #bbf7d0;
  color: #166534;
}
.prt-kh-leave-ic {
  font-size: 22px;
  line-height: 1;
}
.prt-kh-leave-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.prt-kh-leave-body strong {
  font-size: 15px;
}
.prt-kh-leave-body span {
  font-size: 12px;
  opacity: 0.85;
}
.prt-kh-leave-arrow {
  font-size: 18px;
  opacity: 0.7;
}

.prt-kh-board {
  padding: 0 12px 14px;
}

.prt-kh-summary-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}
.prt-kh-date-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #64748b;
  min-width: 120px;
}
.prt-kh-summary-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (min-width: 380px) {
  .prt-kh-summary-kpis {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.prt-kh-summary-kpi {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
}
.prt-kh-summary-kpi-lbl {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.prt-kh-summary-kpi-val {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}
.prt-kh-ot-table-wrap {
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}
.prt-kh-ot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.prt-kh-ot-table th,
.prt-kh-ot-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.prt-kh-ot-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
}
.prt-kh-sales-btn {
  border: none;
  background: transparent;
  color: #2563eb;
  font-weight: 700;
  font-size: 12px;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}
.prt-kh-sales-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.prt-kh-sales-popup[hidden] { display: none !important; }
.prt-kh-sales-popup-card {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 14px;
  max-height: min(70vh, 560px);
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
}
.prt-kh-sales-popup-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
}
.prt-kh-sales-popup-body { padding: 12px 14px 16px; }
.prt-kh-sales-detail {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.prt-kh-sales-detail th,
.prt-kh-sales-detail td {
  padding: 6px 4px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}

.prt-kh-section-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 10px;
  padding: 0 2px;
}

.prt-kh-section-sub {
  font-size: 11px;
  color: #64748b;
  margin: -6px 0 10px;
  padding: 0 2px;
}

.prt-kh-board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.prt-kh-board-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px 14px;
  border: 1px solid #e3eaf5;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 4px 6px -1px rgba(21, 101, 192, 0.08);
  text-decoration: none;
  color: inherit;
}

.prt-kh-board-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
}

.prt-kh-board-val {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.05;
  color: var(--prt-night-gold, #e8c547);
}

.prt-kh-board-val.is-zero {
  color: #cbd5e1;
}

.prt-kh-board-val.is-alert {
  color: #c62828;
}

.prt-kh-board-hint {
  font-size: 9px;
  color: #94a3b8;
}

.prt-kh-alerts {
  margin: 0 12px 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7ed;
  border: 2px solid #fb923c;
}

.prt-kh-checkout-alert {
  margin: 0 12px 14px;
}
.prt-kh-checkout-alert-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  box-shadow: 0 4px 14px rgba(234, 88, 12, 0.12);
}
.prt-kh-checkout-alert.is-urgent .prt-kh-checkout-alert-inner {
  background: #fef2f2;
  border-color: #f87171;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.16);
  animation: prtKhCheckoutPulse 1.8s ease-in-out infinite;
}
.prt-kh-checkout-alert.is-soon .prt-kh-checkout-alert-inner {
  background: #fff7ed;
  border-color: #fb923c;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.18);
  animation: prtKhCheckoutPulse 2s ease-in-out infinite;
}
.prt-kh-checkout-alert-text {
  flex: 1;
  min-width: 0;
}
.prt-kh-checkout-alert-text strong {
  display: block;
  font-size: 14px;
  color: #9a3412;
  line-height: 1.3;
}
.prt-kh-checkout-alert.is-urgent .prt-kh-checkout-alert-text strong {
  color: #b91c1c;
}
.prt-kh-checkout-alert.is-soon .prt-kh-checkout-alert-text strong {
  color: #c2410c;
}
.prt-kh-checkout-alert-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #9a3412;
  line-height: 1.35;
}
.prt-kh-checkout-alert.is-urgent .prt-kh-checkout-alert-sub {
  color: #991b1b;
}
.prt-kh-checkout-alert.is-soon .prt-kh-checkout-alert-sub {
  color: #9a3412;
}
.prt-kh-checkout-alert-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: #ea580c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.prt-kh-checkout-alert.is-urgent .prt-kh-checkout-alert-btn {
  background: #dc2626;
}
.prt-kh-checkout-alert.is-soon .prt-kh-checkout-alert-btn {
  background: #ea580c;
}
.prt-kh-checkout-alert-btn:hover {
  color: #fff;
  filter: brightness(1.05);
}
@keyframes prtKhCheckoutPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(220, 38, 38, 0.22); }
}

.prt-kh-tab-fab.is-urgent .prt-kh-tab-ic {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border-color: rgba(254, 202, 202, 0.5);
}

.prt-kh-alerts-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 800;
  color: #9a3412;
  margin-bottom: 8px;
}

.prt-kh-alerts-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 13px;
  font-weight: 700;
  color: #7c2d12;
  line-height: 1.45;
}

.prt-kh-section {
  padding: 0 12px 16px;
}

.prt-kh-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #e2e8f0;
}

html.theme-dark .prt-kh-empty {
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.45);
  border-color: rgba(255, 255, 255, 0.12);
}

.prt-kh-cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.prt-kh-cal-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 11px;
}

.prt-kh-cal-day.is-today {
  border-color: #5c1a33;
  background: #fce7f3;
}

.prt-kh-cal-day.has-event {
  background: #fff3e0;
  border-color: #ffb74d;
}

.prt-kh-cal-day .dow {
  font-size: 10px;
  color: #64748b;
}

.prt-kh-cal-day .num {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
}

.prt-kh-cal-day .cnt {
  font-size: 9px;
  color: #f57c00;
  margin-top: 2px;
}

.prt-kh-team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: #fff;
  border: 1px solid #e3eaf5;
  border-radius: 12px;
  overflow: hidden;
}

.prt-kh-team-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.prt-kh-team-list li:last-child {
  border-bottom: none;
}

.prt-kh-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.prt-kh-badge.ok { background: #e8f5e9; color: #2e7d32; }
.prt-kh-badge.wait { background: #fff8e1; color: #f57f17; }
.prt-kh-badge.off { background: #f1f5f9; color: #64748b; }

.prt-kh-link-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.prt-kh-link-tile {
  display: block;
  padding: 14px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e3eaf5;
  text-decoration: none;
  color: #1e293b;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.prt-kh-wrap--work-hub .prt-kh-scroll {
  padding: 12px 14px 24px;
}

body.prt-mob-menu-open .prt-kh-tabbar {
  z-index: 90;
  pointer-events: none;
}

.prt-kh-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1040;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  min-height: calc(58px + env(safe-area-inset-bottom, 0px));
  padding: 24px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.98);
  border-top: 1px solid rgba(21, 101, 192, 0.12);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

.prt-kh-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  max-width: 72px;
  padding: 6px 2px 4px;
  border: none;
  background: none;
  color: #64748b;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  position: relative;
  border-radius: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}

.prt-kh-tab.on {
  color: #5c1a33;
  background: rgba(92, 26, 51, 0.08);
  font-weight: 700;
}

.prt-kh-tab.on::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: #5c1a33;
}

.prt-kh-tab-ic {
  font-size: 20px;
  line-height: 1;
}

.prt-kh-tab.on .prt-kh-tab-lbl {
  font-weight: 700;
}

.prt-kh-tab-lbl {
  font-size: 10px;
  font-weight: 600;
}

.prt-kh-tab-fab {
  position: relative;
  margin-top: -22px;
  background: none !important;
}

.prt-kh-tab-fab.on {
  background: none !important;
}

.prt-kh-tab-fab.on::before {
  display: none;
}

.prt-kh-tab-fab.on .prt-kh-tab-ic {
  box-shadow: 0 8px 26px rgba(61, 15, 34, 0.55), 0 0 0 3px rgba(92, 26, 51, 0.25);
}

.prt-kh-tab-fab.on .prt-kh-tab-fab-lbl {
  color: #5c1a33;
  font-weight: 800;
}

.prt-kh-tab-fab .prt-kh-tab-ic {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #5c1a33, #3d0f22);
  color: var(--prt-night-gold, #e8c547);
  font-size: 22px;
  box-shadow: 0 8px 26px rgba(61, 15, 34, 0.55);
  border: 2px solid rgba(232, 197, 71, 0.35);
}

.prt-kh-tab-fab.pulse .prt-kh-tab-ic {
  animation: prtKhFabPulse 2.6s ease-in-out infinite;
}

.prt-kh-tab-fab.is-checkout .prt-kh-tab-ic {
  background: linear-gradient(135deg, #f57c00, #e65100);
}

.prt-kh-tab-fab.is-done .prt-kh-tab-ic {
  background: linear-gradient(135deg, #2e7d32, #1b5e20);
  animation: none;
}

@keyframes prtKhFabPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 26px rgba(61, 15, 34, 0.55); }
  50% { transform: scale(1.05); box-shadow: 0 10px 30px rgba(232, 197, 71, 0.35); }
}

.prt-kh-tab-fab-lbl {
  color: var(--prt-night-gold-soft, #f5dfa0);
  font-weight: 700;
}

html.dark .prt-kh-pulse-card,
html.theme-dark .prt-kh-pulse-card,
html.dark .prt-kh-checkin-embed,
html.theme-dark .prt-kh-checkin-embed,
html.dark .prt-kh-board-card,
html.theme-dark .prt-kh-board-card,
html.dark .prt-kh-link-tile,
html.theme-dark .prt-kh-link-tile,
html.dark .prt-kh-team-list,
html.theme-dark .prt-kh-team-list {
  background: var(--prt-night-card, #1a1420);
  border-color: rgba(232, 197, 71, 0.1);
}

/* สรุปการทำงาน + รายงานยอดขาย (Sup / PC) */
html.theme-dark .prt-kh-date-field,
html.dark .prt-kh-date-field {
  color: #c4b5c0;
}
html.theme-dark .prt-kh-summary-kpi,
html.dark .prt-kh-summary-kpi {
  background: var(--prt-night-card, #1a1420);
  border-color: rgba(232, 197, 71, 0.14);
}
html.theme-dark .prt-kh-summary-kpi-lbl,
html.dark .prt-kh-summary-kpi-lbl {
  color: #c4b5c0;
}
html.theme-dark .prt-kh-summary-kpi-val,
html.dark .prt-kh-summary-kpi-val {
  color: #f1f5f9;
}
html.theme-dark .prt-kh-ot-table-wrap,
html.dark .prt-kh-ot-table-wrap {
  background: var(--prt-night-card, #1a1420);
  border-color: rgba(232, 197, 71, 0.14);
}
html.theme-dark .prt-kh-ot-table th,
html.dark .prt-kh-ot-table th {
  background: rgba(15, 10, 18, 0.85);
  color: #c4b5c0;
}
html.theme-dark .prt-kh-ot-table th,
html.theme-dark .prt-kh-ot-table td,
html.dark .prt-kh-ot-table th,
html.dark .prt-kh-ot-table td {
  border-bottom-color: #3d2a35;
  color: #e2e8f0;
}
html.theme-dark .prt-kh-ot-table .text-secondary,
html.dark .prt-kh-ot-table .text-secondary {
  color: #94a3b8 !important;
}
html.theme-dark .prt-kh-sales-btn,
html.dark .prt-kh-sales-btn {
  color: #93c5fd;
}
html.theme-dark .prt-kh-sales-popup-card,
html.dark .prt-kh-sales-popup-card {
  background: var(--prt-night-card, #1a1420);
  color: #f1f5f9;
  border: 1px solid rgba(232, 197, 71, 0.14);
}
html.theme-dark .prt-kh-sales-popup-head,
html.dark .prt-kh-sales-popup-head {
  border-bottom-color: #3d2a35;
}
html.theme-dark .prt-kh-sales-popup-head .btn-close,
html.dark .prt-kh-sales-popup-head .btn-close {
  filter: invert(1) grayscale(1);
}
html.theme-dark .prt-kh-sales-detail th,
html.theme-dark .prt-kh-sales-detail td,
html.dark .prt-kh-sales-detail th,
html.dark .prt-kh-sales-detail td {
  border-bottom-color: #3d2a35;
  color: #e2e8f0;
}
html.theme-dark .prt-kh-board-lbl,
html.theme-dark .prt-kh-board-hint,
html.dark .prt-kh-board-lbl,
html.dark .prt-kh-board-hint {
  color: #c4b5c0;
}
html.theme-dark .prt-kh-board-val,
html.dark .prt-kh-board-val {
  color: var(--prt-night-gold-soft, #f5dfa0);
}
html.theme-dark .prt-kh-board-val.is-zero,
html.dark .prt-kh-board-val.is-zero {
  color: #94a3b8;
}
html.theme-dark .prt-kh-team-list li,
html.dark .prt-kh-team-list li {
  border-bottom-color: #3d2a35;
  color: #e2e8f0;
}
html.theme-dark .prt-kh-badge.ok,
html.dark .prt-kh-badge.ok {
  background: rgba(22, 101, 52, 0.4);
  color: #bbf7d0;
}
html.theme-dark .prt-kh-badge.wait,
html.dark .prt-kh-badge.wait {
  background: rgba(180, 83, 9, 0.35);
  color: #fde68a;
}
html.theme-dark .prt-kh-badge.off,
html.dark .prt-kh-badge.off {
  background: rgba(71, 85, 105, 0.45);
  color: #cbd5e1;
}
html.theme-dark .prt-kh-alerts,
html.dark .prt-kh-alerts {
  background: rgba(124, 45, 18, 0.35);
  border-color: rgba(251, 146, 60, 0.55);
  color: #fed7aa;
}
html.theme-dark .prt-kh-checkout-alert-inner,
html.dark .prt-kh-checkout-alert-inner {
  background: rgba(124, 45, 18, 0.35);
  border-color: rgba(251, 146, 60, 0.45);
  color: #fed7aa;
}
html.theme-dark .prt-kh-leave-btn,
html.dark .prt-kh-leave-btn {
  background: linear-gradient(135deg, rgba(92, 26, 51, 0.55), rgba(26, 20, 32, 0.95));
  border-color: rgba(232, 197, 71, 0.25);
  color: #f5dfa0;
}
html.theme-dark .prt-kh-leave-btn--sup,
html.dark .prt-kh-leave-btn--sup {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.45), rgba(26, 20, 32, 0.95));
  border-color: rgba(52, 211, 153, 0.35);
  color: #a7f3d0;
}
html.theme-dark .prt-kh-cal-day,
html.dark .prt-kh-cal-day {
  background: var(--prt-night-card, #1a1420);
  border-color: #3d2a35;
}
html.theme-dark .prt-kh-cal-day.is-today,
html.dark .prt-kh-cal-day.is-today {
  background: rgba(92, 26, 51, 0.45);
  border-color: var(--prt-night-gold, #e8c547);
}
html.theme-dark .prt-kh-cal-day.has-event,
html.dark .prt-kh-cal-day.has-event {
  background: rgba(120, 53, 15, 0.4);
  border-color: rgba(251, 146, 60, 0.45);
}
html.theme-dark .prt-kh-cal-day .dow,
html.dark .prt-kh-cal-day .dow {
  color: #c4b5c0;
}
html.theme-dark .prt-kh-cal-day .num,
html.dark .prt-kh-cal-day .num {
  color: #f1f5f9;
}

html.dark .prt-kh-pulse-title,
html.theme-dark .prt-kh-pulse-title,
html.dark .prt-kh-section-title,
html.theme-dark .prt-kh-section-title {
  color: #f1f5f9;
}

html.dark .prt-kh-tabbar,
html.theme-dark .prt-kh-tabbar {
  background: rgba(18, 8, 16, 0.98);
  border-top-color: rgba(232, 197, 71, 0.12);
}

html.theme-dark body.prt-kc-home .prt-kh-tab:not(.on),
html.dark body.prt-kc-home .prt-kh-tab:not(.on) {
  color: #94a3b8;
  background: transparent;
}

html.theme-dark body.prt-kc-home .prt-kh-tab.on,
html.dark body.prt-kc-home .prt-kh-tab.on {
  color: var(--prt-night-gold-soft, #f5dfa0);
  background: rgba(232, 197, 71, 0.12);
}

html.theme-dark body.prt-kc-home .prt-kh-tab.on::before,
html.dark body.prt-kc-home .prt-kh-tab.on::before {
  background: var(--prt-night-gold, #e8c547);
}

html.theme-dark body.prt-kc-home .prt-kh-tab-fab.on .prt-kh-tab-fab-lbl,
html.dark body.prt-kc-home .prt-kh-tab-fab.on .prt-kh-tab-fab-lbl {
  color: var(--prt-night-gold-soft, #f5dfa0);
}

html.theme-dark body.prt-kc-home .prt-kh-tab-fab.on .prt-kh-tab-ic,
html.dark body.prt-kc-home .prt-kh-tab-fab.on .prt-kh-tab-ic {
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(232, 197, 71, 0.35);
}

/* ── KC Home mobile: nightlife dark (อ่านง่ายกลางคืน) ── */
html.theme-dark body.prt-kc-home,
body.prt-kc-home.prt-dark {
  background: var(--prt-night-bg, #120810);
}

html.theme-dark body.prt-kc-home .prt-main {
  background: transparent;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-kh-section-title,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-kh-section-title {
  color: var(--prt-night-gold-soft, #f5dfa0);
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-kh-section-sub,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-kh-section-sub {
  color: #c4b5c0;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-calendar-section,
html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-action-form,
html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-day-panel,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-calendar-section,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-action-form,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-day-panel {
  background: rgba(26, 20, 32, 0.92);
  border-color: #3d2a35;
  color: #f1f5f9;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-calendar-section,
html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-action-form,
html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-day-panel {
  background: #faf8fb;
  border-color: #e9d5df;
  color: #1e293b;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-cal {
  background: #141018;
  border-color: #3d2a35;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal {
  background: #fff;
  border-color: #e9d5df;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-head,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-cal-head {
  background: rgba(61, 15, 34, 0.35);
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-head {
  background: #fdf2f8;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day .num,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-cal-day .num {
  color: #e2e8f0;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day .num {
  color: #334155;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day.is-today .num,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-cal-day.is-today .num {
  color: var(--prt-night-gold, #e8c547);
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day.is-today .num {
  color: #5c1a33;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day.is-selected,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-cal-day.is-selected {
  background: rgba(92, 26, 51, 0.35);
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-cal-day.is-selected {
  background: rgba(92, 26, 51, 0.08);
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-event-card,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-event-card {
  background: rgba(20, 16, 24, 0.8);
  border-color: #3d2a35;
  color: #f1f5f9;
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-event-card {
  background: #fff;
  border-color: #e9d5df;
  color: #1e293b;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-event-card.is-selected,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-event-card.is-selected {
  border-color: var(--prt-night-gold, #e8c547);
  background: rgba(92, 26, 51, 0.4);
}

html.theme-light body.prt-kc-home .prt-kh-checkin-embed .prt-ci-event-card.is-selected {
  border-color: #5c1a33;
  background: #fdf2f8;
}

html.theme-dark body.prt-kc-home .prt-kh-checkin-embed .prt-ci-hub-btn.checkout,
body.prt-kc-home.prt-dark .prt-kh-checkin-embed .prt-ci-hub-btn.checkout {
  background: linear-gradient(135deg, #5c1a33, #3d0f22);
  border: 1px solid rgba(232, 197, 71, 0.25);
}

html.theme-light body.prt-kc-home {
  background: #f8f4f6;
}

html.theme-light body.prt-kc-home .prt-kh-section-title {
  color: #1e293b;
}

html.theme-light body.prt-kc-home .prt-kh-board-val {
  color: #5c1a33;
}

html.theme-light body.prt-kc-home .prt-kh-ring-pct {
  color: #5c1a33;
}

html.theme-light body.prt-kc-home .prt-kh-tab-fab-lbl {
  color: #5c1a33;
}
