/* =====================================================================
   Label Printing — visual system ("Clean SaaS")
   White surfaces on a soft slate canvas, one indigo accent for actions and
   selection, emerald for anything that prints. Inter, generous spacing,
   12 px panels, quiet borders and soft shadows.
   ===================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../lib/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url('../lib/inter/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* neutrals (slate) */
    --ink: #0f172a;          /* headings, strong text */
    --ink-2: #1e293b;
    --ink-3: #475569;        /* secondary icons */
    --text: #1e293b;
    --muted: #64748b;
    --subtle: #94a3b8;
    --line: #e2e8f0;
    --line-soft: #f1f5f9;
    --paper: #f8fafc;        /* app background */
    --liner: #f1f5f9;        /* where labels sit */
    --label: #ffffff;

    /* accent (indigo) */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-700: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --signal: var(--primary);

    /* semantic */
    --print: #059669;        /* print = go (emerald) */
    --print-dark: #047857;
    --print-50: #ecfdf5;
    --danger: #dc2626;
    --danger-50: #fef2f2;
    --warn: #d97706;
    --warn-50: #fffbeb;
    --link: var(--primary);

    --radius-label: 10px;
    --radius-panel: 12px;
    --radius-control: 8px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, .12), 0 2px 6px -2px rgba(15, 23, 42, .06);
    --lift: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 20px -10px rgba(15, 23, 42, .25);
    --ring: 0 0 0 4px rgba(79, 70, 229, .16);

    /* bootstrap mapping */
    --bs-body-font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--paper);
    --bs-border-color: var(--line);
    --bs-secondary-color: var(--muted);
    --bs-link-color: var(--primary);
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: var(--primary-hover);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 79, 70, 229;
    --bs-success: var(--print);
    --bs-success-rgb: 5, 150, 105;
    --bs-danger: var(--danger);
    --bs-danger-rgb: 220, 38, 38;
    --bs-warning-rgb: 217, 119, 6;
    --bs-border-radius: var(--radius-control);
    --bs-border-radius-sm: 6px;
    --bs-border-radius-lg: var(--radius-panel);
    --bs-focus-ring-color: rgba(79, 70, 229, .25);
    --bs-emphasis-color: var(--ink);
}

html { font-size: 15px; }
body {
    font-family: var(--bs-body-font-family);
    background: var(--paper);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11" 1, "ss01" 1;   /* Inter: straight-sided 1, open digits */
    letter-spacing: -.003em;
}
.font-monospace, code, kbd { font-feature-settings: normal; }
code { color: var(--primary-700); background: var(--primary-50); padding: .05rem .3rem; border-radius: 4px; font-size: .85em; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-weight: 650;
    letter-spacing: -.02em;
    color: var(--ink);
}
::selection { background: var(--primary-100); }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: var(--ring); }
.form-check-input:focus { border-color: var(--primary); box-shadow: var(--ring); }

/* ---------- buttons ---------- */
.btn {
    --bs-btn-font-weight: 550; --bs-btn-padding-x: .95rem; --bs-btn-padding-y: .5rem;
    border-radius: var(--radius-control); letter-spacing: -.005em;
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-sm { --bs-btn-padding-x: .7rem; --bs-btn-padding-y: .35rem; --bs-btn-font-size: .85rem; border-radius: 7px; }
.btn-primary {
    --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-hover); --bs-btn-hover-border-color: var(--primary-hover);
    --bs-btn-active-bg: var(--primary-700); --bs-btn-active-border-color: var(--primary-700);
    --bs-btn-disabled-bg: var(--primary); --bs-btn-disabled-border-color: var(--primary);
    box-shadow: 0 1px 2px rgba(79, 70, 229, .25), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.btn-success {
    --bs-btn-bg: var(--print); --bs-btn-border-color: var(--print);
    --bs-btn-hover-bg: var(--print-dark); --bs-btn-hover-border-color: var(--print-dark);
    --bs-btn-active-bg: var(--print-dark); --bs-btn-active-border-color: var(--print-dark);
    --bs-btn-disabled-bg: #6ee7b7; --bs-btn-disabled-border-color: #6ee7b7;
    box-shadow: 0 1px 2px rgba(5, 150, 105, .25), inset 0 1px 0 rgba(255, 255, 255, .14);
}
/* Secondary buttons: white, hairline border, ink text. */
.btn-outline-secondary, .btn-outline-primary {
    --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-bg: var(--label);
    --bs-btn-hover-bg: var(--paper); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #cbd5e1;
    --bs-btn-active-bg: var(--line-soft); --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #cbd5e1;
    --bs-btn-disabled-color: var(--subtle); --bs-btn-disabled-border-color: var(--line);
    background: var(--label); box-shadow: var(--shadow-xs);
}
.btn-outline-secondary.active, .btn-check:checked + .btn-outline-secondary { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-200); }
.btn-outline-primary { --bs-btn-color: var(--primary-700); }
.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #fecaca; --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger); background: var(--label); }
.btn-outline-warning { --bs-btn-color: #b45309; --bs-btn-border-color: #fde68a; --bs-btn-hover-bg: #f59e0b; --bs-btn-hover-border-color: #f59e0b; --bs-btn-hover-color: #fff; background: var(--label); }
.btn-link { --bs-btn-color: var(--primary); }
.btn-print { padding: .7rem 1.1rem; font-size: 1.05rem; font-weight: 600; }
.btn-group > .btn { box-shadow: none; }
.btn-group { box-shadow: var(--shadow-xs); border-radius: var(--radius-control); }

/* ---------- forms ---------- */
.form-control, .form-select {
    border-color: #d8dee8; background-color: var(--label); color: var(--ink);
    border-radius: var(--radius-control); padding: .5rem .8rem; box-shadow: var(--shadow-xs);
}
.form-select { padding-right: 2.25rem; }
.form-control-sm, .form-select-sm { padding: .3rem .6rem; border-radius: 7px; }
.form-select-sm { padding-right: 2rem; }
.form-control::placeholder { color: var(--subtle); }
.form-control:disabled, .form-control[readonly] { background: var(--paper); color: var(--muted); }
.form-label { font-weight: 550; font-size: .875rem; color: var(--ink-2); margin-bottom: .35rem; }
.form-check-input { border-color: #cbd5e1; }
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-switch .form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }
.form-text { color: var(--muted); font-size: .82rem; }
.input-group-text { background: var(--paper); border-color: #d8dee8; color: var(--muted); }
.invalid-feedback, .text-danger { color: var(--danger) !important; }
.form-control.is-invalid, .input-validation-error { border-color: #fca5a5 !important; }

/* utilities Bootstrap lacks */
.min-w-0 { min-width: 0 !important; }

/* ---------- spacing scale (use these, not ad-hoc values) ---------- */
:root {
    --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.25rem; --s-6: 1.5rem; --s-8: 2rem;
    --sidebar-w: 256px; --sidebar-mini-w: 72px; --topbar-h: 56px; --tabbar-h: 60px;
    --content-max: 1680px;
}

/* ---------- links: quiet by default, underline on hover ---------- */
a { text-decoration: none; color: var(--link); }
a:hover { text-decoration: underline; text-underline-offset: 3px; color: var(--primary-hover); }
.btn:hover, .dropdown-item:hover, .side-link:hover, .tabbar a:hover, .brand:hover, .tpl-open:hover { text-decoration: none; }
.link-action { font-size: .85rem; font-weight: 600; display: inline-flex; align-items: center; gap: .25rem; }
.link-action::after { content: "\203A"; font-size: 1.1em; line-height: 1; }

.skip-link { position: absolute; left: -999px; top: .5rem; z-index: 2000; background: var(--primary); color: #fff; padding: .5rem .75rem; border-radius: var(--radius-control); font-weight: 700; }
.skip-link:focus { left: .5rem; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    --bs-offcanvas-width: var(--sidebar-w);
    --bs-offcanvas-bg: var(--label);
    --bs-offcanvas-color: var(--ink-2);
    width: var(--sidebar-w);
    flex: none;
    background-color: var(--label) !important; /* .offcanvas-lg forces transparent at ≥lg */
    border-right: 1px solid var(--line);
    color: var(--ink-2);
    transition: width .18s ease;
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
    .sidebar .offcanvas-body { display: flex; flex-direction: column; height: 100%; }
}
.sidebar .offcanvas-body { padding: 0; flex-direction: column; overflow: hidden; }
.brand-row { display: flex; align-items: center; padding: 0 .75rem 0 0; min-height: var(--topbar-h); border-bottom: 1px solid transparent; }
.brand {
    display: flex; align-items: center; gap: .6rem;
    padding: .9rem 1.25rem;
    color: var(--ink); text-decoration: none; white-space: nowrap;
    font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em;
}
.brand:hover { color: var(--ink); }
.brand-mark { width: 30px; height: 30px; flex: none; }

.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--s-2) 0 var(--s-4); scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
.nav-group { padding: 0 .75rem .35rem; }
.nav-heading {
    color: var(--subtle); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
    padding: 1rem .65rem .4rem; white-space: nowrap;
}
.side-link {
    display: flex; align-items: center; gap: .7rem; width: 100%;
    padding: .5rem .65rem; border-radius: var(--radius-control); border: 0; background: none;
    color: var(--ink-3); text-decoration: none; font-weight: 500; font-size: .93rem; white-space: nowrap;
    position: relative; min-height: 38px; text-align: left; margin-bottom: 1px;
}
.side-link .bi { font-size: 1.08rem; width: 1.25rem; flex: none; text-align: center; color: var(--subtle); }
.side-link:hover { background: var(--line-soft); color: var(--ink); }
.side-link:hover .bi { color: var(--ink-3); }
.side-link.active { background: var(--primary-50); color: var(--primary-700); font-weight: 600; }
.side-link.active .bi { color: var(--primary); }
.menu-toggle { margin-left: -.5rem; }

.btn-icon {
    display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
    background: none; border: 0; border-radius: var(--radius-control); color: var(--ink-3); font-size: 1.2rem;
}
.btn-icon:hover { background: var(--line-soft); color: var(--ink); }

/* Collapsed (icon-only) sidebar on desktop. Tooltips come from the links' title attribute. */
@media (min-width: 992px) {
    .sidebar-mini .sidebar { width: var(--sidebar-mini-w); }
    .sidebar-mini .sidebar .lbl { display: none; }
    .sidebar-mini .sidebar .brand { padding: .9rem 0; justify-content: center; width: 100%; }
    .sidebar-mini .sidebar .side-link { justify-content: center; padding: .55rem 0; }
    .sidebar-mini .sidebar .nav-heading { height: 1px; padding: 0; margin: .6rem .4rem; background: var(--line); overflow: hidden; }
}

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Top bar: where am I (breadcrumb) + account. Sticky so it is always reachable. */
.topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; gap: var(--s-3);
    height: var(--topbar-h); padding: 0 var(--s-6);
    background: rgba(255, 255, 255, .85); backdrop-filter: saturate(1.6) blur(10px);
    border-bottom: 1px solid var(--line);
}
.topbar .brand-compact { padding: 0; }
.crumbs ol { display: flex; align-items: center; gap: .4rem; list-style: none; margin: 0; padding: 0; font-size: .9rem; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: .4rem; color: var(--muted); min-width: 0; white-space: nowrap; }
.crumbs li + li::before { content: "/"; color: #cbd5e1; }
.crumbs li[aria-current] { color: var(--ink); font-weight: 600; overflow: hidden; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.user-chip {
    display: flex; align-items: center; gap: .6rem; background: none; border: 1px solid transparent;
    border-radius: 999px; padding: .2rem .6rem .2rem .2rem; color: var(--ink);
}
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--line-soft); border-color: var(--line); }
.user-chip .avatar { width: 34px; height: 34px; font-size: .85rem; }
.user-chip .name { font-weight: 600; font-size: .9rem; }
.user-chip .role { font-size: .75rem; color: var(--muted); }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: none;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-weight: 600; font-size: .85rem;
}

/* Navigation progress: a thin bar under the top bar while the next page loads. */
.nav-progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; pointer-events: none; overflow: hidden; }
.nav-progress::before { content: ""; position: absolute; inset: 0; width: 0; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.nav-progress.run::before { animation: navprog 8s cubic-bezier(.1, .7, .2, 1) forwards; }
@keyframes navprog { 0% { width: 0; } 10% { width: 35%; } 100% { width: 92%; } }
@media (prefers-reduced-motion: reduce) { .nav-progress.run::before { animation: none; width: 60%; } }

.content { padding: var(--s-6) var(--s-8) 3rem; width: 100%; max-width: var(--content-max); margin: 0 auto; flex: 1; }
.content.fluid { max-width: none; padding: var(--s-3) var(--s-4); }
@media (max-width: 991.98px) {
    .topbar { padding: 0 var(--s-3); }
    .content { padding: var(--s-4) var(--s-4) 2.5rem; }
}

/* Phone tab bar for the three things operators do all day. */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: grid; grid-template-columns: repeat(4, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--muted); font-size: .72rem; font-weight: 600; background: none; border: 0;
}
.tabbar .bi { font-size: 1.3rem; }
.tabbar a.active { color: var(--primary-700); }
.tabbar a.active .bi { color: var(--primary); }
@media (max-width: 575.98px) {
    body:has(.tabbar) .content { padding-bottom: calc(var(--tabbar-h) + 2rem); }
    body:has(.tabbar) .toast-stack { bottom: calc(var(--tabbar-h) + .75rem); }
}

/* Focus mode (designer): icon-only sidebar, no wasted space. */
.focus-mode .topbar { display: none; }

/* ---------- page header ---------- */
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
    gap: var(--s-3) var(--s-4); margin-bottom: var(--s-6);
}
.page-header h1 { font-size: 1.6rem; margin: 0; line-height: 1.2; font-weight: 650; }
.page-header .sub { color: var(--muted); margin: .3rem 0 0; max-width: 70ch; }
.page-header .actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
@media (max-width: 575.98px) {
    .page-header { margin-bottom: var(--s-4); }
    .page-header .actions { width: 100%; }
    .page-header .actions > .btn, .page-header .actions > a.btn { flex: 1; }
}

/* ---------- surfaces ---------- */
.card, .panel-surface {
    background: var(--label);
    border: 1px solid var(--line);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
}
.card-header, .card-footer { background: var(--label) !important; border-color: var(--line-soft); }
.card-header:first-child { border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
.card-header { font-weight: 600; padding: var(--s-3) var(--s-5); min-height: 52px; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.card-body { padding: var(--s-5); }
.card-footer { padding: var(--s-3) var(--s-5); }
.section-title { font-size: 1rem; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.step-no {
    display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; flex: none;
    background: var(--primary-50); color: var(--primary-700); font-size: .78rem; font-weight: 700; margin-right: .2rem; box-shadow: inset 0 0 0 1px var(--primary-200);
}
.filter-bar .form-label { margin-bottom: .2rem; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: #f8fafc; --bs-table-color: var(--text); margin-bottom: 0; }
.table > thead th {
    font-size: .8rem; font-weight: 500; color: var(--muted);
    border-bottom: 1px solid var(--line); background: #fbfcfe !important; padding: .6rem var(--s-3); white-space: nowrap;
}
.table > tbody td { border-color: var(--line-soft); padding: .75rem var(--s-3); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tbody td:first-child, .table > thead th:first-child { padding-left: var(--s-5); }
.table > tbody td:last-child, .table > thead th:last-child { padding-right: var(--s-5); }
.table-sm > tbody td { padding-top: .45rem; padding-bottom: .45rem; }
.table td, .table th { vertical-align: middle; }
.table-light { --bs-table-bg: #fbfcfe; }

/* Phones: each row becomes a card; labels come from data-label (set by site.js from the header). */
@media (max-width: 575.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tbody tr { border-bottom: 1px solid var(--line); padding: var(--s-3) var(--s-4); }
    .table-stack tbody tr:last-child { border-bottom: 0; }
    .table-stack > tbody > tr > td {
        display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3);
        border: 0 !important; padding: .2rem 0 !important; text-align: right !important; min-width: 0;
    }
    .table-stack > tbody > tr > td::before {
        content: attr(data-label); flex: none; text-align: left;
        font-size: .78rem; font-weight: 500; color: var(--muted);
    }
    .table-stack > tbody > tr > td[data-label=""]::before { content: none; }
    .table-stack > tbody > tr > td[data-label=""] { justify-content: flex-end; }
    .table-stack > tbody > tr > td:first-child { font-size: 1rem; }
    .table-stack td .cell-v { min-width: 0; text-align: right; overflow-wrap: anywhere; }
    .table-stack td .cell-v > div, .table-stack td .cell-v .small { text-align: right; }
    .table-stack td[colspan] { display: block; text-align: center !important; }
    .table-stack.table-hover > tbody > tr:hover > * { --bs-table-bg-state: transparent; }
    .card > .table-responsive { overflow-x: visible; }
}

/* ---------- status chips ---------- */
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    font-size: .78rem; font-weight: 550; padding: .15rem .55rem .15rem .45rem;
    border-radius: 999px; background: var(--line-soft); color: var(--ink-3); white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
}
.chip::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.chip-Completed, .chip-ok { background: var(--print-50); color: #047857; box-shadow: inset 0 0 0 1px rgba(5, 150, 105, .18); }
.chip-Failed, .chip-bad { background: var(--danger-50); color: #b91c1c; box-shadow: inset 0 0 0 1px rgba(220, 38, 38, .18); }
.chip-Pending, .chip-warn { background: var(--warn-50); color: #b45309; box-shadow: inset 0 0 0 1px rgba(217, 119, 6, .2); }
.chip-muted { background: var(--line-soft); color: var(--muted); }
.role-tag {
    display: inline-flex; align-items: center; gap: .25rem; font-size: .75rem; font-weight: 550; padding: .12rem .5rem;
    border-radius: 6px; background: var(--line-soft); color: var(--ink-3); box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .06);
}
.role-tag.Admin { background: var(--primary-50); color: var(--primary-700); box-shadow: inset 0 0 0 1px var(--primary-200); }
.role-tag.Designer { background: #faf5ff; color: #7e22ce; box-shadow: inset 0 0 0 1px #e9d5ff; }

/* ---------- alerts / flash ---------- */
.alert { border-radius: var(--radius-panel); border-width: 1px; }
.alert-success { background: var(--print-50); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background: var(--danger-50); border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--warn-50); border-color: #fde68a; color: #92400e; }
.alert-info { background: var(--primary-50); border-color: var(--primary-200); color: #3730a3; }
.alert-light { background: var(--label); border-color: var(--line) !important; color: var(--ink-3); }

/* ---------- the label motif ---------- */
/* liner: the backing paper a roll of labels sits on, with black sensing marks between labels */
.liner {
    background: var(--liner);
    border-radius: 4px;
    position: relative;
}
.die-cut {
    background: var(--label);
    border-radius: var(--radius-label);
    box-shadow: var(--lift);
    position: relative;
}
.die-cut canvas { display: block; width: 100%; height: auto; border-radius: var(--radius-label); }

/* dashboard roll */
.roll {
    display: flex; gap: 0; overflow-x: auto; padding: 1.25rem 0 1.4rem 1.25rem;
    scrollbar-width: thin;
}
.roll-item { flex: none; padding-right: 1.6rem; position: relative; }
.roll-item::after { /* black mark on the liner edge */
    content: ""; position: absolute; right: .55rem; bottom: -1.1rem; width: .5rem; height: .55rem; background: var(--subtle); border-radius: 1px;
}
.roll-item .die-cut { height: 168px; display: flex; max-width: calc(100vw - 4rem); }
.roll-item .die-cut canvas { height: 100%; width: auto; }
.roll-caption { margin-top: .6rem; font-size: .85rem; line-height: 1.35; max-width: 320px; }
.roll-caption b { font-weight: 600; color: var(--ink); }
.roll-caption .muted { color: var(--muted); }

@media (prefers-reduced-motion: no-preference) {
    .roll-item { animation: feed .7s cubic-bezier(.2, .7, .2, 1) both; }
    .roll-item:nth-child(2) { animation-delay: .06s; }
    .roll-item:nth-child(3) { animation-delay: .12s; }
    .roll-item:nth-child(4) { animation-delay: .18s; }
    .roll-item:nth-child(5) { animation-delay: .24s; }
    .roll-item:nth-child(6) { animation-delay: .30s; }
    @keyframes feed { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
}

.roll-empty {
    display: flex; align-items: center; gap: 1.25rem; padding: 1.5rem;
}
.ghost-label {
    width: 150px; height: 84px; flex: none; border-radius: var(--radius-label);
    border: 2px dashed #cbd5e1; background: rgba(255, 255, 255, .5);
}

/* stat tiles (dashboard) */
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 1199.98px) { .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 400px) { .stat-tiles { grid-template-columns: 1fr; } }
.stat-tile {
    display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4) var(--s-5);
    background: var(--label); border: 1px solid var(--line); border-radius: var(--radius-panel); color: inherit;
    box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s;
}
.stat-tile.link:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); text-decoration: none; color: inherit; }
.stat-tile.alarm { border-color: #fecaca; background: linear-gradient(180deg, #fff, var(--danger-50)); }
.stat-tile .ico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--primary-50); color: var(--primary); font-size: 1.15rem; }
.stat-tile .ico.ok { background: var(--print-50); color: var(--print); }
.stat-tile .ico.bad { background: var(--danger-50); color: var(--danger); }
.stat-tile .num { font-size: 1.85rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-tile .lbl { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.delta { display: inline-flex; align-items: center; font-size: .78rem; font-weight: 600; margin-top: .35rem; }
.delta .bi { font-size: 1.1rem; margin-left: -.2rem; }
.delta.good { color: var(--print); } .delta.bad { color: var(--danger); } .delta.flat { color: var(--muted); font-weight: 500; }

/* 14-day trend */
.trend { display: grid; grid-template-columns: repeat(14, 1fr); align-items: end; gap: 6px; height: 140px; }
.trend .bar { background: var(--primary-200); border-radius: 5px 5px 2px 2px; min-height: 3px; position: relative; }
.trend .bar span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: .7rem; color: var(--muted); padding-bottom: 2px; white-space: nowrap; }
.trend .bar.today { background: linear-gradient(180deg, #818cf8, var(--primary)); }
.trend .bar.today span { color: var(--primary-700); font-weight: 600; }
.trend .bar:hover { background: #a5b4fc; }
.trend-axis { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; font-size: .72rem; color: var(--muted); text-align: center; margin-top: .35rem; }
.trend-axis small { font-size: .65rem; }
@media (max-width: 575.98px) { .trend { height: 100px; gap: 3px; } .trend .bar span { display: none; } .trend-axis { gap: 3px; } }

/* activity feed */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 2rem 1fr; gap: .6rem; padding: .7rem 1.1rem; border-top: 1px solid var(--line-soft); }
.feed li:first-child { border-top: 0; }
.feed .ico { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--line-soft); color: var(--ink-3); }
.feed .ico.bad { background: #fbe9e1; color: var(--danger); }
.feed .ico.ok { background: #e3f3ef; color: var(--print); }
.feed .t { font-weight: 600; font-size: .92rem; }
.feed .d { font-size: .84rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.feed li > div { min-width: 0; }

/* template wall */
.tpl-toolbar { padding: var(--s-3) var(--s-4); }
.tpl-filters { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.tpl-filters .search { position: relative; flex: 1 1 280px; max-width: 420px; }
.tpl-filters .search .bi { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.tpl-filters .search input { padding-left: 2.2rem; }
.tpl-filters .input-group { width: auto; flex-wrap: nowrap; }
.tpl-filters .input-group-text { background: var(--paper); font-size: .85rem; color: var(--muted); }
.tpl-count { font-size: .82rem; color: var(--muted); margin-top: .5rem; }
@media (max-width: 575.98px) {
    .tpl-filters .search { flex-basis: 100%; max-width: none; order: -1; }
    #more-filters { width: 100%; }
    #more-filters.show, #more-filters.collapsing { display: flex; flex-direction: column; gap: var(--s-2); }
    #more-filters .input-group { width: 100%; }
    .view-toggle { margin-left: auto; }
}

.template-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-5); }
.tpl {
    background: var(--label); border: 1px solid var(--line); border-radius: var(--radius-panel);
    display: flex; flex-direction: column; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s;
    box-shadow: var(--shadow-sm);
}
.tpl:hover { border-color: #cbd5e1; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.tpl-stage {
    background: var(--liner); height: 200px; display: grid; place-items: center; padding: var(--s-5);
    text-decoration: none;
}
.tpl-stage .die-cut { max-width: 100%; max-height: 100%; }
.tpl-stage canvas { max-height: 160px; width: auto; max-width: 100%; }
.tpl-body { padding: var(--s-4) var(--s-4) var(--s-2); flex: 1; }
.tpl-name { font-weight: 600; letter-spacing: -.01em; font-size: 1.02rem; margin: 0; color: var(--ink); }
.tpl-meta { font-size: .82rem; color: var(--muted); margin-top: .2rem; }
.tpl-updated { margin-top: .5rem; }
.tpl-desc { font-size: .88rem; color: var(--ink-3); margin-top: .4rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tpl-actions { display: flex; gap: var(--s-2); padding: var(--s-2) var(--s-4) var(--s-4); }
.tpl-actions .btn-success { flex: 1; }
.btn-square { width: 40px; padding-left: 0; padding-right: 0; display: inline-grid; place-items: center; }
.tpl-actions .btn { min-height: 40px; }

/* list layout: one row per template */
.template-wall.list-view { grid-template-columns: 1fr; gap: var(--s-2); }
.list-view .tpl { flex-direction: row; align-items: center; }
.list-view .tpl-stage { width: 180px; height: 96px; padding: var(--s-2); flex: none; }
.list-view .tpl-stage canvas { max-height: 80px; }
.list-view .tpl-body { padding: var(--s-3) var(--s-4); }
.list-view .tpl-desc, .list-view .tpl-updated { display: none; }
.list-view .tpl-actions { padding: var(--s-3) var(--s-4); }
.list-view .tpl-actions .btn-success { flex: none; padding-left: 1.25rem; padding-right: 1.25rem; }
@media (max-width: 767.98px) {
    .list-view .tpl { flex-wrap: wrap; }
    .list-view .tpl-stage { width: 110px; height: 72px; }
    .list-view .tpl-body { flex: 1 1 160px; }
    .list-view .tpl-actions { width: 100%; padding-top: 0; }
    .list-view .tpl-actions .btn-success { flex: 1; }
}

/* size presets on create page: tiny label silhouettes at real proportions */
.preset { display: inline-flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: .3rem; padding: .45rem .5rem .4rem; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--label); cursor: pointer; min-width: 68px; height: 64px; font-size: .75rem; }
.preset:hover { border-color: #cbd5e1; }
.preset.active { border-color: var(--primary); box-shadow: var(--ring); background: var(--primary-50); color: var(--primary-700); }
.preset .shape { background: var(--label); border: 1.5px solid var(--subtle); border-radius: 4px; }
.preset.active .shape { border-color: var(--primary); }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.auth-art {
    background: radial-gradient(120% 90% at 0% 0%, #6366f1 0%, #4f46e5 38%, #3730a3 100%); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth-art h2 { color: #fff; font-size: clamp(2rem, 3.2vw, 2.9rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; max-width: 14ch; margin: 0; }
.auth-art p { color: #c7d2fe; max-width: 40ch; margin-top: 1rem; font-size: 1.05rem; }
.auth-art .printer-scene { width: min(440px, 100%); align-self: center; filter: drop-shadow(0 24px 40px rgba(30, 27, 75, .45)); }
.auth-art .brand { color: #fff; --bm-bg: #fff; --bm-fg: #4f46e5; --bm-notch: #4f46e5; }
.auth-art::after { /* soft violet glow */
    content: ""; position: absolute; right: -20%; bottom: -30%; width: 70%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(167, 139, 250, .45), transparent); pointer-events: none;
}
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--paper); }
.auth-form .inner { width: 100%; max-width: 360px; }
.auth-form h1 { font-size: 1.75rem; }
.auth-form { background: var(--label); }
/* Sign-in and set-password fields: tall touch targets (44px) but body-size text, so typed values match the labels
   and the rest of the app instead of Bootstrap's 20px "lg" text. */
.auth-form .form-control-lg, .auth-form .input-group-lg > .form-control, .auth-form .input-group-lg > .btn { font-size: 1rem; min-height: 2.9rem; padding-top: .55rem; padding-bottom: .55rem; }
.auth-form .btn-lg { font-size: 1rem; min-height: 2.9rem; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } }
/* login print loop: 8 s = two labels. Feed 0–18 % and 50–68 %, rest in between. */
.printer-scene .print-head { opacity: 0; }
.printer-scene .done-badge { opacity: 0; transform-box: fill-box; transform-origin: center; }
@media (prefers-reduced-motion: no-preference) {
    .printer-scene .feed-strip { animation: lp-feed 8s infinite; }
    .printer-scene .print-head { animation: lp-head 8s infinite; }
    .printer-scene .led { animation: lp-led 8s infinite; }
    .printer-scene .done-badge { animation: lp-done 8s infinite; }
    .auth-art::after { animation: lp-glow 18s ease-in-out infinite alternate; }

    @keyframes lp-feed {
        0%   { transform: translateY(0);     animation-timing-function: cubic-bezier(.45, 0, .2, 1); }
        18%  { transform: translateY(140px); }
        50%  { transform: translateY(140px); animation-timing-function: cubic-bezier(.45, 0, .2, 1); }
        68%  { transform: translateY(280px); }
        100% { transform: translateY(280px); }
    }
    @keyframes lp-head {
        0%, 18%, 50%, 68%, 100% { opacity: 0; }
        3%, 15%, 53%, 65% { opacity: .9; }
    }
    @keyframes lp-led {
        0%, 4%, 8%, 12%, 16%, 50%, 54%, 58%, 62%, 66% { opacity: 1; }
        2%, 6%, 10%, 14%, 52%, 56%, 60%, 64% { opacity: .25; }
    }
    @keyframes lp-done {
        0%, 20%, 44%, 70%, 94%, 100% { opacity: 0; transform: scale(.4); }
        24%, 40%, 74%, 90% { opacity: 1; transform: scale(1); }
        22%, 72% { opacity: 1; transform: scale(1.15); }
    }
    @keyframes lp-glow { from { transform: translate(0, 0); } to { transform: translate(-18%, -14%); } }
}
@media (prefers-reduced-motion: reduce) {
    .printer-scene .feed-strip { transform: translateY(140px); }
}

/* ---------- designer ---------- */
.designer { display: grid; grid-template-columns: 240px 1fr 330px; gap: .75rem; height: calc(100vh - 92px); min-height: 520px; }
.focus-mode .content.fluid { padding-top: var(--s-3); }
.designer-small-screen { display: none; }
@media (max-width: 991.98px) {
    .designer-small-screen { display: block; text-align: center; padding: 3rem 1rem; max-width: 460px; margin: 0 auto; color: var(--muted); }
    .designer-small-screen > .bi { font-size: 2.5rem; color: #8a96b0; display: block; margin-bottom: .75rem; }
    .designer-small-screen h1 { color: var(--ink); }
    .designer-small-screen ~ .toolbar, .designer-small-screen ~ .designer, .designer-small-screen ~ #old-version-banner { display: none !important; }
}
@media (max-width: 1599.98px) { .toolbar .tb-lbl { display: none; } }
#layers .layer-name { min-width: 0; }
#layers input { height: 1.6rem; }
.designer .panel { background: var(--label); border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: auto; }
.designer .panel-title { font-size: .88rem; font-weight: 600; color: var(--ink); padding: .65rem .85rem; border-bottom: 1px solid var(--line-soft); margin: 0; }
#canvas-wrap {
    background-color: var(--liner);
    background-image: radial-gradient(#cdd6e2 1px, transparent 1px);
    background-size: 14px 14px;
    display: flex; align-items: center; justify-content: center; overflow: auto; position: relative;
}
#canvas-wrap .canvas-container { box-shadow: var(--lift); border-radius: 2px; flex: none; }
#designer-toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 1080; max-width: 420px; }
.toolbar { background: var(--label); border: 1px solid var(--line); border-radius: var(--radius-panel); padding: .5rem .6rem; }
.toolbar .btn { white-space: nowrap; }
#layers .list-group-item { border-left: 0; border-right: 0; }
#layers .list-group-item.active { background: var(--primary-50); color: var(--primary-700); border-color: var(--line-soft); box-shadow: inset 3px 0 0 var(--primary); }
@media (max-width: 1199.98px) and (min-width: 992px) { .designer { grid-template-columns: 200px 1fr 290px; } }

/* ---------- print ---------- */
.label-preview { display: block; background: #fff; border-radius: var(--radius-label); box-shadow: var(--lift); height: auto; max-width: 100%; }
#preview { display: flex; flex-wrap: wrap; gap: 1rem; padding: 1rem; background: var(--liner); border-radius: 4px; min-height: 120px; align-items: flex-start; }
.grid-wrap { max-height: 360px; overflow: auto; }
.grid-wrap table { min-width: 100%; }
.grid-wrap td { padding: .15rem .25rem; min-width: 120px; }
.output-option {
    display: flex; gap: .75rem; align-items: flex-start; padding: .7rem .8rem; border: 1px solid var(--line);
    border-radius: var(--radius-control); cursor: pointer; margin-bottom: .45rem; background: var(--label);
}
.output-option:hover { border-color: #cbd5e1; }
.output-option:has(input:checked) { border-color: var(--primary); box-shadow: var(--ring); background: var(--primary-50); }
.output-option:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.output-option .bi { font-size: 1.3rem; color: var(--ink-3); }
.output-option .t { font-weight: 600; line-height: 1.2; }
.output-option .d { font-size: .82rem; color: var(--muted); }
.total-box { background: var(--paper); border-radius: var(--radius-control); padding: .6rem .9rem; text-align: right; }
.total-box .n { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.progress { background: var(--liner); }
.progress-bar { background: var(--print); }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 3rem 1.25rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.empty > .bi, .empty .empty-icon {
    width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin-bottom: .4rem;
    background: var(--paper); color: #8a96b0; font-size: 1.5rem;
}
.empty .empty-title { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.empty .empty-text { max-width: 46ch; }
.empty .btn { margin-top: .6rem; }
.empty.compact { padding: 1.5rem 1rem; }
.empty.compact > .bi { width: 40px; height: 40px; font-size: 1.1rem; }

/* ---------- skeleton (while label thumbnails render) ---------- */
.skeleton { position: relative; overflow: hidden; background: #e7ecf2; border-radius: var(--radius-label); }
.skeleton::after {
    content: ""; position: absolute; inset: 0; transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent);
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* ---------- toasts ---------- */
.toast-stack {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem;
    width: min(420px, calc(100vw - 2rem)); pointer-events: none;
}
.lp-toast {
    pointer-events: auto; width: 100%; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-panel);
    background: var(--label); box-shadow: var(--shadow-md); padding: .8rem .9rem; font-size: .92rem; color: var(--ink);
}
.lp-toast > div > .bi { font-size: 1.1rem; margin-top: .05rem; }
.lp-toast.ok { border-left-color: var(--print); } .lp-toast.ok > div > .bi { color: var(--print); }
.lp-toast.bad { border-left-color: var(--danger); } .lp-toast.bad > div > .bi { color: var(--danger); }
.lp-toast.warn { border-left-color: var(--warn); } .lp-toast.warn > div > .bi { color: var(--warn); }
.lp-toast.info { border-left-color: var(--ink-3); } .lp-toast.info > div > .bi { color: var(--ink-3); }
.lp-toast .btn-close { font-size: .7rem; margin-top: .2rem; }

/* ---------- side drawers (add / edit) ---------- */
.offcanvas.drawer { --bs-offcanvas-width: min(480px, 100vw); border-left: 1px solid var(--line); }
.drawer .offcanvas-header { border-bottom: 1px solid #e6ebf1; padding: var(--s-4) var(--s-5); }
.drawer .offcanvas-title { font-size: 1.1rem; font-weight: 650; letter-spacing: -.015em; }
.drawer .offcanvas-body { padding: var(--s-5); }
.drawer form { display: flex; flex-direction: column; min-height: 100%; }
.drawer .drawer-actions {
    margin-top: auto; padding-top: var(--s-5); display: flex; gap: var(--s-2); justify-content: flex-end;
    position: sticky; bottom: calc(-1 * var(--s-5)); background: var(--label); padding-bottom: var(--s-5);
}

/* ---------- list toolbar (search + count above a table) ---------- */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-bottom: 1px solid #e6ebf1; }
.list-toolbar .search { position: relative; flex: 1 1 260px; max-width: 360px; }
.list-toolbar .search .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.list-toolbar .search input { padding-left: 2.1rem; }
.list-toolbar .count { color: var(--muted); font-size: .85rem; margin-left: auto; }

/* ---------- error / status pages ---------- */
.status-page { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.status-page .code { font-size: clamp(3.5rem, 10vw, 6rem); font-weight: 750; line-height: 1; color: var(--ink); letter-spacing: -.04em; }
.status-page .code span { color: var(--primary); }
.status-page p { color: var(--muted); max-width: 46ch; margin: .75rem auto 1.5rem; }

/* misc */
.kbd { font-size: .78rem; padding: .05rem .35rem; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: #fff; }
.pagination { --bs-pagination-active-bg: var(--ink); --bs-pagination-active-border-color: var(--ink); --bs-pagination-color: var(--ink); margin: 0; }
.dropdown-menu { border-color: var(--line); box-shadow: var(--lift); border-radius: var(--radius-panel); padding: .35rem; }
.dropdown-item { border-radius: 5px; padding: .45rem .7rem; }
.dropdown-header { font-size: .85rem; color: var(--ink); font-weight: 700; }
.dropdown-header .fw-normal { color: var(--muted); font-size: .8rem; }
.flatpickr-calendar { font-family: var(--bs-body-font-family); }
.flatpickr-calendar .flatpickr-day.selected, .flatpickr-calendar .flatpickr-day.selected:hover, .flatpickr-calendar .flatpickr-day.selected:focus { background: var(--primary); border-color: var(--primary); color: #fff; }
.flatpickr-calendar .flatpickr-day.today { border-color: var(--primary-200); }
.flatpickr-calendar { font-family: inherit; border-radius: var(--radius-panel); box-shadow: var(--shadow-md); }
.date-alt { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23667085' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5M1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; padding-right: 2rem; }

/* Touch targets on phones: 44 px minimum (WCAG 2.5.5 / platform guidelines). */
@media (max-width: 575.98px) {
    .btn, .form-control, .form-select { min-height: 44px; }
    .btn-sm, .form-control-sm, .form-select-sm { min-height: 40px; }
    .page-header h1 { font-size: 1.45rem; }
    .card-header { padding: var(--s-3) var(--s-4); }
    .card-body { padding: var(--s-4); }
    .list-toolbar { padding: var(--s-3) var(--s-4); }
    .list-toolbar .search { max-width: none; }
}

/* ---------- size preview (add / edit template) ---------- */
.size-stage { position: relative; height: 320px; background: var(--liner); border-radius: 6px; overflow: hidden; }
.size-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.size-stage .lbl-box { position: absolute; background: var(--label); box-shadow: var(--lift); overflow: hidden; transition: left .15s, top .15s, width .15s, height .15s; }
@media (prefers-reduced-motion: reduce) { .size-stage .lbl-box { transition: none; } }
.size-stage .dim line { stroke: var(--ink-3); stroke-width: 1.2; }
.size-stage .dim text { font: 600 13px 'Inter', sans-serif; fill: var(--ink); }
.size-stage .was { fill: none; stroke: #8a96b0; stroke-width: 1.2; stroke-dasharray: 5 4; }
.size-stage .was-label { font: 500 11px 'Inter', sans-serif; fill: var(--muted); }
.size-stage .hint { font: 500 13px 'Inter', sans-serif; fill: var(--muted); }
.size-caption { margin-top: .6rem; font-size: .9rem; color: var(--muted); }
.size-caption b { color: var(--ink); font-weight: 600; font-size: 1.05rem; }

/* ---------- template wall: preview + open ---------- */
.tpl-stage { border: 0; width: 100%; cursor: zoom-in; position: relative; }
.tpl-stage .zoom-hint {
    position: absolute; right: .6rem; bottom: .6rem; background: rgba(15, 23, 42, .78); color: #fff;
    font-size: .78rem; padding: .2rem .5rem; border-radius: 4px; opacity: 0; transition: opacity .15s;
}
.tpl-stage:hover .zoom-hint, .tpl-stage:focus-visible .zoom-hint { opacity: 1; }
.tpl-open { color: inherit; text-decoration: none; }
.tpl-open:hover .tpl-name { text-decoration: underline; text-underline-offset: 3px; }
.preview-stage { background: var(--liner); border-radius: 6px; padding: 2rem; display: grid; place-items: center; min-height: 340px; }
.preview-stage .die-cut canvas { max-width: 100%; height: auto !important; }

/* ---------- Reports ---------- */
.report-bar { height: 10px; background: var(--liner); border-radius: 3px; overflow: hidden; }
.report-bar span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }

/* ---------- Template form: languages dropdown ---------- */
.lang-picker .form-select { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 8px; }
.lang-option { display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem; border-radius: var(--radius-control); cursor: pointer; min-height: 38px; }
.lang-option:hover { background: var(--paper); }
.lang-option:has(input:checked) { background: var(--primary-50); }
.tpl-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .35rem; }
.lang-tag { font-size: .7rem; font-weight: 700; padding: 0 .35rem; border-radius: 3px; background: var(--primary-100); color: var(--primary-700); line-height: 1.4; }
.list-group-item.active .lang-tag { background: #fff; color: var(--primary-700); }

/* ---------- Print: saved batch records + languages ---------- */
.records-wrap { max-height: 420px; }
.records th { white-space: nowrap; font-size: .82rem; }
.records td.sel, .records th.sel { width: 2rem; text-align: center; }
.records td.meta { line-height: 1.25; min-width: 90px; }
.records tr.row-selected > td { background: var(--primary-50); }
.records .form-control-sm { min-width: 110px; }
.lang-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 2px 6px; }
.lang-checks .lang-option:has(input:disabled) { cursor: not-allowed; opacity: .75; }

/* ---------- Print screen layout ---------- */
.print-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: var(--s-5); align-items: start; }
.print-main, .print-side { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
@media (max-width: 1199.98px) { .print-layout { grid-template-columns: 1fr; } }
.rec-tools { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.rec-tools .search { position: relative; width: 220px; }
.rec-tools .search .bi { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; }
.rec-tools .search input { padding-left: 1.9rem; }
@media (max-width: 575.98px) { .rec-tools { width: 100%; } .rec-tools .search { flex: 1; width: auto; } }
#import-map:not(:empty) { padding: var(--s-4) var(--s-5); border-bottom: 1px solid #e6ebf1; background: #fbfcfd; }
.preview-stage-lg { display: grid !important; place-items: center; min-height: 260px; padding: var(--s-6) !important; background: var(--liner); border-radius: 0 0 var(--radius-panel) var(--radius-panel) !important; }
.copies-stepper { max-width: 220px; }
.copies-stepper .btn { width: 44px; }
.mode-switch .btn { min-width: 110px; }

/* sticky summary + Print button */
.print-bar {
    position: sticky; bottom: var(--s-3); z-index: 1010; margin-top: var(--s-5);
    background: var(--label); border: 1px solid var(--line); border-radius: var(--radius-panel);
    box-shadow: 0 -8px 24px -16px rgba(15, 23, 42, .25); padding: var(--s-3) var(--s-4);
}
.print-bar-row { display: flex; align-items: center; gap: var(--s-4); }
.print-bar .summary { flex: 1; }
.print-bar .total { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--ink); }
.print-bar .total .unit { font-size: .85rem; font-weight: 600; color: var(--muted); }
.print-bar .total.over { color: var(--danger); }
.print-bar .btn-print { min-width: 220px; min-height: 52px; }
.print-bar .print-status { max-height: 30vh; overflow: auto; }
.print-bar #pdf-result:not(:empty) { margin-bottom: var(--s-2); }
.print-bar .progress { margin-bottom: var(--s-2); }
@media (max-width: 575.98px) {
    .print-bar { bottom: calc(var(--tabbar-h) + .5rem); margin-left: calc(-1 * var(--s-2)); margin-right: calc(-1 * var(--s-2)); }
    .print-bar .btn-print { min-width: 0; flex: none; padding-left: 1rem; padding-right: 1rem; }
    .print-bar .total { font-size: 1.25rem; }
}

/* Records grid as cards on phones: checkbox + number on top, then labelled inputs. */
@media (max-width: 575.98px) {
    .records-wrap { max-height: none; }
    .records.table-stack tbody tr { position: relative; padding-top: var(--s-4); }
    .records.table-stack > tbody > tr > td { align-items: center; }
    .records.table-stack > tbody > tr > td .cell-v { flex: 1; max-width: 62%; }
    .records.table-stack > tbody > tr > td .form-control-sm { min-width: 0; width: 100%; }
    .records.table-stack > tbody > tr > td.sel { position: absolute; top: .55rem; left: var(--s-4); width: auto; }
    .records.table-stack > tbody > tr > td.sel::before { content: none; }
    .records.table-stack > tbody > tr > td.sel + td { justify-content: center; font-weight: 700; }
    .records.table-stack > tbody > tr > td.sel + td::before { content: "Record"; }
    .records.table-stack > tbody > tr > td.meta { font-size: .78rem; }
    .records.table-stack tr.row-selected { background: var(--primary-50); border-color: var(--primary-200); }
    .records.table-stack tr.row-selected > td { background: transparent; }
}

/* Breadcrumb on narrow screens: keep only the current page, truncated. */
.crumbs { flex: 1 1 auto; overflow: hidden; }
.crumbs li[aria-current] span { display: block; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 767.98px) {
    .crumbs li:not(:last-child) { display: none; }
    .crumbs li + li::before { content: none; }
}

/* ---------- in-app confirm / prompt (LP.confirm, LP.prompt) ---------- */
.modal { --bs-modal-bg: var(--label); }
.lp-dialog .modal-dialog { max-width: 480px; }
.lp-dialog .modal-content { border: 0; border-radius: 16px; box-shadow: 0 24px 64px -16px rgba(15, 23, 42, .35), 0 0 0 1px rgba(15, 23, 42, .05); }
.lp-dialog .modal-body { display: flex; gap: 1rem; padding: 1.5rem 1.5rem .75rem; }
.lp-dialog .modal-footer { border: 0; padding: .75rem 1.5rem 1.5rem; gap: .5rem; }
.lp-dialog .modal-footer > * { margin: 0; }
.lp-dialog-icon { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 1.25rem; background: var(--primary-50); color: var(--primary); box-shadow: 0 0 0 6px rgba(79, 70, 229, .06); }
.lp-dialog[data-variant="danger"] .lp-dialog-icon { background: var(--danger-50); color: var(--danger); box-shadow: 0 0 0 6px rgba(220, 38, 38, .06); }
.lp-dialog[data-variant="warning"] .lp-dialog-icon { background: var(--warn-50); color: var(--warn); box-shadow: 0 0 0 6px rgba(217, 119, 6, .07); }
.lp-dialog-title { font-size: 1.1rem; font-weight: 650; margin: .55rem 0 .35rem; }
.lp-dialog-msg { color: var(--ink-3); margin: 0 0 .25rem; overflow-wrap: anywhere; }
.lp-dialog-field { margin-top: .9rem; }
.lp-dialog-field[hidden], .lp-dialog-msg[hidden] { display: none; }
.modal-backdrop.show { opacity: 1; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.btn-danger {
    --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c;
    --bs-btn-active-bg: #991b1b; --bs-btn-active-border-color: #991b1b;
    box-shadow: 0 1px 2px rgba(220, 38, 38, .25), inset 0 1px 0 rgba(255, 255, 255, .12);
}
@media (max-width: 575.98px) {
    .lp-dialog .modal-dialog { margin: .75rem; }
    .lp-dialog .modal-footer > .btn { flex: 1; }
}

/* PDF output split into parts */
.pdf-part { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .5rem; padding: .45rem 0; border-top: 1px solid var(--line-soft); }
.pdf-part:first-child { border-top: 0; }
.pdf-part-label { flex: 1 1 180px; font-size: .9rem; font-weight: 500; }

/* Role descriptions on the user forms */
.role-help { font-size: .875rem; color: var(--ink-3); }
.role-help summary { cursor: pointer; color: var(--primary-700); font-weight: 550; width: fit-content; }
.role-help dl { display: grid; grid-template-columns: auto 1fr; gap: .5rem .75rem; margin: .75rem 0 0; }
.role-help dt { font-weight: 400; }
.role-help dd { margin: 0; }
@media (max-width: 575.98px) { .role-help dl { grid-template-columns: 1fr; } .role-help dd { margin-bottom: .4rem; } }

/* Change password: forced (sign-in layout) and voluntary (app frame) */
.pw-form { display: flex; flex-direction: column; gap: 1rem; }
.pw-card { max-width: 520px; }
.pw-rules { list-style: none; padding: 0; margin: -.25rem 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: .3rem .75rem; font-size: .84rem; color: var(--muted); }
.pw-rules li { display: flex; align-items: center; gap: .4rem; }
.pw-rules li.ok { color: var(--print-dark); }
.pw-rules li.ok i { color: var(--print); }
@media (max-width: 420px) { .pw-rules { grid-template-columns: 1fr; } }
.pw-match { margin-top: -.5rem; display: flex; align-items: center; gap: .4rem; }
.pw-match.ok { color: var(--print-dark); }
.pw-match.bad { color: var(--danger); }
.auth-step {
    display: inline-flex; align-items: center; gap: .4rem; margin-bottom: .75rem;
    font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--primary-700);
    background: var(--primary-50); border-radius: 999px; padding: .25rem .7rem;
}
.auth-signed-in { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .25rem .75rem; justify-content: space-between; font-size: .875rem; color: var(--muted); }
.auth-signed-in .btn-link { font-size: .875rem; text-decoration: none; }

/* Validation */
.validation-summary-valid { display: none; }
.field-validation-error { display: block; margin-top: .25rem; }

/* ---------- pager (server _Pager.cshtml and in-browser lists share it) ---------- */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-5); font-size: .875rem; color: var(--muted); }
.pager-info b { color: var(--ink); font-weight: 600; }
.pager-size { display: inline-flex; align-items: center; gap: var(--s-2); margin: 0; white-space: nowrap; }
.pager-size .form-select { width: auto; min-width: 4.5rem; }
.pager .pagination { margin-left: auto; flex-wrap: wrap; }
.card .table[data-paginate] { margin-bottom: 0; }
@media (max-width: 575.98px) {
    .pager { justify-content: center; text-align: center; }
    .pager .pagination { margin-left: 0; }
}
