@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
    color-scheme: light;
    --navy: #092b50;
    --blue: #1769e0;
    --cyan: #13a8c7;
    --ink: #152b43;
    --muted: #718198;
    --line: #e3eaf2;
    --bg: #f3f6fb;
    --green: #07845d;
    --orange: #dc7412;
    --red: #c53b42;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(ellipse at 90% 0, rgb(222 237 255 / 50%), transparent 32rem),
        var(--bg);
    color: var(--ink);
    font-family: 'Prompt', system-ui, sans-serif;
    font-size: 14px;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    min-height: 76px;
    padding: 0 30px;
    color: #fff;
    background: linear-gradient(112deg, #062447, #0b3b6b 72%, #12528b);
    box-shadow: 0 8px 24px rgb(9 43 80 / 14%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand b {
    font-size: 20px;
    letter-spacing: .2px;
}

.brand b span {
    color: #78b9ff;
}

.brand small {
    display: block;
    color: #a9c2dc;
    font-size: 10px;
    letter-spacing: 1.7px;
}

.brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 15px;
    background: #e5f2ff;
    color: #0b4b91;
    font-size: 26px;
}

.brand-mark.small {
    width: 42px;
    height: 42px;
}

.userbox {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
}

.user-name {
    color: #e6eff8;
}

.role-pill {
    border-color: rgb(255 255 255 / 20%);
    background: rgb(255 255 255 / 12%);
    color: #dcecff;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .5px;
}

.logout-link {
    color: #d6e7f7;
}

.logout-link:hover {
    background: rgb(255 255 255 / 12%);
    color: white;
}

.app {
    display: grid;
    min-height: calc(100vh - 76px);
    grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
    position: relative;
    border-right: 1px solid var(--line);
    background: rgb(255 255 255 / 88%);
    padding: 26px 14px;
}

.side-caption {
    padding: 0 12px 12px;
    color: #95a2b3;
    font-size: 11px;
    letter-spacing: 1px;
}

.sidebar-menu {
    gap: 5px;
    padding: 0;
}

.sidebar-menu li > a {
    min-height: 44px;
    border-radius: 11px;
    color: #566a80;
    font-size: 13px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.sidebar-menu li > a:hover {
    background: #f0f6ff;
    color: #1258b5;
    transform: translateX(2px);
}

.sidebar-menu li > a.active {
    background: linear-gradient(110deg, #e5f0ff, #f1f7ff);
    color: #1258b5;
    font-weight: 600;
    box-shadow: inset 3px 0 #1769e0;
}

.sidebar-menu li > a.is-current {
    background: linear-gradient(110deg, #e5f0ff, #f1f7ff);
    color: #1258b5;
    font-weight: 600;
    box-shadow: inset 3px 0 #1769e0;
}

.top-navigation a.is-current {
    background: rgb(255 255 255 / 16%);
    color: #fff;
}

.sidebar-bottom {
    position: sticky;
    top: 90vh;
    margin: 60px 8px 0;
    color: #8392a5;
    font-size: 11px;
}

.dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 6px;
    border-radius: 50%;
    background: #0ca678;
    box-shadow: 0 0 0 4px #0ca67818;
}

.content {
    width: 100%;
    max-width: 1800px;
    margin: auto;
    padding: 30px;
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.eyebrow {
    margin: 0 0 5px;
    color: #3978be;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1.5px;
}

.page-head h1 {
    margin: 0 0 4px;
    color: #102c4b;
    font-size: 27px;
    font-weight: 600;
}

.muted {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.date-chip {
    height: auto;
    padding: 10px 14px;
    border-color: #d9e6f5;
    background: #fff;
    color: #63758b;
    font-size: 12px;
    font-weight: 500;
}

.stock-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-flow: row;
    gap: 14px;
    margin-bottom: 20px;
    overflow: visible;
    background: transparent;
}

.stock-stats .stat {
    position: relative;
    min-width: 0;
    min-height: 138px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    padding: 19px;
    box-shadow: 0 5px 18px rgb(16 46 77 / 4%);
}

.stock-stats .stat > span {
    display: block;
    margin: 7px 0;
    color: #61738a;
    font-size: 12px;
}

.stock-stats .stat strong {
    display: block;
    color: #102c4b;
    font-size: 29px;
    line-height: 1.2;
}

.stock-stats .stat small {
    color: #91a0b0;
    font-size: 11px;
}

.stat-icon {
    position: absolute;
    top: 17px;
    right: 16px;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 12px;
    font-size: 19px;
}

.blue {
    background: #e8f1ff;
    color: #246fe0;
}

.cyan {
    background: #e2f9fc;
    color: #0b9bb6;
}

.orange {
    background: #fff1df;
    color: #d4770a;
}

.green {
    background: #e1f8ee;
    color: #08865f;
}

.panel {
    margin-bottom: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 5px 18px rgb(16 46 77 / 4%);
}

.panel-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-title h2 {
    margin: 0 0 4px;
    color: #153554;
    font-size: 17px;
    font-weight: 600;
}

.panel-title p {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.inventory-header-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.btn-danger,
.btn-danger-outline {
    border-color: #c53b42;
    color: #b4232a;
}

.btn-danger {
    background: #c53b42;
    color: #fff;
}

.btn-danger:hover {
    border-color: #a92e35;
    background: #a92e35;
}

.btn-danger-outline:hover {
    border-color: #c53b42;
    background: #fff4f4;
    color: #a92e35;
}

.stock-clear-warning {
    margin-bottom: 14px;
    border: 1px solid #f2c6c8;
    border-radius: 10px;
    background: #fff7f7;
    padding: 12px;
    color: #8f252b;
}

.stock-clear-warning p {
    margin: 5px 0 0;
    color: #7b5a5c;
    font-size: 12px;
}

.stock-clear-confirm {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 12px 0;
}

.stock-clear-confirm input {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    accent-color: #c53b42;
}

.issue-panel {
    border-top: 3px solid var(--blue);
}

.stock-product-row {
    cursor: pointer;
}

.stock-product-row:hover td {
    background: #eff6ff;
}

.stock-product-row.is-linked-product td {
    background: #dbeafe;
}

.issue-panel > .card-body,
.panel.card > .card-body {
    gap: 0;
    padding: 0;
}

.scan-grid {
    display: grid;
    grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr);
    gap: 16px;
}

.scan-box {
    border: 1px dashed #b6cbe3;
    border-radius: 13px;
    background: #f7faff;
    padding: 22px;
    text-align: center;
}

.scan-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    margin: 0 auto 10px;
    border-radius: 17px;
    background: #e2efff;
    color: #1668d5;
    font-size: 30px;
}

.scan-box h3 {
    margin: 0 0 6px;
    font-size: 15px;
}

.scan-box p {
    margin-bottom: 15px;
}

.search-box label,
label {
    display: block;
    margin-bottom: 7px;
    color: #50647a;
    font-size: 12px;
    font-weight: 500;
}

input,
select {
    width: 100%;
    color: var(--ink);
    font: inherit;
}

.input,
.select {
    min-height: 44px;
    border-color: #d6e0eb;
    border-radius: 10px;
    background: #fff;
    box-shadow: none;
}

.input:focus,
.select:focus {
    border-color: #4c92f4;
    outline: 3px solid rgb(23 105 224 / 10%);
    outline-offset: 0;
}

.product-results {
    max-height: 205px;
    margin-top: 8px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}

.result-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid #edf1f6;
    background: #fff;
    padding: 10px 12px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.result-item:hover {
    background: #f0f6ff;
}

.result-item b,
.result-item small {
    display: block;
}

.result-item b,
.result-item strong {
    font-size: 12px;
}

.result-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.result-item strong {
    white-space: nowrap;
}

.qty-low {
    color: var(--red);
}

.selected-product {
    display: flex;
    min-height: 90px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 18px 0 14px;
    border: 1px solid #e2eaf4;
    border-radius: 12px;
    background: linear-gradient(120deg, #f4f8fd, #fbfdff);
    padding: 15px 17px;
}

.selected-product h3 {
    margin: 2px 0;
    font-size: 16px;
}

.selected-product p {
    margin: 3px 0;
    font-size: 12px;
}

.selected-product small {
    color: var(--muted);
    font-size: 11px;
}

.empty-state {
    color: #8998aa;
    font-size: 12px;
}

.stock-number {
    min-width: 70px;
    text-align: right;
}

.stock-number strong {
    display: block;
    color: #125fbd;
    font-size: 25px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 15px;
}

.btn {
    min-height: 42px;
    border-radius: 10px;
    font-family: 'Prompt', system-ui, sans-serif;
    font-weight: 500;
    transition: transform .18s ease, box-shadow .18s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    border-color: #1769e0;
    background: linear-gradient(110deg, #1769e0, #2780f2);
    color: #fff;
    box-shadow: 0 5px 12px rgb(23 105 224 / 17%);
}

.btn-primary:hover {
    border-color: #1058c1;
    background: linear-gradient(110deg, #1058c1, #1769e0);
}

.btn-outline {
    border-color: #d5e0ec;
    background: #fff;
    color: #4d6680;
    box-shadow: none;
}

.btn-outline:hover {
    border-color: #9fc2eb;
    background: #f3f8ff;
    color: #1258b5;
}

.full {
    width: 100%;
}

.scan-box .btn {
    min-width: 170px;
}

.table-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.table-tools input {
    max-width: 360px;
}

.inventory-search {
    display: flex;
    flex: 1 1 360px;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 520px;
}

.inventory-search input {
    width: 100%;
    min-width: 0;
}

.inventory-search .btn {
    flex: 0 0 auto;
}

.inventory-pagination {
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.inventory-pagination nav {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-actions .btn {
    white-space: nowrap;
}

.table-wrap {
    width: 100%;
    overflow: auto;
    border: 1px solid #e8edf4;
    border-radius: 12px;
}

.log-actions,
.log-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-datasets {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-bottom: 14px;
}

.export-datasets label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.export-datasets input,
.select-log-row,
.select-all-logs {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

.log-actions {
    flex-wrap: wrap;
}

.log-pagination {
    justify-content: center;
    margin-top: 14px;
    color: var(--muted);
    font-size: 12px;
}

.password-input-group {
    display: flex;
    align-items: stretch;
    gap: 7px;
}

.password-input-group .input {
    flex: 1;
    min-width: 0;
}

.password-input-group .btn {
    flex: 0 0 auto;
    min-width: 112px;
    padding-inline: 9px;
    font-size: 11px;
}

table {
    width: 100%;
    white-space: nowrap;
}

.table thead th {
    background: #f5f8fc;
    color: #62748a;
    font-size: 11px;
    font-weight: 600;
}

.table td {
    font-size: 12px;
}

.table-zebra tbody tr:nth-child(even) {
    background: #fbfdff;
}

.table tbody tr:hover {
    background: #f1f7ff;
}

.subcell {
    display: block;
    margin-top: 3px;
    color: #98a5b4;
    font-size: 10px;
}

.status {
    display: inline-block;
    border-radius: 7px;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 500;
}

.status.ok {
    background: #e3f7ed;
    color: #087d57;
}

.status.low,
.tag.warn {
    background: #fff0df;
    color: #b75a0b;
}

.low-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.low-item {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #edf1f5;
    border-radius: 11px;
    background: #fff;
    padding: 12px;
}

.warning-icon {
    display: grid;
    width: 27px;
    height: 27px;
    flex: 0 0 27px;
    place-items: center;
    border-radius: 50%;
    background: #fff0df;
    color: #c26708;
    font-weight: 700;
}

.low-item div {
    min-width: 0;
    flex: 1;
}

.low-item b,
.low-item small {
    display: block;
}

.low-item b {
    font-size: 12px;
}

.low-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.low-item strong {
    color: #b75a0b;
    font-size: 12px;
}

.reader {
    max-width: 340px;
    margin: 12px auto 0;
}

.reader:has(video) {
    overflow: hidden;
    border: 1px solid #d6e0eb;
    border-radius: 12px;
    background: #071b2e;
}

.scan-video {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
}

#stopScanBtn {
    margin-left: 6px;
}

#stopScanBtn[hidden] {
    display: none;
}

.small-note {
    overflow-wrap: anywhere;
}

.small-note {
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
}

#txnMsg,
#productMsg {
    margin-top: 10px;
    color: var(--green);
    font-size: 12px;
}

#importMsg {
    margin-top: 10px;
    color: var(--red);
    font-size: 12px;
    white-space: pre-line;
}

.txn-form > .btn {
    min-width: 210px;
}

footer {
    padding: 10px 0 22px;
    color: #96a3b2;
    font-size: 10px;
    text-align: center;
}

.modal-box {
    width: min(700px, calc(100vw - 28px));
    max-width: none;
    max-height: calc(100vh - 32px);
    border: 1px solid #e6edf6;
    border-radius: 20px;
    background: #fff;
    padding: 26px;
    box-shadow: 0 24px 90px rgb(9 43 80 / 25%);
}

.modal-box .panel-title {
    margin-bottom: 20px;
}

.modal-box .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.product-form-section {
    grid-column: 1 / -1;
    margin: 4px 0 -4px;
    color: #60758b;
    font-size: 13px;
    font-weight: 600;
}

.modal-box .panel-title .btn {
    width: 38px;
    min-height: 38px;
    flex: 0 0 38px;
    padding: 0;
}

.modal-box .file-input {
    width: 100%;
    margin: 5px 0 16px;
}

.modal-box > .btn-primary {
    margin-top: 12px;
}

.login-bg {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 18% 12%, rgb(120 185 255 / 28%), transparent 32%),
        radial-gradient(circle at 86% 85%, rgb(19 168 199 / 12%), transparent 30%),
        linear-gradient(140deg, #eef4fb, #e7eef8);
}

.login-card {
    width: min(440px, 100%);
    overflow: hidden;
    border: 1px solid #e1e9f2;
    border-radius: 22px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 24px 80px rgb(9 43 80 / 14%);
}

.login-card .card-body {
    gap: 0;
    padding: 36px;
}

.login-card .brand-mark {
    margin-bottom: 22px;
}

.login-card h1 {
    margin: 0;
    font-size: 28px;
}

.login-card h1 span {
    color: var(--blue);
}

.login-card form {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.login-card label {
    margin-top: 5px;
}

.login-card .login-note {
    margin: 18px 0 8px;
    border-radius: 10px;
    background: #f2f7fd;
    padding: 10px;
    color: #536b84;
    font-size: 11px;
}

.login-card > small,
.login-card .card-body > small {
    color: #91a0b0;
    font-size: 11px;
}

@media (max-width: 1050px) {
    .app {
        grid-template-columns: 205px minmax(0, 1fr);
    }

    .content {
        padding: 22px;
    }

    .stock-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .form-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .topbar {
        min-height: 68px;
        padding: 0 15px;
    }

    .brand b {
        font-size: 17px;
        white-space: nowrap;
    }

    .brand small {
        display: none;
    }

    .brand-mark.small {
        width: 38px;
        height: 38px;
    }

    .userbox {
        gap: 7px;
        font-size: 11px;
    }

    .userbox .user-name {
        display: none;
    }

    .logout-link {
        min-height: 34px;
        padding: 0 8px;
        font-size: 11px;
    }

    .app {
        display: block;
    }

    .sidebar {
        position: sticky;
        z-index: 5;
        top: 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 8px 12px;
    }

    .side-caption,
    .sidebar-bottom {
        display: none;
    }

    .sidebar-menu {
        width: 100%;
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 5px;
        overflow-x: auto;
        white-space: nowrap;
        scrollbar-width: none;
        scroll-snap-type: x proximity;
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    .sidebar-menu li {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    .sidebar-menu li > a {
        min-height: 38px;
        padding: 7px 10px;
        font-size: 11px;
    }

    .content {
        padding: 18px 14px;
    }

    .page-head {
        align-items: flex-start;
    }

    .page-head h1 {
        font-size: 22px;
    }

    .date-chip {
        padding: 8px 10px;
        font-size: 10px;
    }

    .scan-grid {
        grid-template-columns: 1fr;
    }

    .table-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .table-tools input {
        max-width: none;
    }

    .table-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .table-actions .btn {
        min-height: 38px;
        padding: 6px;
        font-size: 11px;
    }

    .table-actions .btn:last-child {
        grid-column: 1 / -1;
    }

    .low-list {
        grid-template-columns: 1fr;
    }

    .panel {
        padding: 17px;
    }
}

@media (max-width: 440px) {
    .form-grid,
    .modal-box .form-grid {
        grid-template-columns: 1fr;
    }

    .stock-stats {
        gap: 9px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-stats .stat {
        min-height: 120px;
        padding: 14px;
    }

    .stock-stats .stat strong {
        font-size: 24px;
    }

    .stat-icon {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .panel-title {
        align-items: flex-start;
    }

    .modal-box {
        padding: 20px;
    }

    .login-card .card-body {
        padding: 27px;
    }
}

@media (max-width: 380px) {
    .role-pill {
        display: none;
    }

    .brand b {
        font-size: 14px;
    }
}

.qr-dialog-box {
    width: min(680px, calc(100vw - 28px));
}

.qr-label-list {
    display: grid;
    gap: 12px;
    max-height: min(62vh, 620px);
    overflow: auto;
}

#selectAllQrProducts,
.select-qr-product {
    width: 16px;
    height: 16px;
    accent-color: var(--blue);
}

.select-qr-product {
    cursor: pointer;
}

.qr-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    min-height: 270px;
    padding: 24px;
    border: 1px solid #d8e1ec;
    border-radius: 12px;
    background: #fff;
    color: #102a43;
}

.qr-label-info {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.qr-label-info strong {
    overflow-wrap: anywhere;
    font-size: 25px;
    line-height: 1.2;
}

.qr-label-info span {
    color: #486581;
    font-size: 15px;
}

.qr-code {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 190px;
    height: 190px;
}

.qr-code img,
.qr-code canvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
}

.qr-dialog-note {
    margin: 14px 0;
}

@media (max-width: 480px) {
    .qr-label {
        gap: 10px;
        min-height: 210px;
        padding: 12px;
    }

    .qr-label-info strong {
        font-size: 18px;
    }

    .qr-label-info span {
        font-size: 12px;
    }

    .qr-code {
        width: 140px;
        height: 140px;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    html,
    body {
        width: auto !important;
        height: auto !important;
        min-height: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    body * {
        visibility: hidden !important;
    }

    #qrLabelDialog[open],
    #qrLabelDialog[open] * {
        visibility: visible !important;
    }

    #qrLabelDialog[open] {
        position: absolute !important;
        inset: 0 auto auto 0 !important;
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        background: #fff !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    #qrLabelDialog::backdrop {
        background: transparent !important;
    }

    #qrLabelDialog .qr-dialog-heading,
    #qrLabelDialog .qr-dialog-note,
    #qrLabelDialog #qrLabelMsg,
    #qrLabelDialog .qr-dialog-actions {
        display: none !important;
    }

    #qrLabelDialog .qr-dialog-box {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        max-width: none !important;
        max-height: none !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    #qrLabelDialog .qr-label-list {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        align-items: stretch !important;
        gap: 4mm !important;
        max-height: none !important;
        overflow: visible !important;
    }

    #qrLabelDialog .qr-label {
        display: flex !important;
        width: auto !important;
        height: 43mm !important;
        min-height: 0 !important;
        gap: 2mm !important;
        margin: 0 !important;
        padding: 2mm !important;
        border: .25mm solid #d8e1ec !important;
        border-radius: 2mm !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
    }

    #qrLabelDialog .qr-label-info {
        flex: 1 1 auto !important;
        gap: 1.5mm !important;
        overflow: hidden !important;
    }

    #qrLabelDialog .qr-label-info strong {
        font-size: 10pt !important;
    }

    #qrLabelDialog .qr-label-info span {
        font-size: 7pt !important;
    }

    #qrLabelDialog .qr-code {
        width: 36mm !important;
        height: 36mm !important;
    }

    #qrLabelDialog .qr-code img,
    #qrLabelDialog .qr-code canvas {
        width: 36mm !important;
        height: 36mm !important;
        max-width: none !important;
        max-height: none !important;
    }
}

/* Dashboard layout follows the compact warehouse-console reference. */
body {
    background: #edf3fa;
}

.topbar {
    position: relative;
    z-index: 6;
    min-height: 76px;
    gap: 18px;
    padding: 0 22px;
    background: linear-gradient(105deg, #05264a, #0a3b6c 68%, #124d80);
}

.brand {
    flex: 0 0 auto;
}

.brand b {
    color: #f4f8ff;
    font-size: 19px;
}

.brand b span {
    color: #88c5ff;
}

.brand-short {
    display: none;
}

.brand small {
    letter-spacing: .15px;
}

.brand-mark.small {
    border: 1px solid rgb(255 255 255 / 25%);
    background: rgb(255 255 255 / 12%);
    color: #eaf5ff;
}

.top-navigation {
    display: flex;
    min-width: 0;
    align-items: stretch;
    justify-content: center;
    margin: 0 auto;
}

.top-navigation a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border-left: 1px solid rgb(255 255 255 / 22%);
    padding: 0 18px;
    color: #e4effc;
    font-size: 19px;
    white-space: nowrap;
}

.top-navigation a span {
    font-size: 12px;
}

.top-navigation a:hover {
    background: rgb(255 255 255 / 8%);
    color: #fff;
}

.userbox {
    flex: 0 0 auto;
}

.app {
    min-height: calc(100vh - 76px);
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    position: relative;
    display: flex;
    min-height: calc(100vh - 76px);
    align-self: stretch;
    flex-direction: column;
    border: 0;
    background: linear-gradient(180deg, #07284c, #041d38);
    padding: 14px 11px;
    color: #e8f3ff;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 2px 20px;
    border-bottom: 1px solid rgb(255 255 255 / 14%);
    padding: 2px 4px 16px;
}

.sidebar-brand-icon {
    display: grid;
    width: 35px;
    height: 35px;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 30%);
    border-radius: 10px;
    background: rgb(255 255 255 / 10%);
    font-size: 20px;
}

.sidebar-brand b,
.sidebar-brand small,
.sidebar-account b,
.sidebar-account small {
    display: block;
}

.sidebar-brand b {
    font-size: 12px;
}

.sidebar-brand small,
.sidebar-account small {
    margin-top: 2px;
    color: #9ab2ca;
    font-size: 9px;
}

.side-caption {
    color: #8aa6c4;
    font-size: 10px;
}

.sidebar-menu {
    gap: 3px;
}

.sidebar-menu li > a {
    min-height: 38px;
    border-radius: 7px;
    color: #d3e2f2;
    font-size: 11px;
}

.sidebar-menu li > a:hover {
    background: rgb(255 255 255 / 10%);
    color: #fff;
    transform: none;
}

.sidebar-menu li > a.active,
.sidebar-menu li > a.is-current {
    background: linear-gradient(95deg, #1168b9, #164f89);
    color: #fff;
    box-shadow: inset 3px 0 #76c5ff;
}

.sidebar-account {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 9px;
    margin: auto 4px 12px;
    border-top: 1px solid rgb(255 255 255 / 14%);
    padding: 16px 2px 3px;
    font-size: 10px;
}

.account-avatar {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    place-items: center;
    border-radius: 50%;
    background: #dcecff;
    color: #0a4379;
    font-size: 19px;
}

.sidebar-bottom {
    position: static;
    margin: 0 4px;
    color: #a5bed7;
    font-size: 9px;
}

.sidebar-account > span:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.content {
    display: grid;
    max-width: none;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-content: start;
    gap: 13px;
    padding: 20px;
}

.employee-view .content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 13px;
}

.stock-staff-view .content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 13px;
}

.stock-staff-view .content > * {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.manager-view .content.accounts-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}

.accounts-page > * {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 0;
}

.manager-view .content.accounts-page > #accounts,
.manager-view .content.accounts-page > #activity {
    grid-row: auto;
    order: initial;
}

.employee-view .content > * {
    width: 100%;
    min-width: 0;
    margin: 0;
}

.employee-view .content > #home {
    flex: 0 0 auto;
}

.employee-view .issue-panel {
    border-top-width: 3px;
}

.employee-view #history .table-wrap {
    max-height: 540px;
}

.manager-view .content > #home,
.manager-view .content > .stock-stats,
.manager-view .content > #issue,
.manager-view .content > #history,
.manager-view .content > #activity,
.manager-view .content > #accounts,
.manager-view .content > footer {
    grid-column: 1 / -1;
}

.manager-view .content > #home {
    margin: 0;
}

.manager-view .content > .stock-stats {
    margin: 0;
}

.manager-view .content > #inventory {
    grid-column: 1 / span 8;
    grid-row: 3;
    min-width: 0;
    margin: 0;
}

.manager-view .content > #stockAside {
    grid-column: 9 / -1;
    grid-row: 3;
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 13px;
}

.manager-view .content > #issue {
    grid-column: 1 / -1;
    grid-row: 4;
    margin: 0;
}

.manager-view .content > #history {
    grid-row: 5;
    margin: 0;
}

.manager-view .content > #activity {
    grid-row: 6;
    margin: 0;
}

.manager-view .content > #accounts {
    grid-row: 7;
    margin: 0;
}

.manager-view .content > footer {
    grid-row: 8;
}

.page-head {
    align-items: center;
    margin: 0;
}

.page-head h1 {
    font-size: 23px;
}

.stock-stats {
    gap: 10px;
}

.stock-stats .stat {
    min-height: 104px;
    border-radius: 11px;
    padding: 13px 15px;
}

.stock-stats .stat > span {
    margin: 2px 0 4px;
    font-size: 10px;
}

.stock-stats .stat strong {
    font-size: 23px;
}

.stock-stats .stat small {
    font-size: 9px;
}

.stat-icon {
    top: 12px;
    right: 12px;
    width: 31px;
    height: 31px;
    border-radius: 9px;
    font-size: 15px;
}

.panel,
.qr-shelf-card {
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 3px 12px rgb(16 46 77 / 5%);
}

.panel-title {
    margin-bottom: 12px;
}

.panel-title h2,
.qr-shelf-heading h2 {
    font-size: 14px;
}

.panel-title p,
.qr-shelf-heading p {
    font-size: 10px;
}

.panel-title > .btn,
.panel-title .badge {
    min-height: 32px;
    font-size: 10px;
}

.table-tools {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 9px;
}

#inventory .table-tools {
    display: grid;
    grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
    align-content: start;
    gap: 10px;
    height: auto;
}

.table-tools input {
    max-width: none;
    min-height: 36px;
    font-size: 11px;
}

#inventory .inventory-search {
    flex: initial;
    max-width: none;
}

.table-actions {
    width: 100%;
    gap: 6px;
}

#inventory .table-actions {
    justify-content: flex-end;
}

.table-actions .btn {
    min-height: 31px;
    flex: 1 1 auto;
    padding: 4px 7px;
    font-size: 9px;
}

#inventory .inventory-pagination {
    padding-top: 10px;
    border-top: 1px solid #e8edf4;
}

.table-wrap {
    border-radius: 8px;
}

#stockTable {
    min-width: 1050px;
}

#stockTable.awarded-items-table {
    width: max-content;
    min-width: 100%;
}

#stockTable .table thead th,
#stockTable thead th {
    padding: 7px 6px;
    font-size: 9px;
}

#stockTable td {
    padding: 7px 6px;
    font-size: 10px;
}

#stockTable td:first-child {
    white-space: normal;
}

#stockTable td:first-child b {
    overflow-wrap: anywhere;
}

#inventory .table-wrap {
    max-height: 72vh;
}

#stockTable.stock-products-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    white-space: nowrap;
}

#stockTable.stock-products-table td {
    max-width: 320px;
    white-space: normal;
    overflow-wrap: anywhere;
}

#stockTable.stock-products-table th:nth-child(2),
#stockTable.stock-products-table td:nth-child(2) {
    min-width: 300px;
    max-width: 420px;
}

#stockTable.awarded-items-table th:nth-child(3),
#stockTable.awarded-items-table td:nth-child(3) {
    min-width: 280px;
    max-width: 460px;
}

#stockTable.awarded-items-table th,
#stockTable.awarded-items-table td {
    white-space: normal;
    vertical-align: top;
}

#stockTable.awarded-items-table th:nth-last-child(3),
#stockTable.awarded-items-table td:nth-last-child(3) {
    min-width: 82px;
    white-space: nowrap;
}

#stockTable.awarded-items-table th:nth-last-child(2),
#stockTable.awarded-items-table td:nth-last-child(2) {
    min-width: 132px;
}

#stockTable.awarded-items-table th:last-child,
#stockTable.awarded-items-table td:last-child {
    min-width: 100px;
    white-space: nowrap;
}

#stockTable.awarded-items-table td:last-child .badge {
    display: inline-flex;
    max-width: 100%;
    white-space: nowrap;
}

.min-stock-form {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.min-stock-form input {
    width: 72px;
    min-height: 28px;
}

.min-stock-form .btn {
    min-height: 28px;
    height: 28px;
    padding: 0 7px;
    font-size: 9px;
}

.inventory-result-count {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.subcell {
    font-size: 9px;
}

.qr-link {
    display: block;
    margin-top: 4px;
    border: 0;
    background: transparent;
    padding: 0;
    color: #1670cb;
    cursor: pointer;
    font: inherit;
    font-size: 9px;
}

.qr-link:hover {
    color: #064d96;
    text-decoration: underline;
}

.low-list {
    grid-template-columns: 1fr;
    gap: 6px;
}

.low-item {
    gap: 7px;
    border-radius: 8px;
    padding: 8px;
}

.low-item b {
    font-size: 10px;
}

.low-item small {
    font-size: 9px;
}

.low-item strong {
    font-size: 10px;
    white-space: nowrap;
}

.low-item .badge {
    flex: 0 0 auto;
    font-size: 8px;
}

.warning-icon {
    width: 23px;
    height: 23px;
    flex-basis: 23px;
    font-size: 11px;
}

.qr-shelf-card {
    display: grid;
    align-content: start;
    gap: 12px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 13px;
}

.qr-shelf-heading {
    display: flex;
    align-items: center;
    gap: 9px;
}

.qr-shelf-heading h2,
.qr-shelf-heading p {
    margin: 0;
}

.qr-shelf-mark {
    display: grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 8px;
    background: #eaf3ff;
    color: #1265bd;
    font-size: 17px;
}

.qr-shelf-label {
    display: flex;
    min-height: 145px;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    border: 1px solid #e2e8ef;
    border-radius: 8px;
    background: linear-gradient(140deg, #fff, #f7faff);
    padding: 9px;
}

.qr-shelf-product {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.qr-shelf-product b {
    overflow-wrap: anywhere;
    color: #152b43;
    font-size: 11px;
}

.qr-shelf-product span {
    color: #53677c;
    font-size: 9px;
}

.qr-shelf-product small {
    color: #8795a5;
    font-size: 8px;
}

.shelf-qr-code {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 112px;
    height: 112px;
    border: 5px solid #fff;
    background: #fff;
    box-shadow: 0 0 0 1px #e6ebf1;
}

.shelf-qr-code img,
.shelf-qr-code canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.qr-shelf-card > .btn {
    min-height: 32px;
    font-size: 10px;
}

.issue-panel {
    border-top-width: 2px;
}

.scan-box {
    padding: 15px;
}

.scan-box .btn {
    min-width: 130px;
    min-height: 36px;
    font-size: 11px;
}

.form-grid {
    gap: 10px;
}

.form-grid label,
.search-box label {
    font-size: 10px;
}

.form-grid .input,
.form-grid .select,
.search-box .input {
    min-height: 38px;
    font-size: 11px;
}

.selected-product {
    min-height: 74px;
    margin: 12px 0;
    padding: 11px;
}

.txn-form > .btn {
    min-height: 36px;
    font-size: 11px;
}

.manager-view #history .table td {
    font-size: 10px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 12px;
}

@media (max-width: 700px) {
    html {
        scroll-padding-top: 54px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

}

.back-to-top {
    position: fixed;
    z-index: 20;
    right: 24px;
    bottom: 24px;
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border: 1px solid rgb(255 255 255 / 25%);
    border-radius: 50%;
    background: linear-gradient(135deg, #1769e0, #0b4f9c);
    color: #fff;
    box-shadow: 0 8px 22px rgb(9 43 80 / 28%);
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 11px 26px rgb(9 43 80 / 34%);
}

.back-to-top span {
    font-family: Arial, sans-serif;
    font-size: 27px;
    line-height: 1;
}

.back-to-top[hidden] {
    display: none;
}

@media (max-width: 700px) {
    .back-to-top {
        right: 16px;
        bottom: 16px;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 1250px) {
    .top-navigation {
        display: none;
    }

    .top-navigation a {
        gap: 5px;
        padding: 0 10px;
        font-size: 16px;
    }

    .top-navigation a span {
        font-size: 10px;
    }

    .topbar {
        padding: 0 14px;
    }

    .brand b {
        font-size: 16px;
    }
}

@media (max-width: 1050px) {
    .top-navigation {
        display: none;
    }

    .app {
        grid-template-columns: 205px minmax(0, 1fr);
    }

    .manager-view .content {
        grid-template-columns: minmax(0, 1fr);
    }

    .manager-view .content > #home,
    .manager-view .content > .stock-stats,
    .manager-view .content > #inventory,
    .manager-view .content > #stockAside,
    .manager-view .content > #issue,
    .manager-view .content > #history,
    .manager-view .content > #activity,
    .manager-view .content > #accounts,
    .manager-view .content > footer {
        grid-column: 1;
        grid-row: auto;
    }

    .manager-view .content > #home { order: 0; }
    .manager-view .content > .stock-stats { order: 1; }
    .manager-view .content > #inventory { order: 2; }
    .manager-view .content > #stockAside { order: 3; }
    .manager-view .content > #issue { order: 5; }
    .manager-view .content > #history { order: 6; }
    .manager-view .content > #activity { order: 7; }
    .manager-view .content > #accounts { order: 8; }
    .manager-view .content > footer { order: 9; }

    #stockTable {
        min-width: 1050px;
    }
}

@media (max-width: 700px) {
    .topbar {
        min-height: 62px;
        gap: 8px;
        padding: 0 10px;
    }

    .brand {
        min-width: 0;
        gap: 8px;
    }

    .brand b {
        font-size: 15px;
        white-space: nowrap;
    }

    .brand-full {
        display: none;
    }

    .brand-short {
        display: inline;
        font-size: 15px;
    }

    .brand-mark.small {
        width: 34px;
        height: 34px;
    }

    .sidebar {
        height: auto;
        min-height: 0;
        padding: 7px 10px;
    }

    .sidebar-brand,
    .sidebar-account {
        display: none;
    }

    .side-caption,
    .sidebar-bottom {
        display: none;
    }

    .content {
        gap: 11px;
        padding: 14px 12px;
    }

    .manager-view .content {
        grid-template-columns: minmax(0, 1fr);
    }

    .manager-view .content > #home,
    .manager-view .content > .stock-stats,
    .manager-view .content > #inventory,
    .manager-view .content > #stockAside,
    .manager-view .content > #issue,
    .manager-view .content > #history,
    .manager-view .content > footer {
        grid-column: 1;
    }

    .manager-view .content > .stock-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stock-stats .stat {
        min-height: 95px;
    }

    .page-head h1 {
        font-size: 19px;
    }

    .page-head .muted {
        max-width: 245px;
        font-size: 10px;
    }

    .panel {
        padding: 13px;
    }

    .panel-title {
        align-items: flex-start;
    }

    .table-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #inventory .table-tools {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    #inventory .table-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .table-actions .btn:last-child {
        grid-column: auto;
    }

    #stockTable {
        min-width: 1050px;
    }

    .qr-shelf-label {
        min-height: 154px;
    }
}

@media (max-width: 440px) {
    .manager-view .content > .stock-stats {
        gap: 8px;
    }

    .stock-stats .stat strong {
        font-size: 21px;
    }

    .qr-shelf-label {
        min-height: 145px;
    }
}
