/* ==========================================================================
   Sistem Presensi Desa Pajar Bulan - Custom Stylesheet
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens
   -------------------------------------------------------------------------- */
:root {
  --primary: #38BDF8;
  --primary-50: #F0F9FF;
  --primary-100: #E0F2FE;
  --primary-200: #BAE6FD;
  --primary-500: #38BDF8;
  --primary-600: #0284C7;
  --primary-700: #0369A1;
  --primary-ring: rgba(56, 189, 248, 0.24);

  --secondary: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #0EA5E9;

  --dark: #0F172A;
  --muted: #64748B;
  --text: #111827;
  --surface: #FFFFFF;
  --surface-soft: #F8FAFC;
  --neutral-bg: #F4F7FB;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 28px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);

  --radius: 8px;
  --sidebar-width: 250px;
  --topbar-height: 60px;

  --z-sidebar: 1000;
  --z-topbar: 999;
  --z-overlay: 999;
  --z-sidebar-mobile: 1001;
  --z-flash: 9999;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  background:
    linear-gradient(180deg, rgba(240, 249, 255, 0.72) 0%, rgba(248, 250, 252, 0) 240px),
    var(--neutral-bg);
  color: var(--text);
  overflow-x: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

a {
  color: var(--primary-700);
  text-decoration: none;
}

a:hover {
  color: var(--primary-600);
}

::selection {
  background: var(--primary-200);
  color: var(--dark);
}

.w-100 {
  width: 100% !important;
}

.h-100 {
  height: 100% !important;
}

.row {
  --grid-gutter-x: 1.5rem;
  --grid-gutter-y: 0;
  display: flex;
  flex-wrap: wrap;
  margin-top: calc(-1 * var(--grid-gutter-y));
  margin-right: calc(-0.5 * var(--grid-gutter-x));
  margin-left: calc(-0.5 * var(--grid-gutter-x));
}

.row > * {
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding-right: calc(0.5 * var(--grid-gutter-x));
  padding-left: calc(0.5 * var(--grid-gutter-x));
  margin-top: var(--grid-gutter-y);
}

.g-2 {
  --grid-gutter-x: 0.5rem;
  --grid-gutter-y: 0.5rem;
}

.g-3 {
  --grid-gutter-x: 1rem;
  --grid-gutter-y: 1rem;
}

.g-4 {
  --grid-gutter-x: 1.5rem;
  --grid-gutter-y: 1.5rem;
}

.col {
  flex: 1 0 0%;
}

.col-4 {
  flex: 0 0 auto;
  width: 33.333333%;
}

.col-6 {
  flex: 0 0 auto;
  width: 50%;
}

.col-8 {
  flex: 0 0 auto;
  width: 66.666667%;
}

.col-12 {
  flex: 0 0 auto;
  width: 100%;
}

@media (min-width: 768px) {
  .col-md-2 { flex: 0 0 auto; width: 16.666667%; }
  .col-md-3 { flex: 0 0 auto; width: 25%; }
  .col-md-4 { flex: 0 0 auto; width: 33.333333%; }
  .col-md-6 { flex: 0 0 auto; width: 50%; }
  .col-md-8 { flex: 0 0 auto; width: 66.666667%; }
  .d-md-block { display: block !important; }
}

@media (min-width: 992px) {
  .col-lg-4 { flex: 0 0 auto; width: 33.333333%; }
  .col-lg-5 { flex: 0 0 auto; width: 41.666667%; }
  .col-lg-6 { flex: 0 0 auto; width: 50%; }
  .col-lg-7 { flex: 0 0 auto; width: 58.333333%; }
  .col-lg-8 { flex: 0 0 auto; width: 66.666667%; }
  .col-lg-10 { flex: 0 0 auto; width: 83.333333%; }
}

@media (min-width: 1200px) {
  .col-xl-3 { flex: 0 0 auto; width: 25%; }
  .col-xl-5 { flex: 0 0 auto; width: 41.666667%; }
  .col-xl-6 { flex: 0 0 auto; width: 50%; }
  .col-xl-7 { flex: 0 0 auto; width: 58.333333%; }
}

.container-fluid {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
}

.d-flex {
  display: flex !important;
}

.d-grid {
  display: grid !important;
}

.d-block {
  display: block !important;
}

.d-inline-flex {
  display: inline-flex !important;
}

.d-none {
  display: none !important;
}

@media (min-width: 576px) {
  .d-sm-inline {
    display: inline !important;
  }
}

@media (min-width: 768px) {
  .d-md-block {
    display: block !important;
  }
}

.align-items-center {
  align-items: center !important;
}

.align-items-start {
  align-items: flex-start !important;
}

.justify-content-center {
  justify-content: center !important;
}

.justify-content-between {
  justify-content: space-between !important;
}

.justify-content-end {
  justify-content: flex-end !important;
}

.flex-wrap {
  flex-wrap: wrap !important;
}

.flex-grow-1 {
  flex-grow: 1 !important;
}

.gap-2 {
  gap: 0.5rem !important;
}

.gap-3 {
  gap: 1rem !important;
}

.gap-4 {
  gap: 1.5rem !important;
}

.mx-auto {
  margin-right: auto !important;
  margin-left: auto !important;
}

.ms-auto {
  margin-left: auto !important;
}

.ms-1 {
  margin-left: 0.25rem !important;
}

.me-1 {
  margin-right: 0.25rem !important;
}

.me-2 {
  margin-right: 0.5rem !important;
}

.mt-1 {
  margin-top: 0.25rem !important;
}

.mt-2 {
  margin-top: 0.5rem !important;
}

.mt-3 {
  margin-top: 1rem !important;
}

.mt-4 {
  margin-top: 1.5rem !important;
}

.mb-0 {
  margin-bottom: 0 !important;
}

.mb-2 {
  margin-bottom: 0.5rem !important;
}

.mb-3 {
  margin-bottom: 1rem !important;
}

.mb-4 {
  margin-bottom: 1.5rem !important;
}

.my-1 {
  margin-top: 0.25rem !important;
  margin-bottom: 0.25rem !important;
}

.my-2 {
  margin-top: 0.5rem !important;
  margin-bottom: 0.5rem !important;
}

.my-3 {
  margin-top: 1rem !important;
  margin-bottom: 1rem !important;
}

.p-0 {
  padding: 0 !important;
}

.p-3 {
  padding: 1rem !important;
}

.p-4 {
  padding: 1.5rem !important;
}

.px-3 {
  padding-right: 1rem !important;
  padding-left: 1rem !important;
}

.px-4 {
  padding-right: 1.5rem !important;
  padding-left: 1.5rem !important;
}

.py-0 {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.py-2 {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
}

.py-3 {
  padding-top: 1rem !important;
  padding-bottom: 1rem !important;
}

.ps-3 {
  padding-left: 1rem !important;
}

.text-center {
  text-align: center !important;
}

.text-end {
  text-align: right !important;
}

.small,
small {
  font-size: 0.875em;
}

.fw-medium {
  font-weight: 500 !important;
}

.fw-semibold {
  font-weight: 600 !important;
}

.fw-bold {
  font-weight: 700 !important;
}

.rounded {
  border-radius: var(--radius) !important;
}

.rounded-circle {
  border-radius: 50% !important;
}

.border {
  border: 1px solid var(--border) !important;
}

.border-start {
  border-left: 1px solid var(--border) !important;
}

.border-end {
  border-right: 1px solid var(--border) !important;
}

.border-start-0 {
  border-left: 0 !important;
}

.border-end-0 {
  border-right: 0 !important;
}

.bg-transparent {
  background-color: transparent !important;
}

.bg-light {
  background-color: var(--surface-soft) !important;
}

.bg-secondary {
  background-color: #64748B !important;
}

.bg-success {
  background-color: #22C55E !important;
}

.bg-warning {
  background-color: #F59E0B !important;
}

.bg-info {
  background-color: #0EA5E9 !important;
}

.bg-danger {
  background-color: #EF4444 !important;
}

.text-white {
  color: #fff !important;
}

.text-dark {
  color: var(--dark) !important;
}

.text-success {
  color: #16A34A !important;
}

.text-warning {
  color: #D97706 !important;
}

.text-info {
  color: #0284C7 !important;
}

.text-danger {
  color: #DC2626 !important;
}

.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1000;
  min-width: 10rem;
  padding: 0.5rem 0;
  margin: 0.125rem 0 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item,
.dropdown-item-text {
  display: block;
  width: 100%;
  padding: 0.45rem 1rem;
  clear: both;
  color: var(--text);
  white-space: nowrap;
}

.dropdown-divider {
  height: 0;
  margin: 0.5rem 0;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.input-group > .form-control,
.input-group > .form-select {
  position: relative;
  flex: 1 1 auto;
  width: 1%;
  min-width: 0;
}

.input-group > .input-group-text:not(:last-child),
.input-group > .form-control:not(:last-child),
.input-group > .btn:not(:last-child) {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group > .input-group-text:not(:first-child),
.input-group > .form-control:not(:first-child),
.input-group > .btn:not(:first-child) {
  margin-left: -1px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.text-muted {
  color: var(--muted) !important;
}

.text-primary,
.text-primary-custom {
  color: var(--primary-700) !important;
}

.bg-primary,
.bg-primary-custom {
  background-color: var(--primary-600) !important;
}

.min-w-0 {
  min-width: 0;
}

hr {
  border-color: var(--border);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */
#sidebar {
  width: var(--sidebar-width);
  position: fixed;
  inset: 0 auto 0 0;
  height: 100vh;
  min-height: 100vh;
  background: #111827;
  z-index: var(--z-sidebar);
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

#sidebar::-webkit-scrollbar {
  width: 4px;
}

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

#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 4px;
}

#sidebar.collapsed {
  transform: translateX(-100%);
}

#sidebar .sidebar-brand {
  padding: 18px 20px;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#sidebar .sidebar-brand-fallback {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(56, 189, 248, 0.16);
  color: var(--primary-200);
}

#sidebar .sidebar-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  object-fit: contain;
  padding: 3px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
}

#sidebar .sidebar-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
}

#sidebar .nav-link {
  margin: 2px 10px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.68);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  border-radius: var(--radius);
  transition: background 0.18s ease, color 0.18s ease;
  white-space: nowrap;
}

#sidebar .nav-link:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08);
}

#sidebar .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  box-shadow: 0 8px 22px rgba(2, 132, 199, 0.28);
}

#sidebar .nav-link i.fa-fw {
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

#sidebar .nav-section {
  padding: 14px 20px 5px;
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.38);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Topbar
   -------------------------------------------------------------------------- */
#topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(14px);
  z-index: var(--z-topbar);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  transition: left 0.3s ease;
}

#topbar.full-width {
  left: 0;
}

#topbar .topbar-brand {
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#topbar .topbar-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 28px;
}

#topbar .app-name {
  font-weight: 700;
  color: var(--dark);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar-toggle {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
}

/* --------------------------------------------------------------------------
   Main Content Area
   -------------------------------------------------------------------------- */
#main-content {
  margin-left: var(--sidebar-width);
  padding-top: calc(var(--topbar-height) + 24px);
  padding-left: 24px;
  padding-right: 24px;
  padding-bottom: 42px;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.3s ease, width 0.3s ease;
  overflow-x: hidden;
}

#main-content.full-width {
  margin-left: 0;
  width: 100%;
}

#main-content .container-fluid,
#main-content > div {
  max-width: 100%;
  width: 100%;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: var(--z-overlay);
}

#sidebar-overlay.show {
  display: block;
}

@media (max-width: 991.98px) {
  #sidebar {
    transform: translateX(-100%);
    z-index: var(--z-sidebar-mobile);
    height: 100%;
    min-height: 100vh;
    max-height: 100vh;
  }

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

  #topbar {
    left: 0;
  }

  #main-content {
    margin-left: 0;
    width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  .page-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .page-header > a,
  .page-header > button {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h4 {
  margin: 0;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: 0;
}

.page-header small,
.page-header .page-date {
  display: block;
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  color: var(--dark);
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: 16px 20px;
}

.card-body {
  width: 100%;
  overflow-x: auto;
}

.chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Form Styles
   -------------------------------------------------------------------------- */
.form-label {
  margin-bottom: 7px;
  font-weight: 700;
  font-size: 0.91rem;
  color: var(--dark);
}

.form-control,
.form-select {
  width: 100%;
  max-width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-size: 0.94rem;
  color: var(--text);
  background-color: #fff;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea.form-control {
  min-height: 112px;
  resize: vertical;
}

.form-control-sm,
.form-select-sm {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

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

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 0.22rem var(--primary-ring);
}

.form-control[readonly],
.form-control:disabled,
.form-select:disabled {
  color: #64748B;
  background-color: #F8FAFC;
  border-color: var(--border);
}

.input-group-text {
  min-height: 48px;
  padding: 10px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--border-strong);
  border-radius: var(--radius);
}

.input-group .form-control {
  min-height: 48px;
}

.input-group .btn {
  min-height: 48px;
}

.form-check-input {
  border-color: var(--border-strong);
}

.form-check-input:checked {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
}

.form-check-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 0.2rem var(--primary-ring);
}

.invalid-feedback {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  font-size: 0.84rem;
  color: #DC2626;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #DC2626;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: #DC2626;
  box-shadow: 0 0 0 0.22rem rgba(220, 38, 38, 0.18);
}

.file-drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.file-drop-zone:hover {
  border-color: var(--primary-500);
  background: var(--primary-50);
  transform: translateY(-1px);
}

.file-drop-zone i {
  font-size: 2rem;
  color: var(--primary-600);
  margin-bottom: 8px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 40px;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease;
}

.btn-sm {
  min-height: 34px;
  padding: 0.45rem 0.75rem;
  font-size: 0.86rem;
}

.btn:not(:disabled):hover {
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
  box-shadow: 0 8px 18px rgba(2, 132, 199, 0.22);
}

.btn-primary:hover,
.btn-primary:active,
.btn-primary:focus {
  background-color: var(--primary-700) !important;
  border-color: var(--primary-700) !important;
  color: #fff !important;
}

.btn-outline-primary {
  color: var(--primary-700);
  border-color: var(--primary-500);
}

.btn-outline-primary:hover {
  color: #fff;
  background-color: var(--primary-600);
  border-color: var(--primary-600);
}

.btn-outline-secondary {
  color: #475569;
  border-color: var(--border-strong);
  background: #fff;
}

.btn-outline-secondary:hover {
  color: var(--dark);
  border-color: var(--primary-500);
  background: var(--primary-50);
}

.btn-light {
  color: var(--dark);
  border-color: var(--border);
  background: #fff;
}

.btn:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

.btn-success:focus-visible {
  outline-color: var(--secondary);
}

.btn-warning:focus-visible {
  outline-color: var(--warning);
}

.btn-danger:focus-visible {
  outline-color: var(--danger);
}

/* --------------------------------------------------------------------------
   Badges and Alerts
   -------------------------------------------------------------------------- */
.badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0;
}

.badge-hadir {
  background-color: #22C55E;
  color: #fff;
}

.badge-terlambat {
  background-color: #F59E0B;
  color: #111827;
}

.badge-izin {
  background-color: var(--primary-600);
  color: #fff;
}

.badge-sakit {
  background-color: #A855F7;
  color: #fff;
}

.badge-cuti {
  background-color: #0EA5E9;
  color: #fff;
}

.badge-alpa {
  background-color: #EF4444;
  color: #fff;
}

.alert {
  border-radius: var(--radius);
  border-width: 1px;
}

/* --------------------------------------------------------------------------
   Stat Cards
   -------------------------------------------------------------------------- */
.stat-card {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  padding: 22px 20px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
  min-height: 120px;
  height: 100%;
}

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

.stat-card .stat-info .stat-number {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
}

.stat-card .stat-info .stat-label {
  font-size: 0.86rem;
  opacity: 0.9;
  margin-top: 4px;
}

.stat-card .stat-info small {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  opacity: 0.84;
}

.stat-card .stat-icon {
  font-size: 2.7rem;
  opacity: 0.24;
}

.bg-hadir {
  background: linear-gradient(135deg, #22C55E, #16A34A);
}

.bg-terlambat {
  background: linear-gradient(135deg, #F59E0B, #D97706);
}

.bg-izin {
  background: linear-gradient(135deg, var(--primary-600), #0EA5E9);
}

.bg-alpa {
  background: linear-gradient(135deg, #EF4444, #DC2626);
}

.row-stat-cards > [class*="col-"],
.row.g-3 > [class*="col-"] {
  min-width: 0;
}

.row-stat-cards > [class*="col-"] {
  display: flex;
}

.row-stat-cards > [class*="col-"] > .stat-card,
.row.g-3 > [class*="col-"] > .stat-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   DataTables and Tables
   -------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  color: var(--text);
  vertical-align: middle;
}

.table > :not(caption) > * > * {
  padding: 0.82rem 0.95rem;
}

table.dataTable {
  width: 100% !important;
}

table.dataTable thead th,
.table thead th {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--dark);
  background: var(--surface-soft);
  border-bottom-color: var(--border);
  white-space: nowrap;
}

.dataTables_wrapper {
  width: 100%;
  padding: 0.5rem;
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  min-height: 38px;
  font-size: 0.88rem;
  border-radius: var(--radius);
  border-color: var(--border-strong);
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 0.2rem var(--primary-ring);
}

.page-link {
  color: var(--primary-700);
  border-color: var(--border);
}

.active > .page-link,
.page-link.active {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
}

/* --------------------------------------------------------------------------
   Profile Pages
   -------------------------------------------------------------------------- */
.profile-hero {
  border: 1px solid var(--primary-200);
  border-radius: var(--radius);
  background: linear-gradient(135deg, #EFF6FF 0%, var(--primary-100) 100%);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}

.profile-hero-main {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: #fff;
  font-size: 2.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary-600), #2563EB);
  box-shadow: 0 14px 30px rgba(2, 132, 199, 0.26);
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-title {
  margin: 0;
  color: var(--dark);
  font-size: 1.55rem;
  font-weight: 800;
}

.profile-subtitle {
  color: #475569;
  font-size: 0.98rem;
  margin-top: 2px;
}

.profile-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  color: #166534;
  background: #DCFCE7;
  font-size: 0.86rem;
  font-weight: 700;
}

.profile-pill.info {
  color: var(--primary-700);
  background: #E0F2FE;
}

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

.profile-meta-item {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 10px;
}

.profile-meta-icon,
.card-title-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--primary-700);
  background: var(--primary-100);
}

.profile-meta-label {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.profile-meta-value {
  color: var(--dark);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-section-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-section-title h5 {
  margin: 0;
  color: var(--dark);
  font-weight: 800;
}

.profile-section-title p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.profile-detail-row {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.profile-detail-label {
  color: var(--muted);
  font-weight: 700;
}

.profile-detail-value {
  color: var(--dark);
  font-weight: 700;
}

@media (max-width: 1199.98px) {
  .profile-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .profile-hero {
    padding: 18px;
  }

  .profile-hero-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-avatar {
    width: 76px;
    height: 76px;
    font-size: 2rem;
  }

  .profile-title {
    font-size: 1.25rem;
  }

  .profile-meta-grid {
    grid-template-columns: 1fr;
  }

  .profile-detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* --------------------------------------------------------------------------
   Presensi Page
   -------------------------------------------------------------------------- */
#live-clock {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.presensi-date {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 6px;
}

.presensi-greeting {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--dark);
}

.btn-absen {
  height: 62px;
  font-size: 1.02rem;
  font-weight: 800;
  border-radius: var(--radius);
}

.btn-absen:not(:disabled):hover {
  box-shadow: var(--shadow-md);
}

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

.btn-absen-masuk {
  background-color: #22C55E;
  border-color: #22C55E;
  color: #fff;
}

.btn-absen-masuk:hover:not(:disabled) {
  background-color: #16A34A;
  border-color: #16A34A;
  color: #fff;
}

.btn-absen-pulang {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  color: #fff;
}

.btn-absen-pulang:hover:not(:disabled) {
  background-color: var(--primary-700);
  border-color: var(--primary-700);
  color: #fff;
}

.jam-kerja-info {
  font-size: 0.86rem;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
}

.presensi-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 480px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Login Page
   -------------------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.18), transparent 28%),
    linear-gradient(135deg, #0F172A 0%, #075985 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-card .login-header {
  background: linear-gradient(135deg, #0F172A, #0C4A6E);
  padding: 32px 30px 24px;
  text-align: center;
  color: #fff;
}

.login-logo,
.login-logo-fallback {
  width: 84px;
  height: 84px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.login-logo {
  object-fit: contain;
  padding: 6px;
}

.login-logo-fallback {
  background: rgba(255, 255, 255, 0.15);
}

.login-card .login-header .app-title {
  font-size: 1.22rem;
  font-weight: 800;
  margin-top: 12px;
}

.login-card .login-header .app-subtitle {
  font-size: 0.86rem;
  opacity: 0.72;
  margin-top: 4px;
}

.login-card .login-body {
  padding: 30px;
  background: #fff;
}

.login-body .input-group .form-control {
  padding-left: 12px;
}

.login-card .login-footer {
  background: var(--surface-soft);
  padding: 12px 30px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   Flash Container
   -------------------------------------------------------------------------- */
.flash-container {
  position: fixed;
  top: 75px;
  right: 20px;
  z-index: var(--z-flash);
  min-width: 300px;
  max-width: 380px;
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */
.progress {
  height: 8px;
  border-radius: 999px;
  background: #E2E8F0;
}

.progress-bar {
  border-radius: 999px;
}
