:root {
  --maroon-900: #4a0a10;
  --maroon-800: #6b0f18;
  --maroon-700: #8b1520;
  --maroon-600: #a31d2a;
  --gold-400: #f2cf74;
  --gold-500: #e3b64f;
  --gold-600: #c99a2e;
  --bg: #f7f3ef;
  --card: #ffffff;
  --text: #2a1d1f;
  --muted: #7a6a6c;
  --line: #ecdfd8;
  --ok: #1d7a46;
  --ok-bg: #e4f5ea;
  --warn: #9a6400;
  --warn-bg: #fff3d9;
  --bad: #b3261e;
  --bad-bg: #fde7e5;
  --info: #1f5fa8;
  --info-bg: #e5effb;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(74, 10, 16, 0.06), 0 6px 20px rgba(74, 10, 16, 0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--maroon-700); }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ---------- header */
.top {
  background: radial-gradient(120% 140% at 0% 0%, var(--maroon-600), var(--maroon-800) 55%, var(--maroon-900));
  color: #fff;
  padding: 18px 24px 20px;
  border-bottom: 3px solid var(--gold-500);
}
.top-inner { max-width: 1320px; margin: 0 auto; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.brand { display: flex; gap: 14px; align-items: center; flex: 1; min-width: 260px; }
.brand .logo {
  width: 56px; height: 56px; border-radius: 14px; background: #fff; display: grid; place-items: center;
  overflow: hidden; flex-shrink: 0; font-size: 28px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.brand .logo img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.brand h1 { margin: 0; font-size: 22px; letter-spacing: .5px; font-weight: 800; }
.brand .sub { color: var(--gold-400); font-size: 12px; letter-spacing: .6px; text-transform: uppercase; }
.brand .inst { font-size: 12px; opacity: .85; }
.clock {
  border: 1px solid rgba(242, 207, 116, .45); border-radius: 12px; padding: 8px 18px; text-align: center;
  background: rgba(0,0,0,.15);
}
.clock b { display: block; color: var(--gold-400); font-size: 22px; letter-spacing: 1px; }
.clock span { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.usercard {
  display: flex; gap: 10px; align-items: center; border: 1px solid rgba(242, 207, 116, .45); border-radius: 12px;
  padding: 8px 12px; background: rgba(0,0,0,.15); cursor: pointer; position: relative;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--gold-500); color: var(--maroon-900);
  display: grid; place-items: center; font-weight: 800;
}
.avatar.foto { overflow: hidden; background: #fff; box-shadow: 0 0 0 2px var(--gold-500); }
.avatar.foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-profil { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.foto-profil .avatar { width: 96px; height: 96px; font-size: 40px; }
.usercard .nm { font-weight: 700; }
.usercard .rl { font-size: 12px; opacity: .85; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--text); border-radius: 12px;
  box-shadow: var(--shadow); min-width: 220px; padding: 6px; z-index: 50; border: 1px solid var(--line);
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; border: 0; background: none;
  text-decoration: none; color: var(--text); cursor: pointer;
}
.menu a:hover, .menu button:hover { background: var(--bg); }

/* ---------- nav */
.nav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
/* semua menu selalu terlihat: melipat ke baris berikutnya bila tidak muat */
.nav-inner { max-width: 1320px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 2px; padding: 0 16px; }
.nav a {
  padding: 12px 11px; font-size: 14px; gap: 6px !important; text-decoration: none; color: var(--text); font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; display: flex; gap: 8px; align-items: center;
}
.nav a:hover { background: var(--bg); }
.nav a.active { color: var(--maroon-700); border-bottom-color: var(--gold-500); background: #fdf8f2; }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px;
  background: var(--maroon-700); color: #fff; font-size: 12px; font-weight: 700;
}

main { max-width: 1320px; margin: 0 auto; padding: 20px 16px 60px; }
.page-title { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title h2 { margin: 0; font-size: 22px; }
.page-title p { margin: 2px 0 0; color: var(--muted); }

/* ---------- cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 18px; }
.card h3 { margin: 0 0 12px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); }
.stat { display: flex; gap: 14px; }
.stat .ic { width: 46px; height: 46px; border-radius: 12px; background: #fbefe3; display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.stat .lb { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; }
.stat .val { font-size: 24px; font-weight: 800; margin: 2px 0; }
.stat .ds { font-size: 12px; color: var(--muted); }
.neg { color: var(--bad); }
.pos { color: var(--ok); }

.hero {
  background: radial-gradient(120% 140% at 100% 0%, var(--maroon-600), var(--maroon-800) 55%, var(--maroon-900));
  color: #fff; border-radius: var(--radius); padding: 24px 28px; display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
}
.hero h2 { margin: 0 0 4px; font-size: 26px; }
.hero .clock b { font-size: 30px; }

.reminder {
  border: 1.5px dashed var(--gold-600); background: #fffaf0; border-radius: var(--radius); padding: 14px 18px;
}
.reminder b { color: var(--maroon-800); }

/* ---------- buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--maroon-800);
  transition: background .15s, transform .05s;
}
.btn:hover { background: #fbf4ee; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--maroon-700); border-color: var(--maroon-700); color: #fff; }
.btn.primary:hover { background: var(--maroon-800); }
.btn.gold { background: linear-gradient(180deg, var(--gold-400), var(--gold-500)); border-color: var(--gold-600); color: var(--maroon-900); }
.btn.danger { color: var(--bad); border-color: #f2c4c0; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.icon-btn { border: 0; background: none; cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); }

/* ---------- forms */
label.f { display: block; }
label.f > span { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .3px; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=email], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid #dccbc3; border-radius: 10px; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--maroon-600); box-shadow: 0 0 0 3px rgba(163, 29, 42, .12); }
input[readonly] { background: var(--bg); }
textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; }
legend { font-weight: 700; color: var(--maroon-800); padding: 0 6px; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }

/* ---------- table */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { background: #fbf4ee; text-align: left; padding: 10px 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--maroon-800); white-space: nowrap; }
table.t td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.t tr:hover td { background: #fffaf6; }
.temuan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 18px; font-size: 13px; margin: 8px 0; }
.temuan-grid p { margin: 2px 0 6px; }
.temuan-grid b { color: var(--maroon-800); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.sbm-info table.t td { padding: 6px 10px; font-size: 12.5px; }
.sbm-note { margin-top: 4px; padding: 6px 10px; border-radius: 8px; background: var(--warn-bg); color: #6b4a00; }
#up-form table.t td { vertical-align: middle; padding: 6px 12px; }
#up-form table.t input { padding: 6px 10px; }
/* tabel rekap: muat tanpa digeser di layar laptop */
table.t.rekap { table-layout: fixed; }
table.t.rekap td { word-break: normal; overflow-wrap: anywhere; }
table.t.rekap .tt { font-weight: 600; line-height: 1.35; }
table.t.rekap .brk { overflow-wrap: anywhere; }
table.t.rekap .aksi { display: grid; grid-template-columns: repeat(3, 32px); gap: 2px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.gray { background: #f0eae6; color: var(--muted); }
.bar { height: 8px; background: #f0e6df; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--maroon-600)); }
.bar.ok > i { background: var(--ok); }

.filters { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; }
a.chip { text-decoration: none; color: var(--text); display: inline-block; }
.chip.active { background: var(--maroon-700); color: #fff; border-color: var(--maroon-700); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.todo { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.todo:first-child { border-top: 0; }
.todo .tt { font-weight: 600; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- modal */
.modal-back { position: fixed; inset: 0; background: rgba(40, 10, 14, .55); z-index: 100; display: flex; justify-content: center; align-items: flex-start; padding: 30px 12px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 980px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.sm { max-width: 480px; }
.modal.modal-kunci { animation: modal-kunci .35s ease; }
@keyframes modal-kunci { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.modal-h { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-h h3 { margin: 0; flex: 1; font-size: 18px; }
.modal-b { padding: 20px; }
.modal-f { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.pegawai-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pegawai-list label { display: flex; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.pegawai-list label:first-child { border-top: 0; }
.pegawai-list label:hover { background: var(--bg); }
.hotel-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 8px; }
/* uang harian per hari: FULLDAY / FULLBOARD / HALFDAY */
.uh-box { border: 1px dashed #e3cfc4; border-radius: 12px; padding: 12px; background: #fffaf6; }
.uh-box > span, .f > span:first-child:not(.pill) { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .3px; }
.uh-pola { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; font-weight: 600; font-size: 14px; }
.uh-hari { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.uh-day { display: block; border: 1px solid var(--line); border-left: 4px solid var(--maroon-600); border-radius: 10px; padding: 6px 8px; background: #fff; }
.uh-day > span { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.uh-day select { padding: 6px 8px; font-weight: 700; }
.uh-day.uh-fullday { border-left-color: #c98a00; }
.uh-day.uh-fullboard { border-left-color: var(--info); }
.uh-day.uh-halfday { border-left-color: var(--ok); }
.uh-day.uh-diklat { border-left-color: #7a4bb3; }
#durasi.salah { border-color: var(--bad); color: var(--bad); font-weight: 700; background: var(--bad-bg); }
.sbm-note-err:empty { display: none; }
.sbm-note-err { padding: 8px 12px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: 13px; }
.status-auto { min-height: 38px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.status-auto .pill { font-size: 13px; padding: 5px 12px; }
.sum-box { background: #fbf4ee; border-radius: 12px; padding: 14px; display: grid; gap: 4px; }
.sum-box .ln { display: flex; justify-content: space-between; gap: 12px; }
.sum-box .ln > b { white-space: nowrap; }
.sum-box .tot { font-weight: 800; font-size: 16px; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px; }

.gen-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: linear-gradient(90deg, #fff8e8, #fdf1ef); border: 1px solid #f0dcc0; border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; }
.gen-head { display: flex; gap: 6px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.gen-head > span { flex: 1; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.icon-btn:disabled { opacity: .35; cursor: default; }
textarea.flash { animation: flash 1s ease; }
@keyframes flash { from { background: #fff4d6; } to { background: #fff; } }
.berkas-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.berkas-item.done { border-color: #b9e2c7; background: #f6fcf8; }
.berkas-item.need { border-color: #f2c4c0; }
.berkas-file { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.dropzone { border: 2px dashed #dccbc3; border-radius: 10px; padding: 10px; text-align: center; color: var(--muted); cursor: pointer; font-size: 13px; }
.dropzone.drag { border-color: var(--maroon-600); background: #fff6f3; }
.progress { height: 6px; background: #f0e6df; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--maroon-600); transition: width .1s; }

/* ---------- calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.cal .dh { background: #fbf4ee; padding: 8px; font-weight: 700; font-size: 12px; text-align: center; color: var(--maroon-800); }
.cal .d { min-height: 104px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); padding: 6px; font-size: 12px; }
.cal .d:nth-child(7n+1) { border-left: 0; }
.cal .d.out { background: #faf7f5; color: #bbb; }
.cal .d.today { background: #fff8e8; }
.cal .d .n { font-weight: 700; }
.cal .d.libur .n, .cal .d.sun .n { color: var(--bad); }
.cal .ev { display: block; margin-top: 3px; padding: 2px 6px; border-radius: 6px; background: var(--maroon-700); color: #fff; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal .ev.k2 { background: #1f5fa8; }
.cal .ev.k3 { background: #1d7a46; }
.cal .lib { display: block; color: var(--bad); font-size: 11px; }
/* acara kantor & pakaian dinas */
.cal .d { cursor: pointer; transition: background .15s; }
.cal .d:hover { background: #fffaf3; }
.cal .d.d17 .n { color: #b7791f; }
.cal .lib.cuti { color: #b26a00; }
/* pencarian arsip bahasa sehari-hari */
.cari-arsip { background: linear-gradient(135deg, #fffaf2, #fff); border: 1px solid #f1dfb5; }
.cari-bar { display: flex; gap: 8px; }
.cari-bar input { flex: 1; font-size: 16px !important; padding: 12px 14px !important; border-radius: 12px !important; }
.cari-contoh { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.chip-contoh { border: 1px dashed #d9b87a; background: #fffdf8; color: #7a4f00; border-radius: 999px; padding: 4px 11px; font-size: 12px; cursor: pointer; transition: background .2s, transform .2s; }
.chip-contoh:hover { background: #fff3d9; transform: translateY(-1px); }
.cari-tafsir { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cari-item { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-top: 10px; cursor: pointer; background: #fff; transition: transform .2s, box-shadow .2s, border-color .2s; }
.cari-item:hover { transform: translateY(-2px); border-color: #e9cf8f; box-shadow: 0 12px 22px -14px rgba(74, 10, 16, .4); }
.cari-cuplik { margin-top: 6px; font-size: 13px; color: #4b3b3d; background: #fbf7f3; border-radius: 10px; padding: 8px 10px; line-height: 1.5; }
.cari-item mark, .cari-cuplik mark { background: #ffe39a; color: inherit; border-radius: 3px; padding: 0 2px; }
.berkas-link { text-decoration: none; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.grup-banner { padding: 10px 12px; border-radius: 10px; background: #eef5ff; border: 1px solid #c9dcf5; color: #1f3f6b; font-size: 13px; line-height: 1.5; }
select.terkunci { pointer-events: none; background: #f4efea; }
input[readonly], textarea[readonly] { background: #f7f3ef; }
.cal .d.libur { background: #fff5f4; }
/* tanggal hari ini: dilingkari merah */
.cal .d.today .n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #d32f2f; color: #fff !important;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, .22); font-weight: 800; }
@media (max-width: 900px) { .cal .d.today .n { width: 22px; height: 22px; font-size: 11px; } }
.cal .ev.acara { background: linear-gradient(90deg, #c98a1d, #b7791f); color: #fff; font-weight: 600; }
.cal .pk { display: block; font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.hari-ini { display: grid; grid-template-columns: minmax(220px, 1fr) 2fr; gap: 14px; align-items: center;
  background: linear-gradient(135deg, #fff8e8, #fff); border: 1px solid #f1dfb5; }
.hari-ini .hi-teks { font-size: 20px; font-weight: 800; color: var(--maroon-800); margin: 2px 0; }
.hari-ini .hi-ac { border-left: 3px solid #e3b64f; padding-left: 14px; display: grid; gap: 6px; }
.hari-ini .hi-item { cursor: pointer; }
.pakaian-chip { display: inline-block; padding: 4px 10px; border-radius: 999px; background: #fff3d9; color: #7a4f00; font-weight: 600; }
.pakaian-chip.sm { font-size: 11px; padding: 2px 8px; margin-top: 4px; }
.agenda.semua { display: block; }
.agenda .tgl-box.acara { background: #fff3d9; color: #9a6400; }
.dash-pk { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.dash-pk .ic { font-size: 30px; }

.hbar { display: grid; grid-template-columns: 110px 1fr 140px; gap: 10px; align-items: center; padding: 5px 0; font-size: 13px; }

/* ---------- toast */
#toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; }
.toast { background: #2a1d1f; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); max-width: 360px; animation: up .2s ease; }
.toast.err { background: var(--bad); }
.toast.ok { background: var(--ok); }
@keyframes up { from { transform: translateY(10px); opacity: 0; } }

/* ---------- login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 120% at 0% 0%, var(--maroon-600), var(--maroon-800) 50%, var(--maroon-900)); }
.auth .box { background: #fff; border-radius: 20px; padding: 32px; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.auth .logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 12px; background: #fbefe3; display: grid; place-items: center; font-size: 36px; overflow: hidden; }
.auth .logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.auth h1 { text-align: center; margin: 0; color: var(--maroon-800); }
.auth .sub { text-align: center; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 20px; }
.err-box { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; }

.panduan h4 { margin: 18px 0 6px; color: var(--maroon-800); }
.panduan ol, .panduan ul { padding-left: 20px; }
code { background: #f3ebe6; padding: 1px 6px; border-radius: 6px; font-size: 12px; }

/* ---------- navigasi bawah (hanya HP) */
.bnav, .only-mobile, .agenda { display: none; }
.agenda .todo { cursor: pointer; }
.agenda .tgl-box { width: 46px; flex-shrink: 0; text-align: center; border-radius: 10px; background: #fbf4ee; padding: 4px 0; font-weight: 800; color: var(--maroon-700); line-height: 1.1; }
.agenda .tgl-box small { display: block; font-size: 10px; font-weight: 600; color: var(--muted); }
.pill.k1k { background: #fbe4e6; color: var(--maroon-700); }
.pill.k2k { background: var(--info-bg); color: var(--info); }
.pill.k3k { background: var(--ok-bg); color: var(--ok); }

/* ================================================================ TAMPILAN HP */
@media (max-width: 900px) {
  :root { --radius: 16px; }
  body { font-size: 15px; padding-bottom: calc(78px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
  .only-mobile { display: inline-flex; }

  /* header ringkas & lengket */
  .top { padding: 10px 14px calc(10px); position: sticky; top: 0; z-index: 30; border-bottom-width: 2px; box-shadow: 0 4px 18px rgba(74,10,16,.25); }
  .top-inner { flex-wrap: nowrap; gap: 10px; }
  .brand { min-width: 0; gap: 10px; }
  .brand .logo { width: 40px; height: 40px; border-radius: 11px; font-size: 20px; }
  .brand h1 { font-size: 18px; }
  .brand .sub { display: none; }
  .brand .inst { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
  .clock.hdr, #btn-new, #btn-pasang, .usercard .nm, .usercard .rl { display: none !important; }
  .usercard { padding: 4px; border-radius: 50%; background: rgba(255,255,255,.08); }
  .usercard .avatar { width: 36px; height: 36px; }
  .nav { display: none; }

  .bnav {
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255,255,255,.96); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgba(74,10,16,.08);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bnav a, .bnav button[data-bn] {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border: 0; background: none;
    font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; position: relative; cursor: pointer; border-radius: 12px;
  }
  .bnav .bi { font-size: 21px; line-height: 1; filter: grayscale(.6); transition: transform .15s; }
  .bnav .active { color: var(--maroon-700); }
  .bnav .active .bi { filter: none; transform: translateY(-1px) scale(1.08); }
  .bnav .active::after { content: ''; position: absolute; top: -6px; width: 24px; height: 3px; border-radius: 3px; background: var(--gold-500); }
  .bnav-fab {
    justify-self: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%; border: 4px solid #fff;
    background: radial-gradient(circle at 30% 30%, var(--maroon-600), var(--maroon-800)); color: #fff; font-size: 30px; line-height: 1;
    box-shadow: 0 8px 20px rgba(139,21,32,.45); cursor: pointer; transition: transform .1s;
  }
  .bnav-fab:active { transform: scale(.94); }
  .bdot { position: absolute; top: 4px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); border: 2px solid #fff; }

  /* konten */
  main { padding: 14px 12px 24px; }
  .stack > * + * { margin-top: 10px; }
  .page-title { margin-bottom: 12px; }
  .page-title h2 { font-size: 20px; }
  .page-title p { font-size: 13px; }
  .hide-mobile { display: none !important; }
  .page-title { gap: 8px; align-items: center; }
  .page-title > .grow { flex: 1 1 100%; }
  .page-title > .btn { min-height: 38px; padding: 6px 12px; }
  .page-title > b { flex: 1; text-align: center; min-width: 0 !important; }
  .agenda { display: block !important; }
  .card { padding: 14px; border-radius: var(--radius); }
  .grid { gap: 10px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat { align-items: center; }
  /* kartu statistik: carousel geser */
  .grid-3:has(> .stat) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -12px; padding: 2px 12px 6px; scrollbar-width: none; }
  .grid-3:has(> .stat)::-webkit-scrollbar { display: none; }
  .grid-3:has(> .stat) > .stat { flex: 0 0 84%; scroll-snap-align: center; }
  .stat .val { font-size: 21px; }
  .hero { padding: 18px; border-radius: 18px; gap: 10px; }
  .hero h2 { font-size: 20px; }
  .hero .clock { display: none; }
  .reminder { padding: 12px 14px; }
  .btn { min-height: 40px; }
  .btn.sm { min-height: 34px; }
  input[type=text], input[type=password], input[type=date], input[type=time], input[type=email], input[type=number], input[type=search], input[type=tel], select, textarea { font-size: 16px; padding: 11px 12px; } /* 16px: cegah zoom otomatis iOS */
  .form-grid { grid-template-columns: 1fr; }
  .hotel-row { grid-template-columns: 1fr 1fr; }
  .hotel-row .f:first-child { grid-column: 1 / -1; }
  .hbar { grid-template-columns: 78px 1fr 92px; font-size: 12px; }

  /* filter dapat dilipat & chip bergeser */
  .filters { display: none; grid-template-columns: 1fr 1fr; }
  .filters.open { display: grid; animation: turun .18s ease; }
  #f-toggle { min-width: 52px; justify-content: center; }
  #f-count:not(:empty) { background: var(--maroon-700); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 12px; margin-left: 4px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 2px 4px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { white-space: nowrap; }
  .card > .row:has(#btn-csv) { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .card > .row:has(#btn-csv) #chips { grid-column: 1 / -1; }
  .card > .row:has(#btn-csv) .btn.sm { justify-content: center; font-size: 12px; padding: 6px 4px; }

  /* kartu perjalanan */
  .tcards { display: grid; gap: 12px; }
  .tcard { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 2px 10px rgba(74,10,16,.06); cursor: pointer; transition: transform .1s; }
  .tcard:active { transform: scale(.99); }
  .tcard h4 { margin: 8px 0 4px; font-size: 15.5px; line-height: 1.35; }
  .tc-top { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
  .tc-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
  .tc-uang { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; background: #fbf4ee; border-radius: 12px; padding: 8px; }
  .tc-uang div { display: flex; flex-direction: column; }
  .tc-uang span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
  .tc-uang b { font-size: 13px; }
  .tc-arsip { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
  .tc-arsip .bar { flex: 1; }
  .tc-act { display: grid; grid-template-columns: 1fr 1fr 48px 48px; gap: 6px; margin-top: 10px; }
  .tc-act .btn { justify-content: center; }
  .pager { justify-content: center; }
  .pager span { order: -1; width: 100%; text-align: center; }

  /* tabel umum → kartu berlabel */
  .table-wrap:has(table.t:not(.rekap)) { border: 0; background: none; overflow: visible; }
  table.t:not(.rekap) thead { display: none; }
  table.t:not(.rekap), table.t:not(.rekap) tbody { display: block; }
  table.t:not(.rekap) tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; margin-bottom: 10px; box-shadow: 0 1px 6px rgba(74,10,16,.05); }
  table.t:not(.rekap) td { display: block; border: 0; padding: 6px 0; text-align: right; overflow-wrap: anywhere; min-height: 30px; }
  table.t:not(.rekap) td::after { content: ''; display: block; clear: both; }
  table.t:not(.rekap) td + td { border-top: 1px dashed var(--line); }
  table.t:not(.rekap) td::before { content: attr(data-label); float: left; width: 38%; padding-right: 8px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); padding-top: 2px; }
  table.t:not(.rekap) td:not([data-label])::before, table.t:not(.rekap) td[data-label=""]::before { display: none; }
  table.t:not(.rekap) td .pill { white-space: normal; margin: 2px 0 2px 4px !important; }
  table.t:not(.rekap) td .bar { margin-left: 40%; }
  table.t:not(.rekap) td .row { justify-content: flex-end; }
  table.t:not(.rekap) tr:hover td { background: none; }
  table.t td input { max-width: 140px; }
  .sbm-info table.t td { font-size: 13px; }

  /* modal = lembar layar penuh / bottom sheet */
  .modal-back { padding: 0; align-items: flex-end; }
  .modal, .modal.sm { max-width: none; border-radius: 22px 22px 0 0; max-height: 96dvh; display: flex; flex-direction: column; animation: naik .22s cubic-bezier(.2,.8,.2,1); }
  .modal:not(.sm):not(.sheet) { min-height: 96dvh; }
  .modal-h { position: sticky; top: 0; background: #fff; border-radius: 22px 22px 0 0; z-index: 2; padding: 14px 16px 12px; }
  .modal-h::before { content: ''; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: #e2d4cc; }
  .modal-h h3 { font-size: 17px; }
  .modal-b { padding: 14px 14px 18px; overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
  .modal-f { position: sticky; bottom: 0; background: #fff; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: 8px; box-shadow: 0 -6px 16px rgba(0,0,0,.05); }
  .modal-f .btn { justify-content: center; }
  .modal-f .btn.primary:last-child { grid-column: 1 / -1; }
  .modal-f:has(> .btn:nth-child(4)) { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .modal-f:has(> .btn:nth-child(4)) .btn { min-height: 38px; font-size: 13px; padding: 6px 4px; }
  .modal-f:has(> .btn:nth-child(4)) .btn.primary:last-child { grid-column: span 2; }
  .modal-f:has(> .btn:nth-child(2):last-child) { grid-template-columns: 1fr 2fr; }
  .modal-f:has(> .btn:nth-child(2):last-child) .btn.primary:last-child { grid-column: auto; }
  fieldset { padding: 12px; }
  .gen-head > span { flex-basis: 100%; }
  .berkas-item .btn-kamera { width: 100%; justify-content: center; min-height: 44px; font-size: 15px; }

  /* lembar menu */
  .modal.sheet .modal-b { padding: 4px 8px 12px; }
  .sheet-grup { font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }
  .sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 10px; border-radius: 12px; border: 0; background: none; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px; text-align: left; cursor: pointer; }
  .sheet-item .si { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: #fbf4ee; font-size: 18px; }
  .sheet-item.active { background: #fff6ec; color: var(--maroon-700); }
  .sheet-item.danger { color: var(--bad); }
  .sheet-item:active { background: var(--bg); }

  /* kalender ringkas */
  .cal .dh { padding: 6px 2px; font-size: 10px; }
  .cal .d { min-height: 54px; padding: 3px; font-size: 11px; }
  .cal .ev { font-size: 0; height: 6px; padding: 0; margin-top: 2px; border-radius: 3px; }
  .cal .lib { font-size: 0; height: 4px; background: var(--bad); border-radius: 2px; margin-top: 2px; }
  .cal .pk { display: none; }
  .hari-ini { grid-template-columns: 1fr; }
  .hari-ini .hi-ac { border-left: 0; border-top: 1px dashed #e9cf8f; padding: 10px 0 0; }
  .temuan-grid { grid-template-columns: 1fr; }

  #toast-root { left: 12px; right: 12px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  .auth .box { padding: 24px 20px; border-radius: 20px; }
}
@keyframes naik { from { transform: translateY(40px); opacity: .4; } }
@keyframes turun { from { transform: translateY(-6px); opacity: 0; } }
@media (max-width: 380px) {
  .filters { grid-template-columns: 1fr; }
}
@media print {
  .top, .nav, .no-print { display: none !important; }
}
