:root {
  --bg: #f4f5f8;
  --card: #ffffff;
  --card-2: #f9fafb;
  --text: #15171c;
  --muted: #687082;
  --line: #e3e6ec;
  --accent: #4338ca;
  --accent-ink: #ffffff;
  --accent-soft: #eceafe;
  --ok: #157f3c;
  --ok-soft: #dcf5e4;
  --warn: #a35a00;
  --warn-soft: #fdf0d5;
  --bad: #b42318;
  --bad-soft: #fde4e1;
  --info: #0b6aa2;
  --info-soft: #ddf0fb;
  --ungu: #7e22ce;
  --ungu-soft: #f2e5fd;
  --teal: #0f766e;
  --teal-soft: #d7f4f0;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f13; --card: #181a20; --card-2: #1e2028; --text: #eceef3; --muted: #9399a8; --line: #2a2d37;
    --accent: #8b85ff; --accent-ink: #0e0f13; --accent-soft: #25234a;
    --ok: #4ade80; --ok-soft: #12301e; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1717;
    --info: #60c3f5; --info-soft: #0f2a3a; --ungu: #d19bff; --ungu-soft: #2c1a3d; --teal: #4fd1c5; --teal-soft: #0f2d2a;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0f13; --card: #181a20; --card-2: #1e2028; --text: #eceef3; --muted: #9399a8; --line: #2a2d37;
  --accent: #8b85ff; --accent-ink: #0e0f13; --accent-soft: #25234a;
  --ok: #4ade80; --ok-soft: #12301e; --warn: #fbbf24; --warn-soft: #33270b; --bad: #f87171; --bad-soft: #3a1717;
  --info: #60c3f5; --info-soft: #0f2a3a; --ungu: #d19bff; --ungu-soft: #2c1a3d; --teal: #4fd1c5; --teal-soft: #0f2d2a;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.memuat { padding: 40vh 0 0; text-align: center; color: var(--muted); }
.redup { color: var(--muted); }
.kecil { font-size: 13px; }
.angka { font-variant-numeric: tabular-nums; }
.kanan { text-align: right; }
.tebal { font-weight: 650; }
[hidden] { display: none !important; }

/* ---------- kerangka ---------- */
.kerangka { min-height: 100vh; }
.samping { display: none; }
.utama { padding: 16px 16px 96px; max-width: 980px; margin: 0 auto; }
.kepala { display: flex; align-items: center; gap: 12px; margin: 4px 0 16px; min-height: 40px; }
.kepala h1 { flex: 1; min-width: 0; }
.kepala .kembali { margin-left: -8px; }
.bawah {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.bawah a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 7px;
  font-size: 11px; color: var(--muted);
}
.bawah a.aktif { color: var(--accent); }
.bawah a svg { width: 22px; height: 22px; }
.bawah a.tambah span.bulat {
  width: 44px; height: 44px; margin-top: -18px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; box-shadow: 0 4px 12px rgba(67, 56, 202, .35);
}
@media (min-width: 900px) {
  .kerangka { display: grid; grid-template-columns: 232px 1fr; }
  .samping {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh;
    padding: 20px 12px; background: var(--card); border-right: 1px solid var(--line);
  }
  .samping .merek { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; }
  .samping .merek img { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; }
  .samping a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--text); }
  .samping a svg { width: 19px; height: 19px; color: var(--muted); }
  .samping a:hover { background: var(--card-2); }
  .samping a.aktif { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .samping a.aktif svg { color: var(--accent); }
  .samping .tombol { margin: 0 4px 14px; justify-content: center; }
  .samping .bawah-samping { margin-top: auto; }
  .bawah { display: none; }
  .utama { padding: 28px 32px 48px; }
}

/* ---------- komponen ---------- */
.kartu { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kartu.isi { padding: 16px; }
.judul-blok { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 22px 0 10px; }
.judul-blok:first-child { margin-top: 0; }

.tombol {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.tombol:hover { background: var(--card-2); }
.tombol svg { width: 18px; height: 18px; }
.tombol.utama-t { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tombol.utama-t:hover { filter: brightness(1.06); }
.tombol.bahaya { color: var(--bad); }
.tombol.hijau { background: #1da851; border-color: #1da851; color: #fff; }
.tombol.kecil { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.tombol.ikon { padding: 0; width: 40px; }
.tombol.polos { border-color: transparent; background: transparent; }
.tombol:disabled { opacity: .55; cursor: default; }
.baris-tombol { display: flex; flex-wrap: wrap; gap: 8px; }

.lencana {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: var(--card-2); color: var(--muted);
}
.st-Baru { background: var(--info-soft); color: var(--info); }
.st-Desain { background: var(--ungu-soft); color: var(--ungu); }
.st-Cetak { background: var(--accent-soft); color: var(--accent); }
.st-Finishing { background: var(--warn-soft); color: var(--warn); }
.st-Siap { background: var(--teal-soft); color: var(--teal); }
.st-Selesai { background: var(--ok-soft); color: var(--ok); }
.st-Batal { background: var(--card-2); color: var(--muted); text-decoration: line-through; }
.by-Lunas { background: var(--ok-soft); color: var(--ok); }
.by-DP { background: var(--warn-soft); color: var(--warn); }
.by-Belum { background: var(--bad-soft); color: var(--bad); }

/* form */
.isian { display: grid; gap: 12px; }
.isian.dua { grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .isian.dua { grid-template-columns: 1fr; } }
label.f { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); font-weight: 400; font-size: 15px;
}
textarea.inp { min-height: 64px; resize: vertical; }
.inp:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.segmen { display: flex; padding: 3px; gap: 3px; background: var(--card-2); border: 1px solid var(--line); border-radius: 11px; }
.segmen button { flex: 1; min-height: 36px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted); }
.segmen button.aktif { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }

.cari { position: relative; flex: 1; min-width: 180px; }
.cari svg { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--muted); }
.cari .inp { padding-left: 36px; }
.saring { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.saring::-webkit-scrollbar { display: none; }
.saring button {
  flex: none; padding: 6px 13px; border-radius: 99px; border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.saring button.aktif { background: var(--text); border-color: var(--text); color: var(--bg); }
.saring button b { font-weight: 700; margin-left: 4px; opacity: .7; }

/* statistik */
.statistik { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 760px) { .statistik { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 14px 16px; }
.stat .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.stat .nil { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .ket { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pita-status { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.pita-status a { padding: 10px 6px; text-align: center; border-radius: 12px; color: inherit; }
.pita-status a .n { font-size: 20px; font-weight: 700; display: block; }
.pita-status a .t { font-size: 12px; font-weight: 600; }

/* daftar */
.daftar { display: grid; grid-template-columns: minmax(0, 1fr); }
.daftar > .baris { display: flex; gap: 12px; align-items: center; padding: 13px 16px; border-top: 1px solid var(--line); color: inherit; cursor: pointer; }
.daftar > .baris:first-child { border-top: 0; }
.daftar > .baris:hover { background: var(--card-2); }
.baris .tengah { flex: 1; min-width: 0; }
.baris .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.baris .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.baris .ujung { text-align: right; display: grid; gap: 4px; justify-items: end; }
.kosong { padding: 36px 16px; text-align: center; color: var(--muted); }
.telat { color: var(--bad); font-weight: 600; }
.dekat { color: var(--warn); font-weight: 600; }

/* item pesanan (form) */
.item-form { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--card-2); }
.item-form + .item-form { margin-top: 10px; }
.item-form .atas { display: flex; gap: 8px; align-items: center; }
.item-form .atas .no { width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.item-form .angka-item { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 8px; }
.item-form .jumlah { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.total-form { display: grid; gap: 8px; }
.total-form .r { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.total-form .r .inp { max-width: 170px; text-align: right; }
.total-form .besar { font-size: 19px; font-weight: 700; }

/* detail */
.langkah { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 6px; }
.langkah button {
  min-height: 36px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.langkah button.lewat { color: var(--text); }
.langkah button.aktif { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tabel { width: 100%; border-collapse: collapse; }
.tabel th, .tabel td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabel th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tabel td.k, .tabel th.k { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabel tr:last-child td { border-bottom: 0; }
.hp-saja { display: none; }
@media (max-width: 600px) {
  .tabel .sembunyi-hp { display: none; }
  .tabel .hp-saja { display: block; }
}
.ringkas { display: grid; gap: 6px; padding: 14px 16px; border-top: 1px solid var(--line); }
.ringkas .r { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.ringkas .r.besar { font-size: 17px; font-weight: 700; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.info-grid .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.dua-kolom { display: grid; gap: 14px; }
@media (min-width: 900px) {
  .dua-kolom { grid-template-columns: 1.6fr 1fr; align-items: start; }
  .lekat { position: sticky; top: 20px; }
}
.dua-kolom > div { min-width: 0; }
.dua-kolom > div > .kartu + .kartu, form.dua-kolom section + section { margin-top: 14px; }

/* menu (HP) */
.menu-daftar a { display: flex; align-items: center; gap: 12px; padding: 15px 16px; border-top: 1px solid var(--line); color: var(--text); }
.menu-daftar a:first-child { border-top: 0; }
.menu-daftar a svg { width: 20px; height: 20px; color: var(--muted); }

/* login */
.masuk { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.masuk .kotak { width: 100%; max-width: 340px; text-align: center; }
.masuk .logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; overflow: hidden; }
.masuk .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.titik { display: flex; justify-content: center; gap: 12px; margin: 22px 0 8px; }
.titik i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--line); }
.titik i.isi { background: var(--accent); border-color: var(--accent); }
.pesan-salah { min-height: 22px; color: var(--bad); font-size: 13px; font-weight: 600; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.pad button { height: 60px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); font-size: 22px; font-weight: 600; cursor: pointer; }
.pad button:active { background: var(--accent-soft); }
.pad button.polos { border-color: transparent; background: transparent; font-size: 14px; color: var(--muted); }

/* modal & toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10, 12, 18, .5); display: flex; align-items: flex-end; justify-content: center; }
.modal .jendela {
  width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--card); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .modal { align-items: center; } .modal .jendela { border-radius: 18px; padding: 22px; } }
.modal .jendela h2 { margin-bottom: 14px; }
.modal .aksi { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}
.toast.salah { background: var(--bad); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- invoice ---------- */
.invoice { background: #fff; color: #111; border-radius: 6px; padding: 32px; max-width: 800px; margin: 0 auto; font-size: 13.5px; border: 1px solid var(--line); }
.invoice .ih { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 18px; border-bottom: 2px solid #111; }
.invoice .ih .usaha { display: flex; gap: 14px; align-items: flex-start; }
.invoice .ih img { width: 64px; height: 64px; object-fit: contain; }
.invoice .ih .nm { font-size: 18px; font-weight: 800; }
.invoice .ih .judul-inv { text-align: right; }
.invoice .ih .judul-inv .besar { font-size: 26px; font-weight: 800; letter-spacing: .06em; }
.invoice .ib { display: flex; justify-content: space-between; gap: 24px; margin: 18px 0; }
.invoice .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #666; font-weight: 700; }
.invoice table { width: 100%; border-collapse: collapse; }
.invoice th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #444; border-top: 1px solid #111; border-bottom: 1px solid #111; padding: 8px 6px; }
.invoice td { padding: 8px 6px; border-bottom: 1px solid #ddd; vertical-align: top; }
.invoice .k { text-align: right; white-space: nowrap; }
.invoice .spek { color: #555; font-size: 12px; white-space: pre-line; }
.invoice .it { display: flex; justify-content: space-between; gap: 24px; margin-top: 16px; }
.invoice .totals { min-width: 260px; }
.invoice .totals .r { display: flex; justify-content: space-between; gap: 16px; padding: 3px 0; }
.invoice .totals .r.g { border-top: 1px solid #111; margin-top: 4px; padding-top: 7px; font-weight: 800; font-size: 15px; }
.invoice .cap { display: inline-block; border: 2px solid currentColor; border-radius: 6px; padding: 3px 10px; font-weight: 800; letter-spacing: .08em; transform: rotate(-4deg); margin-top: 10px; }
.invoice .cap.Lunas { color: #157f3c; }
.invoice .cap.DP { color: #a35a00; }
.invoice .cap.Belum { color: #b42318; }
.invoice .kaki { margin-top: 26px; padding-top: 14px; border-top: 1px solid #ddd; white-space: pre-line; color: #333; font-size: 12.5px; }
@media (max-width: 600px) {
  .invoice { padding: 18px 14px; font-size: 12.5px; }
  .invoice .ih, .invoice .ib, .invoice .it { flex-direction: column; gap: 12px; }
  .invoice .ih .judul-inv, .invoice .ib .kn { text-align: left; }
  .invoice .totals { min-width: 0; }
}

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; }
  .samping, .bawah, .kepala, .no-print, .toast, .modal { display: none !important; }
  .kerangka { display: block; }
  .utama { padding: 0; max-width: none; }
  .invoice { border: 0; padding: 0; max-width: none; }
}
