:root {
  --nu-orange: #df6316;
  --nu-orange-hover: #c8540e;
  --nu-orange-active: #ab4508;
  --nu-orange-lip: #9e3f07;
  --nu-orange-soft: #fef3ea;
  --nu-orange-border: #f3cdb0;

  --nu-bg: #f4ece4;
  --nu-surface: #ffffff;
  --nu-window-header: #f8f5f1;
  --nu-border: #ded5cc;
  --nu-border-strong: #c7bbb0;
  --nu-text: #1f1b18;
  --nu-muted: #665d56;

  --bs-primary: #df6316;
  --bs-primary-rgb: 223, 99, 22;
  --bs-body-bg: #f4ece4;
  --bs-body-color: #1f1b18;
}

body {
  font-family: "Sarabun", "Noto Sans Thai", "Prompt", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--nu-bg);
  background-image:
    linear-gradient(130deg, rgba(255, 255, 255, 0.65) 0%, rgba(255, 255, 255, 0.65) 26%, transparent 26.1%, transparent 100%),
    linear-gradient(210deg, rgba(255, 255, 255, 0.45) 0%, rgba(255, 255, 255, 0.45) 34%, transparent 34.1%, transparent 100%);
  background-attachment: fixed;
  color: var(--nu-text);
  font-variant-numeric: tabular-nums;
  padding-bottom: env(safe-area-inset-bottom, 0);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  right: -80px;
  top: 56px;
  width: 560px;
  height: 560px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 400' fill='none'%3E%3Ccircle cx='200' cy='200' r='175' stroke='%23ffffff' stroke-width='16' stroke-opacity='0.6'/%3E%3Cpolygon points='200,40 352,150 294,330 106,330 48,150' stroke='%23ffffff' stroke-width='8' stroke-opacity='0.55' fill='%23ffffff' fill-opacity='0.16'/%3E%3Cpath d='M200 40 L200 200 M352 150 L200 200 M294 330 L200 200 M106 330 L200 200 M48 150 L200 200' stroke='%23ffffff' stroke-width='4' stroke-opacity='0.45'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
  z-index: 0;
}

body > nav,
body > main,
body > footer {
  position: relative;
  z-index: 1;
}

@media (max-width: 991.98px) {
  body.has-mobile-nav {
    padding-bottom: 74px;
  }
}

/* ==========================================================================
   1. NAVIGATION BAR
   ========================================================================== */
.nu-navbar {
  background: #ffffff;
  border-top: 3px solid var(--nu-orange);
  border-bottom: 1px solid var(--nu-border);
  box-shadow: 0 1px 3px rgba(25, 18, 12, 0.05);
}

.nu-brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.nu-login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.nu-nav-pill {
  border-radius: 8px;
  padding: 0.42rem 0.85rem !important;
  font-weight: 600;
  font-size: 0.92rem;
  color: #49413b !important;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.nu-nav-pill:hover {
  background-color: #f6f1eb;
  color: var(--nu-text) !important;
}

.nu-nav-pill.active {
  background-color: var(--nu-orange-soft);
  color: var(--nu-orange) !important;
  border-color: var(--nu-orange-border);
}

/* Mobile Bottom Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: #ffffff;
  border-top: 1px solid var(--nu-border);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom, 0));
}

.mobile-bottom-nav a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--nu-muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.3rem 0.2rem;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.mobile-bottom-nav a.active {
  color: var(--nu-orange);
  background: var(--nu-orange-soft);
}

/* ==========================================================================
   2. DATA WINDOWS / PANELS (กรอบแสดงข้อมูล — ห้ามดูเหมือนปุ่มกด)
   ========================================================================== */
.card,
.info-window {
  background: var(--nu-surface);
  border: 1px solid var(--nu-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(30, 20, 10, 0.04) !important;
  cursor: default;
}

.card-header,
.window-header {
  background: var(--nu-window-header) !important;
  border-bottom: 1px solid var(--nu-border) !important;
  border-top-left-radius: 13px !important;
  border-top-right-radius: 13px !important;
  padding: 0.75rem 1.15rem;
  font-weight: 700;
  font-size: 0.92rem;
  color: #3b332e;
}

.card-footer,
.window-footer {
  background: #faf8f5 !important;
  border-top: 1px solid var(--nu-border) !important;
  border-bottom-left-radius: 13px !important;
  border-bottom-right-radius: 13px !important;
  padding: 0.75rem 1.15rem;
}

/* Summary Strip Inside an Info Window */
.stat-summary-window {
  background: var(--nu-surface);
  border: 1px solid var(--nu-border);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(30, 20, 10, 0.04);
  overflow: hidden;
}

.stat-cell {
  padding: 0.9rem 1.15rem;
  border-right: 1px solid #ece5de;
}

.stat-cell:last-child {
  border-right: none;
}

.stat-cell-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--nu-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-cell-value {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--nu-text);
  margin-top: 2px;
}

/* ==========================================================================
   3. CLICKABLE BUTTONS (ปุ่มกด — มีขอบนูน/มิติชัดเจน แยกจากป้ายข้อมูล)
   ========================================================================== */
.btn {
  border-radius: 9px;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0.48rem 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.06s ease, box-shadow 0.12s ease;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:active {
  transform: translateY(1px);
}

.btn-lg {
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-size: 0.98rem;
}

.btn-sm {
  border-radius: 7px;
  padding: 0.32rem 0.72rem;
  font-size: 0.82rem;
}

/* Primary Button: Solid Orange + Bottom Tactile Bevel */
.btn-primary {
  background-color: var(--nu-orange);
  border: 1px solid var(--nu-orange-active);
  border-bottom: 3px solid var(--nu-orange-lip);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(223, 99, 22, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--nu-orange-hover);
  border-color: var(--nu-orange-lip);
  border-bottom-color: #7d3104;
  color: #ffffff;
  box-shadow: 0 3px 8px rgba(223, 99, 22, 0.3);
}

/* Secondary / Outline Button: Crisp Raised White Button */
.btn-outline-primary,
.btn-outline-secondary,
.btn-soft-primary {
  background-color: #ffffff;
  color: #2c2520;
  border: 1px solid var(--nu-border-strong);
  border-bottom: 2px solid #b3a598;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-outline-primary {
  color: var(--nu-orange);
  border-color: #e2a579;
  border-bottom-color: #c97f4b;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-soft-primary:hover {
  background-color: var(--nu-orange-soft);
  color: var(--nu-orange-active);
  border-color: var(--nu-orange);
  border-bottom-color: var(--nu-orange-active);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background-color: #f5f0ea;
  color: var(--nu-text);
  border-color: #9e9185;
  border-bottom-color: #827569;
}

.btn-outline-danger {
  background-color: #ffffff;
  color: #b91c1c;
  border: 1px solid #e5a3a3;
  border-bottom: 2px solid #c87171;
}

.btn-outline-danger:hover {
  background-color: #fef2f2;
  color: #991b1b;
  border-color: #dc2626;
}

/* (?) Help Button */
.btn-help {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #cfc2b6;
  border-bottom: 2px solid #b5a698;
  background: #ffffff;
  color: var(--nu-muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-help:hover,
.btn-help:focus {
  background: var(--nu-orange);
  color: #ffffff;
  border-color: var(--nu-orange-active);
}

/* ==========================================================================
   4. STATIC BADGES & SKILL TAGS (ป้ายข้อมูล — แบน ไม่มีเงาปุ่ม ไม่ขยับตอนชี้)
   ========================================================================== */
.badge {
  border-radius: 6px;
  padding: 0.3em 0.6em;
  font-weight: 600;
}

.badge-nu {
  background-color: var(--nu-orange-soft);
  color: var(--nu-orange-active);
  border: 1px solid var(--nu-orange-border);
}

/* Read-only skill tag (not a button!) */
.skill-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid transparent;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  cursor: default;
}

.skill-tag svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.skill-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.skill-icon-circle svg {
  width: 19px;
  height: 19px;
}

/* Form Controls */
.form-control,
.form-select {
  border-radius: 8px;
  border: 1px solid #cfc4b9;
  padding: 0.52rem 0.85rem;
  background-color: #ffffff;
}

.form-control-lg,
.form-select-lg {
  border-radius: 10px;
  min-height: 46px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--nu-orange);
  box-shadow: 0 0 0 3px rgba(223, 99, 22, 0.15);
}

/* 5-Skill Checkbox Selector on Activity Form */
.skill-select-card {
  border: 1px solid var(--nu-border);
  border-radius: 12px;
  padding: 0.85rem;
  background: #ffffff;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}

.skill-select-card:hover {
  border-color: #b8a99c;
}

.skill-select-card.is-checked {
  border: 2px solid var(--nu-orange);
  background: #fffaf5;
}

/* Tables */
.table > :not(caption) > * > * {
  padding: 0.78rem 1rem;
  border-bottom-color: #eee7e0;
}

.table thead th {
  font-size: 0.8rem;
  font-weight: 700;
  color: #544b44;
  background-color: var(--nu-window-header);
  border-bottom: 1px solid var(--nu-border);
}

/* Status Dots */
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.is-open {
  background: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
}

.status-dot.is-closed {
  background: #9ca3af;
}

.status-dot.is-draft {
  background: #d97706;
}

.nu-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--nu-orange-soft);
  border: 1px solid var(--nu-orange-border);
  color: var(--nu-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nu-icon-box-sm {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--nu-orange-soft);
  border: 1px solid var(--nu-orange-border);
  color: var(--nu-orange);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.skill-radar-svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.ovr-hero-box {
  text-align: right;
  line-height: 1.1;
}

.ovr-hero-box .ovr-hero-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--nu-muted);
}

.ovr-hero-box .ovr-hero-num {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--nu-orange);
}

.text-primary {
  color: var(--nu-orange) !important;
}

.bg-primary {
  background-color: var(--nu-orange) !important;
}

.alert {
  border-radius: 10px;
  border: 1px solid transparent;
}

/* Check-in Success Live Pulse */
.checkin-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.9rem;
  font-weight: 700;
  animation: pulseRing 1.8s infinite;
}

@keyframes pulseRing {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.55);
  }
  70% {
    box-shadow: 0 0 0 14px rgba(255, 255, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

/* QR Projector Display */
.display-body {
  background-color: var(--nu-bg);
  min-height: 100vh;
}

.display-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.qr-stage {
  max-width: 100%;
  border-radius: 16px !important;
  border: 1px solid var(--nu-border);
  box-shadow: 0 4px 16px rgba(30, 20, 10, 0.06) !important;
}

.qr-box {
  width: min(74vw, 400px);
  height: min(74vw, 400px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-box svg {
  width: 100%;
  height: 100%;
  display: block;
}

.counter-hero {
  font-size: clamp(3.2rem, 5.5vw, 5rem);
  line-height: 1;
  color: var(--nu-orange);
}

@media print {
  .no-print {
    display: none !important;
  }
  .display-body {
    background: #ffffff !important;
  }
  .print-poster {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
}
