/* PRMS — Custom Styles */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --sidebar-width: 260px;
  --header-height: 56px;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 4px 12px rgba(0, 0, 0, .08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

h1,
h2,
h3,
h4,
h5,
h6,
.card-title,
.logo-text,
.stat-value {
  font-family: 'Inter', sans-serif;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ── Layout ── */
#app {
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  will-change: transform;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
}

.sidebar-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sidebar-logo .logo-text {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.2;
}

.sidebar-logo .logo-sub {
  font-size: 10px;
  color: #64748b;
  font-weight: 400;
}

.sidebar-nav {
  padding: 10px 8px;
  flex: 1;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 1px;
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .06);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(59, 130, 246, .15);
  color: #60a5fa;
}

.nav-item.active .nav-icon {
  color: #60a5fa;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  color: #64748b;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}

.user-card:hover {
  background: rgba(255, 255, 255, .06);
}

.user-card-info {
  flex: 1;
  min-width: 0;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #e2e8f0;
}

.user-role {
  font-size: 11px;
  color: #64748b;
}

.user-card-chevron {
  color: #64748b;
  font-size: 12px;
  flex-shrink: 0;
  transition: color .15s;
}

.user-card:hover .user-card-chevron {
  color: #94a3b8;
}

/* ── Sidebar Collapse Button ── */
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
  font-size: 12px;
  transition: all .15s;
  flex-shrink: 0;
  margin-left: auto;
}

.sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, .08);
  color: #94a3b8;
}

.logo-text-wrap {
  flex: 1;
  min-width: 0;
}

/* ── Sidebar Collapsed State ── */
.sidebar.collapsed {
  width: 60px;
}

.sidebar.collapsed .logo-text-wrap,
.sidebar.collapsed .logo-sub,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-card-info,
.sidebar.collapsed .user-card-chevron,
.sidebar.collapsed .profile-popup-menu,
.sidebar.collapsed .sidebar-collapse-btn i::before {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-btn i::before {
  content: "\f101";
}

.sidebar.collapsed .sidebar-logo {
  padding: 14px 10px;
  justify-content: center;
}

.sidebar.collapsed .sidebar-logo .logo-icon {
  display: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
  display: flex;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.sidebar.collapsed .nav-item .nav-icon {
  width: auto;
  font-size: 16px;
}

.sidebar.collapsed .user-card {
  justify-content: center;
  padding: 8px;
}

.sidebar.collapsed .sidebar-nav {
  padding: 10px 4px;
}

.sidebar.collapsed .nav-section {
  margin-bottom: 2px;
}

/* Main content responds to collapsed sidebar */
.main-content.sidebar-collapsed {
  margin-left: 60px;
}

.top-header.sidebar-collapsed {
  left: 60px;
}

/* ── Profile Popup Menu ── */
.profile-menu-wrapper {
  position: relative;
}

.profile-popup-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 4px;
  right: 4px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
  z-index: 70;
  overflow: hidden;
  overflow-y: auto;
  max-height: 80vh;
  animation: slideUpMenu .15s ease;
}

.profile-popup-menu.open {
  display: block;
}

@keyframes slideUpMenu {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.profile-menu-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 8px 14px 4px;
}

.profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  color: #cbd5e1;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: all .12s;
  white-space: nowrap;
}

.profile-menu-item:hover {
  background: rgba(255, 255, 255, .06);
  color: #f1f5f9;
}

.profile-menu-item i {
  width: 16px;
  text-align: center;
  color: #64748b;
  font-size: 12px;
  flex-shrink: 0;
}

.profile-menu-item:hover i {
  color: #94a3b8;
}

.profile-menu-item-sub {
  padding-left: 28px;
  font-size: 12.5px;
}

.profile-menu-item-sub i {
  font-size: 11px;
}

.profile-menu-item-danger {
  color: #f87171;
}

.profile-menu-item-danger i {
  color: #f87171;
}

.profile-menu-item-danger:hover {
  background: rgba(239, 68, 68, .1);
  color: #fca5a5;
}

.profile-menu-item.disabled {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

.profile-menu-soon {
  margin-left: auto;
  font-size: 9px;
  background: rgba(255, 255, 255, .08);
  color: #64748b;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
}

.profile-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, .06);
  margin: 4px 0;
}

/* ── Main Content ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left .3s cubic-bezier(.4, 0, .2, 1);
}

.top-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.header-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: none;
  color: #64748b;
  font-size: 18px;
  transition: all .15s;
}

.header-menu-btn:hover {
  background: #f1f5f9;
}

.header-breadcrumb {
  flex: 1;
}

.header-breadcrumb h1 {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

.header-breadcrumb p {
  font-size: 12px;
  color: #64748b;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  background: #f8fafc;
  color: #64748b;
  font-size: 15px;
  transition: all .15s;
  position: relative;
}

.header-btn:hover {
  background: #f1f5f9;
  color: #334155;
}

.header-btn .notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid white;
}

.page-content {
  flex: 1;
  padding: 20px;
  padding-top: calc(var(--header-height) + 20px);
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  width: 100%;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.card-subtitle {
  font-size: 12px;
  color: #64748b;
}

/* ── Stat Cards ── */
.stat-card {
  background: white;
  border-radius: var(--radius);
  border: 1px solid #e2e8f0;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: #64748b;
  margin-top: 3px;
}

.stat-change {
  font-size: 11px;
  margin-top: 4px;
  font-weight: 500;
}

.stat-change.up {
  color: #10b981;
}

.stat-change.down {
  color: #ef4444;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* PPH Levels */
.badge-excellent {
  background: #d1fae5;
  color: #065f46;
}

.badge-good {
  background: #dbeafe;
  color: #1e40af;
}

.badge-average {
  background: #fef3c7;
  color: #92400e;
}

.badge-needs_improvement {
  background: #fee2e2;
  color: #991b1b;
}

/* Violation Levels */
.badge-low {
  background: #d1fae5;
  color: #065f46;
}

.badge-medium {
  background: #fef3c7;
  color: #92400e;
}

.badge-high {
  background: #ffedd5;
  color: #9a3412;
}

.badge-critical {
  background: #fee2e2;
  color: #991b1b;
}

/* Status */
.badge-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-confirmed {
  background: #dbeafe;
  color: #1e40af;
}

.badge-approved {
  background: #d1fae5;
  color: #065f46;
}

.badge-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.badge-waived {
  background: #f1f5f9;
  color: #475569;
}

.badge-draft {
  background: #f1f5f9;
  color: #475569;
}

.badge-manager_review {
  background: #fef3c7;
  color: #92400e;
}

.badge-hr_approved {
  background: #dbeafe;
  color: #1e40af;
}

.badge-final {
  background: #d1fae5;
  color: #065f46;
}

.badge-pending_approval {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-expired {
  background: #e2e8f0;
  color: #475569;
}

/* Hide mobile summary on desktop */
.mobile-summary {
  display: none;
}

/* ── Table ── */
.table-container {
  overflow-x: auto;
  margin: 0;
  padding-bottom: 8px;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 600px;
}

thead {
  background: #f8fafc;
}

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #334155;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #f8fafc;
}

.td-primary {
  font-weight: 600;
  color: #0f172a;
}

.td-muted {
  font-size: 12px;
  color: #64748b;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  border: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #fee2e2;
  color: #dc2626;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-success {
  background: #d1fae5;
  color: #059669;
}

.btn-success:hover {
  background: #a7f3d0;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 7px;
  border-radius: 7px;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Forms ── */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 5px;
}

.form-label .required {
  color: #ef4444;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 13.5px;
  color: #111827;
  background: white;
  transition: all .15s;
  outline: none;
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .1);
}

.form-control::placeholder {
  color: #9ca3af;
}

select.form-control {
  cursor: pointer;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn .15s ease;
}

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.modal {
  background: white;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp .25s cubic-bezier(.4, 0, .2, 1);
  box-shadow: 0 -4px 32px rgba(0, 0, 0, .15);
}

@media (min-width: 640px) {
  .modal {
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: scaleIn .2s ease;
  }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
}

.modal-close {
  background: #f1f5f9;
  border: none;
  min-width: 44px;
  min-height: 44px;
  border-radius: 7px;
  cursor: pointer;
  color: #64748b;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.modal-close:hover {
  background: #e2e8f0;
  color: #334155;
}

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

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Filters Bar ── */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filter-select {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: white;
  cursor: pointer;
  min-width: 0;
}

.search-input {
  padding: 7px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  flex: 1;
  min-width: 160px;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 9px;
  margin-bottom: 14px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 6px 14px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  color: #64748b;
  white-space: nowrap;
}

.tab.active {
  background: white;
  color: #0f172a;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── Progress Bar ── */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s;
}

/* ── Avatar ── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #94a3b8;
}

.empty-state i {
  font-size: 36px;
  margin-bottom: 10px;
  display: block;
}

.empty-state p {
  font-size: 14px;
}

/* ── Loading ── */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.loading-spinner::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

/* ── Login ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: #fff;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .12);
  padding: 8px;
}

.login-logo .logo-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
}

.login-logo p {
  font-size: 13px;
  color: #64748b;
  margin-top: 3px;
}

.login-demo-accounts {
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.login-demo-accounts p {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.demo-btn {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.demo-chip {
  padding: 3px 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11px;
  color: #334155;
  cursor: pointer;
  transition: all .15s;
}

.demo-chip:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* ── Chart Container ── */
.chart-container {
  position: relative;
}

/* ── Grid ── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.grid-2>*,
.grid-3>*,
.grid-4>* {
  min-width: 0;
}

@media (max-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .grid-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  max-width: 280px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideInRight .2s ease;
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #991b1b;
}

.toast.warning {
  background: #92400e;
}

/* ── Overlay (mobile sidebar) ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 49;
}

/* ── Score Workflow ── */
.workflow-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
}

.workflow-step.active {
  color: var(--primary);
}

.workflow-step.done {
  color: #10b981;
}

.workflow-step .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.workflow-step.done .step-num {
  background: #10b981;
  border-color: #10b981;
  color: white;
}

.workflow-step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.workflow-connector {
  width: 20px;
  height: 2px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.workflow-connector.done {
  background: #10b981;
}

/* ── PPH Meter ── */
.pph-meter {
  display: flex;
  gap: 2px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}

.pph-segment {
  flex: 1;
}

/* ── Onboarding Page ── */
.onboarding-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.onboarding-hero-content {
  display: flex;
  align-items: center;
  gap: 14px;
}

.onboarding-hero-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  flex-shrink: 0;
}

.onboarding-hero-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.onboarding-hero-sub {
  font-size: 13px;
  color: #475569;
  margin: 3px 0 0;
}

.onboarding-hero-progress {
  margin-top: 14px;
}

.onboarding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.onboarding-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .2s ease;
}

.onboarding-card:hover {
  border-color: #93c5fd;
  box-shadow: 0 2px 12px rgba(59, 130, 246, .1);
  transform: translateY(-1px);
}

.onboarding-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.onboarding-card-body {
  flex: 1;
  min-width: 0;
}

.onboarding-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}

.onboarding-card-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.4;
}

.onboarding-card-arrow {
  color: #cbd5e1;
  font-size: 12px;
  flex-shrink: 0;
  transition: color .15s;
}

.onboarding-card:hover .onboarding-card-arrow {
  color: #3b82f6;
}

/* Checklist */
.onboarding-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}

.checklist-item:hover {
  background: #f8fafc;
}

.checklist-item.checked {
  opacity: .6;
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
  color: #94a3b8;
}

.checklist-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  font-size: 11px;
  color: white;
}

.checklist-checkbox.checked {
  background: #10b981;
  border-color: #10b981;
}

.checklist-content {
  flex: 1;
  min-width: 0;
}

.checklist-label {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  transition: all .15s;
}

.checklist-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.checklist-link {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  transition: all .15s;
  flex-shrink: 0;
}

.checklist-link:hover {
  background: #f1f5f9;
  color: #3b82f6;
}

.checklist-progress {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 3px;
  transition: width .5s ease;
}

/* Routine Tabs */
.routine-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 9px;
  margin-bottom: 14px;
  width: fit-content;
}

.routine-tab {
  padding: 7px 16px;
  border: none;
  border-radius: 7px;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.routine-tab.active {
  background: white;
  color: #0f172a;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.routine-panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.routine-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}

.routine-item:hover {
  background: #f8fafc;
}

.routine-item.done {
  opacity: .55;
}

.routine-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #64748b;
  flex-shrink: 0;
  transition: all .15s;
}

.routine-icon.done {
  background: #d1fae5;
  color: #059669;
}

.routine-content {
  flex: 1;
  min-width: 0;
}

.routine-label {
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
}

.routine-desc {
  font-size: 11px;
  color: #64748b;
  margin-top: 1px;
}

.routine-status {
  flex-shrink: 0;
  text-align: right;
}

/* ── Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    transform: scale(.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

/* ── Mobile ── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-overlay.hidden {
    display: none;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .header-menu-btn {
    display: flex;
  }

  .top-header {
    left: 0;
  }

  .page-content {
    padding: 12px;
    padding-top: calc(var(--header-height) + 12px);
  }

  .hide-mobile {
    display: none !important;
  }

  /* ── Stat Cards: 2×2 compact grid ── */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
    gap: 10px;
  }

  .stat-card>div:last-child {
    flex: 1;
    min-width: 0;
  }

  .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 15px;
    flex-shrink: 0;
  }

  .stat-value {
    font-size: 18px;
    line-height: 1.2;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-change {
    font-size: 10px;
  }

  /* ── Cards compact ── */
  .card {
    padding: 12px;
    width: 100%;
    overflow: hidden;
  }

  .card-header {
    margin-bottom: 10px;
  }

  .card-title {
    font-size: 13px;
  }

  .period-nav {
    flex-wrap: nowrap;
    width: 100%;
    justify-content: space-between;
  }

  .period-nav .period-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: 13px;
    flex-shrink: 0;
  }

  .period-nav .period-label {
    font-size: 13px;
    min-width: 0;
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Filters: stack on mobile ── */
  .filters-bar {
    gap: 6px;
  }

  .filters-bar .filter-select {
    flex: 1;
    min-width: calc(50% - 3px);
  }

  .search-input {
    width: 100%;
    min-width: 0;
    flex-basis: 100%;
  }

  /* ── Tabs: scrollable with fade ── */
  .tabs {
    position: relative;
    margin-bottom: 12px;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    padding: 5px 11px;
    font-size: 12px;
  }

  /* ── Workflow Stepper compact ── */
  .workflow-steps {
    gap: 2px;
    margin-bottom: 12px;
  }

  .workflow-step {
    padding: 4px 6px;
    font-size: 11px;
    gap: 4px;
  }

  .workflow-step .step-label {
    display: none;
  }

  .workflow-step .step-num {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .workflow-connector {
    width: 12px;
  }

  /* ── Buttons compact ── */
  .btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .btn-sm {
    padding: 5px 8px;
    font-size: 11px;
  }

  /* ── Table responsive card view ── */
  .table-container {
    overflow-x: auto;
  }

  table.mobile-cards,
  table.mobile-cards thead,
  table.mobile-cards tbody,
  table.mobile-cards tr,
  table.mobile-cards td,
  table.mobile-cards th {
    display: block;
  }

  table.mobile-cards thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  table.mobile-cards tr {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: background .15s;
  }

  table.mobile-cards tr:active {
    background: #f8fafc;
  }

  /* Only show first td (name + embedded mobile summary) */
  table.mobile-cards td:not(:first-child) {
    display: none !important;
  }

  table.mobile-cards td:first-child {
    padding: 0;
    font-size: 14px;
  }

  table.mobile-cards td:first-child::before {
    display: none;
  }

  /* Mobile summary (key metrics inline) */
  table.mobile-cards .mobile-summary {
    display: flex !important;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
    font-weight: 400;
    font-size: 12px;
  }

  /* ── Toast: center bottom on mobile ── */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: 100%;
  }

  /* ── Modal: already bottom-sheet, improve it ── */
  .modal {
    max-height: 88vh;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-footer {
    padding: 10px 16px;
  }

  /* ── Charts compact ── */
  .chart-container {
    height: 140px !important;
  }

  /* ── Detail panel compact ── */
  .detail-row {
    font-size: 12px;
    padding: 5px 0;
    flex-wrap: wrap;
    gap: 4px;
  }

  /* ── Pagination compact ── */
  .pagination {
    gap: 4px;
  }

  .page-btn {
    min-width: 36px;
    min-height: 36px;
    font-size: 13px;
  }

  /* ── Header compact ── */
  .top-header {
    padding: 0 12px;
    gap: 8px;
  }

  .header-breadcrumb h1 {
    font-size: 15px;
  }

  /* ── Settings tabs horizontal scroll ── */
  .settings-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap !important;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── Grid-2 and Grid-3 stack on mobile ── */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr !important;
  }
}

/* ── Extra small (375px and below) ── */
@media (max-width: 480px) {
  .page-content {
    padding: 10px;
    padding-top: calc(var(--header-height) + 10px);
  }

  .stat-card {
    padding: 10px;
    gap: 8px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .stat-value {
    font-size: 16px;
  }

  .stat-label {
    font-size: 10px;
    line-height: 1.3;
    white-space: normal;
  }

  .period-nav .period-btn {
    min-width: 32px;
    min-height: 32px;
  }

  .card {
    padding: 10px;
  }

  .tab {
    padding: 4px 9px;
    font-size: 11px;
  }
}

/* ── Period selector ── */
.period-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.period-nav .period-label {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  min-width: 80px;
  text-align: center;
}

.period-nav .period-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.period-nav .period-btn:hover {
  background: #f1f5f9;
}

/* ── Role badge ── */
.role-badge {
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
}

.role-bod {
  background: #fde68a;
  color: #92400e;
}

.role-warehouse_manager {
  background: #dbeafe;
  color: #1e40af;
}

.role-warehouse_leader {
  background: #e0e7ff;
  color: #3730a3;
}

.role-hr {
  background: #fce7f3;
  color: #9d174d;
}

.role-staff {
  background: #f1f5f9;
  color: #475569;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  padding: 12px 0 0;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 7px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}

.page-btn:hover {
  background: #f1f5f9;
}

.page-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ── Summary row ── */
.summary-row {
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
}

.summary-row td {
  font-weight: 600;
  color: #0f172a;
  font-size: 13px;
}

/* ── Section divider ── */
.section-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 16px 0;
}

/* Score detail panel */
.detail-panel {
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px;
  border: 1px solid #e2e8f0;
}

.detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-key {
  color: #64748b;
}

.detail-val {
  font-weight: 600;
  color: #0f172a;
}

/* Clickable row / item affordance */
.clickable-row {
  cursor: pointer;
  transition: background .12s;
}

.clickable-row:hover {
  background: #f8fafc !important;
}

.clickable-row:active {
  background: #f1f5f9 !important;
}

/* Clickable action item in report cards */
.action-item-clickable {
  cursor: pointer;
  transition: background .12s, box-shadow .12s;
  border-radius: 6px;
}

.action-item-clickable:hover {
  background: #f1f5f9 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.action-item-clickable:active {
  background: #e2e8f0 !important;
}

/* PPH Level colors */
.pph-excellent {
  color: #065f46;
}

.pph-good {
  color: #1e40af;
}

.pph-average {
  color: #92400e;
}

.pph-needs_improvement {
  color: #991b1b;
}

/* ── Page Toolbar (compact control bar) ── */
.page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.page-toolbar .period-nav {
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Icon-only circle buttons */
.toolbar-actions .btn-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border: 1px solid #e2e8f0;
  background: white;
  color: #475569;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}

.toolbar-actions .btn-icon-only:hover {
  background: #f1f5f9;
}

.toolbar-actions .btn-icon-only.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.toolbar-actions .btn-icon-only.btn-primary:hover {
  background: var(--primary-dark);
}

/* Dropdown Menu (⋮ more actions) */
.toolbar-dropdown {
  position: relative;
}

.toolbar-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
  min-width: 180px;
  z-index: 60;
  overflow: hidden;
  animation: scaleIn .12s ease;
}

.toolbar-dropdown.open .toolbar-dropdown-menu {
  display: block;
}

.toolbar-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .1s;
}

.toolbar-dropdown-item:hover {
  background: #f1f5f9;
}

.toolbar-dropdown-item i {
  width: 16px;
  text-align: center;
  color: #64748b;
  font-size: 13px;
}

/* Tab-as-select filter on mobile */
.tab-filter-select {
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: #374151;
  background: white;
  cursor: pointer;
  min-width: 0;
  font-weight: 500;
}

/* Inline filter row (period + warehouse on same row) */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-row .period-nav {
  flex-shrink: 0;
}

.filter-row .filter-select {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .page-toolbar {
    gap: 6px;
    margin-bottom: 10px;
  }

  .page-toolbar .period-nav .period-btn {
    min-width: 32px;
    min-height: 32px;
  }

  .page-toolbar .period-nav .period-label {
    font-size: 12px;
  }

  .toolbar-actions .btn-icon-only {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  /* Hide text-only labels on mobile toolbar buttons */
  .toolbar-actions .btn-label {
    display: none;
  }

  .filter-row {
    gap: 6px;
  }
}

/* ── Warehouse Multi-Select Filter ── */
.wh-filter {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.wh-filter-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  color: #374151;
  font-weight: 500;
  white-space: nowrap;
  transition: all .15s;
  min-height: 36px;
}

.wh-filter-trigger:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.wh-filter-trigger .wh-icon {
  color: #64748b;
  font-size: 12px;
}

.wh-filter-trigger .wh-chevron {
  color: #94a3b8;
  font-size: 10px;
  transition: transform .15s;
}

.wh-filter.open .wh-filter-trigger .wh-chevron {
  transform: rotate(180deg);
}

.wh-filter-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  max-width: 180px;
  overflow: hidden;
}

.wh-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  white-space: nowrap;
}

.wh-pill .wh-pill-x {
  cursor: pointer;
  font-size: 9px;
  opacity: .6;
  transition: opacity .1s;
}

.wh-pill .wh-pill-x:hover {
  opacity: 1;
}

.wh-filter-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: auto;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
  width: 260px;
  max-height: 300px;
  z-index: 999;
  animation: scaleIn .12s ease;
  overflow: hidden;
}

.wh-filter.open .wh-filter-dropdown {
  display: flex !important;
  flex-direction: column;
}

.wh-filter-dropdown-header {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.wh-filter-dropdown-header span {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.wh-filter-dropdown-header button {
  font-size: 11px;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
}

.wh-filter-list {
  overflow-y: auto;
  max-height: 240px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
}

.wh-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .1s;
  font-size: 13px;
  color: #374151;
  width: 100%;
  flex-shrink: 0;
}

.wh-filter-item:hover {
  background: #f8fafc;
}

.wh-filter-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.wh-filter-item.checked {
  background: #eff6ff;
  font-weight: 600;
  color: var(--primary);
}

@media (max-width: 768px) {
  .wh-filter-pills {
    max-width: 120px;
  }

  .wh-filter-dropdown {
    width: calc(100vw - 24px);
    max-width: 300px;
    right: 0;
    left: auto;
  }

  .wh-filter-trigger {
    padding: 5px 8px;
    font-size: 12px;
  }
}

/* ── Tooltips ── */
[data-tip] {
  position: relative;
  cursor: help;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f1f5f9;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  padding: 6px 10px;
  border-radius: 7px;
  white-space: normal;
  max-width: 240px;
  min-width: 100px;
  width: max-content;
  text-align: left;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
}

[data-tip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 9999;
  pointer-events: none;
}

[data-tip]:hover::after,
[data-tip]:hover::before,
[data-tip]:focus-within::after,
[data-tip]:focus-within::before {
  opacity: 1;
  visibility: visible;
}

/* Tooltip on the right for narrow left-edge elements */
[data-tip-right]::after {
  left: 0;
  transform: none;
}

[data-tip-right]::before {
  left: 12px;
  transform: none;
}

/* Info icon next to tooltip text */
.tip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  font-weight: 700;
  color: #94a3b8;
  border: 1.5px solid #cbd5e1;
  border-radius: 50%;
  margin-left: 3px;
  vertical-align: middle;
  cursor: help;
  flex-shrink: 0;
  line-height: 1;
}

th [data-tip] {
  border-bottom: 1px dashed #94a3b8;
}

/* Mobile: tap to reveal tooltip */
@media (max-width: 768px) {
  [data-tip]::after {
    font-size: 11px;
    max-width: 200px;
    padding: 5px 8px;
  }

  [data-tip]:active::after,
  [data-tip]:active::before {
    opacity: 1;
    visibility: visible;
  }
}