/* Sistem Delivery Order — semua warna antara muka melalui token; Mod Gelap ikut tetapan telefon. */
:root {
  --bg: #f4f5f8; --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(245, 158, 11, .10), transparent 60%);
  --panel: #ffffff; --panel2: #f8fafc; --line: #e6e8ee; --line2: #d3d8e1;
  --text: #0b1220; --text2: #334155; --muted: #667085; --dim: #98a2b3;
  --brand: #f59e0b; --brand2: #fbbf24; --brand-deep: #b45309; --brand-ink: #92400e; --brand-soft: #fff4dc;
  --nav: #0b1220; --nav2: #141c2e; --nav-ink: #a8b3c7;
  --ok: #047857; --ok-soft: #dcfce7; --okb: #059669; --warn: #b45309; --warn-soft: #fef3c7; --err: #be123c; --err-soft: #ffe4e6;
  --info: #1d4ed8; --info-soft: #e0eaff; --field: #ffffff; --scrim: rgba(11, 18, 32, .55);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .06), 0 12px 32px rgba(16, 24, 40, .06);
  --r: 16px; --r-sm: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
/* Mod Malam: ikut telefon (Auto) kecuali dipaksa Siang; atau dipaksa Malam (butang tema, js/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b14; --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(245, 158, 11, .10), transparent 60%);
    --panel: #0f1626; --panel2: #0b1220; --line: #1c2538; --line2: #2a3550;
    --text: #f1f5f9; --text2: #cbd5e1; --muted: #94a3b8; --dim: #64748b;
    --brand-ink: #fcd34d; --brand-soft: rgba(245, 158, 11, .14); --nav: #050810; --nav2: #0c1322;
    --ok: #6ee7b7; --ok-soft: rgba(16, 185, 129, .15); --warn: #fcd34d; --warn-soft: rgba(245, 158, 11, .15);
    --err: #fda4af; --err-soft: rgba(244, 63, 94, .15); --info: #93c5fd; --info-soft: rgba(59, 130, 246, .15);
    --field: #0a1120; --scrim: rgba(0, 0, 0, .65); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #070b14; --bg-grad: radial-gradient(1200px 500px at 85% -10%, rgba(245, 158, 11, .10), transparent 60%);
  --panel: #0f1626; --panel2: #0b1220; --line: #1c2538; --line2: #2a3550;
  --text: #f1f5f9; --text2: #cbd5e1; --muted: #94a3b8; --dim: #64748b;
  --brand-ink: #fcd34d; --brand-soft: rgba(245, 158, 11, .14); --nav: #050810; --nav2: #0c1322;
  --ok: #6ee7b7; --ok-soft: rgba(16, 185, 129, .15); --warn: #fcd34d; --warn-soft: rgba(245, 158, 11, .15);
  --err: #fda4af; --err-soft: rgba(244, 63, 94, .15); --info: #93c5fd; --info-soft: rgba(59, 130, 246, .15);
  --field: #0a1120; --scrim: rgba(0, 0, 0, .65); --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-md: 0 8px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--sans); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; background-image: var(--bg-grad); background-repeat: no-repeat; }
[hidden] { display: none !important; }
a { color: var(--info); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; font-family: var(--display); }
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
h2 { font-size: 17px; font-weight: 750; letter-spacing: -.01em; }
h3 { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
p { margin: 0; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 4px; flex-wrap: nowrap; }
.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; } .grow2 { flex: 2 1 auto; }
.stack > * + * { margin-top: 14px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.mono-b { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.pre { white-space: pre-line; word-break: break-word; }
.eyebrow { font-size: 13px; font-weight: 650; color: var(--brand-deep); margin-bottom: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .eyebrow { color: var(--brand2); } }
:root[data-theme="dark"] .eyebrow { color: var(--brand2); }
.hide-svg { position: absolute; width: 0; height: 0; overflow: hidden; }
@media (max-width: 520px) { .hide-sm { display: none; } }
@media (min-width: 1100px) { .hide-lg { display: none !important; } }

/* Butang & medan */
.btn { appearance: none; border: 1px solid var(--line2); background: var(--panel); color: var(--text); font: 650 14.5px/1 var(--sans);
  padding: 12px 16px; border-radius: 12px; display: inline-flex; gap: 8px; align-items: center; justify-content: center; cursor: pointer; min-height: 46px;
  box-shadow: var(--shadow); transition: transform .08s, background .15s, border-color .15s, box-shadow .15s; white-space: nowrap; }
.btn:hover { border-color: var(--dim); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.pri { background: linear-gradient(180deg, var(--brand2), var(--brand)); border-color: #e48d06; color: #1c1300; box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 6px 16px rgba(245, 158, 11, .28); }
.btn.dark { background: var(--nav); border-color: var(--nav); color: #fff; }
.btn.ok { background: linear-gradient(180deg, #10b981, var(--okb)); border-color: var(--okb); color: #fff; box-shadow: 0 6px 16px rgba(5, 150, 105, .25); }
.btn.danger { color: var(--err); border-color: transparent; background: var(--err-soft); box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.sm { min-height: 38px; padding: 8px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { min-height: 52px; font-size: 16px; padding: 14px 20px; border-radius: 14px; }
.btn.block { width: 100%; white-space: normal; text-align: center; line-height: 1.25; }
.back { appearance: none; border: 0; background: none; color: var(--muted); font: 650 14px/1 var(--sans); display: inline-flex; align-items: center; gap: 4px; padding: 6px 0 10px; cursor: pointer; }
.icon-btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text2); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; }
.icon-btn .ico { width: 16px; height: 16px; }
.icon-btn.danger { color: var(--err); background: var(--err-soft); border-color: transparent; }
.icon-btn:disabled { opacity: .35; }
label.f { display: block; }
label.f > span, .f > span, .lbl-sm { display: block; font-size: 12.5px; font-weight: 650; color: var(--text2); margin-bottom: 6px; }
input, select, textarea { width: 100%; font: 16px/1.35 var(--sans); color: var(--text); background: var(--field); border: 1px solid var(--line2);
  border-radius: 12px; padding: 11px 13px; min-height: 48px; transition: border-color .15s, box-shadow .15s; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea { resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245, 158, 11, .18); }
input:disabled, textarea:disabled, select:disabled { opacity: .65; }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; accent-color: var(--brand); flex: none; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--text2); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } .span2 { grid-column: span 2; } }

/* Kad */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); }
.card + .card, section.card + section.card { margin-top: 14px; }
.card-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 4px; }
.sec-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-h .num { width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-ink); font: 800 13px/26px var(--sans); text-align: center; flex: none; }
.pill { display: inline-block; font: 700 12px/1 var(--sans); padding: 6px 9px; border-radius: 999px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); letter-spacing: 0; text-transform: none; }
.note { background: var(--info-soft); color: var(--info); border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.note .ico { width: 17px; height: 17px; vertical-align: -3px; margin-right: 4px; }
.note .btn { margin-left: 6px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.err { background: var(--err-soft); color: var(--err); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.badge { display: inline-flex; align-items: center; gap: 5px; font: 750 12px/1 var(--sans); padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.lg { font-size: 13.5px; padding: 8px 13px; }
.st-completed { background: var(--ok-soft); color: var(--ok); }
.st-pending { background: var(--warn-soft); color: var(--warn); }
.st-cancelled { background: var(--err-soft); color: var(--err); }
.b-role { background: var(--info-soft); color: var(--info); }
.b-role::before, .b-lama::before { display: none; }
.b-lama { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); font-size: 11px; padding: 4px 8px; }

/* Skrin log masuk */
.center { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(900px 500px at 80% -10%, rgba(245, 158, 11, .25), transparent 60%), radial-gradient(700px 400px at 0% 110%, rgba(59, 130, 246, .18), transparent 60%), var(--nav); }
.auth { width: 100%; max-width: 410px; background: var(--panel); border-radius: 24px; padding: 30px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); border: 1px solid rgba(255, 255, 255, .06); }
.logo-mark { width: 60px; height: 60px; border-radius: 18px; background: linear-gradient(145deg, var(--brand2), var(--brand-deep)); color: #1c1300; display: grid; place-items: center; margin: 0 auto 14px; box-shadow: 0 10px 24px rgba(245, 158, 11, .35); }
.logo-mark .ico { width: 30px; height: 30px; }
.auth h1 { text-align: center; font-size: 23px; }
.auth .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 22px; }
.foot { text-align: center; font-size: 11.5px; color: var(--dim); margin-top: 20px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.spin-sm { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(0, 0, 0, .2); border-top-color: currentColor; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Rangka aplikasi */
.top { position: sticky; top: 0; z-index: 30; background: rgba(11, 18, 32, .92); -webkit-backdrop-filter: saturate(160%) blur(14px); backdrop-filter: saturate(160%) blur(14px);
  color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.top .mark { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(145deg, var(--brand2), var(--brand-deep)); color: #1c1300; display: grid; place-items: center; flex: none; }
.top > div:nth-child(2) { min-width: 0; }
.top .t1 { font-weight: 800; font-size: 15.5px; line-height: 1.15; letter-spacing: -.01em; }
.top .t2 { font-size: 11.5px; color: var(--brand2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.top .who { margin-left: auto; text-align: right; font-size: 12px; color: var(--nav-ink); line-height: 1.25; min-width: 0; }
.top .who b { color: #fff; display: block; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .btn.dark { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .08); box-shadow: none; }
.side { display: none; }
.nav-m { position: fixed; left: 10px; right: 10px; bottom: calc(env(safe-area-inset-bottom) + 8px); z-index: 30; background: rgba(11, 18, 32, .94);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); display: flex; justify-content: space-around; padding: 6px; border-radius: 20px; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .06); }
.nav-m button, .side button { appearance: none; background: none; border: 0; color: var(--nav-ink); font: 650 11px/1.1 var(--sans); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 7px 8px; border-radius: 14px; cursor: pointer; flex: 1; }
.nav-m button.on { color: #1c1300; background: linear-gradient(180deg, var(--brand2), var(--brand)); }
.side button.on { color: #fff; background: rgba(255, 255, 255, .08); }
.side button.on .ico { color: var(--brand2); }
.nav-m .ico { width: 22px; height: 22px; }
main { padding: 18px 16px calc(env(safe-area-inset-bottom) + 104px); max-width: 1180px; margin: 0 auto; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 59px; height: calc(100vh - 59px); background: var(--nav); padding: 16px 12px; }
  .side button { flex-direction: row; font-size: 14.5px; gap: 12px; padding: 12px 14px; width: 100%; flex: 0 0 auto; }
  .nav-m { display: none; }
  main { padding: 28px 32px 48px; width: 100%; }
}
.shell > *, .form-grid > * { min-width: 0; }
.page-h { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h p { margin-top: 5px; color: var(--muted); font-size: 14px; }
.doh { word-break: break-all; font-size: 24px; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.hero h1 { font-size: 30px; }

/* Jubin statistik */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, 1fr); gap: 14px; } }
.tile { appearance: none; text-align: left; font: inherit; color: inherit; cursor: pointer; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; transition: transform .1s, box-shadow .15s; }
.tile:active { transform: scale(.98); }
.tile .ti { grid-row: span 2; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.tile .k { font-size: 12px; font-weight: 650; color: var(--muted); line-height: 1.2; }
.tile .v { font: 800 24px/1.1 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.t-brand .ti { background: var(--brand-soft); color: var(--brand-ink); }
.t-warn .ti { background: var(--warn-soft); color: var(--warn); }
.t-ok .ti { background: var(--ok-soft); color: var(--ok); }
.t-ink .ti { background: var(--info-soft); color: var(--info); }

/* Carian & senarai */
.searchbar { position: relative; }
.searchbar .ico { position: absolute; left: 14px; top: 15px; color: var(--dim); }
.searchbar input { padding-left: 42px; border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.filters-row { margin: 12px 0 10px; flex-wrap: nowrap; }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; flex: 1; min-width: 0; }
.filters::-webkit-scrollbar { display: none; }
.chip { appearance: none; border: 1px solid var(--line2); background: var(--panel); color: var(--text2); font: 650 13.5px/1 var(--sans); padding: 9px 14px; border-radius: 999px; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.list { display: grid; gap: 10px; }
.group { font: 750 12px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 4px 2px; }
.do-card { position: relative; display: block; width: 100%; text-align: left; appearance: none; font: inherit; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px 14px 19px; box-shadow: var(--shadow); cursor: pointer; overflow: hidden; transition: transform .08s, box-shadow .15s; }
.do-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ok); }
.do-card.s-pending::before { background: var(--brand); }
.do-card.s-cancelled::before { background: var(--err); }
.do-card:hover { box-shadow: var(--shadow-md); }
.do-card:active { transform: scale(.99); }
.do-card .no { font-weight: 800; font-size: 14.5px; word-break: break-all; font-variant-numeric: tabular-nums; }
.do-card .recv { font-weight: 650; font-size: 15.5px; color: var(--text); margin-top: 4px; }
.do-card .items-sum { font-size: 13px; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.do-card .meta { font-size: 12.5px; color: var(--muted); margin-top: 9px; display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; }
.do-card .meta span { display: inline-flex; gap: 5px; align-items: center; }
.do-card .meta .ico { width: 14px; height: 14px; }
.okc { color: var(--ok); font-weight: 650; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; font-size: 14px; display: grid; gap: 6px; justify-items: center; background: var(--panel); border: 1px dashed var(--line2); border-radius: var(--r); }
.empty .ico { width: 34px; height: 34px; color: var(--dim); margin-bottom: 4px; }
.empty b { color: var(--text); font-size: 16px; }
.more { margin-top: 6px; text-align: center; }
.skel { height: 96px; border-radius: var(--r); background: linear-gradient(90deg, var(--panel) 0%, var(--panel2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: sk 1.2s infinite; border: 1px solid var(--line); }
@keyframes sk { to { background-position: -200% 0; } }

/* Lihat DO */
.view-card { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.view-card > *, .modal > *, .stack > * { min-width: 0; }
.who-box .lbl { font: 750 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--brand-deep); margin-bottom: 6px; }
.who-box b { font-size: 17px; display: block; }
.who-box > * + * { margin-top: 3px; }
.act-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 640px) { .act-grid { grid-template-columns: repeat(5, 1fr); } }
.act { min-width: 0; appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text); border-radius: 14px; padding: 12px 6px; display: grid; justify-items: center; gap: 6px; font: 650 12.5px/1.15 var(--sans); cursor: pointer; min-height: 70px; text-align: center; }
.act .ico { width: 22px; height: 22px; }
.act.pri { background: linear-gradient(180deg, var(--brand2), var(--brand)); border-color: #e48d06; color: #1c1300; box-shadow: 0 6px 16px rgba(245, 158, 11, .25); }
.act:active { transform: scale(.97); }
.act:disabled { opacity: .45; }
.status-row { align-items: flex-end; border-top: 1px solid var(--line); padding-top: 14px; }

/* Kertas pratonton (canvas) */
.paper { margin-top: 16px; background: linear-gradient(180deg, #e7eaf0, #dfe3ea); border-radius: var(--r); padding: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .paper { background: #131b2c; } }
:root[data-theme="dark"] .paper { background: #131b2c; }
.pv-pages { display: grid; gap: 12px; }
.pv-pages canvas.page { width: 100%; height: auto; aspect-ratio: 210 / 297; display: block; background: #fff; border-radius: 4px; box-shadow: 0 2px 10px rgba(16, 24, 40, .14); }
.pv-head { display: flex; justify-content: space-between; align-items: center; margin: 0 2px 10px; }
.preview-col .paper { margin-top: 0; }

/* Borang DO */
.form-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } .preview-col { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; } }
.preview-col { scroll-margin-top: 70px; }
.item { border: 1px solid var(--line); background: var(--panel2); border-radius: 14px; padding: 12px; margin-top: 12px; }
.item-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-h b { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 9px; background: var(--text); color: var(--bg); font: 800 13px/28px var(--sans); text-align: center; }
.item-f { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.item-f .wide { grid-column: span 2; }
.item-f label > span, .item-f .f > span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.item-f input { min-height: 44px; padding: 10px 12px; }
.stepper { display: grid; grid-template-columns: 40px 1fr 40px; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--field); }
.stepper button { appearance: none; border: 0; background: var(--panel2); color: var(--text); font: 600 20px/1 var(--sans); cursor: pointer; }
.stepper button:active { background: var(--brand-soft); }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 750; min-height: 42px; padding: 8px 2px; box-shadow: none !important; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.item-btns { margin-top: 12px; }
.cols-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.cols-box summary { cursor: pointer; font-weight: 650; font-size: 14px; display: flex; gap: 8px; align-items: center; list-style: none; color: var(--text2); }
.cols-box summary::-webkit-details-marker { display: none; }
.cols-box[open] summary { margin-bottom: 10px; }
.cols-ed { display: grid; gap: 8px; margin-bottom: 10px; }
.col-ed { display: flex; gap: 6px; }
.sig-pad { position: relative; height: 160px; border: 1.5px dashed var(--line2); border-radius: 14px; background: #fff; overflow: hidden; }
.sig-pad canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.sig-pad .ph { position: absolute; inset: 0; display: flex; gap: 8px; align-items: center; justify-content: center; color: #98a2b3; font-size: 15px; pointer-events: none; }
.sig-pad::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 34px; border-bottom: 1px solid #e2e8f0; pointer-events: none; }
.sig-clear { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid #e2e8f0; background: #fff; color: #64748b; display: grid; place-items: center; cursor: pointer; z-index: 1; }
.actionbar { position: sticky; bottom: calc(env(safe-area-inset-bottom) + 86px); z-index: 20; display: flex; gap: 8px; margin-top: 16px; padding: 10px; background: color-mix(in srgb, var(--panel) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-md); }
@media (min-width: 900px) { .actionbar { bottom: 14px; } }

/* Pelanggan */
.cust-card { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; box-shadow: var(--shadow); }
.avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand-ink); font: 800 17px/42px var(--sans); text-align: center; flex: none; text-transform: uppercase; }
.col-btns { display: flex; flex-direction: column; gap: 6px; }

/* Helaian (modal) */
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto; background: var(--panel); border-radius: 24px 24px 0 0; padding: 20px 18px calc(env(safe-area-inset-bottom) + 20px); animation: up .22s cubic-bezier(.2, .8, .2, 1); }
.modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line2); margin: -8px auto 14px; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .modal { border-radius: 22px; } .modal::before { display: none; } }
@keyframes up { from { transform: translateY(40px); opacity: .6; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 96px); z-index: 80; background: #0b1220; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14.5px; max-width: calc(100vw - 32px); box-shadow: 0 12px 30px rgba(0, 0, 0, .3); }
.toast.err { background: #9f1239; }

/* Tetapan, pengguna */
.rows > * { padding: 13px 0; border-bottom: 1px solid var(--line); }
.rows > *:last-child { border-bottom: 0; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.logo-it { position: relative; border: 2px solid var(--line); border-radius: 14px; background: #fff; padding: 8px; height: 96px; display: grid; place-items: center; cursor: pointer; appearance: none; }
.logo-it img { max-width: 100%; max-height: 62px; object-fit: contain; }
.logo-it.on { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(245, 158, 11, .2); }
.logo-it .tag { position: absolute; left: 7px; bottom: 6px; font: 800 10px/1 var(--sans); color: var(--brand-deep); }
.progress { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }
#editRow, #logoRow { margin-top: 12px; }

/* Cetak: imej halaman A4 sahaja */
#printArea { display: none; }
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  /* 296mm (bukan 297) supaya pembundaran tidak menolak imej ke halaman kosong tambahan */
  #printArea img { display: block; width: 210mm; height: 296mm; margin: 0; break-after: page; page-break-after: always; break-inside: avoid; }
  #printArea img:last-child { break-after: auto; page-break-after: auto; }
}

/* Berbilang cawangan & tetapan awal */
.br-chips { margin: 0 0 14px; }
.br-chips .chip.on { background: var(--brand); border-color: var(--brand); color: #1c1300; }
.b-br { background: var(--info-soft); color: var(--info); font-size: 11px; padding: 4px 8px; }
.b-br::before { display: none; }
.setup { margin-bottom: 16px; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.setup ol { margin: 10px 0 14px; padding-left: 22px; color: var(--text2); }
.setup li { margin: 4px 0; }
.setup li.done { color: var(--ok); text-decoration: line-through; }
.center-t { text-align: center; margin-top: 18px; }
.center-v { align-self: center; }
.warn-t { color: var(--warn); margin: 6px 0 0; }
.mt8 { margin-top: 8px; }
.br-row .col-btns { flex: none; }

/* Butang tema */
.theme-btn { font-size: 17px; padding: 0; width: 40px; min-height: 38px; }
.theme-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-seg .chip { text-align: center; padding: 12px 8px; border-radius: 12px; }

/* Helaian pengesahan, Buat asal, sejarah isian */
.ask-bg { z-index: 70; }
.ask h2 { margin-bottom: 8px; }
.ask-btns { margin-top: 18px; flex-wrap: nowrap; }
.btn.danger-solid { background: #e11d48; border-color: #e11d48; color: #fff; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast-undo { appearance: none; border: 0; background: rgba(255, 255, 255, .14); color: #fbbf24; font: 750 14px/1 var(--sans); padding: 8px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.reuse { margin-top: 10px; width: 100%; justify-content: flex-start; white-space: normal; text-align: left; background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.dup-warn { margin-top: 10px; }

/* Borang DO di telefon: navigasi bawah disorok, bar Simpan melekat di bawah skrin */
@media (max-width: 899px) {
  body.in-form .nav-m { display: none; }
  body.in-form main { padding-bottom: calc(env(safe-area-inset-bottom) + 96px); }
  body.in-form .actionbar { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; border-radius: 18px 18px 0 0; border-width: 1px 0 0;
    padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px); z-index: 40; transition: transform .2s ease; }
  body.in-form.typing .actionbar { transform: translateY(110%); }
  body.in-form .toast { bottom: calc(env(safe-area-inset-bottom) + 86px); }
}

/* Aliran kelulusan & tandatangan tanpa kertas */
.flow-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--panel2); }
.flow-card > * { min-width: 0; }
.flow { list-style: none; margin: 0 0 2px; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; position: relative; }
.flow::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 12px; height: 2px; background: var(--line2); }
.flow li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; font: 650 12px/1.2 var(--sans); color: var(--muted); min-width: 0; text-align: center; }
.flow li span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--panel); border: 1.5px solid var(--line2); font: 800 12px/1 var(--sans); }
.flow li span .ico { width: 14px; height: 14px; }
.flow li.done { color: var(--ok); }
.flow li.done span { background: var(--ok); border-color: var(--ok); color: #fff; }
.flow li.cur { color: var(--text); }
.flow li.cur span { border-color: var(--brand); color: var(--brand-deep); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.link-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 12px; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.link-box b .ico { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.link-box .small { color: var(--text2); }
.link-url { font: 600 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 10px 12px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); word-break: break-all; user-select: all; -webkit-user-select: all; }
.btn.wa { background: #25d366; border-color: #1fb457; color: #06290f; text-decoration: none; justify-content: center; }
.b-rev { background: var(--info-soft); color: var(--info); font-size: 11px; padding: 4px 8px; }
.b-back { background: var(--err-soft); color: var(--err); font-size: 11px; padding: 4px 8px; }
.b-sent { background: var(--warn-soft); color: var(--warn); font-size: 11px; padding: 4px 8px; }
.b-okap { background: var(--ok-soft); color: var(--ok); font-size: 11px; padding: 4px 8px; }
.b-draft { background: var(--panel2); color: var(--muted); border: 1px solid var(--line); font-size: 11px; padding: 4px 8px; }

/* Halaman tandatangan penerima (/t/<token>) */
.sign-body { min-height: 100vh; }
.sign-main { padding: 16px 16px calc(28px + env(safe-area-inset-bottom)); }
.sign-wrap { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.sign-wrap > * { min-width: 0; }
.sign-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.sign-head .mark { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(145deg, var(--brand2), var(--brand-deep)); color: #1c1300; display: grid; place-items: center; flex: none; }
.sign-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: #fff; padding: 3px; flex: none; }
.sign-head .t1 { font: 800 17px/1.2 var(--display); }
.sign-head .t2 { font-size: 13px; color: var(--brand-deep); font-weight: 700; }
.sign-msg { text-align: center; padding: 28px 18px; }
.sign-msg h1 { font-size: 22px; margin: 0 0 6px; }
.sign-foot { text-align: center; font-size: 12px; color: var(--dim); margin: 6px 0 0; }
.flow-sec { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.flow-sec > * { min-width: 0; }
.flow-sec .lbl { font: 750 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--brand-deep); }
.flow-sec .lbl .ico { width: 14px; height: 14px; vertical-align: -3px; margin-right: 5px; }
.flow-card .row .btn { white-space: normal; }

/* Salinan DO kertas bertandatangan */
.scan-box { display: grid; gap: 10px; padding: 12px 14px; border: 1px dashed var(--line2); border-radius: var(--r-sm); }
.scan-box > * { min-width: 0; }
.scan-box .lbl { font: 750 11px/1.3 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--brand-deep); }
.scan-box .lbl .ico { width: 14px; height: 14px; vertical-align: -3px; margin-right: 5px; }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.scan-th { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; aspect-ratio: 3 / 4; cursor: pointer; }
.scan-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-th span { position: absolute; right: 5px; bottom: 5px; background: rgba(11, 18, 32, .75); color: #fff; font: 700 11px/1 var(--sans); padding: 4px 6px; border-radius: 6px; }
.scan-full { width: 100%; max-height: 62vh; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.ph-th { aspect-ratio: 1 / 1; }
.ph-th .stg { left: 5px; right: auto; }
.stg-ambil { background: rgba(180, 83, 9, .9) !important; }
.stg-hantar { background: rgba(29, 78, 216, .9) !important; }
.stg-terima { background: rgba(4, 120, 87, .9) !important; }
.stage-btn { justify-content: flex-start; }
.ph-pick { display: grid; gap: 8px; }
.ph-pick .scan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ph-rm { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(11, 18, 32, .75); color: #fff; display: grid; place-items: center; padding: 0; }
.ph-rm .ico { width: 14px; height: 14px; }
.stg-no { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: inline-grid; place-items: center; font: 800 12px/1 var(--sans); margin-right: 2px; flex: none; }
.lang-btn { font: 800 13px/1 var(--display); letter-spacing: .04em; }
.logo-it .no { position: absolute; right: 8px; top: 6px; font: 800 11px/1 var(--sans); color: var(--muted); }
/* Logo RC Delivery Order (gambar) menggantikan ikon trak */
.mark-img { background: none !important; box-shadow: 0 6px 16px rgba(0, 0, 0, .25) !important; padding: 0 !important; overflow: hidden; }
.mark-img img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* Tulisan jenama (ikut banner): Montserrat 800, "RC" emas condong. Fon dalam /fonts (SIL OFL). */
@font-face { font-family: 'RC Brand'; src: url('/fonts/montserrat-800.woff2') format('woff2'); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: 'RC Brand'; src: url('/fonts/montserrat-800i.woff2') format('woff2'); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: 'RC Brand'; src: url('/fonts/montserrat-700.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
.wordmark { font-family: 'RC Brand', var(--display); font-weight: 800; letter-spacing: -.015em; }
.wordmark .rc { font-style: italic; padding-right: .06em; background: linear-gradient(180deg, #ffe08a 0%, #f2b02e 48%, #b77712 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { font-family: 'RC Brand', var(--display); font-weight: 700; text-align: center; color: #c8901a; margin: 2px 0 6px; font-size: 14px; }
.top .t1.wordmark { font-size: 16px; }
.auth h1.wordmark { font-size: 25px; }
.foot .wordmark, .sign-foot .wordmark { font-size: 1.05em; }
.meta .bkc { color: var(--ok, #059669); }
/* Kaki laman undang-undang & halaman Terma / Privasi / Penafian / Hubungi */
.site-foot { text-align: center; font-size: 12px; color: var(--muted); margin: 26px 0 8px; line-height: 1.7; }
.site-foot p { margin: 0 0 2px; }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; }
.site-foot nav span { color: var(--dim); }
.site-foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.site-foot a:hover { color: var(--text); }
.legal-body { min-height: 100vh; }
.legal { max-width: 760px; margin: 0 auto; padding: 22px 16px 40px; }
.legal-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); margin-bottom: 14px; font-size: 18px; }
.legal-brand img { border-radius: 10px; }
.legal-card h1 { font-size: 24px; margin-bottom: 4px; }
.legal-card h2 { font-size: 16.5px; margin: 20px 0 6px; }
.legal-card p, .legal-card li { line-height: 1.65; font-size: 14.5px; }
.legal-card ul { padding-left: 20px; margin: 6px 0; }
.legal-card li { margin: 4px 0; }
.legal-back { margin-top: 16px; text-align: center; }
.contact-box { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 12px 0 6px; }
.contact-mail { font-size: 17px; font-weight: 700; word-break: break-all; }
