:root {
    --orange: #f97316;
    --orange-dark: #ea580c;
    --orange-soft: #fff7ed;
    --orange-border: #fed7aa;
    --ink: #172033;
    --text: #475569;
    --muted: #94a3b8;
    --line: #e8edf3;
    --panel: #ffffff;
    --background: #f8fafc;
    --success: #15803d;
    --danger: #b91c1c;
    --shadow: 0 12px 35px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--background);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

button, input, select { font: inherit; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 30;
}

.brand {
    height: 92px;
    padding: 22px 24px;
    display: flex;
    align-items: center;
    gap: 13px;
    border-bottom: 1px solid var(--line);
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: white;
    display: grid;
    place-items: center;
    font-size: 21px;
    font-weight: 800;
    box-shadow: 0 9px 22px rgba(249,115,22,.28);
}

.brand-mark.large { width: 58px; height: 58px; border-radius: 18px; font-size: 28px; }

.brand strong { display: block; font-size: 15px; letter-spacing: .09em; }
.brand span { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.nav-menu { padding: 18px 14px; flex: 1; overflow-y: auto; }

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 45px;
    padding: 0 13px;
    margin: 3px 0;
    border-radius: 11px;
    color: #5a6577;
    font-size: 14px;
    font-weight: 600;
    transition: .18s ease;
}

.nav-menu a:hover { background: #f8fafc; color: var(--ink); }

.nav-menu a.active {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.nav-icon {
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    font-size: 16px;
}

.sidebar-footer { border-top: 1px solid var(--line); padding: 17px 18px 20px; }

.user-mini { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--orange-soft);
    color: var(--orange-dark);
    display: grid;
    place-items: center;
    font-weight: 800;
}

.user-mini strong, .user-mini span {
    display: block;
    max-width: 145px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-mini strong { font-size: 13px; }
.user-mini span { color: var(--muted); font-size: 11px; margin-top: 2px; text-transform: capitalize; }
.logout-link { font-size: 12px; color: #64748b; }
.logout-link:hover { color: var(--orange-dark); }

.main { width: calc(100% - 260px); margin-left: 260px; min-width: 0; }

.topbar {
    height: 92px;
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    padding: 0 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(8px);
}

.topbar h1 { margin: 0; font-size: 20px; font-weight: 750; }
.topbar p { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.topbar-badge {
    margin-left: auto;
    font-size: 10px;
    letter-spacing: .08em;
    font-weight: 800;
    background: var(--orange-soft);
    border: 1px solid var(--orange-border);
    color: var(--orange-dark);
    padding: 7px 10px;
    border-radius: 999px;
}

.menu-toggle { display: none; border: 0; background: transparent; font-size: 22px; cursor: pointer; }

.content { padding: 28px 30px 48px; max-width: 1800px; margin: 0 auto; }

.page-actions {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.page-actions h2 { margin: 0; font-size: 22px; }
.page-actions p { margin: 5px 0 0; color: var(--text); font-size: 13px; }

.store-filter { display: grid; gap: 5px; min-width: 280px; }
.store-filter label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.store-filter select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
}
.store-filter select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card {
    min-height: 108px;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 42px; height: 42px; flex: 0 0 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--orange-soft);
    color: var(--orange-dark);
    font-weight: 800;
}

.stat-card span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .055em; font-weight: 700; }
.stat-card strong { display: block; margin-top: 4px; font-size: 26px; letter-spacing: -.03em; }
.stat-card.success .stat-icon { background: #f0fdf4; color: var(--success); }
.stat-card.warning .stat-icon { background: #fff7ed; color: #c2410c; }
.stat-card.danger .stat-icon { background: #fef2f2; color: var(--danger); }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(330px, .8fr);
    gap: 18px;
    margin-bottom: 18px;
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: var(--shadow);
    padding: 20px;
    min-width: 0;
}

.panel-heading { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 16px; }
.panel-heading h3 { margin: 0; font-size: 15px; }
.panel-heading p { margin: 4px 0 0; font-size: 11px; color: var(--muted); }
.text-link { color: var(--orange-dark); font-size: 12px; font-weight: 700; white-space: nowrap; }

.chart-wrap { height: 310px; position: relative; }
.chart-wrap.donut { height: 310px; }

.table-scroll { overflow-x: auto; }

/* Table hints are injected by tablet-ux.js; keep their layout intact even when
   a cached/previously tablet-enhanced page is viewed outside tablet breakpoints. */
.tablet-table-hint{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 14px;width:100%;box-sizing:border-box;margin:0 0 8px;padding:8px 12px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;color:#64748b;font-size:11px;line-height:1.4}
.tablet-table-hint>span{min-width:0}
.tablet-table-hint>b{margin-left:auto;color:#9a3412;font-weight:800;text-align:right;white-space:nowrap}
@media(max-width:560px){.tablet-table-hint{justify-content:flex-start}.tablet-table-hint>b{margin-left:0;text-align:left}}

.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th {
    padding: 10px 9px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: .05em;
    text-transform: uppercase;
    text-align: left;
}
.data-table td { padding: 12px 9px; border-bottom: 1px solid #f1f5f9; color: #536074; vertical-align: middle; }
.data-table td strong { color: var(--ink); display: block; font-size: 12px; }
.data-table td small { color: var(--muted); display: block; margin-top: 2px; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.positive { color: var(--success) !important; font-weight: 700; }
.negative { color: var(--danger) !important; font-weight: 700; }
.pill { display: inline-block; padding: 5px 8px; border-radius: 999px; background: #f8fafc; border: 1px solid var(--line); font-size: 9px; font-weight: 800; color: #64748b; }

.low-stock-list { display: grid; gap: 8px; }
.stock-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid #f0f2f5;
    border-radius: 11px;
}
.stock-item strong { display: block; font-size: 11px; }
.stock-item span, .stock-item small { display: block; color: var(--muted); margin-top: 2px; font-size: 10px; }
.stock-item b {
    min-width: 34px; height: 34px; padding: 0 8px;
    border-radius: 10px; background: var(--orange-soft); color: var(--orange-dark);
    display: grid; place-items: center;
}

.empty, .empty-card { color: var(--muted); text-align: center; padding: 25px !important; }

.alert { border-radius: 11px; padding: 12px 14px; margin: 0 0 18px; font-size: 13px; }
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-danger { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.module-placeholder {
    max-width: 620px;
    margin: 80px auto;
    text-align: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 52px 35px;
    box-shadow: var(--shadow);
}
.placeholder-icon { font-size: 32px; color: var(--orange); }
.module-placeholder h2 { margin: 12px 0 8px; }
.module-placeholder p { color: var(--text); line-height: 1.7; margin: 0 auto 24px; max-width: 460px; }

.btn-primary {
    border: 0;
    background: linear-gradient(135deg, #fb923c, #ea580c);
    color: white;
    border-radius: 10px;
    padding: 11px 17px;
    font-weight: 750;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 18px rgba(249,115,22,.22);
}
.btn-primary:hover { filter: brightness(.98); }
.btn-block { width: 100%; }

/* Login */
.login-page { background: white; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }

.login-brand {
    position: relative;
    overflow: hidden;
    display: grid;
    place-items: center;
    padding: 60px;
    background:
        radial-gradient(circle at 15% 15%, rgba(255,255,255,.18), transparent 24%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,.12), transparent 26%),
        linear-gradient(145deg, #f97316, #ea580c 65%, #c2410c);
    color: white;
}

.login-brand::after {
    content: "";
    position: absolute;
    width: 420px; height: 420px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 50%;
    right: -180px; bottom: -190px;
}

.login-brand-inner { max-width: 520px; position: relative; z-index: 1; }
.login-brand .brand-mark { background: white; color: var(--orange-dark); box-shadow: 0 15px 35px rgba(124,45,18,.18); margin-bottom: 28px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-weight: 800; font-size: 10px; }
.login-brand h1 { margin: 13px 0; font-size: clamp(38px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.login-brand p { max-width: 480px; font-size: 15px; line-height: 1.75; color: rgba(255,255,255,.82); }
.feature-row { display: flex; flex-wrap: wrap; gap: 17px; margin-top: 28px; font-size: 11px; font-weight: 750; }

.login-form-panel { display: grid; place-items: center; padding: 50px 28px; }

.login-form { width: min(420px, 100%); }
.login-form > .eyebrow { color: var(--orange-dark); }
.login-form h2 { margin: 8px 0 4px; font-size: 30px; letter-spacing: -.03em; }
.login-form > p { margin: 0 0 28px; color: var(--text); font-size: 13px; }

.login-form label { display: grid; gap: 7px; margin-bottom: 16px; }
.login-form label > span { color: #4b5563; font-size: 12px; font-weight: 700; }
.login-form input,
.login-form select {
    width: 100%;
    height: 46px;
    border: 1px solid #dce2e9;
    border-radius: 10px;
    padding: 0 12px;
    outline: none;
    color: var(--ink);
    background: #fff;
}
.login-form input:focus, .login-form select:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(249,115,22,.12); }

.password-field { position: relative; }
.password-field input { padding-right: 60px; }
.password-field button {
    position: absolute;
    right: 7px; top: 7px; bottom: 7px;
    border: 0; background: transparent;
    color: var(--orange-dark); font-weight: 700; font-size: 11px; cursor: pointer;
}
.form-note { display: block; margin-top: 14px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.login-utility-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:14px;padding:10px 12px;border:1px solid #e5e7eb;border-radius:14px;background:#fff7ed;overflow-x:auto;scrollbar-width:thin}
.login-utility-brand{display:flex;align-items:center;gap:10px;flex:0 0 auto;min-width:0}
.login-utility-brand .brand-mark{width:34px;height:34px;border-radius:11px;font-size:17px;box-shadow:0 8px 18px rgba(249,115,22,.22)}
.login-utility-brand-copy{display:grid;gap:1px;min-width:0}
.login-utility-brand-copy strong{font-size:12px;letter-spacing:.08em;text-transform:uppercase;color:#9a3412}
.login-utility-brand-copy span{font-size:10px;color:#7c2d12;white-space:nowrap}
.login-utility-actions{display:flex;align-items:center;gap:8px;flex:0 0 auto;flex-wrap:nowrap}
.login-utility-btn{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 12px;border-radius:10px;white-space:nowrap;font-size:12px;font-weight:700;text-decoration:none;flex:0 0 auto}
.login-utility-actions .pwa-install-button[hidden]{display:none!important}
.device-login-actions{display:none}

@media (max-width: 1250px) {
    .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1050px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .chart-wrap.donut { height: 340px; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px rgba(15,23,42,.12); }
    .sidebar.open { transform: translateX(0); }
    .main { width: 100%; margin-left: 0; }
    .menu-toggle { display: block; }
    .content { padding: 22px 18px 40px; }
    .topbar { padding: 0 18px; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 380px; padding: 45px 30px; }
}

@media (max-width: 720px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .page-actions { align-items: stretch; flex-direction: column; }
    .store-filter { min-width: 0; width: 100%; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .topbar-badge { display: none; }
    .login-form-panel { padding: 30px 16px; }
    .login-form { width: 100%; }
    .login-utility-bar { gap: 10px; padding: 9px 10px; }
    .login-utility-brand-copy strong { font-size: 11px; }
    .login-utility-brand-copy span { font-size: 9px; }
    .login-utility-btn { min-height: 34px; padding: 0 10px; font-size: 11px; }
}


/* Phase 2: Products + Inventory */
.filter-panel { margin-bottom: 18px; padding: 16px 18px; }

.filter-grid {
    display: grid;
    gap: 13px;
    align-items: end;
}

.product-filter-grid { grid-template-columns: minmax(280px, 1.7fr) minmax(140px, .55fr) minmax(190px, .9fr) 100px; }
.inventory-filter-grid { grid-template-columns: minmax(220px, .9fr) minmax(300px, 1.3fr) minmax(180px, .7fr) 100px; }

.filter-grid label, .barcode-box { display: grid; gap: 6px; }
.filter-grid label > span, .barcode-box > label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.filter-grid input,
.filter-grid select,
.barcode-box input {
    width: 100%;
    height: 42px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.filter-grid input:focus,
.filter-grid select:focus,
.barcode-box input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.products-actions { align-items: end; }

.barcode-box { width: min(420px, 100%); }
.search-inline { display: flex; gap: 8px; }
.search-inline input { min-width: 0; flex: 1; }

.table-panel { padding: 0; overflow: hidden; }
.table-panel .table-scroll { padding: 0 18px; }

.table-toolbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--line);
}

.table-toolbar h3 { margin: 0; font-size: 15px; }
.table-toolbar p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }

.pagination-bar {
    min-height: 66px;
    padding: 12px 18px;
    border-top: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.pagination-bar span { min-width: 100px; text-align: center; color: var(--text); font-size: 11px; font-weight: 700; }

.btn-secondary {
    min-height: 36px;
    padding: 0 13px;
    border: 1px solid #dce3eb;
    border-radius: 9px;
    background: #fff;
    color: #526073;
    font-size: 11px;
    font-weight: 750;
    cursor: pointer;
}
.btn-secondary:hover:not(:disabled) { border-color: #cbd5e1; background: #f8fafc; color: var(--ink); }
.btn-secondary:disabled { opacity: .45; cursor: default; }

.btn-table, .table-link {
    border: 0;
    background: transparent;
    color: var(--orange-dark);
    font-weight: 750;
    cursor: pointer;
    padding: 0;
}
.btn-table {
    padding: 6px 9px;
    border: 1px solid var(--orange-border);
    background: var(--orange-soft);
    border-radius: 8px;
    font-size: 10px;
}
.table-link:hover { text-decoration: underline; }

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.status-badge.active { color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0; }
.status-badge.inactive { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }

.stock-number {
    display: inline-flex;
    justify-content: flex-end;
    min-width: 32px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.stock-number.low { color: var(--orange-dark); }
.muted-number { color: var(--muted) !important; }

.inventory-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.modal-open { overflow: hidden; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .48);
    backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: flex; }

.modal-card {
    width: min(680px, 100%);
    max-height: min(88vh, 900px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 17px;
    box-shadow: 0 30px 80px rgba(15,23,42,.25);
}
.modal-card.modal-large { width: min(980px, 100%); }

.modal-header, .modal-footer {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 17px 20px;
}
.modal-header { justify-content: space-between; border-bottom: 1px solid var(--line); }
.modal-footer { justify-content: flex-end; border-top: 1px solid var(--line); }
.modal-header h3 { margin: 3px 0 0; font-size: 18px; }

.modal-close {
    width: 36px; height: 36px;
    border: 0;
    border-radius: 10px;
    background: #f8fafc;
    color: #64748b;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.modal-body { padding: 20px; overflow-y: auto; }

.loading-block {
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--muted);
}

.orange-text { color: var(--orange-dark); }

.product-detail-hero {
    display: flex;
    align-items: center;
    gap: 17px;
    padding: 16px;
    border: 1px solid var(--orange-border);
    border-radius: 14px;
    background: var(--orange-soft);
}
.product-code-box {
    min-width: 125px;
    padding: 13px 12px;
    border-radius: 10px;
    background: #fff;
    color: var(--orange-dark);
    font-weight: 850;
    letter-spacing: .06em;
    text-align: center;
    border: 1px solid #ffedd5;
}
.product-detail-hero h4 { margin: 7px 0 3px; font-size: 17px; }
.product-detail-hero p { margin: 0; color: var(--text); font-size: 11px; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0,1fr));
    gap: 10px;
    margin-top: 15px;
}
.detail-grid > div {
    min-height: 68px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
}
.detail-grid span {
    display: block;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    font-size: 9px;
    font-weight: 750;
}
.detail-grid strong { display: block; margin-top: 5px; font-size: 12px; word-break: break-word; }

.modal-section { margin-top: 22px; }
.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.section-title h4 { margin: 0; font-size: 13px; }
.section-title span { color: var(--muted); font-size: 10px; }

.detail-strip {
    padding: 11px 13px;
    margin-bottom: 14px;
    border-radius: 10px;
    background: var(--orange-soft);
    color: var(--orange-dark);
    font-size: 12px;
}

.danger-outline { color: #b91c1c; border-color: #fecaca; }
.success-outline { color: #15803d; border-color: #bbf7d0; }

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1200;
    max-width: min(380px, calc(100vw - 44px));
    padding: 12px 15px;
    border-radius: 11px;
    background: #172033;
    color: #fff;
    font-size: 12px;
    font-weight: 650;
    box-shadow: 0 15px 35px rgba(15,23,42,.25);
    opacity: 0;
    transform: translateY(14px);
    pointer-events: none;
    transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }

@media (max-width: 1180px) {
    .product-filter-grid,
    .inventory-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .inventory-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 650px) {
    .product-filter-grid,
    .inventory-filter-grid { grid-template-columns: 1fr; }
    .products-actions { align-items: stretch; }
    .barcode-box { width: 100%; }
    .search-inline { flex-direction: column; }
    .pagination-bar { justify-content: space-between; }
    .detail-grid { grid-template-columns: 1fr; }
    .product-detail-hero { align-items: flex-start; flex-direction: column; }
    .modal-backdrop { padding: 8px; align-items: flex-end; }
    .modal-card { max-height: 94vh; border-radius: 16px 16px 0 0; }
}


/* VER1.0040 — Hardened camera barcode scanner foundation */
.barcode-actions { align-items: stretch; }
.scanner-hint {
    display: block;
    max-width: 680px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.camera-modal-card { width: min(720px, 100%); }

.camera-scan-shell {
    position: relative;
    width: 100%;
    min-height: 320px;
    overflow: hidden;
    border-radius: 14px;
    background: #0b2523;
    isolation: isolate;
}

.camera-scan-shell > video {
    display: block;
    width: 100%;
    height: clamp(260px, 52dvh, 460px);
    min-height: 320px;
    object-fit: cover;
    background: #071413;
}

/*
 * This element is the real viewfinder, not just decoration. The shared
 * scanner maps these screen coordinates back into source-video pixels and
 * sends only this crop to BarcodeDetector.
 */
.camera-scan-frame {
    position: absolute;
    inset: 28% 12%;
    z-index: 2;
    pointer-events: none;
    border: 2px solid #72f3cf;
    border-radius: 10px;
    box-shadow: 0 0 0 9999px rgba(5, 25, 23, .42);
}

.camera-scan-frame::before { content: none; }

.camera-scan-frame span {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 50%;
    height: 2px;
    background: var(--orange);
    box-shadow: 0 0 14px rgba(249,115,22,.9);
    animation: barcodeScanLine 1.8s ease-in-out infinite alternate;
}

.camera-status {
    margin: 12px 0 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1.45;
    text-align: center;
    min-height: 1.5em;
}

.camera-status[data-scanner-state="confirming"],
.camera-status[data-scanner-state="lookup"] { color: #9a3412; }
.camera-status[data-scanner-state="success"] { color: #166534; }
.camera-status[data-scanner-state="error"],
.camera-status[data-scanner-state="multiple"] { color: #b91c1c; }

.scanner-match-row {
    outline: 2px solid #22c55e;
    outline-offset: -2px;
    background: #f0fdf4 !important;
}

.scanner-verify-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.scanner-verify-result {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}

@keyframes barcodeScanLine {
    from { transform: translateY(-42px); }
    to { transform: translateY(42px); }
}

@media (max-width: 720px) {
    .barcode-actions { flex-wrap: wrap; }
    .barcode-actions input { flex: 1 1 100%; }
    .barcode-actions button { flex: 1 1 auto; }

    .camera-scan-shell,
    .camera-scan-shell > video {
        min-height: 260px;
        height: clamp(260px, 44dvh, 380px);
    }

    .camera-scan-frame { inset: 30% 8%; }
}


/* Barcode input / product search interaction hotfix */
#barcodeLookup,
#productSearch {
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

#barcodeLookup:focus,
#productSearch:focus {
    background: #ffffff;
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .12);
}

#barcodeLookup::selection,
#productSearch::selection {
    background: rgba(249, 115, 22, .22);
}


/* Phase 3: Stock Receiving */
.receiving-filter-grid {
    grid-template-columns: minmax(320px, 1.5fr) minmax(160px, .55fr) 100px;
}

.receiving-stats {
    margin-bottom: 18px;
}

.status-badge.pending {
    color: #9a3412;
    background: #fff7ed;
    border: 1px solid #fed7aa;
}

.status-badge.completed {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.status-badge.cancelled {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.modal-xl {
    width: min(1180px, 100%);
}

.modal-subtitle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.receiving-editor-body {
    background: #fbfcfe;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px;
}

.form-grid label {
    display: grid;
    gap: 6px;
}

.form-grid label > span,
.receiving-add-grid label > span,
.cancel-area label > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.form-grid input,
.form-grid select,
.receiving-add-grid input,
.cancel-area textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.form-grid input:focus,
.form-grid select:focus,
.receiving-add-grid input:focus,
.cancel-area textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.form-grid input:disabled,
.form-grid select:disabled {
    background: #f8fafc;
    color: #64748b;
}

.form-span-2 {
    grid-column: span 2;
}

.store-form-grid .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    padding: 10px 0;
}

.store-form-grid .checkbox-label input {
    flex: 0 0 18px;
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--orange);
}

.store-form-grid .checkbox-label span {
    color: var(--ink);
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.receiving-header-grid {
    padding: 17px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.receiving-entry-card {
    margin-top: 17px;
    padding: 17px;
    background: #fff;
    border: 1px solid var(--orange-border);
    border-radius: 14px;
}

.receiving-entry-card .section-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.receiving-add-grid {
    display: grid;
    grid-template-columns: minmax(350px, 1fr) minmax(300px, 1fr);
    gap: 14px;
}

.receiving-add-grid label {
    display: grid;
    gap: 6px;
    position: relative;
}

.receiving-add-grid small {
    color: var(--muted);
    font-size: 9px;
}

.product-search-wrap {
    position: relative;
}

.product-search-results {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    z-index: 1100;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 18px 40px rgba(15,23,42,.14);
}

.product-search-option {
    width: 100%;
    min-height: 58px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    text-align: left;
    cursor: pointer;
}

.product-search-option:last-child {
    border-bottom: 0;
}

.product-search-option:hover {
    background: var(--orange-soft);
}

.product-search-option strong,
.product-search-option small {
    display: block;
}

.product-search-option strong {
    font-size: 11px;
    color: var(--ink);
}

.product-search-option small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.product-search-option b {
    color: var(--orange-dark);
    font-size: 10px;
    white-space: nowrap;
}

.product-search-empty {
    padding: 18px;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.table-input {
    width: 88px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    text-align: right;
    outline: none;
}

.table-input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgba(249,115,22,.10);
}

.table-action-group {
    display: inline-flex;
    gap: 5px;
}

.danger-table {
    color: #991b1b;
    border-color: #fecaca;
    background: #fef2f2;
}

.cancel-area {
    margin-top: 17px;
    padding: 15px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    border-radius: 12px;
}

.cancel-area label {
    display: grid;
    gap: 6px;
}

.cancel-area textarea {
    resize: vertical;
}

.receiving-editor-footer {
    justify-content: space-between;
}

.footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.receiving-meta {
    color: var(--muted);
    font-size: 9px;
}

.receiving-final-note {
    margin-top: 13px;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

@media (max-width: 900px) {
    .receiving-add-grid {
        grid-template-columns: 1fr;
    }

    .receiving-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .receiving-editor-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .footer-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 650px) {
    .receiving-filter-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-span-2 {
        grid-column: auto;
    }

    .footer-actions button {
        flex: 1 1 auto;
    }

    .receiving-add-grid .search-inline {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .receiving-add-grid .search-inline input {
        grid-column: 1 / -1;
    }
}


/* Global textbox/input interaction fix */
input:not([disabled]),
textarea:not([disabled]),
select:not([disabled]),
[contenteditable="true"] {
    pointer-events: auto !important;
    user-select: text;
    -webkit-user-select: text;
    touch-action: manipulation;
    position: relative;
}

input:not([disabled]),
textarea:not([disabled]) {
    cursor: text;
}

select:not([disabled]) {
    cursor: pointer;
}

input:not([disabled]):focus,
textarea:not([disabled]):focus,
select:not([disabled]):focus {
    outline: none;
    border-color: var(--orange) !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.12) !important;
}

.modal-card input:not([disabled]),
.modal-card textarea:not([disabled]),
.modal-card select:not([disabled]) {
    z-index: 2;
}

/*
 * Hidden modal layers must never intercept clicks/focus.
 * When open, pointer events are restored.
 */
.modal-backdrop:not(.open) {
    pointer-events: none !important;
}

.modal-backdrop.open {
    pointer-events: auto !important;
}

.modal-card {
    pointer-events: auto;
}


/* Global searchable dropdowns - Select2 */
.select2-container {
    width: 100% !important;
    font-size: 12px;
}

.select2-container .select2-selection--single {
    height: 42px;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    outline: none;
    display: flex;
    align-items: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    width: 100%;
    padding-left: 11px;
    padding-right: 35px;
    line-height: 40px;
    color: var(--ink);
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
    right: 7px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

.select2-dropdown {
    border: 1px solid #dce3eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(15,23,42,.12);
    overflow: hidden;
    z-index: 1400;
}

.select2-container--open {
    z-index: 1400;
}

.select2-search--dropdown {
    display: block !important;
    padding: 8px;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    display: block !important;
    width: 100% !important;
    height: 38px;
    padding: 0 10px;
    border: 1px solid #dce3eb;
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.select2-results__options {
    max-height: 290px !important;
}

.select2-container--default .select2-results__option {
    min-height: 36px;
    padding: 9px 11px;
    color: #475569;
    font-size: 11px;
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--orange);
    color: #fff;
}

.select2-container--default .select2-results__option--selected {
    background: var(--orange-soft);
    color: var(--orange-dark);
    font-weight: 700;
}

/* Keep Select2 correctly positioned inside application modals. */
.modal-card .select2-container {
    z-index: 3;
}

.modal-card .select2-dropdown {
    z-index: 1500;
}

/* Select2 multi-select support for future modules. */
.select2-container--default .select2-selection--multiple {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    padding: 3px 7px;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background: var(--orange-soft);
    border: 1px solid var(--orange-border);
    color: var(--orange-dark);
    border-radius: 7px;
    padding: 3px 7px 3px 23px;
}

/*
 * Native selects stay in the DOM for accessibility and form behavior,
 * but Select2 handles the visible UI.
 */
select.select2-hidden-accessible[aria-hidden="true"] {
    display: none !important;
    pointer-events: none !important;
}


/* ============================================================
   Mobile modal layout fix
   ============================================================
   On phones, every modal becomes a true full-screen app sheet:
   - header stays visible
   - content scrolls independently
   - footer stays visible
   - no content is hidden behind browser UI/footer
   - safe-area insets are respected
*/
@media (max-width: 650px) {
    .modal-backdrop {
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        background: rgba(15, 23, 42, .50);
    }

    .modal-card,
    .modal-card.modal-large,
    .modal-card.modal-xl,
    .camera-modal-card {
        width: 100vw !important;
        max-width: 100vw !important;

        /* fallback first, then modern mobile viewport unit */
        height: 100vh;
        max-height: 100vh;
        height: 100dvh;
        max-height: 100dvh;

        margin: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        overflow: hidden !important;

        display: flex !important;
        flex-direction: column !important;
    }

    .modal-header {
        flex: 0 0 auto;
        min-height: 68px;
        padding:
            calc(12px + env(safe-area-inset-top, 0px))
            16px
            12px !important;
        background: #fff;
        z-index: 20;
    }

    .modal-header > div {
        min-width: 0;
    }

    .modal-header h3 {
        margin-top: 2px;
        font-size: 18px;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .modal-subtitle {
        flex-wrap: wrap;
        gap: 5px 8px;
    }

    .modal-close {
        flex: 0 0 40px;
        width: 40px;
        height: 40px;
        align-self: flex-start;
    }

    .modal-body {
        flex: 1 1 auto;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding: 14px !important;
        background: #fff;
    }

    .receiving-editor-body {
        background: #fbfcfe;
    }

    .modal-footer {
        flex: 0 0 auto;
        min-height: 64px;
        padding:
            10px
            14px
            calc(10px + env(safe-area-inset-bottom, 0px)) !important;
        background: #fff;
        z-index: 20;
        box-shadow: 0 -5px 18px rgba(15,23,42,.05);
    }

    .modal-footer .btn-primary,
    .modal-footer .btn-secondary {
        min-height: 42px;
    }

    /*
     * Product details:
     * Keep the mobile page compact instead of making each detail card
     * a full-width tall block.
     */
    .product-detail-hero {
        flex-direction: row !important;
        align-items: center !important;
        gap: 12px !important;
        padding: 12px !important;
        border-radius: 12px;
    }

    .product-code-box {
        min-width: 108px;
        max-width: 42%;
        padding: 11px 9px;
        font-size: 15px;
    }

    .product-detail-hero > div:last-child {
        min-width: 0;
        flex: 1;
    }

    .product-detail-hero h4 {
        margin: 6px 0 2px;
        font-size: 14px;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .product-detail-hero p {
        overflow-wrap: anywhere;
    }

    .detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-top: 10px !important;
    }

    .detail-grid > div {
        min-height: 58px !important;
        padding: 10px !important;
        border-radius: 10px !important;
    }

    .detail-grid span {
        font-size: 8px;
    }

    .detail-grid strong {
        margin-top: 4px;
        font-size: 11px;
        line-height: 1.25;
    }

    .modal-section {
        margin-top: 16px !important;
    }

    .section-title {
        align-items: flex-start;
    }

    /*
     * Horizontal data tables stay usable on narrow screens.
     * The body scrolls vertically and table wrapper scrolls horizontally.
     */
    .modal-body .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-body .data-table {
        min-width: 620px;
    }

    /*
     * Receiving editor action footer:
     * Keep buttons visible and wrap cleanly instead of stretching the modal.
     */
    .receiving-editor-footer {
        gap: 8px;
    }

    .receiving-editor-footer #receivingFooterLeft {
        display: none;
    }

    .receiving-editor-footer .footer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .receiving-editor-footer .footer-actions > button {
        width: 100%;
        margin: 0;
    }

    .receiving-editor-footer .footer-actions > .btn-primary:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    /*
     * New receiving and other forms: one clean column on phone.
     */
    .form-grid,
    .receiving-filter-grid,
    .receiving-add-grid {
        grid-template-columns: 1fr !important;
    }

    .form-span-2 {
        grid-column: auto !important;
    }

    /*
     * Camera modal: maximize useful preview area but keep controls visible.
     */
    .camera-scan-shell,
    #barcodeCameraVideo,
    #receivingCameraVideo {
        min-height: 280px;
        max-height: calc(100dvh - 190px);
    }

    /*
     * Select2 dropdowns inside full-screen modals.
     */
    .modal-card .select2-dropdown {
        max-width: calc(100vw - 28px);
    }
}

/* Very narrow phones */
@media (max-width: 390px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .product-detail-hero {
        align-items: flex-start !important;
    }

    .product-code-box {
        min-width: 96px;
        font-size: 13px;
    }

    .modal-header {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .modal-body {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .modal-footer {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}


/* Phase 4: Inventory Adjustments */
.adjustment-filter-grid {
    grid-template-columns: minmax(320px, 1.5fr) minmax(160px, .55fr) 100px;
}

.adjustment-stats {
    margin-bottom: 18px;
}

.adjustment-editor-body {
    background: #fbfcfe;
}

.adjustment-header-grid {
    padding: 17px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
}

.adjustment-entry-card {
    margin-top: 17px;
    padding: 17px;
    border: 1px solid var(--orange-border);
    border-radius: 14px;
    background: #fff;
}

.adjustment-entry-card .section-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 10px;
}

.adjustment-product-grid {
    display: grid;
    grid-template-columns: minmax(330px, 1fr) minmax(300px, 1fr);
    gap: 14px;
}

.adjustment-product-grid label,
.adjustment-value-area label {
    display: grid;
    gap: 6px;
    position: relative;
}

.adjustment-product-grid label > span,
.adjustment-value-area label > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.adjustment-product-grid input,
.adjustment-value-area input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.adjustment-product-grid input:focus,
.adjustment-value-area input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.selected-adjustment-product {
    margin-top: 13px;
    padding: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: 1px solid #dce3eb;
    border-radius: 11px;
    background: #f8fafc;
}

.selected-adjustment-product strong,
.selected-adjustment-product small {
    display: block;
}

.selected-adjustment-product strong {
    margin-top: 4px;
    font-size: 12px;
}

.selected-adjustment-product small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.adjustment-stock-box {
    flex: 0 0 auto;
    min-width: 105px;
    padding: 9px 12px;
    text-align: right;
    border-radius: 9px;
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.adjustment-stock-box span,
.adjustment-stock-box strong {
    display: block;
}

.adjustment-stock-box span {
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.adjustment-stock-box strong {
    margin-top: 3px;
    font-size: 18px;
}

.adjustment-value-area {
    display: grid;
    grid-template-columns: minmax(150px, .55fr) minmax(180px, .6fr) minmax(280px, 1.2fr) auto;
    gap: 12px;
    align-items: end;
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
}

.adjustment-add-button {
    min-height: 42px;
    white-space: nowrap;
}

.adjustment-editor-footer {
    justify-content: space-between;
}

.adjustment-final-note {
    margin-top: 13px;
}

@media (max-width: 950px) {
    .adjustment-product-grid,
    .adjustment-value-area {
        grid-template-columns: 1fr 1fr;
    }

    .adjustment-add-button {
        width: 100%;
    }
}

@media (max-width: 650px) {
    .adjustment-filter-grid,
    .adjustment-product-grid,
    .adjustment-value-area {
        grid-template-columns: 1fr !important;
    }

    .selected-adjustment-product {
        align-items: stretch;
        flex-direction: column;
    }

    .adjustment-stock-box {
        width: 100%;
        text-align: left;
    }

    .adjustment-editor-footer {
        gap: 8px;
    }

    .adjustment-editor-footer #adjustmentFooterLeft {
        display: none;
    }

    .adjustment-editor-footer .footer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .adjustment-editor-footer .footer-actions > button {
        width: 100%;
    }

    .adjustment-editor-footer .footer-actions > .btn-primary:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}


/* Phase 5: Stores Management */
.nav-section-label {
    padding: 15px 16px 6px;
    color: rgba(255,255,255,.45);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.store-filter-grid {
    grid-template-columns: minmax(360px, 1.5fr) minmax(160px, .55fr) 100px;
}

.store-address-cell {
    min-width: 220px;
    max-width: 380px;
    white-space: normal;
    line-height: 1.45;
}

.store-form-grid textarea {
    width: 100%;
    resize: vertical;
    min-height: 84px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    outline: none;
    font: inherit;
}

.store-form-grid textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.store-metrics-area {
    margin-top: 16px;
}

.store-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.store-metric-card {
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}

.store-metric-card span,
.store-metric-card small,
.store-metric-card strong {
    display: block;
}

.store-metric-card span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.store-metric-card strong {
    margin-top: 6px;
    font-size: 18px;
    color: var(--ink);
}

.store-metric-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.store-user-list {
    display: grid;
    gap: 8px;
}

.store-user-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}

.store-user-row .avatar {
    width: 34px;
    height: 34px;
}

.store-user-row strong,
.store-user-row span {
    display: block;
}

.store-user-row strong {
    font-size: 11px;
}

.store-user-row div > span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
}

.store-users-empty {
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 11px;
}

.store-modal-footer {
    justify-content: space-between;
}

@media (max-width: 850px) {
    .store-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .store-filter-grid,
    .store-metrics-grid {
        grid-template-columns: 1fr !important;
    }

    .store-modal-footer {
        gap: 8px;
    }

    .store-modal-footer #storeStatusActions,
    .store-modal-footer .footer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .store-modal-footer #storeStatusActions:empty {
        display: none;
    }

    .store-modal-footer #storeStatusActions button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .store-modal-footer .footer-actions > button {
        width: 100%;
    }
}


/* Phase 6: Store Users / Access Management */
.user-filter-grid {
    grid-template-columns: minmax(330px, 1.45fr) minmax(150px, .55fr) minmax(150px, .55fr) 100px;
}

.role-pill {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.user-store-summary {
    min-width: 210px;
    max-width: 350px;
    white-space: normal;
}

.user-store-summary strong,
.user-store-summary small {
    display: block;
}

.user-store-summary small {
    margin-top: 3px;
    color: var(--muted);
    line-height: 1.35;
}

.user-profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-password-area {
    margin-top: 16px;
    padding: 15px;
    border: 1px solid var(--orange-border);
    border-radius: 13px;
    background: #fffaf5;
}

.user-password-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.user-store-access-label {
    display: grid;
    gap: 7px;
}

.user-store-access-label > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.user-store-access-label .select2-container {
    width: 100% !important;
}

.user-store-access-label .select2-selection--multiple {
    min-height: 44px !important;
}

.user-activity-list {
    display: grid;
    gap: 7px;
}

.user-saved-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-bottom: 12px;
}

.user-summary-item {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.user-summary-item span,
.user-summary-item strong {
    display: block;
}

.user-summary-item span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.user-summary-item strong {
    margin-top: 4px;
    overflow-wrap: anywhere;
    font-size: 11px;
    line-height: 1.4;
}

.user-next-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 14px;
}

.user-next-actions[hidden] {
    display: none;
}

.user-activity-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: start;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.user-activity-row strong,
.user-activity-row span {
    display: block;
}

.user-activity-row strong {
    font-size: 10px;
}

.user-activity-row span {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
}

.user-activity-row time {
    color: var(--muted);
    font-size: 8px;
    white-space: nowrap;
}

.user-activity-empty {
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 10px;
}

.user-modal-footer {
    justify-content: space-between;
}

.store-users-manage-link {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.store-users-manage-link .btn-secondary {
    text-decoration: none;
}

@media (max-width: 900px) {
    .user-filter-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 650px) {
    .user-filter-grid,
    .user-profile-grid,
    .user-password-grid {
        grid-template-columns: 1fr !important;
    }

    .user-activity-row {
        grid-template-columns: 1fr;
    }

    .user-saved-summary {
        grid-template-columns: 1fr;
    }

    .user-next-actions,
    .user-next-actions > button {
        width: 100%;
    }

    .user-activity-row time {
        white-space: normal;
    }

    .user-modal-footer {
        gap: 8px;
    }

    .user-modal-footer #userStatusActions,
    .user-modal-footer .footer-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .user-modal-footer #userStatusActions:empty {
        display: none;
    }

    .user-modal-footer #userStatusActions button,
    .user-modal-footer #userStatusActions .receiving-meta {
        grid-column: 1 / -1;
        width: 100%;
    }

    .user-modal-footer .footer-actions > button {
        width: 100%;
    }
}


/* Sortable main tables */
.data-table th.sortable-column {
    position: relative;
    padding-right: 22px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.data-table th.sortable-column::after {
    content: '↕';
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 10px;
    font-weight: 900;
    opacity: .72;
}

.data-table th.sortable-column:hover,
.data-table th.sortable-column:focus-visible {
    background: #fff7ed;
    color: #9a3412;
    outline: none;
}

.data-table th.sortable-column.sort-active {
    color: #c2410c;
    background: #fff7ed;
}

.data-table th.sortable-column.sort-asc::after {
    content: '▲';
    color: #f97316;
    opacity: 1;
}

.data-table th.sortable-column.sort-desc::after {
    content: '▼';
    color: #f97316;
    opacity: 1;
}


/* Phase 7: Stock Transfers */
.transfer-filter-grid {
    grid-template-columns: minmax(330px, 1.5fr) minmax(170px, .55fr) 100px;
}

.transfer-stats {
    margin-bottom: 18px;
}

.status-badge.in_transit {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.transfer-workflow-note {
    line-height: 1.55;
}

.transfer-new-grid,
.transfer-header-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.transfer-new-hint {
    margin-top: 16px;
}

.transfer-barcode-grid {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 14px;
}

.transfer-barcode-grid > label {
    min-width: 0;
}

.transfer-barcode-grid > label > span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.transfer-final-note {
    margin-top: 14px;
}

.transfer-editor-footer {
    justify-content: space-between;
}

.transfer-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

#transferCameraVideo {
    display: block;
    width: 100%;
    min-height: 320px;
    max-height: 60vh;
    object-fit: cover;
}

@media (max-width: 900px) {
    .transfer-barcode-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .transfer-filter-grid,
    .transfer-new-grid,
    .transfer-header-grid {
        grid-template-columns: 1fr !important;
    }

    .transfer-editor-footer {
        gap: 8px;
    }

    .transfer-editor-footer #transferFooterLeft,
    .transfer-editor-footer .transfer-footer-actions {
        width: 100%;
    }

    .transfer-footer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .transfer-footer-actions > button {
        width: 100%;
    }

    #dispatchTransferBtn,
    #completeTransferBtn {
        grid-column: 1 / -1;
    }

    #transferCameraVideo {
        min-height: 260px;
    }
}


/* Phase 7 UI hotfix: complete Stock Transfer control styling */

/*
 * All form controls inside transfer modals get the same visual system as
 * Receiving / Adjustments. This intentionally covers text, search, number,
 * select and textarea controls so future transfer fields do not appear as
 * raw browser-default controls.
 */
#newTransferModal input:not([type="hidden"]),
#newTransferModal select,
#newTransferModal textarea,
#transferEditorModal input:not([type="hidden"]),
#transferEditorModal select,
#transferEditorModal textarea {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.35;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

#newTransferModal input::placeholder,
#newTransferModal textarea::placeholder,
#transferEditorModal input::placeholder,
#transferEditorModal textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

#newTransferModal input:not([disabled]):hover,
#newTransferModal select:not([disabled]):hover,
#newTransferModal textarea:not([disabled]):hover,
#transferEditorModal input:not([disabled]):hover,
#transferEditorModal select:not([disabled]):hover,
#transferEditorModal textarea:not([disabled]):hover {
    border-color: #cbd5e1;
}

#newTransferModal input:focus,
#newTransferModal select:focus,
#newTransferModal textarea:focus,
#transferEditorModal input:focus,
#transferEditorModal select:focus,
#transferEditorModal textarea:focus {
    border-color: var(--orange) !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.12) !important;
    background: #fff;
}

#newTransferModal input:disabled,
#newTransferModal select:disabled,
#newTransferModal textarea:disabled,
#transferEditorModal input:disabled,
#transferEditorModal select:disabled,
#transferEditorModal textarea:disabled {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

/* Keep transfer textareas comfortably usable. */
#transferCancelReason {
    min-height: 92px;
    resize: vertical;
}

/* Source/destination panels now visually match the other transaction modules. */
.transfer-header-grid {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

#transferItemEntry {
    padding: 16px;
    border: 1px solid var(--orange-border);
    border-radius: 14px;
    background: #fffaf5;
}

#transferItemEntry .section-title p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 10px;
}

/* Barcode / product-search inputs */
.transfer-barcode-grid > label {
    position: relative;
    display: grid;
    gap: 6px;
}

.transfer-barcode-actions,
.transfer-barcode-grid .barcode-actions {
    display: flex;
    align-items: stretch;
    gap: 8px;
    min-width: 0;
}

.transfer-barcode-actions input,
.transfer-barcode-grid .barcode-actions input {
    flex: 1 1 auto;
    min-width: 0;
}

.transfer-barcode-actions .btn-secondary,
.transfer-barcode-grid .barcode-actions .btn-secondary {
    min-height: 42px;
    flex: 0 0 auto;
}

/*
 * Product results are anchored to the product-search label rather than the
 * modal/page, preventing the dropdown from floating in the wrong position.
 */
.transfer-barcode-grid .product-search-results {
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1250;
}

/* Quantity input in the transfer item table. */
#transferItemRows .table-input {
    width: 92px;
    min-width: 82px;
    min-height: 36px;
    padding: 6px 8px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Table secondary text / store labels. */
#transferRows td small,
#transferItemRows td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

#transferRows td strong,
#transferItemRows td strong {
    color: var(--ink);
}

/* Select2 inside both transfer modals must fill the field width. */
#newTransferModal .select2-container,
#transferEditorModal .select2-container {
    width: 100% !important;
}

/* Consistent Select2 height with the native 42px transfer controls. */
#newTransferModal .select2-container .select2-selection--single,
#transferEditorModal .select2-container .select2-selection--single {
    min-height: 42px;
}

#newTransferModal .select2-container--default .select2-selection--single .select2-selection__rendered,
#transferEditorModal .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
}

#newTransferModal .select2-container--default .select2-selection--single .select2-selection__arrow,
#transferEditorModal .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

/* Prevent action buttons from looking detached from their text fields. */
.transfer-barcode-grid .btn-secondary {
    border-radius: 10px;
}

/* Better spacing for the transfer document editor. */
#transferHeaderArea + #transferItemEntry {
    margin-top: 16px;
}

#transferEditorModal .modal-section {
    scroll-margin-top: 12px;
}

@media (max-width: 720px) {
    .transfer-barcode-actions,
    .transfer-barcode-grid .barcode-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .transfer-barcode-actions input,
    .transfer-barcode-grid .barcode-actions input {
        grid-column: 1 / -1;
        width: 100%;
    }

    .transfer-barcode-actions button,
    .transfer-barcode-grid .barcode-actions button {
        width: 100%;
    }

    #transferItemRows .table-input {
        width: 78px;
        min-width: 72px;
    }
}


/* Phase 7 partial transfer receiving */
[hidden] {
    display: none !important;
}

.transfer-receipt-history {
    display: grid;
    gap: 9px;
}

.transfer-receipt-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}

.transfer-receipt-card strong,
.transfer-receipt-card span,
.transfer-receipt-card small {
    display: block;
}

.transfer-receipt-card span,
.transfer-receipt-card small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
}

.transfer-receipt-meta {
    text-align: right;
}

.transfer-receive-table .transfer-receive-qty {
    width: 92px;
    min-width: 82px;
    min-height: 36px;
    padding: 6px 8px;
    text-align: right;
}

.transfer-receipt-remarks {
    display: grid;
    gap: 7px;
    margin-top: 16px;
}

.transfer-receipt-remarks > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

#transferReceiveModal textarea,
#transferReceiveModal input:not([type="hidden"]) {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

#transferReceiveModal input:focus,
#transferReceiveModal textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

#transferShortageReason {
    min-height: 92px;
    resize: vertical;
}

@media (max-width: 650px) {
    .transfer-receipt-card {
        grid-template-columns: 1fr;
    }

    .transfer-receipt-meta {
        text-align: left;
    }

    .transfer-receive-table .transfer-receive-qty {
        width: 76px;
        min-width: 70px;
    }
}


/* Keyboard / Select2 interaction hotfix */
input:not([disabled]),
textarea:not([disabled]),
[contenteditable="true"],
.select2-search__field {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.select2-search__field {
    pointer-events: auto !important;
    touch-action: auto !important;
    cursor: text !important;
    caret-color: auto;
}

/*
 * Select2 filters must remain interactive above surrounding filter panels
 * and modal content. Search fields are intentionally normal text inputs so
 * Ctrl/Cmd+C/V/X/A/Z and browser-native editing shortcuts remain untouched.
 */
.select2-container,
.select2-container--open,
.select2-dropdown,
.select2-search,
.select2-search__field {
    pointer-events: auto;
}

.inventory-filter-grid .select2-container {
    width: 100% !important;
}

.inventory-filter-grid .select2-dropdown {
    z-index: 1500;
}


/* Phase 8: Sales / POS */
.sales-filter-grid {
    grid-template-columns: minmax(300px, 1.4fr) minmax(180px, .7fr) minmax(150px, .55fr) 100px;
}

.sales-new-grid,
.sales-header-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

#newSaleModal input:not([type="hidden"]),
#newSaleModal select,
#saleEditorModal input:not([type="hidden"]),
#saleEditorModal select,
#saleEditorModal textarea {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

#newSaleModal input:focus,
#newSaleModal select:focus,
#saleEditorModal input:focus,
#saleEditorModal select:focus,
#saleEditorModal textarea:focus {
    border-color: var(--orange) !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.12) !important;
}

.sales-header-grid {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

#saleItemEntry {
    padding: 16px;
    border: 1px solid var(--orange-border);
    border-radius: 14px;
    background: #fffaf5;
}

.sales-barcode-grid {
    display: grid;
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
    gap: 14px;
}

.sales-barcode-grid > label {
    position: relative;
    display: grid;
    gap: 6px;
    min-width: 0;
}

.sales-barcode-grid > label > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.sales-barcode-actions {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.sales-barcode-actions input {
    flex: 1 1 auto;
}

.sales-barcode-actions button {
    flex: 0 0 auto;
    min-height: 42px;
}

.sales-barcode-grid .product-search-results {
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1450;
}

#saleItemRows .table-input {
    width: 84px;
    min-width: 76px;
    min-height: 36px;
    padding: 6px 8px;
    text-align: right;
}

#salesRows td small,
#saleItemRows td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

.sales-totals {
    width: min(100%, 430px);
    margin: 16px 0 0 auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.sales-total-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 0;
    color: var(--muted);
}

.sales-total-row strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.sales-total-row.grand {
    margin-top: 5px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: 14px;
    font-weight: 900;
}

.sales-total-row.grand strong {
    color: var(--orange-dark);
    font-size: 20px;
}

.sales-final-note {
    margin-top: 14px;
}

.sales-editor-footer {
    justify-content: space-between;
}

.sales-footer-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

#saleCameraVideo {
    display: block;
    width: 100%;
    min-height: 320px;
    max-height: 60vh;
    object-fit: cover;
}

#newSaleModal .select2-container,
#saleEditorModal .select2-container {
    width: 100% !important;
}

@media (max-width: 900px) {
    .sales-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sales-barcode-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .sales-filter-grid,
    .sales-new-grid,
    .sales-header-grid {
        grid-template-columns: 1fr !important;
    }

    .sales-barcode-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sales-barcode-actions input {
        grid-column: 1 / -1;
    }

    .sales-barcode-actions button {
        width: 100%;
    }

    .sales-totals {
        width: 100%;
    }

    .sales-editor-footer,
    .sales-footer-actions {
        width: 100%;
    }

    .sales-footer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .sales-footer-actions > button {
        width: 100%;
    }

    #completeSaleBtn {
        grid-column: 1 / -1;
    }

    #saleCameraVideo {
        min-height: 260px;
    }
}


/* Phase 9: Reports */
.reports-page-actions {
    align-items: flex-start;
}

.reports-export-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.reports-filter-grid {
    grid-template-columns: 150px 150px minmax(220px, .9fr) minmax(330px, 1.2fr);
    align-items: end;
}

.reports-range-presets {
    display: grid;
    gap: 7px;
}

.reports-range-presets > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.reports-preset-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.reports-summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin-bottom: 18px;
}

.reports-chart-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 18px;
}

.report-chart-panel {
    min-width: 0;
}

.report-chart-wrap {
    position: relative;
    min-height: 320px;
    padding: 8px 4px 2px;
}

.report-section {
    margin-top: 18px;
}

#reportProductRows td small,
#reportSalesRows td small,
#reportInventoryRows td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

.reports-inventory-toolbar {
    align-items: end;
    gap: 12px;
}

.reports-inventory-filters {
    display: grid;
    grid-template-columns: minmax(240px, 1fr) minmax(180px, .7fr);
    gap: 8px;
    width: min(100%, 620px);
}

.reports-inventory-filters input,
.reports-inventory-filters select {
    width: 100%;
}

.report-inventory-summary {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    margin: 10px 0 16px;
}

.reports-filter-panel input[type="date"],
.reports-inventory-filters input {
    min-height: 42px;
}

@media (max-width: 1050px) {
    .reports-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .reports-chart-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .reports-page-actions,
    .reports-export-group {
        width: 100%;
    }

    .reports-export-group {
        display: grid;
        grid-template-columns: 1fr;
    }

    .reports-export-group > button {
        width: 100%;
    }

    .reports-filter-grid {
        grid-template-columns: 1fr !important;
    }

    .reports-preset-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .reports-preset-buttons > button {
        width: 100%;
    }

    .reports-inventory-toolbar {
        align-items: stretch;
    }

    .reports-inventory-filters {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .report-chart-wrap {
        min-height: 260px;
    }
}


/* Phase 10: Sale Returns */
.returns-filter-grid {
    grid-template-columns:
        minmax(320px, 1.35fr)
        minmax(190px, .7fr)
        minmax(150px, .55fr)
        100px;
}

.return-create-grid {
    grid-template-columns: 1fr;
}

.return-sale-select-label {
    min-width: 0;
}

#newReturnModal textarea,
#returnEditorModal textarea,
#returnEditorModal input:not([type="hidden"]) {
    width: 100%;
    min-width: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

#newReturnModal textarea:focus,
#returnEditorModal textarea:focus,
#returnEditorModal input:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.12);
}

#newReturnModal .select2-container {
    width: 100% !important;
}

#newReturnModal .select2-container .select2-selection--single {
    min-height: 42px;
}

.return-header-card {
    display: grid;
    gap: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.return-header-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.return-header-meta > div {
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.return-header-meta span,
.return-reason-field > span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.return-header-meta strong {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.return-reason-field {
    display: grid;
    gap: 6px;
}

.return-final-note {
    margin-top: 14px;
}

#returnSourceRows td small,
#returnItemRows td small,
#returnRows td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

#returnSourceRows .table-input {
    width: 84px;
    min-width: 76px;
    min-height: 36px;
    padding: 6px 8px;
    text-align: right;
}

.return-totals {
    width: min(100%, 420px);
    margin: 16px 0 0 auto;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.return-total-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 7px 0;
    color: var(--muted);
}

.return-total-row strong {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.return-total-row.grand {
    margin-top: 5px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-weight: 900;
}

.return-total-row.grand strong {
    color: var(--orange-dark);
    font-size: 19px;
}

.return-editor-footer {
    justify-content: space-between;
}

.return-footer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

@media (max-width: 950px) {
    .returns-filter-grid {
        grid-template-columns: 1fr 1fr;
    }

    .return-header-meta {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 650px) {
    .returns-filter-grid,
    .return-header-meta {
        grid-template-columns: 1fr !important;
    }

    .return-editor-footer,
    .return-footer-actions {
        width: 100%;
    }

    .return-footer-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .return-footer-actions > button {
        width: 100%;
    }

    #completeReturnBtn {
        grid-column: 1 / -1;
    }
}


/* Phase 11: Promotions + POS automatic discounts */
.promotion-filter-grid {
    grid-template-columns: minmax(360px, 1.4fr) minmax(170px, .55fr) 100px;
}

.promotion-form-grid {
    grid-template-columns: 1.4fr .55fr 1fr 1fr;
}

.promotion-scope-grid {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1.35fr);
    margin-top: 15px;
}

.promotion-scope-grid label {
    min-width: 0;
}

.promotion-scope-grid small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
}

.promotion-toggle-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}

.toggle-check {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.toggle-check input {
    width: 18px !important;
    min-height: 18px !important;
    height: 18px;
    margin: 0;
    accent-color: var(--orange);
}

.toggle-check > span {
    margin: 0 !important;
    color: var(--ink) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

#promotionModal input:not([type="hidden"]),
#promotionModal select,
#promotionModal textarea {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

#promotionModal input:focus,
#promotionModal select:focus,
#promotionModal textarea:focus {
    border-color: var(--orange) !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.12) !important;
}

#promotionModal .select2-container {
    width: 100% !important;
}

#promotionModal .select2-container--default .select2-selection--multiple {
    min-height: 42px;
    padding: 3px 5px;
}

.promotion-modal-footer {
    justify-content: space-between;
}

.status-badge.scheduled {
    color: #1d4ed8;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}

.status-badge.expired {
    color: #854d0e;
    background: #fefce8;
    border: 1px solid #fde68a;
}

.promotion-discount {
    color: #15803d;
    font-weight: 800;
    white-space: nowrap;
}

.promotion-live-price {
    color: #15803d;
    font-weight: 800;
}

.promotion-live-price s {
    margin-right: 4px;
    color: var(--muted);
    font-weight: 600;
}

@media (max-width: 1100px) {
    .promotion-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 850px) {
    .promotion-scope-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 650px) {
    .promotion-filter-grid,
    .promotion-form-grid {
        grid-template-columns: 1fr !important;
    }

    .promotion-toggle-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .promotion-modal-footer {
        gap: 8px;
    }

    .promotion-modal-footer > div,
    .promotion-modal-footer .footer-actions {
        width: 100%;
    }
}


/* Phase 12: Audit / Activity & Exception Monitoring */
.audit-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 5px;
    width: fit-content;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.audit-tab {
    min-height: 40px;
    padding: 8px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.audit-tab.active {
    background: var(--orange);
    color: #fff;
}

.audit-tab-panel[hidden] {
    display: none !important;
}

.audit-exception-stats,
.audit-activity-stats {
    margin-bottom: 18px;
}

.audit-exception-filters {
    grid-template-columns:
        minmax(320px, 1.3fr)
        minmax(190px, .65fr)
        minmax(150px, .5fr)
        minmax(220px, .7fr);
}

.audit-activity-filters {
    grid-template-columns:
        minmax(300px, 1.2fr)
        minmax(210px, .75fr)
        minmax(150px, .45fr)
        minmax(200px, .7fr)
        145px
        145px
        100px;
}

.exception-badge,
.operation-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 74px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.exception-badge.critical {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.exception-badge.warning {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fed7aa;
}

.exception-badge.info {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.operation-badge.create {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.operation-badge.update {
    color: #9a3412;
    background: #fff7ed;
    border-color: #fed7aa;
}

.operation-badge.delete {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

.operation-badge.select {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.exception-row td {
    vertical-align: top;
}

.exception-row.critical {
    background: #fffafa;
}

.exception-row.warning {
    background: #fffdf8;
}

#exceptionRows td small,
#activityRows td small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
    white-space: normal;
}

.activity-description {
    min-width: 280px;
    max-width: 520px;
    white-space: normal;
    word-break: break-word;
}

@media (max-width: 1200px) {
    .audit-activity-filters {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 900px) {
    .audit-exception-filters {
        grid-template-columns: 1fr 1fr;
    }

    .audit-activity-filters {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 650px) {
    .audit-tabs {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .audit-tab {
        width: 100%;
    }

    .audit-exception-filters,
    .audit-activity-filters {
        grid-template-columns: 1fr !important;
    }

    .activity-description {
        min-width: 220px;
    }
}


/* ============================================================
   Global modal overflow / large-data resilience hotfix
   ============================================================
   Some create/edit modals wrap .modal-body + .modal-footer inside a <form>.
   Without a constrained flex form, a long body can grow past the card while
   .modal-card overflow:hidden clips the data/footer.  Apply the same layout
   contract to both direct-body and form-wrapped modals.
*/

/* Every modal is a bounded flex column. */
.modal-card {
    min-width: 0;
    min-height: 0;
}

/*
 * Forms that directly wrap modal body/footer must become the modal's
 * scroll-layout container. This fixes:
 * Stores, Users, Receiving create, Adjustments create, Transfers create,
 * Sales create, Sale Returns create, and Promotions.
 */
.modal-card > form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

/* Header/footer never get pushed outside the visible modal. */
.modal-card > .modal-header,
.modal-card > .modal-footer,
.modal-card > form > .modal-footer {
    flex: 0 0 auto;
    min-width: 0;
}

/* The data area is the only vertical scrolling region. */
.modal-card > .modal-body,
.modal-card > form > .modal-body {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/*
 * Long tables remain inside the body. Horizontal overflow belongs to the
 * table wrapper instead of expanding/clipping the entire modal.
 */
.modal-body .table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.modal-body .data-table {
    width: max-content;
    min-width: 100%;
    max-width: none;
}

/* Allow long text values to wrap instead of forcing modal width. */
.modal-body .data-table td,
.modal-body .data-table th {
    overflow-wrap: anywhere;
}

.modal-body .data-table td > strong,
.modal-body .data-table td > small,
.modal-body .data-table td > span,
.modal-body .data-table td > a,
.modal-body .data-table td > button {
    max-width: 100%;
}

/*
 * Keep ordinary detail/form grids from overflowing because of a long code,
 * customer name, address, reason, username, description, etc.
 */
.modal-body .form-grid,
.modal-body .detail-grid,
.modal-body .modal-section,
.modal-body .section-title,
.modal-body [class$="-grid"],
.modal-body [class$="-card"],
.modal-body label,
.modal-body label > *,
.modal-body .select2-container {
    min-width: 0;
    max-width: 100%;
}

.modal-body input,
.modal-body textarea,
.modal-body select {
    max-width: 100%;
}

.modal-body textarea {
    resize: vertical;
}

/* Header/subtitle text may wrap while the close button stays reachable. */
.modal-header > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.modal-header h3,
.modal-header .modal-subtitle,
.modal-header p {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/*
 * Large multi-selects (notably Promotions) may contain many selected values.
 * Keep their selection area bounded and internally scrollable.
 */
.modal-card .select2-container--default
.select2-selection--multiple {
    max-height: 130px;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-card .select2-container--default
.select2-selection--multiple
.select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    max-width: 100%;
    padding-bottom: 3px;
}

.modal-card .select2-selection__choice {
    max-width: calc(100% - 8px);
}

.modal-card .select2-selection__choice__display {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
}

/*
 * Select2 result lists with large datasets get their own predictable scroll
 * area rather than extending beyond the viewport.
 */
.modal-card .select2-results__options {
    max-height: min(42vh, 360px) !important;
    overflow-y: auto !important;
}

/*
 * Desktop/tablet: use more of the viewport while still preserving breathing
 * room. This helps high-data editor modals without making small forms huge.
 */
@media (min-width: 651px) {
    .modal-card {
        max-height: min(92vh, 960px);
    }

    .modal-card.modal-large,
    .modal-card.modal-xl {
        max-height: min(94vh, 1000px);
    }

    .modal-body {
        scrollbar-gutter: stable both-edges;
    }
}

/*
 * Mobile already uses full-screen modal sheets. Explicitly keep form-wrapped
 * modals at full available height and make only their body scroll.
 */
@media (max-width: 650px) {
    .modal-card > form {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: 100% !important;
        overflow: hidden !important;
    }

    .modal-card > form > .modal-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    .modal-card > form > .modal-footer {
        flex: 0 0 auto !important;
    }

    .modal-body .data-table {
        width: max-content;
        min-width: 620px;
    }

    .modal-card .select2-container--default
    .select2-selection--multiple {
        max-height: 105px;
    }

    .modal-card .select2-results__options {
        max-height: min(38vh, 300px) !important;
    }
}


/* Phase 13: Advanced operational dashboard */
.dashboard-page-actions {
    align-items: flex-start;
}

.dashboard-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin: 24px 0 12px;
}

.dashboard-section-heading h3 {
    margin: 3px 0 0;
    font-size: 18px;
}

.executive-kpis .stat-card,
.inventory-health-kpis .stat-card {
    min-height: 108px;
}

.executive-kpis .stat-card small,
.inventory-health-kpis .stat-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
}

.dashboard-kpi-charts {
    margin-top: 18px;
}

.dashboard-sales-chart {
    min-height: 320px;
}

.pending-operation-list {
    display: grid;
    gap: 8px;
}

.pending-operation-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    transition:
        border-color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.pending-operation-list a:hover {
    border-color: rgba(249,115,22,.45);
    background: #fffaf5;
    transform: translateY(-1px);
}

.pending-operation-list span {
    font-size: 11px;
    font-weight: 750;
}

.pending-operation-list strong {
    min-width: 30px;
    color: var(--orange);
    font-size: 18px;
    text-align: right;
}

.dashboard-top-products td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

@media (max-width: 750px) {
    .dashboard-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-sales-chart {
        min-height: 280px;
    }
}


/* Phase 14: Procurement / Suppliers / Replenishment */
.procurement-tabs {
    display:flex;
    gap:8px;
    width:fit-content;
    max-width:100%;
    margin:0 0 16px;
    padding:5px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fff;
}
.procurement-tab {
    min-height:40px;
    padding:8px 14px;
    border:0;
    border-radius:9px;
    background:transparent;
    color:var(--muted);
    font:inherit;
    font-weight:800;
    cursor:pointer;
}
.procurement-tab.active {
    background:var(--orange);
    color:#fff;
}
#procOrdersPanel[hidden],
#procReplenishmentPanel[hidden] {
    display:none !important;
}
.procurement-item-entry {
    grid-template-columns:minmax(260px,2fr) 100px 140px auto;
    align-items:end;
}
.inline-editor-panel {
    margin:14px 0;
    padding:14px;
    border:1px solid var(--line);
    border-radius:12px;
    background:#fffaf5;
}
.inline-editor-panel[hidden] {
    display:none !important;
}
.inline-actions {
    display:flex;
    justify-content:flex-end;
    gap:8px;
    margin-top:12px;
}
.workflow-actions {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-right:auto;
}
.linked-doc-list {
    display:grid;
    gap:8px;
}
.linked-doc-row {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:10px 12px;
    border:1px solid var(--line);
    border-radius:9px;
    color:var(--ink);
    text-decoration:none;
    background:#fff;
}
.linked-doc-row:hover {
    border-color:rgba(249,115,22,.45);
    background:#fffaf5;
}
.linked-doc-row span {
    color:var(--muted);
    font-size:10px;
}
.table-input {
    width:90px;
    min-width:80px;
    padding:6px 7px;
}
.status-badge.draft {
    background:#f8fafc;
    color:#475569;
    border-color:#cbd5e1;
}
.status-badge.approved {
    background:#fff7ed;
    color:#9a3412;
    border-color:#fed7aa;
}
.status-badge.partially_received {
    background:#fffbeb;
    color:#92400e;
    border-color:#fde68a;
}
@media (max-width:900px) {
    .procurement-item-entry {
        grid-template-columns:1fr 1fr;
    }
    .procurement-item-entry .span-2 {
        grid-column:1 / -1;
    }
}
@media (max-width:650px) {
    .procurement-tabs {
        display:grid;
        width:100%;
        grid-template-columns:1fr;
    }
    .procurement-tab {
        width:100%;
    }
    .procurement-item-entry {
        grid-template-columns:1fr;
    }
    .procurement-item-entry .span-2 {
        grid-column:auto;
    }
    .linked-doc-row {
        align-items:flex-start;
        flex-direction:column;
    }
}


/* Phase 14 R2: procurement setup / New PO robustness */
#procurementSetupAlert[hidden] {
    display: none !important;
}

#procurementSetupAlert a {
    font-weight: 850;
}

#poCreateModal .modal-footer .text-link {
    margin-right: auto;
}

#newPurchaseOrder:disabled {
    cursor: wait;
    opacity: .65;
}

@media (max-width: 650px) {
    #poCreateModal .modal-footer .text-link {
        width: 100%;
        margin: 0 0 6px;
        text-align: center;
    }
}


/* Phase 14 R5: modal visibility compatibility.
   Standard behavior uses .open; hidden=false is also supported as a fallback. */


/* ================================================================
   Phase 14 R6 — Complete UI style normalization
   Applies a consistent COLEROSH visual contract to old and new UI.
   ================================================================ */

/* ---------- Global interactive-element normalization ---------- */
button,
input,
select,
textarea {
    font: inherit;
}

button {
    -webkit-appearance: none;
    appearance: none;
}

input,
select,
textarea {
    accent-color: var(--orange);
}

textarea {
    line-height: 1.5;
    resize: vertical;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(249, 115, 22, .18);
    outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
}

/* ---------- Complete button family ---------- */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-table {
    transition:
        border-color .16s ease,
        background-color .16s ease,
        color .16s ease,
        box-shadow .16s ease,
        transform .16s ease,
        opacity .16s ease;
}

.btn-primary:hover:not(:disabled),
.btn-secondary:hover:not(:disabled),
.btn-danger:hover:not(:disabled),
.btn-table:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled),
.btn-secondary:active:not(:disabled),
.btn-danger:active:not(:disabled),
.btn-table:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-danger {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.btn-danger:hover:not(:disabled) {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #991b1b;
}

.btn-danger:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.btn-table.danger,
.btn-table.danger-table {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.btn-table.danger:hover,
.btn-table.danger-table:hover {
    border-color: #fca5a5;
    background: #fee2e2;
    color: #991b1b;
}

/* ---------- Generic modal form styling ----------
   Handles fields placed outside .form-grid as well as future fields. */
.modal-body form {
    min-width: 0;
}

.modal-body form > label:not(.check-field),
.inline-editor-panel > label:not(.check-field),
.modal-section > label:not(.check-field) {
    display: grid;
    gap: 6px;
    margin-top: 13px;
    min-width: 0;
}

.modal-body form > label:not(.check-field) > span,
.inline-editor-panel > label:not(.check-field) > span,
.modal-section > label:not(.check-field) > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.modal-body form > label:not(.check-field) > input,
.modal-body form > label:not(.check-field) > select,
.modal-body form > label:not(.check-field) > textarea,
.inline-editor-panel > label:not(.check-field) > input,
.inline-editor-panel > label:not(.check-field) > select,
.inline-editor-panel > label:not(.check-field) > textarea,
.modal-section > label:not(.check-field) > input,
.modal-section > label:not(.check-field) > select,
.modal-section > label:not(.check-field) > textarea {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    outline: none;
}

.modal-body form > label:not(.check-field) > textarea,
.inline-editor-panel > label:not(.check-field) > textarea,
.modal-section > label:not(.check-field) > textarea {
    min-height: 78px;
}

.modal-body form > label:not(.check-field) > input:focus,
.modal-body form > label:not(.check-field) > select:focus,
.modal-body form > label:not(.check-field) > textarea:focus,
.inline-editor-panel > label:not(.check-field) > input:focus,
.inline-editor-panel > label:not(.check-field) > select:focus,
.inline-editor-panel > label:not(.check-field) > textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

/* ---------- Form-grid utility coverage ---------- */
.form-grid.two-col,
.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .span-2,
.form-grid > .span-2 {
    grid-column: span 2;
}

/* Checkbox/radio fields must not inherit full-size text-input rules. */
.check-field,
.form-grid .check-field {
    display: flex !important;
    align-items: center;
    align-self: end;
    gap: 9px;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.check-field:hover {
    border-color: var(--orange-border);
    background: var(--orange-soft);
}

.check-field input[type="checkbox"],
.check-field input[type="radio"],
.form-grid .check-field input[type="checkbox"],
.form-grid .check-field input[type="radio"] {
    flex: 0 0 auto;
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    min-height: 17px !important;
    margin: 0;
    padding: 0;
    box-shadow: none !important;
}

.check-field > span,
.form-grid .check-field > span {
    display: inline !important;
    margin: 0 !important;
    color: var(--ink) !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
}

/* ---------- Modal size utilities ---------- */
.modal-card.modal-small,
.modal-small {
    width: min(500px, 100%);
}

.modal-card.modal-large,
.modal-card.modal-xl,
.modal-card.modal-small {
    min-width: 0;
}

/* ---------- Panel / dashboard utility coverage ---------- */
.panel-wide {
    min-width: 0;
    overflow: hidden;
}

.dashboard-grid.second-row {
    align-items: start;
}

.second-row > * {
    min-width: 0;
}

/* ---------- Table utility coverage ---------- */
.product-table,
.inventory-table {
    width: 100%;
    table-layout: auto;
}

.product-table td,
.inventory-table td {
    min-width: 0;
}

.data-table tbody tr {
    transition: background-color .14s ease;
}

.data-table tbody tr:hover {
    background: #fcfdff;
}

.data-table td,
.data-table th {
    max-width: 420px;
}

.data-table td {
    overflow-wrap: anywhere;
}

.data-table .num {
    white-space: nowrap;
}

.table-input,
.reorder-input {
    max-width: 110px;
}

/* ---------- Report preset coverage ---------- */
.report-preset {
    white-space: nowrap;
}

.report-preset:hover {
    border-color: var(--orange-border);
    color: var(--orange-dark);
    background: var(--orange-soft);
}

/* ---------- Phase 14 list/filter layouts ---------- */
.supplier-filter-grid,
.procurement-filter-grid {
    grid-template-columns:
        minmax(300px, 1.7fr)
        minmax(170px, .55fr)
        100px;
}

.replenishment-filter-grid {
    grid-template-columns:
        minmax(220px, .65fr)
        minmax(320px, 1.35fr);
}

.procurement-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

/* ---------- Supplier module polish ---------- */
#supplierForm {
    min-width: 0;
}

#supplierForm .form-grid {
    margin-bottom: 0;
}

#supplierForm > label:first-of-type {
    margin-top: 13px;
}

#supplierProductsPanel {
    padding-top: 4px;
}

#supplierProductsPanel > h4,
#poAddItemPanel > h4,
.modal-section > h4 {
    margin: 0 0 10px;
    color: var(--ink);
    font-size: 13px;
}

#supplierProductRows .btn-table,
#poItemRows .btn-table {
    white-space: nowrap;
}

#supplierSetupAlert {
    box-shadow: 0 7px 20px rgba(146, 64, 14, .05);
}

/* ---------- Procurement module polish ---------- */
#procurementSetupAlert {
    box-shadow: 0 7px 20px rgba(146, 64, 14, .05);
}

#poSummary {
    color: var(--text);
    font-size: 10px;
    font-weight: 700;
}

.procurement-item-entry > .btn-secondary,
.procurement-item-entry > .btn-primary {
    min-height: 42px;
    align-self: end;
}

.inline-editor-panel {
    box-shadow: inset 0 0 0 1px rgba(249,115,22,.02);
}

.linked-doc-row strong {
    color: var(--ink);
    font-size: 11px;
}

.workflow-actions .btn-primary,
.workflow-actions .btn-secondary,
.workflow-actions .btn-danger {
    min-height: 36px;
}

/* ---------- Select2 fallback/consistency inside forms ---------- */
.form-grid .select2-container,
.filter-grid .select2-container,
.modal-body .select2-container {
    width: 100% !important;
    min-width: 0;
}

.check-field + .select2-container {
    min-width: 0;
}

/* ---------- Empty and message states ---------- */
.empty-card {
    min-height: 68px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: #fbfcfe;
}

.alert strong {
    font-weight: 850;
}

/* ---------- Responsive normalization ---------- */
@media (max-width: 1050px) {
    .supplier-filter-grid,
    .procurement-filter-grid {
        grid-template-columns: minmax(240px, 1fr) minmax(150px, .55fr) 100px;
    }

    .procurement-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .supplier-filter-grid,
    .procurement-filter-grid,
    .replenishment-filter-grid,
    .form-grid.two-col,
    .two-col {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2,
    .form-grid > .span-2 {
        grid-column: auto;
    }

    .check-field,
    .form-grid .check-field {
        align-self: stretch;
    }
}

@media (max-width: 520px) {
    .procurement-stats {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-wrap: wrap;
    }

    .modal-footer > .btn-primary,
    .modal-footer > .btn-secondary,
    .modal-footer > .btn-danger {
        min-height: 40px;
    }

    .workflow-actions {
        width: 100%;
        margin-right: 0;
    }
}


/* ================================================================
   Phase 14 R7 — Strict modal visibility contract
   ================================================================
   Existing COLEROSH modals are present in page markup but must remain
   invisible until their module JavaScript adds the .open class.
*/
.modal-backdrop {
    display: none;
    pointer-events: none;
}

.modal-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
}

.modal-backdrop.open {
    display: flex;
    pointer-events: auto;
}


/* ================================================================
   Phase 14 R8 — Semantic form/control styling audit
   ================================================================
   A modal label is a visual field regardless of whether the form is:
     .modal-body > form > label
   or:
     form > .modal-body > label
   or:
     .modal-body > label

   This prevents browser-default controls when markup hierarchy changes.
*/

/* ----- Universal labelled modal field ----- */
.modal-card label:not(.check-field):not(.toggle-check) {
    min-width: 0;
}

.modal-card label:not(.check-field):not(.toggle-check) > span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.modal-card label:not(.check-field):not(.toggle-check) >
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
.modal-card label:not(.check-field):not(.toggle-check) > select,
.modal-card label:not(.check-field):not(.toggle-check) > textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 42px;
    margin: 0;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.35;
    outline: none;
    box-shadow: none;
}

.modal-card label:not(.check-field):not(.toggle-check) > textarea {
    min-height: 86px;
    padding-top: 10px;
    padding-bottom: 10px;
    resize: vertical;
}

.modal-card label:not(.check-field):not(.toggle-check) >
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):hover:not(:disabled),
.modal-card label:not(.check-field):not(.toggle-check) > select:hover:not(:disabled),
.modal-card label:not(.check-field):not(.toggle-check) > textarea:hover:not(:disabled) {
    border-color: #cbd5e1;
}

.modal-card label:not(.check-field):not(.toggle-check) >
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):focus,
.modal-card label:not(.check-field):not(.toggle-check) > select:focus,
.modal-card label:not(.check-field):not(.toggle-check) > textarea:focus {
    border-color: var(--orange) !important;
    box-shadow: 0 0 0 3px rgba(249,115,22,.10) !important;
}

.modal-card label:not(.check-field):not(.toggle-check) >
input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):disabled,
.modal-card label:not(.check-field):not(.toggle-check) > select:disabled,
.modal-card label:not(.check-field):not(.toggle-check) > textarea:disabled {
    border-color: var(--line);
    background: #f8fafc;
    color: #64748b;
}

/*
 * Standalone fields must stack label over control.
 * This directly fixes PO Remarks and Cancel Reason from the screenshots.
 */
.modal-field-full,
.modal-card > form > .modal-body > label:not(.check-field):not(.toggle-check),
.modal-card > .modal-body > label:not(.check-field):not(.toggle-check),
.modal-body > form > label:not(.check-field):not(.toggle-check),
.inline-editor-panel > label:not(.check-field):not(.toggle-check) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
    width: 100%;
    max-width: 100%;
}

.modal-field-full,
.modal-card > form > .modal-body > label:not(.check-field):not(.toggle-check),
.modal-body > form > label:not(.check-field):not(.toggle-check),
.inline-editor-panel > label:not(.check-field):not(.toggle-check) {
    margin-top: 14px;
}

/* Fields inside a grid do not need added vertical margins. */
.form-grid > label {
    margin-top: 0 !important;
}

/* ----- Complete form-grid control contract, including textarea ----- */
.form-grid textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 86px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.4;
    outline: none;
    resize: vertical;
}

.form-grid textarea:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249,115,22,.10);
}

.form-grid textarea:disabled {
    background: #f8fafc;
    color: #64748b;
}

/* ----- Screenshot-specific procurement polish ----- */
#poCreateModal .modal-body,
#poCancelModal .modal-body {
    background: #fff;
}

#poCreateModal .modal-field-full textarea {
    min-height: 92px;
}

#poCancelModal .modal-field-full {
    margin-top: 0;
}

#poCancelModal .modal-field-full textarea {
    min-height: 120px;
}

#poCreateModal .modal-footer,
#poCancelModal .modal-footer {
    align-items: center;
}

#poCreateModal .modal-footer .btn-primary,
#poCreateModal .modal-footer .btn-secondary,
#poCancelModal .modal-footer .btn-danger,
#poCancelModal .modal-footer .btn-secondary {
    min-height: 42px;
    padding-left: 16px;
    padding-right: 16px;
}

#poCreateModal .modal-footer .text-link {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 7px;
    border-radius: 8px;
    text-decoration: none;
}

#poCreateModal .modal-footer .text-link:hover {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

/* ----- Supplier standalone fields ----- */
#supplierForm > .modal-field-full textarea {
    min-height: 82px;
}

/* ----- Consistent required-field / helper appearance ----- */
.modal-card label > small,
.modal-card .field-help {
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}

/* ----- Footer action consistency across every modal ----- */
.modal-footer .btn-primary,
.modal-footer .btn-secondary,
.modal-footer .btn-danger {
    min-height: 40px;
}

.modal-footer .text-link {
    line-height: 1.25;
}

/* ----- Native date/select visual consistency ----- */
.modal-card input[type="date"],
.modal-card input[type="datetime-local"],
.modal-card select {
    color-scheme: light;
}

/* ----- Mobile field behavior ----- */
@media (max-width: 650px) {
    .modal-field-full,
    .modal-card > form > .modal-body > label:not(.check-field):not(.toggle-check),
    .modal-card > .modal-body > label:not(.check-field):not(.toggle-check),
    .modal-body > form > label:not(.check-field):not(.toggle-check),
    .inline-editor-panel > label:not(.check-field):not(.toggle-check) {
        width: 100%;
    }

    #poCreateModal .modal-footer .text-link {
        width: 100%;
        justify-content: center;
        margin: 0 0 4px;
    }

    #poCancelModal .modal-field-full textarea {
        min-height: 110px;
    }
}


/* ================================================================
   Phase 15 R2 — Cross-device responsive navigation
   ================================================================ */
.sidebar-overlay {
    display: none;
    visibility: hidden;
    position: fixed;
    inset: 0;
    z-index: 40;
    border: 0;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, .44);
    opacity: 0;
    pointer-events: none;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
    transition: opacity .18s ease, visibility .18s ease;
}

body.sidebar-open {
    /* Keep layout viewport stable while drawer is open. */
    overscroll-behavior: contain;
}

@media (max-width: 1366px),
       (max-width: 1600px) and (hover: none) and (pointer: coarse) {
    .sidebar {
        transform: translate3d(-102%, 0, 0);
        transition: transform .22s ease;
        box-shadow: 20px 0 40px rgba(15,23,42,.16);
        z-index: 42;
        will-change: transform;
        backface-visibility: hidden;
    }

    .sidebar.open {
        transform: translate3d(0, 0, 0);
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.show {
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        width: 100%;
        margin-left: 0;
    }

    .topbar {
        z-index: 41;
        padding-left: 18px;
        padding-right: 18px;
    }

    .menu-toggle {
        display: inline-grid !important;
        place-items: center;
        position: relative;
        z-index: 43;
        flex: 0 0 auto;
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 11px;
        background: #fff;
        color: var(--ink);
        font-size: 23px;
        line-height: 1;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        user-select: none;
    }

    .menu-toggle:hover {
        border-color: var(--orange-border);
        background: var(--orange-soft);
        color: var(--orange-dark);
    }

    .menu-toggle:active { transform: scale(.97); }
    .menu-toggle:focus-visible {
        outline: 3px solid rgba(249,115,22,.18);
        outline-offset: 2px;
    }

    .content { padding: 22px 18px 40px; }
}

@media (max-width: 700px) {
    .sidebar { width: min(86vw, 320px); }
    .topbar { height: 78px; }
    .brand {
        height: 78px;
        padding-top: 16px;
        padding-bottom: 16px;
    }
    .menu-toggle {
        width: 42px;
        height: 42px;
        min-width: 42px;
        min-height: 42px;
    }
}

@media (max-width: 420px) {
    .sidebar { width: min(90vw, 305px); }
    .topbar h1 { font-size: 17px; }
    .topbar p { font-size: 10px; }
}


/* Phase 15: Procurement Reports */
.procurement-report-filter-grid {
    grid-template-columns:
        minmax(210px, .7fr)
        minmax(250px, .9fr)
        150px
        150px
        auto;
}

.procurement-report-filter-grid > .btn-primary {
    min-height: 42px;
    align-self: end;
}

.procurement-report-kpis {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.procurement-report-kpis .stat-card small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}

.procurement-report-charts {
    margin-top: 18px;
}

#procCostRows td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

@media (max-width: 1250px) {
    .procurement-report-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .procurement-report-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .procurement-report-filter-grid > .btn-primary {
        width: fit-content;
    }
}

@media (max-width: 720px) {
    .procurement-report-kpis,
    .procurement-report-filter-grid {
        grid-template-columns: 1fr;
    }

    .procurement-report-filter-grid > .btn-primary {
        width: 100%;
    }
}


/* ================================================================
   Phase 15 R3 — deterministic hamburger safety layer
   ================================================================ */
@media (max-width: 1366px),
       (max-width: 1600px) and (hover: none) and (pointer: coarse) {
    #menuToggle.menu-toggle {
        display: inline-grid !important;
        pointer-events: auto !important;
        touch-action: manipulation;
    }

    #sidebar.sidebar {
        transform: translate3d(-102%, 0, 0) !important;
    }

    #sidebar.sidebar.open {
        transform: translate3d(0, 0, 0) !important;
    }

    #sidebarOverlay.sidebar-overlay {
        visibility: hidden;
        opacity: 0;
        pointer-events: none !important;
    }

    #sidebarOverlay.sidebar-overlay.show {
        visibility: visible;
        opacity: 1;
        pointer-events: auto !important;
    }
}

/* Phase 16 Inventory Intelligence */
.intelligence-filters{grid-template-columns:minmax(220px,.8fr) 160px minmax(260px,1fr) auto}
.intelligence-filters>.btn-primary{align-self:end;min-height:42px}
.intelligence-kpis{grid-template-columns:repeat(5,minmax(0,1fr))}
.intelligence-kpis small,.data-table td small{display:block;margin-top:4px;color:var(--muted);font-size:9px}
.intelligence-po-builder{margin:18px 0}
.intelligence-po-builder .inline-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.intelligence-po-builder .select2-container{min-width:280px}
#intelRows .table-input{width:82px;min-width:72px;text-align:right}
#intelRows input[type=checkbox],#intelSelectAll{width:18px;height:18px;accent-color:var(--orange)}
@media(max-width:1000px){.intelligence-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.intelligence-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.intelligence-kpis,.intelligence-filters{grid-template-columns:1fr}.intelligence-filters>.btn-primary{width:100%}.intelligence-po-builder .select2-container{min-width:100%!important;width:100%!important}}


/* ================================================================
   Phase 16 R2 — Utility Tools / Default Reorder Settings
   ================================================================ */
.utility-tool-card,
.utility-help-card {
    margin-bottom: 18px;
}

.utility-tool-body {
    padding-top: 4px;
}

.utility-reorder-grid {
    grid-template-columns:
        minmax(220px, 1.15fr)
        minmax(260px, 1.35fr)
        minmax(170px, .8fr)
        minmax(170px, .8fr);
}

.utility-mode-note {
    margin-top: 14px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.utility-mode-note.danger-note {
    border-color: #fecaca;
    background: #fff7f7;
    color: #991b1b;
}

.utility-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
}

.utility-preview-area {
    margin-top: 18px;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.utility-preview-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.utility-preview-summary {
    margin-top: 14px;
    padding: 14px 15px;
    border: 1px solid var(--orange-border);
    border-radius: 12px;
    background: var(--orange-soft);
}

.utility-preview-summary strong {
    display: block;
    margin-bottom: 5px;
    color: var(--ink);
}

.utility-preview-summary p {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
}

.utility-confirm {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 14px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.utility-confirm input {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    margin-top: 1px;
    accent-color: var(--orange);
}

.utility-confirm span {
    color: var(--ink);
    font-size: 12px;
    line-height: 1.5;
}

.utility-help-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.utility-help-grid > div {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.utility-help-grid strong {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
}

.utility-help-grid p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.utility-help-grid code {
    font-size: 11px;
    word-break: break-word;
}

@media (max-width: 1100px) {
    .utility-reorder-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .utility-preview-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .utility-reorder-grid,
    .utility-preview-grid,
    .utility-help-grid {
        grid-template-columns: 1fr;
    }

    .utility-actions .btn-primary,
    .utility-actions .btn-secondary {
        width: 100%;
    }
}


/* ================================================================
   Phase 16 R4 — Descriptive product search results
   ================================================================ */
.product-search-option-rich {
    min-height: 84px;
    align-items: flex-start;
    padding-top: 11px;
    padding-bottom: 11px;
}

.product-search-identity {
    min-width: 0;
    flex: 1 1 auto;
}

.product-search-option-rich strong {
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.product-search-option-rich small {
    line-height: 1.42;
    overflow-wrap: anywhere;
}

.product-search-option-rich .product-search-variant {
    color: #475569;
    font-weight: 600;
}

.product-search-option-rich > b {
    flex: 0 0 auto;
    max-width: 38%;
    padding-top: 1px;
    text-align: right;
    line-height: 1.45;
}

.product-select2-result {
    display: grid;
    gap: 2px;
    padding: 3px 1px;
    line-height: 1.35;
}

.product-select2-title {
    display: block;
    color: var(--ink);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.product-select2-line {
    display: block;
    color: var(--muted);
    font-size: 10px;
    overflow-wrap: anywhere;
}

.product-select2-variant {
    color: #475569;
    font-weight: 600;
}

.select2-results__option--highlighted .product-select2-title,
.select2-results__option--highlighted .product-select2-line {
    color: inherit;
}

.modal-card .select2-results__option:has(.product-select2-result) {
    padding-top: 8px;
    padding-bottom: 8px;
}

@media (max-width: 700px) {
    .product-search-option-rich {
        min-height: 96px;
        gap: 8px;
    }

    .product-search-option-rich > b {
        max-width: 42%;
        white-space: normal;
    }
}


/* ================================================================
   Phase 16 R5 — Mobile responsive audit + spacing/button polish
   ================================================================ */

/* ---------- Prevent page-level horizontal overflow ----------
   Tables may scroll internally on tablet, but the entire application page
   must never need a rightward page scroll. */
html,
body,
.app-shell,
.main,
.content {
    max-width: 100%;
}

html,
body {
    overflow-x: hidden;
}

.content,
.content > *,
.page-actions > *,
.panel,
.panel-heading > *,
.table-toolbar > *,
.filter-grid > *,
.form-grid > *,
.inline-actions > * {
    min-width: 0;
}

/* ---------- Consistent vertical rhythm between top-level sections ---------- */
.content > .panel,
.content > .stat-grid,
.content > .dashboard-grid,
.content > .reports-chart-grid,
.content > .procurement-report-chart-grid {
    margin-bottom: 18px;
}

.content > .page-actions {
    margin-bottom: 22px;
}

.content > .table-panel:last-child,
.content > .panel:last-child {
    margin-bottom: 0;
}

/* Consecutive table/report blocks must never visually touch. */
.content > .table-panel + .table-panel,
.content > .report-section + .report-section,
.content > .panel + .table-panel,
.content > .table-panel + .panel {
    margin-top: 18px;
}

/* ---------- Button text normalization ----------
   Anchor-buttons and long labels such as "Purchase Orders" now share the
   same centering, line-height and wrapping behavior as <button>. */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-table {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 100%;
    text-align: center;
    text-decoration: none;
    line-height: 1.25;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    min-height: 40px;
}

.page-actions > .btn-primary,
.page-actions > .btn-secondary,
.page-actions > .btn-danger,
.page-actions > .page-action-button {
    flex: 0 1 auto;
    min-width: max-content;
    padding-top: 8px;
    padding-bottom: 8px;
}

/* ---------- Table breathing room ----------
   Keep content away from panel edges and make internal scrolling obvious. */
.table-panel .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
}

.table-panel .data-table {
    margin: 0;
}

.table-panel .pagination-bar {
    margin-top: 0;
}

/* ---------- Page/header actions ---------- */
.page-actions {
    flex-wrap: wrap;
}

.page-actions > :first-child {
    flex: 1 1 auto;
}

.page-actions > :not(:first-child) {
    flex-shrink: 0;
}

/* Product barcode controls should never disappear off the right side. */
.products-actions .barcode-box {
    flex: 1 1 480px;
    width: min(560px, 100%);
    max-width: 100%;
}

.product-barcode-actions {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto auto;
    width: 100%;
    max-width: 100%;
}

.product-barcode-actions > input,
.product-barcode-actions > button {
    min-width: 0;
}

/* ---------- Generic compact tablet refinements ---------- */
@media (max-width: 1100px) {
    .content {
        padding-left: 18px;
        padding-right: 18px;
    }

    .page-actions {
        align-items: stretch;
    }

    .products-actions {
        flex-direction: column;
    }

    .products-actions .barcode-box {
        width: 100%;
    }

    .product-barcode-actions {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .panel-heading,
    .table-toolbar {
        flex-wrap: wrap;
    }

    .table-toolbar > :first-child,
    .panel-heading > :first-child {
        flex: 1 1 240px;
    }

    .table-toolbar > .btn-primary,
    .table-toolbar > .btn-secondary,
    .panel-heading > .btn-primary,
    .panel-heading > .btn-secondary {
        flex: 0 1 auto;
    }

    .workflow-actions,
    .inline-actions,
    .footer-actions {
        max-width: 100%;
    }
}

/* ---------- Phone layout ----------
   Main-page data tables become readable cards. This avoids the common
   "scroll the entire page to the right to reach actions/details" problem. */
@media (max-width: 700px) {
    .content {
        padding: 16px 12px 32px;
    }

    .page-actions {
        gap: 14px;
        margin-bottom: 16px;
    }

    .page-actions h2 {
        font-size: 20px;
        line-height: 1.2;
    }

    .page-actions p {
        font-size: 12px;
        line-height: 1.55;
    }

    .page-actions > .btn-primary,
    .page-actions > .btn-secondary,
    .page-actions > .btn-danger,
    .page-actions > .page-action-button {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }

    .product-barcode-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .product-barcode-actions > input {
        grid-column: 1 / -1;
        width: 100%;
    }

    .product-barcode-actions > .btn-primary,
    .product-barcode-actions > .btn-secondary {
        width: 100%;
    }

    .scanner-hint {
        line-height: 1.6;
    }

    .filter-panel {
        padding: 14px 12px;
    }

    .panel {
        border-radius: 13px;
    }

    .panel-heading,
    .table-toolbar {
        padding-left: 14px;
        padding-right: 14px;
    }

    .panel-heading > .btn-primary,
    .panel-heading > .btn-secondary,
    .table-toolbar > .btn-primary,
    .table-toolbar > .btn-secondary {
        width: 100%;
        flex: 1 1 100%;
    }

    .pagination-bar {
        padding: 12px;
        gap: 8px;
    }

    .pagination-bar .btn-primary,
    .pagination-bar .btn-secondary {
        flex: 1 1 0;
        min-width: 0;
        padding-left: 8px;
        padding-right: 8px;
    }

    .pagination-bar span {
        min-width: 72px;
        font-size: 10px;
    }

    /* Select2 / form controls can otherwise preserve a desktop min width. */
    .content .select2-container {
        max-width: 100% !important;
    }

    .content .inline-actions {
        width: 100%;
    }

    .content .inline-actions > .btn-primary,
    .content .inline-actions > .btn-secondary,
    .content .inline-actions > .btn-danger {
        flex: 1 1 150px;
    }

    /* Inventory Intelligence: supplier + Purchase Orders/draft actions */
    .intelligence-po-builder .inline-actions {
        align-items: stretch;
    }

    .intelligence-po-builder .inline-actions > * {
        max-width: 100%;
    }
}

@media (max-width: 420px) {
    .content {
        padding-left: 10px;
        padding-right: 10px;
    }

    .product-barcode-actions {
        grid-template-columns: 1fr;
    }

    .product-barcode-actions > input {
        grid-column: auto;
    }

    .pagination-bar {
        flex-wrap: wrap;
    }

    .pagination-bar span {
        order: -1;
        width: 100%;
        min-width: 100%;
    }

    .content > .table-panel .data-table tbody td {
        grid-template-columns: minmax(72px, .32fr) minmax(0, 1fr);
        gap: 8px;
        padding-left: 9px;
        padding-right: 9px;
    }
}


/* ================================================================
   Phase 16 R6 — Mobile spacing correction + classic table restore
   ================================================================ */

/*
 * IMPORTANT:
 * Do not use a fixed flex-basis on .page-actions children.
 * On column layouts flex-basis becomes vertical height and creates the
 * large blank spaces seen on Dashboard and Product Catalog.
 */
.page-actions > :first-child {
    flex-basis: auto;
    min-height: 0;
}

.page-actions > :not(:first-child) {
    min-height: 0;
}

/* Keep normal table presentation on every viewport. */
.content .table-panel .data-table {
    display: table;
    width: 100%;
}

.content .table-panel .data-table thead {
    display: table-header-group;
}

.content .table-panel .data-table tbody {
    display: table-row-group;
}

.content .table-panel .data-table tr {
    display: table-row;
}

.content .table-panel .data-table th,
.content .table-panel .data-table td {
    display: table-cell;
}

/*
 * Wide tables scroll INSIDE their panel.
 * The page itself should not need horizontal scrolling.
 */
.content .table-panel .table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.content .table-panel .data-table {
    min-width: 760px;
}

/* Narrower/simple tables are allowed to naturally fit when possible. */
.content .table-panel .data-table.compact-table {
    min-width: 620px;
}

/* Product Catalog barcode controls remain visible without creating tall gaps. */
.products-actions {
    row-gap: 16px;
}

.products-actions > :first-child,
.products-actions .barcode-box {
    min-height: 0;
}

@media (max-width: 1100px) {
    .products-actions {
        gap: 16px;
    }

    .products-actions > :first-child {
        flex: 0 0 auto;
        width: 100%;
    }

    .products-actions .barcode-box {
        flex: 0 0 auto;
        width: 100%;
    }

    .product-barcode-actions {
        grid-template-columns: minmax(0, 1fr) auto auto;
        align-items: stretch;
    }

    .product-barcode-actions > button {
        min-height: 42px;
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (max-width: 720px) {
    /*
     * Existing base CSS switches page-actions to column here.
     * Explicitly reset flex sizing so headings/forms remain content-height.
     */
    .page-actions {
        gap: 14px;
    }

    .page-actions > :first-child,
    .page-actions > :not(:first-child) {
        flex: 0 0 auto;
        width: 100%;
        min-height: 0;
    }

    .store-filter {
        margin-top: 0;
    }

    .content > .page-actions {
        margin-bottom: 18px;
    }

    .product-barcode-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .product-barcode-actions > input {
        grid-column: 1 / -1;
        min-height: 44px;
    }

    .product-barcode-actions > button {
        width: 100%;
        min-height: 44px;
    }

    /*
     * Reverted table behavior:
     * retain standard rows/columns; user scrolls only the table container
     * when a table is wider than the phone.
     */
    .content .table-panel .table-scroll {
        overflow-x: auto;
        padding-left: 12px;
        padding-right: 12px;
    }

    .content .table-panel .data-table {
        min-width: 760px !important;
    }

    .content .table-panel .data-table th,
    .content .table-panel .data-table td {
        white-space: nowrap;
    }

    /*
     * Product/description cells may wrap slightly so tables do not become
     * unnecessarily wider, while preserving the original row/table view.
     */
    .content .table-panel .data-table td:nth-child(2) {
        white-space: normal;
        min-width: 180px;
    }

    /* Long page action buttons such as Purchase Orders stay readable. */
    .page-actions > .btn-primary,
    .page-actions > .btn-secondary,
    .page-actions > .btn-danger,
    .page-actions > .page-action-button {
        width: 100%;
        min-height: 42px;
        white-space: normal;
        line-height: 1.25;
    }
}

@media (max-width: 420px) {
    .product-barcode-actions {
        grid-template-columns: 1fr;
    }

    .product-barcode-actions > input {
        grid-column: auto;
    }

    .content .table-panel .table-scroll {
        padding-left: 10px;
        padding-right: 10px;
    }
}


/* ================================================================
   Phase 16 R7 — Product Catalog heading alignment
   ================================================================ */

/*
 * Product Catalog has a tall barcode utility on the right.
 * Do not bottom-align the page title against that utility.
 * The heading must begin at the same top content position as other pages
 * such as Inventory Browser.
 */
.products-actions {
    align-items: flex-start;
}

.products-actions > :first-child,
.products-actions .barcode-box {
    align-self: flex-start;
}

/*
 * Preserve the existing responsive behavior. The title remains content-height
 * and the barcode controls stay visible without creating vertical gaps.
 */
@media (max-width: 1100px) {
    .products-actions {
        align-items: stretch;
    }

    .products-actions > :first-child,
    .products-actions .barcode-box {
        align-self: auto;
    }
}


/* ================================================================
   Phase 17 — Stock Counts / Cycle Counting
   ================================================================ */
.stock-count-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stock-count-filter-grid {
    grid-template-columns: minmax(200px, .9fr) minmax(170px, .65fr) minmax(280px, 1.4fr) 110px;
}

.stock-count-editor {
    width: min(1180px, calc(100vw - 34px));
}

.stock-count-new-modal {
    width: min(720px, calc(100vw - 34px));
}

.stock-count-document-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.stock-count-document-meta > div {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.stock-count-document-meta span,
.stock-count-progress span,
.selected-product-stock span {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.stock-count-document-meta strong,
.stock-count-progress strong,
.selected-product-stock strong {
    color: var(--ink);
    font-size: 12px;
    overflow-wrap: anywhere;
}

.stock-count-meta-wide {
    grid-column: 1 / -1;
}

.stock-count-entry {
    margin: 16px 0;
    padding: 15px;
    border: 1px solid var(--orange-border);
    border-radius: 13px;
    background: var(--orange-soft);
}

.stock-count-entry .panel-heading {
    padding: 0 0 12px;
}

.stock-count-scan-row {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    gap: 8px;
}

.stock-count-scan-row input {
    min-width: 0;
}

.stock-count-search-wrap {
    margin-top: 10px;
}

.stock-count-value-grid {
    grid-template-columns: minmax(180px, .55fr) minmax(280px, 1.45fr) auto;
    align-items: end;
    margin-top: 10px;
}

.stock-count-value-grid > .btn-primary {
    min-height: 42px;
}

.stock-count-progress {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.stock-count-progress > div {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.stock-count-items-scroll {
    max-height: 50vh;
    overflow: auto;
}

.stock-count-items-scroll .data-table {
    min-width: 980px;
}

.stock-count-footer {
    align-items: center;
}

.stock-count-footer .footer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1000px) {
    .stock-count-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-count-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-count-document-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-count-progress {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .stock-count-value-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stock-count-value-grid > .btn-primary {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (max-width: 700px) {
    .stock-count-filter-grid,
    .stock-count-document-meta,
    .stock-count-progress,
    .stock-count-value-grid {
        grid-template-columns: 1fr;
    }

    .stock-count-meta-wide,
    .stock-count-value-grid > .btn-primary {
        grid-column: auto;
    }

    .stock-count-scan-row {
        grid-template-columns: 1fr 1fr;
    }

    .stock-count-scan-row input {
        grid-column: 1 / -1;
        min-height: 44px;
    }

    .stock-count-scan-row .btn-primary,
    .stock-count-scan-row .btn-secondary {
        width: 100%;
        min-height: 44px;
    }

    .stock-count-editor,
    .stock-count-new-modal {
        width: 100%;
    }

    .stock-count-footer {
        align-items: stretch;
    }

    .stock-count-footer .footer-actions {
        width: 100%;
    }

    .stock-count-footer .footer-actions > button {
        flex: 1 1 180px;
    }

    .stock-count-items-scroll {
        max-height: 45vh;
    }
}

@media (max-width: 420px) {
    .stock-count-scan-row {
        grid-template-columns: 1fr;
    }

    .stock-count-scan-row input {
        grid-column: auto;
    }

    .stock-count-footer .footer-actions > button {
        flex-basis: 100%;
        width: 100%;
    }
}


/* ================================================================
   Phase 17 R2 — Global control styling + responsive totals/cards
   ================================================================ */

/* ---------- Universal application control baseline ----------
   Low-specificity rules deliberately fill styling gaps without replacing
   module-specific filter/modal styling. */
.content :where(
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="tel"],
    input[type="url"],
    select
) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.25;
    outline: none;
    box-shadow: none;
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        background-color .16s ease;
}

.content :where(textarea) {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 82px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    box-shadow: none;
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        background-color .16s ease;
}

.content :where(
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea
):focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .10);
}

.content :where(
    input[type="text"],
    input[type="search"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="tel"],
    input[type="url"],
    select,
    textarea
):disabled {
    cursor: not-allowed;
    background: #f8fafc;
    color: #94a3b8;
}

.content :where(input)::placeholder,
.content :where(textarea)::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Search inputs should look identical to normal application text fields. */
.content :where(input[type="search"]) {
    -webkit-appearance: none;
    appearance: none;
}

.content :where(input[type="search"])::-webkit-search-cancel-button {
    cursor: pointer;
}

/* Standalone selects/searches inside action bars and report toolbars. */
.content :where(
    .inline-actions,
    .table-toolbar,
    .panel-heading,
    .reports-inventory-filters,
    .reports-export-group
) :where(input, select, textarea) {
    max-width: 100%;
}

/* ---------- Report inventory snapshot controls ----------
   These controls previously only had width/min-height, leaving the browser
   native border/appearance visible. */
.reports-inventory-filters input,
.reports-inventory-filters select {
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    outline: none;
}

.reports-inventory-filters input:focus,
.reports-inventory-filters select:focus {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .10);
}

/* ---------- Responsive total / KPI cards ----------
   Let the grid decide the number of columns from available width rather
   than forcing cards narrow enough for monetary values to overlap. */
.content .stat-grid {
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    align-items: stretch;
}

.content .stat-card {
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

.content .stat-card > :not(.stat-icon) {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

.content .stat-card strong {
    max-width: 100%;
    font-size: clamp(17px, 1.35vw, 26px);
    line-height: 1.08;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.025em;
    white-space: nowrap;
}

/* Inventory summary has currency totals; keep each card comfortably wide. */
.report-inventory-summary {
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* Reports top-level money cards get the same safe width contract. */
.reports-summary-grid {
    grid-template-columns:
        repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* Avoid a toolbar title competing with filters for the same narrow row. */
.reports-inventory-toolbar > :first-child {
    flex: 1 1 320px;
    min-width: 0;
}

.reports-inventory-filters {
    flex: 1 1 520px;
    min-width: min(100%, 360px);
    max-width: 620px;
}

/* ---------- Tablet ----------
   Amount cards become 2–3 columns naturally depending on actual content
   width; filters stop compressing each other. */
@media (max-width: 1100px) {
    .content .stat-grid,
    .reports-summary-grid,
    .report-inventory-summary {
        grid-template-columns:
            repeat(auto-fit, minmax(min(100%, 210px), 1fr));
    }

    .reports-inventory-toolbar {
        align-items: stretch;
    }

    .reports-inventory-toolbar > :first-child,
    .reports-inventory-filters {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }

    .reports-inventory-filters {
        grid-template-columns: minmax(0, 1.3fr) minmax(180px, .7fr);
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 700px) {
    .content .stat-grid,
    .reports-summary-grid,
    .report-inventory-summary {
        grid-template-columns:
            repeat(auto-fit, minmax(min(100%, 180px), 1fr));
        gap: 10px;
    }

    .content .stat-card {
        min-height: 92px;
        padding: 14px;
        gap: 11px;
    }

    .content .stat-icon {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
        border-radius: 10px;
    }

    .content .stat-card strong {
        font-size: clamp(18px, 5vw, 24px);
    }

    .reports-inventory-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    .content .stat-grid,
    .reports-summary-grid,
    .report-inventory-summary {
        grid-template-columns: 1fr;
    }

    .content .stat-card strong {
        font-size: clamp(20px, 7vw, 27px);
    }
}


/* ================================================================
   Phase 18 — Notifications & Alerts
   ================================================================ */
.nav-menu a { position: relative; }

.nav-alert-badge {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    margin-left: auto;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.topbar-alert-wrap { position: relative; }

.topbar-alert-button {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: #64748b;
    cursor: pointer;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.topbar-alert-button:hover,
.topbar-alert-button.has-alerts {
    border-color: var(--orange-border);
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.topbar-alert-icon { font-size: 14px; line-height: 1; }

.topbar-alert-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 8px;
    font-weight: 900;
    line-height: 1;
}

.alert-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 70;
    width: min(390px, calc(100vw - 24px));
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 24px 55px rgba(15, 23, 42, .18);
}

.alert-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
}

.alert-dropdown-header strong,
.alert-dropdown-header span { display: block; }

.alert-dropdown-header strong { color: var(--ink); font-size: 12px; }
.alert-dropdown-header span { margin-top: 2px; color: var(--muted); font-size: 9px; }

.alert-dropdown-header button {
    flex: 0 0 auto;
    padding: 5px 7px;
    border: 0;
    background: transparent;
    color: var(--orange-dark);
    font-size: 9px;
    font-weight: 800;
    cursor: pointer;
}

.alert-dropdown-list {
    max-height: min(420px, 58vh);
    overflow-y: auto;
}

.alert-preview-item {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 11px 13px;
    border-bottom: 1px solid #f1f5f9;
    color: inherit;
    text-decoration: none;
}

.alert-preview-item:hover { background: #fffaf5; }

.alert-preview-icon {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 12px;
    font-weight: 900;
}

.alert-preview-icon.warning { background: #fff7ed; color: #ea580c; }
.alert-preview-icon.critical { background: #fef2f2; color: #dc2626; }

.alert-preview-item strong,
.alert-preview-item small,
.alert-preview-item em {
    display: block;
    min-width: 0;
}

.alert-preview-item strong { color: var(--ink); font-size: 10px; line-height: 1.35; }
.alert-preview-item small { margin-top: 2px; color: var(--orange-dark); font-size: 8px; font-weight: 700; }
.alert-preview-item em { margin-top: 3px; color: var(--muted); font-size: 9px; font-style: normal; line-height: 1.42; }

.alert-dropdown-empty {
    padding: 24px 14px;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.alert-dropdown-footer {
    display: block;
    padding: 10px 14px;
    background: #f8fafc;
    color: var(--orange-dark);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
}

.dashboard-alert-summary {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #fed7aa;
    border-radius: 12px;
    background: #fff7ed;
    color: inherit;
    text-decoration: none;
}

.dashboard-alert-summary.critical {
    border-color: #fecaca;
    background: #fff5f5;
}

.dashboard-alert-summary-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #ffedd5;
    color: #ea580c;
    font-weight: 900;
}

.dashboard-alert-summary.critical .dashboard-alert-summary-icon {
    background: #fee2e2;
    color: #dc2626;
}

.dashboard-alert-summary strong,
.dashboard-alert-summary small { display: block; }

.dashboard-alert-summary strong { color: var(--ink); font-size: 11px; }
.dashboard-alert-summary small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.dashboard-alert-summary em { color: var(--orange-dark); font-size: 10px; font-style: normal; font-weight: 800; }

.alert-summary-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.alert-filter-grid {
    grid-template-columns:
        minmax(190px, .95fr)
        minmax(150px, .65fr)
        minmax(180px, .8fr)
        minmax(150px, .65fr)
        minmax(260px, 1.35fr)
        100px;
}

.alerts-table { min-width: 1120px; }
.alert-row-unread td { background: #fffdf9; }
.alert-row-unread td:nth-child(2) > strong { color: #0f172a; }
.alert-row-read { opacity: .78; }

.alert-severity {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.alert-severity b {
    display: inline-grid;
    place-items: center;
    width: 15px;
    height: 15px;
    border-radius: 50%;
}

.alert-severity.warning { background: #fff7ed; color: #c2410c; }
.alert-severity.critical { background: #fef2f2; color: #b91c1c; }
.alert-table-actions { flex-wrap: nowrap; }

@media (max-width: 1100px) {
    .alert-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .alert-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .topbar-actions { gap: 7px; }
    .topbar-alert-button { width: 40px; height: 40px; }

    .alert-dropdown {
        position: fixed;
        top: 70px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: calc(100vh - 85px);
    }

    .dashboard-alert-summary { grid-template-columns: 38px minmax(0, 1fr); }
    .dashboard-alert-summary em { grid-column: 2; }
    .alert-summary-grid,
    .alert-filter-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
    .topbar-badge { display: none; }
    .alert-dropdown { top: 66px; right: 8px; left: 8px; }
}


/* ================================================================
   Phase 19 — System Health / Production Readiness
   ================================================================ */
.system-health-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.system-health-overall {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    align-items: center;
    gap: 13px;
    margin-bottom: 18px;
    padding: 14px 15px;
    border: 1px solid #fed7aa;
    border-radius: 13px;
    background: #fff7ed;
}

.system-health-overall.pass {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.system-health-overall.fail {
    border-color: #fecaca;
    background: #fef2f2;
}

.system-health-overall-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: #ffedd5;
    color: #ea580c;
    font-size: 18px;
    font-weight: 900;
}

.system-health-overall.pass .system-health-overall-icon {
    background: #dcfce7;
    color: #15803d;
}

.system-health-overall.fail .system-health-overall-icon {
    background: #fee2e2;
    color: #b91c1c;
}

.system-health-overall strong {
    display: block;
    color: var(--ink);
    font-size: 12px;
}

.system-health-overall p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.system-health-environment {
    margin-bottom: 18px;
}

.system-health-env-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.system-health-env-grid > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.system-health-env-grid span,
.system-health-env-grid strong {
    display: block;
}

.system-health-env-grid span {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.system-health-env-grid strong {
    color: var(--ink);
    font-size: 10px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.system-health-filter-grid {
    grid-template-columns: minmax(190px, .7fr) minmax(170px, .6fr) minmax(300px, 1.7fr);
}

.system-health-table {
    min-width: 1000px;
}

.health-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #475569;
    font-size: 9px;
    font-weight: 900;
    text-transform: uppercase;
}

.health-status-badge.pass {
    background: #dcfce7;
    color: #166534;
}

.health-status-badge.warning {
    background: #ffedd5;
    color: #c2410c;
}

.health-status-badge.fail {
    background: #fee2e2;
    color: #b91c1c;
}

.system-health-notes {
    margin-top: 18px;
}

.system-health-launch-card {
    border-color: var(--orange-border);
}

@media (max-width: 1100px) {
    .system-health-summary,
    .system-health-env-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .system-health-summary,
    .system-health-env-grid,
    .system-health-filter-grid {
        grid-template-columns: 1fr;
    }

    .system-health-overall {
        grid-template-columns: 38px minmax(0, 1fr);
    }
}


/* ================================================================
   Phase 20 — Superadmin / Database Backup & Restore / Launch Gate
   ================================================================ */
.superadmin-nav-label {
    color: #fb923c;
}

.database-backup-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.database-critical-warning code,
.database-backup-table code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.database-upload-panel {
    margin-bottom: 18px;
}

.database-upload-form {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto;
    align-items: end;
    gap: 12px;
}

.database-upload-form label {
    min-width: 0;
}

.database-backup-table {
    min-width: 1180px;
}

.database-backup-table td:nth-child(2) strong,
.database-backup-table td:nth-child(2) small,
.database-backup-table td:nth-child(4) strong,
.database-backup-table td:nth-child(4) small {
    display: block;
}

.database-backup-table td:nth-child(2) small,
.database-backup-table td:nth-child(4) small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.backup-hash {
    font-size: 9px;
    white-space: nowrap;
}

.danger-button {
    background: #b91c1c;
    border-color: #b91c1c;
}

.danger-button:hover {
    background: #991b1b;
    border-color: #991b1b;
}

.deployment-checklist-table {
    min-width: 850px;
}

.user-protected-row {
    opacity: .82;
}

@media (max-width: 900px) {
    .database-backup-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .database-upload-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .database-backup-summary {
        grid-template-columns: 1fr;
    }
}


/* ================================================================
   Phase 20 R1 — Database backup creation/cPanel compatibility
   ================================================================ */
.database-backup-preflight {
    margin-bottom: 18px;
}

.database-preflight-summary {
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    background: #fff7ed;
    color: #9a3412;
    font-size: 10px;
    font-weight: 800;
}

.database-preflight-summary.pass {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.database-preflight-summary.fail {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.database-preflight-table {
    min-width: 720px;
}


/* ================================================================
   Phase 20 R2 — Full / Segregated database backup modes
   ================================================================ */
.database-backup-mode-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.database-backup-mode-card {
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.database-backup-mode-card.recommended {
    border-color: var(--orange-border);
    background: linear-gradient(180deg, #fff 0%, #fffaf5 100%);
}

.database-backup-mode-card h3 {
    margin: 4px 0 6px;
    color: var(--ink);
    font-size: 15px;
}

.database-backup-mode-card p,
.database-backup-mode-card li {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.55;
}

.database-backup-mode-card ul {
    margin: 10px 0 14px;
    padding-left: 18px;
}

.database-backup-mode-card button {
    width: 100%;
}

.database-backup-table {
    min-width: 1320px;
}

@media (max-width: 820px) {
    .database-backup-mode-grid {
        grid-template-columns: 1fr;
    }
}


/* ================================================================
   Phase 20 R3 — Restore privilege preflight / recovery safety
   ================================================================ */
.restore-preflight-box {
    margin: 0 16px 14px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}

.restore-preflight-table {
    min-width: 680px;
}

#confirmDatabaseRestore:disabled {
    opacity: .62;
    cursor: not-allowed;
}


/* ================================================================
   Phase 20 R5 — Live restore progress + maintenance lock
   ================================================================ */
.restore-live-progress {
    margin: 0 16px 14px;
    padding: 14px;
    border: 1px solid #fed7aa;
    border-radius: 13px;
    background: #fffaf5;
}

.restore-progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.restore-progress-heading > div {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.restore-progress-heading strong {
    color: var(--ink);
    font-size: 12px;
}

.restore-progress-heading b {
    flex: 0 0 auto;
    color: var(--orange-dark);
    font-size: 12px;
}

.restore-progress-pulse {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 0 0 0 rgba(249, 115, 22, .36);
    animation: restoreProgressPulse 1.5s infinite;
}

@keyframes restoreProgressPulse {
    70% { box-shadow: 0 0 0 9px rgba(249, 115, 22, 0); }
    100% { box-shadow: 0 0 0 0 rgba(249, 115, 22, 0); }
}

.restore-progress-bar {
    height: 11px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.restore-progress-bar > i {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--orange);
    transition: width .35s ease;
}

.restore-live-progress > p {
    margin: 9px 0 0;
    color: #475569;
    font-size: 10px;
    line-height: 1.55;
}

.restore-progress-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.restore-progress-stats > div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.restore-progress-stats span,
.restore-progress-stats strong {
    display: block;
}

.restore-progress-stats span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.restore-progress-stats strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 10px;
    overflow-wrap: anywhere;
}

.restore-progress-detail {
    margin-top: 10px;
    padding: 10px 11px;
    border-radius: 10px;
    background: #f8fafc;
    color: #475569;
    font-size: 9px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.restore-progress-warning {
    margin: 10px 0 0;
    font-size: 9px;
    line-height: 1.55;
}

#databaseRestoreModal button:disabled {
    cursor: not-allowed;
}

@media (max-width: 700px) {
    .restore-progress-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ================================================================
   Phase 20 R6 — Optional segregated MAIN/CORE-only restore
   ================================================================ */
.restore-strategy-box {
    margin: 0 16px 14px;
    padding: 13px;
    border: 1px solid var(--orange-border);
    border-radius: 12px;
    background: #fffaf5;
}

.restore-strategy-box h4 {
    margin: 4px 0 10px;
    color: var(--ink);
    font-size: 12px;
}

.restore-strategy-option {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    margin: 8px 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}

.restore-strategy-option input {
    margin: 3px 0 0;
}

.restore-strategy-option strong,
.restore-strategy-option small {
    display: block;
}

.restore-strategy-option strong {
    color: var(--ink);
    font-size: 10px;
}

.restore-strategy-option small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.5;
}

.restore-strategy-option.danger-option {
    border-color: #fed7aa;
}

.restore-strategy-option.disabled {
    opacity: .58;
    cursor: not-allowed;
    background: #f8fafc;
}

#restoreCoreOnlyWarning {
    margin-top: 10px;
}


/* ================================================================
   Phase 20 R7 — Restore modal scroll / visibility repair
   ================================================================
   One bounded modal, one vertical scroll region:
   header (fixed)
   -> form
      -> .database-restore-body (ALL variable details; scrollable)
      -> footer (fixed)
   ================================================================ */

.database-restore-card {
    width: min(1040px, 100%);
    height: min(92vh, 940px);
    max-height: min(92vh, 940px);
    overflow: hidden;
}

.database-restore-card > .database-restore-header {
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    background: #fff;
}

.database-restore-card > .database-restore-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.database-restore-card
> .database-restore-form
> .database-restore-body {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 16px 18px 22px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    background: #f8fafc;
}

/*
 * R6 placed these as direct modal-card children. Their old margins assumed
 * that position. Inside the unified scroll body they must be normal flowing
 * sections so nothing is pushed/clipped outside the modal.
 */
.database-restore-body > .restore-strategy-box,
.database-restore-body > .restore-preflight-box,
.database-restore-body > .restore-live-progress {
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px;
}

.database-restore-section {
    min-width: 0;
}

.database-restore-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 9px;
}

.database-restore-section-heading strong,
.database-restore-section-heading small {
    display: block;
}

.database-restore-section-heading strong {
    color: var(--ink);
    font-size: 10px;
}

.database-restore-section-heading small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.45;
}

/*
 * Horizontal movement stays inside the preflight table. Vertical movement
 * belongs exclusively to .database-restore-body.
 */
.database-restore-body .restore-preflight-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

.database-restore-body .restore-preflight-table {
    width: 100%;
    min-width: 760px;
    margin: 0;
}

.database-restore-body .restore-preflight-table th,
.database-restore-body .restore-preflight-table td {
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
}

.database-restore-body .restore-preflight-table th:first-child,
.database-restore-body .restore-preflight-table td:first-child {
    width: 90px;
}

.database-restore-confirmation {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.database-restore-confirmation > .alert {
    margin: 0 0 12px;
}

.database-restore-confirmation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.database-restore-footer {
    flex: 0 0 auto;
    position: relative;
    z-index: 3;
    min-width: 0;
    background: #fff;
}

.database-restore-footer-note {
    margin-right: auto;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.35;
}

.database-restore-scroll-end {
    padding: 4px 0 0;
    color: #94a3b8;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: center;
    text-transform: uppercase;
}

/* Give the visible scroll area a clear top/bottom edge. */
.database-restore-body {
    border-top: 0;
    border-bottom: 0;
}

/*
 * Restore progress can grow as server details change. Never constrain or clip
 * it to a fixed height.
 */
.database-restore-body .restore-live-progress,
.database-restore-body .restore-progress-detail,
.database-restore-body .restore-progress-warning {
    max-height: none;
    overflow: visible;
}

/* The modal itself must never become the browser-page scroll container. */
#databaseRestoreModal.open {
    overflow: hidden;
}

@media (max-width: 820px) {
    .database-restore-card {
        width: 100%;
        height: min(96dvh, 960px);
        max-height: 96dvh;
    }

    .database-restore-card
    > .database-restore-form
    > .database-restore-body {
        padding: 13px 12px 18px;
    }

    .database-restore-confirmation-grid {
        grid-template-columns: 1fr;
    }

    .database-restore-footer {
        flex-wrap: wrap;
        gap: 8px;
        padding: 12px;
    }

    .database-restore-footer-note {
        flex: 1 0 100%;
        order: -1;
        width: 100%;
    }

    .database-restore-footer .btn-secondary,
    .database-restore-footer .btn-primary {
        flex: 1 1 150px;
    }
}

@media (max-width: 520px) {
    #databaseRestoreModal.modal-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .database-restore-card,
    .database-restore-card.modal-large {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .database-restore-card > .database-restore-header {
        padding: 12px 14px;
    }

    .database-restore-card
    > .database-restore-form
    > .database-restore-body {
        padding: 12px 10px 18px;
    }

    .database-restore-body .restore-preflight-table {
        min-width: 640px;
    }
}


/* ================================================================
   Phase 21 — Disaster Recovery SQL backup
   ================================================================ */
.database-backup-mode-grid {
    grid-template-columns: repeat(
        auto-fit,
        minmax(min(100%, 280px), 1fr)
    );
}

.disaster-recovery-card {
    border-color: #fdba74;
    background:
        linear-gradient(
            180deg,
            #fff7ed 0%,
            #ffffff 44%
        );
}

.disaster-recovery-card code,
.disaster-cli-note code {
    font-size: .9em;
    overflow-wrap: anywhere;
}

.disaster-recovery-preflight {
    border-color: #fed7aa;
}

.disaster-cli-note {
    margin: 12px 0 0;
    line-height: 1.55;
}

.database-backup-table td small {
    display: block;
    margin-top: 3px;
}


/* ================================================================
   Phase 21 R3 — Application-level isolated staging restore
   ================================================================ */
.staging-database-panel {
    border-color: #fdba74;
    background: linear-gradient(180deg, #fffaf5 0%, #fff 46%);
}

.staging-target-grid {
    display: grid;
    grid-template-columns: minmax(180px, .8fr) repeat(2, minmax(220px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin: 12px 0;
}

.staging-target-fact,
.staging-target-field {
    min-width: 0;
}

.staging-target-fact {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.staging-target-fact span,
.staging-target-fact strong,
.staging-target-fact small,
.staging-target-field > span,
.staging-target-field > small {
    display: block;
}

.staging-target-fact span,
.staging-target-field > span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
}

.staging-target-fact strong {
    margin-top: 4px;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.staging-target-fact small,
.staging-target-field > small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    line-height: 1.4;
}

.staging-target-action {
    align-self: center;
}

.staging-production-note {
    margin: 12px 0 0;
}

.staging-restore-card {
    width: min(1080px, 100%);
    height: min(92vh, 940px);
    max-height: min(92vh, 940px);
    overflow: hidden;
}

.staging-restore-card > .staging-restore-header {
    flex: 0 0 auto;
    background: #fff;
}

.staging-restore-card > .staging-restore-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.staging-restore-card
> .staging-restore-form
> .staging-restore-body {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 16px 18px 22px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
    background: #f8fafc;
}

.staging-restore-target-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.staging-restore-target-summary > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.staging-restore-target-summary span,
.staging-restore-target-summary strong,
.staging-restore-target-summary small {
    display: block;
}

.staging-restore-target-summary span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
}

.staging-restore-target-summary strong {
    margin-top: 4px;
    color: var(--ink);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.staging-restore-target-summary small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 9px;
}

.staging-preflight-box,
.staging-live-progress,
.staging-restore-confirmation {
    width: 100%;
    max-width: 100%;
    margin: 0 0 14px;
}

.staging-restore-footer {
    flex: 0 0 auto;
    background: #fff;
}

#stagingRestoreModal.open {
    overflow: hidden;
}

@media (max-width: 1100px) {
    .staging-target-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .staging-target-action {
        align-self: end;
    }
}

@media (max-width: 720px) {
    .staging-target-grid,
    .staging-restore-target-summary {
        grid-template-columns: 1fr;
    }

    .staging-restore-card {
        width: 100%;
        height: 96dvh;
        max-height: 96dvh;
    }

    .staging-restore-card
    > .staging-restore-form
    > .staging-restore-body {
        padding: 12px 10px 18px;
    }
}

@media (max-width: 520px) {
    #stagingRestoreModal.modal-backdrop {
        padding: 0;
        align-items: stretch;
    }

    .staging-restore-card,
    .staging-restore-card.modal-large {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
    }
}

/* ================================================================
   Phase 22 R3 — Web Department Database Setup
   ================================================================ */
.status-badge.success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.status-badge.warning {
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.status-badge.danger {
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.department-db-top-actions {
    margin-top: 0;
    margin-bottom: 14px;
}

.department-db-table-wrap,
.setup-status-table-wrap {
    margin-top: 8px;
}

.department-db-action-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(260px, 1.2fr);
    margin-top: 16px;
}

.setup-console-page {
    min-height: 100vh;
    background: #f6f8fb;
    color: var(--ink);
}

.setup-console-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 34px 0 48px;
}

.setup-console-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.setup-console-topbar h1 {
    margin: 5px 0 8px;
    font-size: clamp(26px, 4vw, 38px);
    letter-spacing: -.03em;
}

.setup-console-topbar p {
    margin: 0;
    color: var(--muted);
}

.setup-console-login-card {
    max-width: 640px;
    margin: 20px auto 0;
}

.setup-console-form {
    display: grid;
    gap: 14px;
    padding-top: 4px;
}

.setup-console-form label {
    display: grid;
    gap: 7px;
}

.setup-console-form label > span {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink);
}

.setup-console-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.setup-action-card {
    margin: 0;
}

.setup-demo-note {
    margin-top: 18px;
}

.setup-status-table small,
.department-db-table-wrap small {
    color: var(--muted);
}

@media (max-width: 900px) {
    .department-db-action-grid,
    .setup-console-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .setup-console-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 18px;
    }

    .setup-console-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .setup-console-topbar .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* Phase 22 R4: HFSQL Windows Migration API */
.migration-token-grid {
    grid-template-columns: minmax(220px, 1fr) minmax(160px, .6fr) minmax(240px, 1fr);
    margin-top: 14px;
}

.copy-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 10px 0 6px;
}

.copy-field-row input {
    min-width: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

#migrationTokenTable td:last-child {
    white-space: nowrap;
}

@media (max-width: 900px) {
    .migration-token-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .copy-field-row {
        grid-template-columns: 1fr;
    }
    .copy-field-row .btn-secondary {
        width: 100%;
    }
}


/* Phase 22 R10: optimized legacy product photos */
.product-list-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.product-list-info > div { min-width: 0; }
.product-list-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}
.product-detail-image {
    width: 96px;
    height: 96px;
    flex: 0 0 96px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid #ffedd5;
    background: #fff;
}
@media (max-width: 720px) {
    .product-detail-image {
        width: 72px;
        height: 72px;
        flex-basis: 72px;
    }
    .product-list-thumb {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}


/* ==========================================================================
   Phase 22 R10.3 - Product Photo Lightbox
   ========================================================================== */

.product-photo-link {
    appearance: none;
    border: 0;
    padding: 0;
    margin: 0;
    background: transparent;
    cursor: zoom-in;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.product-photo-link:focus-visible {
    outline: 3px solid rgba(210, 91, 35, .35);
    outline-offset: 3px;
}

.product-list-photo-button {
    flex: 0 0 auto;
}

.product-list-photo-button:hover .product-list-thumb,
.inventory-photo-button:hover .inventory-product-thumb,
.product-detail-photo-button:hover .product-detail-image {
    transform: scale(1.03);
}

.product-list-thumb,
.inventory-product-thumb,
.product-detail-image {
    transition: transform .18s ease, box-shadow .18s ease;
}

.inventory-product-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    display: block;
    border-radius: 9px;
    background: #f3f4f6;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .10);
}

.product-photo-cell {
    width: 66px;
    min-width: 66px;
    text-align: center;
}

.product-photo-empty {
    color: #a0a5ad;
}

.product-detail-photo-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.product-detail-photo-button {
    position: relative;
    overflow: hidden;
}

.product-photo-expand {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 6px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity .18s ease, transform .18s ease;
    pointer-events: none;
}

.product-detail-photo-button:hover .product-photo-expand,
.product-detail-photo-button:focus-visible .product-photo-expand {
    opacity: 1;
    transform: translateY(0);
}

.product-photo-original-link {
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    padding: 22px;
    background: rgba(5, 10, 20, .88);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.photo-lightbox.open {
    display: flex;
}

.photo-lightbox-dialog {
    width: min(1180px, 100%);
    max-height: calc(100vh - 44px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 30px 100px rgba(0, 0, 0, .42);
}

.photo-lightbox-header,
.photo-lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 18px;
}

.photo-lightbox-header {
    border-bottom: 1px solid #e8ebef;
}

.photo-lightbox-header h3 {
    margin: 2px 0 0;
}

.photo-lightbox-header p {
    margin: 3px 0 0;
    color: #69717c;
    font-size: 13px;
}

.photo-lightbox-close {
    appearance: none;
    border: 0;
    background: transparent;
    color: #20242a;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 10px;
}

.photo-lightbox-close:hover {
    background: #f1f3f5;
}

.photo-lightbox-stage {
    min-height: 260px;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background:
        linear-gradient(45deg, #e7e9ec 25%, transparent 25%),
        linear-gradient(-45deg, #e7e9ec 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e7e9ec 75%),
        linear-gradient(-45deg, transparent 75%, #e7e9ec 75%),
        #f3f4f6;
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.photo-lightbox-stage img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 190px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 35px rgba(0, 0, 0, .20);
    cursor: zoom-in;
}

.photo-lightbox-stage img:active {
    cursor: zoom-out;
}

.photo-lightbox-footer {
    border-top: 1px solid #e8ebef;
    color: #69717c;
    font-size: 12px;
}

.photo-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 720px) {
    .photo-lightbox {
        padding: 0;
        align-items: stretch;
    }

    .photo-lightbox-dialog {
        max-height: 100vh;
        width: 100%;
        border-radius: 0;
    }

    .photo-lightbox-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .photo-lightbox-actions {
        width: 100%;
    }

    .photo-lightbox-actions > * {
        flex: 1;
        text-align: center;
    }

    .photo-lightbox-stage img {
        max-height: calc(100vh - 230px);
    }

    .product-photo-expand {
        opacity: 1;
        transform: none;
    }
}


/* ==========================================================================
   Phase 23 R1 - BHPC PROGRAM 2026 Required Reports
   ========================================================================== */
.bhpc-page-actions { align-items: flex-start; }
.bhpc-action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.bhpc-tabs-panel { padding: 0; overflow: hidden; }
.bhpc-tabs { display: flex; gap: 0; border-bottom: 1px solid #e7e9ed; background: #fafbfc; }
.bhpc-tab {
    appearance: none; border: 0; border-right: 1px solid #e7e9ed;
    background: transparent; padding: 14px 18px; font-weight: 800;
    cursor: pointer; color: #555d68;
}
.bhpc-tab.active { background: #fff; color: #c45124; box-shadow: inset 0 -3px 0 #d9632c; }
.bhpc-filter-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(160px, 1fr));
    gap: 14px; padding: 18px;
}
.bhpc-filter-grid label, .bhpc-filter-action { display: flex; flex-direction: column; gap: 6px; }
.bhpc-filter-action { justify-content: flex-end; }
.bhpc-summary-grid { margin-top: 16px; }
.bhpc-report-sheet { margin-top: 16px; }
.bhpc-sheet-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 20px; padding: 18px 20px; border-bottom: 1px solid #e6e8ec;
}
.bhpc-sheet-header h2 { margin: 0 0 8px; letter-spacing: .04em; }
.bhpc-sheet-meta { display: flex; gap: 18px; flex-wrap: wrap; font-weight: 700; font-size: 13px; }
.bhpc-template-note { margin: 14px 18px 0; padding: 10px 12px; background: #fff8e9; border: 1px solid #f2d49b; border-radius: 9px; font-size: 12px; line-height: 1.55; }
.bhpc-data-table th { white-space: nowrap; vertical-align: middle; }
.bhpc-data-table td { vertical-align: middle; }
.bhpc-data-table thead tr:first-child th { background: #2e3136; color: #fff; }
.bhpc-data-table thead tr:nth-child(2) th { background: #f0f2f4; }
.bhpc-data-table tfoot th { background: #f8f1e8; border-top: 2px solid #c45124; }
.bhpc-sold-row { background: #fffaf4; }
.bhpc-remarks-guide {
    display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
    padding: 14px 18px 18px; font-size: 12px;
}
.bhpc-remarks-guide span { padding: 5px 8px; border: 1px solid #ddd; border-radius: 999px; background: #fff; }
.bhpc-remarks-guide small { width: 100%; color: #6f7780; }
@media (max-width: 900px) {
    .bhpc-filter-grid { grid-template-columns: repeat(2, minmax(140px, 1fr)); }
}
@media (max-width: 620px) {
    .bhpc-filter-grid { grid-template-columns: 1fr; }
    .bhpc-sheet-header { flex-direction: column; }
}
@media print {
    body * { visibility: hidden !important; }
    #bhpcReportSheet, #bhpcReportSheet * { visibility: visible !important; }
    #bhpcReportSheet {
        position: absolute; left: 0; top: 0; width: 100%;
        box-shadow: none !important; border: 0 !important;
    }
    .sidebar, .topbar, .bhpc-page-actions, .bhpc-tabs-panel, .bhpc-summary-grid, .alert { display: none !important; }
    .bhpc-table-scroll { overflow: visible !important; }
    .bhpc-data-table { font-size: 8.5pt; width: 100%; }
    @page { size: landscape; margin: 8mm; }
}

/* Phase 23 R1.1 BHPC report correction */
.bhpc-filter-grid textarea {
    width: 100%;
    min-height: 70px;
    resize: vertical;
    font: inherit;
    border: 1px solid #d6dae0;
    border-radius: 8px;
    padding: 9px 10px;
    background: #fff;
}
.bhpc-sheet-meta #bhpcBasisLabel:not(:empty) { color: #c45124; }


/* Phase 23 R1.1.2 - BHPC selector population reliability */
.bhpc-population-status {
    margin: 12px 0;
    padding: 10px 13px;
    border: 1px solid #dfe3e8;
    border-radius: 9px;
    background: #f8fafb;
    color: #56606b;
    font-size: 12px;
}
.bhpc-field-help {
    color: #737b85;
    font-size: 11px;
    line-height: 1.35;
}
#bhpcProductCodesWrap .select2-container {
    width: 100% !important;
}
#bhpcProductCodesWrap .select2-selection--multiple {
    min-height: 42px;
    border: 1px solid #d6dae0;
    border-radius: 8px;
    padding: 3px 5px;
}
#bhpcProductCodesWrap .select2-search__field {
    min-width: 220px !important;
}


/* Phase 23 R1.1.3 - BHPC reactive dependent selectors */
.bhpc-filter-grid .bhpc-field-hidden {
    display: none !important;
}
.bhpc-population-status strong {
    color: var(--ink);
}


/* ==========================================================================
   Phase 23 R2 - Demo Data Reset & Generator
   ========================================================================== */
.demo-seed-panel { padding: 20px; }
.demo-seed-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.demo-seed-grid article {
    padding: 16px;
    border: 1px solid #e6e8ec;
    border-radius: 12px;
    background: #fafbfc;
}
.demo-seed-grid article strong {
    display: block;
    margin-top: 5px;
    font-size: 20px;
}
.demo-seed-options,
.demo-seed-confirm {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 16px;
    margin: 18px 0;
}
.demo-seed-options label,
.demo-seed-confirm label {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.demo-seed-options small,
.demo-seed-confirm small {
    color: #707984;
    line-height: 1.45;
}
.demo-seed-plan {
    margin: 22px 0;
    padding: 16px;
    border: 1px solid #e6e8ec;
    border-radius: 12px;
}
.demo-seed-plan h3 { margin-top: 0; }
.demo-seed-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 12px;
}
.demo-seed-plan-grid div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 11px 12px;
    border-radius: 9px;
    background: #f8fafb;
}
.demo-seed-plan-grid span {
    color: #69727d;
    font-size: 12px;
}
.demo-seed-estimate {
    padding: 12px 14px;
    border-radius: 9px;
    background: #fff8e9;
    border: 1px solid #f0d5a0;
}
.demo-seed-run {
    min-height: 46px;
    padding-left: 22px;
    padding-right: 22px;
}
.demo-seed-progress {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #e6e8ec;
    border-radius: 10px;
    background: #fafbfc;
}
.demo-seed-progress p { margin: 4px 0 0; color: #6d7580; }
.demo-seed-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #eceff2;
    border-top-color: #e86522;
    border-radius: 50%;
    animation: demoSeedSpin .8s linear infinite;
    flex: 0 0 auto;
}
@keyframes demoSeedSpin { to { transform: rotate(360deg); } }
.demo-seed-result { margin-top: 18px; padding: 20px; }
.demo-seed-result pre {
    overflow: auto;
    padding: 15px;
    border-radius: 10px;
    background: #111827;
    color: #e5e7eb;
    line-height: 1.55;
}
.demo-seed-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
@media (max-width: 900px) {
    .demo-seed-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .demo-seed-grid,
    .demo-seed-options,
    .demo-seed-confirm,
    .demo-seed-plan-grid {
        grid-template-columns: 1fr;
    }
}

/* VER1.0002 · Merchandiser Simple Mode */
body.merchandiser-simple-mode {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(249,115,22,.08), transparent 28rem),
        var(--background);
}

.merch-simple-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.merch-simple-topbar {
    min-height: 78px;
    padding: 14px clamp(18px, 4vw, 46px);
    background: rgba(255,255,255,.96);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(10px);
}

.merch-simple-brand,
.merch-simple-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.merch-simple-brand strong,
.merch-simple-brand span,
.merch-simple-user strong,
.merch-simple-user span {
    display: block;
}

.merch-simple-brand strong { letter-spacing: .08em; font-size: 15px; }
.merch-simple-brand span,
.merch-simple-user span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.merch-simple-user { text-align: right; }
.merch-signout { min-height: 42px; display: inline-flex; align-items: center; }

.merch-simple-main {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 38px;
    flex: 1;
}

.merch-status-hero {
    border-radius: 22px;
    padding: clamp(22px, 4vw, 34px);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
}

.merch-status-hero h1 {
    margin: 5px 0 6px;
    font-size: clamp(28px, 4.5vw, 44px);
    line-height: 1.03;
    letter-spacing: -.045em;
}

.merch-status-hero p { margin: 0; color: var(--text); }
.merch-status-good { border-top: 4px solid var(--success); }
.merch-status-critical,
.merch-status-inactive,
.merch-status-assignment { border-top: 4px solid var(--danger); }

.merch-status-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.merch-overall-badge {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 999px;
    font-weight: 800;
    background: #ecfdf5;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.merch-status-critical .merch-overall-badge,
.merch-status-inactive .merch-overall-badge,
.merch-status-assignment .merch-overall-badge {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.merch-status-note {
    margin: 14px 2px 22px;
    color: var(--text);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: baseline;
}

.merch-status-note strong { color: var(--ink); }

.merch-simple-grid {
    display: grid;
    gap: 16px;
}

.merch-kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.merch-kpi-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 17px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.merch-kpi-card span,
.merch-kpi-card small { display: block; }
.merch-kpi-card span {
    text-transform: uppercase;
    letter-spacing: .06em;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}
.merch-kpi-card strong {
    display: block;
    margin: 6px 0 3px;
    font-size: 27px;
    letter-spacing: -.035em;
}
.merch-kpi-card small { color: var(--text); }
.merch-kpi-card.success { border-top: 3px solid var(--success); }
.merch-kpi-card.attention { border-top: 3px solid #d97706; }
.merch-kpi-card.danger { border-top: 3px solid var(--danger); }

.merch-two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 18px;
}

.merch-status-panel { padding: 0; overflow: hidden; }
.merch-panel-heading {
    min-height: 78px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.merch-panel-heading h2 { margin: 2px 0 0; font-size: 19px; }
.merch-generated { font-size: 12px; color: var(--muted); }

.merch-metric-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
}
.merch-metric-list > div {
    background: #fff;
    padding: 18px 20px;
}
.merch-metric-list span,
.merch-metric-list strong { display: block; }
.merch-metric-list span { color: var(--text); font-size: 13px; }
.merch-metric-list strong { margin-top: 4px; font-size: 23px; }
.merch-metric-list.compact strong { font-size: 20px; }

.merch-row-list { padding: 4px 20px 8px; }
.merch-row-item {
    min-height: 63px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid var(--line);
}
.merch-row-item:last-child { border-bottom: 0; }
.merch-row-item strong,
.merch-row-item span { display: block; }
.merch-row-item strong { font-size: 13px; }
.merch-row-item span { color: var(--muted); font-size: 11px; margin-top: 3px; }
.merch-row-item > b { min-width: 42px; text-align: right; font-size: 18px; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }

.merch-inline-ok,
.merch-inline-muted {
    margin: 18px 20px 20px;
    border-radius: 12px;
    padding: 13px 14px;
    font-size: 13px;
}
.merch-inline-ok { background: #f0fdf4; color: #166534; }
.merch-inline-muted { background: #f8fafc; color: var(--text); }

.merch-readonly-banner {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: #9a3412;
}
.merch-readonly-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #ffedd5;
    display: grid;
    place-items: center;
    flex: 0 0 34px;
}
.merch-readonly-banner strong,
.merch-readonly-banner p { display: block; margin: 0; }
.merch-readonly-banner p { margin-top: 3px; font-size: 13px; }

.merch-empty-panel {
    padding: 42px 24px;
    text-align: center;
}
.merch-empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    margin: 0 auto 12px;
    display: grid;
    place-items: center;
    background: #fff7ed;
    color: #c2410c;
    font-size: 26px;
}
.merch-empty-panel h2 { margin: 0 0 8px; }
.merch-empty-panel p { margin: 0 auto; max-width: 560px; color: var(--text); }

.merch-simple-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 16px clamp(18px, 4vw, 46px);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    .merch-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .merch-two-column { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .merch-simple-topbar {
        align-items: flex-start;
        padding: 13px 16px;
    }
    .merch-simple-user > div { display: none; }
    .merch-simple-main { width: min(100% - 24px, 1180px); padding-top: 16px; }
    .merch-status-hero { align-items: flex-start; flex-direction: column; border-radius: 18px; }
    .merch-status-actions { width: 100%; justify-content: flex-start; }
    .merch-status-actions .btn-primary { flex: 1; text-align: center; }
    .merch-kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .merch-kpi-card { padding: 15px; }
    .merch-kpi-card strong { font-size: 22px; }
    .merch-metric-list { grid-template-columns: 1fr 1fr; }
    .merch-panel-heading { align-items: flex-start; flex-direction: column; }
    .merch-simple-footer { flex-direction: column; text-align: center; }
}

@media (max-width: 400px) {
    .merch-kpi-grid { grid-template-columns: 1fr; }
    .merch-metric-list { grid-template-columns: 1fr; }
}

.pwa-install-button{min-height:38px;white-space:nowrap}
.pwa-install-help-open{overflow:hidden}
#pwaInstallHelpOverlay{position:fixed;inset:0;z-index:10050;display:grid;place-items:center;padding:18px;background:rgba(15,23,42,.58);backdrop-filter:blur(3px)}
#pwaInstallHelpOverlay[hidden]{display:none!important}
.pwa-install-help-card{position:relative;width:min(94vw,480px);max-height:min(86dvh,720px);overflow:auto;background:#fff;border:1px solid #fed7aa;border-radius:20px;padding:22px;box-shadow:0 24px 70px rgba(15,23,42,.25)}
.pwa-install-help-card h2{margin:5px 36px 12px 0}.pwa-install-help-card p,.pwa-install-help-card li{line-height:1.55}.pwa-install-help-card ol{padding-left:22px}.pwa-install-help-eyebrow{font-size:.72rem;font-weight:900;letter-spacing:.08em;color:#ea580c}.pwa-install-help-note{padding:10px 12px;border-radius:10px;background:#fff7ed;color:#9a3412}.pwa-install-help-close{position:absolute;top:12px;right:12px;width:40px;height:40px;border:0;border-radius:10px;background:#f3f4f6;font-size:24px;cursor:pointer}.pwa-install-help-done{width:100%;min-height:44px;border:0;border-radius:11px;background:#f97316;color:#fff;font-weight:800;cursor:pointer}
@media(max-width:720px){.pwa-install-button[hidden]{display:none!important}.pwa-install-button:not([hidden]){display:inline-flex!important;min-height:44px;align-items:center;justify-content:center}.topbar-actions .pwa-install-button{font-size:.78rem;padding:0 10px}.pwa-install-help-card{padding:19px}}
/* VER1.0015 · Secure pairing code reveal */
.secure-pairing-code{margin:8px 0;font:800 clamp(1.45rem,4vw,2rem)/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.14em;word-break:break-all}

/* VER1.0016 · resumable pairing session metadata */
#deviceRows td:first-child small{display:block;margin-top:3px;max-width:44ch;line-height:1.35}
#deviceRows .table-action-group{gap:6px;flex-wrap:wrap}


/* VER1.0017 · Store device control visual hardening */
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.modal-card.modal-lg{width:min(1040px,100%)}
.device-access-modal{max-height:min(92dvh,940px)}
.device-access-modal .modal-header{flex:0 0 auto;background:#fff;z-index:4}
.device-access-modal .modal-header>div{min-width:0}
.device-access-modal .modal-subtitle{margin:5px 0 0;color:var(--muted);font-size:12px;line-height:1.45}
.device-access-modal .modal-body{padding:0;overflow-y:auto;background:#f8fafc}
.device-access-toolbar{position:sticky;top:0;z-index:3;padding:14px 18px 12px;border-bottom:1px solid var(--line);background:rgba(255,255,255,.96);backdrop-filter:blur(8px)}
.device-access-search-row{display:grid;grid-template-columns:minmax(0,1fr) max-content;align-items:center;gap:14px}
.device-access-search{position:relative;display:block;min-width:0}
.device-access-search input{box-sizing:border-box;width:100%;min-height:46px;padding:0 48px 0 50px!important;border:1px solid #cbd5e1;border-radius:12px;background:#fff;font-size:14px;font-weight:600;color:var(--ink);line-height:1.2}
.device-access-search-icon{position:absolute;left:16px;top:50%;transform:translateY(-50%);z-index:3;display:flex;width:22px;height:22px;align-items:center;justify-content:center;color:#64748b;font-size:20px;line-height:1;pointer-events:none}
.device-access-search-clear{position:absolute;right:7px;top:50%;transform:translateY(-50%);z-index:3;width:34px;height:34px;border:0;border-radius:9px;background:#f1f5f9;color:#475569;font-size:20px;cursor:pointer}
.device-access-result-count{justify-self:end;color:#64748b;font-size:12px;font-weight:700;white-space:nowrap}
.device-access-filters{display:flex;flex-wrap:wrap;gap:7px;margin-top:10px}
.device-access-filter{min-height:36px;padding:0 12px;border:1px solid #e2e8f0;border-radius:999px;background:#fff;color:#475569;font-size:11px;font-weight:800;cursor:pointer;transition:.15s ease}
.device-access-filter:hover{border-color:#fdba74;background:#fff7ed;color:#9a3412}
.device-access-filter.active{border-color:#fb923c;background:#fff7ed;color:#c2410c;box-shadow:0 0 0 2px rgba(249,115,22,.08)}
.device-access-list{display:grid;gap:10px;padding:14px 18px 20px}
.device-store-card{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:18px;padding:15px 16px;border:1px solid #e2e8f0;border-radius:14px;background:#fff;box-shadow:0 1px 2px rgba(15,23,42,.03)}
.device-store-card:hover{border-color:#fdba74;box-shadow:0 5px 18px rgba(15,23,42,.05)}
.device-store-heading{min-width:0}
.device-store-title{display:flex;align-items:baseline;gap:8px;min-width:0;flex-wrap:wrap}
.device-store-title strong{font-size:15px;line-height:1.25;color:#0f172a;letter-spacing:.01em}
.device-store-title span{min-width:0;color:#334155;font-size:13px;line-height:1.35;overflow-wrap:anywhere}
.device-store-badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.device-access-badge{display:inline-flex;align-items:center;min-height:25px;padding:0 8px;border-radius:999px;border:1px solid #e2e8f0;background:#f8fafc;color:#475569;font-size:9px;font-weight:900;letter-spacing:.045em}
.device-access-badge.active{border-color:#bbf7d0;background:#f0fdf4;color:#166534}
.device-access-badge.no-access{border-color:#e2e8f0;background:#f8fafc;color:#64748b}
.device-access-badge.primary{border-color:#bfdbfe;background:#eff6ff;color:#1d4ed8}
.device-access-badge.backup{border-color:#ddd6fe;background:#f5f3ff;color:#6d28d9}
.device-access-badge.offline{border-color:#fed7aa;background:#fff7ed;color:#c2410c}
.device-access-badge.standby{border-color:#fde68a;background:#fffbeb;color:#92400e}
.device-access-badge.store-inactive{border-color:#fecaca;background:#fef2f2;color:#991b1b}
.device-store-controls{display:flex;align-items:flex-end;justify-content:flex-end;gap:10px;min-width:min(100%,420px)}
.device-role-field{display:grid;gap:5px;min-width:130px}
.device-role-field>span{font-size:9px;font-weight:900;letter-spacing:.06em;text-transform:uppercase;color:#64748b}
.device-role{min-height:42px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;padding:0 36px 0 11px;font-size:12px;font-weight:700;color:#334155}
.device-store-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}
.device-store-actions .btn-table{min-height:42px;min-width:104px;padding:0 12px;border-radius:10px;white-space:normal;line-height:1.15;font-weight:800}
.device-store-actions .promote-offline,.device-store-actions .revoke-offline{min-width:148px}
.device-access-empty{padding:50px 20px;text-align:center;color:#64748b}
.device-access-empty strong,.device-access-empty span{display:block}.device-access-empty strong{color:#334155;font-size:15px}.device-access-empty span{margin-top:5px;font-size:12px}
.device-access-modal .modal-footer{justify-content:space-between;background:#fff;z-index:4}
.device-access-footer-summary{color:#64748b;font-size:11px;font-weight:700}
.action-spinner{display:inline-block;width:14px;height:14px;margin-right:7px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;vertical-align:-2px;animation:colerosh-spin .65s linear infinite}
@keyframes colerosh-spin{to{transform:rotate(360deg)}}
@media(max-width:780px){
 .modal-backdrop{padding:10px}
 .device-access-modal{width:100%;max-height:calc(100dvh - 20px);border-radius:16px}
 .device-access-toolbar{padding:12px}
 .device-access-search-row{grid-template-columns:1fr;align-items:stretch;gap:7px}
 .device-access-result-count{justify-self:start;white-space:normal}
 .device-access-filters{flex-wrap:nowrap;overflow-x:auto;padding-bottom:2px;scrollbar-width:thin}
 .device-access-filter{flex:0 0 auto;min-height:40px}
 .device-access-list{padding:10px 12px 18px;gap:9px}
 .device-store-card{grid-template-columns:1fr;gap:12px;padding:14px}
 .device-store-controls{width:100%;min-width:0;display:grid;grid-template-columns:minmax(120px,.7fr) minmax(0,1.3fr);align-items:end}
 .device-store-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
 .device-store-actions .btn-table,.device-store-actions .promote-offline,.device-store-actions .revoke-offline{width:100%;min-width:0;min-height:44px}
 .device-store-actions .btn-table:only-child{grid-column:1/-1}
 .device-role{min-height:44px;font-size:16px}
 .device-access-modal .modal-footer{position:sticky;bottom:0;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px))}
}
@media(max-width:480px){
 .device-access-modal .modal-header{padding:13px 14px}
 .device-access-modal .modal-header h3{font-size:17px;overflow-wrap:anywhere}
 .device-access-modal .modal-subtitle{display:none}
 .device-store-controls{grid-template-columns:1fr}
 .device-store-actions{grid-template-columns:1fr 1fr}
 .device-access-footer-summary{display:none}
 .device-access-modal .modal-footer .btn-secondary{width:100%}
}


/* VER1.0025 — Superadmin user-facing information controls */
.login-shell--form-only{grid-template-columns:1fr;background:linear-gradient(180deg,#fff,#fff7ed)}
.login-shell--form-only .login-form-panel{min-height:100vh}
.presentation-settings-heading{margin-bottom:16px}
.presentation-settings-form{display:grid;gap:18px}
.presentation-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
.presentation-settings-card{padding:20px;border:1px solid var(--line);border-radius:16px;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.04)}
.presentation-settings-wide{grid-column:1/-1}
.presentation-settings-card-head{margin-bottom:12px}
.presentation-settings-card-head h3{margin:6px 0 5px;font-size:18px}
.presentation-settings-card-head p{margin:0;color:var(--muted);font-size:12px;line-height:1.55}
.setting-toggle-row{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 0;border-top:1px solid #eef1f4;cursor:pointer}
.setting-toggle-copy{display:grid;gap:4px;min-width:0}
.setting-toggle-copy strong{font-size:13px;color:var(--ink)}
.setting-toggle-copy small{font-size:11px;line-height:1.5;color:var(--muted)}
.setting-toggle-copy code{font-size:10px}
.setting-toggle-row input[type="checkbox"]{appearance:none;width:46px;height:26px;border-radius:999px;background:#d1d5db;position:relative;flex:0 0 auto;cursor:pointer;transition:.18s}
.setting-toggle-row input[type="checkbox"]::after{content:"";position:absolute;width:20px;height:20px;border-radius:50%;background:#fff;left:3px;top:3px;box-shadow:0 2px 6px rgba(15,23,42,.24);transition:.18s}
.setting-toggle-row input[type="checkbox"]:checked{background:#f97316}
.setting-toggle-row input[type="checkbox"]:checked::after{transform:translateX(20px)}
.setting-toggle-row input[type="checkbox"]:focus-visible{outline:3px solid rgba(249,115,22,.25);outline-offset:2px}
.setting-toggle-sensitive{background:#fffaf5;margin-inline:-8px;padding-inline:8px;border-radius:10px}
.presentation-settings-actions{position:sticky;bottom:14px;z-index:5;display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px;border:1px solid #fed7aa;border-radius:14px;background:rgba(255,247,237,.96);backdrop-filter:blur(10px);box-shadow:0 14px 40px rgba(124,45,18,.10)}
.presentation-settings-status{font-size:11px;color:var(--muted)}
@media(max-width:760px){.presentation-settings-grid{grid-template-columns:1fr}.presentation-settings-wide{grid-column:auto}.presentation-settings-card{padding:16px}.setting-toggle-row{gap:12px}.presentation-settings-actions{bottom:8px}.presentation-settings-actions .btn-primary,.presentation-settings-actions .btn-secondary{min-height:44px}}
.device-access-department{margin-bottom:10px}.device-access-department label{display:grid;gap:6px;max-width:340px}.device-access-department label>span{font-size:11px;font-weight:800;color:#475569}.device-access-department select{min-height:42px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;padding:0 11px;color:var(--ink);font-weight:700}

/* VER1.0031 login + store-device hardening */
.login-mobile-hero{display:none;align-items:center;gap:12px;margin-bottom:10px}.login-mobile-hero strong{font-size:26px;letter-spacing:.12em;line-height:1;color:#111827}.login-mobile-hero .brand-mark{width:52px;height:52px;border-radius:16px;font-size:26px;box-shadow:0 14px 30px rgba(249,115,22,.24)}
.login-utility-bar{overflow:visible}
.login-utility-actions{min-width:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;flex:1 1 auto}
.login-utility-btn{width:100%;min-width:0}
.login-utility-btn.is-disabled,.login-utility-btn[aria-disabled="true"]{opacity:.62;pointer-events:none}
.device-access-modal .modal-body{overflow-x:hidden}
.device-store-card{overflow:hidden}
.device-role-toggle{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;min-width:178px}
.device-role-option{min-height:42px;padding:0 10px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;font-size:12px;font-weight:800;color:#475569;cursor:pointer;transition:.15s ease}
.device-role-option:hover{border-color:#fdba74;background:#fff7ed;color:#9a3412}.device-role-option.active{border-color:#fb923c;background:#fff7ed;color:#c2410c;box-shadow:0 0 0 2px rgba(249,115,22,.08)}
@media(max-width:780px){
  body.login-page,html:has(body.login-page){height:100dvh;overflow:hidden;background:#f8fafc}
  .login-shell,.login-form-panel,.login-shell--form-only .login-form-panel{min-height:100dvh;height:100dvh}
  .login-brand{display:none}
  .login-form-panel{padding:0;align-items:stretch;justify-content:flex-start;overflow:hidden}
  .login-form{max-width:none;width:100%;min-height:100dvh;padding:22px 22px calc(16px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;justify-content:flex-start;overflow:hidden}
  .login-mobile-hero{display:flex}
  .login-form .eyebrow{font-size:12px}
  .login-form h2{font-size:46px;line-height:.98;margin-bottom:8px}
  .login-form p{margin-bottom:14px;font-size:15px;line-height:1.5}
  .login-form label{margin-bottom:12px}
  .login-form select,.login-form input{min-height:46px;font-size:16px}
  .login-form .btn-primary{min-height:54px;margin-top:2px}
  .login-utility-bar{display:grid;grid-template-columns:auto minmax(0,1fr);gap:10px;padding:10px 10px 6px;margin-top:14px}
  .login-utility-brand{min-width:0;align-self:stretch}
  .login-utility-brand .brand-mark{width:36px;height:36px;border-radius:11px;font-size:18px}
  .login-utility-brand-copy strong{font-size:11px}
  .login-utility-brand-copy span{font-size:10px;white-space:normal;line-height:1.2}
  .login-utility-actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
  .login-utility-btn{min-height:40px;padding:0 6px;font-size:11px;border-radius:10px;white-space:normal;line-height:1.15;text-align:center}
  .login-form .form-note{display:none}
  .device-store-controls{display:grid;grid-template-columns:1fr;gap:10px}
  .device-role-toggle{min-width:0;width:100%}
  .device-store-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .device-store-actions .btn-table,.device-store-actions .promote-offline,.device-store-actions .revoke-offline{width:100%;min-width:0}
}
@media(max-width:430px){
  .login-mobile-hero strong{font-size:22px}
  .login-form h2{font-size:40px}
  .login-form p{font-size:14px}
  .login-utility-bar{grid-template-columns:1fr}
  .login-utility-brand{justify-content:flex-start}
}

/* VER1.0032 visible Admin unlink control */
.unlink-device-prominent{background:#b91c1c!important;border-color:#b91c1c!important;color:#fff!important;font-weight:900!important;letter-spacing:.035em;box-shadow:0 4px 12px rgba(185,28,28,.16)}
.unlink-device-prominent:hover{background:#991b1b!important;border-color:#991b1b!important;color:#fff!important}

/* VER1.0039 Device Archive & Historical Review */
.archive-device-prominent{background:#7f1d1d!important;border-color:#7f1d1d!important;color:#fff!important;font-weight:900!important;letter-spacing:.025em}
.archive-device-prominent:hover{background:#641717!important;border-color:#641717!important;color:#fff!important}
.device-history-count{display:inline-flex;min-width:1.55rem;height:1.55rem;align-items:center;justify-content:center;border-radius:999px;padding:0 .4rem;background:rgba(0,0,0,.08);font-size:.75rem;font-weight:800;margin-left:.3rem}
.device-archive-kpis{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}.device-archive-kpis span{border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:12px;background:var(--surface,#fff)}.device-archive-kpis strong{font-size:1.15rem;margin-right:.25rem}@media(max-width:640px){.device-archive-kpis{grid-template-columns:1fr}}


/* ================================================================
   VER1.0040 — Global Search / Help Center
   ================================================================ */
.topbar-tool-button{min-height:40px;display:inline-flex;align-items:center;gap:7px;padding:0 10px;border:1px solid var(--line);border-radius:11px;background:#fff;color:#475569;font:inherit;font-size:.76rem;font-weight:800;cursor:pointer}.topbar-tool-button:hover,.topbar-tool-button:focus-visible{border-color:var(--orange-border);background:var(--orange-soft);color:var(--orange-dark);outline:none}.topbar-tool-button>span{font-size:1rem}.topbar-tool-button kbd,.global-search-input-wrap kbd,.global-search-footer kbd,.help-topic-card kbd{font:700 .68rem/1 system-ui;padding:4px 6px;border:1px solid #cbd5e1;border-bottom-width:2px;border-radius:6px;background:#f8fafc;color:#64748b;white-space:nowrap}.global-command-modal{z-index:10050}.global-search-card{width:min(720px,calc(100vw - 28px));max-height:min(78vh,760px);overflow:hidden;align-self:flex-start;margin-top:min(12vh,110px);padding:0}.global-search-header{display:flex;justify-content:space-between;gap:16px;align-items:center;padding:18px 20px 10px}.global-search-header h3{margin:3px 0 0}.global-search-input-wrap{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;margin:0 20px 12px;padding:0 12px;border:1px solid var(--orange-border);border-radius:13px;background:#fff;box-shadow:0 0 0 3px rgba(249,115,22,.08)}.global-search-input-wrap>span{color:var(--orange-dark);font-size:1.15rem}.global-search-input-wrap input{width:100%;min-height:48px;border:0;outline:0;background:transparent;font:inherit;font-size:1rem;color:var(--ink)}.global-search-results{max-height:min(50vh,480px);overflow:auto;padding:0 12px 12px}.global-search-result{width:100%;display:flex;align-items:center;justify-content:space-between;gap:16px;text-align:left;padding:11px 12px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--ink);cursor:pointer}.global-search-result span{min-width:0}.global-search-result strong,.global-search-result small{display:block}.global-search-result strong{font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.global-search-result small{margin-top:3px;color:var(--muted);font-size:.74rem}.global-search-result>b{color:#94a3b8}.global-search-result:hover,.global-search-result.active{background:var(--orange-soft);border-color:var(--orange-border)}.global-search-result.active>b{color:var(--orange-dark)}.global-search-empty{padding:28px 16px;text-align:center;color:var(--muted)}.global-search-footer{display:flex;gap:16px;flex-wrap:wrap;padding:10px 20px 14px;border-top:1px solid var(--line);background:#f8fafc;color:#64748b;font-size:.7rem}.global-help-card{width:min(900px,calc(100vw - 28px));max-height:min(88vh,900px)}.help-topic-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.help-topic-card{scroll-margin-top:14px;padding:15px;border:1px solid var(--line);border-radius:13px;background:#fff}.help-topic-card:target{border-color:var(--orange);box-shadow:0 0 0 3px rgba(249,115,22,.1)}.help-topic-card strong{display:block;font-size:.95rem}.help-topic-card p{margin:7px 0 10px;color:#64748b;font-size:.82rem;line-height:1.5}.help-topic-card a{color:var(--orange-dark);font-size:.8rem;font-weight:800;text-decoration:none}.device-access-badge.pending-lease{background:#fff7ed;color:#c2410c;border-color:#fdba74}.device-lease-note{display:block;margin-top:6px;color:#166534;font-size:.72rem}.device-lease-note.warning{color:#c2410c}@media(max-width:920px){.global-search-trigger b,.help-trigger b,.global-search-trigger kbd{display:none}.topbar-tool-button{width:40px;justify-content:center;padding:0}.help-topic-grid{grid-template-columns:1fr}}@media(max-width:700px){.global-search-card{margin-top:8px;max-height:calc(100dvh - 16px)}.global-search-header{padding:15px 15px 9px}.global-search-input-wrap{margin:0 12px 10px}.global-search-footer{padding:9px 14px}.global-search-results{max-height:calc(100dvh - 190px)}}

/* ================================================================
   VER1.0039 — Offline Authority search + System Settings + Login hardening
   ================================================================ */
.system-settings-heading{margin-bottom:16px}
.system-settings-form{display:grid;gap:18px;max-width:860px}
.system-settings-card{padding:20px;border:1px solid var(--line);border-radius:16px;background:#fff;box-shadow:0 10px 30px rgba(15,23,42,.04)}
.system-settings-card-head{margin-bottom:16px}.system-settings-card-head h3{margin:6px 0 5px;font-size:18px}.system-settings-card-head p{margin:0;color:var(--muted);font-size:12px;line-height:1.55}
.system-settings-field{display:grid;gap:7px}.system-settings-field>span{font-size:12px;font-weight:800;color:#475569}.system-settings-field select{width:100%;min-height:46px}
.system-settings-preview{display:grid;gap:4px;margin-top:14px;padding:14px;border:1px solid #fed7aa;border-radius:12px;background:#fff7ed}.system-settings-preview span,.system-settings-preview small{color:#7c2d12;font-size:11px}.system-settings-preview strong{color:#9a3412;font-size:16px}
.system-settings-actions{display:flex;justify-content:flex-end;position:sticky;bottom:10px;padding:12px;border:1px solid var(--line);border-radius:14px;background:rgba(255,255,255,.94);backdrop-filter:blur(8px);box-shadow:0 8px 24px rgba(15,23,42,.08)}
.system-settings-actions .btn-primary{min-width:180px}

/* Search row uses a real icon element rather than a label pseudo-element. */
.device-access-search-row{grid-template-columns:minmax(0,1fr) max-content!important}
.device-access-search:before{content:none!important}
.device-access-search input[type="search"]{padding-left:50px!important;padding-right:48px!important;text-indent:0!important}
.device-access-search-icon{left:14px!important}
.device-access-result-count{min-width:max-content;text-align:right}
@media(max-width:780px){.device-access-search-row{grid-template-columns:1fr!important}.device-access-result-count{text-align:left;min-width:0}}

/* Mobile/tablet login hardening. Desktop remains the two-panel presentation. */
html.login-root,html.login-root body.login-page{width:100%;min-width:0;min-height:100%;margin:0}
body.login-page{overscroll-behavior:none}
@media(max-width:1024px){
  html.login-root,html.login-root body.login-page{height:100%;min-height:100svh;background:#f8fafc;overflow:hidden}
  body.login-page .login-shell,body.login-page .login-form-panel,body.login-page .login-shell--form-only .login-form-panel{width:100%;min-height:100svh;height:100dvh;max-height:100dvh}
  body.login-page .login-shell{display:block;background:linear-gradient(180deg,#fff,#fff7ed)}
  body.login-page .login-brand{display:none!important}
  body.login-page .login-form-panel{display:grid;place-items:center;padding:max(18px,env(safe-area-inset-top,0px)) max(18px,env(safe-area-inset-right,0px)) max(18px,env(safe-area-inset-bottom,0px)) max(18px,env(safe-area-inset-left,0px));overflow:hidden}
  body.login-page .login-form{width:min(520px,100%);max-width:520px;min-height:0!important;height:auto;padding:clamp(18px,3.5vw,30px);border:1px solid #e5e7eb;border-radius:22px;background:rgba(255,255,255,.96);box-shadow:0 18px 50px rgba(15,23,42,.10);overflow:visible!important}
  body.login-page .login-mobile-hero{display:flex;margin-bottom:10px}
  body.login-page .login-mobile-hero .brand-mark{width:50px;height:50px;border-radius:15px;font-size:24px}
  body.login-page .login-mobile-hero strong{font-size:clamp(22px,4vw,30px)}
  body.login-page .login-form>.eyebrow{font-size:11px}
  body.login-page .login-form h2{font-size:clamp(34px,6vw,46px);line-height:1;margin:7px 0 7px}
  body.login-page .login-form>p{margin:0 0 14px;font-size:14px;line-height:1.45}
  body.login-page .login-form label{margin-bottom:11px;gap:6px}
  body.login-page .login-form label>span{font-size:11px}
  body.login-page .login-form select,body.login-page .login-form input{min-height:48px;font-size:16px;border-radius:11px}
  body.login-page .password-field button{min-width:58px;min-height:44px}
  body.login-page .login-form .btn-primary{min-height:52px;margin-top:1px;border-radius:11px}
  body.login-page .login-utility-bar{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:10px;margin-top:12px;padding:9px;border-radius:13px;overflow:visible}
  body.login-page .login-utility-actions{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;min-width:0}
  body.login-page .login-utility-btn{width:100%;min-width:0;min-height:42px;padding:0 6px;white-space:normal;text-align:center;line-height:1.1}
  body.login-page .form-note{display:none}
}
@media(max-width:600px){
  body.login-page .login-form-panel{place-items:start stretch;padding:14px 14px calc(14px + env(safe-area-inset-bottom,0px))}
  body.login-page .login-form{width:100%;max-width:none;padding:16px;border-radius:18px;box-shadow:0 10px 28px rgba(15,23,42,.08)}
  body.login-page .login-mobile-hero{margin-bottom:7px}
  body.login-page .login-mobile-hero .brand-mark{width:44px;height:44px;border-radius:13px;font-size:21px}
  body.login-page .login-form h2{font-size:36px}
  body.login-page .login-form>p{font-size:13px;margin-bottom:10px}
  body.login-page .login-form label{margin-bottom:9px}
  body.login-page .login-form select,body.login-page .login-form input{min-height:46px}
  body.login-page .login-form .btn-primary{min-height:50px}
  body.login-page .login-utility-bar{grid-template-columns:1fr;margin-top:10px}
  body.login-page .login-utility-brand{display:none}
  body.login-page .login-utility-btn{min-height:40px;font-size:11px}
}
@media(max-height:700px) and (max-width:1024px){
  body.login-page .login-form-panel{place-items:start center;padding-top:10px;padding-bottom:10px}
  body.login-page .login-form{padding:14px 18px}
  body.login-page .login-mobile-hero{margin-bottom:5px}
  body.login-page .login-mobile-hero .brand-mark{width:40px;height:40px;border-radius:12px;font-size:19px}
  body.login-page .login-mobile-hero strong{font-size:22px}
  body.login-page .login-form>.eyebrow{font-size:10px}
  body.login-page .login-form h2{font-size:32px;margin:5px 0}
  body.login-page .login-form>p{font-size:12px;margin-bottom:8px}
  body.login-page .login-form label{margin-bottom:7px}
  body.login-page .login-form select,body.login-page .login-form input{min-height:42px}
  body.login-page .login-form .btn-primary{min-height:46px}
  body.login-page .login-utility-bar{margin-top:8px;padding:7px}
  body.login-page .login-utility-btn{min-height:38px}
}
/* Keyboard-only escape hatch: page remains fixed normally, but fields stay reachable
   when a mobile/tablet on-screen keyboard substantially reduces visualViewport. */
body.login-page.login-keyboard-open .login-form-panel{overflow-y:auto!important;align-items:start!important}
body.login-page.login-keyboard-open .login-form{margin:auto 0;min-height:0!important}

/* VER1.0039 mobile/tablet login centering hardening.
   Normal phone/tablet view stays centered both vertically and horizontally. */
@media (max-width:1024px){
  body.login-page .login-form-panel{
    display:grid!important;
    place-items:center!important;
    align-content:center!important;
    justify-content:stretch!important;
  }
  body.login-page .login-form{
    width:min(520px,100%)!important;
    max-width:520px!important;
    margin:0 auto!important;
  }
}
@media (max-width:600px){
  body.login-page .login-form-panel{
    place-items:center!important;
    align-content:center!important;
    padding:max(12px,env(safe-area-inset-top,0px)) max(14px,env(safe-area-inset-right,0px)) max(12px,env(safe-area-inset-bottom,0px)) max(14px,env(safe-area-inset-left,0px))!important;
  }
  body.login-page .login-form{
    width:min(480px,100%)!important;
    max-width:480px!important;
  }
}
@media (max-height:700px) and (max-width:1024px){
  body.login-page:not(.login-keyboard-open) .login-form-panel{
    place-items:center!important;
    align-content:center!important;
  }
}
body.login-page.login-keyboard-open .login-form-panel{
  place-items:start center!important;
  align-content:start!important;
  overflow-y:auto!important;
}
body.login-page.login-keyboard-open .login-form{
  margin:0 auto!important;
}

/* VER1.0039 Legacy Transfer Integration Center */
.legacy-transfer-heading{align-items:flex-start;gap:18px}.legacy-transfer-heading-actions{display:flex;flex-wrap:wrap;gap:10px;justify-content:flex-end}.legacy-transfer-rule code,.legacy-contract-card code{font-weight:800}.legacy-contract-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:0 0 18px}.legacy-contract-card{margin:0;min-width:0}.legacy-contract-card h3{margin:5px 0 8px}.legacy-contract-card p{margin:0 0 10px;color:var(--muted,#64748b)}.legacy-contract-actions{display:flex;gap:12px;flex-wrap:wrap}.legacy-contract-actions a{font-weight:800;color:#c2410c;text-decoration:none}.legacy-import-panel{margin-bottom:18px}.legacy-import-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:14px;align-items:end}.legacy-file-picker{min-width:0}.legacy-file-picker input[type=file]{width:100%;min-height:46px;padding:8px;border:1px solid #d8dee8;border-radius:10px;background:#fff}.legacy-file-picker small{display:block;margin-top:6px;color:#64748b}.legacy-import-result{display:flex;flex-wrap:wrap;gap:10px;margin-top:12px;padding:12px 14px;border:1px solid #bbf7d0;background:#f0fdf4;border-radius:10px}.legacy-import-result span{padding-left:10px;border-left:1px solid #86efac}.legacy-transfer-stats{margin-bottom:18px}.legacy-transfer-filter-grid{grid-template-columns:minmax(240px,1fr) minmax(190px,.42fr) minmax(120px,.22fr)}.legacy-error-count,.legacy-validation-message{display:block;margin-top:5px;color:#b91c1c}.legacy-import-history-panel{margin-top:18px}.legacy-detail-meta{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-bottom:16px}.legacy-detail-meta>div{border:1px solid #e2e8f0;border-radius:10px;padding:10px 12px;background:#f8fafc}.legacy-detail-meta span{display:block;font-size:.78rem;color:#64748b;margin-bottom:4px}.legacy-detail-meta strong{display:block}.legacy-receive-grid,.legacy-finalize-grid{grid-template-columns:minmax(0,1fr) auto;align-items:end}.legacy-receive-action{display:flex;align-items:end}.legacy-receive-qty{width:92px;min-height:40px;text-align:right}.legacy-variance{font-weight:800;color:#b45309}.status-badge.legacy-expected{background:#fff7ed;color:#c2410c}.status-badge.legacy-partial{background:#eff6ff;color:#1d4ed8}.status-badge.legacy-received{background:#ecfdf5;color:#047857}.status-badge.legacy-discrepancy{background:#fef2f2;color:#b91c1c}.status-badge.legacy-exception{background:#fef2f2;color:#b91c1c}.status-badge.legacy-completed{background:#ecfdf5;color:#047857}.status-badge.legacy-completed_with_exceptions{background:#fff7ed;color:#c2410c}.status-badge.legacy-duplicate{background:#f1f5f9;color:#475569}.status-badge.legacy-failed{background:#fef2f2;color:#b91c1c}.button-spinner{display:inline-block;width:14px;height:14px;border:2px solid currentColor;border-right-color:transparent;border-radius:50%;animation:legacy-spin .7s linear infinite;vertical-align:-2px}@keyframes legacy-spin{to{transform:rotate(360deg)}}
@media (max-width:980px){.legacy-contract-grid{grid-template-columns:1fr}.legacy-detail-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.legacy-transfer-filter-grid{grid-template-columns:1fr 1fr}.legacy-transfer-filter-grid label:first-child{grid-column:1/-1}}
@media (max-width:640px){.legacy-transfer-heading-actions{width:100%;justify-content:stretch}.legacy-transfer-heading-actions .btn-secondary{flex:1 1 100%;text-align:center}.legacy-import-row,.legacy-receive-grid,.legacy-finalize-grid{grid-template-columns:1fr}.legacy-import-row .btn-primary,.legacy-receive-action>*{width:100%}.legacy-detail-meta{grid-template-columns:1fr 1fr}.legacy-transfer-filter-grid{grid-template-columns:1fr}.legacy-transfer-filter-grid label:first-child{grid-column:auto}.legacy-import-result{display:grid;grid-template-columns:1fr 1fr}.legacy-import-result span{padding-left:0;border-left:0}.legacy-detail-table{min-width:980px}}

/* VER1.0056 global non-blocking action feedback */
button.is-processing,input.is-processing{cursor:progress}
.action-processing-text{vertical-align:middle}
.colerosh-task-progress{position:fixed;z-index:100000;top:max(10px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(440px,calc(100vw - 28px));padding:10px 12px;border:1px solid rgba(15,23,42,.14);border-radius:12px;background:rgba(255,255,255,.97);box-shadow:0 10px 30px rgba(15,23,42,.18);pointer-events:none;color:#0f172a}
.colerosh-task-progress[hidden]{display:none!important}.colerosh-task-progress-head{display:flex;align-items:center;gap:8px;font-size:.86rem}.colerosh-task-progress-head strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.colerosh-task-progress-head [data-task-percent]{margin-left:auto;font-variant-numeric:tabular-nums}.colerosh-task-progress-status{margin-top:4px;font-size:.75rem;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.colerosh-task-progress-track{height:5px;margin-top:8px;border-radius:999px;overflow:hidden;background:#e2e8f0}.colerosh-task-progress-track span{display:block;height:100%;width:0;background:currentColor;border-radius:inherit;transition:width .2s ease}.colerosh-task-progress.is-indeterminate .colerosh-task-progress-track span{width:38%;animation:colerosh-progress-slide 1.05s ease-in-out infinite}@keyframes colerosh-progress-slide{0%{transform:translateX(-120%)}100%{transform:translateX(340%)}}
@media (prefers-reduced-motion:reduce){.colerosh-task-progress.is-indeterminate .colerosh-task-progress-track span{animation-duration:2s}.action-spinner{animation-duration:1.2s}}

/* VER1.0056 · Shared Barcode Scanner Viewfinder 2.1 */
.scanner-capability-controls{
    display:flex;flex-wrap:wrap;align-items:end;gap:10px;margin:10px 0 0;padding:10px;
    border:1px solid #e5e7eb;border-radius:12px;background:#f8fafc
}
.scanner-capability-controls label{display:grid;gap:4px;min-width:150px;margin:0}
.scanner-capability-controls label>span{font-size:.72rem;font-weight:700;color:#64748b;text-transform:uppercase;letter-spacing:.04em}
.scanner-camera-select,.scanner-control-button,.scanner-zoom{min-height:44px}
.scanner-camera-select{width:min(100%,320px);padding:8px 10px;border:1px solid #cbd5e1;border-radius:9px;background:#fff}
.scanner-control-button{padding:8px 13px;border:1px solid #fdba74;border-radius:9px;background:#fff7ed;color:#9a3412;font-weight:700;cursor:pointer}
.scanner-control-button[aria-pressed="true"]{background:#9a3412;color:#fff;border-color:#9a3412}
.scanner-zoom-field{flex:1 1 190px}.scanner-zoom{width:100%;accent-color:#f97316}
.camera-status[data-scanner-state="duplicate"]{color:#9a3412}
.camera-status[data-scanner-state="paused"]{color:#475569}
@media(max-width:560px){.scanner-capability-controls{display:grid;grid-template-columns:1fr}.scanner-capability-controls label{min-width:0}.scanner-camera-select{width:100%}}


/* VER1.0056 — dependency-free transaction notifications + device registration feedback */
.colerosh-toast-host{position:fixed;z-index:2147483000;top:max(14px,env(safe-area-inset-top));right:max(14px,env(safe-area-inset-right));display:grid;gap:10px;width:min(420px,calc(100vw - 28px));pointer-events:none}
.colerosh-toast{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:12px;padding:13px 14px;border-radius:12px;border:1px solid #cbd5e1;background:#fff;color:#0f172a;box-shadow:0 16px 40px rgba(15,23,42,.22);opacity:0;transform:translateY(-8px);transition:opacity .18s ease,transform .18s ease;pointer-events:auto}
.colerosh-toast.show{opacity:1;transform:translateY(0)}.colerosh-toast-success{border-left:5px solid #16a34a}.colerosh-toast-error{border-left:5px solid #dc2626}.colerosh-toast-warning{border-left:5px solid #d97706}.colerosh-toast-info{border-left:5px solid #2563eb}
.colerosh-toast-message{font-size:.88rem;line-height:1.4;font-weight:700}.colerosh-toast-close{border:0;background:transparent;color:#475569;font-size:1.25rem;line-height:1;cursor:pointer;padding:0 2px;min-width:28px;min-height:28px}
.device-registration-result{margin-top:14px;outline:none}.device-registration-result-body{margin-top:6px;line-height:1.45}.device-row-created{animation:colerosh-device-created 1.1s ease-in-out 0s 3;background:#f0fdf4!important}@keyframes colerosh-device-created{50%{box-shadow:inset 0 0 0 2px #22c55e}}
@media(max-width:640px){.colerosh-toast-host{left:14px;right:14px;width:auto}}
@media(prefers-reduced-motion:reduce){.colerosh-toast{transition:none}.device-row-created{animation:none;box-shadow:inset 0 0 0 2px #22c55e}}


/* VER1.0056 · Shared Barcode Scanner Viewfinder 2.1 */
.camera-scan-shell{
    --scanner-accent:#72f3cf;
    --scanner-mask:rgba(2,8,23,.58);
}
.camera-scan-frame.scanner-viewfinder,
.camera-scan-frame[data-scanner-mode]{
    inset:auto;
    left:50%;
    top:50%;
    transform:translate(-50%,-50%);
    width:min(84%,720px);
    height:clamp(96px,25%,148px);
    border:1px solid rgba(255,255,255,.22);
    border-radius:14px;
    box-shadow:0 0 0 9999px var(--scanner-mask),0 0 0 1px rgba(15,23,42,.18) inset;
    background:
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) left top/34px 4px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) left top/4px 34px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) right top/34px 4px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) right top/4px 34px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) left bottom/34px 4px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) left bottom/4px 34px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) right bottom/34px 4px no-repeat,
        linear-gradient(var(--scanner-accent),var(--scanner-accent)) right bottom/4px 34px no-repeat;
    transition:border-color .16s ease,box-shadow .16s ease,background-color .16s ease,width .2s ease,height .2s ease;
}
.camera-scan-frame[data-scanner-mode="square"]{
    width:min(68%,340px);
    height:auto;
    aspect-ratio:1/1;
}
.camera-scan-frame[data-scanner-mode="linear"]{
    width:min(84%,720px);
    height:clamp(96px,25%,148px);
    aspect-ratio:auto;
}
.camera-scan-frame .scanner-scan-line,
.camera-scan-frame[data-scanner-mode] > span{
    position:absolute;
    left:8%;
    right:8%;
    top:12%;
    height:2px;
    background:var(--scanner-accent);
    box-shadow:0 0 12px var(--scanner-accent),0 0 2px #fff;
    animation:coleroshViewfinderSweep 1.65s ease-in-out infinite alternate;
    opacity:.95;
}
.scanner-viewfinder-guide{
    position:absolute;
    z-index:4;
    top:14px;
    left:50%;
    transform:translateX(-50%);
    max-width:calc(100% - 28px);
    padding:6px 10px;
    border:1px solid rgba(255,255,255,.28);
    border-radius:999px;
    background:rgba(2,8,23,.72);
    color:#fff;
    font-size:.76rem;
    font-weight:800;
    line-height:1.2;
    text-align:center;
    letter-spacing:.01em;
    box-shadow:0 6px 18px rgba(2,8,23,.22);
    pointer-events:none;
}
.camera-scan-shell[data-scanner-state="confirming"],
.camera-scan-shell[data-scanner-state="lookup"]{--scanner-accent:#f59e0b}
.camera-scan-shell[data-scanner-state="success"]{--scanner-accent:#22c55e}
.camera-scan-shell[data-scanner-state="error"],
.camera-scan-shell[data-scanner-state="multiple"]{--scanner-accent:#ef4444}
.camera-scan-shell[data-scanner-state="duplicate"]{--scanner-accent:#fb923c}
.camera-scan-shell[data-scanner-state="paused"]{--scanner-accent:#94a3b8}
.camera-scan-shell[data-scanner-state="lookup"] .scanner-scan-line,
.camera-scan-shell[data-scanner-state="paused"] .scanner-scan-line{animation-play-state:paused;opacity:.48}
.camera-scan-shell[data-scanner-state="success"] .camera-scan-frame{box-shadow:0 0 0 9999px rgba(2,8,23,.52),0 0 0 3px rgba(34,197,94,.26),0 0 28px rgba(34,197,94,.35)}
.camera-scan-shell[data-scanner-state="error"] .camera-scan-frame,
.camera-scan-shell[data-scanner-state="multiple"] .camera-scan-frame{box-shadow:0 0 0 9999px rgba(2,8,23,.60),0 0 0 3px rgba(239,68,68,.24),0 0 24px rgba(239,68,68,.28)}
@keyframes coleroshViewfinderSweep{from{top:12%}to{top:86%}}
@media (orientation:landscape) and (max-height:620px){
    .camera-scan-frame[data-scanner-mode="linear"]{width:min(78%,760px);height:clamp(82px,34%,132px)}
    .camera-scan-frame[data-scanner-mode="square"]{width:min(46%,280px)}
    .scanner-viewfinder-guide{top:8px}
}
@media(max-width:560px){
    .camera-scan-frame[data-scanner-mode="linear"]{width:88%;height:clamp(92px,24%,132px)}
    .camera-scan-frame[data-scanner-mode="square"]{width:min(72%,300px)}
    .scanner-viewfinder-guide{font-size:.72rem;padding:5px 9px}
}
@media(prefers-reduced-motion:reduce){
    .camera-scan-frame .scanner-scan-line,
    .camera-scan-frame[data-scanner-mode] > span{animation:none;top:50%}
}


/* VER1.0056 · Sales payment policy toggle */
.system-settings-toggle{display:flex;align-items:flex-start;gap:12px;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fff;cursor:pointer}.system-settings-toggle>input{position:absolute;opacity:0;pointer-events:none}.system-settings-toggle-control{position:relative;flex:0 0 48px;width:48px;height:28px;border-radius:999px;background:#cbd5e1;transition:.18s ease}.system-settings-toggle-control::after{content:"";position:absolute;top:4px;left:4px;width:20px;height:20px;border-radius:50%;background:#fff;box-shadow:0 2px 5px rgba(15,23,42,.22);transition:.18s ease}.system-settings-toggle>input:checked+.system-settings-toggle-control{background:var(--orange)}.system-settings-toggle>input:checked+.system-settings-toggle-control::after{transform:translateX(20px)}.system-settings-toggle>input:focus-visible+.system-settings-toggle-control{outline:3px solid rgba(249,115,22,.2);outline-offset:2px}.system-settings-toggle-copy{display:grid;gap:4px}.system-settings-toggle-copy strong{font-size:.92rem}.system-settings-toggle-copy small{color:var(--text);line-height:1.45}

/* VER1.0056 · Tablet-first full-feature operational shell */
.tablet-action-dock,.tablet-tools-drawer{display:none}
@media (max-width:1180px),(max-width:1600px) and (hover:none) and (pointer:coarse){
 body.tablet-operational-ui{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
 body.tablet-operational-ui .content{padding:18px 16px 36px}
 body.tablet-operational-ui .topbar{height:72px;padding:0 16px;gap:10px}
 body.tablet-operational-ui .topbar h1{font-size:17px}body.tablet-operational-ui .topbar p{font-size:11px}
 body.tablet-operational-ui button,body.tablet-operational-ui .btn-primary,body.tablet-operational-ui .btn-secondary,body.tablet-operational-ui .btn-danger,body.tablet-operational-ui .btn-table{min-height:44px}
 body.tablet-operational-ui input:not([type=checkbox]):not([type=radio]),body.tablet-operational-ui select,body.tablet-operational-ui textarea{font-size:16px;min-height:44px}
 body.tablet-operational-ui .filter-grid,body.tablet-operational-ui .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 body.tablet-operational-ui .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
 body.tablet-operational-ui .stat-card{min-height:90px;padding:14px}body.tablet-operational-ui .stat-card strong{font-size:22px}
 body.tablet-operational-ui .panel{padding:16px}body.tablet-operational-ui .page-actions{margin-bottom:16px;gap:12px}
 body.tablet-operational-ui .modal-card{width:min(980px,calc(100vw - 20px));max-height:calc(100dvh - 20px);margin:10px;display:flex;flex-direction:column}
 body.tablet-operational-ui .modal-card.modal-xl{width:min(1180px,calc(100vw - 16px))}
 body.tablet-operational-ui .modal-body{overflow:auto;overscroll-behavior:contain;min-height:0}
 body.tablet-operational-ui .modal-footer{position:sticky;bottom:0;z-index:4;background:#fff;border-top:1px solid var(--line);padding-bottom:max(12px,env(safe-area-inset-bottom))}
 body.tablet-operational-ui .table-scroll{scrollbar-width:auto}
 body.tablet-operational-ui .data-table th,body.tablet-operational-ui .data-table td{padding:11px 10px}
 body.tablet-operational-ui .data-table.tablet-sticky-actions th:last-child,body.tablet-operational-ui .data-table.tablet-sticky-actions td:last-child{position:sticky;right:0;z-index:3;background:#fff;box-shadow:-10px 0 14px -14px rgba(15,23,42,.55);min-width:92px}
 body.tablet-operational-ui .data-table.tablet-sticky-actions thead th:last-child{z-index:5;background:#f8fafc}
 body.tablet-operational-ui .data-table.tablet-sticky-actions td:last-child .btn-table,body.tablet-operational-ui .data-table.tablet-sticky-actions td:last-child button{min-height:40px}
 .tablet-table-hint{margin-bottom:7px;padding:7px 10px}
 .tablet-action-dock{position:fixed;z-index:8000;left:50%;bottom:max(8px,env(safe-area-inset-bottom));transform:translateX(-50%);display:grid;grid-auto-flow:column;grid-auto-columns:minmax(52px,1fr);width:auto;max-width:calc(100vw - 20px);padding:6px;gap:4px;border:1px solid rgba(15,23,42,.12);border-radius:18px;background:rgba(255,255,255,.97);box-shadow:0 14px 40px rgba(15,23,42,.2);backdrop-filter:blur(12px)}
 .tablet-action-dock[hidden]{display:none!important}.tablet-action-dock button{position:relative;display:grid;place-items:center;min-width:52px;min-height:52px;padding:0;border:0;border-radius:14px;background:transparent;color:#334155}.tablet-action-dock button:active,.tablet-action-dock button:focus-visible{background:var(--orange-soft);color:var(--orange-dark)}.tablet-dock-icon{font-size:20px;line-height:1}.tablet-dock-badge{position:absolute;top:5px;right:5px;display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 4px;border-radius:999px;background:#ea580c;color:#fff;font-size:10px;font-style:normal;font-weight:800}.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
 .tablet-tools-drawer{position:fixed;inset:0;z-index:12000;display:block}.tablet-tools-drawer[hidden]{display:none!important}.tablet-tools-scrim{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(15,23,42,.52)}.tablet-tools-sheet{position:absolute;right:0;top:0;bottom:0;width:min(430px,92vw);display:flex;flex-direction:column;background:#fff;box-shadow:-18px 0 45px rgba(15,23,42,.24);padding:max(16px,env(safe-area-inset-top)) 14px max(18px,env(safe-area-inset-bottom));overflow:hidden}.tablet-tools-sheet header{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:0 2px 12px;border-bottom:1px solid var(--line)}.tablet-tools-sheet header span{font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--orange-dark);font-weight:800}.tablet-tools-sheet h2{margin:3px 0 0;font-size:20px}.tablet-tools-close{width:44px;height:44px;border:0;border-radius:12px;background:#f8fafc;font-size:26px}.tablet-tools-list{display:grid;gap:8px;padding:12px 0;overflow:auto;overscroll-behavior:contain}.tablet-tool-proxy{width:100%;min-height:48px;text-align:left;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:#fff;color:var(--ink);font-weight:700}.tablet-tool-proxy:disabled{opacity:.5}.tablet-tools-empty{color:var(--muted);font-size:13px}
 body.tablet-tools-open{overflow:hidden}
}
@media(max-width:700px){body.tablet-operational-ui .content{padding:14px 10px 30px}body.tablet-operational-ui .filter-grid,body.tablet-operational-ui .form-grid,body.tablet-operational-ui .stat-grid{grid-template-columns:1fr}body.tablet-operational-ui .topbar-actions .topbar-badge{display:none}.tablet-table-hint{font-size:10px}.tablet-tools-sheet{width:100vw}.tablet-action-dock{max-width:calc(100vw - 12px);bottom:max(4px,env(safe-area-inset-bottom));border-radius:15px}.tablet-action-dock button{min-width:48px;min-height:48px}}


/* VER1.0056 · Compact tablet scanner workspace + Quick Scan + Messaging */
.camera-modal-card{width:min(620px,100%)}
.camera-scan-shell,.compact-camera-shell{min-height:0;height:clamp(160px,22dvh,220px);border-radius:12px}
.camera-scan-shell>video,.compact-camera-shell>video{min-height:0!important;height:100%!important;max-height:220px;object-fit:cover}
.camera-scan-frame[data-scanner-mode="linear"],.camera-scan-frame.scanner-viewfinder{height:clamp(72px,48%,104px);width:min(88%,620px)}
.camera-scan-frame[data-scanner-mode="square"]{width:min(44%,180px);height:auto}
.scanner-viewfinder-guide{top:7px;font-size:.68rem;padding:4px 8px}
.scanner-capability-controls{margin:7px 0 0!important;padding:7px!important;gap:6px!important;align-items:center!important}
.scanner-capability-controls label{min-width:110px!important}.scanner-camera-select,.scanner-control-button,.scanner-zoom{min-height:36px!important;font-size:.78rem}.scanner-zoom-field{flex:1 1 130px!important}
.camera-status{margin:7px 0 0;min-height:1.2em;font-size:.76rem}
.compact-scan-workspace{padding:14px}.compact-scan-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:stretch}.quick-scan-input{margin:0}.compact-camera-area{margin-top:10px}.compact-camera-area[hidden]{display:none!important}
.quick-product-result{display:grid;gap:14px;margin-top:14px}.quick-product-head{display:flex;justify-content:space-between;gap:18px;align-items:flex-start}.quick-product-head h3{margin:3px 0 5px}.quick-product-head p{margin:0;color:var(--muted)}.quick-product-total{text-align:right;min-width:130px}.quick-product-total span,.quick-product-total small{display:block;color:var(--muted);font-size:.72rem}.quick-product-total strong{display:block;font-size:2rem;color:#166534}.quick-store-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.quick-store-card{padding:12px;border:1px solid var(--line);border-radius:13px;background:#fff}.quick-store-card.has-stock{border-color:#bbf7d0;background:#f0fdf4}.quick-store-card.no-stock{opacity:.72}.quick-store-card header{display:flex;justify-content:space-between;gap:12px}.quick-store-card header strong,.quick-store-card header small{display:block}.quick-store-card header small{margin-top:3px;color:var(--muted);font-size:.72rem}.quick-store-card header>b{font-size:1.25rem;white-space:nowrap}.quick-store-contact{margin:8px 0;font-size:.8rem}.quick-store-contact a{font-weight:800;color:var(--orange-dark);text-decoration:none}.quick-store-staff-list{display:grid;gap:6px}.quick-store-staff{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-top:6px;border-top:1px solid rgba(148,163,184,.2)}.quick-store-staff strong,.quick-store-staff small{display:block}.quick-store-staff small{font-size:.7rem;color:var(--muted)}
.messaging-page-head p{max-width:720px}.messaging-workspace{display:grid;grid-template-columns:minmax(310px,360px) minmax(0,1fr);gap:18px;min-height:calc(100dvh - 190px);align-items:stretch}.messaging-sidebar{display:flex;flex-direction:column;min-height:0;padding:16px;gap:14px}.messaging-sidebar-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.messaging-sidebar-head h3{margin:0 0 4px}.messaging-sidebar-head p{margin:0;color:var(--muted);font-size:.82rem;line-height:1.45}.messaging-search-wrap{display:grid;gap:6px}.messaging-search-wrap span{font-size:.74rem;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.08em}.message-list-section{display:grid;gap:9px;min-height:0}.message-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:0 2px}.message-section-head strong{font-size:.78rem;text-transform:uppercase;letter-spacing:.08em;color:#334155}.message-section-head small{color:var(--muted);font-size:.74rem}.message-recent-list,.message-contact-list{display:grid;gap:7px;overflow:auto;padding-right:2px}.message-recent-list{max-height:30dvh}.message-contact-list{max-height:46dvh}.message-empty-list{margin:0;padding:14px 12px;border:1px dashed var(--line);border-radius:12px;background:#f8fafc;color:var(--muted);font-size:.85rem}.message-person{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:12px;text-align:left;padding:12px 13px;border:1px solid #e2e8f0;border-radius:16px;background:#fff;color:var(--ink);cursor:pointer;box-shadow:0 2px 10px rgba(15,23,42,.03)}.message-person:hover,.message-person.active{border-color:#c4b5fd;background:linear-gradient(180deg,#ffffff 0%,#f5f3ff 100%);box-shadow:0 12px 26px rgba(124,58,237,.10)}.message-person-avatar,.message-thread-avatar{display:grid;place-items:center;width:42px;height:42px;border-radius:999px;background:#eef2ff;color:#4f46e5;font-weight:800;letter-spacing:.02em;flex:0 0 auto}.message-person-body{min-width:0;display:block}.message-person strong,.message-person small{display:block}.message-person small{margin-top:2px;color:var(--muted);font-size:.74rem;line-height:1.35}.message-person-stores{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.message-unread,.topbar-message-badge{display:inline-grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:999px;background:#7c3aed;color:#fff;font-size:.68rem;font-style:normal;font-weight:800}.message-chevron{color:#94a3b8;font-size:1.2rem;font-weight:700}.messaging-thread-panel{display:flex;min-width:0;min-height:0;padding:0;overflow:hidden;background:linear-gradient(180deg,#f9fafb 0%,#f3f4f6 100%)}.messaging-empty{margin:auto;display:grid;gap:8px;text-align:center;color:var(--muted);padding:30px}.messaging-empty strong{font-size:1.1rem;color:#0f172a}#messageThread{display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;width:100%;min-height:0}.message-thread-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:16px 18px;border-bottom:1px solid var(--line);background:#fff}.message-thread-ident{display:flex;align-items:center;gap:12px;min-width:0}.message-thread-head strong,.message-thread-head span{display:block}.message-thread-head strong{font-size:1.05rem}.message-thread-head span{margin-top:3px;color:var(--muted);font-size:.79rem;line-height:1.35}.message-thread-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}.messaging-mobile-back{display:none}.message-inline-alert{margin:10px 14px 0;padding:11px 12px;border-radius:12px;border:1px solid #fecaca;background:#fef2f2;color:#b91c1c}.message-inline-alert.info{display:none!important}.message-rows{display:flex;flex-direction:column;gap:12px;padding:18px;overflow:auto;background:linear-gradient(180deg,#eef2ff 0%,#f8fafc 35%,#ffffff 100%)}.message-bubble{position:relative;max-width:min(74%,620px);padding:12px 14px 10px;border-radius:20px;background:#fff;border:1px solid #e5e7eb;box-shadow:0 10px 22px rgba(15,23,42,.05)}.message-bubble.incoming{align-self:flex-start;border-bottom-left-radius:8px}.message-bubble.outgoing{align-self:flex-end;color:#fff;background:linear-gradient(135deg,#8b5cf6 0%,#6366f1 100%);border-color:#8b5cf6;border-bottom-right-radius:8px}.message-bubble p{margin:0;white-space:pre-wrap;word-break:break-word;line-height:1.5}.message-bubble small{display:block;margin-top:7px;color:#94a3b8;font-size:.68rem}.message-bubble.outgoing small{color:rgba(255,255,255,.82)}.message-composer{display:grid;gap:8px;padding:14px;border-top:1px solid var(--line);background:#fff}.message-composer-shell{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end;padding:8px 8px 8px 14px;border:1px solid #dbeafe;border-radius:22px;background:linear-gradient(180deg,#ffffff 0%,#f8fafc 100%);box-shadow:inset 0 1px 0 rgba(255,255,255,.65),0 8px 24px rgba(15,23,42,.06)}.message-composer-field{display:grid}.message-composer textarea{resize:none;min-height:50px;max-height:140px;padding:8px 0;border:0;background:transparent;box-shadow:none}.message-composer textarea:focus{outline:0;box-shadow:none}.message-composer textarea::placeholder{color:#94a3b8}.message-composer small{padding:0 6px;color:var(--muted)}.message-send-button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-width:54px;height:54px;padding:0 18px;border:0;border-radius:999px;background:linear-gradient(135deg,#2563eb 0%,#7c3aed 100%);color:#fff;font-weight:800;box-shadow:0 12px 26px rgba(99,102,241,.28);transition:transform .15s ease,box-shadow .15s ease,opacity .15s ease}.message-send-button:hover,.message-send-button:focus-visible{transform:translateY(-1px);box-shadow:0 16px 30px rgba(99,102,241,.34)}.message-send-button:disabled{opacity:.65;cursor:not-allowed;transform:none}.message-send-icon{font-size:1rem;line-height:1;transform:translateX(1px)}.message-send-label{font-size:.92rem;line-height:1}.message-send-button.is-sending .message-send-icon{animation:messageSendPulse .8s linear infinite}.topbar-tool-button.tablet-priority-tool{text-decoration:none}.topbar-message-badge[hidden],.tablet-dock-badge[hidden]{display:none!important}@keyframes messageSendPulse{0%{transform:translateX(1px) scale(1)}50%{transform:translateX(1px) scale(1.16)}100%{transform:translateX(1px) scale(1)}}
@media(max-width:920px){.quick-store-grid{grid-template-columns:1fr}.messaging-workspace{grid-template-columns:1fr;min-height:auto}.messaging-sidebar{max-height:none}.messaging-thread-panel{min-height:58dvh}.compact-scan-toolbar{grid-template-columns:minmax(0,1fr) auto}.compact-scan-toolbar>#quickScanPause{grid-column:2}.quick-product-head{flex-direction:column}.quick-product-total{text-align:left}.message-bubble{max-width:90%}.messaging-thread-open #messageSidebar{display:none}.messaging-thread-open #messageMain{min-height:70dvh}.messaging-mobile-back{display:inline-flex!important;align-items:center;gap:6px}.message-composer-shell{padding:8px 8px 8px 10px}.message-send-button{min-width:52px;width:52px;padding:0}.message-send-label{display:none}}

@media(max-width:560px){.camera-scan-shell,.compact-camera-shell{height:150px!important;min-height:0!important}.camera-scan-shell>video,.compact-camera-shell>video{height:150px!important;min-height:0!important}.scanner-capability-controls{display:flex!important;overflow-x:auto;flex-wrap:nowrap!important}.scanner-zoom-field{min-width:150px}.compact-scan-toolbar{grid-template-columns:1fr 1fr}.quick-scan-input{grid-column:1/-1}.quick-product-total strong{font-size:1.55rem}}

.scanner-capability-controls{display:flex;align-items:center;flex-wrap:wrap}.scanner-advanced-controls{flex:1 1 180px;min-width:150px}.scanner-advanced-controls>summary{list-style:none;cursor:pointer;min-height:36px;display:flex;align-items:center;justify-content:center;padding:6px 10px;border:1px solid #cbd5e1;border-radius:9px;background:#f8fafc;color:#475569;font-size:.76rem;font-weight:800}.scanner-advanced-controls>summary::-webkit-details-marker{display:none}.scanner-advanced-controls[open]>summary{border-color:#fdba74;background:#fff7ed;color:#9a3412}.scanner-advanced-body{display:grid;grid-template-columns:minmax(150px,1fr) minmax(130px,1fr);gap:8px;margin-top:7px;padding:8px;border:1px solid var(--line);border-radius:10px;background:#f8fafc}.scanner-advanced-body label{min-width:0!important}.scanner-advanced-body .scanner-camera-select{width:100%}@media(max-width:560px){.scanner-advanced-controls{flex:1 1 100%}.scanner-advanced-body{grid-template-columns:1fr}}


/* VER1.0058 · Mobile sidebar stacking + tablet/mobile topbar icon-only quick actions */
@media (max-width:1366px),
       (max-width:1600px) and (hover:none) and (pointer:coarse) {
    #sidebar.sidebar {
        z-index:14020 !important;
    }
    #sidebarOverlay.sidebar-overlay {
        z-index:14010 !important;
    }
    body.sidebar-open .tablet-action-dock {
        z-index:7000 !important;
        opacity:0;
        visibility:hidden;
        pointer-events:none;
    }
    #sidebar.sidebar .nav-menu {
        padding-bottom:18px;
        overscroll-behavior:contain;
    }
    #sidebar.sidebar .sidebar-footer {
        position:relative;
        z-index:2;
        flex:0 0 auto;
        padding-bottom:max(20px,env(safe-area-inset-bottom));
        background:#fff;
    }
}

@media (max-width:1180px),
       (max-width:1600px) and (hover:none) and (pointer:coarse) {
    .topbar-tool-button.tablet-priority-tool {
        width:44px;
        min-width:44px;
        height:44px;
        min-height:44px;
        padding:0;
        justify-content:center;
        gap:0;
        position:relative;
    }
    .topbar-tool-button.tablet-priority-tool > b {
        display:none !important;
    }
    .topbar-tool-button.tablet-priority-tool > span {
        font-size:1.18rem;
        line-height:1;
    }
    .topbar-tool-button.tablet-priority-tool .topbar-message-badge {
        position:absolute;
        top:-6px;
        right:-6px;
        min-width:18px;
        height:18px;
        padding:0 4px;
        font-size:10px;
        border:2px solid #fff;
    }
}

@media (max-width:560px) {
    .topbar-actions {
        gap:6px;
    }
    .topbar-tool-button.tablet-priority-tool {
        width:42px;
        min-width:42px;
        height:42px;
        min-height:42px;
    }
}


/* VER1.0060 · Messaging active-user chooser modal + recent-only conversation rail */
.message-new-button{display:inline-flex;align-items:center;gap:7px}.message-new-button>span{font-size:1.15rem;line-height:1}
.messaging-sidebar{overflow:hidden}.message-recent-list{max-height:none;flex:1 1 auto;min-height:140px}.message-choose-person{width:100%;display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:11px;min-height:58px;padding:10px 12px;border:1px dashed #c4b5fd;border-radius:15px;background:#f5f3ff;color:#312e81;text-align:left;cursor:pointer}.message-choose-person>span:first-child{display:grid;place-items:center;width:34px;height:34px;border-radius:999px;background:#7c3aed;color:#fff;font-size:1.2rem}.message-choose-person strong,.message-choose-person small{display:block}.message-choose-person small{margin-top:2px;color:#6d28d9;font-size:.72rem}.message-choose-person>b{font-size:1.2rem;color:#7c3aed}.message-no-conversations{display:grid;justify-items:center;gap:5px;padding:22px 14px;text-align:center;color:var(--muted)}.message-no-conversations>span{display:grid;place-items:center;width:46px;height:46px;border-radius:999px;background:#eef2ff;color:#4f46e5;font-size:1.2rem}.message-no-conversations strong{color:#334155}.message-no-conversations small{font-size:.78rem}
.message-user-modal{position:fixed;inset:0;z-index:15050;display:grid;place-items:center;padding:max(14px,env(safe-area-inset-top)) 14px max(14px,env(safe-area-inset-bottom));}.message-user-modal[hidden]{display:none!important}.message-user-modal-scrim{position:absolute;inset:0;width:100%;height:100%;border:0;background:rgba(15,23,42,.58);backdrop-filter:blur(3px)}.message-user-modal-card{position:relative;z-index:1;width:min(760px,100%);max-height:min(82dvh,760px);display:grid;grid-template-rows:auto auto minmax(0,1fr);overflow:hidden;border:1px solid rgba(148,163,184,.25);border-radius:22px;background:#fff;box-shadow:0 28px 80px rgba(15,23,42,.28)}.message-user-modal-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:20px 20px 15px;border-bottom:1px solid #eef2f7}.message-user-modal-head h3{margin:4px 0 4px;font-size:1.25rem}.message-user-modal-head p{margin:0;color:var(--muted);font-size:.82rem}.message-user-modal-close{flex:0 0 auto;width:44px;height:44px;border:0;border-radius:13px;background:#f8fafc;color:#334155;font-size:26px;cursor:pointer}.message-user-modal-search{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:9px;padding:13px 18px;border-bottom:1px solid #eef2f7;background:#fbfdff}.message-user-modal-search>span{color:#64748b;font-size:1.1rem}.message-user-modal-search input{min-width:0;border:0;background:transparent;box-shadow:none;padding:9px 0}.message-user-modal-search input:focus{outline:0;box-shadow:none}.message-user-modal-search small{color:var(--muted);font-size:.72rem;white-space:nowrap}.message-user-picker-list{display:grid;gap:9px;padding:14px 16px 18px;overflow:auto;overscroll-behavior:contain;background:#f8fafc}.message-user-card{display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:13px;padding:13px 14px;border:1px solid #e2e8f0;border-radius:16px;background:#fff;box-shadow:0 3px 12px rgba(15,23,42,.04)}.message-user-card:hover{border-color:#c4b5fd;box-shadow:0 12px 28px rgba(124,58,237,.10)}.message-user-card-avatar{display:grid;place-items:center;width:48px;height:48px;border-radius:999px;background:linear-gradient(135deg,#eef2ff,#ede9fe);color:#5b21b6;font-weight:900}.message-user-card-info{min-width:0}.message-user-card-info strong,.message-user-card-info span,.message-user-card-info small{display:block}.message-user-card-info span{margin-top:2px;color:#475569;font-size:.78rem}.message-user-card-info small{margin-top:3px;color:var(--muted);font-size:.72rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.message-user-card-actions{display:flex;align-items:center;gap:7px}.message-user-card-actions .btn-primary,.message-user-card-actions .btn-secondary{min-height:40px;padding:8px 12px}.message-user-picker-empty{display:grid;justify-items:center;gap:5px;padding:32px 16px;text-align:center;color:var(--muted)}.message-user-picker-empty strong{color:#334155}.message-user-picker-empty.error strong{color:#b91c1c}body.message-user-modal-open{overflow:hidden}
@media(max-width:920px){.messaging-sidebar{min-height:58dvh}.message-user-modal{padding:0;place-items:stretch}.message-user-modal-card{width:100%;max-height:100dvh;height:100dvh;border-radius:0}.message-user-modal-head{padding-top:max(16px,env(safe-area-inset-top))}.message-user-picker-list{padding-bottom:max(18px,env(safe-area-inset-bottom))}.message-user-card{grid-template-columns:auto minmax(0,1fr)}.message-user-card-actions{grid-column:1/-1;justify-content:flex-end;border-top:1px solid #f1f5f9;padding-top:9px}.message-user-card-actions .btn-primary{min-width:110px}}
@media(max-width:560px){.message-new-button{min-width:44px;width:44px;height:44px;padding:0;justify-content:center;border-radius:999px}.message-new-button{font-size:0}.message-new-button>span{font-size:1.25rem}.message-user-modal-search{grid-template-columns:auto minmax(0,1fr)}.message-user-modal-search small{grid-column:2}.message-user-card-avatar{width:44px;height:44px}.message-user-card-actions{justify-content:stretch}.message-user-card-actions .btn-primary,.message-user-card-actions .btn-secondary{flex:1;text-align:center;justify-content:center}}


/* VER1.0062 · Messaging compact active-user picker + auto-growing composer */
.message-user-modal-card{width:min(700px,100%);max-height:min(78dvh,700px);border-radius:18px}
.message-user-modal-head{gap:12px;padding:14px 16px 10px}.message-user-modal-head h3{margin:2px 0 2px;font-size:1.12rem}.message-user-modal-head p{font-size:.76rem;line-height:1.35}.message-user-modal-close{width:40px;height:40px;border-radius:11px}
.message-user-modal-search{gap:7px;padding:8px 13px}.message-user-modal-search input{padding:7px 0;min-height:38px}.message-user-modal-search small{font-size:.68rem}
.message-user-picker-list{gap:5px;padding:7px 9px 10px;background:#f8fafc}
.message-user-card{grid-template-columns:38px minmax(0,1fr) auto;gap:9px;padding:8px 9px;border-radius:12px;box-shadow:none}
.message-user-card:hover{box-shadow:0 5px 14px rgba(124,58,237,.08)}
.message-user-card-avatar{width:38px;height:38px;font-size:.78rem}
.message-user-card-info{display:grid;gap:1px}.message-user-card-title{display:flex;align-items:baseline;gap:7px;min-width:0}.message-user-card-title strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.88rem}.message-user-card-title>span{flex:0 0 auto;color:#64748b;font-size:.66rem;font-weight:700;text-transform:uppercase;letter-spacing:.03em}
.message-user-card-info>small{margin:0!important;font-size:.67rem!important;line-height:1.25!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#64748b}
.message-user-card-stores{color:#94a3b8!important}
.message-user-card-actions{display:flex;align-items:center;gap:5px;grid-column:auto;border-top:0;padding-top:0}
.message-picker-action{display:inline-flex;align-items:center;justify-content:center;gap:4px;min-height:34px;padding:6px 9px;border:1px solid #e2e8f0;border-radius:10px;background:#fff;color:#475569;font-size:.7rem;font-weight:800;text-decoration:none;cursor:pointer}.message-picker-action.message{border-color:#c4b5fd;background:#f5f3ff;color:#5b21b6}.message-picker-action:hover,.message-picker-action:focus-visible{border-color:#a78bfa;background:#ede9fe;color:#4c1d95}
.message-composer{gap:5px;padding:9px 12px}.message-composer-shell{gap:8px;align-items:end;padding:5px 6px 5px 12px;border-radius:20px}.message-composer-field{align-self:center}.message-composer textarea{box-sizing:border-box;min-height:38px;max-height:128px;height:38px;padding:8px 0;line-height:1.35;overflow-y:hidden}.message-composer small{padding:0 4px;font-size:.67rem}.message-send-button{min-width:46px;height:46px;padding:0 14px}.message-send-label{font-size:.82rem}
@media(max-width:920px){.message-user-modal-card{width:100%;max-height:100dvh;height:100dvh;border-radius:0}.message-user-modal-head{padding:max(10px,env(safe-area-inset-top)) 12px 8px}.message-user-picker-list{padding:5px 7px max(9px,env(safe-area-inset-bottom))}.message-user-card{grid-template-columns:36px minmax(0,1fr) auto;gap:8px;padding:7px 8px}.message-user-card-avatar{width:36px;height:36px}.message-user-card-actions{justify-content:flex-end}.message-picker-action{min-width:36px;min-height:34px;padding:6px 8px}.message-picker-action>span{display:none}.message-composer{padding:8px}.message-composer-shell{padding:4px 5px 4px 10px}.message-send-button{min-width:44px;width:44px;height:44px;padding:0}.message-composer textarea{min-height:36px;height:36px;max-height:112px}}
@media(max-width:560px){.message-user-modal-search{padding:7px 10px}.message-user-modal-search small{grid-column:2}.message-user-card-title>span{display:none}.message-user-card-info>small{font-size:.64rem!important}.message-picker-action{width:34px;min-width:34px;padding:0}.message-composer small{display:none}}


/* VER1.0063 · Singular authenticated web-session takeover notice */
html.session-replaced-lock,html.session-replaced-lock body{overflow:hidden!important}.session-replaced-overlay{position:fixed;inset:0;z-index:40000;display:grid;place-items:center;padding:18px;background:rgba(15,23,42,.72);backdrop-filter:blur(6px)}.session-replaced-card{width:min(480px,100%);padding:24px;border-radius:22px;border:1px solid rgba(255,255,255,.45);background:#fff;box-shadow:0 30px 90px rgba(15,23,42,.35);text-align:center}.session-replaced-icon{width:54px;height:54px;margin:0 auto 12px;display:grid;place-items:center;border-radius:999px;background:#fff7ed;color:#c2410c;font-size:1.5rem;font-weight:900}.session-replaced-card h2{margin:0 0 10px}.session-replaced-card p{margin:7px 0;color:#64748b;line-height:1.55}.session-replaced-card .btn-primary{display:inline-flex;justify-content:center;align-items:center;margin-top:14px;min-height:46px;text-decoration:none}


/* VER1.0064 · Messaging composer viewport pinning */
.messaging-thread-panel{height:calc(100dvh - 190px);max-height:calc(100dvh - 190px);align-self:start}
#messageThread{height:100%;max-height:100%;overflow:hidden}
.message-rows{min-height:0;overscroll-behavior:contain}
.message-composer{position:sticky;bottom:0;z-index:14;box-shadow:0 -10px 26px rgba(15,23,42,.06)}
@media(max-width:920px){.messaging-thread-panel{height:calc(100dvh - 150px);max-height:calc(100dvh - 150px);min-height:480px}.messaging-thread-open #messageMain{height:calc(100dvh - 120px);max-height:calc(100dvh - 120px)}.message-composer{padding-bottom:max(8px,env(safe-area-inset-bottom))}}
@media(max-width:560px){.messaging-thread-panel,.messaging-thread-open #messageMain{height:calc(100dvh - 106px);max-height:calc(100dvh - 106px);min-height:420px}}


/* VER1.0065 · Persistent sidebar context + Messenger/Viber-style chat footer dock */
.nav-menu{scroll-behavior:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.messaging-workspace{height:calc(100dvh - 190px);min-height:560px;align-items:stretch}
.messaging-sidebar{height:100%;min-height:0}
.messaging-thread-panel{position:relative;height:100%;max-height:100%;min-height:0;align-self:stretch;overflow:hidden}
#messageThread{position:relative;display:grid;grid-template-rows:auto auto minmax(0,1fr) auto;height:100%;max-height:100%;min-height:0;overflow:hidden}
.message-rows{min-height:0;overflow-y:auto;overscroll-behavior:contain;scroll-padding-bottom:18px;padding-bottom:18px}
.message-composer{position:relative;inset:auto;bottom:auto;z-index:20;flex:0 0 auto;display:grid;gap:0;margin:0;padding:8px 10px max(8px,env(safe-area-inset-bottom));border-top:1px solid #e5e7eb;background:rgba(255,255,255,.98);box-shadow:0 -8px 24px rgba(15,23,42,.07);backdrop-filter:blur(10px)}
.message-composer>small{display:none!important}
.message-composer-shell{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:7px;padding:4px 5px 4px 13px;border:1px solid #dbe3ee;border-radius:999px;background:#f1f3f5;box-shadow:none}
.message-composer textarea{min-height:36px;height:36px;max-height:128px;padding:7px 2px;line-height:22px;background:transparent;border:0;box-shadow:none;color:var(--ink)}
.message-composer textarea:focus{outline:0;box-shadow:none}
.message-send-button{width:42px;min-width:42px;height:42px;padding:0;border-radius:999px;box-shadow:none}
.message-send-button:hover,.message-send-button:focus-visible{transform:none;box-shadow:0 4px 14px rgba(99,102,241,.24)}
.message-send-label{display:none!important}
.message-send-icon{font-size:1rem}
@media(max-width:920px){.messaging-workspace{height:auto;min-height:0}.messaging-sidebar{height:auto}.messaging-thread-open #messageMain{height:calc(100dvh - 112px);max-height:calc(100dvh - 112px);min-height:0}.messaging-thread-open #messageThread{height:100%;max-height:100%}.message-composer{padding:7px 8px max(7px,env(safe-area-inset-bottom))}.message-composer-shell{padding:3px 4px 3px 11px}.message-send-button{width:40px;min-width:40px;height:40px}.message-composer textarea{min-height:34px;height:34px;max-height:112px;padding:6px 1px}}
@media(max-width:560px){.messaging-thread-open #messageMain{height:calc(100dvh - 96px);max-height:calc(100dvh - 96px)}.message-rows{padding:14px 10px 14px}.message-composer{padding-left:7px;padding-right:7px}}


/* VER1.0067 · ChatGPT-style messaging prompt composer */
.message-composer.chatgpt-style-composer{position:relative;z-index:24;display:block;margin:0;padding:10px 14px max(10px,env(safe-area-inset-bottom));border-top:0;background:linear-gradient(180deg,rgba(255,255,255,0) 0%,rgba(255,255,255,.94) 28%,#fff 58%);box-shadow:none;backdrop-filter:none}
.message-prompt-box{width:100%;display:grid;grid-template-rows:auto auto;gap:2px;padding:10px 10px 8px 16px;border:1px solid #dedede;border-radius:26px;background:#f4f4f4;box-shadow:0 1px 2px rgba(0,0,0,.04),0 5px 18px rgba(15,23,42,.06);transition:border-color .15s ease,box-shadow .15s ease,background .15s ease}
.message-prompt-box:focus-within{border-color:#d2d2d2;background:#f7f7f7;box-shadow:0 1px 2px rgba(0,0,0,.04),0 7px 22px rgba(15,23,42,.08)}
.message-prompt-box textarea#messageBody{box-sizing:border-box;width:100%;min-height:28px;height:28px;max-height:160px;margin:0;padding:5px 4px 2px 0;border:0!important;border-radius:0;background:transparent!important;box-shadow:none!important;outline:0!important;resize:none;overflow-y:hidden;color:#1f2937;font:inherit;font-size:.95rem;line-height:1.45}
.message-prompt-box textarea#messageBody::placeholder{color:#737373;opacity:1}
.message-prompt-toolbar{display:flex;align-items:center;justify-content:space-between;min-height:36px;padding-top:2px}
.message-prompt-spacer{display:block;min-width:1px;min-height:1px}
.message-prompt-box .message-send-button{display:inline-grid;place-items:center;width:36px;min-width:36px;height:36px;margin:0;padding:0;border:0;border-radius:999px;background:#111827;color:#fff;box-shadow:none;transition:transform .12s ease,opacity .12s ease,background .12s ease}
.message-prompt-box .message-send-button:hover,.message-prompt-box .message-send-button:focus-visible{transform:none;background:#000;box-shadow:none;outline:2px solid rgba(17,24,39,.16);outline-offset:2px}
.message-prompt-box .message-send-button:disabled{opacity:.38;background:#6b7280;cursor:not-allowed}
.message-prompt-box .message-send-icon{display:block;font-size:1.18rem;font-weight:900;line-height:1;transform:translateY(-1px)}
.message-prompt-box .message-send-button.is-sending .message-send-icon{animation:messageSendPulse .8s linear infinite}
@media(max-width:920px){.message-composer.chatgpt-style-composer{padding:8px 8px max(8px,env(safe-area-inset-bottom))}.message-prompt-box{padding:9px 9px 7px 14px;border-radius:24px}.message-prompt-box textarea#messageBody{min-height:26px;height:26px;max-height:132px;font-size:16px;line-height:1.4}.message-prompt-toolbar{min-height:34px}.message-prompt-box .message-send-button{width:34px;min-width:34px;height:34px}}
@media(max-width:560px){.message-composer.chatgpt-style-composer{padding-left:7px;padding-right:7px}.message-prompt-box{border-radius:23px}.message-prompt-box textarea#messageBody{max-height:116px}}

/* VER1.0071 · Legacy warehouse XLS preview + destination mapping */
.legacy-department-map-row,.legacy-import-actions{display:flex;align-items:flex-end;gap:.75rem;flex-wrap:wrap}.legacy-department-map-row label{min-width:min(360px,100%);flex:1}.legacy-department-map-row input{text-transform:uppercase}.legacy-import-actions{align-self:flex-end}.legacy-import-preview{margin-top:1rem;border-top:1px solid var(--border,#e5e7eb);padding-top:1rem}.legacy-preview-issues{margin-top:.85rem}.legacy-preview-issues ul{margin:.5rem 0 0 1.2rem}.legacy-preview-issues li+li{margin-top:.3rem}.legacy-validation-message{display:block;margin-top:.35rem;max-width:34rem}.legacy-contract-card code{word-break:break-word}@media(max-width:720px){.legacy-department-map-row,.legacy-import-actions{align-items:stretch}.legacy-department-map-row>*,.legacy-import-actions>*{width:100%}.legacy-import-actions .btn-primary,.legacy-import-actions .btn-secondary{min-height:44px}}

/* VER1.0072 · Legacy Pullout reverse-stock workflow */
.legacy-pullout-import-row{display:grid;grid-template-columns:minmax(220px,.8fr) minmax(280px,1.25fr) auto;align-items:end;gap:1rem}
.legacy-pullout-import-row>label{min-width:0}
.legacy-pullout-heading .page-actions,.legacy-pullout-heading-actions{display:flex;gap:.65rem;flex-wrap:wrap}
.legacy-pullout-post-qty{width:96px;min-width:86px;text-align:right}
.legacy-pullout-post-qty+small{display:block;margin-top:.25rem;white-space:nowrap}
#legacyPulloutPreviewIssues ul{margin:.5rem 0 0 1.2rem}
#legacyPulloutPreviewIssues li+li{margin-top:.3rem}
@media(max-width:980px){.legacy-pullout-import-row{grid-template-columns:1fr 1fr}.legacy-pullout-import-row .legacy-import-actions{grid-column:1/-1}}
@media(max-width:680px){.legacy-pullout-import-row{grid-template-columns:1fr}.legacy-pullout-import-row .legacy-import-actions{grid-column:auto}.legacy-pullout-import-row .legacy-import-actions>*{width:100%;min-height:44px}.legacy-pullout-post-qty{width:84px}}

/* VER1.0074 · Legacy Integration Mapping Center */
.legacy-map-heading{align-items:flex-start}.legacy-map-heading-actions{display:flex;gap:.6rem;flex-wrap:wrap;justify-content:flex-end}.legacy-map-summary-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem;margin:1rem 0}.legacy-map-kpi{padding:1rem 1.1rem}.legacy-map-kpi>span{display:block;color:var(--muted,#64748b);font-size:.74rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase}.legacy-map-kpi>strong{display:block;font-size:1.65rem;line-height:1.1;margin:.35rem 0}.legacy-map-kpi>small{color:var(--muted,#64748b)}.legacy-map-toolbar-panel{margin-bottom:1rem}.legacy-map-toolbar{display:grid;grid-template-columns:minmax(260px,1fr) minmax(320px,1.25fr) auto;gap:1rem;align-items:end}.legacy-map-search>span,.legacy-map-filter-wrap>span{display:block;margin-bottom:.35rem;font-size:.78rem;font-weight:800;color:var(--muted,#64748b);text-transform:uppercase;letter-spacing:.06em}.legacy-map-search input{width:100%}.legacy-map-filter-chips{display:flex;gap:.4rem;flex-wrap:wrap}.legacy-map-filter{border:1px solid var(--border,#dbe3ec);background:var(--surface,#fff);color:var(--text,#172033);border-radius:999px;min-height:40px;padding:.45rem .8rem;font-weight:700;cursor:pointer}.legacy-map-filter.active{border-color:var(--primary,#ff6b1a);box-shadow:0 0 0 2px color-mix(in srgb,var(--primary,#ff6b1a) 18%,transparent)}.legacy-map-unmapped-toggle{display:flex;align-items:center;gap:.55rem;min-height:44px;font-weight:700;white-space:nowrap}.legacy-map-unmapped-toggle input{width:18px;height:18px}.legacy-map-section{margin-top:1.25rem}.legacy-department-mapping-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1rem}.legacy-dept-map-card{padding:1rem}.legacy-dept-map-card.unavailable{border-color:#fecaca}.legacy-dept-map-title,.legacy-map-store-group-head{display:flex;align-items:flex-start;justify-content:space-between;gap:.8rem;margin-bottom:.85rem}.legacy-dept-map-title h4,.legacy-map-store-group-head h4{margin:.12rem 0 0}.legacy-dept-map-card label>span{display:block;font-weight:800;margin-bottom:.4rem}.legacy-map-code-input{text-transform:uppercase;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;letter-spacing:.03em}.legacy-map-code-input.is-dirty{border-color:#f59e0b!important;box-shadow:0 0 0 3px rgba(245,158,11,.15)!important;background:#fffbeb}.legacy-dept-map-card input{width:100%}.legacy-dept-map-card small{display:block;margin-top:.35rem;color:var(--muted,#64748b)}.legacy-dept-map-stats,.legacy-map-group-stats{display:flex;gap:.8rem;flex-wrap:wrap;color:var(--muted,#64748b);font-size:.8rem;margin-top:.8rem}.legacy-store-mapping-groups{display:grid;gap:1rem}.legacy-map-store-group{padding:0;overflow:hidden}.legacy-map-store-group-head{padding:1rem 1rem .7rem;margin:0}.legacy-map-table{min-width:760px}.legacy-map-table td:nth-child(1){min-width:260px}.legacy-map-table td:nth-child(3){min-width:240px}.legacy-map-table .legacy-map-code-input{width:100%;min-height:42px}.legacy-map-store-row td>small{display:block;margin-top:.2rem;color:var(--muted,#64748b)}.legacy-map-no-match,.legacy-map-loading{padding:1.2rem;color:var(--muted,#64748b);text-align:center}.legacy-map-save-dock{position:sticky;bottom:calc(.65rem + env(safe-area-inset-bottom,0px));z-index:35;margin:1rem 0 0;display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.8rem 1rem;box-shadow:0 14px 38px rgba(15,23,42,.18);border-color:#f59e0b}.legacy-map-save-dock[hidden]{display:none}.legacy-map-save-dock>div{display:flex;flex-direction:column;gap:.18rem}.legacy-map-save-dock span{color:var(--muted,#64748b);font-size:.86rem}.status-badge.warning{background:#fff7ed;color:#9a3412;border-color:#fed7aa}.status-badge.neutral{background:#f8fafc;color:#475569;border-color:#e2e8f0}@media(max-width:1100px){.legacy-map-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.legacy-department-mapping-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.legacy-map-toolbar{grid-template-columns:1fr 1fr}.legacy-map-unmapped-toggle{grid-column:1/-1}}@media(max-width:720px){.legacy-map-heading-actions,.legacy-map-heading-actions>*{width:100%}.legacy-map-summary-grid,.legacy-department-mapping-grid,.legacy-map-toolbar{grid-template-columns:1fr}.legacy-map-toolbar>*{grid-column:auto}.legacy-map-filter{min-height:44px}.legacy-map-save-dock{align-items:stretch;flex-direction:column}.legacy-map-save-dock button{width:100%;min-height:48px}.legacy-map-table{min-width:650px}.legacy-map-code-input{font-size:16px}}
.page-action-group,.legacy-mapping-summary-row{display:flex;align-items:center;gap:.65rem;flex-wrap:wrap}.legacy-mapping-summary-row{padding-top:.35rem}.legacy-mapping-summary-row .muted{flex:1;min-width:240px}@media(max-width:720px){.page-action-group,.page-action-group>*{width:100%}}

/* VER1.0079.2 · pending transfer quantity persistence hardening */

/* VER1.0080: make unsaved operational draft fields obvious across tablet/desktop workflows. */
.table-input.input-dirty,
input.input-dirty,
textarea.input-dirty,
select.input-dirty {
    outline: 2px solid rgba(255, 122, 24, .45);
    outline-offset: 1px;
}

#transferItemRows .transfer-item-qty.input-dirty {
    border-color: #ff7a1a;
    box-shadow: 0 0 0 2px rgba(255, 122, 26, 0.12);
}

#transferItemRows .transfer-item-qty.input-invalid {
    border-color: #c62828;
    box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.10);
}

/* 1.82.00 · Staff training period administration */
.user-training-grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:start}
.user-training-grid .form-note{margin-top:6px}
@media (max-width:900px){.user-training-grid{grid-template-columns:1fr}}

.training-list-badge{display:block;margin-top:5px;font-size:.75rem;font-weight:700;color:#c2410c}
/* 1.84.00 Store Encounters + Company Information Center */
.comm-filter-bar{display:flex;gap:12px;align-items:end;justify-content:space-between;flex-wrap:wrap}.comm-filter-bar label{display:grid;gap:5px;min-width:220px}.comm-card-list{display:grid;gap:12px}.comm-card{width:100%;text-align:left;border:1px solid var(--border,#e5e7eb);background:var(--panel,#fff);border-radius:16px;padding:16px;color:inherit;cursor:pointer}.comm-card:hover{border-color:#fb923c;box-shadow:0 8px 24px rgba(15,23,42,.08)}.comm-card.is-unread{border-left:5px solid #f97316}.comm-card-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start}.comm-card-head>div:first-child{display:grid;gap:4px}.comm-card-head small,.comm-card footer{color:var(--muted,#64748b)}.comm-card-head>div:last-child{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}.comm-card p{margin:10px 0}.comm-card footer{display:flex;gap:12px;flex-wrap:wrap;font-size:.82rem}.comm-pill{display:inline-flex;align-items:center;border-radius:999px;padding:4px 8px;font-size:.72rem;font-weight:700;text-transform:uppercase;background:#f1f5f9}.comm-pill.ok{background:#dcfce7;color:#166534}.comm-pill.urgent{background:#fee2e2;color:#991b1b}.comm-pill.important{background:#ffedd5;color:#9a3412}.comm-pill.muted,.comm-pill.normal{background:#f1f5f9;color:#475569}.comm-modal{position:fixed;inset:0;z-index:1200;background:rgba(15,23,42,.58);padding:24px;overflow:auto}.comm-modal-card{max-width:760px;margin:auto;background:var(--panel,#fff);border-radius:20px;padding:20px;box-shadow:0 30px 70px rgba(0,0,0,.24)}.comm-modal-card.wide{max-width:980px}.comm-modal-card>header{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:16px}.comm-modal-card>header button{border:0;background:transparent;font-size:2rem;line-height:1;cursor:pointer}.comm-modal-card form,.comm-modal-card form>label{display:grid;gap:8px}.comm-modal-card form{gap:14px}.comm-modal-card input,.comm-modal-card textarea,.comm-modal-card select{width:100%;min-height:44px}.comm-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.comm-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}.comm-check{display:flex!important;align-items:center;gap:8px}.comm-check input{width:auto!important;min-height:0!important}.comm-targets{border:1px solid var(--border,#e5e7eb);border-radius:14px;padding:14px}.comm-targets select[multiple]{min-height:145px}.comm-detail-meta{display:flex;gap:8px;flex-wrap:wrap;align-items:center;color:var(--muted,#64748b);margin-bottom:14px}.comm-detail-text{line-height:1.65;white-space:normal}.comm-attachments{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px;margin:16px 0}.comm-attachment{display:flex;gap:10px;align-items:center;padding:12px;border:1px solid var(--border,#e5e7eb);border-radius:12px;text-decoration:none;color:inherit}.comm-attachment div{display:grid}.comm-attachment small{color:var(--muted,#64748b)}.comm-receipts{margin-top:20px}.nav-alert-badge{min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#ef4444;color:#fff;font-size:.68rem;display:inline-flex;align-items:center;justify-content:center}
@media(max-width:700px){.comm-grid{grid-template-columns:1fr}.comm-modal{padding:8px}.comm-modal-card{min-height:calc(100dvh - 16px);border-radius:16px}.comm-card-head{display:grid}.comm-card-head>div:last-child{justify-content:flex-start}.comm-actions>*{flex:1 1 160px}}

/* 1.84.01 Readiness Checker Repair + Unified Staff Access */


/* 1.84.02 Company Information receipt status + positive encounter presentation */
.comm-metric-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin:16px 0}.comm-metric-grid>div{border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:12px;background:var(--surface,#fff);display:flex;flex-direction:column;gap:3px}.comm-metric-grid strong{font-size:1.35rem}.comm-metric-grid span{font-size:.78rem;color:var(--muted,#64748b)}@media(max-width:700px){.comm-metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}


/* 1.84.03 Local-first Store Encounter review/final/upload queue */
.encounter-local-panel{display:grid;gap:14px;margin-bottom:18px}
.encounter-local-head{display:flex;gap:16px;align-items:flex-start;justify-content:space-between}
.encounter-local-head h3{margin:.15rem 0 .2rem}
.encounter-local-head p{margin:0;color:var(--muted,#64748b)}
.encounter-local-stats{display:flex;gap:10px;flex-wrap:wrap}
.encounter-local-stats span{display:inline-flex;gap:6px;align-items:center;padding:7px 10px;border:1px solid var(--border,#e5e7eb);border-radius:999px;background:var(--surface,#fff);font-size:.82rem}
.encounter-local-list{display:grid;gap:10px}
.encounter-local-card{border:1px solid var(--border,#e5e7eb);border-radius:14px;padding:14px;background:var(--surface,#fff)}
.encounter-local-card p{margin:10px 0}
.encounter-local-card footer{display:flex;gap:10px;flex-wrap:wrap;color:var(--muted,#64748b);font-size:.8rem}
.encounter-local-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end;margin-top:12px}
.encounter-local-error{margin-top:10px;padding:9px 10px;border-radius:10px;background:#fee2e2;color:#991b1b;font-size:.82rem}
.encounter-local-attachments{display:grid;gap:7px;padding:10px;border:1px dashed var(--border,#cbd5e1);border-radius:12px}
.encounter-local-attachments>div{display:grid;gap:4px;font-size:.82rem;color:var(--muted,#64748b)}
@media(max-width:700px){.encounter-local-head{display:grid}.encounter-local-head>button{width:100%}.encounter-local-actions>*{flex:1 1 130px}}


/* 1.85.00 · Company Info recipient DataTable + responsive topbar icon tray */
.topbar-title{min-width:0}.topbar-title h1,.topbar-title p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.topbar-actions{min-width:0;position:relative;flex-wrap:nowrap}.topbar-overflow-wrap{position:relative;flex:0 0 auto}.topbar-overflow-wrap[hidden]{display:none!important}.topbar-overflow-button{display:inline-grid;place-items:center;width:42px;height:42px;padding:0;border:1px solid var(--line);border-radius:12px;background:#fff;color:#475569;font-size:1.4rem;line-height:1;cursor:pointer}.topbar-overflow-button:hover,.topbar-overflow-button:focus-visible,.topbar-overflow-button[aria-expanded="true"]{border-color:var(--orange-border);background:var(--orange-soft);color:var(--orange-dark);outline:none}.topbar-overflow-tray{position:absolute;right:0;top:calc(100% + 9px);z-index:16000;display:grid;gap:6px;width:min(280px,calc(100vw - 24px));padding:8px;border:1px solid #e2e8f0;border-radius:16px;background:#fff;box-shadow:0 22px 54px rgba(15,23,42,.22)}.topbar-overflow-tray[hidden]{display:none!important}.topbar-overflow-tray .topbar-tool-button,.topbar-overflow-tray .pwa-install-button{width:100%!important;min-width:0!important;height:auto!important;min-height:44px!important;justify-content:flex-start!important;padding:0 12px!important;gap:10px!important;border-radius:11px!important;text-decoration:none}.topbar-overflow-tray .topbar-tool-button>b,.topbar-overflow-tray .tablet-priority-tool>b{display:block!important;font-size:.8rem}.topbar-overflow-tray .topbar-tool-button>span{font-size:1.05rem!important}.topbar-overflow-tray .topbar-tool-button kbd{margin-left:auto}.topbar-overflow-tray .topbar-message-badge{position:static!important;margin-left:auto!important;border:0!important}.topbar-overflow-tray .pwa-install-button:not([hidden]){display:inline-flex!important}
.comm-receipt-datatable{display:grid;gap:10px;margin-top:10px}.comm-dt-toolbar{display:grid;grid-template-columns:minmax(220px,1fr) minmax(180px,.55fr) minmax(92px,.22fr);gap:10px;align-items:end}.comm-dt-toolbar label{display:grid;gap:5px;margin:0}.comm-dt-toolbar label>span{font-size:.68rem;font-weight:850;letter-spacing:.07em;text-transform:uppercase;color:#64748b}.comm-dt-toolbar input,.comm-dt-toolbar select{width:100%;min-height:42px}.comm-dt-scroll{border:1px solid #e2e8f0;border-radius:13px;background:#fff}.comm-dt-table{width:100%;min-width:860px;border-collapse:collapse}.comm-dt-table th,.comm-dt-table td{padding:10px 12px;vertical-align:top;border-bottom:1px solid #eef2f7;text-align:left}.comm-dt-table th{position:sticky;top:0;z-index:1;background:#f8fafc}.comm-dt-table th button{display:inline-flex;align-items:center;gap:6px;padding:0;border:0;background:transparent;color:#334155;font:inherit;font-weight:850;cursor:pointer}.comm-dt-table th button::after{content:'↕';color:#94a3b8;font-size:.72rem}.comm-dt-table th button.active::after{content:attr(data-dir);font-size:.58rem;text-transform:uppercase;color:var(--orange-dark)}.comm-dt-table td strong,.comm-dt-table td small{display:block}.comm-dt-table td small{margin-top:3px;color:#64748b;font-size:.72rem;white-space:nowrap}.comm-dt-status{display:inline-flex;align-items:center;min-height:24px;padding:3px 8px;border-radius:999px;font-size:.67rem;font-weight:850}.comm-dt-status.ok{background:#dcfce7;color:#166534}.comm-dt-status.pending{background:#fff7ed;color:#9a3412}.comm-dt-status.muted{background:#f1f5f9;color:#64748b}.comm-dt-empty{text-align:center!important;color:#64748b;padding:22px!important}.comm-dt-footer{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.comm-dt-footer>span{color:#64748b;font-size:.76rem}.comm-dt-footer>div{display:flex;gap:8px}.comm-dt-footer .btn-secondary{min-height:38px;padding:7px 11px}
@media(max-width:920px){.comm-dt-toolbar{grid-template-columns:minmax(0,1fr) minmax(150px,.6fr)}.comm-dt-toolbar label:last-child{grid-column:1/-1;width:120px}.topbar-overflow-tray{position:fixed;right:10px;top:76px;max-height:calc(100dvh - 92px);overflow:auto}}
@media(max-width:620px){.comm-dt-toolbar{grid-template-columns:1fr}.comm-dt-toolbar label:last-child{grid-column:auto;width:100%}.comm-dt-footer{align-items:stretch;flex-direction:column}.comm-dt-footer>div{display:grid;grid-template-columns:1fr 1fr}.comm-dt-footer .btn-secondary{width:100%}.topbar-title{max-width:min(42vw,220px)}}

/* 1.85.01 draggable tablet/mobile floating action dock */

.tablet-action-dock{user-select:none;-webkit-user-select:none}
.tablet-action-dock.is-positioned{margin:0!important}
.tablet-action-dock.is-dragging{transition:none!important;cursor:grabbing;box-shadow:0 18px 48px rgba(15,23,42,.28)}
.tablet-dock-drag-handle{position:absolute!important;z-index:2;left:50%;top:-13px;transform:translateX(-50%);display:grid!important;place-items:center!important;width:48px!important;min-width:48px!important;height:22px!important;min-height:22px!important;padding:0!important;border:1px solid rgba(15,23,42,.12)!important;border-radius:999px!important;background:rgba(255,255,255,.98)!important;box-shadow:0 5px 14px rgba(15,23,42,.13)!important;color:#64748b!important;cursor:grab!important;touch-action:none!important}
.tablet-dock-drag-handle>span{display:block;width:24px;height:4px;border-radius:999px;background:#94a3b8}
.tablet-dock-drag-handle:focus-visible{outline:3px solid rgba(249,115,22,.20);outline-offset:2px}
.tablet-action-dock.is-dragging .tablet-dock-drag-handle{cursor:grabbing!important;background:#fff7ed!important;border-color:#fdba74!important}
@media(max-width:700px){.tablet-dock-drag-handle{top:-12px;width:44px!important;min-width:44px!important;height:20px!important;min-height:20px!important}}

/* 1.86.00 Concurrent Session Policies */
.session-policy-toolbar{display:flex;gap:12px;flex-wrap:wrap;margin:0 0 14px}.session-policy-toolbar input,.session-policy-toolbar select{min-height:44px;padding:9px 12px;border:1px solid #dfe5ee;border-radius:12px;background:#fff}.session-policy-toolbar input{flex:1 1 280px}.session-policy-toolbar select{flex:0 1 220px}.session-limit-input{width:110px;min-height:42px;padding:8px 10px;border:1px solid #dfe5ee;border-radius:10px}.status-badge.muted{background:#eef2f7;color:#64748b}@media(max-width:700px){.session-policy-toolbar>*{flex:1 1 100%}.session-limit-input{width:92px}}

/* 1.87.00 · Shared COLEROSH DataTable standardization; 1.87.03 toolbar/sort hardening */
.colerosh-datatable{width:100%}
.colerosh-dt-controls{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:0;padding:14px 16px 12px;border-bottom:1px solid #eef2f7;background:#fff}
.colerosh-dt-controls-compact{justify-content:flex-end;padding-top:10px;padding-bottom:10px}
.colerosh-dt-title{display:grid;gap:2px;min-width:180px;margin-right:auto}
.colerosh-dt-title strong{font-size:.9rem;line-height:1.2;color:var(--ink)}
.colerosh-dt-title small{font-size:.7rem;color:var(--muted)}
.colerosh-dt-tools{display:flex;align-items:center;justify-content:flex-end;gap:9px;flex-wrap:wrap;margin-left:auto}
.colerosh-dt-search{width:min(280px,38vw);min-height:40px}
.colerosh-dt-per-page{width:auto;min-width:112px;min-height:40px}
.colerosh-dt-footer{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:0;padding:11px 16px 14px;border-top:1px solid #eef2f7;background:#fff}
.colerosh-dt-info{font-size:.74rem;color:var(--muted)}
.colerosh-dt-nav{display:flex;gap:8px;margin-left:auto}
.colerosh-dt-footer .btn-secondary{min-height:38px;padding:7px 11px}
.colerosh-dt-sortable{cursor:pointer;user-select:none;position:relative;padding-right:22px!important}
.colerosh-dt-sortable::after{content:'↕';position:absolute;right:7px;color:#94a3b8;font-size:.72em}
.colerosh-dt-sortable.dt-sort-active::after{content:'↑';color:var(--orange-dark)}
.colerosh-dt-sortable.dt-sort-active.dt-sort-desc::after{content:'↓'}
.colerosh-dt-scroll{overflow:auto;max-width:100%}
.colerosh-datatable tbody tr.colerosh-dt-row-hidden{display:none!important}
.colerosh-datatable th:last-child,.colerosh-datatable td:last-child:has(button),.colerosh-datatable td:last-child:has(a.btn-secondary),.colerosh-datatable td:last-child:has(a.btn-primary){position:sticky;right:0;background:#fff;z-index:2}
.colerosh-datatable thead th:last-child{z-index:3;background:#f8fafc}
@media(max-width:900px){.colerosh-dt-controls{align-items:stretch}.colerosh-dt-title{flex-basis:100%;min-width:0}.colerosh-dt-tools{width:100%;margin-left:0;display:grid;grid-template-columns:minmax(0,1fr) auto}.colerosh-dt-search{width:100%;min-width:0}.colerosh-dt-footer{align-items:stretch}.colerosh-dt-nav{margin-left:0}.colerosh-dt-footer .btn-secondary{min-height:42px}}
@media(max-width:560px){.colerosh-dt-tools{grid-template-columns:1fr}.colerosh-dt-per-page{width:100%}.colerosh-dt-footer{flex-direction:column}.colerosh-dt-nav{display:grid;grid-template-columns:1fr 1fr;width:100%}.colerosh-dt-nav .btn-secondary{width:100%}}

/* 1.87.02 Session Policy save wiring + full-width workspace */
.session-policy-page{width:100%;max-width:none}.session-policy-page .page-actions{width:100%}.session-policy-page .session-policy-form{display:grid;gap:18px;width:100%;max-width:none}.session-policy-page .system-settings-card{width:100%;max-width:none;box-sizing:border-box}.session-policy-page .table-wrap{width:100%;max-width:100%;overflow:auto}.session-policy-page .session-policy-save-status{background:linear-gradient(180deg,#fff,#f8fafc)}.session-policy-status-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.session-policy-status-grid>div{display:grid;gap:4px;padding:14px;border:1px solid var(--line);border-radius:12px;background:#fff}.session-policy-status-grid span{font-size:.68rem;color:var(--muted);font-weight:800;text-transform:uppercase;letter-spacing:.04em}.session-policy-status-grid strong{font-size:.9rem;color:var(--ink)}.session-policy-page .system-settings-actions{position:sticky;bottom:10px;z-index:8;display:flex;justify-content:flex-end;padding:10px;border:1px solid rgba(226,232,240,.9);border-radius:14px;background:rgba(255,255,255,.94);backdrop-filter:blur(10px)}@media(max-width:760px){.session-policy-status-grid{grid-template-columns:1fr}.session-policy-page .system-settings-card{padding:16px}.session-policy-page .system-settings-actions .btn-primary{width:100%}}

/* 1.87.04 · DataTable browser-autofill and search-state hardening */
.colerosh-dt-search[readonly]{cursor:text;background:#fff;color:var(--ink)}
.colerosh-dt-search:-webkit-autofill{-webkit-text-fill-color:var(--ink);-webkit-box-shadow:0 0 0 1000px #fff inset;box-shadow:0 0 0 1000px #fff inset}

/* 1.87.07: search fields are not credential fields. Trigger a JS scrub when WebKit/Chromium attempts delayed autofill. */
@keyframes colerosh-search-autofill-detected { from { opacity: .999; } to { opacity: 1; } }
input[type="search"]:-webkit-autofill {
    animation-name: colerosh-search-autofill-detected;
    animation-duration: .01s;
    animation-iteration-count: 1;
}


/* 1.88.00 recurring hard-pass checklist */
.hard-pass-panel{margin-bottom:1.25rem}.hard-pass-actions,.hard-pass-toolbar{display:flex;gap:.65rem;align-items:center;flex-wrap:wrap}.hard-pass-toolbar{margin:1rem 0}.hard-pass-toolbar input{flex:1 1 260px;min-width:220px}.hard-pass-groups{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1rem}.hard-pass-group{border:1px solid var(--border-color,#dfe4ea);border-radius:14px;padding:1rem;background:var(--card-bg,#fff)}.hard-pass-group h4{margin:0 0 .75rem}.hard-pass-checks{display:grid;gap:.55rem}.hard-pass-check{display:grid;grid-template-columns:auto 1fr;gap:.65rem;align-items:start;padding:.5rem .55rem;border-radius:9px}.hard-pass-check:hover{background:rgba(127,127,127,.08)}.hard-pass-check input{margin-top:.2rem;width:18px;height:18px}.hard-pass-check.is-complete span{text-decoration:line-through;opacity:.68}.hard-pass-group.is-hidden{display:none}.hard-pass-rule{margin-top:1rem}@media(max-width:900px){.hard-pass-groups{grid-template-columns:1fr}.hard-pass-actions{width:100%}.hard-pass-actions .btn-secondary{flex:1 1 auto}.hard-pass-toolbar>*{flex:1 1 100%}}

/* 1.92.00 — flexible role scope + dedicated workspaces */
.role-workspace-heading{align-items:flex-end}
.role-workspace-table-wrap{margin-top:14px}
.role-workspace-table td{vertical-align:top}
.role-workspace-table td strong,.role-workspace-table td small{display:block}
.role-workspace-table td small{margin-top:4px;color:var(--muted);line-height:1.35}
.role-workspace-table .btn-small{min-height:38px;padding:8px 12px;white-space:nowrap}
.executive-workspace-heading{border-left:4px solid var(--orange);padding-left:16px}
.executive-pnl-note{margin:14px 0 20px}
@media(max-width:900px){.role-workspace-table{min-width:820px}.role-workspace-heading{align-items:stretch}}

/* 1.94.18 — scheduled, store-assigned annual Big Counts */
.stock-count-campaign-panel{margin:0 0 1.25rem;padding:1rem}
.stock-count-campaign-panel>form{display:grid;gap:1rem}
.stock-count-campaign-form{margin-bottom:.25rem}
.stock-count-campaign-panel .table-toolbar{margin:0 0 .7rem}
.stock-count-campaign-list-toolbar{margin-top:1.25rem!important;padding-top:1rem;border-top:1px solid var(--border-color,#e1e6ec)}
.stock-count-campaign-panel table td{vertical-align:middle}
.stock-count-campaign-panel table td strong,.stock-count-campaign-panel table td small{display:block}
.stock-count-campaign-panel table td small{margin-top:3px;color:var(--muted);line-height:1.35}
.stock-count-campaign-panel .big-count-store-check{width:18px;height:18px}
.stock-count-campaign-panel .big-count-promodiser{min-width:220px}
.stock-count-campaign-panel .status-badge{margin-top:4px}
.stock-count-campaign-panel .inline-actions{justify-content:flex-end}
@media(max-width:720px){.stock-count-campaign-panel{padding:.75rem}.stock-count-campaign-form{grid-template-columns:1fr}.stock-count-campaign-panel .big-count-promodiser{min-width:180px}}

/* Keep the legacy catalog upload controls aligned and touch-friendly. */
.catalog-reference-form{display:grid;grid-template-columns:minmax(190px,230px) minmax(280px,1fr) auto;align-items:end;gap:16px;padding-top:16px}
.catalog-reference-form>label{display:grid;gap:7px;min-width:0;color:var(--ink,#1e293b);font-size:.86rem;font-weight:700}
.catalog-reference-form>label>span{line-height:1.25}
.catalog-reference-form input[type="date"],.catalog-reference-form input[type="file"]{box-sizing:border-box;width:100%;min-width:0;min-height:46px;border:1px solid var(--border,#dbe2ea);border-radius:10px;background:#fff;color:var(--ink,#1e293b);font:inherit}
.catalog-reference-form input[type="date"]{padding:0 12px}
.catalog-reference-form input[type="file"]{padding:5px 8px;color:var(--muted,#64748b);font-size:.84rem}
.catalog-reference-form input[type="file"]::file-selector-button{min-height:34px;margin:0 10px 0 0;padding:0 13px;border:1px solid #fed7aa;border-radius:7px;background:#fff7ed;color:#9a3412;font:inherit;font-weight:700;cursor:pointer}
.catalog-reference-form input[type="file"]::file-selector-button:hover{background:#ffedd5}
.catalog-reference-form>.btn-primary{align-self:end;min-width:176px;min-height:46px;padding:0 18px;border-radius:10px;white-space:nowrap}
@media(max-width:900px){.catalog-reference-form{grid-template-columns:minmax(180px,.7fr) minmax(260px,1.3fr)}.catalog-reference-form>.btn-primary{grid-column:1/-1;justify-self:end}}
@media(max-width:560px){.catalog-reference-form{grid-template-columns:minmax(0,1fr);gap:12px}.catalog-reference-form>.btn-primary{grid-column:auto;justify-self:stretch;width:100%}}
.catalog-conflict-review{display:grid;gap:8px;margin-top:10px;min-width:220px}
.catalog-conflict-review label{display:grid;gap:4px;color:var(--muted,#64748b);font-size:.76rem;font-weight:700}
.catalog-conflict-review select,.catalog-conflict-review textarea{box-sizing:border-box;width:100%;border:1px solid var(--border,#dbe2ea);border-radius:8px;background:#fff;color:var(--ink,#1e293b);font:inherit;font-size:.82rem;padding:8px}
.catalog-conflict-review textarea{resize:vertical;min-height:54px}
.catalog-conflict-review .btn-secondary{justify-self:start;min-height:36px}
.catalog-conflict-audit{display:block;margin-top:4px;color:var(--muted,#64748b);font-size:.75rem;font-weight:400}
.catalog-current-stock{min-width:150px;white-space:nowrap}.catalog-current-stock strong,.catalog-current-stock small{display:block}.catalog-current-stock small{margin-top:4px;color:var(--muted,#64748b);font-size:.76rem;white-space:normal}

/* Physical count: consistent field spacing on phones and tablets. */
#stockCountEntryArea .panel-heading { margin-bottom: 16px; }
#stockCountEntryArea .stock-count-scan-row { gap: 12px; }
#stockCountEntryArea .stock-count-search-wrap { margin-top: 16px; margin-bottom: 20px; }
#stockCountSelectedProduct:not([hidden]) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px; padding: 16px; margin: 0 0 20px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
#stockCountSelectedProduct > div:first-child { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
#stockCountSelectedProduct small { display: block; line-height: 1.5; }
#stockCountValueArea { gap: 20px 16px; margin-top: 0; }
#stockCountValueArea > label { display: grid; gap: 8px; min-width: 0; margin: 0; }
#stockCountEntryArea input, #stockCountEntryArea button { min-height: 48px; }
#stockCountEditorModal .stock-count-footer .footer-actions { gap: 12px; }
.executive-month-filter { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 20px 0; }
.executive-month-filter label { display: grid; gap: 8px; }
.executive-month-filter p { flex-basis: 100%; margin: 0; color: var(--muted); }
@media (max-width: 700px) {
    #stockCountSelectedProduct:not([hidden]) { grid-template-columns: minmax(0, 1fr); }
    #stockCountEntryArea { padding: 16px; }
    #stockCountValueArea { grid-template-columns: minmax(0, 1fr); }
    #stockCountEditorModal .stock-count-footer { gap: 16px; }
}

/* Embedded tablet count surface keeps the PWA shell and removes dashboard chrome. */
body.tablet-count-embedded .sidebar, body.tablet-count-embedded .topbar,
body.tablet-count-embedded .tablet-action-dock, body.tablet-count-embedded .tablet-tools-drawer { display: none !important; }
body.tablet-count-embedded .app-shell { display: block; min-height: 100dvh; }
body.tablet-count-embedded .main { margin: 0; width: 100%; }
body.tablet-count-embedded .content { padding: 16px; }
body.tablet-count-embedded .modal-backdrop { padding: 0; }
body.tablet-count-embedded .stock-count-editor,
body.tablet-count-embedded .stock-count-new-modal { width: 100%; max-width: 1180px; max-height: 100dvh; border-radius: 0; }
.executive-month-filter input[type="month"] { min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
.executive-month-filter .btn-primary,.executive-month-filter .btn-secondary { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }

/* Phone web quick tools stay at the bottom, with room for the final content. */
@media (max-width: 700px) {
    body.tablet-operational-ui { --mobile-quick-menu-space: calc(88px + env(safe-area-inset-bottom, 0px)); scroll-padding-bottom: var(--mobile-quick-menu-space); }
    body.tablet-operational-ui .content { padding-bottom: calc(var(--mobile-quick-menu-space) + 20px); }
    body.tablet-operational-ui .tablet-action-dock,
    body.tablet-operational-ui .tablet-action-dock.is-positioned {
        position: fixed; top: auto !important; left: 8px !important; right: 8px !important;
        bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important; transform: none !important;
        width: auto; max-width: none; grid-auto-columns: minmax(0, 1fr);
    }
    body.tablet-operational-ui .tablet-action-dock button { min-width: 0; }
    body.tablet-operational-ui .tablet-dock-drag-handle { display: none !important; }
    body.tablet-operational-ui .modal-backdrop { padding: 10px 0 var(--mobile-quick-menu-space); }
    body.tablet-operational-ui .modal-card { max-height: calc(100dvh - var(--mobile-quick-menu-space) - 20px); margin: 0; }
}

@media (max-width: 700px) {
    body.tablet-operational-ui.modal-open .tablet-action-dock,
    body.tablet-operational-ui:has(input:focus, textarea:focus, select:focus) .tablet-action-dock { display: none !important; }
    body.tablet-operational-ui.modal-open .modal-backdrop { padding: 10px 0; }
    body.tablet-operational-ui.modal-open .modal-card { max-height: calc(100dvh - 20px); }
}

#stockCountSelectedProduct:not([hidden]) { margin-top: 20px; }
@media (max-width: 700px) {
    #stockCountEditorModal .stock-count-footer { flex-direction: column; align-items: stretch; gap: 12px; }
    #stockCountEditorModal .stock-count-footer .footer-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; width: 100%; }
    #stockCountEditorModal .stock-count-footer .footer-actions button { width: 100%; min-width: 0; white-space: normal; }
}

/* Good and damaged count entry */
.stock-count-condition-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;width:100%}.stock-count-condition-fields label{min-width:0;display:flex;flex-direction:column;gap:8px}.stock-count-condition-fields input{min-height:48px;width:100%;box-sizing:border-box}.stock-count-condition-fields input[readonly]{background:#f4f6f8;font-weight:700}#stockCountConditionHelp{margin:0;line-height:1.5}#stockCountConditionSummary{margin:16px 0;line-height:1.6}@media(max-width:600px){.stock-count-condition-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.stock-count-condition-fields label:last-child{grid-column:1/-1}}
/* Linked count variance review: explicit requests and readable explanations. */
.count-variance-panel{margin-top:24px;padding:20px;display:grid;gap:16px}
.count-variance-panel[hidden]{display:none}
.count-variance-panel h3,.count-variance-panel p{margin:0}
.count-variance-filters,.count-variance-inputs{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.count-variance-panel label{display:grid;gap:8px;min-width:0}
.count-variance-panel input,.count-variance-panel select,.count-variance-panel textarea{width:100%;min-height:48px;box-sizing:border-box}
.count-variance-panel textarea{min-height:88px}
.count-variance-line{border:1px solid var(--border-color,#dedede);border-radius:14px;padding:18px;display:grid;gap:16px;margin-top:16px;overflow-wrap:anywhere}
.variance-explanation-field{grid-column:1/-1}
.count-variance-line .save-variance-reason{justify-self:start}
.count-variance-panel .inline-actions{display:flex;gap:12px;flex-wrap:wrap}
@media(max-width:600px){.count-variance-filters,.count-variance-inputs{grid-template-columns:1fr}.count-variance-panel{padding:14px}.count-variance-panel .inline-actions>*{width:100%}}

/* Any open form hides quick tools, including dialogs without a body modal-open class. */
@media(max-width:1180px){
 body.tablet-operational-ui:has(.modal-backdrop.open) .tablet-action-dock{display:none!important}
}
@media(max-width:700px){
 body.tablet-operational-ui:has(.modal-backdrop.open) .modal-backdrop{padding:10px 0}
 body.tablet-operational-ui:has(.modal-backdrop.open) .modal-card{max-height:calc(100dvh - 20px)}
}

.sidebar-account-actions{display:flex;align-items:center;gap:8px;margin-top:12px}.sidebar-footer .sidebar-account-icon{display:grid;place-items:center;width:34px;height:34px;min-height:34px;margin:0;padding:7px;border:1px solid var(--line,#e5e7eb);border-radius:9px;text-decoration:none}.sidebar-footer .sidebar-account-icon:hover,.sidebar-footer .sidebar-account-icon:focus-visible{color:#c2410c;background:#fff7ed;border-color:#fdba74;outline-offset:2px}.sidebar-account-icon svg{display:block;flex-shrink:0}

.sidebar-footer .sidebar-connection-signout{position:relative}.sidebar-connection-signout .connection-dot{position:absolute;right:-3px;top:-3px;width:10px;height:10px;border:2px solid #fff;border-radius:50%;background:#64748b;box-shadow:0 0 0 1px #cbd5e1}.sidebar-connection-signout[data-connection="online"] .connection-dot{background:#15803d}.sidebar-connection-signout[data-connection="offline"] .connection-dot{background:#dc2626}

.sidebar-footer .sidebar-connection-signout[data-connection="online"]{color:#15803d;border-color:#86efac;background:#f0fdf4}.sidebar-footer .sidebar-connection-signout[data-connection="offline"]{color:#dc2626;border-color:#fca5a5;background:#fef2f2}
/* Clip horizontal overflow without creating a vertical scroll ancestor for sticky header. */
@media(min-width:1025px){html,body{overflow-x:clip;overflow-y:visible}.main>.topbar{position:sticky;top:0;z-index:40}}

/* Mobile/tablet: preserve document scrolling so identity offset applies only once. */
@media(max-width:1024px){html,body{overflow-x:clip;overflow-y:visible}body.sidebar-open,body.tablet-tools-open{overflow:hidden}.main>.topbar{position:sticky;z-index:41}}
@media(max-width:700px){body.tablet-operational-ui .topbar{padding-inline:10px;gap:8px}.topbar-title{flex:1 1 0;min-width:0;max-width:none}.topbar-actions{flex:0 0 auto;gap:5px}.topbar-actions .pwa-install-button{max-width:54px;font-size:11px;padding-inline:6px}}

@media(max-width:1180px),(hover:none) and (pointer:coarse){body.has-session-identity .modal-backdrop .modal-card{max-height:calc(100dvh - var(--session-identity-height,28px) - 20px)!important}}
@media(max-width:700px){body.has-session-identity .modal-backdrop .modal-card{max-height:calc(100dvh - var(--session-identity-height,28px))!important}}

@media(max-width:700px){body.has-session-identity.tablet-operational-ui #tabletStagingModal>.modal-card{height:calc(100dvh - var(--session-identity-height,28px))!important;max-height:calc(100dvh - var(--session-identity-height,28px))!important}}

/* Keep header actions usable; overflow script moves complete controls into More. */
.topbar-actions>*{flex-shrink:0}
@media(max-width:920px){.topbar-title{flex:1 1 auto;min-width:min(140px,35vw);max-width:none}.topbar-actions>.topbar-tool-button>b{display:none}.topbar-actions>.topbar-tool-button{width:42px;min-width:42px;padding-inline:0}}

/* Table header standard: compact search/page size next to refresh and preset filters. */
.table-toolbar.table-toolbar-compact{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px}
.table-toolbar-compact>div:first-child:not(.table-header-controls){flex:1 1 200px;min-width:0}
.table-header-controls{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;min-width:0;max-width:100%}
.table-header-controls .colerosh-dt-header-controls{display:block;padding:0;margin:0;border:0;background:transparent;width:auto}
.table-header-controls .colerosh-dt-tools{display:flex;align-items:center;gap:8px;flex-wrap:nowrap;width:auto;margin:0}
.table-header-controls .colerosh-dt-search{width:190px;max-width:100%;min-width:0;min-height:36px;height:36px;padding:7px 10px;font-size:13px}
.table-header-controls .colerosh-dt-per-page{width:64px;min-width:64px;min-height:36px;height:36px;padding:6px 8px;font-size:13px}
.table-toolbar .table-refresh-icon{display:inline-grid;place-items:center;flex:0 0 36px;width:36px;min-width:36px;min-height:36px;height:36px;padding:8px;border-radius:9px}
#registeredDevicesPanel .table-header-controls .device-site-filters{padding:0;margin:0;gap:5px}
#registeredDevicesPanel .table-header-controls .colerosh-dt-controls{padding:0;margin:0;border:0;width:auto}
#registeredDevicesPanel .table-header-controls .colerosh-dt-tools{display:flex;width:auto;gap:8px}
#registeredDevicesPanel .table-header-controls .colerosh-dt-search{width:190px;min-height:36px;height:36px;font-size:13px}
#registeredDevicesPanel .table-header-controls .colerosh-dt-per-page{width:64px;min-width:64px;height:36px;min-height:36px}
@media(max-width:700px){.table-header-controls{justify-content:flex-start;width:100%}.table-header-controls .colerosh-dt-search,#registeredDevicesPanel .table-header-controls .colerosh-dt-search{width:min(190px,calc(100vw - 180px));font-size:16px}.table-toolbar .table-refresh-icon{min-height:36px}.table-header-controls .device-site-filters{flex-basis:100%}}

/* Icon-only actions retain their compact size while busy. */
.is-processing-icon{display:inline-flex!important;align-items:center;justify-content:center;gap:0!important}.is-processing-icon .action-spinner{margin:0;vertical-align:middle;flex:0 0 14px}.is-processing-icon .action-processing-text{display:none!important}

/* Compact header page-size controls never expand to fill search space. */
.table-header-controls .colerosh-dt-search{width:260px;flex:1 1 260px}
.table-header-controls .colerosh-dt-per-page{flex:0 0 62px;width:62px;min-width:62px;max-width:62px}

/* Icon controls keep a square border box even when shared button rules add padding. */
.table-toolbar .table-header-controls .table-refresh-icon{box-sizing:border-box!important;aspect-ratio:1;flex:0 0 36px!important;width:36px!important;min-width:36px!important;max-width:36px!important;height:36px!important;min-height:36px!important;max-height:36px!important;padding:0!important;align-self:center;line-height:1}
.table-toolbar .table-refresh-icon svg{display:block;width:18px;height:18px;margin:0}
#registeredDevicesPanel .table-header-controls .table-refresh-icon{flex-basis:32px!important;width:32px!important;min-width:32px!important;max-width:32px!important;height:32px!important;min-height:32px!important;max-height:32px!important;border-radius:8px}

/* Pairing is a child workflow: retain the staging sheet beneath it. */
#pairingSessionModal,#pairingRevealModal{z-index:1100}

/* Pairing presentation is centered around the QR and hardware barcode. */
#pairingRevealModal .modal-card{text-align:center}
#pairingRevealModal .modal-header{position:relative;justify-content:center;padding-inline:56px}
#pairingRevealModal .modal-header>div{flex:1;min-width:0;text-align:center}
#pairingRevealModal .modal-header .modal-close{position:absolute;right:16px;top:16px}
#pairingRevealModal .modal-body,#pairingRevealModal .modal-body label,#pairingRevealModal .modal-body p,#pairingRevealModal .modal-body small,#pairingRevealModal .modal-body input{text-align:center}
#pairingRevealModal .modal-footer,#pairingRevealModal .table-action-group{justify-content:center}
#pairingRevealModal .modal-subtitle{margin-inline:auto}

/* Compact pairing content forms one continuous, centered panel. */
#pairingRevealModal .modal-card{width:min(540px,100%)}
#pairingRevealModal .modal-header{padding:14px 48px 10px;gap:8px}
#pairingRevealModal .modal-header h3{margin:3px 0;font-size:20px;line-height:1.25}
#pairingRevealModal .modal-subtitle{margin-top:4px;margin-bottom:0;font-size:13px;line-height:1.4}
#pairingRevealModal .modal-body{padding:12px 16px}
#pairingRevealModal .modal-body label{margin:0 0 8px;gap:5px}
#pairingRevealModal #revealedPairingBlock{margin:8px 0 0;padding:10px 12px}
#pairingRevealModal #revealedPairingBlock>small{font-size:12px;line-height:1.35}
#pairingRevealModal #revealedPairingBlock>p{margin:8px 0;font-size:13px;line-height:1.4}
#pairingRevealModal #revealedPairingBlock .table-action-group{margin-top:8px!important;gap:6px}
#pairingRevealModal .modal-footer{padding:10px 16px;gap:8px}
#pairingRevealModal #pairingRevealCountdown{font-size:12px}

/* Pairing footer actions share dimensions without replacing their visual styles. */
#pairingRevealModal .modal-footer{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
#pairingRevealModal .modal-footer>button{box-sizing:border-box;flex:1 1 100px;width:auto;min-width:0;min-height:40px;height:40px;padding:8px 10px;font-size:13px;line-height:20px;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center}
#pairingRevealModal .modal-footer>button[hidden]{display:none!important}

/* Keep the equal-size pairing action group anchored to the right edge. */
#pairingRevealModal .modal-footer{justify-content:flex-end}
#pairingRevealModal .modal-footer>button{flex:0 0 104px;width:104px}
@media(max-width:480px){#pairingRevealModal .modal-footer>button{flex-basis:92px;width:92px;padding-inline:6px}}

/* Existing-account department switching fits beside the current role badge. */
.department-switcher{display:inline-flex;align-items:center;flex:0 0 auto;margin:0;min-width:0}
.department-switcher select{box-sizing:border-box;width:124px;min-width:0;max-width:150px;height:36px;min-height:36px;margin:0;padding:6px 26px 6px 10px;border:1px solid #fed7aa;border-radius:9px;background-color:#fff7ed;color:#9a3412;font:inherit;font-size:12px;font-weight:750}
@media(max-width:700px){.department-switcher select{width:112px;max-width:112px;font-size:12px}}

/* Sidebar identity and account actions share a compact footer without an avatar. */
#sidebar.sidebar .sidebar-footer{box-sizing:border-box;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:10px;padding:14px 18px max(14px,env(safe-area-inset-bottom));min-width:0;background:#fff}
#sidebar.sidebar .sidebar-footer .user-mini{display:block;min-width:0;margin:0}
#sidebar.sidebar .sidebar-footer .user-mini>div{min-width:0}
#sidebar.sidebar .sidebar-footer .user-mini strong{max-width:none;white-space:normal;overflow-wrap:anywhere;line-height:1.35;font-size:13px}
#sidebar.sidebar .sidebar-footer .user-mini span{max-width:none;font-size:11px;line-height:1.35}
#sidebar.sidebar .sidebar-account-actions{display:flex;align-items:center;gap:6px;margin:0;flex-shrink:0}
#sidebar.sidebar .sidebar-account-actions .sidebar-account-icon{box-sizing:border-box;width:34px;min-width:34px;max-width:34px;height:34px;min-height:34px;max-height:34px;flex:0 0 34px;padding:7px}
#sidebar.sidebar .sidebar-connection-signout .connection-dot{right:2px;top:2px;width:8px;height:8px;border-width:1px;box-shadow:none}


/* Responsive spacing pass: prevent intrinsic-width children from widening cards. */
.content :is(.page-actions,.panel-heading,.table-toolbar,.form-grid,.filter-grid,.section-title),
.modal-card :is(.modal-header,.modal-body,.modal-footer,.form-grid,.filter-grid){min-width:0;max-width:100%}
:is(.form-grid,.filter-grid)>label,.modal-header>div,.panel-heading>div,.page-actions>div{min-width:0}
:is(.form-grid,.filter-grid)>label{row-gap:8px}
:is(.form-grid,.filter-grid) :is(input,select,textarea){max-width:100%;min-width:0}
.modal-header h3,.modal-subtitle,.modal-header p{overflow-wrap:anywhere}
.modal-header p{line-height:1.45;margin-bottom:0}
.modal-header>.modal-close{flex-shrink:0}
.modal-footer{gap:8px;flex-wrap:wrap}
.content .table-responsive,.content .table-wrap:not(.coordinator-mobile-table-wrap){max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain}
.session-policy-form,.session-policy-form>.system-settings-card,.system-settings-card-head{min-width:0;max-width:100%}
.session-policy-form>.system-settings-card{overflow-wrap:anywhere}
/* Search shrinks inside the card; the numeric page size stays compact. */
.table-header-controls{min-width:0;max-width:100%;gap:8px}
.table-header-controls .colerosh-dt-header-controls{min-width:0;max-width:100%;flex:1 1 250px}
.table-header-controls .colerosh-dt-tools{min-width:0;max-width:100%;width:100%}
.table-header-controls .colerosh-dt-search{width:100%;min-width:0;max-width:100%;flex:1 1 0}
.table-header-controls .colerosh-dt-per-page{flex:0 0 62px;width:62px;min-width:62px;max-width:62px}
/* A one-time tablet location is a field group, separate from account selection. */
.device-location-config{padding:14px;margin:0 0 16px;border:1px solid var(--line);border-radius:12px;background:#fffaf5}
.device-location-config>label{display:grid;gap:8px;min-width:0}
.device-location-config>label>span{font-size:11px;font-weight:750;color:#64748b}
.device-location-config p{margin:10px 0 12px;font-size:12px;line-height:1.45;overflow-wrap:anywhere}
@media(max-width:900px){
 .table-toolbar{flex-wrap:wrap;gap:12px}
 .table-toolbar>div:first-child{min-width:0}
 .table-header-controls .colerosh-dt-header-controls{flex-basis:220px}
}
@media(max-width:700px){
 .content .page-actions{gap:12px;flex-wrap:wrap}
 .modal-header,.modal-footer{padding:14px 16px}
 .modal-header{align-items:flex-start;gap:10px}
 .modal-body{padding:16px}
 .modal-header h3{line-height:1.25}
 .modal-body :is(input,select,textarea):not([type=checkbox]):not([type=radio]){font-size:16px}
 .modal-footer :is(.btn-primary,.btn-secondary){min-height:44px;white-space:normal;max-width:100%}
 .table-header-controls .colerosh-dt-header-controls{flex:1 1 100%;width:100%}
 .table-header-controls .colerosh-dt-tools{display:flex;gap:8px}
 .table-header-controls .colerosh-dt-search{font-size:16px;width:100%;flex:1 1 0}
 #registeredDevicesPanel .table-header-controls .colerosh-dt-header-controls{width:100%;flex:1 1 100%}
 #registeredDevicesPanel .table-header-controls .colerosh-dt-tools{width:100%;min-width:0}
 #registeredDevicesPanel .table-header-controls .colerosh-dt-search{width:100%;min-width:0;flex:1 1 0}
 .colerosh-dt-footer{gap:10px;padding:12px 14px}
 .colerosh-dt-nav{gap:8px;min-width:0}
 .colerosh-dt-nav .btn-secondary{font-size:12px;min-width:0;padding-inline:10px}
 .device-location-config{padding:12px}
}


/* Tablet quick tools stay on the lower edge rather than covering summary cards. */
@media(min-width:701px) and (max-width:1180px){
 body.tablet-operational-ui{--tablet-bottom-tools-space:calc(88px + env(safe-area-inset-bottom,0px));scroll-padding-bottom:var(--tablet-bottom-tools-space)}
 body.tablet-operational-ui .content{padding-bottom:calc(var(--tablet-bottom-tools-space) + 20px)}
 body.tablet-operational-ui .tablet-action-dock,body.tablet-operational-ui .tablet-action-dock.is-positioned{position:fixed;top:auto!important;left:auto!important;right:16px!important;bottom:max(12px,env(safe-area-inset-bottom,0px))!important;transform:none!important;width:min(460px,calc(100vw - 32px));max-width:calc(100vw - 32px);grid-auto-columns:minmax(0,1fr)}
 body.tablet-operational-ui .tablet-dock-drag-handle{display:none!important}
 body.tablet-operational-ui .tablet-action-dock button{min-width:0}
}
