/* =====================================================================
   SmartPrint — glassmorphism dashboard theme (Bootstrap 5 overrides)
   ===================================================================== */
:root {
    --sp-bg-1: #0f172a;
    --sp-bg-2: #1e1b4b;
    --sp-primary: #4f46e5;
    --sp-primary-2: #06b6d4;
    --sp-text: #0f172a;
    --sp-muted: #64748b;
    --sp-glass: rgba(255, 255, 255, 0.72);
    --sp-glass-border: rgba(255, 255, 255, 0.55);
    --sp-shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.25);
    --sp-radius: 18px;
    --sidebar-w: 268px;
    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body { min-height: 100%; }
body.app-body {
    color: var(--sp-text);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(6, 182, 212, 0.22), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(236, 72, 153, 0.16), transparent 60%),
        var(--sp-page-base, linear-gradient(160deg, #eef2ff 0%, #f8fafc 45%, #ecfeff 100%));
    background-attachment: fixed;
}

.btn-primary { --bs-btn-bg: var(--sp-primary); --bs-btn-border-color: var(--sp-primary); --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca; --bs-btn-active-bg: #3730a3; background-image: linear-gradient(135deg, #4f46e5, #6366f1); }
.btn-outline-primary { --bs-btn-color: var(--sp-primary); --bs-btn-border-color: rgba(79,70,229,.45); --bs-btn-hover-bg: var(--sp-primary); --bs-btn-hover-border-color: var(--sp-primary); --bs-btn-active-bg: var(--sp-primary); }
.btn-lg { border-radius: 14px; padding: .7rem 1.25rem; }
.btn, .form-control, .form-select { border-radius: 12px; }
.form-control, .form-select { border-color: rgba(100, 116, 139, .3); background-color: var(--sp-input-bg, rgba(255,255,255,.85)); }
.form-control:focus, .form-select:focus { border-color: #818cf8; box-shadow: 0 0 0 .2rem rgba(99, 102, 241, .2); }
.text-bg-primary { background-color: var(--sp-primary) !important; }
.page-link { color: var(--sp-accent-text, var(--sp-primary)); }
.active > .page-link, .page-link.active { background-color: var(--sp-primary); border-color: var(--sp-primary); }

/* ---------- glass surfaces ---------- */
.glass {
    background: var(--sp-glass);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid var(--sp-glass-border);
    border-radius: var(--sp-radius);
    box-shadow: var(--sp-shadow);
}
.glass-modal { background: var(--sp-modal-bg, rgba(255,255,255,.92)); backdrop-filter: blur(18px); border: 1px solid var(--sp-glass-border); border-radius: var(--sp-radius); }
.glass-alert { border-radius: 14px; box-shadow: var(--sp-shadow); }
.panel { padding: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin-bottom: .9rem; }
.panel-head h3 { font-size: 1.02rem; font-weight: 600; margin: 0; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sp-muted); font-weight: 700; margin: 0 0 .75rem; }
.empty-state { text-align: center; color: var(--sp-muted); padding: 2rem 1rem; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, rgba(15,23,42,.96), rgba(30,27,75,.96));
    color: #cbd5e1; padding: 1.1rem .8rem; overflow-y: auto;
    transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: .7rem; color: #fff; text-decoration: none; padding: .3rem .5rem 1.1rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { color: #94a3b8; font-size: .75rem; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; font-size: 1.25rem; background: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-2)); box-shadow: 0 8px 20px -6px rgba(79,70,229,.7); flex-shrink: 0; }
.brand-mark.big { width: 72px; height: 72px; border-radius: 22px; font-size: 2rem; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; border-radius: 10px; background: #fff; flex-shrink: 0; }
.brand-logo.big { width: 84px; height: 84px; border-radius: 20px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #64748b; padding: 1rem .8rem .35rem; font-weight: 700; }
.side-link { display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 12px; color: #cbd5e1; text-decoration: none; font-size: .92rem; transition: background .15s, color .15s; }
.side-link i { font-size: 1.1rem; width: 1.3rem; text-align: center; }
.side-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.side-link.active { background: linear-gradient(135deg, rgba(79,70,229,.9), rgba(6,182,212,.75)); color: #fff; box-shadow: 0 8px 20px -10px rgba(79,70,229,.9); }
.phase-pill { font-size: .62rem; padding: .1rem .4rem; border-radius: 6px; background: rgba(148,163,184,.2); color: #94a3b8; font-weight: 700; }
.side-foot { font-size: .72rem; color: #475569; padding: .8rem; }
.sidebar-backdrop { display: none; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem;
    padding: .8rem 1.5rem; background: var(--sp-topbar-bg, rgba(248,250,252,.7)); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(148,163,184,.18);
}
.page-title { font-size: 1.3rem; font-weight: 700; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }
.clock { color: var(--sp-muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.btn-icon { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 12px; font-size: 1.25rem; color: var(--sp-text); background: var(--sp-surface-soft, rgba(255,255,255,.7)); border: 1px solid rgba(148,163,184,.25); }
.btn-icon .dot { position: absolute; top: 9px; right: 10px; width: 9px; height: 9px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 0 2px var(--sp-ring, #fff); }
.user-chip { display: flex; align-items: center; gap: .55rem; background: var(--sp-surface-soft, rgba(255,255,255,.7)); border: 1px solid rgba(148,163,184,.25); border-radius: 14px; padding: .3rem .7rem .3rem .3rem; }
.user-chip small { color: var(--sp-muted); }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6366f1, #ec4899); font-size: .9rem; }
.agent-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .78rem; font-weight: 600; padding: .3rem .65rem; border-radius: 999px; background: rgba(148,163,184,.15); color: var(--sp-muted); }
.agent-pill i { font-size: .55rem; }
.agent-pill.online { background: rgba(16,185,129,.12); color: var(--sp-ok-text, #047857); }
.agent-pill.offline { background: rgba(245,158,11,.14); color: var(--sp-warn-text, #b45309); }
.content { padding: 1.5rem; flex: 1; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: none; }
    .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1035; }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
    .topbar { padding: .7rem 1rem; }
}
@media (max-width: 575.98px) {
    .topbar .agent-pill span { display: none; }
    .topbar .agent-pill { padding: .45rem; }
}

/* ---------- dashboard ---------- */
.hero { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; padding: 1.4rem 1.6rem;
    background: linear-gradient(135deg, rgba(79,70,229,.12), rgba(6,182,212,.1)), var(--sp-glass); }
.stat-card { padding: 1.1rem 1.1rem 1rem; height: 100%; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -35px; top: -35px; background: var(--tone); opacity: .12; }
.stat-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: var(--tone); font-size: 1.15rem; margin-bottom: .7rem; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--sp-muted); font-size: .82rem; }
.tone-indigo { --tone: #6366f1; } .tone-emerald { --tone: #10b981; } .tone-amber { --tone: #f59e0b; }
.tone-sky { --tone: #0ea5e9; } .tone-teal { --tone: #14b8a6; } .tone-pink { --tone: #ec4899; }

.service-card { display: flex; flex-direction: column; gap: .3rem; padding: 1.2rem; height: 100%; min-height: 150px; text-decoration: none; color: inherit; position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.service-card:hover { transform: translateY(-3px); box-shadow: 0 18px 36px -16px rgba(15,23,42,.35); color: inherit; }
.service-card.disabled { opacity: .5; pointer-events: none; }
.service-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; font-size: 1.5rem; color: #fff; background: var(--accent); box-shadow: 0 10px 20px -10px var(--accent); margin-bottom: .35rem; }
.service-icon.big { width: 84px; height: 84px; border-radius: 24px; font-size: 2.4rem; display: grid; }
.service-title { font-weight: 700; font-size: 1rem; }
.service-desc { color: var(--sp-muted); font-size: .83rem; }
.phase-tag { position: absolute; top: .8rem; right: .8rem; font-size: .68rem; font-weight: 700; padding: .15rem .5rem; border-radius: 8px; background: rgba(100,116,139,.12); color: var(--sp-muted); }

.file-row { display: flex; align-items: center; gap: .75rem; background: transparent; border-color: rgba(148,163,184,.18); padding: .6rem .25rem; }
.file-row:hover { background: rgba(99,102,241,.05); }
.file-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--sp-placeholder, #e2e8f0); }
.file-thumb.icon { display: inline-grid; place-items: center; font-size: 1.5rem; color: var(--sp-accent-text, var(--sp-primary)); background: rgba(99,102,241,.1); }
.printer-row { display: flex; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid rgba(148,163,184,.18); }
.printer-row:last-child { border-bottom: 0; }
.printer-row .bi-circle-fill { font-size: .55rem; }

/* ---------- incoming ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; text-align: center; cursor: pointer;
    padding: 2rem 1rem; border: 2px dashed rgba(99,102,241,.4); border-radius: 16px; background: rgba(99,102,241,.04); transition: all .15s; width: 100%; }
.dropzone > i { font-size: 2.6rem; color: var(--sp-accent-text, var(--sp-primary)); }
.dropzone.dragover { background: rgba(99,102,241,.12); border-color: var(--sp-primary); transform: scale(1.01); }
.channel-list { list-style: none; padding: 0; margin: 0 0 .6rem; }
.channel-list li { display: flex; gap: .55rem; align-items: flex-start; padding: .28rem 0; }
.channel-list i { color: var(--sp-accent-text, var(--sp-primary)); }
.channel-list code { word-break: break-all; font-size: .75rem; }
.incoming-table .file-thumb { width: 52px; height: 52px; cursor: pointer; }
.incoming-table tr.is-new td { background: rgba(79,70,229,.05); }
.incoming-table tr.is-new .fname::after { content: "NEW"; font-size: .6rem; font-weight: 800; margin-left: .4rem; padding: .05rem .35rem; border-radius: 5px; color: #fff; background: var(--sp-primary); vertical-align: middle; }
.status-badge { font-weight: 600; }
.preview-box { min-height: 420px; max-height: 70vh; display: grid; place-items: center; border-radius: 14px; background: repeating-conic-gradient(var(--sp-checker-a, #f1f5f9) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 20px 20px; overflow: auto; }
.preview-box img { max-width: 100%; max-height: 68vh; object-fit: contain; }
.preview-box iframe { width: 100%; height: 68vh; border: 0; border-radius: 12px; background: #fff; }
.preview-box pre { width: 100%; height: 68vh; margin: 0; padding: 1rem; background: #fff; color: #111; white-space: pre-wrap; font-size: .85rem; }
.preview-box .doc-icon { font-size: 5rem; color: var(--sp-accent-text, var(--sp-primary)); }
/* Document printing: file-type colours (Word, Excel, PowerPoint, PDF, images, text) */
.ft-word { color: #2b579a !important; } .ft-excel { color: #217346 !important; } .ft-powerpoint { color: #c43e1c !important; }
.ft-pdf { color: #d93025 !important; } .ft-image { color: #0e7490 !important; } .ft-text { color: #64748b !important; }
[data-bs-theme="dark"] .ft-word { color: #7aa7ec !important; } [data-bs-theme="dark"] .ft-excel { color: #5fd08f !important; }
[data-bs-theme="dark"] .ft-powerpoint { color: #ff8a65 !important; } [data-bs-theme="dark"] .ft-pdf { color: #ff7b72 !important; }
[data-bs-theme="dark"] .ft-image { color: #5ee0f5 !important; } [data-bs-theme="dark"] .ft-text { color: #a3b1c6 !important; }
.doc-actions .btn { white-space: nowrap; }
#pdForm .pd-doc { padding: .6rem .75rem; border-radius: 10px; border: 1px solid rgba(148,163,184,.3); }
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin-bottom: 1rem; }
.meta-list dt { color: var(--sp-muted); font-weight: 500; }
.meta-list dd { margin: 0; word-break: break-word; }
.webcam-stage { position: relative; background: #0f172a; border-radius: 14px; overflow: hidden; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.webcam-stage video, .webcam-stage canvas { width: 100%; height: 100%; object-fit: contain; }
.cam-msg { position: absolute; color: #cbd5e1; }
.qr-box { display: inline-block; padding: 12px; background: #fff; border-radius: 14px; box-shadow: var(--sp-shadow); }
.qr-box img { display: block; width: 240px; height: 240px; image-rendering: pixelated; }

/* ---------- misc ---------- */
.glass-pills .nav-link { border-radius: 12px; color: var(--sp-text); background: var(--sp-surface-faint, rgba(255,255,255,.6)); margin-right: .4rem; margin-bottom: .4rem; }
.glass-pills .nav-link.active { background: linear-gradient(135deg, #4f46e5, #6366f1); color: #fff; }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { border-color: rgba(148,163,184,.2); }
.toast { border-radius: 14px; overflow: hidden; backdrop-filter: blur(16px); background: var(--sp-toast-bg, rgba(255,255,255,.95)); }
.toast .toast-thumb { width: 54px; height: 54px; object-fit: cover; border-radius: 10px; }

/* ---------- auth / standalone ---------- */
body.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background: radial-gradient(800px 500px at 15% 10%, rgba(99,102,241,.55), transparent 60%),
                radial-gradient(800px 500px at 90% 90%, rgba(6,182,212,.45), transparent 60%),
                linear-gradient(160deg, #0f172a, #1e1b4b); }
.auth-card { width: 100%; max-width: 430px; padding: 2.2rem; background: var(--sp-modal-bg, rgba(255,255,255,.86)); }
/* Login page footer: the card stays centred in the first row, the footer sits in its own row at the bottom
   (never on top of the card; on short screens the page scrolls instead of overlapping). */
body.auth-body { grid-template-rows: 1fr auto; row-gap: 1rem; }
.auth-footer { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .35rem .6rem;
    font-size: .8rem; letter-spacing: .02em; color: rgba(255, 255, 255, .88); text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .75), 0 0 12px rgba(0, 0, 0, .45); }
.auth-footer strong { font-weight: 600; color: #fff; }
.auth-footer-sep { opacity: .55; }
.auth-footer-dev { display: inline-flex; align-items: center; gap: .5rem; white-space: nowrap; }
.auth-footer-logo { height: 30px; width: auto; display: block; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .55)); }
/* Over a custom picture / video (which may be very light), a subtle dark glass strip keeps the footer readable. */
body.has-custom-bg .auth-footer { padding: .3rem .95rem; border-radius: 999px; background: rgba(15, 23, 42, .55);
    border: 1px solid rgba(255, 255, 255, .12); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
@media (max-width: 575.98px) {
    .auth-footer { flex-direction: column; gap: .2rem; font-size: .74rem; }
    .auth-footer-sep { display: none; }   /* two stacked lines on phones: no dangling "|" */
    .auth-footer-logo { height: 26px; }
    body.has-custom-bg .auth-footer { border-radius: 14px; }
}

/* Custom login background (System Settings → Login Background): full screen, never stretched */
.auth-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    background-color: #0f172a; background-position: center; background-size: cover; background-repeat: no-repeat; }
.auth-bg-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
body.has-custom-bg { background: #0f172a; }
body.has-custom-bg .auth-card { position: relative; z-index: 1; color: #e2e8f0;
    background: rgba(15, 23, 42, .72); border: 1px solid rgba(255, 255, 255, .14);
    -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
    box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .75); }
body.has-custom-bg .auth-card .text-muted { color: #94a3b8 !important; }
/* System Settings → Login Background: preview of the login page */
.lbg-current { padding: .9rem; border-radius: 14px; border: 1px solid rgba(148,163,184,.3); }
.lbg-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 12px; background: #0f172a; display: grid; place-items: center; }
.lbg-frame.lbg-default { background: radial-gradient(60% 60% at 15% 10%, rgba(99,102,241,.55), transparent 60%), radial-gradient(60% 60% at 90% 90%, rgba(6,182,212,.45), transparent 60%), linear-gradient(160deg, #0f172a, #1e1b4b); }
.lbg-frame:fullscreen { aspect-ratio: auto; border-radius: 0; }
.lbg-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lbg-mini-card { position: relative; z-index: 1; width: 24%; min-width: 70px; padding: 4% 3%; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px;
    background: rgba(15,23,42,.72); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(8px); color: #e2e8f0; text-align: center; }
.lbg-mini-card > span:not(.lbg-mini-logo) { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.18); }
.lbg-mini-logo { width: 22%; aspect-ratio: 1; border-radius: 6px; background: rgba(255,255,255,.35); }
.lbg-mini-card-lg { width: 30%; min-width: 150px; font-size: .72rem; line-height: 1.2; }
.lbg-mini-card-lg strong { font-size: .85rem; }
.lbg-mini-card-lg small { color: #94a3b8; }
.lbg-mini-logo-img { width: 26%; max-width: 54px; border-radius: 6px; }
.lbg-mini-card-lg .lbg-mini-field { height: 16px !important; border-radius: 5px !important; border: 1px solid rgba(255,255,255,.18); background: rgba(15,23,42,.6) !important; }
.lbg-mini-card-lg .lbg-mini-btn { height: 18px !important; border-radius: 5px !important; background: #6366f1 !important; }
.lbg-frame:fullscreen .lbg-mini-card-lg { width: 430px; padding: 2.2rem; font-size: 1rem; gap: 14px; }
.lbg-frame:fullscreen .lbg-mini-card-lg strong { font-size: 1.6rem; }
.lbg-frame:fullscreen .lbg-mini-card-lg .lbg-mini-field { height: 56px !important; }
.lbg-frame:fullscreen .lbg-mini-card-lg .lbg-mini-btn { height: 56px !important; }
.lbg-empty { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: .75rem; color: #cbd5e1; z-index: 1; }
/* Reduced motion: show the still poster instead of animation / video */
@media (prefers-reduced-motion: reduce) { .auth-bg .auth-bg-motion { display: none; } }

/* ---------- ID Photo Studio ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .75rem; }
.photo-tile { position: relative; display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--sp-surface, #fff); text-decoration: none; color: inherit; box-shadow: 0 4px 14px -8px rgba(15,23,42,.35); transition: transform .12s; }
.photo-tile:hover { transform: translateY(-2px); color: inherit; }
.photo-tile img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--sp-placeholder, #e2e8f0); }
.photo-tile span { font-size: .78rem; padding: .35rem .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.photo-tile small { display: block; color: var(--sp-muted); font-weight: 400; }
.tile-new { position: absolute; top: 6px; left: 6px; font-size: .6rem; padding: .1rem .35rem; border-radius: 5px; color: #fff; background: var(--sp-primary); }
.studio-toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.studio-toolbar .btn { min-width: 44px; min-height: 44px; }
.studio-toolbar .btn.active { background: var(--sp-primary); color: #fff; }
.tool-slider { display: flex; flex-direction: column; min-width: 130px; flex: 1; }
.tool-slider label { font-size: .75rem; color: var(--sp-muted); display: flex; justify-content: space-between; }
.stage-scroll { overflow: auto; max-height: 76vh; border-radius: 14px; background: repeating-conic-gradient(var(--sp-checker-a, #e2e8f0) 0% 25%, var(--sp-checker-b, #f1f5f9) 0% 50%) 50% / 18px 18px; display: flex; justify-content: center; padding: 0; }
.stage { position: relative; margin: auto; touch-action: none; user-select: none; }
.stage canvas { display: block; }
.stage.picking, .stage.picking .crop-box { cursor: crosshair; }
.crop-box { position: absolute; cursor: move; outline: 2px solid #fff; box-shadow: 0 0 0 2px var(--sp-primary), 0 0 0 9999px rgba(15,23,42,.55); touch-action: none; }
.crop-box .handle { position: absolute; width: 22px; height: 22px; background: #fff; border: 3px solid var(--sp-primary); border-radius: 50%; }
.crop-box .handle.nw { left: -11px; top: -11px; cursor: nwse-resize; } .crop-box .handle.ne { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-box .handle.sw { left: -11px; bottom: -11px; cursor: nesw-resize; } .crop-box .handle.se { right: -11px; bottom: -11px; cursor: nwse-resize; }
.guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.guides line, .guides ellipse { vector-effect: non-scaling-stroke; fill: none; stroke-width: 1.5; }
.g-center { stroke: rgba(255,255,255,.6); stroke-dasharray: 4 4; }
.g-third { stroke: rgba(255,255,255,.45); }
.g-crown { stroke: #22d3ee; stroke-width: 2 !important; }
.g-chin { stroke: #f59e0b; stroke-dasharray: 6 3; }
.g-band { fill: rgba(245,158,11,.18); }
.g-eye { stroke: #a78bfa; stroke-dasharray: 2 3; }
.g-oval { stroke: rgba(255,255,255,.85) !important; stroke-dasharray: 5 4; }
.lg { display: inline-block; width: 16px; height: 4px; margin-right: 4px; vertical-align: middle; border-radius: 2px; }
.lg-crown { background: #22d3ee; } .lg-band { background: #f59e0b; } .lg-eye { background: #a78bfa; }
.click-marker { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid #22d3ee; background: rgba(34,211,238,.3); pointer-events: none; }
.swatch { width: 38px; height: 38px; border-radius: 10px; border: 2px solid rgba(148,163,184,.5); cursor: pointer; }
.swatch.active { outline: 3px solid var(--sp-primary); outline-offset: 2px; }
.form-control-color { width: 46px; height: 38px; padding: 3px; }
.result-preview { position: relative; display: grid; place-items: center; min-height: 220px; border-radius: 14px; background: repeating-conic-gradient(var(--sp-checker-a, #f1f5f9) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 16px 16px; padding: 1rem; }
.result-preview img { max-width: 100%; max-height: 300px; box-shadow: 0 6px 22px -8px rgba(15,23,42,.5); }
.result-preview .spinner-border { position: absolute; }
.sheet-preview { display: grid; place-items: center; padding: 12px; border-radius: 14px; background: var(--sp-stage, #cbd5e1); min-height: 300px; }
.sheet-preview canvas { box-shadow: 0 10px 30px -10px rgba(15,23,42,.6); }
.layout-stats .big { font-size: 2rem; font-weight: 800; color: var(--sp-accent-text, var(--sp-primary)); }
.saved-box { padding: 1rem; border-radius: 14px; background: rgba(16,185,129,.08); border: 1px solid rgba(16,185,129,.3); }

/* ---------- Photo Editing Studio ---------- */
.compare { position: relative; width: 100%; max-height: 74vh; aspect-ratio: 3 / 4; margin: 0 auto; border-radius: 14px; overflow: hidden; background: #0f172a; touch-action: none; user-select: none; cursor: ew-resize; }
.compare.alpha, .compare.alpha .compare-after { background: repeating-conic-gradient(var(--sp-checker-a, #e2e8f0) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 18px 18px; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.compare-after { position: absolute; inset: 0; background: #0f172a; }
.compare-handle { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.5); pointer-events: none; }
.compare-handle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: #fff; color: var(--sp-primary); box-shadow: 0 4px 12px rgba(0,0,0,.35); font-size: .9rem; }
.compare-tag { position: absolute; top: 10px; padding: .2rem .6rem; border-radius: 8px; font-size: .75rem; font-weight: 700; color: #fff; background: rgba(15,23,42,.65); pointer-events: none; }
.compare-tag.left { left: 10px; } .compare-tag.right { right: 10px; background: rgba(79,70,229,.85); }
.neck-line { position: absolute; left: 0; right: 0; height: 0; border-top: 3px dashed #22d3ee; cursor: ns-resize; z-index: 3; }
.neck-line::before { content: ""; position: absolute; left: 0; right: 0; top: -14px; height: 28px; }
.neck-line span { position: absolute; left: 50%; transform: translate(-50%, -130%); white-space: nowrap; font-size: .72rem; font-weight: 600; color: #fff; background: rgba(8,145,178,.9); padding: .15rem .55rem; border-radius: 6px; }
.compare-busy { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; gap: .75rem; align-items: center; justify-content: center; text-align: center; padding: 1rem; color: #fff; background: rgba(15,23,42,.7); backdrop-filter: blur(3px); cursor: progress; }
.version-strip { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; }
.version { flex: 0 0 auto; width: 92px; border: 2px solid transparent; border-radius: 12px; background: var(--sp-surface, #fff); padding: 3px; text-align: left; box-shadow: 0 2px 8px -4px rgba(15,23,42,.4); }
.version img { width: 100%; height: 72px; object-fit: cover; border-radius: 9px; background: var(--sp-placeholder, #e2e8f0); }
.version.alpha img { background: repeating-conic-gradient(var(--sp-checker-a, #e2e8f0) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 10px 10px; object-fit: contain; }
.version span { display: block; font-size: .66rem; line-height: 1.2; padding: 3px 2px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version.active { border-color: var(--sp-primary); }
.attire-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.attire-btn { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .6rem .3rem; border-radius: 12px; border: 2px solid rgba(148,163,184,.35); background: var(--sp-surface-soft, rgba(255,255,255,.8)); font-size: .78rem; font-weight: 600; min-height: 64px; }
.attire-btn i { font-size: 1.3rem; color: var(--sp-accent-text, var(--sp-primary)); }
.attire-btn.active { border-color: var(--sp-primary); background: rgba(79,70,229,.08); }
.swatch-transparent { background: repeating-conic-gradient(var(--sp-checker-a, #cbd5e1) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 10px 10px; }
/* ID Photo Studio: background removal refinement */
.bgr-toolbar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .6rem; }
.bgr-range { display: flex; align-items: center; gap: .4rem; white-space: nowrap; }
.bgr-range .form-range { width: 120px; }
.bgr-stage { position: relative; overflow: auto; height: 62vh; min-height: 320px; border-radius: 14px; padding: 12px; background: var(--sp-stage, #cbd5e1); }
.bgr-canvases { display: flex; gap: 12px; width: max-content; margin: 0 auto; }
.bgr-canvases canvas { display: block; height: auto; touch-action: none; cursor: none; box-shadow: 0 8px 26px -10px rgba(15,23,42,.55); }
.bgr-stage #bgrAfter { background: var(--bgr-bg, #fff); }
.bgr-stage.transparent-bg #bgrAfter { background: repeating-conic-gradient(var(--sp-checker-a, #cbd5e1) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 0 0 / 16px 16px; }
.bgr-cursor { position: absolute; pointer-events: none; border: 2px solid #fff; outline: 1px solid rgba(15,23,42,.8); border-radius: 50%; transform: translate(-50%, -50%); }
.customer-view { background: #0b1020; }
.customer-view img { max-width: 92vw; max-height: 82vh; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.6); background: repeating-conic-gradient(var(--sp-checker-a, #e2e8f0) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 18px 18px; }

/* ---------- Documents ---------- */
.tpl-card { display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; width: 100%; height: 100%; text-align: left; padding: 1rem; border-radius: 16px; border: 1px solid rgba(148,163,184,.3); background: var(--sp-surface-soft, rgba(255,255,255,.8)); transition: transform .12s, box-shadow .12s; }
.tpl-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -14px rgba(15,23,42,.4); }
.tpl-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; font-size: 1.3rem; background: linear-gradient(135deg, #14b8a6, #22c55e); margin-bottom: .3rem; }
.tpl-name { font-weight: 700; }
.tpl-desc { font-size: .82rem; color: var(--sp-muted); flex: 1; }
.tpl-meta { font-size: .72rem; color: var(--sp-muted); text-transform: uppercase; letter-spacing: .04em; }
.doc-topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.doc-title { max-width: 420px; font-weight: 700; border-color: transparent; background: transparent; }
.doc-title:hover, .doc-title:focus { border-color: rgba(100,116,139,.3); background: var(--sp-input-bg, #fff); }
.doc-form { max-height: 78vh; overflow: auto; }
.doc-fieldset { border: 1px solid rgba(148,163,184,.35); border-radius: 14px; padding: .4rem .9rem .9rem; margin-bottom: 1rem; }
.doc-fieldset legend { float: none; width: auto; font-size: .85rem; font-weight: 700; padding: 0 .4rem; margin: 0; }
.list-item { position: relative; border-left: 3px solid #a5b4fc; background: var(--sp-list-bg, rgba(238,242,255,.6)); border-radius: 10px; padding: .6rem .7rem .2rem; margin-bottom: .6rem; }
.list-item-tools { position: absolute; top: .3rem; right: .3rem; display: flex; gap: 2px; z-index: 1; }
.list-item-tools .btn { padding: .1rem .35rem; }
.img-slot { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid #cbd5e1; background: #fff; }
.rt-editor { min-height: 140px; max-height: 360px; overflow: auto; background: var(--sp-surface, #fff); }
.rt-editor p { margin: 0 0 .5em; }
.doc-preview { width: 100%; height: 78vh; border: 0; border-radius: 12px; background: var(--sp-stage, #cbd5e1); }
.doc-toolbar { position: sticky; top: 70px; z-index: 20; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .5rem .75rem; }
.doc-toolbar .btn-light { background: #fff; border-color: #e2e8f0; }
.free-stage { overflow: auto; padding: 16px 0 40px; background: var(--sp-stage, #cbd5e1); border-radius: 16px; }
.free-sheet { box-sizing: border-box; margin: 0 auto; background-color: #fff; color: #111; box-shadow: 0 6px 24px rgba(15,23,42,.25); outline: none; }
.free-sheet p { margin: 0 0 .6em; } .free-sheet table { border-collapse: collapse; } .free-sheet img { max-width: 100%; cursor: pointer; }
.free-sheet .page-break { border-top: 2px dashed #6366f1; margin: 12px 0; height: 0; }
.free-sheet .page-break::after { content: "Page break"; display: block; font: 10px sans-serif; color: #6366f1; text-align: center; }
.device-box { padding: .55rem .7rem; border-radius: 12px; background: rgba(99,102,241,.06); border: 1px solid rgba(99,102,241,.15); }

/* ---------- Document Scanner ---------- */
.page-strip { display: flex; flex-direction: column; gap: .5rem; max-height: 76vh; overflow-y: auto; }
.page-thumb { position: relative; border: 2px solid transparent; border-radius: 10px; background: var(--sp-surface, #fff); cursor: pointer; padding: 3px; box-shadow: 0 2px 8px -4px rgba(15,23,42,.4); }
.page-thumb.active { border-color: var(--sp-primary); }
.page-thumb img { width: 100%; max-height: 160px; object-fit: contain; display: block; background: var(--sp-placeholder, #e2e8f0); border-radius: 7px; }
.page-thumb .pnum { position: absolute; top: 6px; left: 6px; min-width: 22px; padding: 0 5px; border-radius: 6px; background: rgba(15,23,42,.75); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; }
.page-thumb .ptools { position: absolute; bottom: 6px; right: 6px; display: none; gap: 2px; }
.page-thumb:hover .ptools, .page-thumb.active .ptools { display: flex; }
.page-thumb .ptools .btn { padding: .05rem .3rem; }
.scan-stage { min-height: 60vh; display: grid; place-items: center; border-radius: 14px; background: #334155; padding: 12px; }
.scan-canvas { position: relative; display: inline-block; touch-action: none; user-select: none; }
.scan-canvas img { display: block; max-width: 100%; max-height: 70vh; box-shadow: 0 8px 30px rgba(0,0,0,.45); }
.scan-canvas svg { position: absolute; left: 0; top: 0; pointer-events: none; }
.scan-canvas polygon { fill: rgba(99,102,241,.14); stroke: #22d3ee; stroke-width: 2; }
.sc-handle { position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px; border-radius: 50%; background: rgba(255,255,255,.9); border: 3px solid #22d3ee; cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,.5); touch-action: none; }
.sc-spin { position: absolute; left: 50%; top: 50%; margin: -1rem 0 0 -1rem; }
.doc-guide { position: absolute; inset: 8% 18%; border: 3px dashed rgba(34,211,238,.85); border-radius: 8px; pointer-events: none; }
video.flash { filter: brightness(2.2); }
@media (max-width: 1199.98px) {
    .page-strip { flex-direction: row; overflow-x: auto; overflow-y: hidden; max-height: none; }
    .page-thumb { flex: 0 0 110px; }
    .page-thumb img { height: 130px; }
}

/* ---------- Printing ---------- */
.printer-card { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: 14px; background: var(--sp-surface-soft, rgba(255,255,255,.75)); border: 1px solid rgba(148,163,184,.25); }
.printer-card i.fs-3 { color: var(--sp-accent-text, var(--sp-primary)); }
.printer-card.is-offline i.fs-3 { color: #94a3b8; }
.print-file-list { max-height: 330px; overflow-y: auto; }

/* ---------- Job board ---------- */
.job-board { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(210px, 1fr)); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; }
.job-col { background: var(--sp-surface-faint, rgba(255,255,255,.55)); border: 1px solid rgba(148,163,184,.25); border-radius: 16px; min-height: 60vh; display: flex; flex-direction: column; }
.job-col.drop { outline: 3px dashed var(--sp-primary); outline-offset: -3px; }
.job-col-head { display: flex; align-items: center; gap: .4rem; padding: .7rem .8rem; font-weight: 700; font-size: .9rem; border-bottom: 1px solid rgba(148,163,184,.2); }
.job-col-body { padding: .5rem; display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; max-height: 72vh; }
.job-card { position: relative; background: var(--sp-surface, #fff); border-radius: 12px; padding: .6rem .7rem; box-shadow: 0 3px 10px -6px rgba(15,23,42,.45); cursor: pointer; border-left: 4px solid #c7d2fe; font-size: .88rem; }
.job-card:hover { box-shadow: 0 8px 18px -10px rgba(15,23,42,.55); }
.job-card.rush { border-left-color: #ef4444; }
.rush-tag { position: absolute; top: -7px; right: 8px; font-size: .6rem; font-weight: 800; color: #fff; background: #ef4444; padding: .05rem .35rem; border-radius: 5px; }
.job-empty { text-align: center; color: #94a3b8; padding: 1rem 0; }
.job-history { list-style: none; padding: 0; margin: 0; border-left: 2px solid #c7d2fe; }
.job-history li { padding: .25rem 0 .45rem .7rem; position: relative; }
.job-history li::before { content: ""; position: absolute; left: -6px; top: .55rem; width: 10px; height: 10px; border-radius: 50%; background: var(--sp-primary); }

/* ---------- POS ---------- */
.svc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; max-height: 72vh; overflow-y: auto; }
.svc-tile { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-height: 92px; padding: .7rem .8rem; text-align: left; border-radius: 14px; border: 1px solid rgba(148,163,184,.3); background: var(--sp-surface, #fff); transition: transform .08s; }
.svc-tile:hover { border-color: var(--sp-primary); } .svc-tile:active { transform: scale(.97); }
.svc-name { font-weight: 700; font-size: .88rem; line-height: 1.15; }
.svc-var { font-size: .76rem; color: var(--sp-muted); flex: 1; }
.svc-price { font-weight: 800; color: var(--sp-accent-text, var(--sp-primary)); }
.pos-cart { position: sticky; top: 76px; }
.cart-lines { max-height: 34vh; overflow-y: auto; border-top: 1px solid rgba(148,163,184,.25); }
.cart-line { display: grid; grid-template-columns: 1fr 112px 78px 78px 52px; gap: .3rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid rgba(148,163,184,.2); font-size: .86rem; }
.cl-qty { display: flex; } .cl-qty input { width: 44px; padding-left: 2px; padding-right: 2px; } .cl-qty .btn { padding: .1rem .45rem; }
.cl-total { text-align: right; font-weight: 700; } .cl-x { display: flex; } .cl-x .btn { padding: .1rem .2rem; }
.totals td { padding: .15rem .25rem; border: 0; } .totals .grand td { font-size: 1.5rem; font-weight: 800; color: var(--sp-accent-text, var(--sp-primary)); }
.pay-methods { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; } .pay-methods .btn { font-size: .8rem; padding: .45rem .2rem; }
.change-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.15rem; margin-bottom: .5rem; } .change-line strong { font-size: 1.6rem; }
.receipt-preview { background: #fff; color: #111; border-radius: 10px; padding: 12px; max-width: 320px; margin: 0 auto; box-shadow: 0 6px 20px -10px rgba(15,23,42,.5); max-height: 52vh; overflow-y: auto; font-size: 12px; }
@media (max-width: 575.98px) { .cart-line { grid-template-columns: 1fr 104px 70px; } .cl-unit, .cl-x { display: none; } .pay-methods { grid-template-columns: repeat(3, 1fr); } }

/* ---------- Reports ---------- */
.bar-chart { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; height: 260px; align-items: end; padding-top: 18px; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.bar-col small { font-size: .66rem; color: var(--sp-muted); margin-top: 3px; }
.bar { position: relative; width: 100%; max-width: 38px; min-height: 2px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, #6366f1, #06b6d4); }
.bar span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: .62rem; font-weight: 700; color: var(--sp-text-2, #334155); white-space: nowrap; }
.share { position: relative; height: 18px; background: var(--sp-placeholder, #e2e8f0); border-radius: 9px; overflow: hidden; } .share div { height: 100%; background: linear-gradient(90deg, #6366f1, #06b6d4); }
.share span { position: absolute; inset: 0; font-size: .7rem; line-height: 18px; padding-left: 6px; font-weight: 700; }

/* ===== ID name, signature & nameplate (shared panel) ===== */
.np-switches { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.np-switch { display: flex; flex-direction: column; align-items: center; gap: .25rem; padding: .6rem .3rem; border-radius: 12px; border: 2px solid rgba(148,163,184,.35); background: var(--sp-surface-soft, rgba(255,255,255,.75)); font-size: .78rem; font-weight: 600; text-align: center; cursor: pointer; margin: 0; }
.np-switch i { font-size: 1.25rem; color: #94a3b8; }
.np-switch .form-check-input { margin: 0; }
.np-switch.on { border-color: var(--sp-primary); background: rgba(79,70,229,.08); }
.np-switch.on i { color: var(--sp-accent-text, var(--sp-primary)); }
.np-warn { border-radius: 10px; padding: .5rem .7rem; margin-bottom: .5rem; background: rgba(245,158,11,.12); color: var(--sp-warn-text-2, #92400e); border: 1px solid rgba(245,158,11,.35); }
.np-warn > div + div { margin-top: .25rem; }
.np-section { border-radius: 12px; border: 1px solid rgba(148,163,184,.3); background: var(--sp-surface-faint, rgba(255,255,255,.6)); padding: .7rem; margin-bottom: .6rem; }
.np-section-title { font-weight: 700; font-size: .85rem; margin-bottom: .5rem; color: var(--sp-text); }
.np-sig-thumb { position: relative; display: grid; place-items: center; min-height: 72px; border-radius: 10px; border: 1px dashed rgba(148,163,184,.6); background: repeating-conic-gradient(var(--sp-checker-a, #eef2f7) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 12px 12px; padding: .4rem; }
.np-sig-thumb img { max-width: 100%; max-height: 90px; }
.np-sig-thumb.busy::after { content: ''; position: absolute; inset: 0; border-radius: 10px; background: var(--sp-surface-soft, rgba(255,255,255,.7)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 50 50'%3E%3Ccircle cx='25' cy='25' r='20' fill='none' stroke='%234f46e5' stroke-width='5' stroke-dasharray='90 60'%3E%3CanimateTransform attributeName='transform' type='rotate' from='0 25 25' to='360 25 25' dur='0.8s' repeatCount='indefinite'/%3E%3C/circle%3E%3C/svg%3E") center no-repeat; }
.np-modes { display: grid; gap: .35rem; }
.np-mode { display: flex; gap: .5rem; align-items: flex-start; padding: .45rem .6rem; border-radius: 10px; border: 1px solid rgba(148,163,184,.35); background: var(--sp-surface-soft, rgba(255,255,255,.7)); cursor: pointer; margin: 0; }
.np-mode input { margin-top: .25rem; }
.np-mode span { display: flex; flex-direction: column; font-size: .82rem; }
.np-mode small { color: var(--sp-muted); font-size: .74rem; }
.np-mode:has(input:checked) { border-color: var(--sp-primary); background: rgba(79,70,229,.07); }
.np-dims { border-radius: 10px; background: var(--sp-list-bg, rgba(241,245,249,.8)); padding: .45rem .65rem; }
.np-dims:empty { display: none; }
.np-dims > div { display: flex; justify-content: space-between; gap: .5rem; padding: .1rem 0; }
.np-dims > div > span:first-child { color: var(--sp-muted); }
.np-viewer { overflow: auto; }
.np-viewer.zoomed { display: block; max-height: 520px; text-align: center; }
.np-viewer.zoomed img { max-width: none; max-height: none; }
.np-viewer .np-before-img { display: none; }
.np-viewer.show-before .np-before-img { display: inline-block; }
.np-viewer.show-before > img:not(.np-before-img) { display: none; }
.result-preview .np-before-img { max-width: 100%; max-height: 300px; box-shadow: 0 6px 22px -8px rgba(15,23,42,.5); }
.np-viewer-bar { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: space-between; margin-bottom: .5rem; }
.np-stage { position: relative; display: grid; place-items: center; min-height: 320px; max-height: 74vh; border-radius: 14px; background: repeating-conic-gradient(var(--sp-checker-a, #e2e8f0) 0% 25%, var(--sp-checker-b, #fff) 0% 50%) 50% / 18px 18px; padding: 1rem; }
.np-stage img { max-width: 100%; max-height: calc(74vh - 2rem); box-shadow: 0 8px 26px -10px rgba(15,23,42,.55); }
.np-stage .spinner-border { position: absolute; }
.sig-pad-wrap { position: relative; border-radius: 12px; border: 2px dashed rgba(148,163,184,.6); background: #fff; overflow: hidden; }
.sig-pad-wrap canvas { display: block; touch-action: none; cursor: crosshair; }
.sig-pad-line { position: absolute; left: 6%; right: 6%; bottom: 22%; border-bottom: 1px solid #cbd5e1; pointer-events: none; }
@media (max-width: 575.98px) { .np-switches { grid-template-columns: 1fr; } .np-switch { flex-direction: row; justify-content: flex-start; padding: .5rem .7rem; } }

/* ===== ID photo print layout: modes, photo items, leftover paper ===== */
.pl-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.pl-modes .btn { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .45rem .25rem; font-size: .78rem; font-weight: 600; border-radius: 12px; }
.pl-modes .btn i { font-size: 1.15rem; }
.pl-item { border-radius: 12px; border: 1px solid rgba(148,163,184,.35); background: var(--sp-surface-soft, rgba(255,255,255,.75)); padding: .55rem .65rem; margin-bottom: .45rem; }
.pl-item-thumb { flex: 0 0 auto; width: 38px; height: 46px; border-radius: 6px; overflow: hidden; background: var(--sp-placeholder, #e2e8f0); display: grid; place-items: center; }
.pl-item-thumb img { max-width: 100%; max-height: 100%; }
.pl-qty { width: 9.5rem; }
.pl-qty .btn { width: 2.2rem; font-weight: 700; }
.pl-qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pl-total { border-radius: 10px; padding: .4rem .65rem; background: rgba(79,70,229,.07); font-size: .9rem; }
.pl-settings { border-radius: 12px; border: 1px solid rgba(148,163,184,.3); background: var(--sp-surface-faint, rgba(255,255,255,.55)); padding: .45rem .65rem; }
.pl-settings > summary { font-weight: 600; font-size: .88rem; cursor: pointer; }
.pl-stock { border-radius: 12px; padding: .55rem .7rem; background: rgba(220,38,38,.06); border: 1px solid rgba(220,38,38,.25); }
.pl-toolbar { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pl-sheet-label { min-width: 7.5rem; opacity: 1 !important; }
.pl-legend { display: flex; flex-wrap: wrap; gap: .9rem; justify-content: center; }
.pl-legend .lg { display: inline-block; width: 14px; height: 10px; margin-right: .3rem; vertical-align: -1px; border-radius: 2px; }
.pl-legend .lg-safe { border: 1px dashed #93c5fd; }
.pl-legend .lg-free { background: repeating-linear-gradient(-45deg, rgba(16,185,129,.45) 0 2px, transparent 2px 5px); }
.pl-legend .lg-resv { background: repeating-linear-gradient(-45deg, rgba(220,38,38,.55) 0 2px, transparent 2px 5px); }
#sheetCanvas.manual { cursor: grab; touch-action: none; }
.d-contents { display: contents; }
.layout-stats ul { margin-top: .2rem; }

/* ===== Photo Printing workspace ===== */
.dropzone-sm { padding: 1rem .75rem; }
.dropzone-sm > i { font-size: 1.8rem; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.pp-item { padding: .5rem .6rem; }
.pp-item details > summary { cursor: pointer; }
.pp-item-thumb { flex: 0 0 auto; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; background: var(--sp-placeholder, #e2e8f0); display: grid; place-items: center; }
.pp-item-thumb img { max-width: 100%; max-height: 100%; }
.pp-item .pl-qty { width: 7.6rem; flex: 0 0 auto; }
.pp-stage-wrap { overflow: auto; max-height: 78vh; border-radius: 14px; background: var(--sp-stage, #cbd5e1); padding: 16px; }
.pp-stage { display: flex; justify-content: center; align-items: flex-start; min-width: min-content; }
.pp-sheet { position: relative; flex: 0 0 auto; background: #fff; box-shadow: 0 10px 30px -10px rgba(15,23,42,.6); user-select: none; touch-action: none; overflow: hidden; }
.pp-safe { position: absolute; border: 1px dashed #93c5fd; pointer-events: none; }
.pp-free { position: absolute; pointer-events: none; background: repeating-linear-gradient(-45deg, rgba(16,185,129,.18) 0 2px, transparent 2px 7px); display: grid; place-items: center; }
.pp-free span { font-size: .68rem; color: #047857; background: rgba(255,255,255,.85); padding: 0 .35rem; border-radius: 6px; white-space: nowrap; }
.pp-ph { position: absolute; overflow: hidden; background: #e2e8f0; outline: 1px solid rgba(15,23,42,.12); cursor: pointer; }
.pp-sheet.manual .pp-ph { cursor: grab; }
.pp-ph img { position: absolute; display: block; pointer-events: none; transform-origin: center center; }
.pp-ph.sel { outline: 2px solid var(--sp-primary); z-index: 3; box-shadow: 0 0 0 4px rgba(79,70,229,.2); }
.pp-ph.bad { outline: 2px solid #dc2626; box-shadow: 0 0 0 4px rgba(220,38,38,.25); }
.pp-tag { position: absolute; left: 3px; top: 3px; font-size: .62rem; font-weight: 700; line-height: 1; padding: .15rem .3rem; border-radius: 5px; background: rgba(15,23,42,.65); color: #fff; pointer-events: none; }
.pp-handle { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; background: var(--sp-primary); border-top-left-radius: 6px; cursor: nwse-resize; }
.pp-guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pp-align { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.pp-align .v { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px solid #ec4899; }
.pp-align .h { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid #ec4899; }
.pp-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--sp-muted); font-size: .9rem; pointer-events: none; }
.pp-zoom-label { min-width: 2.6rem; text-align: center; }
.pl-legend .pp-lg-cut { border-top: 2px solid #a3a3a3; height: 0; vertical-align: 3px; }
.pp-pick { border: 2px solid transparent; padding: 0; }
.pp-pick.picked { border-color: var(--sp-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.25); }
.pp-crop-stage { background: #334155; border-radius: 12px; overflow: hidden; }
.pp-crop-stage canvas { display: block; width: 100%; height: auto; cursor: move; touch-action: none; }
.pp-item .pp-size { flex: 1 1 9rem; min-width: 9rem; }

/* ===== Sidebar collapse to an icon rail =====
   Desktop (>= 992px): body.sidebar-collapsed shrinks the sidebar to a rail and the content widens.
   Tablet (768-991px): the sidebar is a docked rail; the menu button opens the full sidebar over the page.
   Phone (< 768px): unchanged off-canvas sidebar. */
:root { --sidebar-rail: 76px; }
.sidebar { transition: transform .25s ease, width .2s ease, padding .2s ease; overflow-x: hidden; }
.main { transition: margin-left .2s ease; }
.side-link { position: relative; }
.side-link > span:not(.badge), .brand-text { white-space: nowrap; }
.sidebar-tooltip { --bs-tooltip-bg: #1e1b4b; --bs-tooltip-font-size: .82rem; }
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar { width: var(--sidebar-rail); padding-left: .55rem; padding-right: .55rem; }
    body.sidebar-collapsed .main { margin-left: var(--sidebar-rail); }
    body.sidebar-collapsed .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    body.sidebar-collapsed .brand-text,
    body.sidebar-collapsed .side-link > span:not(.badge),
    body.sidebar-collapsed .side-link .phase-pill { display: none; }
    body.sidebar-collapsed .side-section { font-size: 0; padding: .55rem .35rem; }
    body.sidebar-collapsed .side-section::before { content: ""; display: block; height: 1px; background: rgba(148,163,184,.22); }
    body.sidebar-collapsed .side-link { justify-content: center; gap: 0; padding: .62rem 0; }
    body.sidebar-collapsed .side-link .badge { position: absolute; top: 3px; right: 6px; font-size: .58rem; padding: .2em .42em; }
    body.sidebar-collapsed .side-foot { text-align: center; padding: .8rem 0; font-size: .62rem; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar { transform: none; }
    .main { margin-left: var(--sidebar-rail); }
    .sidebar:not(.open) { width: var(--sidebar-rail); padding-left: .55rem; padding-right: .55rem; }
    .sidebar:not(.open) .brand { justify-content: center; padding-left: 0; padding-right: 0; }
    .sidebar:not(.open) .brand-text,
    .sidebar:not(.open) .side-link > span:not(.badge),
    .sidebar:not(.open) .side-link .phase-pill { display: none; }
    .sidebar:not(.open) .side-section { font-size: 0; padding: .55rem .35rem; }
    .sidebar:not(.open) .side-section::before { content: ""; display: block; height: 1px; background: rgba(148,163,184,.22); }
    .sidebar:not(.open) .side-link { justify-content: center; gap: 0; padding: .62rem 0; }
    .sidebar:not(.open) .side-link .badge { position: absolute; top: 3px; right: 6px; font-size: .58rem; padding: .2em .42em; }
    .sidebar:not(.open) .side-foot { text-align: center; padding: .8rem 0; font-size: .62rem; }
    .sidebar.open { box-shadow: 0 20px 50px -10px rgba(15,23,42,.6); }
}
@media (prefers-reduced-motion: reduce) { .sidebar, .main { transition: none; } }
/* Rail: keep scrolling but hide the scrollbar so the icons stay centred in the 76px rail. */
@media (min-width: 992px) {
    body.sidebar-collapsed .sidebar { scrollbar-width: none; }
    body.sidebar-collapsed .sidebar::-webkit-scrollbar { display: none; }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .sidebar:not(.open) { scrollbar-width: none; }
    .sidebar:not(.open)::-webkit-scrollbar { display: none; }
}

/* =====================================================================
   THEME: Light (default) / Dark
   Light mode uses the original values (every themed colour above is written as
   var(--token, <original light value>)). Dark mode is defined ONLY here: SmartPrint
   tokens + Bootstrap 5.3 colour-mode variables. Paper-like surfaces (document page,
   photo print sheet, receipt, QR code, signature pad) stay white with dark text in both themes.
   ===================================================================== */
[data-bs-theme="dark"] {
    color-scheme: dark;
    /* SmartPrint tokens */
    --sp-text: #e2e8f0;
    --sp-text-2: #cbd5e1;
    --sp-muted: #94a3b8;
    --sp-glass: rgba(30, 41, 59, .72);
    --sp-glass-border: rgba(148, 163, 184, .16);
    --sp-shadow: 0 10px 30px -12px rgba(0, 0, 0, .65);
    --sp-surface: #1e293b;
    --sp-surface-soft: rgba(30, 41, 59, .82);
    --sp-surface-faint: rgba(30, 41, 59, .55);
    --sp-input-bg: rgba(15, 23, 42, .6);
    --sp-modal-bg: rgba(22, 31, 49, .97);
    --sp-toast-bg: rgba(22, 31, 49, .97);
    --sp-topbar-bg: rgba(11, 17, 32, .72);
    --sp-list-bg: rgba(79, 70, 229, .12);
    --sp-placeholder: #334155;
    --sp-stage: #0b1220;
    --sp-checker-a: #334155;
    --sp-checker-b: #1e293b;
    --sp-ring: #0f172a;
    --sp-accent-text: #a5b4fc;
    --sp-ok-text: #34d399;
    --sp-warn-text: #fbbf24;
    --sp-warn-text-2: #fcd34d;
    --sp-page-base: linear-gradient(160deg, #0b1120 0%, #0f172a 50%, #0b1a24 100%);
    /* Bootstrap 5.3 dark colour mode, tuned to the SmartPrint slate/indigo palette */
    --bs-body-color: #e2e8f0;
    --bs-body-color-rgb: 226, 232, 240;
    --bs-body-bg: #1e293b;
    --bs-body-bg-rgb: 30, 41, 59;
    --bs-emphasis-color: #f8fafc;
    --bs-emphasis-color-rgb: 248, 250, 252;
    --bs-secondary-color: rgba(226, 232, 240, .7);
    --bs-secondary-bg: #273449;
    --bs-secondary-bg-rgb: 39, 52, 73;
    --bs-tertiary-color: rgba(226, 232, 240, .5);
    --bs-tertiary-bg: #222e42;
    --bs-tertiary-bg-rgb: 34, 46, 66;
    --bs-border-color: rgba(148, 163, 184, .24);
    --bs-border-color-translucent: rgba(148, 163, 184, .2);
    --bs-heading-color: #f1f5f9;
    --bs-link-color: #a5b4fc;
    --bs-link-color-rgb: 165, 180, 252;
    --bs-link-hover-color: #c7d2fe;
    --bs-link-hover-color-rgb: 199, 210, 254;
    --bs-primary-text-emphasis: #a5b4fc;
    --bs-primary-bg-subtle: rgba(79, 70, 229, .18);
    --bs-primary-border-subtle: rgba(129, 140, 248, .4);
    --bs-success-text-emphasis: #6ee7b7;
    --bs-danger-text-emphasis: #fca5a5;
    --bs-warning-text-emphasis: #fcd34d;
    --bs-info-text-emphasis: #67e8f9;
    --bs-code-color: #f9a8d4;
}
[data-bs-theme="dark"] body.app-body {
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(6, 182, 212, .12), transparent 60%),
        radial-gradient(900px 600px at -10% 110%, rgba(236, 72, 153, .08), transparent 60%),
        var(--sp-page-base);
    background-attachment: fixed;
}
/* Readable accent / status text on dark surfaces */
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #a5b4fc; --bs-btn-border-color: rgba(129, 140, 248, .55); --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .text-primary { color: #a5b4fc !important; }
[data-bs-theme="dark"] .text-success { color: #4ade80 !important; }
[data-bs-theme="dark"] .text-danger { color: #f87171 !important; }
[data-bs-theme="dark"] .text-info { color: #67e8f9 !important; }
[data-bs-theme="dark"] .text-muted { color: var(--sp-muted) !important; }
[data-bs-theme="dark"] .form-control::placeholder { color: rgba(203, 213, 225, .55); }
/* Floating-label fields (login page): the label is the placeholder, so keep Bootstrap's hidden placeholder
   in dark mode too — otherwise "Username" / "Password" appear twice, on top of each other. */
[data-bs-theme="dark"] .form-floating > .form-control::placeholder { color: transparent; }
/* Login: show / hide eye button inside the Username and Password fields */
.has-eye-toggle > .form-control { padding-right: 3.25rem; }
.has-eye-toggle > .form-control::-ms-reveal, .has-eye-toggle > .form-control::-ms-clear { display: none; }   /* Edge's own eye: avoid two eyes */
.has-eye-toggle > label { padding-right: 3.25rem; }
.has-eye-toggle > .eye-toggle { position: absolute; top: 50%; right: .55rem; transform: translateY(-50%); z-index: 5;
    display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border: 0; border-radius: 50%;
    background: transparent; color: var(--bs-secondary-color); font-size: 1.15rem; line-height: 1; cursor: pointer;
    transition: color .18s ease, background-color .18s ease, transform .18s ease; touch-action: manipulation; }
.has-eye-toggle > .eye-toggle:hover { color: var(--sp-accent-text, var(--sp-primary)); background: rgba(99, 102, 241, .14); }
.has-eye-toggle > .eye-toggle:active { transform: translateY(-50%) scale(.92); }
.has-eye-toggle > .eye-toggle:focus-visible { outline: 2px solid var(--sp-primary, #6366f1); outline-offset: 1px; color: var(--sp-accent-text, var(--sp-primary)); }
[data-bs-theme="dark"] .has-eye-toggle > .eye-toggle:hover { color: #c7d2fe; background: rgba(129, 140, 248, .2); }
[data-bs-theme="dark"] .form-control, [data-bs-theme="dark"] .form-select { border-color: rgba(148, 163, 184, .3); color: var(--bs-body-color); }
[data-bs-theme="dark"] .form-control:disabled, [data-bs-theme="dark"] .form-select:disabled { background-color: rgba(30, 41, 59, .6); }
[data-bs-theme="dark"] .input-group-text { background-color: #273449; border-color: rgba(148, 163, 184, .3); color: var(--sp-text-2); }
[data-bs-theme="dark"] .table { --bs-table-bg: transparent; --bs-table-striped-bg: rgba(148, 163, 184, .06); --bs-table-hover-bg: rgba(148, 163, 184, .08); }
[data-bs-theme="dark"] .toast-header { background-color: rgba(30, 41, 59, .9); color: var(--sp-text); border-bottom-color: rgba(148, 163, 184, .18); }
[data-bs-theme="dark"] .dropdown-menu { --bs-dropdown-bg: #1e293b; --bs-dropdown-link-hover-bg: rgba(99, 102, 241, .18); --bs-dropdown-border-color: rgba(148, 163, 184, .2); }
[data-bs-theme="dark"] .modal-content:not(.glass-modal) { --bs-modal-bg: #1e293b; }
[data-bs-theme="dark"] .glass-pills .nav-link { color: var(--sp-text); }
[data-bs-theme="dark"] .incoming-table tr.is-new td { background: rgba(99, 102, 241, .1); }
[data-bs-theme="dark"] .job-card { border-left-color: #6366f1; }
[data-bs-theme="dark"] .job-card.rush { border-left-color: #ef4444; }
[data-bs-theme="dark"] .sidebar-tooltip { --bs-tooltip-bg: #312e81; --bs-tooltip-color: #fff; }
/* Paper surfaces keep print colours */
[data-bs-theme="dark"] .pp-sheet { color: #475569; }
[data-bs-theme="dark"] .pp-sheet .pp-empty { color: #64748b; }
[data-bs-theme="dark"] .qr-box, [data-bs-theme="dark"] .sig-pad-wrap, [data-bs-theme="dark"] .free-sheet { color-scheme: light; }

/* Theme toggle + subtle cross-fade only while switching (does not slow normal hover/drag transitions) */
.theme-toggle .bi-sun { display: none; }
[data-bs-theme="dark"] .theme-toggle .bi-sun { display: inline-block; }
[data-bs-theme="dark"] .theme-toggle .bi-moon-stars { display: none; }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
    transition: background-color .3s ease, color .3s ease, border-color .3s ease, fill .3s ease, box-shadow .3s ease !important;
}
@media (prefers-reduced-motion: reduce) { html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; } }
/* Bootstrap's yellow outline text is unreadable on white panels (1.6:1); use amber in light mode. */
[data-bs-theme="light"] .btn-outline-warning { --bs-btn-color: #b45309; --bs-btn-border-color: #f59e0b; }

/* ===== Installable app (PWA) ===== */
.topbar .pwa-install-btn {
    display: inline-flex; align-items: center; gap: .45rem; height: 44px; padding: 0 1rem; border: 0; border-radius: 12px;
    font-weight: 600; font-size: .9rem; color: #fff; white-space: nowrap;
    background-image: linear-gradient(135deg, var(--sp-primary), var(--sp-primary-2));
    box-shadow: 0 8px 20px -10px rgba(79, 70, 229, .85);
}
.topbar .pwa-install-btn:hover, .topbar .pwa-install-btn:focus-visible { color: #fff; filter: brightness(1.07); }
.topbar .pwa-install-btn i { font-size: 1.05rem; }
.auth-card .pwa-install-btn { display: inline-flex; align-items: center; gap: .45rem; }
@media (max-width: 767.98px) {
    .topbar .pwa-install-btn { width: 44px; padding: 0; justify-content: center; }
    .topbar .pwa-install-btn span { display: none; }
}
html.pwa-standalone [data-pwa-install] { display: none !important; }

/* ===== Long-term QR codes list (File Receiving Center) ===== */
.qr-code-row { display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; border-radius: 10px; border: 1px solid rgba(148,163,184,.3); background: rgba(255,255,255,.6); margin-bottom: .35rem; }
