/* ------------------------------------------------------------------ dashboard */
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 16px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.dash-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dash-grid, .dash-grid.three { grid-template-columns: minmax(0, 1fr); } }
.chart-box { position: relative; height: 320px; }
.chart-box.sm { height: 240px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); align-items: center; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.donut-wrap { position: relative; height: 250px; display: grid; place-items: center; }
.donut-center { position: absolute; text-align: center; pointer-events: none; }
.donut-center b { display: block; font: 700 28px var(--font-display); }
.donut-center span { font-size: 12px; color: var(--muted); }
.rank-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; }
.rank-row .n { width: 26px; height: 26px; border-radius: 8px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font: 700 12px var(--font-display); }
.rank-row .bar { height: 6px; border-radius: 6px; background: var(--surface-3); margin-top: 5px; overflow: hidden; } .rank-row .bar i { display: block; height: 100%; border-radius: 6px; background: var(--grad); }
.fab-tabs { position: fixed; right: 20px; bottom: 16px; z-index: 30; display: flex; gap: 8px; }
.pill-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 99px; font-weight: 600; font-size: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); box-shadow: var(--shadow); text-decoration: none !important; }
.pill-btn.on { background: var(--grad); color: #fff; border-color: transparent; }

/* ------------------------------------------------------------------ gatepass form / detail */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1200px) { .form-layout { grid-template-columns: minmax(0, 1fr); } }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.type-card { position: relative; text-align: left; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface); display: flex; gap: 12px; align-items: flex-start; transition: all .15s; }
.type-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.type-card.on { border-color: var(--primary); background: var(--primary-50); box-shadow: var(--ring); }
.type-card .tic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; }
.type-card b { display: block; font-size: 13px; font-weight: 600; line-height: 1.3; } .type-card small { color: var(--muted); font-size: 11.5px; }
.dir-toggle { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-3); border-radius: 16px; }
.dir-toggle button { border: 0; height: 44px; padding: 0 22px; border-radius: 12px; background: transparent; font-weight: 600; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.dir-toggle button.on.out { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(160, 38, 211, .3); }
.dir-toggle button.on.in { background: linear-gradient(135deg, #14b8a6, #10b981); color: #fff; box-shadow: 0 6px 16px rgba(16, 185, 129, .3); }
.items-table { width: 100%; }
.items-table th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: left; padding: 6px 6px; white-space: nowrap; }
.items-table td { padding: 5px 4px; vertical-align: top; }
.items-table .input, .items-table .select { height: 38px; font-size: 13px; padding: 0 10px; }
.item-card { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--surface-2); }
.side-summary { position: sticky; top: calc(var(--top-h) + 16px); }
.approver-chain { display: flex; flex-direction: column; gap: 10px; }
.approver-chain .ac { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.approver-chain .ac .no { width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font: 700 12px var(--font-display); flex: 0 0 auto; }
.doc-hero { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; padding: 20px 22px; }
.doc-hero .qr { width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 16px; border: 1px solid var(--line); flex: 0 0 auto; display: grid; place-items: center; }
.doc-no { font: 700 22px var(--font-display); letter-spacing: .01em; }
.wait-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; background: var(--surface-3); font-size: 11px; font-weight: 600; color: var(--text-2); }
.wait-chip.over { background: var(--red-50); color: var(--red); } .wait-chip.live { background: var(--amber-50); color: #b45309; }

/* ------------------------------------------------------------------ guard console (mobile first) */
.guard-wrap { max-width: 920px; margin: 0 auto; }
.scan-panel { display: grid; gap: 14px; }
.scanner { position: relative; overflow: hidden; border-radius: 22px; background: #0d0a26; aspect-ratio: 4 / 3; max-height: 60vh; width: 100%; box-shadow: var(--shadow-lg); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; inset: 14%; border-radius: 22px; box-shadow: 0 0 0 999px rgba(13, 10, 38, .55); border: 3px solid rgba(255, 255, 255, .9); }
.scanner .frame::before { content: ''; position: absolute; left: 6%; right: 6%; height: 3px; top: 10%; background: linear-gradient(90deg, transparent, #c026d3, transparent); animation: scanLine 2.2s ease-in-out infinite; }
@keyframes scanLine { 0%, 100% { top: 10%; } 50% { top: 88%; } }
.scanner .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.scanner .off { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; text-align: center; gap: 8px; padding: 24px; }
.verdict { border-radius: 22px; padding: 22px; text-align: center; color: #fff; }
.verdict.ok { background: linear-gradient(135deg, #10b981, #059669); } .verdict.bad { background: linear-gradient(135deg, #ef4444, #be123c); } .verdict.warn { background: linear-gradient(135deg, #f59e0b, #d97706); }
.verdict .big { font: 700 26px var(--font-display); margin-top: 6px; } .verdict small { display: block; opacity: .9; margin-top: 4px; font-size: 13px; }
.check-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.check-row.done { background: var(--green-50); border-color: transparent; }
.qty-stepper { display: inline-flex; align-items: center; gap: 4px; }
.qty-stepper button { width: 38px; height: 38px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700; font-size: 18px; }
.qty-stepper input { width: 64px; height: 38px; text-align: center; border: 1px solid var(--line-strong); border-radius: 11px; font-weight: 600; background: var(--surface); }
.manual-input { height: 56px; font-size: 18px; font-family: var(--font-display); letter-spacing: .04em; }
@media (max-width: 620px) { .guard-wrap .page { padding: 12px; } }

/* ------------------------------------------------------------------ image tool */
.imgtool { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; min-height: 480px; height: 100%; }
@media (max-width: 900px) { .imgtool { grid-template-columns: minmax(0, 1fr); } }
.imgtool .stage { position: relative; border-radius: 16px; background: repeating-conic-gradient(#2a2650 0% 25%, #221f45 0% 50%) 50% / 20px 20px; overflow: hidden; min-height: 360px; display: flex; align-items: center; justify-content: center; }
.imgtool .stage img, .imgtool .stage canvas { max-width: 100%; }
.imgtool .stage .cropper-container { max-height: 100%; }
.imgtool .panel { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding-right: 2px; }
.tool-group { padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.tool-group h4 { font-size: 12px; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 8px; text-transform: uppercase; }
.tool-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tool-btn { min-width: 40px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 500; }
.tool-btn:hover { border-color: var(--primary); color: var(--primary); } .tool-btn.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.slider { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); margin: 6px 0; }
.slider input[type=range] { width: 100%; accent-color: var(--primary); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px; }
.thumbs .th { position: relative; flex: 0 0 auto; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: var(--surface-3); }
.thumbs .th.on { border-color: var(--primary); } .thumbs .th img { width: 100%; height: 100%; object-fit: cover; }
.camera-box { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; }
.shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid #fff; background: rgba(255, 255, 255, .25); position: relative; }
.shutter::after { content: ''; position: absolute; inset: 5px; border-radius: 50%; background: #fff; transition: transform .1s; } .shutter:active::after { transform: scale(.88); }
.dropzone { border: 2px dashed var(--line-strong); border-radius: 18px; padding: 28px 16px; text-align: center; color: var(--muted); background: var(--surface-2); transition: all .15s; }
.dropzone.over { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.cropper-view-box { outline-color: #c026d3; } .cropper-line, .cropper-point { background-color: #c026d3; } .cropper-face { background-color: transparent; }

/* ------------------------------------------------------------------ misc pages */
.role-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.perm-matrix { overflow: auto; max-height: 68vh; border: 1px solid var(--line); border-radius: 16px; }
.perm-matrix table { min-width: 720px; } .perm-matrix th, .perm-matrix td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.perm-matrix thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; }
.perm-matrix tr.grp td { background: var(--surface-3); font: 600 12px var(--font-display); color: var(--primary); letter-spacing: .04em; position: sticky; left: 0; }
.perm-matrix td.c, .perm-matrix th.c { text-align: center; }
.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.diff .old { color: var(--red); text-decoration: line-through; opacity: .85; } .diff .new { color: var(--green); font-weight: 600; }
.flow-step { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.flow-step .no { width: 36px; height: 36px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; font: 700 14px var(--font-display); }
.bar-h { display: grid; grid-template-columns: 150px minmax(0, 1fr) 90px; gap: 10px; align-items: center; padding: 7px 0; font-size: 13px; }
.bar-h .track { height: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; } .bar-h .track i { display: block; height: 100%; border-radius: 99px; background: var(--grad); }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-right: 6px; box-shadow: 0 0 0 3px rgba(16, 185, 129, .2); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand .side-logo { width: 46px; height: 46px; border-radius: 14px; } .login-brand b { font: 700 20px var(--font-display); display: block; } .login-brand small { color: var(--pink); font-size: 9.5px; letter-spacing: .22em; font-weight: 600; }
.stepper-mini { display: flex; gap: 6px; margin-bottom: 20px; } .stepper-mini i { flex: 1; height: 5px; border-radius: 9px; background: var(--line-strong); } .stepper-mini i.on { background: var(--grad); }
.terms { max-height: 190px; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); font-size: 12.5px; color: var(--text-2); white-space: pre-line; }

/* ------------------------------------------------------------------ approver action bar */
.action-bar { position: fixed; left: var(--side-w); right: 0; bottom: 0; z-index: 35; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -10px 30px rgba(76, 29, 149, .1); padding: 14px 24px; }
.app.collapsed .action-bar { left: var(--side-w-collapsed); }
@media (max-width: 1023px) { .action-bar, .app.collapsed .action-bar { left: 0; padding: 12px; } }

/* ------------------------------------------------------------------ printable gatepass (A4) */
.print-page { min-height: 100vh; background: #e9e6f5; padding: 0 0 40px; }
.print-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet {
  position: relative; width: 210mm; min-height: 297mm; margin: 24px auto; padding: 11mm 12mm; background: #fff; color: #111; font-family: var(--font-body); font-size: 11.5px; line-height: 1.45;
  box-shadow: 0 12px 50px rgba(45, 27, 105, .25); overflow: hidden;
}
.sheet h4 { margin: 0 0 4px; font: 700 10.5px var(--font-display); letter-spacing: .04em; color: #4c1d95; text-transform: uppercase; }
.sheet p { margin: 1px 0; }
.sheet .mono { font-family: ui-monospace, Consolas, monospace; }
.sheet .tiny { font-size: 9.5px; color: #555; } .sheet .muted { color: #666; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-bottom: 8px; border-bottom: 3px solid #7c3aed; }
.sheet-head .brand { display: flex; gap: 10px; align-items: center; }
.sheet-head .logo { height: 46px; width: auto; max-width: 120px; object-fit: contain; }
.sheet-head .logo-fallback { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, #7c3aed, #c026d3); color: #fff; display: grid; place-items: center; }
.sheet-head .co { font: 700 16px var(--font-display); } .sheet-head .co-en { font-size: 11px; color: #444; } .sheet-head .addr { font-size: 9.5px; color: #555; max-width: 340px; }
.doc-title { text-align: right; } .doc-title .dt-th { font: 700 20px var(--font-display); color: #4c1d95; } .doc-title .dt-en { font: 600 11px var(--font-display); letter-spacing: .14em; color: #c026d3; }
.docno-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0; }
.docno { display: flex; flex-direction: column; } .docno span { font-size: 10px; color: #555; } .docno b { font-size: 24px; letter-spacing: .02em; color: #111; }
.qrbox { display: flex; flex-direction: column; align-items: center; gap: 2px; } .qrbox span.mono { font-size: 11px; font-weight: 700; } .qrbox .tiny { font-size: 8.5px; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.sheet .meta { border: 1px solid #d9d4ee; border-radius: 8px; padding: 6px 9px; background: #fbfaff; }
.purpose { margin: 7px 0; padding: 6px 9px; border-left: 3px solid #c026d3; background: #faf5ff; border-radius: 0 6px 6px 0; }
.items { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 11px; }
.items th { background: #4c1d95; color: #fff; padding: 4px 5px; font-weight: 600; text-align: left; font-size: 10px; border: 1px solid #4c1d95; }
.items td { border: 1px solid #cfc9e6; padding: 3px 5px; vertical-align: top; height: 20px; }
.items td.c, .items th.c { text-align: center; } .items td.r { text-align: right; } .items tfoot td { border: 1px solid #cfc9e6; background: #f5f3ff; }
.items .chk { text-align: center; } .box { display: inline-block; width: 11px; height: 11px; border: 1.4px solid #333; border-radius: 2px; vertical-align: -2px; }
.photos { margin-top: 7px; } .photos div { display: flex; gap: 6px; margin-top: 3px; } .photos img { height: 62px; width: auto; border-radius: 5px; border: 1px solid #ddd; object-fit: cover; }
.sign-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.sign { text-align: center; font-size: 10px; display: flex; flex-direction: column; align-items: center; }
.sign .sig { height: 44px; display: flex; align-items: flex-end; justify-content: center; } .sign .sig img { max-height: 42px; max-width: 110px; }
.sign .line { width: 100%; border-top: 1px solid #333; margin: 2px 0 3px; }
.stamp { border: 2px solid #059669; color: #059669; border-radius: 6px; padding: 1px 8px; font: 700 10px var(--font-display); transform: rotate(-4deg); }
.guard-box { margin-top: 10px; border: 1.5px dashed #7c3aed; border-radius: 8px; padding: 7px 10px; }
.gb-grid > div { margin: 6px 0; }
.sheet-foot { margin-top: 8px; padding-top: 5px; border-top: 1px solid #ddd; font-size: 9.5px; color: #444; }
.watermark { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 5; font: 800 92px var(--font-display); transform: rotate(-28deg); letter-spacing: .06em; white-space: nowrap; }
.watermark.reprint { color: rgba(245, 158, 11, .16); } .watermark.status { color: rgba(239, 68, 68, .16); }
@media (max-width: 900px) { .sheet { width: 100%; margin: 0; box-shadow: none; padding: 16px; } .meta-grid { grid-template-columns: 1fr; } }
