/* Kartu NISN — tampilan */
@font-face { font-family: KartuSerif; font-weight: 400; font-style: normal;
  src: local("Times New Roman"), local("TimesNewRomanPSMT"), url("../fonts/LiberationSerif-Regular.ttf") format("truetype"); }
@font-face { font-family: KartuSerif; font-weight: 700; font-style: normal;
  src: local("Times New Roman Bold"), local("TimesNewRomanPS-BoldMT"), url("../fonts/LiberationSerif-Bold.ttf") format("truetype"); }

:root {
  --tinta: #15304f;      /* biru gelap teks */
  --biru: #1d6fb8;       /* biru Dapodik */
  --biru-muda: #dcecf9;
  --langit: #eef6fc;
  --kertas: #ffffff;
  --garis: #d3e1ec;
  --daun: #5d7d0c;       /* hijau bukit pada bingkai foto */
  --daun-muda: #eef4dc;
  --jingga: #a2520a;
  --jingga-muda: #fdf0df;
  --merah: #b42318;
  --abu: #5b6f84;
  --r: 12px;
  --ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--ui); font-size: 15px; line-height: 1.55; color: var(--tinta); background: var(--langit); }
body.no-scroll { overflow: hidden; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.45rem, 3.4vw, 2rem); font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
h4 { font-size: .98rem; }
p { margin: 0 0 .6em; }
.muted { color: var(--abu); }
.small { font-size: .86rem; }
.pad { padding: 12px 16px; }
a { color: var(--biru); }
:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; border-radius: 6px; }

/* ---------- Tombol & isian ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4em; min-height: 42px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--garis); background: var(--kertas); color: var(--tinta); font: 600 .93rem/1 var(--ui); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #a9c3d8; background: #f8fbfe; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--biru); border-color: var(--biru); color: #fff; }
.btn.primary:hover { background: #185f9e; }
.btn.danger { background: var(--merah); border-color: var(--merah); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(29,111,184,.08); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: .86rem; }
.btn.wide { width: 100%; }
.danger-text { color: var(--merah) !important; }
.file-btn { position: relative; }
.file-btn.is-busy { pointer-events: none; opacity: .7; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--abu); text-decoration: underline; cursor: pointer; font-family: var(--ui); }
input, select, textarea { width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--garis); border-radius: 10px; background: #fff; color: var(--tinta); font: 400 1rem var(--ui); }
input:focus, select:focus { outline: 0; border-color: var(--biru); box-shadow: 0 0 0 3px var(--biru-muda); }
label { display: block; font-weight: 600; font-size: .9rem; }
label > input, label > select { margin-top: 6px; font-weight: 400; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
label.check input { width: 20px; min-height: 20px; margin: 0; }
.stack > * + * { margin-top: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-end { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
hr { border: 0; border-top: 1px solid var(--garis); margin: 22px 0; }

/* Lambang kecil: bingkai foto kartu (langit + bukit) */
.mark { display: inline-block; width: 20px; height: 26px; border-radius: 4px; border: 2px solid #fff; box-shadow: 0 0 0 1px #9cc6e6;
  background: linear-gradient(to bottom, #d3efff 0 62%, #8aa201 62%); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--biru); margin: 0 0 18px; }

/* ---------- Masuk ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, #bfe3fa 0%, var(--langit) 45%); }
.auth-card { width: min(400px, 100%); background: #fff; border-radius: 18px; padding: 30px 26px; box-shadow: 0 18px 50px -24px rgba(21,48,79,.45); }
.auth-card > * + * { margin-top: 12px; }
.auth-card .btn { margin-top: 20px; }

/* ---------- Admin ---------- */
.bar-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--garis); position: sticky; top: 0; z-index: 5; }
.brand-wrap { display: flex; gap: 10px; align-items: center; }
.brand-wrap strong { display: block; font-size: 1rem; }
.brand-wrap span:not(.mark) { display: block; font-size: .8rem; color: var(--abu); }
.layout { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 63px); }
.side { background: #fff; border-right: 1px solid var(--garis); }
.side-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 16px 10px; }
.side-head h2 { margin: 0; }
.batch { display: block; width: 100%; text-align: left; background: none; border: 0; border-left: 3px solid transparent; padding: 11px 16px; cursor: pointer; font-family: var(--ui); color: var(--tinta); }
.batch:hover { background: var(--langit); }
.batch.on { background: var(--biru-muda); border-left-color: var(--biru); }
.batch-name { display: block; font-weight: 600; }
.batch-meta { display: block; font-size: .8rem; color: var(--abu); }
.main { padding: 26px clamp(16px, 3vw, 40px) 60px; max-width: 1100px; width: 100%; }
.head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.head-acts { display: flex; gap: 4px; }
.hello { background: #fff; border-radius: 16px; padding: 34px; max-width: 620px; margin-top: 20px; }
.share { margin: 18px 0 22px; padding: 18px 20px; background: #fff; border: 1px solid var(--garis); border-radius: 14px; }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.share-row input { flex: 1 1 260px; min-height: 36px; font-size: .9rem; background: var(--langit); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { flex: 1 1 200px; min-height: 42px; width: auto; }
.rows { background: #fff; border: 1px solid var(--garis); border-radius: 14px; overflow: hidden; }
.r { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 10px 14px; border-top: 1px solid #e7eef4; }
.r:first-child { border-top: 0; }
.r-photo { width: 54px; height: 72px; border-radius: 6px; overflow: hidden; background: linear-gradient(to bottom, #e3f4ff 0 62%, #c9d98f 62%); display: grid; place-items: center; }
.r-photo img { width: 100%; height: 100%; object-fit: cover; }
.r-photo span { font-size: .62rem; text-align: center; color: var(--abu); line-height: 1.2; padding: 2px; }
.r-main { display: flex; flex-direction: column; min-width: 0; }
.r-main strong { overflow-wrap: anywhere; }
.r-acts { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.warn { color: var(--jingga); font-style: normal; }
.empty { background: #fff; border: 1px dashed #b9cee0; border-radius: 14px; padding: 28px; text-align: center; color: var(--abu); }

/* ---------- Guru ---------- */
.wrap { width: min(1120px, 100%); margin: 0 auto; padding: 0 18px; }
.hero { background: linear-gradient(180deg, #bfe3fa 0%, #e6f4fd 100%); padding: 26px 0 30px; border-bottom: 1px solid #c7e0f2; }
.hero .brand { margin-bottom: 10px; }
.hero h1 { margin-bottom: 14px; }
.prog { max-width: 460px; }
.prog-bar, .bar { height: 10px; background: rgba(255,255,255,.75); border-radius: 99px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(21,48,79,.08); }
.prog-bar span, .bar span { display: block; height: 100%; width: 0; background: var(--daun); border-radius: 99px; transition: width .4s ease; }
.bar { background: var(--langit); margin: 16px 0 8px; }
.prog p { margin: 8px 0 0; font-weight: 600; font-size: .92rem; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 0; margin: 22px 0 18px; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; background: #fff; border-radius: 12px; padding: 12px 14px 12px 48px; position: relative; font-size: .9rem; color: var(--abu); }
.steps li strong { color: var(--tinta); }
.steps li::before { content: counter(s); position: absolute; left: 14px; top: 12px; width: 24px; height: 24px; border-radius: 50%; background: var(--biru); color: #fff; font-weight: 700; font-size: .8rem; display: grid; place-items: center; }
.tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.tools input { flex: 1 1 220px; width: auto; }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--garis); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font: 600 .85rem var(--ui); color: var(--abu); cursor: pointer; }
.seg button em { font-style: normal; font-weight: 500; opacity: .75; margin-left: 2px; }
.seg button[aria-pressed=true] { background: var(--biru-muda); color: var(--tinta); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding-bottom: 60px; }
.grid > .empty { grid-column: 1 / -1; }
.item { background: #fff; border-radius: 14px; overflow: hidden; border: 1px solid #dbe7f0; display: flex; flex-direction: column; }
.thumb { display: block; width: 100%; border: 0; padding: 12px 12px 0; background: none; cursor: zoom-in; }
.thumb .skeleton, .dc .skeleton, .edit-preview .skeleton { aspect-ratio: 1016 / 638; height: auto; }
.thumb canvas { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 1px 0 rgba(21,48,79,.08), 0 6px 18px -10px rgba(21,48,79,.4); }
.item-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.item-body h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.item-body p { margin: 0; }
.status { align-self: flex-start; margin-top: 6px; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; }
.status.ok { background: var(--daun-muda); color: var(--daun); }
.status.no { background: var(--jingga-muda); color: var(--jingga); }
.item-acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.item-acts .btn { flex: 1 1 120px; }
.skeleton { display: block; width: 100%; height: 100%; min-height: 60px; border-radius: 6px; background: linear-gradient(90deg, #eef4f9 25%, #f7fafc 50%, #eef4f9 75%); background-size: 200% 100%; animation: sh 1.2s infinite linear; }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- Jendela ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(15,32,52,.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 14px; overflow-y: auto; z-index: 50; }
.modal { position: relative; background: #fff; border-radius: 16px; padding: 24px 22px 20px; width: min(460px, 100%); box-shadow: 0 30px 80px -30px rgba(0,0,0,.5); }
.modal.wide { width: min(860px, 100%); }
.modal-x { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--abu); cursor: pointer; border-radius: 10px; }
.modal-x:hover { background: var(--langit); }
.modal h3 { padding-right: 36px; }
.confirm-text { font-size: 1rem; margin-top: 6px; }
.detail-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.dc { aspect-ratio: 1016 / 638; }
.dc canvas { width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 0 0 1px #dfe7ee, 0 8px 22px -14px rgba(21,48,79,.5); }
.detail-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: grid; gap: 10px; margin-top: 14px; }
.choice-btn { text-align: left; background: var(--langit); border: 1px solid var(--garis); border-radius: 12px; padding: 14px 16px; cursor: pointer; font-family: var(--ui); color: var(--tinta); }
.choice-btn:hover { border-color: var(--biru); }
.choice-btn strong { display: block; font-size: 1rem; }
.choice-btn span { font-size: .86rem; color: var(--abu); }
.crop-stage { position: relative; width: min(300px, 100%); margin: 12px auto; border-radius: 8px; overflow: hidden; touch-action: none; background: #eee; }
.crop-stage canvas { display: block; width: 100%; cursor: grab; }
.crop-guide { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.9);
  background: radial-gradient(ellipse 34% 30% at 50% 40%, transparent 96%, rgba(255,255,255,.55) 97%, transparent 100%); }
.crop-zoom { display: flex; align-items: center; gap: 12px; width: min(300px, 100%); margin: 0 auto; }
.crop-zoom input { margin: 0; min-height: 30px; padding: 0; border: 0; box-shadow: none; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
.edit-preview { position: sticky; top: 0; aspect-ratio: 1016 / 638; }
.edit-preview canvas { width: 100%; height: auto; border-radius: 6px; box-shadow: 0 0 0 1px #dfe7ee; }
.table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--garis); border-radius: 10px; }
.tbl { border-collapse: collapse; width: 100%; font-size: .86rem; }
.tbl th, .tbl td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #e7eef4; white-space: nowrap; }
.tbl th { background: var(--langit); font-weight: 600; }
.note { background: var(--langit); border-radius: 10px; padding: 10px 12px; font-size: .86rem; }
.warnbox { background: var(--jingga-muda); border-radius: 10px; padding: 10px 12px; font-size: .86rem; color: #6b3a06; }
.warnbox summary { font-weight: 600; cursor: pointer; }
.warnbox ul { margin: 8px 0 0; padding-left: 18px; max-height: 160px; overflow: auto; }
.set-tpl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 6px; }
.set-tpl figure { margin: 0; }
.set-tpl img { width: 100%; border-radius: 6px; box-shadow: 0 0 0 1px #dfe7ee; display: block; }
.set-tpl figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-weight: 600; font-size: .9rem; }
.set-tpl figcaption span { display: flex; gap: 4px; }

#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 99; width: min(420px, calc(100% - 28px)); }
.toast { background: var(--tinta); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 500; font-size: .92rem; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); transition: opacity .3s, transform .3s; }
.toast.err { background: var(--merah); }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .side { border-right: 0; border-bottom: 1px solid var(--garis); }
  #batchList { display: flex; overflow-x: auto; gap: 6px; padding: 0 12px 12px; }
  .batch { flex: none; width: auto; border: 1px solid var(--garis); border-radius: 10px; padding: 8px 12px; }
  .batch.on { border-color: var(--biru); }
  .r { grid-template-columns: 46px 1fr; }
  .r-photo { width: 46px; height: 61px; }
  .r-acts { grid-column: 1 / -1; justify-content: flex-start; }
  .edit-grid { grid-template-columns: 1fr; }
  .edit-preview { position: static; order: -1; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .detail-cards, .set-tpl, .two { grid-template-columns: 1fr; }
  .detail-acts .btn, .detail-acts label { flex: 1 1 100%; }
  .tools > * { flex: 1 1 100%; }
  .seg { display: grid; grid-template-columns: repeat(3, 1fr); }
  .seg button { padding: 8px 6px; font-size: .8rem; line-height: 1.25; }
  .seg button em { display: block; margin: 0; }
  .grid { grid-template-columns: 1fr; }
  .modal { padding: 20px 16px 16px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
