:root {
  --ink: #15201e;
  --muted: #64716e;
  --line: #d9e0dc;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --brand: #0f766e;
  --brand-dark: #075f58;
  --mint: #dff4ec;
  --warm: #fff8e8;
  --danger: #ba3f3c;
  --shadow: 0 18px 45px rgba(26, 45, 39, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: linear-gradient(180deg, #f0f6f2 0, var(--paper) 31rem); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; opacity: .55; }

.app-shell { width: min(1400px, calc(100% - 36px)); margin: 0 auto; padding: 20px 0 56px; }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-size: 1.16rem; font-weight: 800; letter-spacing: -.045em; text-decoration: none; }
.brand > span:last-child > span { color: var(--brand); }
.brand-mark { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 9px; color: #fff; background: var(--brand); font-size: 1.1rem; }
.privacy-note { display: inline-flex; align-items: center; gap: 7px; margin: 0; color: #42645c; font-size: .82rem; font-weight: 650; }
.privacy-note span { color: #21a366; font-size: .72rem; }

.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px; padding: 76px 8px 38px; }
.eyebrow, .step { margin: 0 0 10px; color: var(--brand); font-size: .69rem; font-weight: 800; letter-spacing: .14em; }
.hero h1 { max-width: 680px; margin: 0; font-size: clamp(2.45rem, 5vw, 4.85rem); line-height: .97; letter-spacing: -.075em; }
.hero-copy { max-width: 650px; margin: 22px 0 0; color: #50605b; font-size: 1.04rem; line-height: 1.65; }
.flow { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px solid #c9e2d9; border-radius: 14px; color: #245248; background: #effaf5; font-size: .8rem; font-weight: 720; white-space: nowrap; }
.flow b { color: #75a999; font-size: 1rem; }

.workspace { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(340px, 1.1fr); gap: 18px; align-items: start; }
.panel { min-width: 0; padding: 24px; border: 1px solid rgba(208, 219, 214, .9); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel h2 { margin: 0; font-size: 1.12rem; letter-spacing: -.035em; }
.text-button { padding: 3px 0; border: 0; color: var(--danger); background: transparent; font-size: .78rem; font-weight: 720; }

.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 196px; margin: 22px 0 12px; border: 1.5px dashed #98bcb0; border-radius: 16px; color: #507068; background: #f9fcfa; text-align: center; transition: .18s ease; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--brand); color: var(--brand); background: #f0faf5; transform: translateY(-1px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { margin: 10px 0 5px; color: var(--ink); font-size: .94rem; }
.drop-zone span:last-child { font-size: .76rem; }
.upload-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: #fff; background: var(--brand); font-size: 1.35rem; font-weight: 500; }
.image-stage { position: relative; display: grid; min-height: 128px; overflow: hidden; place-items: center; border-radius: 14px; background: #eef2ef; }
.image-stage.is-empty { border: 1px solid var(--line); background: #fbfcfb; }
.image-stage p { margin: 14px; color: #71807c; font-size: .78rem; text-align: center; }
.image-stage img { display: block; width: 100%; max-height: 260px; object-fit: contain; background: #e8ece9; }
.photo-options { display: flex; align-items: end; gap: 12px; margin: 12px 0 18px; }
select, .field input { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #cfd9d5; border-radius: 9px; outline: none; color: var(--ink); background: #fff; font-size: .84rem; }
select:focus, .field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }
.switch-line { display: inline-flex; align-items: center; gap: 7px; padding-bottom: 9px; color: #51635e; font-size: .73rem; font-weight: 720; white-space: nowrap; }
.switch-line input { width: 15px; height: 15px; margin: 0; accent-color: var(--brand); }
.primary-button, .print-button { width: 100%; padding: 13px 15px; border: 0; border-radius: 11px; color: #fff; background: var(--brand); box-shadow: 0 7px 14px rgba(15, 118, 110, .16); font-size: .88rem; font-weight: 780; transition: .18s ease; }
.primary-button:hover:not(:disabled), .print-button:hover:not(:disabled) { background: var(--brand-dark); transform: translateY(-1px); }
.status { min-height: 20px; margin: 11px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.4; }
.status.is-error { color: var(--danger); }

.type-badge { padding: 6px 9px; border-radius: 99px; color: #60706a; background: #eef1ef; font-size: .68rem; font-weight: 780; white-space: nowrap; }
.type-badge[data-type="retail"] { color: #456137; background: #ebf6df; }
.type-badge[data-type="bank"] { color: #265f8d; background: #e5f2fc; }
.type-badge[data-type="pulsa"] { color: #89541d; background: #fff0d7; }
.muted-copy { margin: 24px 0 0; color: var(--muted); font-size: .83rem; line-height: 1.6; }
.receipt-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.field { display: grid; gap: 6px; }
.field span { color: #52615d; font-size: .7rem; font-weight: 760; }
.field.full-width { grid-column: 1 / -1; }
.field.is-low-confidence input { border-color: #dda74d; background: #fffdf5; }
.field.is-low-confidence span::after { content: " · periksa"; color: #b57918; font-weight: 680; }
.raw-text { margin-top: 18px; border-top: 1px solid var(--line); }
.raw-text summary { padding: 13px 0 0; color: #45635b; font-size: .76rem; font-weight: 720; cursor: pointer; }
.raw-text pre { max-height: 180px; overflow: auto; margin: 12px 0 0; padding: 11px; border-radius: 9px; color: #43514d; background: #f5f7f5; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .69rem; white-space: pre-wrap; }

.preview-controls { display: flex; align-items: end; gap: 9px; }
.compact-select { display: grid; gap: 4px; }
.compact-select > span { color: var(--muted); font-size: .64rem; font-weight: 700; }
.compact-select select { padding: 7px; font-size: .73rem; }
.compact-switch { padding: 0 0 7px; }
.preview-wrap { display: grid; min-height: 414px; margin: 22px 0 16px; place-items: start center; overflow: auto; border-radius: 14px; background: #e8eeea; }
.thermal-receipt { width: 270px; min-height: 365px; margin: 22px; padding: 18px 16px 28px; color: #111; background: #fff; box-shadow: 0 7px 14px rgba(19, 31, 27, .18); font-family: "Courier New", Courier, monospace; font-size: 10px; line-height: 1.42; }
.thermal-receipt.receipt-80 { width: 340px; }
.thermal-receipt.receipt-photo { min-height: 0; padding: 0; overflow: hidden; background: #fff; }
.thermal-image { display: block; width: 100%; height: auto; image-rendering: crisp-edges; }
.receipt-empty { display: grid; min-height: 280px; place-content: center; gap: 10px; color: #73817b; text-align: center; font-family: Inter, ui-sans-serif, sans-serif; }
.receipt-empty span { color: #92a79f; font-size: 2rem; }
.receipt-empty p { max-width: 150px; margin: 0; font-size: .76rem; line-height: 1.5; }
.receipt-head { text-align: center; }
.receipt-head strong { display: block; font-size: 12px; line-height: 1.28; }
.receipt-head p, .receipt-foot p { margin: 3px 0; }
.receipt-rule { margin: 10px 0; border: 0; border-top: 1px dashed #111; }
.receipt-row { display: flex; justify-content: space-between; gap: 10px; }
.receipt-row + .receipt-row { margin-top: 3px; }
.receipt-row span:first-child { max-width: 47%; }
.receipt-row span:last-child { overflow-wrap: anywhere; text-align: right; }
.receipt-total { margin-top: 5px; font-size: 11px; font-weight: 700; }
.receipt-foot { margin-top: 10px; text-align: center; }
.receipt-code { margin-top: 11px; letter-spacing: 1px; text-align: center; }
.receipt-items { display: grid; gap: 5px; }
.receipt-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: start; }
.receipt-item span:first-child { overflow-wrap: anywhere; }
.receipt-item span:last-child { white-space: nowrap; text-align: right; }
.print-button { background: #202d29; box-shadow: none; }
.print-button:hover:not(:disabled) { background: #0e1613; }
.print-note { margin: 9px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; text-align: center; }

.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.trust-grid article { padding: 19px 20px; border: 1px solid #dfe8e3; border-radius: 15px; background: rgba(255,255,255,.68); }
.trust-grid article > span { color: var(--brand); font-size: 1.25rem; }
.trust-grid h3 { margin: 10px 0 5px; font-size: .88rem; letter-spacing: -.02em; }
.trust-grid p { margin: 0; color: #677671; font-size: .76rem; line-height: 1.55; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr 1fr; }
  .preview-wrap { min-height: 330px; }
}
@media (max-width: 700px) {
  .app-shell { width: min(100% - 24px, 600px); padding-top: 10px; }
  .privacy-note { font-size: .7rem; }
  .hero { grid-template-columns: 1fr; gap: 22px; padding: 45px 1px 26px; }
  .hero h1 { font-size: clamp(2.6rem, 14vw, 4rem); }
  .hero-copy { font-size: .95rem; }
  .flow { justify-content: center; font-size: .72rem; }
  .workspace { grid-template-columns: 1fr; }
  .preview-panel { grid-column: auto; }
  .panel { padding: 19px; border-radius: 16px; }
  .trust-grid { grid-template-columns: 1fr; }
  .photo-options { align-items: start; flex-direction: column; }
  .receipt-form { grid-template-columns: 1fr; }
  .field.full-width { grid-column: auto; }
}

@media print {
  @page { margin: 0; size: auto; }
  body { background: #fff; }
  .app-shell > :not(.workspace), .workspace > :not(.preview-panel), .preview-panel > :not(.preview-wrap) { display: none !important; }
  .workspace, .preview-panel, .preview-wrap { display: block !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: #fff !important; box-shadow: none !important; }
  .thermal-receipt { margin: 0 !important; box-shadow: none !important; }
  .thermal-receipt.receipt-photo { padding: 0 !important; }
  .thermal-receipt.receipt-58 { width: 58mm !important; }
  .thermal-receipt.receipt-80 { width: 80mm !important; }
}
