/* ============ Tabel & kartu data seragam (semua menu) ============
   Satu gaya untuk semua tabel: bilah cari, tabel, dan paginasi menyatu dalam satu kartu.
   Pola rujukan: Penomoran Otomatis. Dimuat setelah semua stylesheet fitur. */
:root{--tbl-head:color-mix(in srgb,var(--color-text) 3.5%,var(--color-surface));--tbl-hover:color-mix(in srgb,var(--color-primary-soft) 38%,var(--color-surface));--tbl-pad-x:16px}

/* Wadah */
html body .table-wrap,html body .data-table-wrap{border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important;overflow-x:auto!important;overflow-y:visible!important}
html body .card:has(>.table-wrap){padding:0!important;overflow:hidden;border-radius:8px}
html body .card:has(>.table-wrap)>:not(.table-wrap){margin-left:var(--tbl-pad-x);margin-right:var(--tbl-pad-x)}
html body .card:has(>.table-wrap)>:not(.table-wrap):first-child{margin-top:var(--tbl-pad-x)}

/* Bilah cari */
html body .table-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0!important;padding:10px var(--tbl-pad-x)!important;border:0!important;border-bottom:1px solid var(--color-border)!important;border-radius:0!important;background:transparent!important;box-shadow:none!important}
html body .table-search{position:relative;flex:0 1 280px!important;max-width:280px!important;min-width:0}
html body .table-search::before{content:'';position:absolute;left:11px;top:50%;width:14px;height:14px;transform:translateY(-50%);background:currentColor;color:var(--color-text-muted);opacity:.7;pointer-events:none;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") center/contain no-repeat}
html body .table-search input{height:34px!important;min-height:34px!important;padding:6px 12px 6px 32px!important;border:1px solid var(--color-border)!important;border-radius:6px!important;background:var(--color-surface)!important;box-shadow:none!important;font-size:13px!important}
html body .table-search input:focus{border-color:var(--color-primary)!important;outline:0;box-shadow:0 0 0 3px color-mix(in srgb,var(--color-primary) 14%,transparent)!important}
html body .table-count{font-size:12px;font-weight:500;color:var(--color-text-muted);white-space:nowrap}

/* Tabel */
html body .table-scroll{margin:0!important;border:0!important;border-radius:0!important;box-shadow:none!important;background:transparent!important}
html body table.data-table{width:100%;border-collapse:collapse!important;border-spacing:0;border:0;background:transparent!important}
html body .data-table thead th,html body .data-table th{padding:10px 14px!important;background:var(--tbl-head)!important;background-image:none!important;color:var(--color-text-muted)!important;font-size:12px!important;font-weight:600!important;letter-spacing:0!important;text-transform:none!important;text-align:left;white-space:nowrap;border:0!important;border-bottom:1px solid var(--color-border)!important;border-radius:0!important;vertical-align:middle}
html body .data-table td{padding:11px 14px!important;font-size:13.5px!important;line-height:1.45!important;color:var(--color-text);vertical-align:middle!important;border:0!important;border-bottom:1px solid var(--color-border)!important;background:transparent!important}
html body .data-table tbody tr,html body .data-table tbody tr:nth-child(odd),html body .data-table tbody tr:nth-child(even){background:transparent!important;box-shadow:none}
html body .data-table tbody tr:hover,html body .data-table tbody tr:hover td{background:var(--tbl-hover)!important}
html body .data-table tbody tr:last-child td{border-bottom:0!important}
html body .data-table th:first-child,html body .data-table td:first-child{padding-left:var(--tbl-pad-x)!important}
html body .data-table th:last-child,html body .data-table td:last-child{padding-right:var(--tbl-pad-x)!important}
html body .data-table .table-sort{padding:0;border:0;background:none;font:inherit;color:inherit;text-transform:none;letter-spacing:0;cursor:pointer;white-space:nowrap}
html body .data-table .table-sort:hover{color:var(--color-text)}
html body .data-table td[colspan]{padding:32px 16px!important;text-align:center!important;color:var(--color-text-muted);font-size:13px!important}
html body .data-table.full-columns td:last-child,html body .data-table.full-columns th:last-child{text-align:right!important;width:1%;white-space:nowrap}
html body .data-table.full-columns td[colspan]:last-child{text-align:center!important;width:auto}

/* Aksi baris: ikon netral 32px, warna hanya saat disorot */
html body .table-row-actions,html body .user-actions{display:flex!important;align-items:center;justify-content:flex-end!important;gap:6px;flex-wrap:nowrap!important}
html body .table-row-actions>button,html body .table-row-actions>a,html body .user-actions>button{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:32px!important;min-height:32px!important;min-width:32px;padding:0 10px;border:1px solid var(--color-border)!important;border-radius:6px!important;background:var(--color-surface)!important;box-shadow:none!important;color:var(--color-text-muted)!important;font-size:12.5px;font-weight:600;white-space:nowrap;cursor:pointer;transition:color .15s,border-color .15s,background .15s}
html body .table-row-actions>.icon-only,html body .user-actions>.icon-only{width:32px!important;padding:0!important}
html body .table-row-actions>button:hover,html body .table-row-actions>a:hover,html body .user-actions>button:hover,
html body .table-row-actions>button:focus-visible,html body .user-actions>button:focus-visible{border-color:color-mix(in srgb,var(--color-primary) 45%,var(--color-border))!important;background:var(--color-primary-soft)!important;color:var(--color-primary)!important}
html body .table-row-actions>.btn-action-red:hover,html body .user-actions>.danger-text:hover{border-color:color-mix(in srgb,var(--color-danger) 45%,var(--color-border))!important;background:var(--color-danger-soft)!important;color:var(--color-danger)!important}
html body .table-row-actions>button:disabled,html body .user-actions>button:disabled{opacity:.45;cursor:not-allowed}
html body .data-table th:last-child>svg{display:none}

/* Badge status */
html body .data-table .badge{padding:2px 8px;border-radius:5px;font-size:12px;font-weight:600;white-space:nowrap}

/* Paginasi */
html body .table-pagination{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:0!important;padding:10px var(--tbl-pad-x)!important;border:0!important;border-top:1px solid var(--color-border)!important;border-radius:0!important;background:transparent!important;color:var(--color-text-muted);font-size:12.5px}
html body .table-pagination>div{display:flex;gap:6px;width:auto!important}
html body .table-pagination button{flex:none!important;height:32px!important;min-height:32px!important;padding:0 10px!important;border-radius:6px!important;font-size:12.5px!important}
html body .table-page-size select{height:32px;min-height:32px;padding:0 8px;border:1px solid var(--color-border);border-radius:6px;background:var(--color-surface);font-size:12.5px!important}
html body .table-pagination__icon{display:none}

/* Kartu statistik: netral, tanpa garis warna */
html body .stat-card{border-radius:8px!important;box-shadow:none!important;transform:none!important}
html body .stat-card::before{display:none!important}
html body .stat-card__icon{border-radius:6px!important;background:var(--color-primary-soft)!important;color:var(--color-primary)!important;width:34px;height:34px}
html body .stat-card__value{font-size:clamp(20px,1.4vw + 6px,26px)!important;font-weight:700!important;letter-spacing:-.01em!important}
html body .leave-metric{border-radius:8px!important;box-shadow:none!important}
html body .leave-metric::before,html body .leave-metric::after{display:none!important}

/* Tablet: tabel ringkas tetap tabel */
@media (max-width:1024px){
  html body .data-table.compact-columns{table-layout:auto!important}
  html body .data-table.compact-columns th,html body .data-table.compact-columns td{width:auto}
}

/* Ponsel: setiap baris jadi kartu ringkas (kolom utama + aksi, kolom kedua di bawah) */
@media (max-width:600px){
  :root{--tbl-pad-x:12px}
  html body .table-toolbar{gap:10px}
  html body .table-search{flex:1 1 auto!important;max-width:none!important}
  html body .data-table.compact-columns:not(.number-table) thead{display:none!important}
  html body .data-table.compact-columns:not(.number-table),html body .data-table.compact-columns:not(.number-table) tbody{display:block!important;width:100%!important;min-width:0!important}
  html body .data-table.compact-columns:not(.number-table) tbody tr{display:grid!important;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:3px 12px;width:auto!important;margin:0!important;padding:12px var(--tbl-pad-x)!important;border:0!important;border-bottom:1px solid var(--color-border)!important;border-radius:0!important;box-shadow:none!important}
  html body .data-table.compact-columns:not(.number-table) tbody tr:last-child{border-bottom:0!important}
  html body .data-table.compact-columns:not(.number-table) tbody td{display:block!important;width:auto!important;min-width:0!important;max-width:none!important;padding:0!important;border:0!important;text-align:left!important;font-size:13.5px!important}
  html body .data-table.compact-columns:not(.number-table) tbody td::before{display:none!important;content:none!important}
  html body .data-table.compact-columns:not(.number-table) tbody td:first-child{grid-column:1;grid-row:1;font-weight:600}
  html body .data-table.compact-columns:not(.number-table) tbody td:not(:first-child):not(:last-child){grid-column:1;color:var(--color-text-muted);font-size:12.5px!important}
  html body .data-table.compact-columns:not(.number-table) tbody td:last-child{grid-column:2;grid-row:1/span 3;align-self:center;width:auto!important}
  html body .data-table.compact-columns:not(.number-table) tbody td[colspan]{grid-column:1/-1!important;grid-row:auto!important;text-align:center!important;padding:20px 0!important;font-weight:400}
  html body .data-table.compact-columns:not(.number-table) .compact-secondary{display:none!important}
  html body .table-pagination{gap:8px}
  html body .table-pagination>span{order:-1;flex:1 1 auto}
  html body .table-page-size{display:none!important}
  html body .table-pagination button{width:32px;padding:0!important;justify-content:center}
  html body .table-pagination__label{display:none}
  html body .table-pagination__icon{display:inline}
  html body .user-actions>button:not(.icon-only){width:32px;padding:0}
}
html body .leave-metric span,html body .leave-metric small{font-size:12px}

/* Ponsel: kartu statistik 2 kolom ringkas, ikon sebaris dengan angka */
@media (max-width:600px){
  html body .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  html body .stat-card{display:grid!important;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:2px 10px;padding:12px!important}
  html body .stat-card__top{grid-row:1/span 2;grid-column:1}
  html body .stat-card__icon{width:30px!important;height:30px!important}
  html body .stat-card__value{grid-column:2;font-size:18px!important;line-height:1.2}
  html body .stat-card__label{grid-column:2;font-size:12px!important}
  html body .page-header .page-actions,html body .page-header>div:last-child:not(:first-child){display:flex!important;flex-wrap:wrap;justify-content:flex-start;gap:8px;width:auto}
  html body .page-header .page-actions>.btn,html body .page-header>div:last-child:not(:first-child)>.btn{flex:0 0 auto!important;width:auto!important}
}

/* Kalender mingguan admin: garis tipis seperti kalender, kolom ruang tetap menempel */
html body .data-table.jadwal-piket th,html body .data-table.jadwal-piket td{border-left:1px solid var(--color-border)!important}
html body .data-table.jadwal-piket th:first-child,html body .data-table.jadwal-piket td:first-child{border-left:0!important;background:var(--color-surface)!important;font-weight:600}
html body .data-table.jadwal-piket th{text-align:center}
html body .data-table.jadwal-piket th:first-child{text-align:left;background:var(--tbl-head)!important}
html body .data-table.jadwal-piket tbody tr:hover td{background:transparent!important}
html body .data-table.jadwal-piket tbody tr:hover td:first-child{background:var(--color-surface)!important}
html body .data-table.jadwal-piket td.jadwal-piket-cell:not(.jadwal-piket-cell--readonly):hover{background:var(--tbl-hover)!important}
html body .data-table.jadwal-piket td:last-child,html body .data-table.jadwal-piket th:last-child{text-align:center!important;width:auto;white-space:normal}
html body .jadwal-piket .jadwal-piket-kosong{display:grid!important;place-items:center;min-height:44px;margin:0;padding:0;border:1px dashed transparent!important;border-radius:6px!important;background:transparent!important;box-shadow:none!important;color:var(--color-text-faint);font-size:16px!important;opacity:.35;transition:opacity .15s,border-color .15s,color .15s}
html body .jadwal-piket-cell:not(.jadwal-piket-cell--readonly):hover .jadwal-piket-kosong{opacity:1;border-color:color-mix(in srgb,var(--color-primary) 40%,var(--color-border))!important;color:var(--color-primary)}
@media (max-width:600px){
  html body .jadwal-piket .jadwal-piket-kosong{min-height:34px}
  html body .stat-card__value{font-size:15px!important;white-space:nowrap;overflow-wrap:normal!important;overflow:hidden;text-overflow:ellipsis}
}
