/* Jadwal Pimpinan - gaya ala aplikasi kantor pemerintahan (sidebar, tabel berbingkai, kartu di mobile).
   Token mengikuti pola Material Design 3; mobile-first; tanpa font eksternal (CWV: LCP/CLS). */
:root {
  --bg: #f5f5f7; --surface: #fff; --text: #1d1d1f; --muted: #5c5c63;
  --line: #c9c9d0; --line-strong: #757580;
  --primary: #0058b8; --primary-d: #00448f;
  --nav: #0b2545; --nav-hover: #16365f; --nav-text: #e8eef7;
  --ok: #1b6e3a; --ok-bg: #e4f4ea; --warn: #7a4a00; --warn-bg: #fff1d6;
  --bad: #a3231b; --bad-bg: #fde8e6; --info: #0058b8; --info-bg: #e5effb;
  --r: 12px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.06);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; font: 16px/1.5 var(--font); background: var(--bg); color: var(--text); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.125rem; }
p { margin: 0 0 .75em; }
a { color: var(--primary); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -80px; background: #fff; color: var(--primary); padding: 10px 14px; border-radius: 8px; z-index: 200; font-weight: 700; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; box-shadow: 0 0 0 2px #fff; border-radius: 4px; }
.sidebar :focus-visible, .topbar :focus-visible { outline-color: #fff; box-shadow: none; }
.ic { flex: none; fill: currentColor; }

/* ----- Tombol & isian ----- */
.btn { min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; color: var(--text); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; cursor: pointer; text-decoration: none; }
.btn:hover { background: #eef1f6; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .9375rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: inherit; }
.icon-btn.light { color: #fff; }
.icon-btn:hover { background: rgba(0,0,0,.08); } .icon-btn.light:hover { background: rgba(255,255,255,.15); }

.fld { margin-bottom: 14px; }
.fld label { display: block; font-weight: 600; margin-bottom: 4px; }
.req { color: var(--bad); }
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; font: inherit; color: inherit;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; }
textarea { min-height: 88px; resize: vertical; }
input[type=checkbox] { width: 24px; height: 24px; min-height: 0; accent-color: var(--primary); }
input[type=file] { padding: 8px; }
[aria-invalid="true"] { border: 2px solid var(--bad); }
.hint { color: var(--muted); font-size: .875rem; margin-top: 4px; }
.err { color: var(--bad); font-size: .875rem; font-weight: 600; }
.err:empty { display: none; }
.chk { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.chk label { margin: 0; }

/* ----- Kartu, lencana ----- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px 2px 6px; border-radius: 999px; font-size: .8125rem; font-weight: 700; white-space: nowrap; }
.badge .ic { width: 14px; height: 14px; }
.st-plan { background: var(--info-bg); color: var(--info); }
.st-done { background: var(--ok-bg); color: var(--ok); }
.st-hold { background: var(--warn-bg); color: var(--warn); }
.st-cancel { background: var(--bad-bg); color: var(--bad); }

/* ----- Auth ----- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, #0b2545 0 220px, var(--bg) 220px); }
.auth-card { width: 100%; max-width: 420px; padding: 24px; }
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.brand h1 { font-size: 1.25rem; margin: 0; } .brand p { margin: 0; color: var(--muted); font-size: .875rem; }
.logo { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: var(--primary); border-radius: 12px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: #e8e8ed; border-radius: 12px; margin-bottom: 16px; }
.seg-b { min-height: 40px; border: 0; border-radius: 9px; background: transparent; font: inherit; font-weight: 600; cursor: pointer; color: var(--text); }
.seg-b[aria-pressed="true"] { background: #fff; box-shadow: var(--shadow); color: var(--primary); }
.auth-msg { padding: 10px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.auth-msg.ok { background: var(--ok-bg); color: var(--ok); }

/* ----- Kerangka aplikasi (mobile-first) ----- */
.topbar { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 8px; background: var(--nav); color: #fff; }
.topbar-t { font-weight: 700; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; background: var(--nav); color: var(--nav-text);
  display: flex; flex-direction: column; overflow-y: auto;
  visibility: hidden; transform: translateX(-100%); transition: transform .2s ease, visibility 0s .2s; }
.sidebar.open { visibility: visible; transform: none; transition: transform .2s ease; }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 16px 12px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sb-head div { display: grid; line-height: 1.25; flex: 1; } .sb-head span { font-size: .8125rem; opacity: .8; }
.sb-head .logo { width: 40px; height: 40px; }
.nav { list-style: none; margin: 0; padding: 12px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; margin-bottom: 4px; border-radius: 10px; color: var(--nav-text); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--nav-hover); }
.nav a[aria-current="page"] { background: #fff; color: var(--nav); }
.sb-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,.12); }
.who { display: grid; margin-bottom: 10px; line-height: 1.3; } .who span { font-size: .8125rem; opacity: .8; }
.sb-out { width: 100%; background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.sb-out:hover { background: var(--nav-hover); }
main { display: block; }
main:focus { outline: none; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
.page-h { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.page-h h1 { margin: 0; } .page-h h1:focus { outline: none; }
.lead { font-size: 1.0625rem; }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 272px 1fr; min-height: 100dvh; }
  .topbar, .backdrop, .sb-close { display: none !important; }
  .sidebar { position: sticky; top: 0; height: 100dvh; width: auto; visibility: visible; transform: none; }
  .wrap { padding: 24px 32px; }
}

/* ----- Menu utama (ubin) & dashboard ----- */
.tiles { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile { display: grid; gap: 4px; height: 100%; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); color: var(--text); text-decoration: none; }
.tile:hover { border-color: var(--primary); }
.tile .ic { width: 28px; height: 28px; color: var(--primary); } .tile strong { font-size: 1.0625rem; } .tile span { color: var(--muted); font-size: .9375rem; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); margin-bottom: 16px; }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); border-top: 4px solid var(--primary); }
.kpi b { display: block; font-size: 2rem; line-height: 1.1; } .kpi span { color: var(--muted); font-size: .9375rem; }
.grid-2 { display: grid; gap: 16px; } @media (min-width: 960px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.dh { font-size: .9375rem; color: var(--muted); margin: 12px 0 0; }
.ags { list-style: none; margin: 0; padding: 0; }
.ag { display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 12px; align-items: start; padding: 12px 0; border-bottom: 1px solid #e6e6ea; }
.ag:last-child { border-bottom: 0; }
.ag-time { display: grid; font-variant-numeric: tabular-nums; } .ag-time span { color: var(--muted); font-size: .875rem; }
.ag-t { font-weight: 700; } .ag p { margin: 0; color: var(--muted); font-size: .9375rem; }
@media (max-width: 480px) { .ag { grid-template-columns: 56px 1fr; } .ag .badge { grid-column: 2; justify-self: start; } }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bars li div:first-child { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.bar { height: 10px; background: #e6e6ea; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; width: var(--w); background: var(--primary); }
.stats { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stats li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* ----- Filter, toolbar ----- */
.filters { display: grid; gap: 0 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .filters { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.filters .fld { margin-bottom: 8px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

/* ----- Tabel berbingkai (desktop) -> kartu (mobile) ----- */
.tbl-wrap { overflow-x: auto; margin-bottom: 16px; }
.tbl { width: 100%; border-collapse: collapse; background: #fff; }
.tbl caption { text-align: left; font-weight: 700; padding: 8px 0; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.tbl thead th { background: #e9eef6; font-weight: 700; white-space: nowrap; }
.tbl tfoot td { background: #f1f3f7; font-weight: 700; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .aksi { white-space: nowrap; display: flex; gap: 6px; flex-wrap: wrap; }
.tbl select { min-height: 40px; }
@media (max-width: 719px) {
  .tbl thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tbl, .tbl tbody, .tbl tfoot, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; box-shadow: var(--shadow); }
  .tbl td { border: 0; border-bottom: 1px solid #e6e6ea; display: grid; grid-template-columns: 104px 1fr; gap: 8px; text-align: left; }
  .tbl td::before { content: attr(data-label); font-weight: 700; color: var(--muted); }
  .tbl td:last-child { border-bottom: 0; }
  .tbl .num { text-align: left; }
}
.empty { text-align: center; padding: 32px 16px; } .empty p { color: var(--muted); }
.err-box { border-color: var(--bad); }
.pending-bn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); font-weight: 600; }

/* ----- Dialog ----- */
dialog { border: 0; border-radius: 16px; padding: 0; width: calc(100% - 24px); max-width: 640px; color: var(--text); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
dialog#dlg-confirm { max-width: 440px; }
dialog::backdrop { background: rgba(0,0,0,.5); }
.dlg-h { display: flex; justify-content: space-between; align-items: center; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.dlg-h h2 { margin: 0; }
.dlg-b { padding: 16px; max-height: 68vh; overflow-y: auto; }
.dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.grid2 { display: grid; gap: 0 12px; grid-template-columns: 1fr; } @media (min-width: 600px) { .grid2 { grid-template-columns: 1fr 1fr; } .span2 { grid-column: 1 / -1; } }
@media (max-width: 599px) { dialog#dlg-form { margin: auto 0 0; width: 100%; max-width: none; border-radius: 16px 16px 0 0; } }

/* ----- Toast & skeleton ----- */
.toast { position: fixed; left: 50%; bottom: 16px; z-index: 300; max-width: min(92vw, 520px); padding: 12px 16px; border-radius: 12px;
  background: #1d1d1f; color: #fff; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.3);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }
.skeleton { display: grid; gap: 12px; } .sk { height: 72px; border-radius: var(--r); background: linear-gradient(90deg, #e6e6ea 25%, #f0f0f3 50%, #e6e6ea 75%); background-size: 200% 100%; animation: sh 1.4s infinite; }
.sk-h { height: 32px; width: 40%; } .sk-s { height: 120px; }
@keyframes sh { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ----- Cetak ----- */
.print-only { display: none; }
@media print {
  .sidebar, .topbar, .backdrop, .no-print, .toast, .skip { display: none !important; }
  .app { display: block; } body { background: #fff; font-size: 11pt; }
  .wrap { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .print-only { display: block; margin-bottom: 12px; } .print-only h2 { font-size: 14pt; margin: 0; }
  .tbl th, .tbl td { border: 1px solid #000; padding: 4px 6px; } .tbl thead th { background: #ddd !important; }
  .badge { background: none !important; color: #000 !important; padding: 0; } .badge .ic { display: none; }
  @page { size: A4 landscape; margin: 12mm; }
}
