/* A&3T SERVICE — mobile first. Navy / blue / violet gradients on a light, clean background. */

:root {
  --bg: #f3f5fb;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e4e8f1;
  --line-2: #eef1f7;
  --navy: #0b1437;
  --navy-2: #131c4b;
  --blue: #2563eb;
  --violet: #7c3aed;
  --cyan: #06b6d4;
  --bolt: #f04e23;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --grad: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #7c3aed 100%);
  --grad-soft: linear-gradient(135deg, #eff4ff 0%, #f3efff 100%);
  --grad-dark: linear-gradient(165deg, #0b1437 0%, #141a52 55%, #2a1763 100%);
  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -8px rgba(30, 41, 99, .14);
  --shadow-lg: 0 20px 50px -18px rgba(37, 52, 140, .38);
  --font: "Noto Sans Thai", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, opacity .2s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .7); }
.btn-primary:hover { box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .85); }
.btn-ok { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 8px 20px -8px rgba(16, 185, 129, .7); }
.btn-danger { background: linear-gradient(135deg, #f43f5e, #dc2626); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #c7d2fe; color: var(--blue); }
.btn-soft { background: #eef2ff; color: #3730a3; }
.btn-lg { min-height: 54px; font-size: 17px; border-radius: 16px; padding: 0 24px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 42px; height: 42px; display: inline-grid; place-items: center; border-radius: 12px; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; font-size: 18px;
}
.icon-btn:hover { background: #eef2ff; color: var(--blue); }
.link-btn { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 4px; font-weight: 600; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px; /* 16px stops iOS zoom */
}
.field textarea { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #818cf8; box-shadow: 0 0 0 4px rgba(99, 102, 241, .15); }
.field input[readonly] { background: #f8fafc; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
@media (min-width: 640px) { .g2 { grid-template-columns: 1fr 1fr; } .g3 { grid-template-columns: repeat(3, 1fr); } }
.span-all { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--blue); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1.5px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; color: var(--ink-2); transition: all .15s;
}
.seg input:checked + span { border-color: transparent; background: var(--grad); color: #fff; box-shadow: 0 6px 16px -8px rgba(79, 70, 229, .8); }
.seg input:focus-visible + span { outline: 3px solid #a5b4fc; }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); border: 1px solid rgba(226, 232, 240, .7); }
.card-pad { padding: 18px; }
@media (min-width: 768px) { .card-pad { padding: 22px 24px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font-size: 17px; display: flex; align-items: center; gap: 10px; }
.card-head h3 i { color: var(--violet); }
.section-title { font-size: 15px; font-weight: 700; color: var(--ink-2); margin: 4px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title i { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: var(--grad-soft); color: var(--violet); font-size: 14px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); white-space: nowrap;
}
.type-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); border: 1px solid color-mix(in srgb, var(--c) 22%, white); white-space: nowrap;
}
.pill-online {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(16, 185, 129, .14); color: #047857;
}
.pill-online::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 0 rgba(16, 185, 129, .6); animation: pulse 2s infinite; }
.pill-online.offline { background: rgba(239, 68, 68, .12); color: #b91c1c; }
.pill-online.offline::before { background: #ef4444; animation: none; }
.on-dark .pill-online { background: rgba(16, 185, 129, .18); color: #6ee7b7; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .55); } 70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); } 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; background: #0f172a; color: #fff;
  box-shadow: 0 16px 40px -12px rgba(15, 23, 42, .5); font-weight: 500; opacity: 0; transform: translateY(-12px) scale(.98); transition: all .25s ease; cursor: pointer;
}
.toast.show { opacity: 1; transform: none; }
.toast i { font-size: 18px; }
.toast-ok i { color: #34d399; }
.toast-err { background: #7f1d1d; }
.toast-err i { color: #fecaca; }
.toast-info i, .toast-wait i { color: #93c5fd; }

/* ---------- modal ---------- */
.modal-wrap {
  position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, .45); backdrop-filter: blur(4px); display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s;
}
.modal-wrap.show { opacity: 1; }
.modal {
  background: #fff; width: 100%; max-height: 92vh; display: flex; flex-direction: column; border-radius: 22px 22px 0 0;
  transform: translateY(30px); transition: transform .25s ease; padding-bottom: var(--safe-b);
}
.modal-wrap.show .modal { transform: none; }
@media (min-width: 640px) {
  .modal-wrap { align-items: center; padding: 20px; }
  .modal { width: min(520px, 100%); border-radius: 22px; }
  .modal-wide { width: min(860px, 100%); }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 8px 18px 16px; overflow: auto; }
.modal-foot { display: flex; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line-2); }
.modal-foot .btn { flex: 1; }
.confirm-text { font-size: 16px; margin: 4px 0 8px; color: var(--ink-2); white-space: pre-line; }

/* ---------- empty / skeleton / error ---------- */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); }
.empty h4 { color: var(--ink); font-size: 17px; margin: 12px 0 4px; }
.empty p { margin: 0 0 16px; }
.empty-icon { width: 72px; height: 72px; margin: 0 auto; display: grid; place-items: center; border-radius: 22px; background: var(--grad-soft); color: var(--violet); font-size: 28px; }
.error-state .empty-icon { background: #fef2f2; color: var(--bad); }
.skeleton-list { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.sk-row { display: flex; gap: 12px; align-items: center; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk { background: linear-gradient(90deg, #eef1f7 25%, #e2e7f1 37%, #eef1f7 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
.sk-circle { width: 42px; height: 42px; border-radius: 12px; }
.sk-line { height: 12px; }
.sk-line.short { width: 55%; }
.sk-card { height: 220px; border-radius: var(--r); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* =====================================================================
   PUBLIC: ตรวจสอบเอกสาร
   ===================================================================== */
.pub { min-height: 100vh; display: flex; flex-direction: column; }
.pub-hero {
  position: relative; background: var(--grad-dark); color: #fff; padding: 14px 16px 92px; overflow: hidden;
}
.pub-hero::before, .pub-hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(10px); opacity: .55; pointer-events: none;
}
.pub-hero::before { width: 360px; height: 360px; right: -120px; top: -140px; background: radial-gradient(circle, rgba(99, 102, 241, .75), transparent 65%); }
.pub-hero::after { width: 300px; height: 300px; left: -120px; bottom: -160px; background: radial-gradient(circle, rgba(6, 182, 212, .55), transparent 65%); }
.pub-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 10px; max-width: 980px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; }
.brand-logo { width: 44px; height: 44px; border-radius: 13px; background: #fff; padding: 3px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .4); }
.brand b { display: block; font-size: 17px; letter-spacing: .3px; }
.brand small { display: block; font-size: 12px; opacity: .75; margin-top: -2px; }
.pub-meta { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pub-clock { font-variant-numeric: tabular-nums; opacity: .9; display: none; }
@media (min-width: 560px) { .pub-clock { display: inline; } }
.pub-head { position: relative; z-index: 1; text-align: center; max-width: 640px; margin: 34px auto 0; }
.pub-head .kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); }
.pub-head h1 { font-size: clamp(26px, 6.4vw, 40px); margin: 14px 0 6px; font-weight: 800; letter-spacing: -.2px; }
.pub-head h1 span { background: linear-gradient(90deg, #a5b4fc, #67e8f9); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pub-head p { margin: 0; opacity: .82; font-size: 15px; }
.pub-today { margin-top: 6px; font-size: 13px; opacity: .7; }

.pub-main { position: relative; z-index: 2; width: 100%; max-width: 640px; margin: -64px auto 0; padding: 0 14px 30px; flex: 1; }
.search-card { padding: 16px; border-radius: 22px; box-shadow: var(--shadow-lg); }
.search-box { display: flex; flex-direction: column; gap: 10px; }
.search-input { position: relative; }
.search-input i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #818cf8; font-size: 18px; }
.search-input input {
  width: 100%; height: 60px; border-radius: 16px; border: 2px solid var(--line); padding: 0 16px 0 46px; font-size: 19px; font-weight: 700; letter-spacing: .6px;
  text-transform: uppercase; outline: none; transition: border-color .15s, box-shadow .15s; background: #fbfcff;
}
.search-input input::placeholder { text-transform: none; letter-spacing: 0; font-weight: 500; color: #94a3b8; font-size: 16px; }
.search-input input:focus { border-color: #818cf8; box-shadow: 0 0 0 5px rgba(99, 102, 241, .14); background: #fff; }
@media (min-width: 560px) { .search-box { flex-direction: row; } .search-box .btn { min-width: 150px; } }
.search-hint { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; font-size: 12.5px; color: var(--muted); align-items: center; }
.search-hint code { background: #f1f5f9; padding: 2px 8px; border-radius: 7px; font-family: inherit; font-weight: 600; color: var(--ink-2); cursor: pointer; }

.result { margin-top: 18px; }
.res-card { overflow: hidden; animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.res-top { padding: 18px; background: var(--grad-soft); border-bottom: 1px solid var(--line-2); display: flex; gap: 14px; align-items: center; }
.res-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; font-size: 22px; color: #fff; background: var(--c, var(--blue)); box-shadow: 0 10px 22px -10px var(--c, var(--blue)); flex: none; }
.res-top h2 { font-size: 20px; letter-spacing: .3px; }
.res-top .muted { font-size: 13.5px; }
.res-verified { display: inline-flex; align-items: center; gap: 6px; color: #047857; font-weight: 700; font-size: 13px; }
.res-body { padding: 16px 18px 18px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.kv div { min-width: 0; }
.kv dt, .kv .k { font-size: 12.5px; color: var(--muted); }
.kv dd, .kv .v { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.res-total { margin-top: 16px; padding: 16px; border-radius: 16px; background: var(--grad); color: #fff; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.res-total .big { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.res-total small { opacity: .85; display: block; }
.items-mini { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.items-mini div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.items-mini div:last-child { border-bottom: 0; }
.items-mini span:first-child { min-width: 0; }
.items-mini b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.verify-box { margin-top: 16px; padding: 16px; border-radius: 16px; border: 1.5px dashed #c7d2fe; background: #fafbff; }
.verify-box h4 { font-size: 15px; display: flex; gap: 8px; align-items: center; }
.verify-box p { margin: 4px 0 12px; font-size: 13.5px; color: var(--muted); }
.verify-row { display: flex; gap: 8px; }
.verify-row .input { flex: 1; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.photos button { padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 3/4; cursor: zoom-in; background: #e2e8f0; position: relative; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos .rm { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 9px; background: rgba(15, 23, 42, .7); color: #fff; display: grid; place-items: center; font-size: 13px; }
.res-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.res-actions .btn { flex: 1; }
.notfound { text-align: center; padding: 30px 18px; }
.notfound .empty-icon { background: #fff7ed; color: #ea580c; }
.cancel-banner { margin-top: 14px; padding: 12px 14px; border-radius: 14px; background: #fef2f2; color: #991b1b; font-weight: 600; display: flex; gap: 10px; }
.pub-foot { text-align: center; padding: 18px 16px calc(24px + var(--safe-b)); font-size: 13px; color: var(--muted); }
.admin-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 16px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink-2); font-weight: 600; box-shadow: var(--shadow); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.features div { background: #fff; border-radius: 16px; padding: 14px 8px; text-align: center; font-size: 12.5px; color: var(--ink-2); box-shadow: var(--shadow); font-weight: 600; }
.features i { display: block; font-size: 20px; margin-bottom: 6px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 95; background: rgba(2, 6, 23, .92); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-height: 88vh; max-width: 100%; border-radius: 12px; object-fit: contain; }
.lightbox .icon-btn { position: absolute; top: 12px; right: 12px; color: #fff; background: rgba(255, 255, 255, .12); }

/* =====================================================================
   LOGIN
   ===================================================================== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--grad-dark); position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -200px; top: -200px; background: radial-gradient(circle, rgba(124, 58, 237, .55), transparent 65%); }
.login-card { position: relative; width: min(420px, 100%); padding: 28px 22px; border-radius: 26px; background: rgba(255, 255, 255, .97); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55); }
.login-card .brand-logo { width: 74px; height: 74px; border-radius: 22px; margin: -66px auto 10px; box-shadow: 0 16px 34px -12px rgba(30, 41, 99, .6); }
.login-card h1 { text-align: center; font-size: 22px; }
.login-card p.lead { text-align: center; color: var(--muted); margin: 4px 0 20px; font-size: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.back-link { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 14px; }

/* =====================================================================
   ADMIN SHELL
   ===================================================================== */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: rgba(11, 20, 55, .96); color: #fff; backdrop-filter: blur(10px);
}
.topbar .brand-logo { width: 36px; height: 36px; border-radius: 11px; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title small { display: block; font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.topbar .icon-btn { color: #c7d2fe; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.main { padding: 16px 14px calc(var(--nav-h) + 26px + var(--safe-b)); max-width: 1200px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: rgba(255, 255, 255, .97); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); box-shadow: 0 -10px 30px -16px rgba(30, 41, 99, .25);
}
.bottom-nav a, .bottom-nav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: #8792a8;
  background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.bottom-nav i { font-size: 19px; }
.bottom-nav .active { color: var(--blue); }
.bottom-nav .active i { transform: translateY(-1px); }
.bottom-nav .fab i {
  width: 54px; height: 54px; display: grid; place-items: center; border-radius: 18px; margin-top: -30px; color: #fff; font-size: 22px;
  background: var(--grad); box-shadow: 0 12px 24px -8px rgba(79, 70, 229, .8); border: 4px solid #fff;
}
.bottom-nav .fab { color: var(--violet); }

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: 264px 1fr; }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--grad-dark); color: #cbd5e1; padding: 18px 14px; overflow-y: auto;
  }
  .sidebar .brand { padding: 4px 8px 18px; color: #fff; }
  .side-status { margin: 0 8px 16px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .08); font-size: 13px; }
  .side-status .clock { font-size: 22px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; margin-top: 6px; }
  .side-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 1px; color: #7c86b4; padding: 12px 12px 6px; font-weight: 700; }
  .side-nav a, .side-nav button {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; color: #c7cde6; font-weight: 600; margin-bottom: 2px;
    border: 0; background: none; cursor: pointer; text-align: left; transition: background .15s, color .15s;
  }
  .side-nav a i, .side-nav button i { width: 22px; text-align: center; font-size: 16px; color: #8b93c9; }
  .side-nav a:hover, .side-nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
  .side-nav a.active { background: linear-gradient(135deg, rgba(37, 99, 235, .9), rgba(124, 58, 237, .9)); color: #fff; box-shadow: 0 10px 22px -12px rgba(124, 58, 237, .9); }
  .side-nav a.active i { color: #fff; }
  .side-foot { margin-top: auto; padding: 12px 8px 0; font-size: 12px; color: #7c86b4; }
  .topbar { background: rgba(243, 245, 251, .9); color: var(--ink); border-bottom: 1px solid var(--line); padding: 12px 28px; }
  .topbar .brand-logo, .topbar .menu-btn { display: none; }
  .topbar .icon-btn { color: var(--ink-2); }
  .topbar .pill-online { background: rgba(16, 185, 129, .12); color: #047857; }
  .main { padding: 24px 28px 40px; }
  .bottom-nav { display: none; }
}

/* more menu (mobile) */
.menu-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.menu-grid a, .menu-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border-radius: 16px; background: #f8faff; border: 1px solid var(--line);
  font-weight: 600; font-size: 13.5px; color: var(--ink-2); cursor: pointer; text-align: center;
}
.menu-grid i { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--c, var(--grad)); font-size: 18px; }

/* =====================================================================
   DASHBOARD
   ===================================================================== */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, 1fr); gap: 16px; } }
.stat { position: relative; overflow: hidden; padding: 16px; border-radius: var(--r); color: #fff; box-shadow: var(--shadow-lg); min-height: 112px; }
.stat::after { content: ""; position: absolute; right: -30px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.stat i { font-size: 18px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, .18); }
.stat .label { font-size: 13px; opacity: .9; margin-top: 10px; }
.stat .value { font-size: clamp(19px, 5vw, 26px); font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat .sub { font-size: 12px; opacity: .85; }
.s1 { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.s2 { background: linear-gradient(135deg, #7c3aed, #c026d3); }
.s3 { background: linear-gradient(135deg, #0891b2, #0ea5e9); }
.s4 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
@media (min-width: 900px) { .quick { grid-template-columns: repeat(4, 1fr); } }
.quick a {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); background: #fff; box-shadow: var(--shadow); color: var(--ink);
  font-weight: 700; border: 1px solid transparent; transition: transform .15s, border-color .15s;
}
.quick a:hover { transform: translateY(-2px); border-color: #c7d2fe; }
.quick a i { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; color: #fff; background: var(--c); font-size: 18px; box-shadow: 0 8px 18px -8px var(--c); }
.quick small { display: block; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.two-col { display: grid; gap: 16px; margin-top: 16px; }
@media (min-width: 1024px) { .two-col { grid-template-columns: 1.6fr 1fr; } }
.alert-strip { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; margin-bottom: 14px; font-size: 14px; }
.alert-strip.warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.alert-strip.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-strip .btn { margin-left: auto; }

/* list rows (documents) */
.doc-list { display: flex; flex-direction: column; }
.doc-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-2); color: inherit; cursor: pointer;
}
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: #fafbff; }
.doc-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); font-size: 17px; }
.doc-main { min-width: 0; }
.doc-main b { display: block; font-size: 15px; letter-spacing: .2px; }
.doc-main span { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-side { text-align: right; }
.doc-side b { display: block; font-variant-numeric: tabular-nums; }
.doc-side .badge { margin-top: 3px; }

/* table (desktop) */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbff; white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #fafbff; }
.tbl .r { text-align: right; }

/* filters */
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters .wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .filters { grid-template-columns: 2fr repeat(5, 1fr); } .filters .wide { grid-column: auto; } }
.filters .field input, .filters .field select { min-height: 44px; }
.result-sum { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 14px 2px 6px; font-size: 14px; color: var(--muted); }
.result-sum b { color: var(--ink); }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

/* =====================================================================
   DOCUMENT FORM
   ===================================================================== */
.form-layout { display: grid; gap: 16px; }
@media (min-width: 1100px) { .form-layout { grid-template-columns: 1fr 360px; align-items: start; } .form-aside { position: sticky; top: 84px; } }
.type-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-tabs label input { position: absolute; opacity: 0; }
.type-tabs span {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 16px; border: 2px solid var(--line); background: #fff;
  font-weight: 700; font-size: 13.5px; text-align: center; cursor: pointer; color: var(--ink-2); transition: all .15s;
}
.type-tabs i { font-size: 20px; color: var(--c); }
.type-tabs input:checked + span { border-color: var(--c); background: color-mix(in srgb, var(--c) 8%, white); color: var(--ink); box-shadow: 0 10px 22px -16px var(--c); }
.number-preview { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--grad-soft); margin-top: 12px; font-size: 14px; }
.number-preview b { font-size: 17px; letter-spacing: .5px; color: #3730a3; }

.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20; background: #fff; border-radius: 14px; box-shadow: 0 18px 40px -12px rgba(30, 41, 99, .35);
  border: 1px solid var(--line); max-height: 300px; overflow: auto;
}
.ac-list button { display: block; width: 100%; text-align: left; padding: 10px 14px; border: 0; background: none; cursor: pointer; border-bottom: 1px solid var(--line-2); }
.ac-list button:hover, .ac-list button.hi { background: #eef2ff; }
.ac-list b { display: block; font-size: 14.5px; }
.ac-list span { font-size: 12.5px; color: var(--muted); }
.ac-new { color: var(--blue) !important; font-weight: 700; }
.cust-linked { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #047857; font-weight: 600; margin-top: 6px; }
.cust-linked.new { color: #b45309; }

.items { display: flex; flex-direction: column; gap: 10px; }
.item {
  position: relative; border: 1.5px solid var(--line); border-radius: 16px; padding: 12px; background: #fff; display: grid; gap: 10px;
  grid-template-columns: 1fr 1fr; animation: rise .25s ease;
}
.item .it-name { grid-column: 1 / -1; display: flex; gap: 8px; align-items: flex-start; }
.item .it-name .seq { flex: none; width: 30px; height: 30px; margin-top: 9px; border-radius: 9px; display: grid; place-items: center; background: var(--grad-soft); color: #4338ca; font-weight: 800; font-size: 13px; }
.item .it-name .ac { flex: 1; }
.item .field input { min-height: 44px; }
.item .it-amount { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding-top: 4px; border-top: 1px dashed var(--line); font-size: 14px; }
.item .it-amount b { font-size: 16px; font-variant-numeric: tabular-nums; }
.item .it-del { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; font-size: 15px; color: #94a3b8; }
.item .it-del:hover { color: var(--bad); background: #fef2f2; }
.item .it-name .ac input { padding-right: 40px; }
@media (min-width: 760px) {
  .item { grid-template-columns: 2.4fr .7fr .8fr 1fr 1fr 40px; align-items: end; padding: 10px 12px; }
  .item .it-name { grid-column: auto; }
  .item .it-amount { grid-column: auto; border: 0; padding: 0 0 12px; display: block; text-align: right; }
  .item .it-amount span { display: none; }
  .item .it-del { position: static; margin-bottom: 4px; }
  .item .field > span { font-size: 12px; }
}
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.add-row .btn { flex: 1; min-width: 150px; border-style: dashed; }

.sum-card { padding: 18px; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 15px; }
.sum-line b { font-variant-numeric: tabular-nums; }
.sum-line.net { margin-top: 8px; padding: 14px 16px; border-radius: 14px; background: var(--grad); color: #fff; font-size: 16px; }
.sum-line.net b { font-size: 24px; }
.sum-words { text-align: center; font-size: 14px; color: #4338ca; font-weight: 600; margin-top: 8px; }
.sum-opts { display: grid; gap: 10px; margin: 12px 0; padding: 12px; border-radius: 14px; background: #f8faff; border: 1px solid var(--line-2); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .field { flex: 1; }
.save-bar {
  position: sticky; bottom: calc(var(--nav-h) + 8px + var(--safe-b)); z-index: 20; display: flex; gap: 10px; padding: 10px; margin-top: 16px; border-radius: 18px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); box-shadow: 0 -4px 30px -10px rgba(30, 41, 99, .3); border: 1px solid var(--line);
}
.save-bar .btn { flex: 1; }
.save-bar .btn-primary { flex: 2; }
@media (min-width: 1024px) { .save-bar { bottom: 12px; } }
details.more { border-top: 1px solid var(--line-2); margin-top: 14px; padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 8px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: auto; font-size: 12px; transition: transform .2s; }
details.more[open] summary::after { transform: rotate(180deg); }
details.more > .grid { margin-top: 12px; }

/* product picker */
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.pick-list button { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.pick-list button:hover { border-color: #a5b4fc; background: #fafbff; }
.pick-list b { display: block; }
.pick-list span { font-size: 12.5px; color: var(--muted); }

/* =====================================================================
   HANDWRITTEN
   ===================================================================== */
.reserve-hero { padding: 18px; border-radius: var(--r); color: #fff; background: linear-gradient(135deg, #f59e0b, #ea580c 60%, #db2777); box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.reserve-hero::after { content: "\f5ad"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: -6px; bottom: -24px; font-size: 120px; opacity: .14; }
.reserve-hero h3 { font-size: 18px; }
.reserve-hero p { margin: 4px 0 14px; opacity: .92; font-size: 14px; }
.reserve-hero .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: relative; z-index: 1; }
.reserve-hero select { min-height: 48px; border-radius: 14px; border: 0; padding: 0 12px; font-weight: 700; color: #9a3412; background: #fff; }
.reserve-hero .btn { background: #fff; color: #c2410c; }
.big-number { font-size: clamp(26px, 8vw, 40px); font-weight: 800; letter-spacing: 1px; text-align: center; padding: 18px; border-radius: 18px; background: var(--grad-soft); color: #3730a3; margin: 8px 0 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-num { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; font-weight: 700; cursor: pointer; }
.chip-num:hover { background: #ffedd5; }
.camera-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px; border-radius: 18px; border: 2px dashed #a5b4fc;
  background: #fafbff; text-align: center; cursor: pointer; color: var(--ink-2);
}
.camera-zone i { font-size: 30px; color: var(--violet); }
.camera-zone b { font-size: 16px; }
.camera-zone small { color: var(--muted); }
.camera-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-prog { height: 6px; border-radius: 6px; background: #e0e7ff; overflow: hidden; margin-top: 8px; }
.upload-prog div { height: 100%; width: 0; background: var(--grad); transition: width .3s; }

/* =====================================================================
   DOCUMENT VIEW
   ===================================================================== */
.view-layout { display: grid; gap: 16px; }
@media (min-width: 1100px) { .view-layout { grid-template-columns: 1fr 340px; align-items: start; } .view-aside { position: sticky; top: 84px; } }
.preview-wrap { overflow: hidden; border-radius: var(--r); background: #e9edf5; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.preview-scale { transform-origin: top left; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-grid .btn { min-height: 50px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--violet); box-shadow: 0 0 0 4px #ede9fe; }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline b { display: block; font-size: 14px; }
.timeline span { color: var(--muted); }
.timeline pre { white-space: pre-wrap; font-family: inherit; font-size: 12.5px; background: #f8fafc; border-radius: 10px; padding: 8px 10px; margin: 6px 0 0; color: var(--ink-2); max-height: 160px; overflow: auto; }

/* =====================================================================
   REPORTS / SETTINGS / CUSTOMERS
   ===================================================================== */
.chart-box { position: relative; height: 260px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-list .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 14px; }
.bar-list .bar { grid-column: 1 / -1; height: 8px; border-radius: 6px; background: #eef2ff; overflow: hidden; }
.bar-list .bar div { height: 100%; background: var(--grad); border-radius: 6px; }
.settings-nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; }
.settings-nav button { flex: none; }
.logo-prev { width: 88px; height: 88px; border-radius: 20px; border: 1px solid var(--line); background: #fff; object-fit: contain; padding: 6px; }
.sign-prev { height: 70px; max-width: 240px; object-fit: contain; border: 1px dashed var(--line); border-radius: 12px; padding: 6px; background: #fff; }
.cust-card { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.cust-card:hover { background: #fafbff; }
.avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--grad); }
.avatar.company { background: linear-gradient(135deg, #0891b2, #2563eb); }
.counter-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; }

/* =====================================================================
   PRINTOUT (A4: 794 × 1123 px at 96 dpi) — copy of the Excel form
   ===================================================================== */
.printout {
  position: relative; width: 794px; min-height: 1123px; padding: 26px 30px 24px; background: #fff; color: #000;
  font-family: "Sarabun", "TH Sarabun New", "Angsana New", sans-serif; font-size: 13.5px; line-height: 1.35; font-weight: 600; overflow: hidden;
}
.printout * { box-sizing: border-box; }
.pd-head { display: grid; grid-template-columns: 128px 1fr 220px; gap: 12px; align-items: start; margin-bottom: 10px; }
.pd-logo { width: 122px; height: 122px; object-fit: contain; margin-top: -6px; }
.pd-shop { font-size: 14px; line-height: 1.55; padding-top: 2px; }
.pd-shop b { font-size: 15px; }
.pd-title { text-align: center; padding-top: 4px; }
.pd-original { font-size: 14px; font-weight: 700; }
.pd-titlebox { margin: 6px auto 8px; border: 2px solid #f79646; border-radius: 12px; padding: 10px 6px; font-size: 15px; font-weight: 700; }
.pd-taxid { font-size: 12.5px; }
.pd-box { display: grid; grid-template-columns: 54% 46%; border: 2px solid #000; border-bottom: 0; }
.pd-cust { padding: 4px 6px; border-right: 2px solid #000; display: flex; flex-direction: column; min-height: 126px; }
.pd-row { display: grid; grid-template-columns: 50px 1fr; gap: 4px; }
.pd-row b { font-size: 14.5px; }
.pd-tax { margin-top: auto; grid-template-columns: auto 1fr; }
.pd-lbl { white-space: nowrap; }
.pd-info { display: flex; flex-direction: column; }
.pd-irow { display: grid; grid-template-columns: 128px 1fr; padding: 2px 6px; min-height: 25px; align-items: center; }
.pd-irow b { text-align: center; }
.pd-irow b.big { font-size: 15.5px; }
.pd-table { width: 100%; border-collapse: collapse; border: 2px solid #000; table-layout: fixed; }
.pd-table th { border: 1px solid #000; border-bottom: 1.5px solid #000; padding: 3px 4px; font-weight: 700; text-align: center; }
.pd-table td { border-left: 1px solid #000; border-right: 1px solid #000; padding: 2px 5px; height: 25px; vertical-align: top; }
.pd-table td.c { text-align: center; }
.pd-table td.r { text-align: right; }
.pd-table td.l { word-break: break-word; }
.pd-totals { display: grid; grid-template-columns: 54% 46%; border: 2px solid #000; border-top: 1.5px solid #000; border-bottom: 0; }
.pd-tleft { border-right: 2px solid #000; padding: 6px 10px; text-align: center; font-size: 12.5px; }
.pd-wht { margin-top: 8px; font-style: normal; font-size: 12.5px; }
/* columns line up with the item table: จำนวน+หน่วย 18% | ราคา/หน่วย 13% | จำนวนเงิน 15% (of the page) */
.pd-tright > div { display: grid; grid-template-columns: 39.13% 28.26% 32.61%; align-items: center; min-height: 25px; }
.pd-tright b { padding-right: 5px; }
.pd-tright span:first-child { text-align: right; padding-right: 8px; }
.pd-tright span:nth-child(2) { text-align: center; }
.pd-tright b { text-align: right; }
.pd-net { display: grid; grid-template-columns: 54% 31% 15%; border: 2px solid #000; border-bottom-width: 3px; }
.pd-words { border-right: 2px solid #000; text-align: center; padding: 3px; font-weight: 700; }
.pd-netlbl { text-align: center; padding: 3px; font-weight: 700; border-right: 1px solid #000; }
.pd-netval { text-align: right; padding: 3px 5px; font-weight: 700; }
.pd-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 14px; text-align: center; }
.pd-sign-img { height: 56px; display: flex; align-items: flex-end; justify-content: center; }
.pd-sign-img img { max-height: 56px; max-width: 200px; object-fit: contain; }
.pd-sign-line { border-top: 1.5px solid #000; margin: 2px 10px 4px; }
.pd-sign-role { font-weight: 700; }
.pd-sign-date { margin-top: 2px; }
.pd-signs-rc { grid-template-columns: 1.3fr 1fr; align-items: end; text-align: left; }
.pd-signs-rc .pd-sign { text-align: center; }
.pd-pay div { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.pd-check { width: 16px; height: 16px; border: 2px solid #f79646; display: inline-block; flex: none; }
.pd-check.on { background: #f79646; }
.pd-bottom { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-top: 16px; }
.pd-notes { flex: 1; font-size: 13px; }
.pd-qrs { display: flex; gap: 12px; }
.pd-qr { width: 88px; text-align: center; font-size: 9.5px; font-weight: 600; color: #333; }
.pd-qr svg { width: 84px; height: 84px; display: block; margin: 0 auto 2px; }
.pd-stamp {
  position: absolute; top: 44%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 130px; font-weight: 800; color: rgba(220, 38, 38, .2);
  border: 10px solid rgba(220, 38, 38, .2); border-radius: 30px; padding: 0 40px; pointer-events: none; z-index: 2; white-space: nowrap;
}
.pd-stamp.draft { color: rgba(100, 116, 139, .18); border-color: rgba(100, 116, 139, .18); }
.pdf-host { position: fixed; left: -10000px; top: 0; width: 794px; background: #fff; }
#print-root { display: none; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .printout { box-shadow: none; page-break-after: always; }
}

/* grid children may shrink below their content (the 794px printout preview, long buttons) */
.form-layout > *, .view-layout > *, .two-col > *, .grid > *, .shell > * { min-width: 0; }
.preview-wrap { max-width: 100%; }
.add-row .btn { white-space: normal; text-align: center; line-height: 1.3; }
.pdf-host .printout { min-height: 1100px; }
.qr-img { width: 100%; height: auto; image-rendering: pixelated; }
.pd-qr .qr-img { width: 84px; height: 84px; margin: 0 auto 2px; }

/* ---------- login: pick user + PIN pad ---------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.user-pick {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px; border-radius: 18px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; transition: transform .12s, border-color .15s, box-shadow .15s;
}
.user-pick:hover, .user-pick:focus-visible { border-color: var(--c); box-shadow: 0 10px 24px -14px var(--c); transform: translateY(-2px); }
.user-pick .avatar, .pin-user .avatar { width: 54px; height: 54px; border-radius: 18px; font-size: 22px; }
.user-pick b { font-size: 15px; text-align: center; overflow-wrap: anywhere; }
.user-pick small { color: var(--muted); font-size: 12px; }
.pin-user { display: flex; align-items: center; justify-content: center; gap: 12px; }
.pin-user b { display: block; font-size: 18px; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 8px 0 4px; }
.pin-dots i { width: 15px; height: 15px; border-radius: 50%; border: 2px solid #a5b4fc; transition: background .12s, transform .12s; }
.pin-dots i.on { background: var(--grad); border-color: transparent; transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pin-msg { min-height: 22px; text-align: center; color: var(--bad); font-size: 13.5px; font-weight: 600; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.pin-pad button {
  height: 62px; border-radius: 18px; border: 1px solid var(--line); background: #f8faff; font-size: 24px; font-weight: 700; color: var(--ink);
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background .1s, transform .08s;
}
.pin-pad button:active { transform: scale(.94); background: #e0e7ff; }
.pin-pad button.ok { background: var(--grad); color: #fff; border: 0; }
.checking .pin-pad { opacity: .5; pointer-events: none; }

/* ---------- warranty ---------- */
.warranty { margin-top: 14px; padding: 14px 16px; border-radius: 16px; display: flex; gap: 12px; align-items: center; }
.warranty i { font-size: 26px; }
.warranty b { display: block; font-size: 16px; }
.warranty span { font-size: 13.5px; }
.warranty.on { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.warranty.off { background: #f8fafc; color: #475569; border: 1px solid var(--line); }
.warranty .left { margin-left: auto; text-align: right; font-weight: 800; font-size: 20px; white-space: nowrap; }
.warranty .left small { display: block; font-size: 11.5px; font-weight: 600; }

/* ---------- quick picks in the form ---------- */
.quick-picks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-picks .lbl { width: 100%; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.qp { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 8px 12px; border-radius: 12px; border: 1px solid #c7d2fe; background: #eef2ff; color: #3730a3; font-weight: 600; font-size: 13.5px; cursor: pointer; }
.qp span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qp small { color: #6366f1; font-weight: 700; white-space: nowrap; }
.qp:hover { background: #e0e7ff; }
.qp.hist { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.qp.hist small { color: #c2410c; }
.save-total { display: block; font-size: 12px; opacity: .9; font-weight: 500; }

/* products: selection bar for deleting several items */
.pick-bar { position: sticky; top: 62px; z-index: 15; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding: 10px 12px;
  border-radius: 14px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.pick-bar span { margin-right: auto; }
.tbl input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--blue); }
