/* Demo aplikasi interaktif (/demo/*). Data hanya di browser pengunjung (localStorage). Awalan kelas: dm- */
.demo-page { padding: 28px 0 72px; background: var(--bg-alt); }
.demo-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; justify-content: space-between; margin-bottom: 14px; font-size: .9rem; color: var(--muted); }
.demo-note b { color: var(--text); }
.demo-note .dm-reset { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; }
.demo-note .dm-reset:hover { color: var(--text); border-color: #c9cee0; }

.dm-frame { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.dm-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: #f1f3f8; border-bottom: 1px solid var(--line); }
.dm-dots { display: flex; gap: 6px; }
.dm-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.dm-dots i:nth-child(2) { background: #febc2e; }
.dm-dots i:nth-child(3) { background: #28c840; }
.dm-url { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font: 500 .8rem var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dm-app, .dm-modal, .dm-toasts { --dm-c: #0e7a5f; --dm-c2: #0b5f4a; --dm-soft: #e6f5f0; }
.dm-app { min-height: 640px; font-size: .95rem; color: var(--text); }
.dm-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dm-school { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.dm-school svg { width: 38px; height: 38px; flex: none; }
.dm-school b { display: block; font-size: 1rem; line-height: 1.2; }
.dm-school small { color: var(--muted); font-size: .78rem; }
.dm-roles { display: inline-flex; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.dm-roles button { border: 0; background: none; font: 600 .85rem var(--font); color: var(--muted); padding: 7px 16px; border-radius: 999px; cursor: pointer; }
.dm-roles button[aria-pressed="true"] { background: var(--dm-c); color: #fff; box-shadow: 0 2px 6px rgba(14, 122, 95, .3); }

.dm-nav { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.dm-nav::-webkit-scrollbar { display: none; }
.dm-nav button { border: 0; background: none; font: 600 .9rem var(--font); color: var(--muted); padding: 13px 12px 11px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.dm-nav button[aria-current="page"] { color: var(--dm-c); border-bottom-color: var(--dm-c); }
.dm-nav .dm-count { background: #fdecc8; color: #8a5300; font-size: .72rem; border-radius: 999px; padding: 1px 7px; }

.dm-body { padding: 22px 20px 28px; }
.dm-body h2 { font-size: 1.25rem; margin: 0 0 4px; line-height: 1.3; }
.dm-body h3 { font-size: 1rem; margin: 0 0 10px; }
.dm-sub { color: var(--muted); margin: 0 0 18px; font-size: .9rem; }

.dm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 10px; padding: 9px 16px; font: 600 .88rem var(--font); cursor: pointer; background: var(--dm-c); color: #fff; text-decoration: none; transition: background .15s; }
.dm-btn:hover { background: var(--dm-c2); color: #fff; }
.dm-btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.dm-btn.ghost:hover { background: var(--bg-alt); color: var(--text); }
.dm-btn.warn { background: #b45309; }
.dm-btn.warn:hover { background: #92400e; }
.dm-btn.danger { background: #fff; color: #b42318; border-color: #f3c3bd; }
.dm-btn.danger:hover { background: #fef3f2; }
.dm-btn.sm { padding: 6px 11px; font-size: .8rem; border-radius: 8px; }
.dm-btn:disabled { opacity: .5; cursor: not-allowed; }
.dm-btn svg { width: 16px; height: 16px; }
.dm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.dm-banner { border-radius: 14px; padding: 22px; color: #fff; background: linear-gradient(120deg, #0b5f4a, #0e7a5f 55%, #18a57f); display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.dm-banner h2 { color: #fff; font-size: 1.4rem; }
.dm-banner p { margin: 4px 0 0; opacity: .9; }
.dm-banner .dm-btn { background: #fff; color: var(--dm-c2); }
.dm-banner .dm-btn:hover { background: #f0fbf7; }

.dm-grid { display: grid; gap: 14px; }
.dm-grid.c4 { grid-template-columns: repeat(4, 1fr); }
.dm-grid.c2 { grid-template-columns: repeat(2, 1fr); }
.dm-grid.c21 { grid-template-columns: 1.5fr 1fr; align-items: start; }
.dm-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: #fff; }
.dm-card.soft { background: var(--bg-alt); }
.dm-kpi small { display: block; color: var(--muted); font-size: .8rem; }
.dm-kpi b { font-size: 1.6rem; line-height: 1.2; }
.dm-kpi.alert b { color: #b45309; }
.dm-quota { display: grid; gap: 6px; }
.dm-quota b { font-size: .95rem; }
.dm-quota p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.45; }
.dm-meter { height: 8px; border-radius: 99px; background: #e9ecf3; overflow: hidden; }
.dm-meter i { display: block; height: 100%; background: var(--dm-c); border-radius: 99px; transition: width .4s; }
.dm-meter.over i { background: #d97706; }
.dm-quota small { color: var(--muted); font-size: .8rem; }

.dm-timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.dm-timeline li { position: relative; padding: 0 0 16px 26px; font-size: .9rem; }
.dm-timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: #c7cdda; }
.dm-timeline li::after { content: ""; position: absolute; left: 10px; top: 18px; bottom: 0; width: 2px; background: #e4e7f0; }
.dm-timeline li:last-child::after { display: none; }
.dm-timeline li.done::before { background: var(--dm-c); }
.dm-timeline li.now::before { background: #fff; border: 3px solid var(--dm-c); width: 8px; height: 8px; }
.dm-timeline li.bad::before { background: #d92d20; }
.dm-timeline b { display: block; }
.dm-timeline span { color: var(--muted); font-size: .84rem; }

/* Formulir */
.dm-steps { display: flex; gap: 8px; margin-bottom: 20px; counter-reset: s; }
.dm-steps li { list-style: none; flex: 1; font-size: .82rem; font-weight: 600; color: var(--muted); padding-top: 10px; border-top: 3px solid #e4e7f0; counter-increment: s; }
.dm-steps li::before { content: counter(s) ". "; }
.dm-steps li.on { color: var(--dm-c); border-top-color: var(--dm-c); }
.dm-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.dm-form .full { grid-column: 1 / -1; }
.dm-field label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 5px; }
.dm-field input, .dm-field select { width: 100%; font: inherit; font-size: .92rem; padding: 9px 12px; border: 1px solid #d5dae6; border-radius: 9px; background: #fff; color: var(--text); }
.dm-field input:focus, .dm-field select:focus { outline: 2px solid rgba(14, 122, 95, .25); border-color: var(--dm-c); }
.dm-field input[type="file"] { padding: 7px; font-size: .84rem; }
.dm-field .err { color: #b42318; font-size: .8rem; margin-top: 4px; }
.dm-field.bad input, .dm-field.bad select { border-color: #f04438; }
.dm-field small { color: var(--muted); font-size: .8rem; }
.dm-file-ok { color: var(--dm-c); font-size: .82rem; margin-top: 4px; }
.dm-radio { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.dm-radio label { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; border: 1px solid #d5dae6; border-radius: 10px; padding: 12px; cursor: pointer; font-weight: 400; }
.dm-radio label:has(input:checked) { border-color: var(--dm-c); background: var(--dm-soft); }
.dm-radio input { margin-top: 4px; accent-color: var(--dm-c); }
.dm-radio b { font-size: .92rem; }
.dm-radio span { grid-column: 2; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.dm-autofill { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff8e6; border: 1px dashed #f0c46c; border-radius: 10px; padding: 10px 14px; margin-bottom: 18px; font-size: .86rem; color: #7a4b00; }
.dm-autofill .dm-btn { margin-left: auto; }

.dm-review { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: .9rem; margin: 0; }
.dm-review dt { color: var(--muted); }
.dm-review dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.dm-receipt { border: 2px dashed #b9dccf; border-radius: 14px; padding: 20px; background: #fbfefd; max-width: 560px; }
.dm-receipt-no { font: 700 1.5rem var(--mono); color: var(--dm-c2); letter-spacing: .02em; margin: 6px 0 14px; }
.dm-ok { display: inline-flex; align-items: center; gap: 8px; color: var(--dm-c); font-weight: 700; }
.dm-ok svg { width: 22px; height: 22px; }

.dm-search { display: flex; gap: 8px; max-width: 520px; }
.dm-search input { flex: 1; font: inherit; padding: 9px 12px; border: 1px solid #d5dae6; border-radius: 9px; min-width: 0; }

/* Panitia */
.dm-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.dm-toolbar input, .dm-toolbar select { font: inherit; font-size: .88rem; padding: 8px 11px; border: 1px solid #d5dae6; border-radius: 9px; background: #fff; }
.dm-toolbar input { flex: 1; min-width: 180px; }
.dm-toolbar .dm-btn { margin-left: auto; }
.dm-table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.dm-table { width: 100%; border-collapse: collapse; font-size: .87rem; }
.dm-table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--bg-alt); padding: 9px 12px; font-weight: 600; }
.dm-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.dm-table tbody tr { cursor: pointer; }
.dm-table tbody tr:hover { background: #f8faff; }
.dm-table tr.mine td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.dm-table td.num { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.dm-table td.r, .dm-table th.r { text-align: right; }
.dm-table tr.cut td { border-top: 2px dashed #d97706; }
.dm-table .rank { font-weight: 700; color: var(--muted); width: 40px; }
.dm-empty { padding: 28px; text-align: center; color: var(--muted); }
.dm-pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.dm-pager div { display: flex; gap: 6px; }

.dm-badge { display: inline-block; font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: #eef1f6; color: #475069; }
.dm-badge.menunggu { background: #fff4e0; color: #8a5300; }
.dm-badge.terverifikasi { background: #e1f4ec; color: #0b5f4a; }
.dm-badge.perbaikan { background: #fdeaea; color: #9b1c1c; }
.dm-badge.ditolak { background: #eceef2; color: #5b6480; text-decoration: line-through; }
.dm-badge.diterima { background: #0e7a5f; color: #fff; }
.dm-badge.cadangan { background: #fef0c7; color: #7a4b00; }
.dm-badge.tidak { background: #eceef2; color: #5b6480; }
.dm-badge.baru { background: #fde68a; color: #713f12; }

.dm-bars { display: grid; gap: 12px; }
.dm-bars div { display: grid; grid-template-columns: 120px 1fr 64px; gap: 10px; align-items: center; font-size: .85rem; }
.dm-bars span:last-child { text-align: right; color: var(--muted); font-size: .8rem; }
.dm-chart svg { width: 100%; height: 140px; display: block; }
.dm-chart-x { display: grid; grid-template-columns: repeat(10, 1fr); font-size: .72rem; color: var(--muted); text-align: center; margin-top: 4px; white-space: nowrap; }
.m-only { display: none; }
.dm-list { list-style: none; margin: 0; padding: 0; font-size: .87rem; }
.dm-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.dm-list li:first-child { border-top: 0; }
.dm-list small { color: var(--muted); white-space: nowrap; }

.dm-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.dm-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font: 600 .82rem var(--font); color: var(--muted); cursor: pointer; }
.dm-tabs button[aria-pressed="true"] { background: var(--dm-soft); border-color: var(--dm-c); color: var(--dm-c2); }
.dm-rule { font-size: .85rem; color: var(--muted); background: var(--bg-alt); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.dm-rule b { color: var(--text); }

.dm-cta { margin-top: 22px; border-radius: 12px; padding: 16px 18px; background: linear-gradient(120deg, #eef4ff, #e9faf6); border: 1px solid #d6e4fb; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; font-size: .92rem; }
.dm-cta b { display: block; }
.dm-cta .dm-btn { background: var(--primary); }
.dm-cta .dm-btn:hover { background: var(--primary-2); }

/* Modal & toast */
.dm-modal { position: fixed; inset: 0; z-index: 200; background: rgba(11, 16, 32, .55); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.dm-dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: var(--shadow-lg); animation: dmIn .2s ease; }
.dm-dialog header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dm-dialog header h3 { margin: 0; font-size: 1.1rem; }
.dm-dialog header small { color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.dm-x { border: 0; background: var(--bg-alt); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 1.2rem; line-height: 1; color: var(--muted); flex: none; }
.dm-dialog .dm-in { padding: 18px 20px; }
.dm-dialog footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.dm-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.dm-files li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; font-size: .86rem; }
.dm-files li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-files svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.dm-doc { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; padding: 18px; display: grid; gap: 8px; }
.dm-doc i { display: block; height: 8px; border-radius: 4px; background: #e3e7ef; }
.dm-doc i:nth-child(3n) { width: 70%; }
.dm-doc i:nth-child(4n) { width: 45%; }
.dm-doc p { margin: 0 0 4px; font-size: .8rem; color: var(--muted); }
.dm-note { width: 100%; font: inherit; font-size: .9rem; padding: 9px 12px; border: 1px solid #d5dae6; border-radius: 9px; min-height: 70px; margin-top: 6px; }
.dm-toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 210; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.dm-toast { background: #0b1020; color: #fff; border-radius: 12px; padding: 12px 16px; font-size: .88rem; box-shadow: var(--shadow-lg); animation: dmIn .2s ease; display: flex; gap: 10px; align-items: flex-start; }
.dm-toast svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: #4ade80; }
@keyframes dmIn { from { opacity: 0; transform: translateY(8px); } }

/* Halaman daftar demo */
.demo-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.demo-card { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; color: var(--text); box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.demo-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); color: var(--text); }
.demo-card img { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: var(--bg-alt); }
.demo-card div { padding: 18px 20px 20px; }
.demo-card h2 { font-size: 1.15rem; margin: 0 0 6px; }
.demo-card p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.demo-card span { font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 6px; }
.demo-card span svg { width: 16px; height: 16px; }

@media (max-width: 860px) {
  .dm-grid.c4 { grid-template-columns: repeat(2, 1fr); }
  .dm-grid.c21, .dm-grid.c2 { grid-template-columns: 1fr; }
  .demo-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .demo-page { padding: 16px 0 48px; }
  .demo-page > .container { padding-left: 10px; padding-right: 10px; }
  .dm-frame { border-radius: 14px; }
  .dm-bar { padding: 8px 10px; }
  .dm-dots { display: none; }
  .dm-top { padding: 12px 14px; }
  .dm-roles { width: 100%; }
  .dm-roles button { flex: 1; }
  .dm-body { padding: 18px 14px 22px; }
  .dm-banner { grid-template-columns: 1fr; padding: 18px; }
  .dm-form, .dm-radio { grid-template-columns: 1fr; }
  .dm-review { grid-template-columns: 1fr; gap: 0; }
  .dm-review dd { margin-bottom: 8px; }
  .dm-bars div { grid-template-columns: 90px 1fr 54px; }
  .dm-toolbar .dm-btn { margin-left: 0; }
  .dm-toolbar input { flex-basis: 100%; }
  .dm-toolbar select { flex: 1 1 40%; min-width: 0; }
  /* Tabel jadi kartu */
  .dm-table thead { display: none; }
  .dm-table, .dm-table tbody, .dm-table tr, .dm-table td { display: block; }
  .dm-table tr { padding: 10px 12px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  .dm-table tbody tr:first-child { border-top: 0; }
  .dm-table td { border: 0; padding: 0; }
  .dm-table td[data-h]::before { content: attr(data-h) ": "; color: var(--muted); }
  .dm-table td.m-name { font-weight: 600; }
  .dm-table td.m-side { grid-column: 2; grid-row: 1 / span 2; text-align: right; align-self: center; }
  .dm-table td.m-hide { display: none; }
  .dm-table td.r { text-align: left; }
  .dm-table td.rank { width: auto; }
  .m-only { display: inline; }
  .dm-table tr.cut { border-top: 2px dashed #d97706; }
  .dm-table tr.cut td { border: 0; }
  .dm-pager { flex-direction: column; align-items: stretch; text-align: center; }
  .dm-pager div { justify-content: center; }
}

@media print {
  body.dm-printing * { visibility: hidden !important; }
  body.dm-printing .dm-receipt, body.dm-printing .dm-receipt * { visibility: visible !important; }
  body.dm-printing .dm-receipt { position: absolute; left: 0; top: 0; border-color: #999; }
  body.dm-printing .dm-receipt .dm-actions { display: none; }
}

.demo-more { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.demo-more li { position: relative; padding-left: 30px; color: var(--muted); }
.demo-more li::before { content: ""; position: absolute; left: 0; top: 5px; width: 18px; height: 18px; border-radius: 50%; background: #e1f4ec url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e7a5f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 12px no-repeat; }
