:root {
  --bg: #0f172a;
  --panel: #ffffff;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-2: #0ea5e9;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --ink: #0f172a;
  --soft: #f8fafc;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #f1f5f9; color: var(--ink); font-size: 14px; line-height: 1.45;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: linear-gradient(180deg, #0b1220 0%, #111c34 100%);
  color: #cbd5e1; padding: 18px 14px; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; padding: 0 6px; }
.brand-logo { width: 46px; height: 38px; object-fit: contain; flex: 0 0 46px; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.login-logo { width: 96px; height: 79px; object-fit: contain; flex: 0 0 96px; }
html.sidebar-collapsed .brand-logo { width: 40px; height: 33px; flex-basis: 40px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: .5px;
}
.brand-title { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { color: #94a3b8; font-size: 11px; }
.nav-section { color: #64748b; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; margin: 18px 8px 6px; }
.nav a {
  display: flex; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 8px;
  color: #cbd5e1; font-weight: 500; margin-bottom: 2px;
}
.nav a:hover { background: #1e293b; text-decoration: none; color: #fff; }
.nav a.active { background: #1d4ed8; color: #fff; }
.main { flex: 1; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .who { color: var(--muted); font-size: 12px; }
.content { width: 100%; max-width: none; padding: 24px 26px 60px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 720px) { .layout { display: block; } .sidebar { width: auto; height: auto; position: static; } .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.card h2, .card h3 { margin: 0 0 10px; }
.card h2 { font-size: 15px; }
.card h3 { font-size: 13px; }
.stat { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: #e2e8f0; color: #334155;
}
.badge.ok { background: #dcfce7; color: #166534; }
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.err { background: #fee2e2; color: #991b1b; }
.badge.info { background: #dbeafe; color: #1e40af; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--soft); }
.table tr:hover td { background: #f8fafc; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  border-radius: 8px; padding: 8px 12px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--brand); border-color: var(--line); }
.btn.danger { background: var(--err); }
.btn.warn { background: var(--warn); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.form-row { display: grid; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 12px; font-weight: 600; color: #334155; }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid #cbd5e1; border-radius: 8px;
  background: #fff; font: inherit; color: var(--ink);
}
textarea { min-height: 120px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--brand); }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline > * { flex: 0 0 auto; }
.grow { flex: 1 1 220px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; font-weight: 500; }
.flash.success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.flash.info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tab { padding: 7px 12px; border: 1px solid var(--line); background: #fff; border-radius: 999px; font-weight: 600; font-size: 12px; }
.tab.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.code { background: #0b1220; color: #e2e8f0; padding: 12px; border-radius: 10px; overflow: auto; font-size: 12px; }
.hint { font-size: 12px; color: var(--muted); }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.empty { padding: 24px; text-align: center; color: var(--muted); border: 1px dashed #cbd5e1; border-radius: 10px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e1; border-top-color: var(--brand); border-radius: 50%; animation: sp 1s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 20% 10%, #1e3a8a55, transparent), #0b1220; }
.login-card { width: min(400px, 92vw); background: #fff; border-radius: 16px; padding: 26px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 42px; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer; font-size: 16px;
  padding: 4px 7px; border-radius: 6px; line-height: 1;
}
.pw-eye:hover { background: #e2e8f0; }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); display: none;
  place-items: center; z-index: 50; padding: 20px;
}
.modal-backdrop.show { display: grid; }
.modal-card {
  background: #fff; border-radius: 14px; padding: 20px; width: min(460px, 94vw);
  box-shadow: 0 20px 50px rgba(15,23,42,.25);
}
.secret-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px;
  background: #0b1220; color: #e2e8f0; padding: 12px 14px; border-radius: 10px;
  word-break: break-all; margin: 12px 0;
}
.avatar-wrap {
  position: relative; width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 50%; overflow: hidden; background: #e2e8f0;
  display: grid; place-items: center; border: 1px solid #fff;
  box-shadow: 0 1px 4px rgba(15,23,42,.10);
}
.avatar-wrap .initials { font-weight: 800; color: #475569; font-size: 14px; }
.avatar-wrap img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person-head { display: flex; gap: 10px; align-items: flex-start; }
.range-value {
  display: inline-block; min-width: 38px; text-align: center;
  font-weight: 700; font-size: 12px; color: #fff;
  background: #16a34a; border-radius: 999px; padding: 2px 8px;
}
input[type="range"].score-range {
  width: 100%; height: 6px; padding: 0; border: 0; background: transparent;
  accent-color: #16a34a; cursor: pointer;
}
/* SIPK context header */
.sipk-switcher { display:flex; align-items:center; gap:10px; margin-bottom:12px; }
.sipk-switcher label { font-size:12px; color:#64748b; }
.sipk-switcher select { width:auto; min-width:260px; }
.sipk-head {
  background:#fff; border:1px solid #e2e8f0; border-radius:14px; overflow:hidden;
  box-shadow: 0px 0px 0px 1px rgba(0,0,0,.03), 0px 1px 1px -.5px rgba(0,0,0,.04),
              0px 3px 3px -1.5px rgba(0,0,0,.04), 0px 6px 6px -3px rgba(0,0,0,.04),
              0px 12px 12px -6px rgba(0,0,0,.04);
}
.sipk-head-top { display:flex; align-items:center; justify-content:flex-end; gap:18px; padding:10px 14px; }
.sipk-kicker { font-size:11px; color:#64748b; letter-spacing:.02em; }
.sipk-title { font-size:20px; font-weight:750; letter-spacing:-.02em; line-height:1.2; margin-top:2px; }
.sipk-sub { display:flex; align-items:center; gap:7px; margin-top:4px; font-size:12px; color:#475569; }
.sipk-dot { width:8px; height:8px; border-radius:50%; background:#94a3b8; display:inline-block; }
.sipk-dot.ok { background:#16a34a; }
.sipk-dot.warn { background:#d97706; }
.sipk-dot.err { background:#dc2626; }
.sipk-tools { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.sipk-period { display:flex; gap:6px; margin:0; }
.sipk-period select { width:auto; }
.sipk-context { display:grid; grid-template-columns:1fr 1fr; border-top:1px solid #e2e8f0; }
.sipk-person { display:flex; gap:12px; padding:16px 18px; align-items:flex-start; }
.sipk-person.sipk-pp { border-left:1px solid #e2e8f0; }
.sipk-person-body { min-width:0; flex:1; }
.sipk-label { font-size:11px; color:#64748b; margin-bottom:3px; }
.sipk-name { font-size:15px; font-weight:700; letter-spacing:-.01em; line-height:1.25; }
.sipk-meta { font-size:12px; color:#64748b; line-height:1.5; margin-top:2px; overflow-wrap:break-word; }
.sipk-change { margin-top:6px; }
.sipk-change summary { font-size:12px; color:var(--brand); cursor:pointer; }
.sipk-tabs { display:flex; gap:20px; border-bottom:1px solid #e2e8f0; margin:18px 0 16px; }
.sipk-tab { padding:9px 1px 10px; font-size:13px; font-weight:600; color:#475569; border-bottom:2px solid transparent; }
.sipk-tab:hover { color:#0f172a; text-decoration:none; }
.sipk-tab.active { color:#0f172a; border-bottom-color:#1d4ed8; }
@media (max-width: 820px) {
  .sipk-head-top { flex-direction:column; }
  .sipk-tools { justify-content:flex-start; }
  .sipk-context { grid-template-columns:1fr; }
  .sipk-person.sipk-pp { border-left:0; border-top:1px solid #e2e8f0; }
}
.metric-band {
  display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
  background:#fff; border:1px solid #e2e8f0; border-radius:12px; overflow:hidden;
}
.metric { padding:14px 16px; border-left:1px solid #e2e8f0; }
.metric:first-child { border-left:0; }
.metric span { display:block; font-size:11px; color:#64748b; }
.metric strong { display:block; font-size:24px; line-height:1.2; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.metric small { display:block; font-size:11px; color:#64748b; margin-top:2px; }
@media (max-width: 820px) {
  .metric-band { grid-template-columns:1fr 1fr; }
  .metric:nth-child(3) { border-left:0; }
  .metric:nth-child(n+3) { border-top:1px solid #e2e8f0; }
}
.menu-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-left: auto;
  background: #475569; display: inline-block; flex: 0 0 8px;
}
.menu-dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.16); }
.menu-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.16); }
.menu-dot.off { background: #475569; }
.sipk-dot.off { background: #94a3b8; }
.menu-dot.err { background: #ef4444; box-shadow: 0 0 0 3px rgba(239,68,68,.16); }
.score-badge {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: 999px; font-size: 11px; font-weight: 700; color: #fff;
}
.score-badge.red { background: #dc2626; }
.score-badge.orange { background: #ea580c; }
.score-badge.green { background: #16a34a; }
.sipk-error {
  display: inline-flex; align-items: center; gap: 6px; max-width: 480px;
  color: #b91c1c; font-size: 12px; line-height: 1.35;
}
.sipk-error a { color: #b91c1c; text-decoration: underline; white-space: nowrap; }

/* Kategori resmi ABK (Perkap 9/2021) */
.cat-badge { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px; font-weight:700; font-size:12px; }
.cat-badge.cat-a { background:#dcfce7; color:#14532d; border:1px solid #86efac; }
.cat-badge.cat-b { background:#d1fae5; color:#065f46; border:1px solid #6ee7b7; }
.cat-badge.cat-c { background:#fef3c7; color:#92400e; border:1px solid #fcd34d; }
.cat-badge.cat-d { background:#ffedd5; color:#9a3412; border:1px solid #fdba74; }
.cat-badge.cat-e { background:#fee2e2; color:#991b1b; border:1px solid #fca5a5; }
.abk-score { display:flex; align-items:center; gap:14px; }
.abk-score-code { width:58px; height:58px; border-radius:16px; display:flex; align-items:center; justify-content:center; font-size:30px; font-weight:800; }
.abk-score-code.cat-a { background:#dcfce7; color:#14532d; }
.abk-score-code.cat-b { background:#d1fae5; color:#065f46; }
.abk-score-code.cat-c { background:#fef3c7; color:#92400e; }
.abk-score-code.cat-d { background:#ffedd5; color:#9a3412; }
.abk-score-code.cat-e { background:#fee2e2; color:#991b1b; }
.abk-score-value { font-size:26px; font-weight:800; line-height:1.1; }

.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }

/* Cegah grid item melebar mengikuti tabel lebar */
.grid > * { min-width: 0; }

/* Sidebar collapse */
.sidebar { transition: width .2s ease, padding .2s ease; }
.brand-text { min-width: 0; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; }
.nav-label { white-space: nowrap; }
.nav a { position: relative; }
.sidebar-toggle {
  width: 100%; display: flex; align-items: center; justify-content: flex-start; gap: 8px;
  margin: 0 0 16px; padding: 8px 10px; border: 1px solid #334155; border-radius: 8px;
  background: #1e293b; color: #cbd5e1; font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer; min-height: 36px;
}
.sidebar-toggle:hover { background: #273449; color: #fff; }
.sidebar-toggle:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
html.sidebar-collapsed .sidebar { width: 76px; padding-left: 10px; padding-right: 10px; }
html.sidebar-collapsed .brand { justify-content: center; padding: 0; }
html.sidebar-collapsed .brand-text,
html.sidebar-collapsed .nav-section,
html.sidebar-collapsed .nav-label { display: none; }
html.sidebar-collapsed .sidebar-toggle { justify-content: center; padding: 8px 0; }
html.sidebar-collapsed .sidebar-toggle .nav-icon { transform: rotate(180deg); }
html.sidebar-collapsed .nav a { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .menu-dot { position: absolute; top: 8px; right: 10px; }
@media (max-width: 720px) {
  .sidebar-toggle { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* Loading overlay untuk operasi AI / proses panjang */
.bdo-loading {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(3px);
}
.bdo-loading.show { display: flex; }
.bdo-loading-card {
  width: min(360px, 100%); padding: 26px 24px; border-radius: 16px;
  background: #fff; box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  text-align: center;
}
.bdo-spinner {
  width: 38px; height: 38px; margin: 0 auto 14px;
  border: 3px solid #dbeafe; border-top-color: #2563eb;
  border-radius: 50%; animation: bdo-spin .8s linear infinite;
}
.bdo-loading-text { font-weight: 700; color: #0f172a; margin-bottom: 4px; }
@keyframes bdo-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .bdo-spinner { animation-duration: 1.6s; }
}

/* Toast untuk pesan flash (mis. hasil draft AI) */
.bdo-toast-wrap {
  position: fixed; top: 18px; right: 18px; z-index: 9998;
  width: min(440px, calc(100vw - 28px));
}
.bdo-toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 12px 12px 14px; border-radius: 12px;
  background: #fff; border: 1px solid #e2e8f0;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  animation: bdo-toast-in .22s ease-out;
}
.bdo-toast.hide { opacity: 0; transform: translateY(-6px); transition: opacity .2s ease, transform .2s ease; }
.bdo-toast-mark { width: 4px; align-self: stretch; border-radius: 999px; background: #2563eb; flex: 0 0 4px; }
.bdo-toast.success .bdo-toast-mark { background: #16a34a; }
.bdo-toast.warning .bdo-toast-mark { background: #d97706; }
.bdo-toast.error .bdo-toast-mark { background: #dc2626; }
.bdo-toast.info .bdo-toast-mark { background: #2563eb; }
.bdo-toast-body { flex: 1; font-size: 13px; line-height: 1.45; color: #0f172a; }
.bdo-toast-close {
  border: 0; background: transparent; color: #64748b; cursor: pointer;
  font-size: 20px; line-height: 1; padding: 0 2px; min-width: 28px; min-height: 28px;
}
.bdo-toast-close:hover { color: #0f172a; }
@keyframes bdo-toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 720px) {
  .bdo-toast-wrap { top: 10px; right: 10px; left: 10px; width: auto; }
}

/* Pemilih unit ringkas di card periode */
.abk-unit-select { width: 160px; font-weight: 600; }
@media (max-width: 720px) {
  .abk-unit-select { width: 100%; }
}

.abk-menu-item:disabled { opacity: .45; cursor: not-allowed; }

.abk-datecheck { margin-left: 6px; vertical-align: middle; white-space: nowrap; }
.abk-row-datecheck td:first-child { box-shadow: inset 3px 0 #dc2626; }

.bdo-loading-cancel { margin-top: 12px; width: 100%; }

.abk-day-all { font-weight: 600; color: #b91c1c; }

.abk-unit { display: block; margin-top: 2px; font-size: 10px; font-weight: 400; letter-spacing: 0; text-transform: none; color: #64748b; }

.abk-day-holiday { background: #fff7ed; border-color: #fdba74; }
.abk-holiday-label { color: #b45309; font-weight: 700; line-height: 1.2; margin-bottom: 3px; }

/* Mobile: cegah tabel/form lebar membuat seluruh halaman bergeser */
@media (max-width: 720px) {
  .card { overflow-x: auto; }
  .btn, button, .tab, select, input[type="text"], input[type="number"],
  input[type="date"], input[type="file"] { min-height: 44px; }
  .table { min-width: max-content; }
}

@media (max-width: 720px) {
  .abk-calendar .btn, .abk-bulk-bar .btn, .abk-editor-actions .btn { min-height: 44px; }
  .abk-row-actions .abk-move { min-width: 44px; min-height: 44px; }
}

@media (max-width: 720px) {
  .abk-calendar .btn, .abk-bulk-bar .btn, .abk-editor-actions .btn { min-height: 44px !important; }
  .abk-row-actions .abk-move { min-width: 44px !important; min-height: 44px !important; }
}

/* Kontras teks kecil pada kartu kalender dan tautan flash */
.abk-day .tiny.muted { color: #475569; }
.flash a { text-decoration: underline; }

/* Master draft ABK */
.abk-master-table th:nth-child(1), .abk-master-table td:nth-child(1) { width:84px; }
.abk-master-table th:nth-child(2), .abk-master-table td:nth-child(2) { width:auto; }
.abk-master-table th:nth-child(3), .abk-master-table td:nth-child(3) { width:165px; }
.abk-master-table th:nth-child(4), .abk-master-table td:nth-child(4),
.abk-master-table th:nth-child(5), .abk-master-table td:nth-child(5) { width:78px; }
.abk-master-table th:nth-child(6), .abk-master-table td:nth-child(6) { width:145px; }
.abk-master-table th:nth-child(7), .abk-master-table td:nth-child(7) { width:118px; }

/* Editor tanggal kini 6 kolom (tanpa kolom Hari; pola hari ada di master). */
.abk-editor-component th:nth-child(1), .abk-editor-component td:nth-child(1) { width:84px; }
.abk-editor-component th:nth-child(3), .abk-editor-component td:nth-child(3),
.abk-editor-component th:nth-child(4), .abk-editor-component td:nth-child(4) { width:78px; }
.abk-editor-component th:nth-child(5), .abk-editor-component td:nth-child(5) { width:150px; }
.abk-editor-component th:nth-child(6), .abk-editor-component td:nth-child(6) { width:118px; }
.abk-readonly-table th:nth-child(1), .abk-readonly-table td:nth-child(1) { width:84px; }
.abk-readonly-table th:nth-child(3), .abk-readonly-table td:nth-child(3),
.abk-readonly-table th:nth-child(4), .abk-readonly-table td:nth-child(4) { width:76px; }
.abk-readonly-table th:nth-child(5), .abk-readonly-table td:nth-child(5) { width:150px; }

/* Master draft: sumber & frekuensi */
.abk-master-table th:nth-child(3), .abk-master-table td:nth-child(3) { width:125px; }
.abk-master-table th:nth-child(4), .abk-master-table td:nth-child(4) { width:105px; }
.abk-master-table th:nth-child(5), .abk-master-table td:nth-child(5) { width:165px; }
.abk-master-table th:nth-child(6), .abk-master-table td:nth-child(6),
.abk-master-table th:nth-child(7), .abk-master-table td:nth-child(7) { width:72px; }
.abk-master-table th:nth-child(8), .abk-master-table td:nth-child(8) { width:135px; }
.abk-master-table th:nth-child(9), .abk-master-table td:nth-child(9) { width:110px; }

/* Mobile: draft master as cards, not a squeezed 9-column table */
@media (max-width: 720px) {
  .abk-master-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto;
    border: 0;
    background: transparent;
  }
  .abk-master-table thead { display: none; }
  .abk-master-table tbody { display: block; width: 100%; }
  .abk-master-table tr {
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  }
  .abk-master-table td {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    width: auto !important;
    border: 0 !important;
    padding: 6px 0 !important;
    text-align: left !important;
  }
  .abk-master-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
  }
  .abk-master-table td > input,
  .abk-master-table td > select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
  }
  .abk-master-table td.abk-day-picker {
    grid-template-columns: 1fr;
  }
  .abk-master-table td.abk-day-picker::before {
    margin-bottom: 2px;
  }
  .abk-master-table .abk-day-picker-box {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .abk-master-table .abk-day-picker-box label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    padding: 4px 1px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
    font-size: 10px;
  }
  .abk-master-table .abk-day-picker-box label.abk-day-all {
    grid-column: 1 / -1;
  }
  .abk-master-table .abk-day-picker-box input {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 0;
  }
  .abk-master-table td[data-label="Aksi"] {
    grid-template-columns: 1fr;
    padding-top: 10px !important;
    border-top: 1px solid var(--line) !important;
    margin-top: 4px;
  }
  .abk-master-table td[data-label="Aksi"]::before {
    display: none;
  }
  .abk-master-table td[data-label="Aksi"] .abk-row-actions {
    justify-content: flex-end;
  }
  .abk-master-table td[data-label="Aksi"] .btn {
    min-height: 44px;
  }
}

/* Tablet/mobile: compact two-column master cards, labels above inputs */
@media (max-width: 900px) {
  .abk-master-table {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto;
    border: 0;
    background: transparent;
  }
  .abk-master-table thead { display: none; }
  .abk-master-table tbody { display: block; width: 100%; }
  .abk-master-table tr {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    margin: 0 0 12px;
    padding: 10px 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  }
  .abk-master-table td {
    display: flex !important;
    flex-direction: column;
    gap: 3px;
    align-items: stretch;
    width: auto !important;
    min-width: 0;
    border: 0 !important;
    padding: 4px 0 !important;
    text-align: left !important;
  }
  .abk-master-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    display: block;
  }
  .abk-master-table td > input,
  .abk-master-table td > select {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px;
  }
  .abk-master-table td[data-label="Uraian"],
  .abk-master-table td[data-label="Hari berlaku"],
  .abk-master-table td[data-label="Keterangan"],
  .abk-master-table td[data-label="Aksi"] {
    grid-column: 1 / -1;
  }
  .abk-master-table td.abk-day-picker {
    display: flex !important;
    grid-template-columns: none;
  }
  .abk-master-table .abk-day-picker-box {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }
  .abk-master-table .abk-day-picker-box label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 44px;
    padding: 4px 1px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    background: #f8fafc;
    font-size: 10px;
  }
  .abk-master-table .abk-day-picker-box label.abk-day-all {
    grid-column: 1 / -1;
  }
  .abk-master-table .abk-day-picker-box input {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 0;
  }
  .abk-master-table td[data-label="Aksi"] {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding-top: 10px !important;
    border-top: 1px solid var(--line) !important;
    margin-top: 4px;
  }
  .abk-master-table td[data-label="Aksi"]::before { display: none; }
  .abk-master-table td[data-label="Aksi"] .abk-row-actions {
    justify-content: flex-end;
  }
  .abk-master-table td[data-label="Aksi"] .btn {
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 360px) {
  .abk-master-table .abk-day-picker-box {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .abk-master-table .abk-day-picker-box {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  .abk-master-table .abk-day-picker-box label.abk-day-all { display: none; }
}

/* 361–900px: keep cards compact by putting short labels inline */
@media (min-width: 361px) and (max-width: 900px) {
  .abk-master-table td:not([data-label="Uraian"]):not([data-label="Hari berlaku"]):not([data-label="Aksi"]) {
    display: grid !important;
    grid-template-columns: 58px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
  }
  .abk-master-table td:not([data-label="Uraian"]):not([data-label="Hari berlaku"]):not([data-label="Aksi"])::before {
    margin: 0;
    line-height: 1.15;
  }
}
