/*
 * Skylearn Design System for Admin Banjar Bala Angkep
 * Clean, Warm, Ultra-Accessible, Field-Optimized
 */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&display=swap');

:root {
  /* Skylearn Primary Palette */
  --sky: #3B82F6;
  --sky-bright: #60A5FA;
  --sky-deep: #1D4ED8;
  --sky-soft: #DBEAFE;
  --sky-pale: #EFF6FF;

  /* Achievement / Alert / Pending: Sun */
  --sun: #F59E0B;
  --sun-bright: #FBBF24;
  --sun-deep: #D97706;
  --sun-soft: #FEF3C7;

  /* Success / Paid / Lunas: Leaf */
  --leaf: #10B981;
  --leaf-bright: #34D399;
  --leaf-deep: #059669;
  --leaf-soft: #DCFCE7;

  /* Arrears / Debt / Cancelled / Expense: Coral */
  --coral: #EF4444;
  --coral-bright: #F87171;
  --coral-deep: #DC2626;
  --coral-soft: #FEE2E2;

  /* Secondary Accent: Berry */
  --berry: #8B5CF6;
  --berry-soft: #EDE9FE;

  /* Neutrals & Surfaces */
  --bg-page: #F8FAFC;
  --surface: #FFFFFF;
  --surface-alt: #F1F5F9;
  --surface-sunken: #E2E8F0;
  
  /* Text & Inks */
  --ink: #0F172A;
  --ink-muted: #475569;
  --ink-subtle: #64748B;
  --ink-faint: #94A3B8;

  /* Borders & Dividers */
  --outline: #E2E8F0;
  --outline-strong: #CBD5E1;
  --outline-focus: #3B82F6;

  /* Shadows & Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 12px 28px rgba(59, 130, 246, 0.12);

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 9999px;

  /* Typography */
  --font-display: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Numbers & money: the display face with tabular, lining figures so columns align */
  --font-num: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Mobile Tap Height */
  --tap-target-height: 52px;
}

/* Base Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

a {
  color: var(--sky);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--sky-deep);
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar */
.app-sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--outline);
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--sky), var(--sky-deep));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.brand-info h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.brand-info p {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  padding: 12px 12px 6px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 15px;
  transition: all 0.18s ease;
}

.nav-link svg, .nav-link i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  color: var(--ink-subtle);
  transition: color 0.18s ease;
}

.nav-link:hover {
  background-color: var(--sky-soft);
  color: var(--sky-deep);
}

.nav-link:hover svg, .nav-link:hover i {
  color: var(--sky);
}

.nav-link.active {
  background-color: var(--sky-soft);
  color: var(--sky-deep);
  font-weight: 700;
  border-left: 4px solid var(--sky);
}

.nav-link.active svg, .nav-link.active i {
  color: var(--sky-deep);
}

.nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--sky-bright);
  color: white;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--outline);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-page);
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: var(--sky-soft);
  color: var(--sky-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

.user-avatar .lucide {
  width: 20px;
  height: 20px;
}

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

.user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--ink-subtle);
  text-transform: capitalize;
}

/* Superadmin role preview */
.role-switcher {
  padding: 12px 16px 0;
  border-top: 1px solid var(--outline);
  background: var(--bg-page);
}

.role-switcher-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.role-switcher-label .lucide {
  width: 14px;
  height: 14px;
}

.role-switcher + .sidebar-footer {
  border-top: none;
}

.impersonate-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--sun-soft);
  border: 1px solid var(--sun);
  color: var(--sun-deep);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  margin-bottom: 16px;
}

/* Password show/hide */
.password-field {
  position: relative;
}

.password-field .form-control {
  padding-right: 48px;
}

.password-toggle-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.password-toggle-btn:hover {
  color: var(--ink);
  background: var(--surface-alt);
}

.password-toggle-btn .lucide {
  width: 18px;
  height: 18px;
}

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: 280px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  height: 72px;
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.page-title-wrap h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.page-title-wrap p {
  font-size: 13px;
  color: var(--ink-subtle);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.content-wrapper {
  padding: 32px;
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  line-height: 1.2;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--sky);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary:hover {
  background-color: var(--sky-deep);
  color: white;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
}

.btn-success {
  background-color: var(--leaf);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background-color: var(--leaf-deep);
  color: white;
}

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

.btn-warning:hover {
  background-color: var(--sun-deep);
}

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

.btn-danger:hover {
  background-color: var(--coral-deep);
}

.btn-outline {
  background-color: var(--surface);
  border-color: var(--outline);
  color: var(--ink-muted);
}

.btn-outline:hover {
  background-color: var(--surface-alt);
  border-color: var(--outline-strong);
  color: var(--ink);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 17px;
  min-height: var(--tap-target-height);
  border-radius: var(--radius-md);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Cards & Surfaces */
.card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  position: relative;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--outline);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.card-subtitle {
  font-size: 13px;
  color: var(--ink-subtle);
  margin-top: 2px;
}

/* Stat Grid & Metric Widgets */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.stat-card.sky::before { background: var(--sky); }
.stat-card.leaf::before { background: var(--leaf); }
.stat-card.sun::before { background: var(--sun); }
.stat-card.coral::before { background: var(--coral); }
.stat-card.berry::before { background: var(--berry); }

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

.stat-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}

.stat-icon.sky { background: var(--sky-soft); color: var(--sky-deep); }
.stat-icon.leaf { background: var(--leaf-soft); color: var(--leaf-deep); }
.stat-icon.sun { background: var(--sun-soft); color: var(--sun-deep); }
.stat-icon.coral { background: var(--coral-soft); color: var(--coral-deep); }
.stat-icon.berry { background: var(--berry-soft); color: var(--berry); }

.stat-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.stat-footer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.badge-leaf {
  background-color: var(--leaf-soft);
  color: var(--leaf-deep);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-sun {
  background-color: var(--sun-soft);
  color: var(--sun-deep);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-coral {
  background-color: var(--coral-soft);
  color: var(--coral-deep);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-sky {
  background-color: var(--sky-soft);
  color: var(--sky-deep);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-gray {
  background-color: var(--surface-alt);
  color: var(--ink-muted);
  border: 1px solid var(--outline);
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--outline);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.table th {
  background: var(--surface-alt);
  color: var(--ink-muted);
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--outline);
  color: var(--ink);
  vertical-align: middle;
}

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

.table tbody tr:hover {
  background-color: var(--sky-pale);
}

.table .mono,
.table td.amount,
.table th.amount,
.table td.number,
.table th.number,
.tabular-nums,
.nominal-value,
.stat-value,
.stat-number,
.amount-text,
.rupiah-display {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  letter-spacing: 0;
}

.table td.amount,
.table th.amount,
.table td.number,
.table th.number,
.text-right {
  text-align: right !important;
}

/*
 * Tabel -> kartu di layar sempit (<= 640px), agar data terbaca tanpa geser ke samping.
 * Pasang class "table-cards" pada <table> dan "table-cards-wrap" pada .table-responsive.
 * Setiap <tr> menjadi satu kartu; peran tiap sel diatur lewat class:
 *   .m-title   judul kartu (baris pertama, dua pertiga kiri)
 *   .m-badge   status / nominal di pojok kanan atas
 *   .m-stat    angka ringkas, label diambil dari atribut data-label (tiga per baris)
 *   .m-full    selebar kartu
 *   .m-actions tombol aksi selebar kartu
 *   .m-hide    disembunyikan pada tampilan kartu
 * Elemen .m-only hanya tampil di kartu; beri juga class no-print agar tidak ikut tercetak.
 * Tambahkan "table-cards-split" bila kartu tidak memakai .m-stat: judul mengisi sisa lebar
 * dan .m-badge selebar isinya (untuk nominal panjang seperti "Rp 1.100.000").
 */
.m-only {
  display: none;
}

.m-meta {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink-muted);
}

.m-meta + .m-meta {
  margin-top: 2px;
}

.m-meta .badge {
  font-size: 11px;
  padding: 2px 8px;
}

@media (max-width: 640px) {
  .table-cards-wrap {
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }

  .table.table-cards,
  .table.table-cards tbody {
    display: block;
    width: 100% !important;
  }

  .table.table-cards,
  .table.table-cards.no-footer {
    border: none !important;
  }

  .table.table-cards thead {
    display: none;
  }

  .table.table-cards tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid var(--outline);
    border-radius: var(--radius-md);
    background: var(--surface);
  }

  .table.table-cards tbody tr:last-child {
    margin-bottom: 0;
  }

  /* display:grid di atas mengalahkan atribut hidden bawaan browser (dipakai table-search.js) */
  .table.table-cards tbody tr[hidden] {
    display: none;
  }

  .table.table-cards tbody tr:hover {
    background: var(--surface) !important;
  }

  .table.table-cards tbody td {
    display: block;
    min-width: 0;
    padding: 0 !important;
    border: none !important;
    text-align: left !important;
  }

  .table.table-cards .m-hide {
    display: none;
  }

  .table.table-cards .m-only {
    display: block;
  }

  .table.table-cards.table-cards-split tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .table.table-cards .m-title {
    grid-row: 1;
    grid-column: 1 / -2;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .table.table-cards .m-title .m-amount {
    font-size: 19px;
  }

  .table.table-cards .m-badge {
    grid-row: 1;
    grid-column: -2 / -1;
    justify-self: end;
    text-align: right !important;
  }

  .table.table-cards.table-cards-split .m-badge {
    white-space: nowrap;
  }

  .table.table-cards .m-badge > div {
    justify-content: flex-end;
    align-items: flex-end !important;
  }

  .table.table-cards td.m-full {
    font-size: 13px;
    line-height: 1.4;
    color: var(--ink-muted);
  }

  .table.table-cards .m-badge[data-label]::before,
  .table.table-cards .m-stat::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-subtle);
  }

  .table.table-cards .m-stat {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
  }

  .table.table-cards .m-full,
  .table.table-cards td[colspan] {
    grid-column: 1 / -1;
  }

  .table.table-cards td[colspan] {
    text-align: center !important;
  }

  .table.table-cards .m-actions {
    grid-column: 1 / -1;
  }

  .table.table-cards .m-actions > div {
    display: flex;
    gap: 8px;
  }

  .table.table-cards .m-actions .btn {
    flex: 1 1 auto;
    min-height: 44px;
    min-width: 44px;
    justify-content: center;
    white-space: nowrap;
  }
}

/* Forms & Controls */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.form-control, .form-select {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 48px;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 4px var(--sky-soft);
}

.form-text {
  font-size: 12px;
  color: var(--ink-subtle);
  margin-top: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Search Bar */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  padding-left: 42px;
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--ink-subtle);
  pointer-events: none;
}

/* Pencarian live tabel (komponen <x-table-search>) */
.table-search {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 16px;
}

.table-search .search-box {
  flex: 1 1 260px;
  max-width: 420px;
}

.table-search-count {
  font-size: 12px;
  color: var(--ink-muted);
}

/* Progress Bars */
.progress-bar-wrap {
  width: 100%;
  height: 10px;
  background-color: var(--surface-alt);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar-fill.leaf { background: var(--leaf); }
.progress-bar-fill.sky { background: var(--sky); }
.progress-bar-fill.sun { background: var(--sun); }
.progress-bar-fill.coral { background: var(--coral); }

/* Field Operator Mobile View Specifics */
.operator-card {
  background: var(--surface);
  border: 2px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.operator-card:hover, .operator-card:active {
  border-color: var(--sky);
  background: var(--sky-pale);
}

/* Baris tagihan di form setoran: [centang | info | nominal]. Di layar sempit nominal turun ke bawah info. */
.operator-bill-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 180px;
  grid-template-areas: "check info amount";
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.operator-bill-select.checked {
  border-color: var(--sky);
  background: var(--sky-soft);
}

.operator-bill-select .bill-check {
  grid-area: check;
  width: 22px;
  height: 22px;
  cursor: pointer;
}

.operator-bill-select .bill-info {
  grid-area: info;
  min-width: 0;
  cursor: pointer;
}

.operator-bill-select .bill-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 15px;
  overflow-wrap: anywhere;
}

.operator-bill-select .bill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-subtle);
}

.operator-bill-select .bill-amount {
  grid-area: amount;
  min-width: 0;
}

.operator-bill-select .bill-amount label {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  color: var(--ink-subtle);
}

.operator-bill-select .bill-amount .form-control {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 15px;
  padding: 8px 12px;
  min-height: 42px;
}

/* Ringkasan total & tombol simpan di form setoran */
.setoran-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.setoran-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 24px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 2px solid var(--sky);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
}

.setoran-summary .setoran-total {
  font-family: var(--font-num);
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
  color: var(--leaf-deep);
  overflow-wrap: anywhere;
}

.setoran-summary .btn {
  min-width: 240px;
  font-size: 18px;
}

.setoran-payment-box {
  padding: 24px;
  margin-bottom: 28px;
  background: var(--surface-alt);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
}

.setoran-tunggakan {
  text-align: right;
}

@media (max-width: 600px) {
  .operator-bill-select {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "check info"
      ".     amount";
    align-items: start;
    gap: 10px 12px;
    padding: 12px;
  }

  .operator-bill-select .bill-check {
    margin-top: 1px;
  }

  .operator-bill-select .bill-amount .form-control {
    font-size: 16px; /* >= 16px agar iOS tidak auto-zoom saat input difokuskan */
    min-height: 44px;
  }

  .setoran-summary,
  .setoran-payment-box {
    padding: 16px;
  }

  .setoran-summary .btn {
    width: 100%;
    min-width: 0;
    font-size: 16px;
  }

  .setoran-tunggakan {
    text-align: left;
  }
}

/* Kwitansi Printable Layout */
.receipt-box {
  max-width: 600px;
  margin: 0 auto;
  background: white;
  border: 2px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-md);
  color: var(--ink);
}

.receipt-header {
  text-align: center;
  border-bottom: 2px dashed var(--outline);
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.receipt-header h2 {
  font-size: 20px;
  color: var(--ink);
}

.receipt-header p {
  font-size: 13px;
  color: var(--ink-muted);
}

.receipt-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--outline);
  font-size: 14px;
}

.receipt-total {
  display: flex;
  justify-content: space-between;
  padding: 16px 0;
  font-size: 18px;
  font-weight: 700;
  border-top: 2px solid var(--ink);
  margin-top: 16px;
}

.receipt-qr {
  text-align: center;
  margin: 24px 0 12px;
}

/* Mobile Nav Bottom for Operator */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--surface);
  border-top: 1px solid var(--outline);
  z-index: 110;
  justify-content: space-around;
  align-items: center;
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.mobile-nav-item.active {
  color: var(--sky-deep);
}

.mobile-nav-item i, .mobile-nav-item svg {
  font-size: 20px;
}

/* Responsive Breakpoints */
@media (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: 290px;
    max-width: 85vw;
    z-index: 1200; /* Must be ABOVE topbar and mobile-bottom-nav */
    transform: translateX(-100%);
    box-shadow: none;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .app-sidebar.show {
    transform: translateX(0);
    box-shadow: 0 10px 40px rgba(15, 23, 42, 0.35);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    z-index: 1150;
    opacity: 0;
    transition: opacity 0.25s ease;
  }

  .sidebar-backdrop.show {
    display: block;
    opacity: 1;
  }

  .sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 24px;
  }

  .sidebar-footer {
    flex-shrink: 0;
    background: var(--surface);
    padding: 16px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--outline);
    position: relative;
    z-index: 2;
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 6px;
  }

  /* Topbar: title takes the remaining width and truncates on one line instead of overflowing */
  .app-topbar {
    height: auto;
    min-height: 60px;
    padding: 8px 16px;
    gap: 12px;
  }

  .topbar-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 8px;
  }

  .page-title-wrap {
    flex: 1 1 auto;
    min-width: 0;
  }

  .page-title-wrap h1 {
    font-size: 18px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-right {
    flex-shrink: 0;
    gap: 8px;
  }

  .content-wrapper {
    padding: 20px 16px 80px 16px;
  }

  .mobile-bottom-nav {
    display: flex;
  }
}

/* Mobile Typography & Header Compactness (Anti-Slop Rule: No text bloat) */
@media (max-width: 640px) {
  .app-topbar {
    padding: 8px 12px;
  }

  .page-title-wrap h1 {
    font-size: 16px !important;
  }

  .card-subtitle,
  .page-header-desc,
  .section-desc {
    display: none !important;
  }

  .topbar-right .btn span {
    display: none;
  }

  .topbar-right .btn {
    padding: 8px;
  }

  .card {
    padding: 16px;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* >= 16px mencegah iOS Safari auto-zoom saat field difokuskan (zoom membuat field tampak menutupi konten lain) */
  .form-control,
  .form-select {
    font-size: 16px;
  }
}

/* Print / PDF Export Rules */
@media print {
  @page {
    size: auto;
    margin: 10mm 12mm;
  }

  body {
    background: white !important;
    color: #000 !important;
    font-size: 11pt !important;
  }

  .app-sidebar,
  .app-topbar,
  .mobile-bottom-nav,
  .sidebar-backdrop,
  .no-print,
  .btn,
  .search-box,
  .dataTables_filter,
  .dataTables_length,
  .dataTables_paginate,
  .dataTables_info,
  form[method="GET"],
  .pagination-wrapper,
  nav[role="navigation"] {
    display: none !important;
  }

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

  .content-wrapper {
    padding: 0 !important;
  }

  .card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 12px !important;
    background: transparent !important;
  }

  .table-responsive {
    overflow: visible !important;
    border: none !important;
  }

  .table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 10pt !important;
  }

  .table th,
  .table td {
    border: 1px solid #cbd5e1 !important;
    padding: 6px 8px !important;
    page-break-inside: avoid;
  }

  .table th {
    background: #f1f5f9 !important;
    color: #000 !important;
    font-weight: 700 !important;
  }

  .print-header {
    display: block !important;
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0f172a;
  }

  .receipt-box {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  .print-footer {
    display: flex !important;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 10px;
    font-size: 10pt;
    page-break-inside: avoid;
  }
}

.print-header,
.print-footer {
  display: none;
}

/* ==========================================================================
   Select2 Skylearn Theme (Accessible, Modern, Touch-Friendly)
   ========================================================================== */
.select2-container {
  width: 100% !important;
}

.select2-container .select2-selection--single {
  height: 48px;
  background-color: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 16px;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-size: 15px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  color: var(--ink);
  line-height: normal;
  padding-left: 0;
  padding-right: 24px;
  font-weight: 600;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--ink-faint);
  font-weight: 400;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 14px;
  display: flex;
  align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--ink-subtle) transparent transparent transparent;
  border-width: 6px 5px 0 5px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--ink-subtle) transparent;
  border-width: 0 5px 6px 5px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px var(--sky-soft);
  outline: none;
}

.select2-dropdown {
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  background-color: var(--surface);
  overflow: hidden;
  z-index: 9999;
  padding: 6px;
}

.select2-container--default .select2-search--dropdown {
  padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1.5px solid var(--outline);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  background-color: var(--surface-alt);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
  border-color: var(--sky);
  background-color: var(--surface);
}

.select2-results__option {
  padding: 10px 14px;
  font-size: 14px;
  border-radius: var(--radius-xs);
  margin-bottom: 2px;
  font-weight: 500;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--sky-soft);
  color: var(--sky-deep);
  font-weight: 600;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: var(--sky);
  color: white;
  font-weight: 700;
}

/* ==========================================================================
   Pagination Styling (Clean, Centered, Touch-Friendly)
   ========================================================================== */
.skylearn-pagination-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--outline);
}

.skylearn-pagination-nav .pagination-info {
  font-size: 13px;
  color: var(--ink-muted);
}

.skylearn-pagination-nav .pagination-info strong {
  color: var(--ink);
  font-weight: 700;
}

.skylearn-pagination-nav .pagination-links {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.skylearn-pagination-nav .page-item {
  display: inline-block;
}

.skylearn-pagination-nav .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background-color: var(--surface);
  border: 1px solid var(--outline);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.15s ease;
  user-select: none;
}

.skylearn-pagination-nav .page-link:hover {
  background-color: var(--sky-soft);
  color: var(--sky-deep);
  border-color: var(--sky);
}

.skylearn-pagination-nav .page-item.active .page-link {
  background-color: var(--sky);
  color: white;
  border-color: var(--sky);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.skylearn-pagination-nav .page-item.disabled .page-link {
  color: var(--ink-faint);
  background-color: var(--surface-alt);
  border-color: var(--outline);
  cursor: not-allowed;
  opacity: 0.6;
}

.skylearn-pagination-nav .page-link.dots {
  border: none;
  background: transparent;
  cursor: default;
}

.pagination-arrow-icon {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  display: block;
}

/* Global constraint for any pagination SVG */
nav[role="navigation"] svg,
.pagination svg,
.skylearn-pagination-nav svg {
  width: 18px !important;
  height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
}

/* DataTables Skylearn Theme Integration */
.dataTables_wrapper {
  font-family: var(--font-body);
  color: var(--ink);
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length {
  font-size: 13px;
  color: var(--ink-muted);
  padding-top: 0;
}
.dataTables_wrapper .dataTables_length select {
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  margin: 0 4px;
}
.datatable-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--outline);
  background: var(--surface);
}
.dataTables_wrapper .dataTables_paginate {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 0;
}
.dataTables_wrapper .dataTables_paginate .paginate_button {
  padding: 6px 12px !important;
  border-radius: var(--radius-xs) !important;
  border: 1px solid var(--outline) !important;
  background: var(--surface) !important;
  color: var(--ink) !important;
  font-size: 12.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 32px;
  transition: all 0.15s ease;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
  background: var(--surface-alt) !important;
  border-color: var(--outline-strong) !important;
  color: var(--sky-deep) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--sky) !important;
  color: #ffffff !important;
  border-color: var(--sky) !important;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  background: var(--surface) !important;
  border-color: var(--outline) !important;
}
table.dataTable thead th {
  border-bottom: 2px solid var(--outline) !important;
  padding: 12px 16px !important;
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
table.dataTable tbody td {
  padding: 12px 16px !important;
  border-bottom: 1px solid var(--outline);
  vertical-align: middle;
}
table.dataTable tbody tr:hover {
  background-color: var(--sky-pale) !important;
}
table.dataTable.no-footer {
  border-bottom: 1px solid var(--outline) !important;
}




/* Tables: aligned figures everywhere, not only in tagged cells */
.table td,
.table th {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ==========================================================================
   Rekap Tunggakan Multi-Tahun (screen uses the standard table look;
   the coloured navy/amber theme lives only in the printed PDF, print-table.js)
   ========================================================================== */
.rekap-card {
  padding: 0;
  overflow: hidden;
}

.rekap-header {
  padding: 20px 24px 16px;
  margin-bottom: 0;
}

.rekap-toolbar {
  padding: 12px 20px;
  background: var(--surface-alt);
  border-top: 1px solid var(--outline);
  border-bottom: 1px solid var(--outline);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.rekap-toolbar-search {
  flex: 1;
  min-width: 220px;
  max-width: 480px;
}

.rekap-table {
  width: 100% !important;
  font-size: 12px;
}

.rekap-table thead th {
  text-align: center;
  vertical-align: middle;
  padding: 8px 10px;
  border-bottom: 1px solid var(--outline);
}

.rekap-table thead th.rk-sub { font-size: 10px; }
.rekap-table thead th.rk-year { border-bottom: 1px solid var(--outline); }

.rekap-table tbody td {
  padding: 6px 10px;
  vertical-align: middle;
}

.rekap-table .rk-no { text-align: center; width: 40px; color: var(--ink-muted); }
.rekap-table td.rk-name { font-weight: 700; white-space: nowrap; }
.rekap-table td.rk-name a { color: var(--ink); }
.rekap-table td.rk-name a:hover { color: var(--sky-deep); text-decoration: underline; }
.rekap-table .rk-badge { font-size: 9px; padding: 1px 5px; margin-left: 4px; }
.rekap-table td.rk-tempek { text-align: center; white-space: nowrap; font-size: 11px; color: var(--ink-muted); }
.rekap-table .rk-num { text-align: right; white-space: nowrap; font-family: var(--font-num); }
.rekap-table .rk-year-start { border-left: 1px solid var(--outline) !important; }
.rekap-table td.rk-zero { color: var(--ink-faint); }
.rekap-table tbody td.rk-total { font-weight: 700; color: var(--ink); }
.rekap-table tbody td.rk-grand { font-weight: 800; color: var(--coral-deep); }
.rekap-table tbody td.rk-grand.rk-lunas { color: var(--leaf-deep); }

.rekap-table tfoot td {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 800;
  padding: 8px 10px;
  border-top: 2px solid var(--outline);
}

.rekap-table tfoot td.rk-foot-label { text-align: center; text-transform: uppercase; font-size: 11px; }
