@font-face { font-family: "DM Sans"; font-weight: 300; src: url("/fonts/DMSans-300.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Sans"; font-weight: 400; src: url("/fonts/DMSans-400.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Sans"; font-weight: 400; font-style: italic; src: url("/fonts/DMSans-400-italic.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Sans"; font-weight: 500; src: url("/fonts/DMSans-500.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "DM Sans"; font-weight: 600; src: url("/fonts/DMSans-600.ttf") format("truetype"); font-display: swap; }

:root {
  --cream: #faf8f3; --ink: #173e3a; --body: #2c4743; --muted: #647d79; --teal: #2f7a6a;
  --panel: #f0eee8; --mint: #e7eee7; --line: #dcdcd4; --white: #ffffff;
  --amber: #8a5a12; --amber-bg: #f7ecd4; --red: #9c3b2c; --red-bg: #f6e2dc;
  --radius: 6px; --maxw: 760px;
}
* { box-sizing: border-box; }
html { background: var(--cream); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: "DM Sans", system-ui, sans-serif; font-size: 15px; line-height: 1.55; color: var(--body); font-variant-numeric: lining-nums tabular-nums; }
a { color: var(--teal); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--ink); font-weight: 400; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 300; }
h2 { font-size: 20px; line-height: 1.25; }
h3 { font-size: 15px; font-weight: 500; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px 80px; }
.wrap.wide { max-width: 1180px; }

/* bilah atas */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0 6px; }
.brand { font-size: 15px; color: var(--ink); letter-spacing: 0.02em; }
.brand span { color: var(--muted); }
.top .link { font-size: 13px; }

/* strip progres: elemen yang menonjol */
.strip { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; height: 10px; margin: 18px 0 10px; }
.strip i { display: block; background: var(--line); border-radius: 2px; }
.strip i.cek { background: #d8c48f; }
.strip i.ok { background: var(--teal); }
.progress-line { color: var(--ink); font-size: 17px; }
.deadline { color: var(--muted); font-size: 14px; }
.deadline.late { color: var(--red); }

/* zona unggah */
.drop { border: 1.5px dashed #b8c4bf; border-radius: var(--radius); padding: 18px 16px; background: var(--white); margin: 16px 0; cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--teal); background: var(--mint); }
.drop strong { color: var(--ink); font-weight: 500; display: block; }
.drop .small { margin-top: 2px; }
.drop input { display: none; }
.drop.busy { pointer-events: none; opacity: .7; }

/* daftar bagian */
.sections { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.sections li { border-bottom: 1px solid var(--line); }
.sections a { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 14px 4px; color: var(--body); }
.sections a:hover { background: var(--white); text-decoration: none; }
.sections .no { color: var(--muted); font-size: 13px; }
.sections .t { color: var(--ink); font-size: 16px; }
.sections .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.chip { display: inline-block; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.chip.belum { background: var(--panel); color: var(--muted); }
.chip.perlu_cek { background: var(--amber-bg); color: var(--amber); }
.chip.selesai { background: var(--mint); color: var(--teal); }

/* tombol */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: var(--radius); cursor: pointer; line-height: 1.2; }
.btn:hover { background: #10302d; text-decoration: none; }
.btn.secondary { background: transparent; color: var(--ink); border-color: #b8c4bf; }
.btn.secondary:hover { background: var(--white); }
.btn.small { padding: 6px 11px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--red); border-color: #e2b8ae; }
.btn:disabled { opacity: .5; cursor: default; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }

/* masuk */
.gate { max-width: 420px; margin: 56px auto 0; }
.gate input { width: 100%; font-size: 24px; letter-spacing: 0.3em; text-align: center; padding: 12px; border: 1px solid #b8c4bf; border-radius: var(--radius); background: var(--white); margin: 14px 0; }
.gate input:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.pinwrap { position: relative; margin: 14px 0; }
.pinwrap input { margin: 0 !important; padding-left: 120px !important; padding-right: 120px !important; }
.masked { -webkit-text-security: disc; text-security: disc; }
.eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: var(--white); border: 1px solid #b8c4bf; border-radius: 4px; padding: 7px 12px; font-size: 13px; color: var(--teal); cursor: pointer; }
.eye:hover { background: var(--mint); }
.eye:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* halaman bagian */
.back { display: inline-block; margin: 10px 0 14px; font-size: 14px; }
.lead { color: var(--muted); margin: 6px 0 0; }
.prep { background: var(--panel); border-radius: var(--radius); padding: 12px 16px 12px 32px; margin: 14px 0; }
.prep li { margin: 3px 0; }
.prep .h { margin: 0 0 4px -16px; color: var(--ink); font-weight: 500; list-style: none; }
.note { background: var(--mint); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.warn { background: var(--amber-bg); color: var(--amber); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.err { background: var(--red-bg); color: var(--red); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.status-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 8px; }

/* tabel sunting */
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); max-height: 72vh; }
table.edit { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13.5px; }
table.edit th { position: sticky; top: 0; z-index: 2; background: var(--ink); color: var(--white); font-weight: 500; text-align: left; padding: 8px 10px; white-space: nowrap; font-size: 12.5px; }
table.edit th.req::after { content: " *"; color: #a9c2ba; }
table.edit td { border-bottom: 1px solid var(--line); padding: 0; vertical-align: top; }
table.edit td.idx { padding: 8px 6px 0 8px; color: var(--muted); font-size: 12px; white-space: nowrap; background: var(--white); }
table.edit th:first-child, table.edit td:first-child { position: sticky; left: 0; z-index: 1; }
table.edit th:first-child { z-index: 3; }
table.edit th:nth-child(2), table.edit td:nth-child(2) { position: sticky; left: 34px; z-index: 1; background: var(--white); box-shadow: 1px 0 0 var(--line); }
table.edit th:nth-child(2) { z-index: 3; background: var(--ink); }
table.edit input, table.edit select { width: 100%; min-width: 130px; border: 0; background: transparent; padding: 8px 10px; border-radius: 0; }
table.edit td:nth-child(2) input { min-width: 220px; }
details.prep summary { cursor: pointer; color: var(--ink); font-weight: 500; list-style: none; margin-left: -16px; }
details.prep summary::-webkit-details-marker { display: none; }
details.prep summary::before { content: "▸ "; color: var(--muted); } details.prep[open] summary::before { content: "▾ "; }
details.prep ul { margin: 6px 0 0; padding: 0; }
table.edit input:focus, table.edit select:focus { outline: 2px solid var(--teal); outline-offset: -2px; background: #fff; }
table.edit td.bad input, table.edit td.bad select { background: var(--amber-bg); }
table.edit td.note-cell input { background: #f3f7f3; }
table.edit td.file { padding: 4px 8px; white-space: nowrap; }
table.edit tr.has-issue td.idx { color: var(--amber); font-weight: 500; }
table.edit .del { color: var(--muted); background: none; border: 0; cursor: pointer; padding: 6px; font-size: 16px; line-height: 1; }
table.edit .del:hover { color: var(--red); }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; vertical-align: middle; margin-right: 6px; background: var(--panel); }
.filebtn { font-size: 12.5px; color: var(--teal); background: none; border: 1px solid #b8c4bf; border-radius: 4px; padding: 5px 8px; cursor: pointer; }
.filebtn:hover { background: var(--mint); }
.issues { margin: 10px 0; font-size: 13.5px; }
.issues li { margin: 2px 0; } .issues b { color: var(--amber); font-weight: 500; }
.issues .more { color: var(--muted); }

/* formulir */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 14px 0; }
.fld label { display: block; color: var(--ink); font-size: 14px; margin-bottom: 4px; }
.fld label .req { color: var(--amber); }
.fld input, .fld select, .fld textarea { width: 100%; border: 1px solid #c9d1cd; border-radius: var(--radius); padding: 9px 11px; background: var(--white); }
.fld textarea { min-height: 96px; resize: vertical; }
.fld input:focus, .fld select:focus, .fld textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.fld.bad input, .fld.bad select, .fld.bad textarea { background: var(--amber-bg); border-color: #d9b56b; }
.fld .hint { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.fld .msg { color: var(--amber); font-size: 12.5px; margin-top: 3px; }
.fld.check { display: flex; align-items: center; gap: 10px; } .fld.check input { width: 20px; height: 20px; margin: 0; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.files .f { display: inline-flex; align-items: center; gap: 6px; background: var(--panel); border-radius: 4px; padding: 4px 8px 4px 4px; font-size: 13px; max-width: 100%; }
.files .f img { width: 36px; height: 36px; object-fit: cover; border-radius: 3px; }
.files .f .x { color: var(--muted); cursor: pointer; border: 0; background: none; font-size: 15px; padding: 0 4px; }
.files .f .x:hover { color: var(--red); }

/* kartu hasil & toast */
.result { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--teal); border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 14px; }
.result ul { margin: 6px 0 0 18px; padding: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: var(--radius); font-size: 14px; max-width: 92vw; z-index: 50; box-shadow: 0 6px 20px rgba(23,62,58,.25); }
.toast.err { background: var(--red); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #a9c2ba; border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .drop { transition: none; } }

/* dialog ringan */
.sheet { position: fixed; inset: 0; background: rgba(23,62,58,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.sheet > div { background: var(--cream); width: 100%; max-width: 560px; border-radius: 10px 10px 0 0; padding: 18px 18px 26px; max-height: 88vh; overflow: auto; }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet > div { border-radius: 10px; } }

/* admin */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 16px 0; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h3 { font-size: 17px; font-weight: 500; }
.card .strip { margin: 10px 0 6px; height: 8px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 10px; font-size: 13.5px; margin: 8px 0; }
.kv b { font-weight: 500; color: var(--ink); }
.log { font-size: 12.5px; max-height: 40vh; overflow: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; }
.log div { padding: 3px 0; border-bottom: 1px solid var(--panel); }
.log time { color: var(--muted); margin-right: 8px; }
code { background: var(--panel); padding: 1px 5px; border-radius: 3px; font-size: 13px; }
.sr { position: absolute; left: -9999px; }
.focus-ring:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
