/* Hero demo — generator invoice.
   Frame: panel putih 1px border, tanpa chrome window. Isi stage digambar
   di 1200 × 750 lalu diskalakan oleh engine html-demo (--k).
   Semua class di-prefix `ktd-` (stage) / `kt-demo-` (shell) supaya tidak
   bentrok dengan stylesheet lain. */

.kt-demo {
  --hd-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ktd-blue: #2563eb;
  --ktd-blue-700: #1d4ed8;
  --ktd-blue-50: #eff6ff;
  --ktd-line: #e5e7eb;
  --ktd-ink: #111827;
  --ktd-muted: #6b7280;
  border: 1px solid var(--ktd-line);
  border-radius: 20px;
  background: #ffffff;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(17, 24, 39, 0.04),
    0 40px 80px -60px rgba(17, 24, 39, 0.55);
}

/* Head: brand + nama alat + penanda contoh. Bukan bar Mac. */
.kt-demo-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  font: 600 12px/1.2 var(--hd-font);
  color: #374151;
  min-width: 0;
}

.kt-demo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--ktd-blue);
  color: #ffffff;
  flex: none;
}

.kt-demo-mark svg { width: 12px; height: 12px; }

.kt-demo-brand { font-weight: 800; color: var(--ktd-ink); white-space: nowrap; }

.kt-demo-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d1d5db;
  flex: none;
}

.kt-demo-title {
  color: var(--ktd-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kt-demo-flag {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid var(--ktd-line);
  color: var(--ktd-muted);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

.kt-demo-flag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f59e0b;
}

/* Frame: engine html-demo di dalamnya, tapi tanpa look window Mac. */
.kt-demo-frame { position: relative; }
.kt-demo .hd { display: block; }
.kt-demo .hd-win {
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}
.kt-demo .hd-bar { display: none; }
.kt-demo .hd-view { background: #f9fafb; }
.kt-demo .hd-stage { background: #f9fafb; color: var(--ktd-ink); }

/* Steps bar versi kita: teks + garis progress tipis. */
.kt-demo-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  margin: 0;
  padding: 6px 8px 8px;
  border-top: 1px solid #f3f4f6;
  list-style: none;
}

.kt-demo-steps button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 34px;
  padding: 0 7px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ktd-muted);
  font: 600 10.5px/1.1 var(--hd-font);
  text-align: left;
  cursor: pointer;
  transition: color .16s ease, background-color .16s ease;
}

.kt-demo-steps button:hover { background: #f9fafb; color: var(--ktd-ink); }
.kt-demo-steps button.on { background: var(--ktd-blue-50); color: var(--ktd-blue-700); }
.kt-demo-steps button:focus-visible {
  outline: 2px solid var(--ktd-blue);
  outline-offset: 1px;
}

.kt-demo-steps .n {
  font-size: 9px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  opacity: .75;
  flex: none;
}

.kt-demo-steps .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kt-demo-steps button > i {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: #e5e7eb;
  overflow: hidden;
}

.kt-demo-steps button > i::after {
  content: "";
  display: block;
  height: 100%;
  width: calc(var(--p, 0) * 100%);
  border-radius: inherit;
  background: var(--ktd-blue);
}

/* ── Stage 1200 × 750 ─────────────────────────────────────────── */
.ktd-app {
  position: relative;
  width: 1200px;
  height: 750px;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  color: var(--ktd-ink);
  font: 500 13px/1.35 var(--hd-font);
  box-sizing: border-box;
  overflow: hidden;
}
.ktd-app *,
.ktd-app *::before,
.ktd-app *::after { box-sizing: border-box; }

.ktd-top {
  flex: none;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--ktd-line);
}

.ktd-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--ktd-blue);
  color: #ffffff;
  flex: none;
}
.ktd-logo svg { width: 14px; height: 14px; }

.ktd-crumb { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.ktd-crumb b { font-weight: 800; color: var(--ktd-ink); }
.ktd-crumb span { color: var(--ktd-muted); font-weight: 500; }
.ktd-crumb em { font-style: normal; color: #d1d5db; }

.ktd-top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.ktd-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--ktd-blue-50);
  color: var(--ktd-blue-700);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .01em;
}

.ktd-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
}

.ktd-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 564px 564px;
  gap: 24px;
  padding: 14px 24px 18px;
}

/* ── Kolom form ───────────────────────────────────────────────── */
.ktd-form { display: flex; flex-direction: column; gap: 9px; min-height: 0; }

.ktd-card {
  background: #ffffff;
  border: 1px solid var(--ktd-line);
  border-radius: 12px;
  padding: 10px 12px;
}

.ktd-card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.ktd-card-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
}

.ktd-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 5px;
  background: var(--ktd-blue-50);
  color: var(--ktd-blue);
  flex: none;
}
.ktd-ic svg { width: 10px; height: 10px; }

.ktd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 9px; }
.ktd-span2 { grid-column: span 2; }

.ktd-field { min-width: 0; }

.ktd-label {
  display: block;
  margin-bottom: 2px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--ktd-muted);
}

.ktd-input {
  display: flex;
  align-items: center;
  height: 27px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 7px;
  background: #ffffff;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ktd-ink);
  white-space: nowrap;
  overflow: hidden;
}
.ktd-input.is-ph { color: #9ca3af; font-weight: 400; }
.ktd-input.is-focus {
  border-color: var(--ktd-blue);
  box-shadow: 0 0 0 2.5px rgba(37, 99, 235, 0.14);
}
.ktd-input.is-focus::after {
  content: "";
  flex: none;
  width: 1.5px;
  height: 12px;
  margin-left: 1px;
  background: var(--ktd-blue);
  animation: ktd-blink 1s steps(1) infinite;
}
@keyframes ktd-blink { 50% { opacity: 0; } }

/* Item rows */
.ktd-items { display: flex; flex-direction: column; gap: 6px; }

.ktd-item {
  border: 1px solid var(--ktd-line);
  border-radius: 8px;
  padding: 5px 7px;
  background: #ffffff;
}
.ktd-item.is-new { border-color: #bfdbfe; background: #f8fbff; }

.ktd-item-top { display: flex; align-items: center; gap: 6px; }

.ktd-item-desc {
  flex: 1;
  min-width: 0;
  height: 22px;
  font-size: 11px;
}

.ktd-item-x {
  flex: none;
  color: #d1d5db;
  display: inline-flex;
}
.ktd-item-x svg { width: 10px; height: 10px; }

.ktd-item-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.ktd-mini { display: inline-flex; align-items: center; gap: 3px; font-size: 8.5px; color: var(--ktd-muted); }
.ktd-mini b { font-weight: 600; color: #9ca3af; }
.ktd-mini .ktd-mini-val {
  flex: none;
  min-width: 24px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  background: #ffffff;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ktd-ink);
  white-space: nowrap;
}
.ktd-mini .ktd-mini-val.is-focus {
  border-color: var(--ktd-blue);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.14);
}

.ktd-item-sum {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ktd-ink);
}

.ktd-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: var(--ktd-blue-50);
  color: var(--ktd-blue-700);
  font: 700 9.5px/1 var(--hd-font);
}
.ktd-add svg { width: 9px; height: 9px; }

.ktd-total-line {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #f3f4f6;
  font-size: 10px;
  color: var(--ktd-muted);
}
.ktd-total-line strong {
  font-size: 13px;
  font-weight: 800;
  color: var(--ktd-ink);
  font-variant-numeric: tabular-nums;
}

.ktd-actions { display: flex; align-items: center; gap: 6px; }

.ktd-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font: 700 10px/1 var(--hd-font);
  color: #ffffff;
  white-space: nowrap;
}
.ktd-btn svg { width: 10px; height: 10px; }
.ktd-btn.is-green { background: #16a34a; }
.ktd-btn.is-blue { background: var(--ktd-blue); min-width: 78px; justify-content: center; }
.ktd-btn.is-gray { background: #4b5563; }
.ktd-btn.is-wa { background: #16a34a; }
.ktd-btn.is-mail { background: #4f46e5; }
.ktd-btn.is-busy { background: var(--ktd-blue-700); }

.ktd-spin {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-top-color: #ffffff;
  animation: ktd-spin .7s linear infinite;
}
@keyframes ktd-spin { to { transform: rotate(360deg); } }

/* ── Kolom preview ────────────────────────────────────────────── */
.ktd-prev { display: flex; flex-direction: column; min-height: 0; }

.ktd-prev-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px 7px;
}

.ktd-prev-t {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
}

.ktd-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 8.5px;
  font-weight: 700;
}
.ktd-live i { width: 4px; height: 4px; border-radius: 50%; background: #10b981; }

.ktd-prev-actions { display: flex; align-items: center; gap: 5px; }

.ktd-chipbtn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: #f3f4f6;
  color: #4b5563;
  font: 600 9px/1 var(--hd-font);
  white-space: nowrap;
}
.ktd-chipbtn svg { width: 9px; height: 9px; }

.ktd-canvas {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--ktd-line);
  border-radius: 12px;
  background: #eef1f6;
  overflow: hidden;
}

.ktd-paper {
  width: 500px;
  max-height: 100%;
  padding: 20px 22px;
  border: 1px solid var(--ktd-line);
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 18px 40px -30px rgba(17, 24, 39, 0.45);
  color: #374151;
  font-size: 10.5px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}

.ktd-p-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ktd-line);
}

.ktd-p-co { font-size: 13px; font-weight: 800; color: var(--ktd-ink); }
.ktd-p-co-sub { font-size: 8.6px; font-weight: 500; color: var(--ktd-muted); margin-top: 2px; line-height: 1.5; }

.ktd-p-mark {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #2563eb, #1e40af);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .02em;
}

.ktd-p-title {
  margin: 10px 0 7px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--ktd-ink);
}

.ktd-p-info {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 8px;
  font-size: 9.2px;
}
.ktd-p-info td { width: 50%; padding: 1px 0; vertical-align: top; }
.ktd-p-info td:first-child { padding-right: 10px; }
.ktd-p-info td:last-child { text-align: right; }
.ktd-p-info .k { color: #9ca3af; margin-right: 3px; }
.ktd-p-info strong { color: var(--ktd-ink); font-weight: 700; white-space: nowrap; }
.ktd-p-info .due { color: #dc2626; }

.ktd-p-box {
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f9fafb;
  font-size: 9.2px;
  line-height: 1.5;
}
.ktd-p-box b { display: block; font-size: 8.4px; color: var(--ktd-muted); font-weight: 700; margin-bottom: 1px; }
.ktd-p-box .nm { font-size: 10.6px; font-weight: 700; color: var(--ktd-ink); }
.ktd-p-box .nm.is-ph { color: #9ca3af; font-weight: 500; }
.ktd-p-box > div[data-p-line] { min-height: 0; }

.ktd-p-sec { margin: 0 0 5px; font-size: 9.6px; font-weight: 700; color: #374151; }

.ktd-p-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 8.4px;
}
.ktd-p-table th {
  padding: 4px 3px;
  background: #f9fafb;
  border-bottom: 1px solid var(--ktd-line);
  color: #6b7280;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}
.ktd-p-table td {
  padding: 4px 3px;
  border-bottom: 1px solid #f3f4f6;
  color: #4b5563;
  vertical-align: top;
}
.ktd-p-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ktd-p-table .ctr { text-align: center; }
.ktd-p-table tbody td:last-child { text-align: right; font-weight: 700; color: var(--ktd-ink); }
.ktd-p-table .cno { width: 14px; }
.ktd-p-table .cqty { width: 20px; }
.ktd-p-table .cunit { width: 30px; }
.ktd-p-table .chrg { width: 58px; }
.ktd-p-table .cdisc { width: 34px; }
.ktd-p-table .ctax { width: 32px; }
.ktd-p-table .ctot { width: 62px; }

.ktd-p-totals { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--ktd-line); font-size: 9.2px; }
.ktd-p-totals .row { display: flex; justify-content: space-between; padding: 1px 0; }
.ktd-p-totals .grand {
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid var(--ktd-line);
  font-size: 14px;
  font-weight: 800;
  color: var(--ktd-ink);
}
.ktd-p-totals .grand span:last-child { font-variant-numeric: tabular-nums; }
.ktd-p-totals .grand.is-hit {
  border-radius: 4px;
  background: var(--ktd-blue-50);
  box-shadow: 0 0 0 4px var(--ktd-blue-50);
}

.ktd-p-words {
  margin-top: 6px;
  font-size: 8.6px;
  color: var(--ktd-muted);
  min-height: 12px;
  word-spacing: 0.16em;
}

.ktd-p-sign {
  margin-top: 16px;
  padding-top: 10px;
  text-align: right;
  font-size: 8.6px;
  color: var(--ktd-muted);
}
.ktd-p-sign-h { margin-bottom: 22px; }
.ktd-p-sign-name { font-size: 10px; font-weight: 700; color: var(--ktd-ink); }
.ktd-p-sign-role { font-size: 8.2px; }

/* Toast */
.ktd-toasts {
  position: absolute;
  top: 62px;
  right: 18px;
  width: 268px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.ktd-toast {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--ktd-line);
  border-left: 3px solid #16a34a;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px -18px rgba(17, 24, 39, 0.5);
}
.ktd-toast[hidden] { display: none; }
.ktd-toast .tk {
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #dcfce7;
  color: #15803d;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ktd-toast .tk svg { width: 8px; height: 8px; }
.ktd-toast .tt { font-size: 10px; font-weight: 700; color: var(--ktd-ink); line-height: 1.3; }
.ktd-toast .ts { font-size: 8.5px; color: var(--ktd-muted); line-height: 1.4; margin-top: 1px; word-break: break-all; }

/* Reduced motion: no blink, no spinner, no stage entrance. */
@media (prefers-reduced-motion: reduce) {
  .ktd-input.is-focus::after { animation: none; }
  .ktd-spin { animation: none; }
  .kt-demo .hd-stage { animation: none; }
}

@media (max-width: 639px) {
  .kt-demo-head { padding: 9px 11px; }
  .kt-demo-title { display: none; }
  .kt-demo-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 6px; }
  .kt-demo-steps button { min-height: 44px; }
}
