:root {
  --navy: #1c2f4a;
  --navy-2: #2a4466;
  --gold: #b8893b;
  --bg: #f4f3ef;
  --card: #ffffff;
  --ink: #1b1d21;
  --muted: #6b6f78;
  --line: #e4e1d9;
  --ok: #1e7a4f;
  --ok-soft: #e2f3ea;
  --warn: #a8660b;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe6e4;
  --info-soft: #e5edf7;
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--navy-2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 21px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- login ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--navy) 0%, #12233a 100%); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 28px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin: 0 auto 14px; }
.auth-card h1 { text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 6px 0 22px; font-size: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--navy-2); font-size: 13px; padding: 6px 8px; cursor: pointer; }
.lock-note { display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 12.5px; color: var(--muted); margin-top: 16px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100%; }
.sidebar { background: var(--navy); color: #e8edf5; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.sidebar .brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 18px; }
.sidebar .brand img { width: 34px; height: 34px; border-radius: 9px; }
.sidebar .brand b { font-size: 15px; line-height: 1.2; }
.nav-link { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: #c9d3e2; text-decoration: none; font-size: 14.5px; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: rgba(255,255,255,.13); color: #fff; font-weight: 600; }
.nav-link .ico { width: 22px; text-align: center; font-size: 17px; }
.nav-link .count { margin-left: auto; background: var(--gold); color: #fff; border-radius: 99px; font-size: 11.5px; padding: 1px 7px; font-weight: 700; }
.sidebar .spacer { flex: 1; }
.sidebar .me { padding: 10px 12px; font-size: 13px; color: #aab6c8; border-top: 1px solid rgba(255,255,255,.1); margin-top: 8px; }
.sidebar .me b { color: #fff; display: block; }

.main { min-width: 0; padding: 26px 30px 60px; max-width: 1180px; width: 100%; }
.topbar { display: none; }
.bottomnav { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 8px; }

@media (max-width: 860px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; }
  .topbar b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .icon-btn { color: #fff; border-color: rgba(255,255,255,.25); background: transparent; }
  .main { padding: 16px 14px calc(86px + var(--safe-bottom)); }
  .bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom)); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: 11px; padding: 4px 0; position: relative; }
  .bottomnav a .ico { font-size: 20px; line-height: 1.1; }
  .bottomnav a.active { color: var(--navy); font-weight: 700; }
  .bottomnav a .dot { position: absolute; top: 0; right: calc(50% - 20px); background: var(--bad); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; font-weight: 700; }
  h1 { font-size: 19px; }
}

/* ---------- komponen ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3.stats > :last-child { grid-column: span 2; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit; display: block; }
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; margin-top: 4px; word-break: break-word; }
.stat.warn .value { color: var(--warn); }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; padding: 9px 14px; border-radius: 10px; cursor: pointer; text-decoration: none; color: var(--ink); font-size: 14px; min-height: 40px; white-space: nowrap; }
.btn:hover { border-color: #c9c4b8; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--navy-2); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.lg { min-height: 48px; font-size: 15.5px; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: wait; }
.icon-btn { border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 40px; height: 40px; display: inline-grid; place-items: center; cursor: pointer; font-size: 18px; }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: #3a3d44; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input[type=text], input[type=password], input[type=tel], input[type=email], input[type=date], input[type=time], input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; font-weight: 400; min-height: 44px;
}
textarea { resize: vertical; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c7d5ea; border-color: var(--navy-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--navy); }

.search { position: relative; margin-bottom: 14px; }
.search input { padding-left: 38px; }
.search::before { content: "🔎"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { border: 1px solid var(--line); background: #fff; padding: 7px 14px; border-radius: 99px; text-decoration: none; color: var(--muted); font-size: 13.5px; white-space: nowrap; cursor: pointer; }
.tabs .active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; display: flex; gap: 12px; align-items: flex-start; text-decoration: none; color: inherit; }
a.item:hover { border-color: #cdc8bb; }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 600; font-size: 15px; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.item .meta span + span::before { content: " · "; }
.item .right { text-align: right; flex: none; }
.date-chip { flex: none; width: 52px; text-align: center; border-radius: 10px; background: var(--info-soft); color: var(--navy); padding: 6px 0; line-height: 1.1; }
.date-chip b { display: block; font-size: 19px; }
.date-chip small { font-size: 11px; text-transform: uppercase; }
.date-chip.today { background: var(--navy); color: #fff; }
.date-chip.past { background: #eee; color: var(--muted); }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #eceae4; color: #4a4d55; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--navy-2); }

.empty { text-align: center; color: var(--muted); padding: 26px 12px; font-size: 14px; }
.empty .ico { font-size: 30px; display: block; margin-bottom: 6px; }
.alert { padding: 11px 13px; border-radius: 10px; font-size: 14px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: #7a4a06; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.info { background: var(--info-soft); color: var(--navy); }

dl.info { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { dl.info { grid-template-columns: 1fr; gap: 2px; } dl.info dd { margin-bottom: 8px; } }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task input[type=checkbox] { width: 22px; height: 22px; margin-top: 1px; accent-color: var(--ok); flex: none; }
.task.done .title { text-decoration: line-through; color: var(--muted); }

.proof img { max-width: 100%; max-height: 360px; border-radius: 10px; border: 1px solid var(--line); display: block; }

/* ---------- modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 22, 33, .5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 600px) {
  .modal-back { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; animation: up .2s; }
  .modal-foot .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }

.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-bottom)); transform: translateX(-50%); background: #22262e; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 200; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
@media (min-width: 861px) { .toast { bottom: 28px; } }

.splash { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border: 3px solid #dfe4ec; border-top-color: var(--navy); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px 0; display: grid; place-items: center; }

.menu-list a, .menu-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-decoration: none; color: var(--ink); font-size: 15px; cursor: pointer; text-align: left; }
.menu-list a:last-child, .menu-list button:last-child { border-bottom: 0; }
.menu-list .ico { width: 26px; text-align: center; font-size: 19px; }

.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mt { margin-top: 14px; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
pre.wa { white-space: pre-wrap; background: #f5f8f3; border: 1px solid #dfe9dc; border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 6px 0 0; font-family: inherit; }
