/* Tema kayu cerah: krem, oak, walnut, aksen hijau lembut */
:root {
  --cream: #FBF6EC; --paper: #FFFFFF; --sand: #F1E9DC; --oak: #C89F6D; --oak-dark: #A67C47;
  --walnut: #5C3D2E; --text: #2E221B; --muted: #6B5A4E; --green: #4E7A52; --green-soft: #DDEBDC;
  --warn: #9A4A12; --warn-soft: #F8E3CF; --danger: #A12B2B; --line: #E2D5C1; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--cream); -webkit-text-size-adjust: 100%; }
#app { min-height: 100%; display: flex; flex-direction: column; width: 100%; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; color: var(--walnut); }
h2 { font-size: 1.1rem; margin: 1rem 0 .5rem; color: var(--walnut); }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.boot { padding: 2rem; text-align: center; color: var(--muted); }

header { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between;
  padding: .6rem max(1rem, env(safe-area-inset-right)) .6rem max(1rem, env(safe-area-inset-left));
  background: var(--walnut); color: #fff; }
header .brand strong { font-size: 1.05rem; }
.brand { display: flex; align-items: center; gap: .6rem; }
.logo { border-radius: 10px; background: var(--cream); object-fit: contain; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; background: var(--sand); color: var(--text); white-space: nowrap; }
.chip.ok { background: var(--green-soft); color: #23492A; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }

.layout { flex: 1; display: flex; width: 100%; min-height: 0; }
nav { display: flex; flex-direction: column; gap: .2rem; padding: .75rem .5rem; width: 220px; flex: none; background: var(--sand); border-right: 1px solid var(--line); }
nav a { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border-radius: 10px; color: var(--text); text-decoration: none; }
nav a.on { background: var(--oak); color: #1F1610; font-weight: 600; }
nav a:hover { background: var(--line); }
nav .ico { width: 1.4rem; text-align: center; font-size: 1.1rem; }
main { flex: 1; min-width: 0; padding: 1rem max(1rem, env(safe-area-inset-right)) 2rem max(1rem, env(safe-area-inset-left)); }
footer { padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); font-size: .8rem; color: var(--muted); text-align: center; border-top: 1px solid var(--line); background: var(--cream); }

.center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; gap: 1rem; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; box-shadow: 0 1px 2px rgba(92, 61, 46, .06); }
.card.narrow { width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; gap: .75rem; align-items: stretch; }
.card.narrow .logo { align-self: center; }
.card.narrow label { text-align: left; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.card.mod { margin: 0; display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; border-left: 6px solid var(--line); }
.card.mod.on { border-left-color: var(--green); }
.row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.spacer { height: .75rem; }

label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); margin: .5rem 0; }
input, select, textarea, button { font: inherit; color: var(--text); }
input, select, textarea { width: 100%; padding: .6rem .7rem; border: 1px solid var(--oak); border-radius: 10px; background: #fff; min-height: 44px; }
label.check input { width: 1.2rem; min-height: 0; height: 1.2rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
button { min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--oak); background: var(--sand); cursor: pointer; }
button:hover { background: var(--line); }
button.primary { background: var(--walnut); border-color: var(--walnut); color: #fff; font-weight: 600; }
button.primary:hover { background: #47301F; }
button.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; min-height: 0; padding: .25rem; font-size: .85rem; }
button[disabled] { opacity: .6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; }
td.actions { display: table-cell; white-space: nowrap; }
td.actions button { margin: 0 .35rem .25rem 0; }

.lang { display: inline-flex; border: 1px solid var(--oak); border-radius: 999px; overflow: hidden; align-self: center; }
.lang button { border: none; border-radius: 0; background: #fff; min-height: 36px; padding: .25rem .9rem; font-size: .85rem; }
.lang button.on { background: var(--oak); font-weight: 600; }

.flash { padding: .6rem .8rem; border-radius: 10px; margin: 0 0 .75rem; text-align: left; }
.flash.ok { background: var(--green-soft); color: #23492A; }
.flash.err { background: #F6DADA; color: #7A1F1F; }
.update { display: flex; gap: .75rem; align-items: center; justify-content: center; padding: .5rem 1rem; background: var(--green); color: #fff; }
.update button { min-height: 36px; background: #fff; border-color: #fff; }

.tablewrap { width: 100%; overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--sand); color: var(--walnut); white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
table.small { font-size: .85rem; }
table.small td { max-width: 260px; overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: minmax(140px, 1fr) 2fr; gap: .4rem 1rem; margin: .75rem 0; }
dt { color: var(--muted); } dd { margin: 0; overflow-wrap: anywhere; }

/* IDR rata kiri, nominal rata kanan */
.money { display: flex; justify-content: space-between; gap: .75rem; font-variant-numeric: tabular-nums; min-width: 9rem; }
.money.neg { color: var(--danger); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; width: min(92vw, 440px); color: var(--text); }
dialog::backdrop { background: rgba(46, 34, 27, .45); }
dialog form { display: flex; flex-direction: column; gap: .6rem; }

@media (max-width: 760px) {
  .layout { flex-direction: column-reverse; }
  nav { flex-direction: row; width: 100%; padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--line);
    position: sticky; bottom: 0; justify-content: space-around; overflow-x: auto; z-index: 5; }
  nav a { flex-direction: column; gap: 0; padding: .3rem .5rem; font-size: .7rem; min-width: 56px; text-align: center; }
  footer { display: none; }
  .center footer { display: block; border: none; }
  dl { grid-template-columns: 1fr; gap: 0 0; } dt { margin-top: .5rem; }
}
@media (max-width: 760px) and (orientation: landscape) {
  .layout { flex-direction: row; }
  nav { flex-direction: column; width: auto; position: static; border-top: none; border-right: 1px solid var(--line); justify-content: flex-start; }
}
@media (prefers-reduced-motion: no-preference) { button, nav a { transition: background .15s; } }
