:root{
  --public-bg-base: #f6f8fb;
  --public-bg-soft: #eef2ff;
}

body{background:#f6f8fb;}
.card{border-radius:14px;}

html, body.public-home{
  height: 100%;
}

body.public-home{
  background: linear-gradient(180deg, var(--public-bg-soft) 0%, var(--public-bg-base) 62%, var(--public-bg-base) 100%);
  overflow: hidden;
}

body.public-home #homeMain{
  height: 100dvh;
  padding-top: 0.75rem !important;
  padding-bottom: 0.75rem !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.public-home #homeRow{
  flex: 1 1 auto;
  min-height: 0;
}

body.public-home.scan-fullscreen #homeRow{
  height: 100%;
}

body.public-home.scan-fullscreen .home-col-chart{
  display: none;
}

body.public-home.scan-fullscreen .home-col-scan{
  flex: 0 0 100%;
  width: 100%;
  max-width: 100%;
  height: 100%;
}

body.public-home #homeRow > [class*="col-"]{
  height: 100%;
}

body.public-home #homeRow .card{
  height: 100%;
}

body.public-home #homeRow .card-body{
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chart-wrap{
  position: relative;
  height: 360px;
  min-height: 360px;
}

#globalAttendanceChart{
  width: 100% !important;
  height: 100% !important;
}

.month-filter{
  width: 180px;
}

.scan-ok-badge{
  display: inline-block;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
}

.scanner-focus-badge{
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  color: #475569;
  background: #f8fafc;
}

.scanner-focus-badge.is-active{
  border-color: #86efac;
  color: #166534;
  background: #dcfce7;
}

.scanner-focus-badge.is-inactive{
  border-color: #fecaca;
  color: #991b1b;
  background: #fee2e2;
}

.scanner-inline-status{
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#btnDetectScanners{
  white-space: nowrap;
}

#globalStats .stat-label{
  display: block;
  font-size: .78rem;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.global-stats-strip{
  display: flex;
  flex-wrap: nowrap;
  gap: .35rem;
  min-width: 0;
}

.global-stat-item{
  flex: 1 1 0;
  min-width: 0;
}

#globalStats .h5{
  font-size: 1rem;
}

.scan-panel{
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}

body.public-home.scan-fullscreen .home-col-scan .card{
  border: 0;
}

body.public-home.scan-fullscreen .home-col-scan .card-body{
  padding: .75rem;
}

body.public-home.scan-fullscreen #scannerInput{
  font-size: 1.05rem;
  min-height: 46px;
}

.scan-top{
  flex: 0 0 auto;
}

.scan-live-box{
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fafc;
}

.scan-live-grid{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scan-live-row{
  display: grid;
  grid-template-columns: 74px 1fr;
  align-items: start;
  column-gap: 8px;
}

.scan-live-label{
  font-size: 12px;
  color: #6b7280;
}

.scan-live-value{
  font-size: 13px;
  color: #111827;
  line-height: 1.25;
  word-break: break-word;
}

.scan-bottom{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.recent-table-wrap{
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.recent-table-wrap .table{
  font-size: .82rem;
}

.recent-table-wrap .table > :not(caption) > * > *{
  padding: .28rem .4rem;
  vertical-align: middle;
}

.recent-table-wrap .realtime-attendance-table{
  table-layout: fixed;
  width: 100%;
}

.recent-table-wrap .realtime-attendance-table th,
.recent-table-wrap .realtime-attendance-table td{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-table-wrap .realtime-attendance-table th:nth-child(1),
.recent-table-wrap .realtime-attendance-table td:nth-child(1){
  width: 7%;
}

.recent-table-wrap .realtime-attendance-table th:nth-child(2),
.recent-table-wrap .realtime-attendance-table td:nth-child(2){
  width: 25%;
}

.recent-table-wrap .realtime-attendance-table th:nth-child(3),
.recent-table-wrap .realtime-attendance-table td:nth-child(3){
  width: 15%;
}

.recent-table-wrap .realtime-attendance-table th:nth-child(4),
.recent-table-wrap .realtime-attendance-table td:nth-child(4),
.recent-table-wrap .realtime-attendance-table th:nth-child(5),
.recent-table-wrap .realtime-attendance-table td:nth-child(5){
  width: 14%;
}

.recent-table-wrap .realtime-attendance-table th:nth-child(6),
.recent-table-wrap .realtime-attendance-table td:nth-child(6){
  width: 25%;
}

#contentArea{
  scroll-behavior: smooth;
}

.sidebar .nav-link.active{
  background: rgba(255,255,255,.22);
  color: #fff;
  font-weight: 600;
}

.stat-card{
  color: #fff;
  border-radius: 12px;
  transition: transform .15s ease, box-shadow .15s ease;
}

.stat-card:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
}

.stat-card .stat-label{
  color: rgba(255,255,255,.88) !important;
}

.stat-card .stat-icon{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255,255,255,.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.stat-card-1{
  background: linear-gradient(135deg, #ff8a00, #e05200);
}

.stat-card-2{
  background: linear-gradient(135deg, #1d976c, #0f7f5a);
}

.stat-card-3{
  background: linear-gradient(135deg, #2b6cb0, #1e4f84);
}

.stat-card-4{
  background: linear-gradient(135deg, #1f9d57, #128c7e);
}

.stat-card-5{
  background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

/* Public global chart stat cards: aligned with bar colors */
.stat-card-hadir{
  background: linear-gradient(135deg, #16a34a, #15803d);
}

.stat-card-pulang{
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
}

.stat-card-sakit{
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.stat-card-izin{
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.stat-card-alfa{
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.stat-card-no-checkout{
  background: linear-gradient(135deg, #f97316, #ea580c);
}

@media (max-width: 991.98px){
  body.public-home{
    overflow: auto;
  }
  body.public-home #homeMain{
    height: auto;
    overflow: visible;
  }
  body.public-home #homeRow > [class*="col-"]{
    height: auto;
  }
  body.public-home #homeRow .card-body{
    overflow: visible;
  }
  .chart-wrap{
    height: 300px;
    min-height: 300px;
  }
  body.public-home.scan-fullscreen #homeMain{
    padding-left: .5rem !important;
    padding-right: .5rem !important;
  }
}

@media (min-width: 992px){
  .chart-wrap{
    height: clamp(320px, 52vh, 560px);
    min-height: 320px;
  }
}
