:root {
  /* Palet mengikuti mbbn.sch.id */
  --bg: #eef6fb;
  --surface: #ffffff;
  --surface-2: #f5fafd;
  --ink: #13263b;
  --ink-2: #3d5166;
  --ink-3: #56687c;
  --line: #d9e9f3;
  --brand: #0c3866;      /* navy */
  --brand-2: #1584c0;    /* blue-2 */
  --brand-soft: #e8f5fc; /* sky */
  --accent: #1f9ad6;     /* blue */
  --red: #c0392b;   --red-soft: #fbe9e7;
  --orange: #d9661f; --orange-soft: #fdeee3;
  --amber: #b7860b; --amber-soft: #fbf3dc;
  --blue: #1584c0;  --blue-soft: #e8f5fc;
  --green: #2f855a; --green-soft: #e3f3ea;
  --gray-soft: #edf3f8;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(12, 56, 102, .06), 0 6px 20px rgba(12, 56, 102, .07);
  --display: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  --nav-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); }
.boot { padding: 40vh 0; text-align: center; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 34px; height: 34px; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; }
.brand small { display: block; font-weight: 500; opacity: .75; font-size: 11px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; background: rgba(255,255,255,.12); border: 0; color: #fff; width: 40px; height: 40px;
  border-radius: 10px; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.2); }
.badge {
  position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--brand);
}
.user-chip { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.12); border: 0; color: #fff; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }

.layout { display: flex; max-width: 1180px; margin: 0 auto; }
.sidenav { display: none; }
main { flex: 1; min-width: 0; padding: 16px 16px calc(var(--nav-h) + 24px); }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: space-around; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.navlink { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink-3); font-size: 11.5px; font-weight: 600; }
.navlink svg { width: 22px; height: 22px; }
.navlink.active { color: var(--accent); }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 25;
  background: var(--accent); color: #fff; border: 0; border-radius: 16px; padding: 14px 18px; font-weight: 700;
  box-shadow: 0 8px 22px rgba(31,154,214,.4); cursor: pointer; display: flex; align-items: center; gap: 6px;
}
@media (min-width: 900px) {
  .bottomnav { display: none; }
  .sidenav { display: flex; flex-direction: column; gap: 4px; width: 220px; padding: 20px 12px; position: sticky; top: 60px; height: calc(100vh - 60px); }
  .sidenav .navlink { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14px; padding: 10px 14px; border-radius: 10px; }
  .sidenav .navlink.active { background: var(--brand-soft); color: var(--brand); }
  .sidenav .fab-side { margin-top: 12px; }
  main { padding: 24px 24px 40px; }
  .fab { display: none; }
}

/* ---------- Common ---------- */
h1, h2, .brand, .kpi .v { font-family: var(--display); }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.section { margin-bottom: 14px; }
.section > .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.section > .sec-body { padding: 12px 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--gray-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--gray-soft); color: var(--ink-2); white-space: nowrap; }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.brand { background: var(--brand-soft); color: var(--brand); }

.seg { display: inline-flex; background: var(--gray-soft); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=tel], input[type=date], input[type=url], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(31,154,214,.18); }
textarea { resize: vertical; min-height: 70px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.pin-input { letter-spacing: 8px; font-size: 22px !important; text-align: center; font-weight: 700; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--brand) 0%, #1584c0 55%, var(--bg) 55.1%); }
.auth .card { width: 100%; max-width: 380px; padding: 28px 24px; }
.auth .logo { width: 72px; height: 72px; border-radius: 50%; object-fit: contain; margin-bottom: 12px; }
.auth h1 { margin-bottom: 2px; }
.auth p { margin-top: 0; }
.err { color: var(--red); font-size: 13.5px; min-height: 18px; margin: 4px 0 10px; }

/* ---------- Task list ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar select { width: auto; min-width: 160px; }
.bucket { margin-bottom: 18px; }
.bucket-head { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; font-weight: 700; font-size: 14px; }
.bucket-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.bucket-head .count { color: var(--ink-3); font-weight: 600; }
.task-list { display: grid; gap: 8px; }
.task-card {
  display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); transition: transform .08s;
}
.task-card:hover { transform: translateY(-1px); }
.task-card .t-top { display: flex; align-items: flex-start; gap: 8px; }
.task-card .t-title { font-weight: 700; flex: 1; font-size: 15px; }
.task-card .t-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.task-card .t-meta .sep { color: var(--line); }
.progress { height: 6px; background: var(--gray-soft); border-radius: 4px; overflow: hidden; margin-top: 9px; }
.progress > i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.u-1_terlambat { border-left-color: var(--red); } .dot-1_terlambat { background: var(--red); }
.u-2_hari_ini { border-left-color: var(--orange); } .dot-2_hari_ini { background: var(--orange); }
.u-3_besok { border-left-color: var(--amber); } .dot-3_besok { background: var(--amber); }
.u-4_minggu_ini { border-left-color: var(--blue); } .dot-4_minggu_ini { background: var(--blue); }
.u-5_nanti { border-left-color: #b9c1cc; } .dot-5_nanti { background: #b9c1cc; }
.u-tutup { border-left-color: var(--green); opacity: .85; }
.empty { text-align: center; padding: 48px 16px; color: var(--ink-3); }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* ---------- Task detail ---------- */
.detail-head { padding: 18px; }
.detail-head h1 { font-size: 21px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 14px; }
.fact .k { font-size: 12px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.fact .v { font-weight: 600; margin-top: 2px; }
.banner { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.banner.invite { background: var(--amber-soft); border: 1px solid #ecd9a3; }
.banner.info { background: var(--brand-soft); border: 1px solid var(--line); }
.banner.done { background: var(--green-soft); border: 1px solid #bfe0cc; }
.desc { white-space: pre-wrap; }
.step { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.step:last-child { border-bottom: 0; }
.step .cb { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--green); flex: none; cursor: pointer; }
.step .s-body { flex: 1; min-width: 0; }
.step .s-text { font-weight: 600; }
.step.done .s-text { text-decoration: line-through; color: var(--ink-3); }
.step .s-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.step .s-note { margin-top: 6px; font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 6px 10px; color: var(--ink-2); }
.step.pending { background: var(--amber-soft); margin: 0 -16px; padding: 12px 16px; }
.step select { width: auto; padding: 3px 8px; font-size: 13px; border-radius: 8px; }
.member { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.member .m-name { flex: 1; font-weight: 600; }
.comment { display: flex; gap: 10px; padding: 10px 0; }
.comment .c-body { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; flex: 1; }
.comment .c-who { font-weight: 700; font-size: 13px; }
.history { font-size: 13.5px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.history:last-child { border-bottom: 0; }
.two-col { display: grid; gap: 14px; }
@media (min-width: 1000px) { .two-col { grid-template-columns: 1.6fr 1fr; align-items: start; } }

/* ---------- Form steps ---------- */
.step-row { display: grid; grid-template-columns: 1fr 150px 160px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 700px) { .step-row { grid-template-columns: 1fr 1fr 36px; } .step-row input[type=text] { grid-column: 1 / -1; } }
.weekday-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.weekday-pick label { border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: 13px; }
.weekday-pick input { display: none; }
.weekday-pick label:has(input:checked) { background: var(--brand); color: #fff; border-color: var(--brand); }
.people-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.people-pick label { border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13.5px; }
.people-pick input { display: none; }
.people-pick label:has(input:checked) { background: var(--brand-soft); border-color: var(--brand-2); color: var(--brand); font-weight: 600; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-3); background: var(--surface-2); }
td.num, th.num { text-align: right; }
tr.inactive td { color: var(--ink-3); }

/* ---------- Checklist ---------- */
.cl-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); align-items: start; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.cl-item input[type=checkbox] { width: 19px; height: 19px; accent-color: var(--green); }
.cl-item .txt { flex: 1; }
.cl-item.done .txt { text-decoration: line-through; color: var(--ink-3); }
.cl-add { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 28, 40, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
@media (min-width: 640px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
.modal h2 { font-size: 18px; margin-bottom: 12px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Red alert */
.alert-modal .modal { max-width: 640px; padding: 0; }
.alert-head { background: var(--red); color: #fff; padding: 18px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; }
.alert-head.calm { background: var(--brand); }
.alert-head h2 { margin: 0; font-size: 18px; }
.alert-body { padding: 8px 20px 20px; }
.alert-group { margin-top: 14px; }
.alert-group h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-3); margin: 0 0 6px; }
.alert-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.alert-item.red { border-color: #f1c5bf; background: var(--red-soft); }
.alert-item .ai-text { flex: 1; min-width: 180px; font-size: 14px; }
.alert-item a { font-weight: 700; color: var(--ink); }
.notif { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.notif:last-child { border-bottom: 0; }
.notif .when { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* Report */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { padding: 14px; }
.kpi .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 2px; }
.feed-item { font-size: 13.5px; padding: 8px 0; border-bottom: 1px dashed var(--line); }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--red); }

@media print {
  .topbar, .sidenav, .bottomnav, .fab, .no-print { display: none !important; }
  main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; }
  th, td { white-space: normal; }
}

/* Form inline (tambah step / link): satu baris di layar lebar, bertumpuk di HP */
.inline-form { display: grid; gap: 8px; margin-top: 10px; grid-template-columns: 1fr 150px 180px auto; }
.inline-form.propose { grid-template-columns: 1fr 150px auto; }
.inline-form.links { grid-template-columns: 1fr 180px auto; }
@media (max-width: 700px) {
  .inline-form, .inline-form.propose, .inline-form.links { grid-template-columns: 1fr 1fr; }
  .inline-form > input[type=text], .inline-form > input[type=url], .inline-form > .btn { grid-column: 1 / -1; }
  .inline-form.links > input[type=text] { grid-column: auto; }
  .inline-form.links > input[type=url] { grid-column: 1 / -1; }
  .inline-form.links > input[type=text], .inline-form.links > .btn { grid-column: span 1; }
}
@media (max-width: 480px) { .brand small { display: none; } .hide-sm { display: none; } }
