/* 08 Foto – gaya app */
:root {
  --bg: #FFFFFF; --surface: #F4F5F3; --line: #E3E5E1; --line2: #D5D8D3;
  --ink: #161816; --muted: #5B605B; --ink2: #3D423D;
  --accent: #1F5C4A; --accent-dark: #163F33; --accent-soft: #E6EFEB; --accent-tint: #F0F6F3; --accent-light: #CFE2DA;
  --gold: #B08A3E; --gold-soft: #FFF4D6; --gold-ink: #7A5300;
  --warn-bg: #FFF8F3; --warn-line: #F2D3BE; --warn-soft: #FBEDE3; --warn-ink: #8F3E0C; --warn: #C2570F;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, -apple-system, sans-serif; font-size: 15px; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
h1, h2 { font-family: 'Plus Jakarta Sans', Inter, sans-serif; margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
.title { font-size: 22px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.block { display: block; }
.grow { flex: 1 1 auto; min-width: 0; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.upper { text-transform: uppercase; letter-spacing: .04em; font-size: 12px; font-weight: 600; color: var(--muted); }
.accent { color: var(--accent); }
.bad { color: var(--warn-ink); }
.gold { color: var(--gold-ink); }
.light { color: var(--accent-light); }
.pre { white-space: pre-line; line-height: 1.45; }
.big-num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 20px; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; }
.view { padding-bottom: calc(84px + var(--safe-b)); }
.view.print-mode { padding-bottom: 24px; }
.page { padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.page.center { min-height: 90vh; justify-content: center; text-align: center; }
.loading { padding: 60px 20px; text-align: center; color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 360px) { .grid2 { grid-template-columns: 1fr; } }
.actions { display: flex; flex-direction: column; gap: 10px; }

/* Header */
.topbar { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.topbar h1 { font-size: 20px; flex: 1; }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.hello { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.hello h1 { font-size: 22px; margin-top: 2px; }

/* Butang */
.btn { min-height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid #C9D9D2; background: #fff; color: var(--accent);
  font: 600 14px Inter, sans-serif; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.sm { min-height: 44px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: var(--warn-ink); border-color: var(--warn-line); }
.btn.dashed { border-style: dashed; border-color: #A9B8B1; }
.btn:disabled { opacity: .6; cursor: default; }
.iconbtn { width: 44px; height: 44px; flex: none; border-radius: 12px; border: none; background: transparent; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; }
.iconbtn.outline { border: 1px solid var(--line); color: var(--accent); }
.badge-dot { position: absolute; top: 8px; right: 9px; width: 9px; height: 9px; border-radius: 5px; background: var(--warn); border: 2px solid #fff; }

/* Borang */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; text-align: left; }
input, select, textarea { font: 15px Inter, sans-serif; color: var(--ink); background: #fff; border: 1px solid var(--line2); border-radius: 10px; min-height: 44px; padding: 10px 12px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 14px; margin: 0; }
legend { font-size: 13px; font-weight: 600; padding: 0 4px; }
.check { flex-direction: row; align-items: center; gap: 12px; min-height: 44px; font-size: 14px; font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); margin: 0; flex: none; }
.check input:checked + span { color: var(--muted); text-decoration: line-through; }
fieldset .check input:checked + span, .list .check input:checked + span { text-decoration: none; color: var(--ink); }
.inline { flex-direction: row; align-items: center; gap: 8px; }
.num { width: 64px; text-align: center; }

/* Kad */
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; background: #fff; color: var(--ink); text-decoration: none; display: block; }
a.card:hover { color: var(--ink); border-color: var(--line2); }
.card.stack { display: flex; flex-direction: column; gap: 10px; }
.card.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.card.list { padding: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.card.list .row { padding: 12px 14px; }
.card.list .row + .row { border-top: 1px solid var(--line); }
.row-main { flex: 1 1 auto; min-width: 0; }
.row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.event-card { display: flex; gap: 14px; align-items: center; background: var(--surface); border-color: var(--surface); }
.datebox { width: 46px; flex: none; display: flex; flex-direction: column; align-items: center; }
.datebox .small { font-size: 11px; font-weight: 600; }
.datebox .big { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 22px; font-weight: 700; }
.alert { display: flex; gap: 12px; align-items: flex-start; }
.alert .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--accent); margin-top: 6px; flex: none; }
.alert.urgent, .urgent-bg { background: var(--warn-bg); border-color: var(--warn-line); }
.alert.urgent .dot { background: var(--warn); }
.note { background: var(--gold-soft); border-color: var(--gold-soft); display: flex; flex-direction: column; gap: 4px; }
.empty { background: var(--surface); border-radius: var(--radius); padding: 18px 14px; color: var(--muted); font-size: 14px; }
.empty.err { background: var(--warn-bg); color: var(--warn-ink); }
.sec-head { display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
.sec-head a { font-size: 13px; font-weight: 600; text-decoration: none; padding: 12px 0; }
.lockline { display: flex; gap: 8px; align-items: center; }

.hero { background: var(--accent); border-color: var(--accent); color: #fff; display: flex; flex-direction: column; gap: 6px; padding: 18px; }
a.hero:hover { color: #fff; }
.hero-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 19px; font-weight: 700; }
.hero-num { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 30px; font-weight: 700; }
.hero-foot { margin-top: 6px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.12); border-radius: 10px; padding: 8px 10px; }
.hero-split { display: flex; gap: 24px; margin-top: 6px; font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); }
.stat b { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.stat.warn { background: var(--warn-soft); }
.stat.warn b, .stat.warn span { color: var(--warn-ink); }

/* Tag */
.tag { flex: none; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; display: inline-block; }
.tag-ok { background: var(--accent-soft); color: var(--accent); }
.tag-gold { background: var(--gold-soft); color: var(--gold-ink); }
.tag-warn { background: var(--warn-soft); color: var(--warn-ink); }
.tag-bad { background: var(--warn-soft); color: var(--warn-ink); }
.tag-mute { background: var(--surface); color: var(--ink2); }

/* Bar kemajuan */
.bar { display: block; height: 6px; border-radius: 3px; background: #EEF0EC; overflow: hidden; }
.bar > * { display: block; height: 6px; border-radius: 3px; background: var(--accent); }
.bar.deposit > * { background: var(--gold); }
.bar.lewat > *, .bar.belum > * { background: var(--warn); }

/* Pil / tab */
.pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.pill { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); display: inline-flex; align-items: center; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Kalendar */
.cal { padding: 12px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-grid.dow span { text-align: center; font-size: 11px; font-weight: 600; color: var(--muted); padding: 6px 0; }
.day { height: 46px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--ink); font-size: 14px; }
.day.today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 600; }
.day.sel { background: var(--accent); color: #fff; font-weight: 600; }
.ddot { width: 5px; height: 5px; border-radius: 3px; }
.ddot.on { background: var(--gold); }
.ddot.warn { background: var(--warn); }
.day.sel .ddot.on, .day.sel .ddot.warn { background: #fff; }

/* Editing */
.job { display: flex; flex-direction: column; gap: 12px; }
.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.step { display: flex; flex-direction: column; gap: 5px; font-size: 11px; text-align: center; color: var(--muted); }
.step div { height: 6px; border-radius: 3px; background: var(--line); }
.step.done div { background: var(--accent); }
.step.cur div { background: var(--gold); }
.step.done, .step.cur { color: var(--ink); }
.step.cur { font-weight: 600; }

/* Invois */
.choice { width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; font: 14px Inter, sans-serif; color: var(--ink); cursor: pointer; }
.choice.on { border: 2px solid var(--accent); background: var(--accent-tint); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line2); background: #fff; font: 600 13px Inter, sans-serif; color: var(--ink); cursor: pointer; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 44px; gap: 8px; align-items: center; }
.sumbar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 -4px 16px rgba(0,0,0,.05); }
.total { border-top: 1px solid var(--line); padding-top: 8px; }
.grid-pkg { display: grid; grid-template-columns: minmax(0, 1fr) 100px; gap: 8px; }
.pkg { display: flex; flex-direction: column; gap: 8px; }

/* Menu bawah */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); display: grid; padding: 6px 8px calc(10px + var(--safe-b)); z-index: 10; max-width: 560px; margin: 0 auto; }
.tabbar a { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; }
.tabbar a.on { color: var(--accent); font-weight: 600; }

/* Log masuk */
.login { gap: 14px; max-width: 380px; margin: 0 auto; }
.login form { text-align: left; margin-top: 8px; }
.logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 16px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font: 700 22px 'Plus Jakarta Sans', sans-serif; }
.logo.sm { width: 42px; height: 42px; border-radius: 10px; font-size: 15px; margin: 0; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.err { background: var(--warn-ink); }

/* Dokumen invois/resit */
.doc-toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); z-index: 5; }
.doc-tip { padding: 0 16px; }
.doc { margin: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 26px 22px; display: flex; flex-direction: column; gap: 18px; font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.doc-brand { display: flex; gap: 10px; align-items: center; }
.doc-biz { font: 700 16px 'Plus Jakarta Sans', sans-serif; }
.doc-meta { text-align: right; }
.doc-title { font: 700 18px 'Plus Jakarta Sans', sans-serif; color: var(--accent); }
.doc-small { font-size: 11px; color: var(--muted); }
.doc-label { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.doc-strong { font-size: 15px; font-weight: 600; }
.doc-sec div + div { margin-top: 2px; }
.doc-table { width: 100%; border-collapse: collapse; }
.doc-table th { text-align: left; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 0; }
.doc-table td { padding: 8px 0; border-bottom: 1px solid #F0F1EE; }
.doc-table th:last-child, .doc-table td:last-child { text-align: right; }
.doc-table tfoot td { font-size: 15px; font-weight: 700; border-bottom: none; padding-top: 12px; }
.doc-box { background: var(--accent-tint); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.doc-box.big { font-size: 14px; }
.doc-row { display: flex; justify-content: space-between; gap: 10px; }
.doc-row > span:last-child { white-space: nowrap; text-align: right; }
.doc-foot { font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; }

@media print {
  @page { size: A4; margin: 16mm; }
  .no-print, .tabbar, .toast { display: none !important; }
  body, #app { max-width: none; }
  .doc { border: none; margin: 0; padding: 0; font-size: 12pt; }
  .doc-small, .doc-label, .doc-foot { font-size: 10pt; }
  .doc-box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .logo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
