:root {
    --bg: #f3f3f3;
    --card: #ffffff;
    --text: #222;
    --muted: #666;
    --border: #ddd;
    --soft: #fafafa;
    --dark: #222;
    --dark-hover: #444;
    --danger: #9b1c1c;
    --danger-hover: #7f1515;
    --success-bg: #d8ffd8;
    --success-text: #146b14;
    --error-bg: #ffd8d8;
    --error-text: #8a1111;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    color: inherit;
}

.page-shell {
    width: min(92%, 900px);
    margin: 60px auto;
}

.page-shell.wide {
    width: min(96%, 1250px);
}

.hero-card,
.panel-card {
    background: var(--card);
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.panel-card.narrow {
    max-width: 620px;
    margin-inline: auto;
}

h1 {
    margin-top: 0;
    font-size: 32px;
}

h2 {
    margin-top: 0;
    font-size: 21px;
}

.muted {
    color: var(--muted);
    line-height: 1.5;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.block-grid {
    display: grid;
    gap: 18px;
    margin-top: 26px;
}

.block-grid.two {
    grid-template-columns: repeat(2, 1fr);
}

.block-grid.four {
    grid-template-columns: repeat(4, 1fr);
}

.choice-block {
    display: flex;
    min-height: 145px;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    padding: 22px;
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.choice-block:hover {
    transform: translateY(-2px);
    border-color: #aaa;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.block-title {
    font-size: 22px;
    font-weight: bold;
}

.block-text {
    color: var(--muted);
    line-height: 1.45;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: bold;
}

input,
textarea,
select {
    width: 100%;
    padding: 12px;
    font-size: 17px;
    border: 1px solid #bbb;
    border-radius: 8px;
    font-family: inherit;
    background: white;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: none;
    text-decoration: none;
    cursor: pointer;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    white-space: nowrap;
}

.button.primary {
    background: var(--dark);
    color: white;
}

.button.primary:hover {
    background: var(--dark-hover);
}

.button.secondary {
    background: #e7e7e7;
    color: #222;
}

.button.secondary:hover {
    background: #d5d5d5;
}

.button.danger {
    background: var(--danger);
    color: white;
}

.button.danger:hover {
    background: var(--danger-hover);
}

.search-input {
    margin-bottom: 18px;
}

.status-line {
    margin-bottom: 14px;
    color: var(--muted);
}

.items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.item-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--soft);
    margin-bottom: 10px;
}

.item-main {
    min-width: 0;
}

.item-title {
    font-weight: bold;
    font-size: 18px;
    overflow-wrap: anywhere;
}

.item-subtitle {
    color: var(--muted);
    margin-top: 6px;
    line-height: 1.45;
}

.item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.message {
    margin-top: 18px;
    padding: 13px;
    border-radius: 8px;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
}

.hidden {
    display: none !important;
}

.selection-bar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 16px;
    border-radius: 12px;
    background: #fff3c4;
    border: 1px solid #e0c86d;
}

.select-checkbox {
    width: auto;
    transform: scale(1.3);
}

.item-card.selectable {
    grid-template-columns: auto 1fr auto;
}

.item-card.selected {
    outline: 2px solid #222;
}

.role-badge {
    display: inline-block;
    margin-inline-start: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: #e7e7e7;
    font-size: 13px;
    color: #333;
}

.app-dialog {
    width: min(92%, 520px);
    border: none;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.25);
}

.app-dialog::backdrop {
    background: rgba(0,0,0,0.45);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.file-preview {
    direction: ltr;
    text-align: left;
    background: #111;
    color: #f2f2f2;
    padding: 18px;
    border-radius: 12px;
    overflow: auto;
    min-height: 420px;
    white-space: pre-wrap;
}

.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 22px;
}

.tab-button {
    border: 1px solid var(--border);
    background: var(--soft);
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 16px;
}

.tab-button.active {
    background: var(--dark);
    color: white;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
}

.metric-block {
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.metric-block p {
    margin: 9px 0;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 950px;
}

.data-table th,
.data-table td {
    border: 1px solid var(--border);
    padding: 10px;
    text-align: right;
}

.data-table th {
    background: #eee;
}

.placeholder-panel {
    padding: 28px;
    border-radius: 14px;
    background: var(--soft);
    border: 1px solid var(--border);
    color: var(--muted);
}


.helper-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.helper-title {
    margin: 0 0 4px 0;
    font-size: 20px;
}

.helper-mode-text {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.toggle-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #cfcfcf;
    background: white;
    color: #222;
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    min-width: 128px;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toggle-pill:hover {
    border-color: #999;
    background: #f7f7f7;
}

.toggle-pill.active {
    background: #222;
    color: white;
    border-color: #222;
}

.toggle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bdbdbd;
    display: inline-block;
}

.toggle-pill.active .toggle-dot {
    background: white;
}

.helper-summary {
    display: grid;
    gap: 16px;
    transition: all 0.15s ease;
}

.helper-summary.central {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-summary.central .metric-block {
    min-height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.helper-summary.secondary {
    grid-template-columns: repeat(2, minmax(0, 250px));
    justify-content: start;
    margin-bottom: 18px;
}

.helper-summary.secondary .metric-block {
    padding: 12px;
}

.helper-summary.secondary .metric-block h2 {
    font-size: 15px;
}

.big-number {
    font-size: 46px;
    font-weight: bold;
    margin: 8px 0 0;
    direction: ltr;
}

.helper-summary.secondary .big-number {
    font-size: 28px;
}

.helper-details.central {
    display: block;
}


.analysis-table-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.analysis-toolbar h2 {
    margin: 0 0 6px 0;
}

.detail-level-switch {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
}

.level-button {
    border: none;
    border-radius: 999px;
    background: transparent;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    color: #333;
}

.level-button.active {
    background: var(--dark);
    color: white;
}

.inventory-analysis-table th,
.inventory-analysis-table td {
    white-space: nowrap;
}

.inventory-status-row {
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.1s ease;
}

.inventory-status-row:hover {
    filter: brightness(0.98);
}

.inventory-row-ok td {
    background: #e4f8e4;
}

.inventory-row-warn td {
    background: #fff3c4;
}

.inventory-row-bad td {
    background: #ffdede;
}

.status-cell {
    text-align: center !important;
    font-weight: bold;
    font-size: 18px;
}

.status-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

.status-ok { color: #146b14; }
.status-warn { color: #8a6400; }
.status-bad { color: #8a1111; }

.model-detail-dialog {
    width: min(94%, 720px);
}

.model-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.model-dialog-header h2 {
    margin-bottom: 6px;
}

.dialog-x-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--soft);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.model-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.model-detail-field {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--soft);
    min-width: 0;
}

.model-detail-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.model-detail-value {
    display: block;
    font-weight: bold;
    overflow-wrap: anywhere;
    direction: ltr;
    text-align: left;
}

@media (max-width: 850px) {
    body {
        background: white;
    }

    .page-shell,
    .page-shell.wide {
        width: 100%;
        margin: 0;
    }

    .hero-card,
    .panel-card {
        min-height: 100vh;
        border-radius: 0;
        box-shadow: none;
        padding: 24px 16px;
    }

    h1 {
        font-size: 30px;
        line-height: 1.25;
    }

    .page-header {
        flex-direction: column;
    }

    .header-actions,
    .page-header > .button {
        width: 100%;
    }

    .button {
        width: 100%;
        padding: 15px;
        font-size: 19px;
    }

    .block-grid.two,
    .block-grid.four {
        grid-template-columns: 1fr;
    }

    .choice-block {
        min-height: 130px;
        padding: 20px;
    }

    .block-title {
        font-size: 23px;
    }

    .block-text {
        font-size: 17px;
    }

    label {
        font-size: 18px;
    }

    input,
    textarea,
    select {
        padding: 15px;
        font-size: 19px;
    }

    .item-card,
    .item-card.selectable {
        grid-template-columns: 1fr;
    }

    .item-title {
        font-size: 20px;
        text-align: center;
    }

    .item-subtitle {
        text-align: center;
        font-size: 16px;
    }

    .item-actions {
        flex-direction: column;
        width: 100%;
    }

    .select-checkbox {
        justify-self: center;
        width: 28px;
        height: 28px;
    }

    .selection-bar {
        gap: 8px;
    }

    .selection-bar .button {
        width: auto;
        font-size: 16px;
        padding: 10px 12px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dialog-actions {
        flex-direction: column;
    }

    .inner-tabs {
        flex-direction: column;
    }

    .inner-tab-button {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .helper-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toggle-pill {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .helper-summary.central,
    .helper-summary.secondary {
        grid-template-columns: 1fr;
    }

    .big-number {
        font-size: 38px;
        text-align: center;
    }

    .analysis-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-level-switch {
        display: grid;
        grid-template-columns: 1fr;
        border-radius: 14px;
        width: 100%;
    }

    .level-button {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .model-detail-grid {
        grid-template-columns: 1fr;
    }

    .model-dialog-header {
        align-items: center;
    }



}

.dev-notice {
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 12px;
    background: #fff3c4;
    border: 1px solid #e0c86d;
    color: #5f4b00;
    line-height: 1.5;
}

.inner-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.inner-tab-button {
    border: 1px solid var(--border);
    background: var(--soft);
    padding: 9px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
}

.inner-tab-button.active {
    background: var(--dark);
    color: white;
}

.inner-tab-panel {
    display: none;
}

.inner-tab-panel.active {
    display: block;
}

.data-table td {
    vertical-align: top;
}


.helper-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.helper-title {
    margin: 0 0 4px 0;
    font-size: 20px;
}

.helper-mode-text {
    margin: 0;
    color: var(--muted);
    font-size: 15px;
}

.toggle-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: 1px solid #cfcfcf;
    background: white;
    color: #222;
    padding: 9px 14px;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    min-width: 128px;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.toggle-pill:hover {
    border-color: #999;
    background: #f7f7f7;
}

.toggle-pill.active {
    background: #222;
    color: white;
    border-color: #222;
}

.toggle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #bdbdbd;
    display: inline-block;
}

.toggle-pill.active .toggle-dot {
    background: white;
}

.helper-summary {
    display: grid;
    gap: 16px;
    transition: all 0.15s ease;
}

.helper-summary.central {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.helper-summary.central .metric-block {
    min-height: 155px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.helper-summary.secondary {
    grid-template-columns: repeat(2, minmax(0, 250px));
    justify-content: start;
    margin-bottom: 18px;
}

.helper-summary.secondary .metric-block {
    padding: 12px;
}

.helper-summary.secondary .metric-block h2 {
    font-size: 15px;
}

.big-number {
    font-size: 46px;
    font-weight: bold;
    margin: 8px 0 0;
    direction: ltr;
}

.helper-summary.secondary .big-number {
    font-size: 28px;
}

.helper-details.central {
    display: block;
}


.analysis-table-block {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.analysis-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.analysis-toolbar h2 {
    margin: 0 0 6px 0;
}

.detail-level-switch {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
}

.level-button {
    border: none;
    border-radius: 999px;
    background: transparent;
    padding: 9px 14px;
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    color: #333;
}

.level-button.active {
    background: var(--dark);
    color: white;
}

.inventory-analysis-table th,
.inventory-analysis-table td {
    white-space: nowrap;
}

.inventory-status-row {
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.1s ease;
}

.inventory-status-row:hover {
    filter: brightness(0.98);
}

.inventory-row-ok td {
    background: #e4f8e4;
}

.inventory-row-warn td {
    background: #fff3c4;
}

.inventory-row-bad td {
    background: #ffdede;
}

.status-cell {
    text-align: center !important;
    font-weight: bold;
    font-size: 18px;
}

.status-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
}

.status-ok { color: #146b14; }
.status-warn { color: #8a6400; }
.status-bad { color: #8a1111; }

.model-detail-dialog {
    width: min(94%, 720px);
}

.model-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
}

.model-dialog-header h2 {
    margin-bottom: 6px;
}

.dialog-x-button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--soft);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
}

.model-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.model-detail-field {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: var(--soft);
    min-width: 0;
}

.model-detail-label {
    display: block;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.model-detail-value {
    display: block;
    font-weight: bold;
    overflow-wrap: anywhere;
    direction: ltr;
    text-align: left;
}

@media (max-width: 850px) {
    .inner-tab-button {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .helper-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toggle-pill {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .helper-summary.central,
    .helper-summary.secondary {
        grid-template-columns: 1fr;
    }

    .big-number {
        font-size: 38px;
        text-align: center;
    }

    .analysis-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-level-switch {
        display: grid;
        grid-template-columns: 1fr;
        border-radius: 14px;
        width: 100%;
    }

    .level-button {
        width: 100%;
        padding: 14px;
        font-size: 18px;
    }

    .model-detail-grid {
        grid-template-columns: 1fr;
    }

    .model-dialog-header {
        align-items: center;
    }


}


/* v12 — polished analysis tables */
.analysis-table-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0,0,0,0.04);
}

.analysis-table-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    background: linear-gradient(180deg, #ffffff, #f7f7f7);
    border-bottom: 1px solid var(--border);
}

.analysis-table-title {
    margin: 0;
    font-size: 18px;
}

.analysis-table-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.analysis-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #222;
    color: white;
    font-weight: bold;
    direction: ltr;
}

.table-wrap.analysis-wrap {
    overflow-x: auto;
    background: white;
}

.data-table.analysis-table {
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table.analysis-table th,
.data-table.analysis-table td {
    border: none;
    border-bottom: 1px solid #e7e7e7;
    padding: 12px 11px;
    vertical-align: middle;
}

.data-table.analysis-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f0f0f0;
    color: #111;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.data-table.analysis-table tbody tr {
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    cursor: pointer;
}

.data-table.analysis-table tbody tr:hover {
    filter: brightness(0.985);
    box-shadow: inset 3px 0 0 #222;
}

.data-table.analysis-table tbody tr:nth-child(even):not(.status-ok):not(.status-warning):not(.status-bad) {
    background: #fbfbfb;
}

.row-number-cell,
.row-number-header {
    width: 54px;
    text-align: center !important;
    color: #666;
    font-weight: bold;
    direction: ltr;
    white-space: nowrap;
}

.row-number-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.65);
    border: 1px solid rgba(0,0,0,0.08);
    color: #333;
    font-size: 13px;
}

.barcode-cell {
    direction: ltr;
    text-align: left !important;
    font-family: Consolas, "Courier New", monospace;
    font-weight: bold;
    white-space: nowrap;
}

.brand-cell {
    font-weight: 600;
}

.number-cell {
    direction: ltr;
    text-align: center !important;
    font-weight: bold;
}

.percent-cell {
    direction: ltr;
    text-align: center !important;
    font-weight: bold;
}

.status-cell {
    text-align: center !important;
    font-size: 20px;
    font-weight: bold;
}

.status-ok {
    background: #e8f8e8 !important;
}

.status-warning {
    background: #fff5ce !important;
}

.status-bad {
    background: #ffe3e3 !important;
}

.status-ok .status-cell {
    color: #146b14;
}

.status-warning .status-cell {
    color: #8a6500;
}

.status-bad .status-cell {
    color: #8a1111;
}

.level-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.level-toolbar-title {
    font-weight: bold;
}

.level-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.level-button {
    border: 1px solid var(--border);
    background: white;
    border-radius: 999px;
    padding: 9px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
}

.level-button.active {
    background: #222;
    color: white;
    border-color: #222;
}

@media (max-width: 850px) {
    .analysis-table-head {
        flex-direction: column;
        align-items: stretch;
    }

    .analysis-count-badge {
        width: 100%;
    }

    .level-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .level-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .level-button {
        width: 100%;
        padding: 13px;
        font-size: 17px;
    }

    .data-table.analysis-table {
        min-width: 620px;
    }

    .data-table.analysis-table th,
    .data-table.analysis-table td {
        padding: 11px 9px;
        font-size: 14px;
    }

    .row-number-cell,
    .row-number-header {
        width: 46px;
    }

    .barcode-cell {
        font-size: 13px;
    }
}


/* v13 — mobile-first operational tuning only */
@media (max-width: 850px) {
    :root {
        --mobile-page-pad: 10px;
        --mobile-card-pad: 12px;
        --mobile-radius: 12px;
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        background: #f2f2f2;
    }

    body {
        font-size: 14px;
        -webkit-text-size-adjust: 100%;
    }

    .page-shell,
    .page-shell.wide {
        width: 100%;
        margin: 0;
        padding: var(--mobile-page-pad);
    }

    .hero-card,
    .panel-card {
        min-height: calc(100vh - 20px);
        border-radius: var(--mobile-radius);
        box-shadow: 0 2px 14px rgba(0,0,0,0.08);
        padding: var(--mobile-card-pad);
    }

    .panel-card.narrow {
        max-width: none;
        margin-inline: 0;
    }

    h1 {
        font-size: 22px;
        line-height: 1.22;
        margin: 0 0 8px;
    }

    h2 {
        font-size: 17px;
        line-height: 1.25;
        margin-bottom: 8px;
    }

    h3 {
        font-size: 15px;
        margin: 0 0 6px;
    }

    .muted {
        font-size: 13px;
        line-height: 1.35;
    }

    .page-header {
        gap: 10px;
        margin-bottom: 12px;
    }

    .page-header > div {
        width: 100%;
    }

    .header-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .button,
    button.button,
    a.button {
        width: 100%;
        min-height: 38px;
        padding: 9px 11px;
        font-size: 14px;
        border-radius: 9px;
        line-height: 1.1;
    }

    .block-grid {
        gap: 10px;
        margin-top: 14px;
    }

    .choice-block {
        min-height: 92px;
        padding: 13px;
        border-radius: 12px;
        gap: 6px;
    }

    .block-title {
        font-size: 18px;
        line-height: 1.2;
    }

    .block-text {
        font-size: 13px;
        line-height: 1.32;
    }

    .form-stack {
        gap: 11px;
    }

    label {
        font-size: 14px;
        gap: 6px;
    }

    input,
    textarea,
    select {
        min-height: 40px;
        padding: 9px 10px;
        font-size: 16px;
        border-radius: 9px;
    }

    textarea {
        min-height: 86px;
    }

    .search-input {
        margin-bottom: 10px;
    }

    .status-line {
        font-size: 12px;
        margin-bottom: 9px;
    }

    .item-card,
    .item-card.selectable {
        padding: 10px;
        gap: 9px;
        border-radius: 11px;
        margin-bottom: 8px;
    }

    .item-title {
        font-size: 16px;
        line-height: 1.25;
    }

    .item-subtitle {
        font-size: 12px;
        line-height: 1.3;
    }

    .item-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 7px;
    }

    .role-badge {
        font-size: 11px;
        padding: 2px 7px;
    }

    .tabs {
        gap: 6px;
        padding-bottom: 8px;
        margin-bottom: 12px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab-button {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 999px;
        white-space: nowrap;
    }

    .inner-tabs {
        gap: 6px;
        padding-bottom: 8px;
        margin-bottom: 12px;
        overflow-x: auto;
        flex-direction: row;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .inner-tabs::-webkit-scrollbar {
        display: none;
    }

    .inner-tab-button {
        flex: 0 0 auto;
        width: auto;
        padding: 8px 11px;
        font-size: 13px;
        white-space: nowrap;
    }

    .dev-notice {
        padding: 9px 10px;
        margin-bottom: 10px;
        border-radius: 10px;
        font-size: 12px;
        line-height: 1.35;
    }

    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
        margin-bottom: 12px;
    }

    .metric-block {
        border-radius: 11px;
        padding: 10px;
    }

    .metric-block h2 {
        font-size: 14px;
        margin-bottom: 6px;
    }

    .metric-block p {
        font-size: 12px;
        margin: 5px 0;
        line-height: 1.25;
    }

    .helper-toolbar {
        padding: 10px;
        gap: 10px;
        border-radius: 11px;
        margin-bottom: 10px;
    }

    .helper-title {
        font-size: 15px;
    }

    .helper-mode-text {
        font-size: 12px;
    }

    .toggle-pill {
        width: 100%;
        min-height: 38px;
        padding: 9px 11px;
        font-size: 14px;
    }

    .helper-summary.central,
    .helper-summary.secondary {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
        margin-bottom: 10px;
    }

    .helper-summary.central .metric-block {
        min-height: 105px;
    }

    .helper-summary.secondary .metric-block {
        padding: 9px;
    }

    .helper-summary.secondary .metric-block h2,
    .helper-summary.central .metric-block h2 {
        font-size: 13px;
        line-height: 1.25;
    }

    .big-number,
    .helper-summary.secondary .big-number {
        font-size: 30px;
        text-align: center;
        margin-top: 5px;
    }

    .analysis-toolbar {
        gap: 9px;
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 11px;
    }

    .analysis-toolbar h2 {
        font-size: 16px;
        margin-bottom: 4px;
    }

    .detail-level-switch,
    .level-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
    }

    .level-button {
        width: 100%;
        padding: 8px 6px;
        font-size: 12px;
        min-height: 34px;
    }

    .analysis-row-count-badge,
    .analysis-count-badge {
        width: 100%;
        min-height: 30px;
        padding: 6px 10px;
        font-size: 12px;
    }

    .analysis-table-card {
        border-radius: 12px;
    }

    .analysis-table-head {
        padding: 10px;
        gap: 8px;
    }

    .analysis-table-title {
        font-size: 15px;
    }

    .analysis-table-subtitle {
        font-size: 12px;
    }

    .table-wrap,
    .table-wrap.analysis-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 10px;
    }

    .data-table,
    .data-table.analysis-table,
    .inventory-analysis-table,
    .polished-analysis-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }

    .data-table th,
    .data-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td {
        padding: 8px 6px;
        font-size: 11px;
        line-height: 1.2;
        overflow-wrap: anywhere;
    }

    .data-table.analysis-table th,
    .polished-analysis-table th {
        font-size: 11px;
        top: 0;
    }

    .row-number-header,
    .row-number-cell {
        width: 34px;
        min-width: 34px;
        padding-inline: 3px !important;
    }

    .row-number-pill {
        min-width: 24px;
        height: 22px;
        padding: 0 5px;
        font-size: 11px;
    }

    .barcode-cell {
        font-size: 11px;
        white-space: normal;
        word-break: break-all;
    }

    .brand-cell {
        font-size: 11px;
    }

    .number-cell,
    .percent-cell {
        font-size: 12px;
    }

    .status-cell {
        font-size: 17px !important;
        padding-inline: 4px !important;
    }

    .inventory-status-row,
    .data-table.analysis-table tbody tr {
        min-height: 36px;
    }

    .app-dialog {
        width: calc(100vw - 18px);
        max-width: calc(100vw - 18px);
        max-height: calc(100vh - 18px);
        padding: 13px;
        border-radius: 14px;
        overflow: auto;
    }

    .app-dialog h2 {
        font-size: 18px;
        margin-bottom: 6px;
    }

    .dialog-actions {
        gap: 7px;
        margin-top: 12px;
    }

    .model-detail-dialog {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }

    .model-detail-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .model-detail-field {
        padding: 9px;
        border-radius: 9px;
    }

    .model-detail-label {
        font-size: 11px;
    }

    .model-detail-value {
        font-size: 14px;
        line-height: 1.25;
    }

    .selection-bar {
        top: 4px;
        padding: 8px;
        gap: 6px;
        border-radius: 11px;
    }

    .selection-bar .button {
        width: auto;
        min-height: 34px;
        font-size: 13px;
        padding: 8px 10px;
    }

    .file-preview {
        min-height: 60vh;
        padding: 11px;
        font-size: 12px;
        border-radius: 11px;
    }

    .placeholder-panel {
        padding: 14px;
        border-radius: 11px;
        font-size: 13px;
    }
}

@media (max-width: 430px) {
    .page-shell,
    .page-shell.wide {
        padding: 7px;
    }

    .hero-card,
    .panel-card {
        padding: 10px;
        border-radius: 10px;
        min-height: calc(100vh - 14px);
    }

    h1 {
        font-size: 20px;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .helper-summary.central,
    .helper-summary.secondary {
        grid-template-columns: 1fr;
    }

    .header-actions,
    .item-actions {
        grid-template-columns: 1fr;
    }

    .tab-button,
    .inner-tab-button {
        font-size: 12px;
        padding: 7px 10px;
    }

    .data-table th,
    .data-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td {
        padding: 7px 4px;
        font-size: 10.5px;
    }

    .barcode-cell {
        font-size: 10px;
    }

    .status-cell {
        font-size: 16px !important;
    }

    .detail-level-switch,
    .level-buttons {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .level-button {
        font-size: 11px;
        padding-inline: 4px;
    }
}


/* v14 — full-site mobile tightening + no-overlap table safety */
@media (max-width: 850px) {
    *,
    *::before,
    *::after {
        max-width: 100%;
    }

    .top-actions {
        margin-bottom: 12px;
    }

    .link-button {
        width: 100%;
        min-height: 38px;
        padding: 9px 11px;
        font-size: 14px;
        border-radius: 9px;
        text-align: center;
    }

    #result,
    .message {
        margin-top: 12px;
        padding: 10px;
        font-size: 13px;
        border-radius: 9px;
        line-height: 1.35;
    }

    #filesList,
    #projectsList,
    .items-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .file-item {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
        border-radius: 11px;
        margin-bottom: 0;
    }

    .file-name {
        font-size: 14px;
        line-height: 1.25;
        text-align: center;
        direction: ltr;
        word-break: break-all;
        overflow-wrap: anywhere;
    }

    .download-button {
        width: 100%;
        min-height: 36px;
        padding: 9px 11px;
        font-size: 14px;
        border-radius: 9px;
        text-align: center;
    }

    .empty {
        padding: 14px;
        font-size: 13px;
        border-radius: 11px;
    }

    .analysis-toolbar,
    .level-toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 9px;
        margin-bottom: 9px;
        border-radius: 11px;
    }

    .analysis-toolbar > div,
    .level-toolbar > div {
        min-width: 0;
    }

    .analysis-toolbar h2,
    .level-toolbar-title {
        font-size: 15px;
        line-height: 1.2;
        margin: 0 0 3px;
    }

    .analysis-toolbar .muted {
        font-size: 12px;
        line-height: 1.28;
        margin: 0;
    }

    .detail-level-switch,
    .level-buttons {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 5px;
        width: 100%;
        min-width: 0;
    }

    .level-button {
        min-width: 0;
        width: 100%;
        min-height: 32px;
        padding: 7px 4px;
        font-size: 11.5px;
        line-height: 1.05;
        border-radius: 999px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .analysis-row-count-badge,
    .analysis-count-badge {
        width: 100%;
        min-width: 0;
        min-height: 28px;
        padding: 6px 8px;
        font-size: 12px;
        border-radius: 999px;
        text-align: center;
    }

    /* Hard guarantee: table text never physically paints into neighboring cells */
    .table-wrap,
    .table-wrap.analysis-wrap {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        contain: paint;
    }

    .data-table,
    .data-table.analysis-table,
    .inventory-analysis-table,
    .polished-analysis-table {
        width: 100%;
        table-layout: fixed;
        border-collapse: separate;
        border-spacing: 0;
    }

    .data-table th,
    .data-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td,
    .inventory-analysis-table th,
    .inventory-analysis-table td,
    .polished-analysis-table th,
    .polished-analysis-table td {
        box-sizing: border-box;
        max-width: 0;
        min-width: 0;
        white-space: normal;
        overflow: hidden;
        overflow-wrap: anywhere;
        word-break: break-word;
        text-overflow: clip;
        vertical-align: middle;
    }

    .barcode-cell {
        direction: ltr;
        unicode-bidi: isolate;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-all !important;
        line-break: anywhere;
        max-width: 100%;
    }

    .brand-cell,
    .number-cell,
    .percent-cell,
    .status-cell {
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        max-width: 100%;
    }

    .number-cell,
    .percent-cell,
    .status-cell {
        text-align: center !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    .row-number-pill {
        min-width: 22px;
        max-width: 28px;
        height: 20px;
        padding: 0 4px;
        font-size: 10px;
    }

    .data-table.analysis-table th,
    .polished-analysis-table th {
        font-size: 10px;
        line-height: 1.1;
    }

    .data-table.analysis-table td,
    .polished-analysis-table td {
        font-size: 10.5px;
        line-height: 1.15;
    }

    .status-cell {
        font-size: 15px !important;
    }

    .model-detail-field {
        min-width: 0;
        overflow: hidden;
    }

    .model-detail-value {
        overflow-wrap: anywhere;
        word-break: break-word;
        max-width: 100%;
    }

    .model-detail-value,
    .model-detail-label {
        min-width: 0;
    }

    .dialog-actions .button {
        min-width: 0;
    }

    .app-dialog {
        overscroll-behavior: contain;
    }

    .app-dialog input,
    .app-dialog textarea,
    .app-dialog select {
        max-width: 100%;
    }
}

@media (max-width: 430px) {
    .detail-level-switch,
    .level-buttons {
        gap: 4px;
    }

    .level-button {
        min-height: 30px;
        padding: 6px 3px;
        font-size: 10.5px;
    }

    .data-table th,
    .data-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td,
    .inventory-analysis-table th,
    .inventory-analysis-table td,
    .polished-analysis-table th,
    .polished-analysis-table td {
        padding: 6px 3px;
        font-size: 10px;
        line-height: 1.12;
    }

    .barcode-cell {
        font-size: 9.5px !important;
        letter-spacing: -0.2px;
    }

    .brand-cell {
        font-size: 10px !important;
    }

    .number-cell,
    .percent-cell {
        font-size: 10.5px !important;
    }

    .status-cell {
        font-size: 15px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
    }

    .row-number-pill {
        min-width: 20px;
        height: 19px;
        font-size: 9.5px;
    }
}


/* v15 — moderated mobile density: less choking, not tiny */
@media (max-width: 850px) {
    .items-list,
    #filesList,
    #projectsList {
        gap: 6px;
    }

    .item-card,
    .item-card.selectable,
    .file-item {
        padding: 8px 9px;
        gap: 7px;
        border-radius: 10px;
        margin-bottom: 6px;
    }

    .item-title {
        font-size: 15px;
        line-height: 1.18;
    }

    .item-subtitle {
        font-size: 11.5px;
        line-height: 1.25;
        margin-top: 4px;
    }

    .file-name {
        font-size: 13px;
        line-height: 1.2;
    }

    .item-actions {
        gap: 6px;
    }

    .button,
    button.button,
    a.button,
    .download-button,
    .link-button {
        min-height: 34px;
        padding: 7px 10px;
        font-size: 13px;
        border-radius: 8px;
    }

    .choice-block {
        min-height: 82px;
        padding: 11px 12px;
        gap: 5px;
    }

    .block-title {
        font-size: 17px;
    }

    .block-text {
        font-size: 12.5px;
        line-height: 1.25;
    }

    .hero-card,
    .panel-card {
        padding: 11px;
    }

    .page-header {
        gap: 8px;
        margin-bottom: 10px;
    }

    h1 {
        font-size: 21px;
        margin-bottom: 6px;
    }

    h2 {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .muted {
        font-size: 12.5px;
        line-height: 1.3;
    }

    .form-stack {
        gap: 9px;
    }

    label {
        font-size: 13.5px;
        gap: 5px;
    }

    input,
    textarea,
    select {
        min-height: 37px;
        padding: 8px 9px;
        font-size: 15.5px;
        border-radius: 8px;
    }

    textarea {
        min-height: 78px;
    }

    .search-input {
        margin-bottom: 8px;
    }

    .status-line {
        font-size: 11.5px;
        margin-bottom: 7px;
    }

    .role-badge {
        font-size: 10.5px;
        padding: 2px 6px;
    }

    .top-actions {
        margin-bottom: 9px;
    }

    .message,
    #result {
        margin-top: 10px;
        padding: 9px;
        font-size: 12.5px;
    }

    .selection-bar {
        padding: 7px;
        gap: 5px;
    }

    .selection-bar .button {
        min-height: 31px;
        font-size: 12px;
        padding: 7px 9px;
    }

    .select-checkbox {
        width: 22px;
        height: 22px;
        transform: none;
    }

    .tabs {
        gap: 5px;
        margin-bottom: 10px;
    }

    .tab-button,
    .inner-tab-button {
        padding: 7px 10px;
        font-size: 12.5px;
    }

    .dev-notice,
    .placeholder-panel,
    .empty {
        padding: 11px;
        font-size: 12.5px;
        border-radius: 10px;
    }

    .dashboard-grid {
        gap: 7px;
    }

    .metric-block {
        padding: 9px;
        border-radius: 10px;
    }

    .metric-block h2 {
        font-size: 13.5px;
    }

    .metric-block p {
        font-size: 11.5px;
        margin: 4px 0;
    }

    .helper-toolbar,
    .analysis-toolbar,
    .level-toolbar {
        padding: 8px 9px;
        gap: 7px;
        margin-bottom: 8px;
        border-radius: 10px;
    }

    .helper-title,
    .analysis-toolbar h2,
    .level-toolbar-title {
        font-size: 14.5px;
    }

    .helper-mode-text,
    .analysis-toolbar .muted {
        font-size: 11.5px;
    }

    .toggle-pill,
    .level-button {
        min-height: 31px;
        padding: 7px 8px;
        font-size: 12px;
    }

    .big-number,
    .helper-summary.secondary .big-number {
        font-size: 27px;
    }

    .helper-summary.central .metric-block {
        min-height: 92px;
    }

    .app-dialog {
        padding: 11px;
    }

    .app-dialog h2 {
        font-size: 17px;
    }

    .model-detail-field {
        padding: 8px;
    }

    .model-detail-value {
        font-size: 13px;
    }

    .model-detail-label {
        font-size: 10.5px;
    }
}

@media (max-width: 430px) {
    .page-shell,
    .page-shell.wide {
        padding: 6px;
    }

    .hero-card,
    .panel-card {
        padding: 9px;
    }

    h1 {
        font-size: 19px;
    }

    .item-card,
    .item-card.selectable,
    .file-item {
        padding: 8px;
        border-radius: 9px;
    }

    .item-title {
        font-size: 14.5px;
    }

    .item-subtitle {
        font-size: 11px;
    }

    .button,
    button.button,
    a.button,
    .download-button,
    .link-button {
        min-height: 33px;
        padding: 7px 9px;
        font-size: 12.5px;
    }

    .choice-block {
        min-height: 76px;
        padding: 10px;
    }

    .block-title {
        font-size: 16px;
    }

    .block-text {
        font-size: 12px;
    }

    input,
    textarea,
    select {
        min-height: 36px;
        padding: 7px 8px;
    }

    .tab-button,
    .inner-tab-button {
        font-size: 12px;
        padding: 6px 9px;
    }
}


/* v16 — output dashboard */
.output-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.output-block {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
    padding: 16px;
    min-height: 210px;
    box-shadow: 0 2px 14px rgba(0,0,0,0.04);
}

.output-block::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 5px;
    background: #222;
    opacity: 0.85;
}

.output-block-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.output-block h2 {
    margin: 0;
    font-size: 18px;
    line-height: 1.25;
}

.output-mini-badge {
    flex: 0 0 auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #f0f0f0;
    font-size: 12px;
    color: #444;
}

.output-kv,
.output-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #eee;
}

.output-kv:last-child,
.output-metric:last-child {
    border-bottom: none;
}

.output-kv span,
.output-metric span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
}

.output-kv strong,
.output-metric strong {
    direction: ltr;
    text-align: left;
    font-size: 21px;
    font-weight: bold;
}

.output-main-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 90px;
    margin-bottom: 8px;
    border-radius: 14px;
    background: #fafafa;
}

.output-main-status span {
    font-size: 42px;
    font-weight: bold;
    line-height: 1;
}

.output-main-status strong {
    font-size: 20px;
}

.output-status-ok {
    background: #e8f8e8;
    border-color: #b9e0b9;
}

.output-status-ok::before {
    background: #146b14;
}

.output-status-ok .output-main-status {
    background: rgba(255,255,255,0.62);
    color: #146b14;
}

.output-status-warning {
    background: #fff5ce;
    border-color: #e0c86d;
}

.output-status-warning::before {
    background: #8a6500;
}

.output-status-warning .output-main-status {
    background: rgba(255,255,255,0.62);
    color: #8a6500;
}

.output-status-bad {
    background: #ffe3e3;
    border-color: #efb1b1;
}

.output-status-bad::before {
    background: #8a1111;
}

.output-status-bad .output-main-status {
    background: rgba(255,255,255,0.62);
    color: #8a1111;
}

@media (max-width: 850px) {
    .output-dashboard-grid {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .output-block {
        min-height: 0;
        padding: 10px;
        border-radius: 12px;
    }

    .output-block h2 {
        font-size: 14px;
    }

    .output-block-head {
        margin-bottom: 8px;
        gap: 6px;
    }

    .output-mini-badge {
        padding: 3px 7px;
        font-size: 10.5px;
    }

    .output-kv,
    .output-metric {
        gap: 8px;
        padding: 6px 0;
    }

    .output-kv span,
    .output-metric span {
        font-size: 11px;
    }

    .output-kv strong,
    .output-metric strong {
        font-size: 16px;
    }

    .output-main-status {
        min-height: 70px;
        border-radius: 10px;
        gap: 5px;
    }

    .output-main-status span {
        font-size: 32px;
    }

    .output-main-status strong {
        font-size: 15px;
    }
}

@media (max-width: 430px) {
    .output-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .output-block {
        padding: 9px 10px;
    }
}


/* v18 — table polish + compact file action icons */
.analysis-table-block {
    border: 1px solid #dedede;
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.045);
}

.analysis-toolbar {
    border: none;
    border-bottom: 1px solid #e7e7e7;
    border-radius: 0;
    background: linear-gradient(180deg, #fff, #f8f8f8);
    margin-bottom: 0;
    padding: 15px 16px;
}

.analysis-toolbar h2 {
    margin: 0 0 4px;
}

.analysis-toolbar .muted {
    margin: 0;
}

.analysis-row-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    padding: 7px 12px;
    border-radius: 999px;
    background: #222;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    direction: ltr;
    white-space: nowrap;
}

.analysis-table-block .table-wrap {
    border-radius: 0;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table {
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.inventory-analysis-table thead th,
.polished-analysis-table thead th,
.data-table.analysis-table thead th {
    background: #f2f2f2;
    color: #151515;
    border-bottom: 1px solid #dcdcdc;
    font-size: 13px;
    letter-spacing: -0.1px;
}

.inventory-analysis-table tbody td,
.polished-analysis-table tbody td,
.data-table.analysis-table tbody td {
    border-bottom: 1px solid #eeeeee;
}

.inventory-analysis-table tbody tr:last-child td,
.polished-analysis-table tbody tr:last-child td,
.data-table.analysis-table tbody tr:last-child td {
    border-bottom: none;
}

.inventory-analysis-table tbody tr:hover,
.polished-analysis-table tbody tr:hover,
.data-table.analysis-table tbody tr:hover {
    box-shadow: inset 4px 0 0 #222;
}

.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell {
    color: #111;
}

.status-ok,
.inventory-row-ok {
    background: #edf8ed !important;
}

.status-warning,
.inventory-row-warning,
.inventory-row-warn {
    background: #fff6d7 !important;
}

.status-bad,
.inventory-row-bad {
    background: #ffe8e8 !important;
}

.status-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255,255,255,0.62);
    font-weight: bold;
}

.status-symbol.status-ok {
    color: #146b14;
}

.status-symbol.status-warning,
.status-symbol.status-warn {
    color: #8a6500;
}

.status-symbol.status-bad {
    color: #8a1111;
}

.file-icon-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    flex-wrap: nowrap;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #d7d7d7;
    background: #fff;
    color: #222;
    text-decoration: none;
    font-size: 17px;
    line-height: 1;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.icon-action:hover {
    transform: translateY(-1px);
    background: #f5f5f5;
    border-color: #aaa;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.icon-action.edit {
    background: #222;
    color: #fff;
    border-color: #222;
}

.icon-action.edit:hover {
    background: #444;
}

@media (max-width: 850px) {
    .analysis-table-block {
        border-radius: 13px;
        box-shadow: 0 3px 14px rgba(0,0,0,0.055);
    }

    .analysis-toolbar {
        padding: 9px 10px;
        gap: 7px;
    }

    .analysis-row-count-badge {
        width: 100%;
        padding: 6px 9px;
        font-size: 11.5px;
    }

    .inventory-analysis-table thead th,
    .polished-analysis-table thead th,
    .data-table.analysis-table thead th {
        font-size: 10.5px;
    }

    .inventory-analysis-table tbody td,
    .polished-analysis-table tbody td,
    .data-table.analysis-table tbody td {
        border-bottom-color: rgba(0,0,0,0.06);
    }

    .status-symbol {
        width: 23px;
        height: 23px;
        font-size: 14px;
    }

    .file-icon-actions {
        justify-content: center;
        gap: 6px;
        width: auto;
        justify-self: center;
    }

    .icon-action {
        width: 31px;
        height: 31px;
        border-radius: 9px;
        font-size: 15px;
    }

    .item-card.selectable {
        grid-template-columns: auto 1fr auto;
        align-items: center;
    }

    .item-card.selectable .item-main {
        min-width: 0;
    }

    .item-card.selectable .item-title {
        text-align: start;
    }

    .item-card.selectable .item-subtitle {
        text-align: start;
    }
}

@media (max-width: 430px) {
    .icon-action {
        width: 29px;
        height: 29px;
        font-size: 14px;
    }

    .file-icon-actions {
        gap: 5px;
    }

    .item-card.selectable {
        grid-template-columns: auto 1fr auto;
        gap: 6px;
    }
}


/* v19 — center barcode cells in detail/expanded analysis tables */
.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: center !important;
    vertical-align: middle;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    letter-spacing: 0;
}

.inventory-analysis-table th:first-child + th,
.polished-analysis-table th:first-child + th,
.data-table.analysis-table th:first-child + th,
.analysis-table th:first-child + th {
    text-align: center !important;
}

@media (max-width: 850px) {
    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        text-align: center !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-all !important;
        line-break: anywhere;
        padding-left: 3px !important;
        padding-right: 3px !important;
    }
}


/* v20 — center key analysis columns + stronger mobile overflow control */
.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell,
.inventory-analysis-table .percent-cell,
.polished-analysis-table .percent-cell,
.data-table.analysis-table .percent-cell,
.analysis-table .percent-cell,
.inventory-analysis-table .status-cell,
.polished-analysis-table .status-cell,
.data-table.analysis-table .status-cell,
.analysis-table .status-cell {
    text-align: center !important;
    vertical-align: middle !important;
}

.inventory-analysis-table th,
.polished-analysis-table th,
.data-table.analysis-table th,
.analysis-table th {
    text-align: center !important;
    vertical-align: middle !important;
}

.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell {
    font-weight: 700;
}

.inventory-analysis-table .percent-cell,
.polished-analysis-table .percent-cell,
.data-table.analysis-table .percent-cell,
.analysis-table .percent-cell {
    direction: ltr;
    unicode-bidi: isolate;
    font-weight: 800;
}

.inventory-analysis-table .status-cell,
.polished-analysis-table .status-cell,
.data-table.analysis-table .status-cell,
.analysis-table .status-cell {
    line-height: 1;
}

/* Keep analysis table content inside its own cell, especially on phones */
.inventory-analysis-table td,
.polished-analysis-table td,
.data-table.analysis-table td,
.analysis-table td {
    contain: paint;
}

@media (max-width: 850px) {
    .table-wrap,
    .table-wrap.analysis-wrap {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        contain: layout paint;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        table-layout: fixed !important;
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: separate !important;
    }

    .inventory-analysis-table th,
    .inventory-analysis-table td,
    .polished-analysis-table th,
    .polished-analysis-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td,
    .analysis-table th,
    .analysis-table td {
        min-width: 0 !important;
        max-width: 0 !important;
        overflow: hidden !important;
        text-overflow: clip !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
        line-break: anywhere;
        hyphens: auto;
        text-align: center !important;
        vertical-align: middle !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        direction: ltr;
        unicode-bidi: isolate;
        text-align: center !important;
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
        font-size: 9.8px !important;
        letter-spacing: -0.35px;
        line-height: 1.08;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        text-align: center !important;
        font-size: 10.4px !important;
        line-height: 1.12;
        font-weight: 700;
    }

    .inventory-analysis-table .percent-cell,
    .polished-analysis-table .percent-cell,
    .data-table.analysis-table .percent-cell,
    .analysis-table .percent-cell {
        text-align: center !important;
        font-size: 10.8px !important;
        line-height: 1.1;
    }

    .inventory-analysis-table .number-cell,
    .polished-analysis-table .number-cell,
    .data-table.analysis-table .number-cell,
    .analysis-table .number-cell {
        text-align: center !important;
        font-size: 10.5px !important;
        line-height: 1.1;
        direction: ltr;
        unicode-bidi: isolate;
    }

    .inventory-analysis-table .status-cell,
    .polished-analysis-table .status-cell,
    .data-table.analysis-table .status-cell,
    .analysis-table .status-cell {
        text-align: center !important;
        font-size: 14px !important;
        line-height: 1;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    .status-symbol {
        width: 21px;
        height: 21px;
        min-width: 21px;
        font-size: 12.5px;
        margin-inline: auto;
    }

    .inventory-analysis-table th,
    .polished-analysis-table th,
    .data-table.analysis-table th,
    .analysis-table th {
        font-size: 9.6px !important;
        line-height: 1.08;
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    .inventory-analysis-table td,
    .polished-analysis-table td,
    .data-table.analysis-table td,
    .analysis-table td {
        padding-left: 2px !important;
        padding-right: 2px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 26px !important;
        min-width: 26px !important;
        max-width: 26px !important;
    }

    .row-number-pill {
        min-width: 19px;
        max-width: 23px;
        height: 18px;
        font-size: 9px;
        padding: 0 3px;
    }
}

@media (max-width: 430px) {
    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        font-size: 9px !important;
        letter-spacing: -0.5px;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        font-size: 9.4px !important;
    }

    .inventory-analysis-table .percent-cell,
    .polished-analysis-table .percent-cell,
    .data-table.analysis-table .percent-cell,
    .analysis-table .percent-cell,
    .inventory-analysis-table .number-cell,
    .polished-analysis-table .number-cell,
    .data-table.analysis-table .number-cell,
    .analysis-table .number-cell {
        font-size: 9.8px !important;
    }

    .status-symbol {
        width: 20px;
        height: 20px;
        min-width: 20px;
        font-size: 12px;
    }

    .inventory-analysis-table th,
    .polished-analysis-table th,
    .data-table.analysis-table th,
    .analysis-table th {
        font-size: 9px !important;
    }
}


/* v21 — users/auth/permissions */
.auth-shell {
    width: min(92%, 460px);
}

.auth-card {
    text-align: center;
}

.auth-logo {
    display: inline-flex;
    padding: 7px 12px;
    margin-bottom: 14px;
    border-radius: 999px;
    background: #f2f2f2;
    font-size: 13px;
    color: #555;
}

.auth-form {
    text-align: right;
    margin-top: 18px;
}

.auth-form input {
    direction: ltr;
    text-align: center;
    letter-spacing: 8px;
    font-size: 24px;
    font-weight: bold;
}

.user-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 9px 14px;
    background: #1f1f1f;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.16);
}

.user-bar-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    min-width: 0;
}

.user-bar-main strong {
    font-size: 14px;
}

.user-bar-main span {
    color: #d6d6d6;
    font-size: 12px;
}

.user-logout {
    border: 1px solid rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.08);
    color: white;
    border-radius: 999px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: inherit;
}

.user-logout:hover {
    background: rgba(255,255,255,0.16);
}

@media (max-width: 850px) {
    .user-bar {
        align-items: flex-start;
        padding: 7px 9px;
        gap: 8px;
    }

    .user-bar-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .user-bar-main strong {
        font-size: 12.5px;
    }

    .user-bar-main span {
        font-size: 10.5px;
        line-height: 1.15;
    }

    .user-logout {
        padding: 5px 9px;
        font-size: 12px;
        flex: 0 0 auto;
    }

    .auth-shell {
        width: 100%;
    }

    .auth-form input {
        font-size: 22px;
        letter-spacing: 7px;
    }
}


/* v23 — professional SVG action icons */
.icon-action {
    font-size: 0;
}

.action-svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-action.view {
    color: #222;
}

.icon-action.download {
    color: #222;
}

.icon-action.edit .action-svg {
    stroke-width: 1.8;
}

@media (max-width: 850px) {
    .action-svg {
        width: 16px;
        height: 16px;
        stroke-width: 1.85;
    }
}

@media (max-width: 430px) {
    .action-svg {
        width: 15px;
        height: 15px;
    }
}


/* v24 — project settings + compact file items */
@media (max-width: 850px) {
    .item-card.selectable {
        padding: 7px 8px;
        gap: 6px;
    }

    .item-card.selectable .item-title {
        font-size: 15.4px;
        line-height: 1.16;
        font-weight: 800;
    }

    .item-card.selectable .item-subtitle {
        font-size: 10.8px;
        line-height: 1.18;
        margin-top: 3px;
    }

    .file-icon-actions {
        gap: 5px;
    }

    .icon-action {
        width: 28px;
        height: 28px;
        border-radius: 8px;
    }

    .action-svg {
        width: 14.5px;
        height: 14.5px;
    }

    .dialog-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 430px) {
    .item-card.selectable {
        padding: 6px 7px;
    }

    .item-card.selectable .item-title {
        font-size: 15px;
    }

    .icon-action {
        width: 27px;
        height: 27px;
    }
}


/* v25 — demo users test panel */
.demo-access-list {
    margin-top: 16px;
    text-align: right;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    background: #fafafa;
    color: #444;
    font-size: 13px;
}

.demo-access-list summary {
    cursor: pointer;
    font-weight: bold;
    color: #222;
}

.demo-access-list div {
    direction: ltr;
    text-align: left;
    padding-top: 6px;
    font-family: Consolas, "Courier New", monospace;
}

@media (max-width: 850px) {
    .demo-access-list {
        font-size: 12px;
        padding: 9px 10px;
    }
}


/* v26 — home auth bar fix */
.user-bar + .page-shell {
    margin-top: 22px;
}

@media (max-width: 850px) {
    .user-bar + .page-shell {
        margin-top: 8px;
    }
}


/* v27 — home accessible for unauthorized logged-in users */
.home-no-access-note {
    margin-top: 16px;
    text-align: center;
    color: #555;
}


/* v28 — permission FOUC prevention */
[data-permission] {
    display: none !important;
}

[data-permission].permission-allowed {
    display: revert !important;
}

/* Better restoration for known clickable blocks/buttons after permission approval */
.choice-block.permission-allowed {
    display: flex !important;
}

.button.permission-allowed,
a.button.permission-allowed,
.icon-action.permission-allowed,
.link-button.permission-allowed {
    display: inline-flex !important;
}

.selection-bar.permission-allowed {
    display: flex !important;
}

.select-checkbox.permission-allowed {
    display: inline-block !important;
}

@media (max-width: 850px) {
    .button.permission-allowed,
    a.button.permission-allowed,
    .link-button.permission-allowed {
        display: inline-flex !important;
    }
}


/* v29 — cleaner shell, top navigation menu, table overflow fixes */
body {
    background: #f5f5f5;
}

.panel-card,
.hero-card {
    border: 1px solid #e3e3e3;
    box-shadow: 0 6px 22px rgba(0,0,0,0.045);
}

.page-header h1,
.hero-card h1 {
    letter-spacing: -0.35px;
}

.muted {
    color: #666;
}

.app-topbar {
    min-height: 54px;
    padding: 8px 14px;
    background: rgba(28,28,28,0.98);
    backdrop-filter: blur(10px);
}

.topbar-menu-btn {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255,255,255,0.14);
    background: rgba(255,255,255,0.06);
    border-radius: 11px;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.topbar-menu-btn span {
    width: 17px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
}

.topbar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    line-height: 1.2;
}

.topbar-location {
    font-size: 15px;
    color: #fff;
}

.topbar-user {
    font-size: 11.5px;
    color: #cfcfcf;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: min(52vw, 520px);
}

.main-menu-layer {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 120;
}

.menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.18s ease;
}

.main-menu-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(360px, 88vw);
    background: #fff;
    transform: translateX(105%);
    transition: transform 0.2s ease;
    box-shadow: -12px 0 28px rgba(0,0,0,0.16);
    padding: 14px;
    overflow-y: auto;
}

body.menu-open .main-menu-layer {
    pointer-events: auto;
}

body.menu-open .menu-backdrop {
    background: rgba(0,0,0,0.34);
}

body.menu-open .main-menu-drawer {
    transform: translateX(0);
}

.menu-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.menu-head strong {
    font-size: 20px;
}

.menu-close {
    border: 0;
    background: #f1f1f1;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.menu-current {
    border: 1px solid #e8e8e8;
    border-radius: 13px;
    background: #fafafa;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-current span {
    color: #777;
    font-size: 12px;
}

.menu-current strong {
    font-size: 16px;
}

.menu-group {
    border: 1px solid #e8e8e8;
    border-radius: 13px;
    margin-bottom: 9px;
    overflow: hidden;
    background: #fff;
}

.menu-group-toggle {
    width: 100%;
    border: 0;
    background: #f7f7f7;
    padding: 11px 12px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.menu-chevron {
    transition: transform 0.15s ease;
}

.menu-group.open .menu-chevron {
    transform: rotate(180deg);
}

.menu-group-content {
    display: none;
    padding: 8px;
}

.menu-group.open .menu-group-content {
    display: grid;
    gap: 6px;
}

.menu-group-content a,
.menu-group-content button,
.menu-disabled {
    display: flex;
    align-items: center;
    min-height: 38px;
    border-radius: 10px;
    padding: 8px 10px;
    border: 0;
    background: #fff;
    color: #222;
    text-decoration: none;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    text-align: right;
}

.menu-group-content a:hover,
.menu-group-content button:hover {
    background: #f1f1f1;
}

.menu-disabled {
    color: #777;
    background: #fafafa;
    cursor: default;
}

.tabs {
    background: #f8f8f8;
    border: 1px solid #e9e9e9;
    padding: 6px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.tab-button {
    border: 0;
    background: transparent;
    padding: 9px 15px;
}

.tab-button.active {
    background: #222;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.analysis-toolbar h2 {
    font-size: 17px;
}

.analysis-toolbar .muted,
.analysis-table-subtitle {
    color: #666;
    line-height: 1.35;
}

.inventory-analysis-table th,
.polished-analysis-table th,
.data-table.analysis-table th,
.analysis-table th {
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
    line-break: anywhere;
}

.row-number-header,
.row-number-cell {
    width: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    white-space: nowrap !important;
}

.row-number-pill {
    min-width: 34px;
    max-width: none;
    width: auto;
    white-space: nowrap !important;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.barcode-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
}

/* prevent hard numeric strings from breaking in analysis tables */
.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell,
.inventory-analysis-table .number-cell,
.polished-analysis-table .number-cell,
.data-table.analysis-table .number-cell,
.analysis-table .number-cell {
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    direction: ltr;
    unicode-bidi: isolate;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    min-width: max-content;
    width: 100%;
}

@media (max-width: 850px) {
    .app-topbar {
        min-height: 48px;
        padding: 6px 8px;
    }

    .topbar-menu-btn {
        width: 34px;
        height: 34px;
        border-radius: 10px;
    }

    .topbar-location {
        font-size: 13px;
    }

    .topbar-user {
        font-size: 10.5px;
        max-width: 48vw;
    }

    .user-logout {
        font-size: 11.5px;
        padding: 5px 8px;
    }

    .main-menu-drawer {
        width: min(330px, 90vw);
        padding: 12px;
    }

    .tabs {
        border-radius: 14px;
        padding: 5px;
    }

    .tab-button {
        padding: 7px 11px;
        font-size: 12.5px;
    }

    .analysis-toolbar h2 {
        font-size: 14.5px;
    }

    .analysis-toolbar .muted {
        font-size: 11.8px;
    }

    .table-wrap,
    .table-wrap.analysis-wrap {
        overflow-x: auto !important;
        overflow-y: hidden;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        table-layout: auto !important;
        min-width: max-content !important;
        width: max-content !important;
    }

    .inventory-analysis-table th,
    .inventory-analysis-table td,
    .polished-analysis-table th,
    .polished-analysis-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td,
    .analysis-table th,
    .analysis-table td {
        max-width: none !important;
        min-width: 62px !important;
        overflow: hidden !important;
        text-overflow: clip !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 44px !important;
        min-width: 44px !important;
        max-width: 44px !important;
    }

    .row-number-pill {
        min-width: 32px;
        height: 21px;
        font-size: 10px;
    }

    .barcode-cell {
        min-width: 104px !important;
        max-width: 124px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
    }

    .brand-cell {
        min-width: 68px !important;
        max-width: 96px !important;
        white-space: normal !important;
        word-break: normal !important;
        overflow-wrap: anywhere !important;
    }

    .percent-cell,
    .number-cell {
        min-width: 54px !important;
        max-width: 72px !important;
        white-space: nowrap !important;
    }

    .status-cell {
        min-width: 44px !important;
        max-width: 50px !important;
    }
}

@media (max-width: 430px) {
    .topbar-user {
        max-width: 42vw;
    }

    .barcode-cell {
        min-width: 96px !important;
        max-width: 112px !important;
        font-size: 9.5px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
    }
}


/* v30 — report table fixes */
.analysis-table th,
.data-table.analysis-table th,
.inventory-analysis-table th,
.polished-analysis-table th {
    white-space: normal !important;
    line-height: 1.12 !important;
    vertical-align: middle !important;
    text-align: center !important;
}

.analysis-table th br,
.data-table.analysis-table th br,
.inventory-analysis-table th br,
.polished-analysis-table th br {
    display: block;
}

.brand-cell {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.2;
}

.barcode-cell {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}

.row-number-cell,
.row-number-header,
.row-number-pill {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.row-number-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding-inline: 5px;
}

@media (max-width: 850px) {
    .analysis-table th,
    .data-table.analysis-table th,
    .inventory-analysis-table th,
    .polished-analysis-table th {
        font-size: 10.8px !important;
        padding: 6px 5px !important;
        min-width: 46px !important;
        max-width: 76px !important;
    }

    .brand-cell {
        min-width: 78px !important;
        max-width: 116px !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .barcode-cell {
        min-width: 112px !important;
        max-width: 132px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
    }

    .row-number-header,
    .row-number-cell {
        min-width: 48px !important;
        width: 48px !important;
        max-width: 48px !important;
    }

    .row-number-pill {
        min-width: 36px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table th,
    .data-table.analysis-table th,
    .inventory-analysis-table th,
    .polished-analysis-table th {
        font-size: 10px !important;
        padding: 5px 4px !important;
    }

    .brand-cell {
        min-width: 72px !important;
        max-width: 104px !important;
    }

    .barcode-cell {
        min-width: 104px !important;
        max-width: 120px !important;
        font-size: 9.5px !important;
    }

    .row-number-header,
    .row-number-cell {
        min-width: 46px !important;
        width: 46px !important;
        max-width: 46px !important;
    }
}


/* v31 — file metadata + stable report tables */
.file-meta-line {
    margin-top: 5px;
    color: #666;
    font-size: 12px;
    line-height: 1.35;
}

.analysis-table th,
.data-table.analysis-table th,
.inventory-analysis-table th,
.polished-analysis-table th {
    white-space: normal !important;
    line-height: 1.12 !important;
    vertical-align: middle !important;
    text-align: center !important;
}

.analysis-table th br,
.data-table.analysis-table th br,
.inventory-analysis-table th br,
.polished-analysis-table th br {
    display: block;
}

.brand-cell {
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.2;
}

.barcode-cell {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}

.row-number-cell,
.row-number-header,
.row-number-pill {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    direction: ltr;
    font-variant-numeric: tabular-nums;
}

.row-number-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding-inline: 5px;
}

@media (max-width: 850px) {
    .file-meta-line {
        font-size: 10.8px;
    }

    .analysis-table th,
    .data-table.analysis-table th,
    .inventory-analysis-table th,
    .polished-analysis-table th {
        font-size: 10.6px !important;
        padding: 6px 5px !important;
        min-width: 46px !important;
        max-width: 78px !important;
    }

    .brand-cell {
        min-width: 78px !important;
        max-width: 116px !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }

    .barcode-cell {
        min-width: 112px !important;
        max-width: 132px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: clip !important;
    }

    .row-number-header,
    .row-number-cell {
        min-width: 48px !important;
        width: 48px !important;
        max-width: 48px !important;
    }
}


/* v33 — compact analysis tables and combined match/status column */
.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

.inventory-analysis-table th,
.inventory-analysis-table td,
.polished-analysis-table th,
.polished-analysis-table td,
.data-table.analysis-table th,
.data-table.analysis-table td,
.analysis-table th,
.analysis-table td {
    box-sizing: border-box;
    padding: 7px 6px !important;
}

/* row number must never disappear outside viewport */
.row-number-header,
.row-number-cell {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    position: sticky;
    right: 0;
    z-index: 2;
    background-clip: padding-box;
}

.inventory-analysis-table th.row-number-header,
.polished-analysis-table th.row-number-header,
.data-table.analysis-table th.row-number-header,
.analysis-table th.row-number-header {
    z-index: 4;
}

/* The two widest columns */
.barcode-cell,
.inventory-analysis-table th:nth-child(2),
.polished-analysis-table th:nth-child(2),
.data-table.analysis-table th:nth-child(2),
.analysis-table th:nth-child(2) {
    width: 34% !important;
    min-width: 0 !important;
    max-width: none !important;
}

.brand-cell,
.inventory-analysis-table th:nth-child(3),
.polished-analysis-table th:nth-child(3),
.data-table.analysis-table th:nth-child(3),
.analysis-table th:nth-child(3) {
    width: 28% !important;
    min-width: 0 !important;
    max-width: none !important;
}

/* Compact numeric columns in gears 2 and 3 */
.number-cell,
.percent-cell {
    width: 52px !important;
    min-width: 44px !important;
    max-width: 62px !important;
    text-align: center !important;
    white-space: nowrap !important;
}

.match-status-cell,
.inventory-analysis-table th:last-child,
.polished-analysis-table th:last-child,
.data-table.analysis-table th:last-child,
.analysis-table th:last-child {
    width: 78px !important;
    min-width: 70px !important;
    max-width: 86px !important;
    text-align: center !important;
}

.match-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 64px;
    max-width: 78px;
    height: 28px;
    padding: 0 6px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
    font-weight: 800;
    direction: ltr;
    unicode-bidi: isolate;
}

.match-status-percent {
    font-size: 12px;
    line-height: 1;
}

.match-status-symbol {
    font-size: 15px;
    line-height: 1;
}

.match-status-divider {
    width: 1px;
    height: 14px;
    background: rgba(0,0,0,0.16);
}

.match-status-ok {
    background: #dff5df;
    color: #126312;
}

.match-status-warn {
    background: #fff1bd;
    color: #7a5a00;
}

.match-status-bad {
    background: #ffdada;
    color: #8a1111;
}

.barcode-cell {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    font-size: 11px !important;
    letter-spacing: -0.35px;
}

.brand-cell {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    font-size: 11.2px !important;
    line-height: 1.15 !important;
}

.row-number-pill {
    min-width: 31px !important;
    height: 22px !important;
    padding-inline: 3px !important;
    font-size: 10.5px !important;
}

@media (max-width: 850px) {
    .analysis-table-block {
        margin-inline: -6px;
    }

    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        border-radius: 12px;
    }

    .inventory-analysis-table th,
    .inventory-analysis-table td,
    .polished-analysis-table th,
    .polished-analysis-table td,
    .data-table.analysis-table th,
    .data-table.analysis-table td,
    .analysis-table th,
    .analysis-table td {
        padding: 6px 4px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
    }

    .barcode-cell,
    .inventory-analysis-table th:nth-child(2),
    .polished-analysis-table th:nth-child(2),
    .data-table.analysis-table th:nth-child(2),
    .analysis-table th:nth-child(2) {
        width: 35% !important;
    }

    .brand-cell,
    .inventory-analysis-table th:nth-child(3),
    .polished-analysis-table th:nth-child(3),
    .data-table.analysis-table th:nth-child(3),
    .analysis-table th:nth-child(3) {
        width: 29% !important;
    }

    .barcode-cell {
        font-size: 9.6px !important;
        letter-spacing: -0.55px;
    }

    .brand-cell {
        font-size: 10px !important;
        line-height: 1.1 !important;
    }

    .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 68px !important;
        min-width: 64px !important;
        max-width: 72px !important;
    }

    .match-status-badge {
        min-width: 58px;
        max-width: 66px;
        height: 25px;
        gap: 4px;
        padding: 0 5px;
    }

    .match-status-percent {
        font-size: 10.5px;
    }

    .match-status-symbol {
        font-size: 13px;
    }

    .match-status-divider {
        height: 12px;
    }

    .number-cell,
    .percent-cell {
        width: 46px !important;
        min-width: 40px !important;
        max-width: 52px !important;
        font-size: 10px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block {
        margin-inline: -10px;
    }

    .row-number-header,
    .row-number-cell {
        width: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
    }

    .row-number-pill {
        min-width: 28px !important;
        font-size: 9.5px !important;
    }

    .barcode-cell {
        font-size: 8.9px !important;
        letter-spacing: -0.65px;
    }

    .brand-cell {
        font-size: 9.3px !important;
    }

    .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 62px !important;
        min-width: 60px !important;
        max-width: 64px !important;
    }

    .match-status-badge {
        min-width: 54px;
        max-width: 60px;
        height: 24px;
        padding: 0 4px;
    }

    .match-status-percent {
        font-size: 10px;
    }

    .match-status-symbol {
        font-size: 12.5px;
    }
}


/* v34 — rebalance analysis table widths */
.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    border-collapse: collapse !important;
}

/* Less dead space between # and barcode */
.row-number-header,
.row-number-cell {
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    padding-inline: 2px !important;
}

.row-number-pill {
    min-width: 25px !important;
    height: 21px !important;
    padding-inline: 2px !important;
    font-size: 10px !important;
}

/* Barcode is wide, but not wastefully wide */
.barcode-cell,
.inventory-analysis-table th:nth-child(2),
.polished-analysis-table th:nth-child(2),
.data-table.analysis-table th:nth-child(2),
.analysis-table th:nth-child(2) {
    width: 29% !important;
    padding-inline-start: 3px !important;
    padding-inline-end: 3px !important;
}

/* Brand stays one of the widest, but leaves space for the rest */
.brand-cell,
.inventory-analysis-table th:nth-child(3),
.polished-analysis-table th:nth-child(3),
.data-table.analysis-table th:nth-child(3),
.analysis-table th:nth-child(3) {
    width: 25% !important;
    padding-inline-start: 4px !important;
    padding-inline-end: 4px !important;
}

/* Give the middle numeric columns more breathing room in descriptor/summary */
.number-cell {
    width: 62px !important;
    min-width: 56px !important;
    max-width: 72px !important;
    padding-inline: 4px !important;
}

/* Combined status column should not be squeezed too hard */
.match-status-cell,
.inventory-analysis-table th:last-child,
.polished-analysis-table th:last-child,
.data-table.analysis-table th:last-child,
.analysis-table th:last-child {
    width: 84px !important;
    min-width: 76px !important;
    max-width: 92px !important;
    padding-inline: 4px !important;
}

.match-status-badge {
    min-width: 66px;
    max-width: 80px;
}

/* remove unnecessary wide gutters */
.inventory-analysis-table th,
.inventory-analysis-table td,
.polished-analysis-table th,
.polished-analysis-table td,
.data-table.analysis-table th,
.data-table.analysis-table td,
.analysis-table th,
.analysis-table td {
    padding-inline: 5px !important;
}

@media (max-width: 850px) {
    .row-number-header,
    .row-number-cell {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        padding-inline: 1px !important;
    }

    .row-number-pill {
        min-width: 24px !important;
        font-size: 9.4px !important;
    }

    .barcode-cell,
    .inventory-analysis-table th:nth-child(2),
    .polished-analysis-table th:nth-child(2),
    .data-table.analysis-table th:nth-child(2),
    .analysis-table th:nth-child(2) {
        width: 30% !important;
    }

    .brand-cell,
    .inventory-analysis-table th:nth-child(3),
    .polished-analysis-table th:nth-child(3),
    .data-table.analysis-table th:nth-child(3),
    .analysis-table th:nth-child(3) {
        width: 25% !important;
    }

    .number-cell {
        width: 56px !important;
        min-width: 50px !important;
        max-width: 64px !important;
        font-size: 10px !important;
    }

    .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 74px !important;
        min-width: 70px !important;
        max-width: 82px !important;
    }

    .match-status-badge {
        min-width: 62px;
        max-width: 72px;
    }
}

@media (max-width: 430px) {
    .row-number-header,
    .row-number-cell {
        width: 30px !important;
        min-width: 30px !important;
        max-width: 30px !important;
    }

    .barcode-cell,
    .inventory-analysis-table th:nth-child(2),
    .polished-analysis-table th:nth-child(2),
    .data-table.analysis-table th:nth-child(2),
    .analysis-table th:nth-child(2) {
        width: 30% !important;
    }

    .brand-cell,
    .inventory-analysis-table th:nth-child(3),
    .polished-analysis-table th:nth-child(3),
    .data-table.analysis-table th:nth-child(3),
    .analysis-table th:nth-child(3) {
        width: 24% !important;
    }

    .number-cell {
        width: 52px !important;
        min-width: 48px !important;
        max-width: 58px !important;
    }

    .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 70px !important;
        min-width: 66px !important;
        max-width: 76px !important;
    }

    .match-status-badge {
        min-width: 58px;
        max-width: 68px;
        gap: 3px;
    }
}


/* v36 — prevent right-side row-number clipping */
.analysis-table-block {
    overflow: visible !important;
}

.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    box-sizing: border-box;
    width: 100% !important;
    max-width: 100% !important;
    padding-right: 8px !important;
    padding-left: 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* Sticky caused the # column to sit on the viewport edge and get clipped on some phones */
.row-number-header,
.row-number-cell {
    position: static !important;
    right: auto !important;
    inset-inline-start: auto !important;
    inset-inline-end: auto !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    padding-right: 4px !important;
    padding-left: 3px !important;
    overflow: visible !important;
}

.row-number-pill {
    min-width: 28px !important;
    max-width: none !important;
    overflow: visible !important;
}

/* Keep compact spacing but do not let the first visible column touch the screen */
.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    margin-right: 0 !important;
}

@media (max-width: 850px) {
    .analysis-table-block {
        margin-right: 0 !important;
        margin-left: -6px !important;
    }

    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 10px !important;
        padding-left: 6px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        padding-right: 4px !important;
        padding-left: 3px !important;
    }

    .row-number-pill {
        min-width: 28px !important;
        font-size: 9.8px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block {
        margin-right: 0 !important;
        margin-left: -8px !important;
    }

    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 6px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 39px !important;
        min-width: 39px !important;
        max-width: 39px !important;
    }

    .row-number-pill {
        min-width: 29px !important;
    }
}


/* v38 — hard fix: no clipped right-side row number in analysis tables */
.analysis-table-block {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
}

.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 10px 12px 12px 12px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    box-sizing: border-box !important;
    scrollbar-gutter: stable both-edges;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    width: 100% !important;
    min-width: 640px !important;
    max-width: none !important;
    table-layout: fixed !important;
    margin: 0 auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* First column in RTL is the right-most # column. Keep it inside the table, not glued to the viewport. */
.inventory-analysis-table .row-number-header,
.inventory-analysis-table .row-number-cell,
.polished-analysis-table .row-number-header,
.polished-analysis-table .row-number-cell,
.data-table.analysis-table .row-number-header,
.data-table.analysis-table .row-number-cell,
.analysis-table .row-number-header,
.analysis-table .row-number-cell {
    position: static !important;
    right: auto !important;
    left: auto !important;
    inset: auto !important;
    width: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    padding: 6px 6px !important;
    overflow: visible !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.row-number-pill {
    min-width: 32px !important;
    height: 24px !important;
    padding: 0 4px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: visible !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

/* Stable proportions. Barcode and brand are widest, but not leaving dead space. */
.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell {
    width: 31% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 6px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    box-sizing: border-box !important;
}

.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell {
    width: 27% !important;
    min-width: 0 !important;
    max-width: none !important;
    padding-inline: 6px !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    line-height: 1.18 !important;
    box-sizing: border-box !important;
}

.inventory-analysis-table .number-cell,
.polished-analysis-table .number-cell,
.data-table.analysis-table .number-cell,
.analysis-table .number-cell {
    width: 72px !important;
    min-width: 62px !important;
    max-width: 82px !important;
    padding-inline: 6px !important;
    text-align: center !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.inventory-analysis-table .match-status-cell,
.polished-analysis-table .match-status-cell,
.data-table.analysis-table .match-status-cell,
.analysis-table .match-status-cell {
    width: 96px !important;
    min-width: 84px !important;
    max-width: 108px !important;
    padding-inline: 6px !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

.match-status-badge {
    min-width: 72px !important;
    max-width: 88px !important;
}

/* Header cells follow the same visual breathing room. */
.inventory-analysis-table th,
.polished-analysis-table th,
.data-table.analysis-table th,
.analysis-table th {
    padding: 7px 6px !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    line-height: 1.12 !important;
    text-align: center !important;
}

.inventory-analysis-table td,
.polished-analysis-table td,
.data-table.analysis-table td,
.analysis-table td {
    padding-top: 7px !important;
    padding-bottom: 7px !important;
}

/* On phones: allow horizontal scroll, but keep the first/right column fully visible inside the scroll area. */
@media (max-width: 850px) {
    .analysis-table-block {
        margin: 0 !important;
        padding: 0 !important;
    }

    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 14px !important;
        padding-left: 14px !important;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 560px !important;
    }

    .inventory-analysis-table .row-number-header,
    .inventory-analysis-table .row-number-cell,
    .polished-analysis-table .row-number-header,
    .polished-analysis-table .row-number-cell,
    .data-table.analysis-table .row-number-header,
    .data-table.analysis-table .row-number-cell,
    .analysis-table .row-number-header,
    .analysis-table .row-number-cell {
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
        padding-right: 6px !important;
        padding-left: 5px !important;
    }

    .row-number-pill {
        min-width: 31px !important;
        font-size: 9.8px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        font-size: 10px !important;
        letter-spacing: -0.45px;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        font-size: 10px !important;
    }

    .inventory-analysis-table .number-cell,
    .polished-analysis-table .number-cell,
    .data-table.analysis-table .number-cell,
    .analysis-table .number-cell {
        width: 62px !important;
        min-width: 56px !important;
        max-width: 70px !important;
        font-size: 10px !important;
    }

    .inventory-analysis-table .match-status-cell,
    .polished-analysis-table .match-status-cell,
    .data-table.analysis-table .match-status-cell,
    .analysis-table .match-status-cell {
        width: 86px !important;
        min-width: 78px !important;
        max-width: 96px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 16px !important;
        padding-left: 16px !important;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 540px !important;
    }

    .inventory-analysis-table .row-number-header,
    .inventory-analysis-table .row-number-cell,
    .polished-analysis-table .row-number-header,
    .polished-analysis-table .row-number-cell,
    .data-table.analysis-table .row-number-header,
    .data-table.analysis-table .row-number-cell,
    .analysis-table .row-number-header,
    .analysis-table .row-number-cell {
        width: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
    }
}


/* v39 — give combined match/status column proper breathing room */
.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    min-width: 590px !important;
}

/* make the combined column readable, not squeezed */
.inventory-analysis-table .match-status-cell,
.polished-analysis-table .match-status-cell,
.data-table.analysis-table .match-status-cell,
.analysis-table .match-status-cell,
.inventory-analysis-table th:last-child,
.polished-analysis-table th:last-child,
.data-table.analysis-table th:last-child,
.analysis-table th:last-child {
    width: 116px !important;
    min-width: 106px !important;
    max-width: 126px !important;
    padding-inline: 8px !important;
}

.match-status-badge {
    min-width: 92px !important;
    max-width: 108px !important;
    height: 30px !important;
    padding: 0 9px !important;
    gap: 7px !important;
}

.match-status-percent {
    font-size: 13px !important;
}

.match-status-symbol {
    font-size: 16px !important;
}

.match-status-divider {
    height: 15px !important;
}

/* Pull a little width back from barcode/brand so the status column breathes */
.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell {
    width: 29% !important;
}

.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell {
    width: 25% !important;
}

@media (max-width: 850px) {
    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 590px !important;
    }

    .inventory-analysis-table .match-status-cell,
    .polished-analysis-table .match-status-cell,
    .data-table.analysis-table .match-status-cell,
    .analysis-table .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 106px !important;
        min-width: 100px !important;
        max-width: 116px !important;
        padding-inline: 7px !important;
    }

    .match-status-badge {
        min-width: 86px !important;
        max-width: 100px !important;
        height: 29px !important;
        padding: 0 8px !important;
        gap: 6px !important;
    }

    .match-status-percent {
        font-size: 12.4px !important;
    }

    .match-status-symbol {
        font-size: 15px !important;
    }
}

@media (max-width: 430px) {
    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 585px !important;
    }

    .inventory-analysis-table .match-status-cell,
    .polished-analysis-table .match-status-cell,
    .data-table.analysis-table .match-status-cell,
    .analysis-table .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 102px !important;
        min-width: 96px !important;
        max-width: 110px !important;
    }

    .match-status-badge {
        min-width: 82px !important;
        max-width: 94px !important;
        height: 28px !important;
        padding: 0 7px !important;
        gap: 5px !important;
    }
}


/* v40 — mobile-first tighter barcode/brand spacing */
.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    padding-right: 10px !important;
    padding-left: 10px !important;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    min-width: 560px !important;
}

/* Reduce dead spacing between barcode and brand */
.inventory-analysis-table th,
.inventory-analysis-table td,
.polished-analysis-table th,
.polished-analysis-table td,
.data-table.analysis-table th,
.data-table.analysis-table td,
.analysis-table th,
.analysis-table td {
    padding-inline: 3px !important;
}

.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell {
    width: 27% !important;
    padding-inline-start: 3px !important;
    padding-inline-end: 2px !important;
    font-size: 10.6px !important;
    letter-spacing: -0.5px !important;
}

.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell {
    width: 23% !important;
    padding-inline-start: 2px !important;
    padding-inline-end: 3px !important;
    font-size: 10.6px !important;
    line-height: 1.12 !important;
}

/* keep # safe but not oversized */
.inventory-analysis-table .row-number-header,
.inventory-analysis-table .row-number-cell,
.polished-analysis-table .row-number-header,
.polished-analysis-table .row-number-cell,
.data-table.analysis-table .row-number-header,
.data-table.analysis-table .row-number-cell,
.analysis-table .row-number-header,
.analysis-table .row-number-cell {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    padding-inline: 4px !important;
}

.row-number-pill {
    min-width: 29px !important;
}

/* status remains readable */
.inventory-analysis-table .match-status-cell,
.polished-analysis-table .match-status-cell,
.data-table.analysis-table .match-status-cell,
.analysis-table .match-status-cell,
.inventory-analysis-table th:last-child,
.polished-analysis-table th:last-child,
.data-table.analysis-table th:last-child,
.analysis-table th:last-child {
    width: 102px !important;
    min-width: 96px !important;
    max-width: 112px !important;
    padding-inline: 5px !important;
}

.match-status-badge {
    min-width: 82px !important;
    max-width: 96px !important;
    padding: 0 7px !important;
}

/* numeric columns should breathe, but not steal width */
.inventory-analysis-table .number-cell,
.polished-analysis-table .number-cell,
.data-table.analysis-table .number-cell,
.analysis-table .number-cell {
    width: 58px !important;
    min-width: 52px !important;
    max-width: 66px !important;
    padding-inline: 4px !important;
}

@media (max-width: 850px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 11px !important;
        padding-left: 10px !important;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 545px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        width: 27% !important;
        font-size: 9.5px !important;
        letter-spacing: -0.62px !important;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        width: 22% !important;
        font-size: 9.6px !important;
    }

    .inventory-analysis-table .row-number-header,
    .inventory-analysis-table .row-number-cell,
    .polished-analysis-table .row-number-header,
    .polished-analysis-table .row-number-cell,
    .data-table.analysis-table .row-number-header,
    .data-table.analysis-table .row-number-cell,
    .analysis-table .row-number-header,
    .analysis-table .row-number-cell {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
    }

    .inventory-analysis-table .match-status-cell,
    .polished-analysis-table .match-status-cell,
    .data-table.analysis-table .match-status-cell,
    .analysis-table .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 98px !important;
        min-width: 92px !important;
        max-width: 106px !important;
    }

    .match-status-badge {
        min-width: 78px !important;
        max-width: 90px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 8px !important;
    }

    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 535px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        width: 27% !important;
        font-size: 8.9px !important;
        letter-spacing: -0.7px !important;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        width: 21.5% !important;
        font-size: 9.1px !important;
    }

    .inventory-analysis-table .match-status-cell,
    .polished-analysis-table .match-status-cell,
    .data-table.analysis-table .match-status-cell,
    .analysis-table .match-status-cell,
    .inventory-analysis-table th:last-child,
    .polished-analysis-table th:last-child,
    .data-table.analysis-table th:last-child,
    .analysis-table th:last-child {
        width: 94px !important;
        min-width: 88px !important;
        max-width: 100px !important;
    }

    .match-status-badge {
        min-width: 74px !important;
        max-width: 86px !important;
        gap: 4px !important;
    }
}


/* v41 — restore barcode look and aggressively reduce barcode/brand column width */
.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    min-width: 500px !important;
    table-layout: fixed !important;
}

/* Restore barcode visual: less compressed, normal weight/look */
.inventory-analysis-table .barcode-cell,
.polished-analysis-table .barcode-cell,
.data-table.analysis-table .barcode-cell,
.analysis-table .barcode-cell {
    width: 22% !important;
    min-width: 112px !important;
    max-width: 128px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    font-family: inherit !important;
    padding-inline: 2px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
}

/* Brand should not occupy a huge default width */
.inventory-analysis-table .brand-cell,
.polished-analysis-table .brand-cell,
.data-table.analysis-table .brand-cell,
.analysis-table .brand-cell {
    width: 18% !important;
    min-width: 82px !important;
    max-width: 102px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    line-height: 1.12 !important;
    padding-inline: 2px !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}

/* Force matching headers to follow the same proportions */
.inventory-analysis-table th:nth-child(2),
.polished-analysis-table th:nth-child(2),
.data-table.analysis-table th:nth-child(2),
.analysis-table th:nth-child(2) {
    width: 22% !important;
    min-width: 112px !important;
    max-width: 128px !important;
    padding-inline: 2px !important;
}

.inventory-analysis-table th:nth-child(3),
.polished-analysis-table th:nth-child(3),
.data-table.analysis-table th:nth-child(3),
.analysis-table th:nth-child(3) {
    width: 18% !important;
    min-width: 82px !important;
    max-width: 102px !important;
    padding-inline: 2px !important;
}

/* keep # safe and compact */
.inventory-analysis-table .row-number-header,
.inventory-analysis-table .row-number-cell,
.polished-analysis-table .row-number-header,
.polished-analysis-table .row-number-cell,
.data-table.analysis-table .row-number-header,
.data-table.analysis-table .row-number-cell,
.analysis-table .row-number-header,
.analysis-table .row-number-cell {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    padding-inline: 3px !important;
}

/* Give reclaimed width to status/numeric rather than dead space */
.inventory-analysis-table .match-status-cell,
.polished-analysis-table .match-status-cell,
.data-table.analysis-table .match-status-cell,
.analysis-table .match-status-cell,
.inventory-analysis-table th:last-child,
.polished-analysis-table th:last-child,
.data-table.analysis-table th:last-child,
.analysis-table th:last-child {
    width: 110px !important;
    min-width: 100px !important;
    max-width: 122px !important;
}

.inventory-analysis-table .number-cell,
.polished-analysis-table .number-cell,
.data-table.analysis-table .number-cell,
.analysis-table .number-cell {
    width: 64px !important;
    min-width: 56px !important;
    max-width: 72px !important;
}

/* overall cell gutters tighter */
.inventory-analysis-table th,
.inventory-analysis-table td,
.polished-analysis-table th,
.polished-analysis-table td,
.data-table.analysis-table th,
.data-table.analysis-table td,
.analysis-table th,
.analysis-table td {
    padding-inline: 2px !important;
}

@media (max-width: 850px) {
    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 490px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell,
    .inventory-analysis-table th:nth-child(2),
    .polished-analysis-table th:nth-child(2),
    .data-table.analysis-table th:nth-child(2),
    .analysis-table th:nth-child(2) {
        width: 22% !important;
        min-width: 106px !important;
        max-width: 122px !important;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell,
    .inventory-analysis-table th:nth-child(3),
    .polished-analysis-table th:nth-child(3),
    .data-table.analysis-table th:nth-child(3),
    .analysis-table th:nth-child(3) {
        width: 17% !important;
        min-width: 76px !important;
        max-width: 94px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell {
        font-size: 10.4px !important;
        letter-spacing: 0 !important;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell {
        font-size: 9.8px !important;
    }
}

@media (max-width: 430px) {
    .inventory-analysis-table,
    .polished-analysis-table,
    .data-table.analysis-table,
    .analysis-table {
        min-width: 480px !important;
    }

    .inventory-analysis-table .barcode-cell,
    .polished-analysis-table .barcode-cell,
    .data-table.analysis-table .barcode-cell,
    .analysis-table .barcode-cell,
    .inventory-analysis-table th:nth-child(2),
    .polished-analysis-table th:nth-child(2),
    .data-table.analysis-table th:nth-child(2),
    .analysis-table th:nth-child(2) {
        min-width: 102px !important;
        max-width: 116px !important;
    }

    .inventory-analysis-table .brand-cell,
    .polished-analysis-table .brand-cell,
    .data-table.analysis-table .brand-cell,
    .analysis-table .brand-cell,
    .inventory-analysis-table th:nth-child(3),
    .polished-analysis-table th:nth-child(3),
    .data-table.analysis-table th:nth-child(3),
    .analysis-table th:nth-child(3) {
        min-width: 72px !important;
        max-width: 88px !important;
    }
}


/* v42 — balanced mobile-first semantic column widths */
.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    padding-right: 12px !important;
    padding-left: 12px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
}

/* Do not stretch columns to fill dead space. The table should be as wide as its real columns. */
.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    table-layout: fixed !important;
    width: max-content !important;
    min-width: 0 !important;
    max-width: none !important;
    margin-right: 0 !important;
    margin-left: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* Global tight cell gutters */
.inventory-analysis-table th,
.inventory-analysis-table td,
.polished-analysis-table th,
.polished-analysis-table td,
.data-table.analysis-table th,
.data-table.analysis-table td,
.analysis-table th,
.analysis-table td {
    padding: 7px 4px !important;
    box-sizing: border-box !important;
}

/* # column */
.analysis-head-barcode,
.barcode-cell {
    width: 132px !important;
    min-width: 132px !important;
    max-width: 132px !important;
}

.analysis-head-brand,
.brand-cell {
    width: 112px !important;
    min-width: 112px !important;
    max-width: 112px !important;
}

.row-number-header,
.row-number-cell {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    padding-inline: 5px !important;
    text-align: center !important;
    overflow: visible !important;
}

.row-number-pill {
    min-width: 31px !important;
    height: 24px !important;
    padding-inline: 4px !important;
}

/* Numeric columns should be compact, not wider than barcode/brand */
.analysis-head-systemQuantity,
.analysis-head-actualQuantity,
.analysis-head-realDiff,
.analysis-head-systemDebt,
.number-cell {
    width: 58px !important;
    min-width: 58px !important;
    max-width: 58px !important;
    text-align: center !important;
    white-space: nowrap !important;
    padding-inline: 3px !important;
}

/* Combined status should be normal, not huge */
.analysis-head-matchStatus,
.match-status-cell {
    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
    text-align: center !important;
    padding-inline: 4px !important;
}

/* Restore readable barcode appearance */
.barcode-cell {
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
}

/* Brand can wrap inside its controlled width */
.brand-cell {
    font-size: 10.7px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}

/* More compact badge */
.match-status-badge {
    min-width: 68px !important;
    max-width: 76px !important;
    height: 28px !important;
    padding: 0 6px !important;
    gap: 5px !important;
}

.match-status-percent {
    font-size: 12px !important;
}

.match-status-symbol {
    font-size: 14px !important;
}

.match-status-divider {
    height: 13px !important;
}

/* Header alignment follows semantic widths */
.inventory-analysis-table th.analysis-head-barcode,
.polished-analysis-table th.analysis-head-barcode,
.data-table.analysis-table th.analysis-head-barcode,
.analysis-table th.analysis-head-barcode {
    width: 132px !important;
}

.inventory-analysis-table th.analysis-head-brand,
.polished-analysis-table th.analysis-head-brand,
.data-table.analysis-table th.analysis-head-brand,
.analysis-table th.analysis-head-brand {
    width: 112px !important;
}

@media (max-width: 850px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 10px !important;
    }

    .analysis-head-barcode,
    .barcode-cell {
        width: 124px !important;
        min-width: 124px !important;
        max-width: 124px !important;
    }

    .analysis-head-brand,
    .brand-cell {
        width: 98px !important;
        min-width: 98px !important;
        max-width: 98px !important;
    }

    .analysis-head-systemQuantity,
    .analysis-head-actualQuantity,
    .analysis-head-realDiff,
    .analysis-head-systemDebt,
    .number-cell {
        width: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
        font-size: 10px !important;
    }

    .analysis-head-matchStatus,
    .match-status-cell {
        width: 80px !important;
        min-width: 80px !important;
        max-width: 80px !important;
    }

    .match-status-badge {
        min-width: 64px !important;
        max-width: 70px !important;
        height: 27px !important;
        padding: 0 5px !important;
        gap: 4px !important;
    }

    .barcode-cell {
        font-size: 10.3px !important;
    }

    .brand-cell {
        font-size: 9.8px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 8px !important;
    }

    .row-number-header,
    .row-number-cell {
        width: 42px !important;
        min-width: 42px !important;
        max-width: 42px !important;
    }

    .analysis-head-barcode,
    .barcode-cell {
        width: 118px !important;
        min-width: 118px !important;
        max-width: 118px !important;
    }

    .analysis-head-brand,
    .brand-cell {
        width: 88px !important;
        min-width: 88px !important;
        max-width: 88px !important;
    }

    .analysis-head-systemQuantity,
    .analysis-head-actualQuantity,
    .analysis-head-realDiff,
    .analysis-head-systemDebt,
    .number-cell {
        width: 50px !important;
        min-width: 50px !important;
        max-width: 50px !important;
    }

    .analysis-head-matchStatus,
    .match-status-cell {
        width: 76px !important;
        min-width: 76px !important;
        max-width: 76px !important;
    }

    .match-status-badge {
        min-width: 60px !important;
        max-width: 66px !important;
        font-size: 11px !important;
    }
}


/* v43 — fix descriptor/summary header stacking */
.inventory-analysis-table th,
.polished-analysis-table th,
.data-table.analysis-table th,
.analysis-table th {
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    line-break: auto !important;
    white-space: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
}

/* numeric headers/cells: compact but readable, never letter-stacked */
.analysis-head-systemQuantity,
.analysis-head-actualQuantity,
.analysis-head-realDiff,
.analysis-head-systemDebt,
.number-cell {
    width: 62px !important;
    min-width: 62px !important;
    max-width: 62px !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    text-align: center !important;
    padding-inline: 4px !important;
}

/* status column back to sane size */
.analysis-head-matchStatus,
.match-status-cell {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    padding-inline: 4px !important;
}

.match-status-badge {
    min-width: 62px !important;
    max-width: 68px !important;
    height: 27px !important;
    padding: 0 5px !important;
    gap: 4px !important;
}

.match-status-percent {
    font-size: 11.8px !important;
}

.match-status-symbol {
    font-size: 13.5px !important;
}

.match-status-divider {
    height: 12px !important;
}

/* keep minimal view proportions stable */
.analysis-head-barcode,
.barcode-cell {
    width: 126px !important;
    min-width: 126px !important;
    max-width: 126px !important;
}

.analysis-head-brand,
.brand-cell {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
}

.row-number-header,
.row-number-cell {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
}

@media (max-width: 850px) {
    .analysis-head-barcode,
    .barcode-cell {
        width: 120px !important;
        min-width: 120px !important;
        max-width: 120px !important;
    }

    .analysis-head-brand,
    .brand-cell {
        width: 94px !important;
        min-width: 94px !important;
        max-width: 94px !important;
    }

    .analysis-head-systemQuantity,
    .analysis-head-actualQuantity,
    .analysis-head-realDiff,
    .analysis-head-systemDebt,
    .number-cell {
        width: 58px !important;
        min-width: 58px !important;
        max-width: 58px !important;
    }

    .analysis-head-matchStatus,
    .match-status-cell {
        width: 74px !important;
        min-width: 74px !important;
        max-width: 74px !important;
    }

    .match-status-badge {
        min-width: 58px !important;
        max-width: 64px !important;
    }
}

@media (max-width: 430px) {
    .analysis-head-barcode,
    .barcode-cell {
        width: 116px !important;
        min-width: 116px !important;
        max-width: 116px !important;
    }

    .analysis-head-brand,
    .brand-cell {
        width: 88px !important;
        min-width: 88px !important;
        max-width: 88px !important;
    }

    .analysis-head-systemQuantity,
    .analysis-head-actualQuantity,
    .analysis-head-realDiff,
    .analysis-head-systemDebt,
    .number-cell {
        width: 56px !important;
        min-width: 56px !important;
        max-width: 56px !important;
    }

    .analysis-head-matchStatus,
    .match-status-cell {
        width: 72px !important;
        min-width: 72px !important;
        max-width: 72px !important;
    }

    .match-status-badge {
        min-width: 56px !important;
        max-width: 62px !important;
        padding: 0 4px !important;
    }
}


/* v44 — deterministic colgroup widths, no crushed middle columns */
.analysis-table-block .table-wrap,
.analysis-table-block .table-wrap.analysis-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-right: 12px !important;
    padding-left: 12px !important;
    box-sizing: border-box !important;
}

.inventory-analysis-table,
.polished-analysis-table,
.data-table.analysis-table,
.analysis-table {
    table-layout: fixed !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* Hard semantic widths — match JS colgroup. */
.row-number-header,
.row-number-cell {
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
}

.analysis-head-barcode,
.barcode-cell {
    width: 126px !important;
    min-width: 126px !important;
    max-width: 126px !important;
}

.analysis-head-brand,
.brand-cell {
    width: 104px !important;
    min-width: 104px !important;
    max-width: 104px !important;
}

.analysis-head-systemQuantity,
.analysis-head-actualQuantity,
.analysis-head-realDiff,
.analysis-head-systemDebt,
.number-cell {
    width: 66px !important;
    min-width: 66px !important;
    max-width: 66px !important;
}

.analysis-head-matchStatus,
.match-status-cell {
    width: 86px !important;
    min-width: 86px !important;
    max-width: 86px !important;
}

/* headers must never become letter-stacked */
.inventory-analysis-table th,
.polished-analysis-table th,
.data-table.analysis-table th,
.analysis-table th {
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    line-break: auto !important;
    text-align: center !important;
    vertical-align: middle !important;
    padding: 7px 4px !important;
    font-size: 12px !important;
}

/* cells */
.inventory-analysis-table td,
.polished-analysis-table td,
.data-table.analysis-table td,
.analysis-table td {
    padding: 7px 4px !important;
    box-sizing: border-box !important;
}

.barcode-cell {
    font-family: inherit !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0 !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: clip !important;
}

.brand-cell {
    font-size: 10.7px !important;
    font-weight: 700 !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
}

.number-cell {
    text-align: center !important;
    white-space: nowrap !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.match-status-badge {
    min-width: 68px !important;
    max-width: 74px !important;
    height: 27px !important;
    padding: 0 5px !important;
    gap: 4px !important;
}

.match-status-percent {
    font-size: 11.8px !important;
}

.match-status-symbol {
    font-size: 13.5px !important;
}

.match-status-divider {
    height: 12px !important;
}

@media (max-width: 850px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 10px !important;
    }
}

@media (max-width: 430px) {
    .analysis-table-block .table-wrap,
    .analysis-table-block .table-wrap.analysis-wrap {
        padding-right: 12px !important;
        padding-left: 8px !important;
    }

    .inventory-analysis-table th,
    .polished-analysis-table th,
    .data-table.analysis-table th,
    .analysis-table th {
        font-size: 11px !important;
    }
}



/* v53 — stable project context and branch text in topbar */
.topbar-branch {
    display: block;
    font-size: 11px;
    line-height: 1.15;
    opacity: 0.9;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-center {
    min-width: 0;
}

.topbar-location,
.topbar-user {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* v56 — selected files action UI */
.selection-bar[hidden] {
    display: none !important;
}

.app-dialog .dialog-actions #downloadActionBtn.button.primary,
.app-dialog .dialog-actions #mergeActionBtn.button.primary {
    background: var(--dark);
    color: #fff;
}

.app-dialog .dialog-actions #downloadActionBtn.button.primary:hover,
.app-dialog .dialog-actions #mergeActionBtn.button.primary:hover {
    background: var(--dark-hover);
}

.app-dialog .dialog-actions #deleteActionBtn.button.danger {
    background: #b42323;
    color: #fff;
}

.app-dialog .dialog-actions #deleteActionBtn.button.danger:hover {
    background: #8f1d1d;
}

.app-dialog .dialog-actions #closeDialogBtn.button.secondary {
    background: #e7e7e7;
    color: #222;
}


.report-export-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 0 0 18px 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--soft);
}

.report-export-toolbar p {
    margin: 4px 0 0;
}

.report-export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 700px) {
    .report-export-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .report-export-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


.report-share-row {
    display: flex;
    justify-content: flex-start;
    margin: 0 0 16px 0;
}

.share-main-button {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    border: none;
    border-radius: 999px;
    background: var(--dark);
    color: #ffffff;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

.share-main-button:hover {
    background: var(--dark-hover);
}

.share-main-icon {
    font-size: 20px;
    line-height: 1;
}

.share-dialog {
    width: min(92vw, 360px);
    border: none;
    border-radius: 18px;
    padding: 20px;
}

.share-dialog h2 {
    margin: 0 0 14px 0;
    text-align: center;
    font-size: 20px;
}

.share-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

#shareFormatDialog .share-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.share-choice {
    border: 1px solid var(--border);
    background: var(--soft);
    border-radius: 14px;
    min-height: 84px;
    padding: 10px 8px;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    align-items: center;
}

.share-choice:hover {
    border-color: #999;
    background: #f0f0f0;
}

.share-choice-icon {
    font-size: 26px;
    line-height: 1;
}

.share-close-btn {
    width: 100%;
    margin-top: 12px;
}


/* v62 — compact share button */
.report-share-row {
    justify-content: flex-start;
    margin: 0 0 12px 0;
}

.share-main-button {
    padding: 7px 12px;
    font-size: 14px;
    min-height: 34px;
    border-radius: 999px;
}

.share-main-icon {
    font-size: 16px;
}


/* v63 — share button fixed in report header */
.report-header-actions {
    align-items: center;
}

.report-header-actions .share-main-button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 7px 12px;
    font-size: 14px;
    min-height: 34px;
    border-radius: 999px;
    background: var(--dark);
    color: #fff;
}

.report-header-actions .share-main-icon {
    font-size: 16px;
}


/* v66 — strict inventory row colors, including 0% full gaps */
.inventory-analysis-table tbody tr.status-ok td,
.inventory-analysis-table tbody tr.inventory-row-ok td,
.polished-analysis-table tbody tr.status-ok td,
.polished-analysis-table tbody tr.inventory-row-ok td,
.data-table.analysis-table tbody tr.status-ok td,
.data-table.analysis-table tbody tr.inventory-row-ok td {
    background: #e4f8e4 !important;
}

.inventory-analysis-table tbody tr.status-warning td,
.inventory-analysis-table tbody tr.inventory-row-warning td,
.inventory-analysis-table tbody tr.inventory-row-warn td,
.polished-analysis-table tbody tr.status-warning td,
.polished-analysis-table tbody tr.inventory-row-warning td,
.polished-analysis-table tbody tr.inventory-row-warn td,
.data-table.analysis-table tbody tr.status-warning td,
.data-table.analysis-table tbody tr.inventory-row-warning td,
.data-table.analysis-table tbody tr.inventory-row-warn td {
    background: #fff3c4 !important;
}

.inventory-analysis-table tbody tr.status-bad td,
.inventory-analysis-table tbody tr.inventory-row-bad td,
.polished-analysis-table tbody tr.status-bad td,
.polished-analysis-table tbody tr.inventory-row-bad td,
.data-table.analysis-table tbody tr.status-bad td,
.data-table.analysis-table tbody tr.inventory-row-bad td {
    background: #ffd6d6 !important;
}

.match-status-bad,
.match-status-badge.match-status-bad {
    background: #ffcaca !important;
    color: #8a1111 !important;
    border-color: #e0a0a0 !important;
}


/* v68 — scan drafts and camera scanning */
.scan-page-shell { width: min(96%, 920px); }
.scanner-camera-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    min-height: 320px;
    background: #111;
    border: 1px solid #333;
    margin-bottom: 14px;
}
.scan-video {
    width: 100%;
    min-height: 320px;
    max-height: 58vh;
    object-fit: cover;
    display: block;
    background: #111;
}
.camera-unavailable {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scanner-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 44px;
}
.scanner-target-label {
    position: absolute;
    top: 14px;
    background: rgba(0,0,0,0.68);
    color: #fff;
    padding: 7px 12px;
    border-radius: 999px;
    font-weight: bold;
}
.scanner-line {
    width: min(82%, 520px);
    height: 96px;
    border: 3px solid rgba(120,255,140,0.9);
    border-radius: 16px;
    box-shadow: 0 0 0 999px rgba(0,0,0,0.18);
}
.scan-toggle {
    position: absolute;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 4px solid #fff;
    color: #fff;
    background: #0f9d45;
    font-size: 24px;
    box-shadow: 0 7px 18px rgba(0,0,0,0.35);
}
.scan-toggle.paused { background: #b42323; }
.manual-scan-row,
.scan-actions-row,
.scan-review-header {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin: 14px 0;
}
.manual-scan-row input,
.scan-review-header input {
    flex: 1;
    min-width: 220px;
}
.scan-toast {
    position: sticky;
    top: 62px;
    z-index: 20;
    margin-bottom: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: bold;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    animation: scanToastDrop 0.18s ease-out;
}
.scan-toast.success { background: #dff7df; color: #126312; }
.scan-toast.warning { background: #fff0c7; color: #7a4d00; cursor: pointer; }
@keyframes scanToastDrop {
    from { transform: translateY(-18px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.scan-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 8px;
}
.scan-list li {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--border);
    background: var(--soft);
    border-radius: 12px;
    padding: 10px 12px;
}
.scan-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 28px;
    border-radius: 999px;
    background: #eee;
    font-weight: bold;
    direction: ltr;
}
.scan-barcode {
    direction: ltr;
    text-align: left;
    font-family: Consolas, "Courier New", monospace;
    font-weight: bold;
    overflow-wrap: anywhere;
}
.scan-time {
    color: var(--muted);
    font-size: 13px;
}
@media (max-width: 700px) {
    .scan-list li { grid-template-columns: 42px 1fr; }
    .scan-time { grid-column: 2; }
}


/* v70 — real mobile scanner window */
.scan-page-shell {
    width: min(100%, 960px);
    padding: 10px;
}

.scan-panel {
    padding: 14px;
}

.scanner-camera-card {
    position: relative !important;
    width: 100% !important;
    min-height: 360px !important;
    height: min(62vh, 560px) !important;
    overflow: hidden !important;
    border-radius: 18px !important;
    background: #050505 !important;
    border: 1px solid #1d1d1d !important;
    margin: 14px 0 !important;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 10px 24px rgba(0,0,0,0.18);
}

.scan-video {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    display: block !important;
    object-fit: cover !important;
    background: #050505 !important;
    z-index: 1 !important;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: #fff;
    background:
        radial-gradient(circle at center, rgba(255,255,255,0.08), rgba(0,0,0,0.75)),
        #111;
}

.camera-placeholder-icon {
    font-size: 44px;
    line-height: 1;
}

.camera-placeholder-title {
    font-size: 20px;
    font-weight: 800;
}

.camera-placeholder-text {
    color: rgba(255,255,255,0.82);
    line-height: 1.45;
    max-width: 360px;
}

.camera-start-btn {
    margin-top: 8px;
    min-width: 150px;
}

.camera-active .camera-placeholder {
    display: none !important;
}

.camera-active .scanner-frame {
    display: flex !important;
}

.camera-error .scanner-frame,
.camera-waiting .scanner-frame {
    display: none !important;
}

.scanner-frame {
    position: absolute !important;
    inset: 0 !important;
    z-index: 3 !important;
    pointer-events: none !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    padding-top: 48px !important;
}

.scanner-target-label {
    position: absolute !important;
    top: 14px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(0,0,0,0.72) !important;
    color: #fff !important;
    padding: 8px 13px !important;
    border-radius: 999px !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

.scanner-line {
    width: min(82%, 520px) !important;
    height: 108px !important;
    border: 3px solid rgba(88, 255, 123, 0.95) !important;
    border-radius: 18px !important;
    box-shadow: 0 0 0 999px rgba(0,0,0,0.16), 0 0 18px rgba(88,255,123,0.45) !important;
}

.scan-toggle {
    position: absolute !important;
    left: 50% !important;
    bottom: 16px !important;
    transform: translateX(-50%) !important;
    z-index: 5 !important;
    width: 58px !important;
    height: 58px !important;
    border-radius: 50% !important;
    border: 4px solid rgba(255,255,255,0.92) !important;
    color: #fff !important;
    background: #12964d !important;
    font-size: 20px !important;
    line-height: 1 !important;
    box-shadow: 0 7px 18px rgba(0,0,0,0.35) !important;
}

.scan-toggle.paused {
    background: #bd2727 !important;
}

.manual-scan-row {
    background: #f6f6f6;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px;
}

.manual-scan-row input {
    min-height: 44px;
}

.scan-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.scan-actions-row .button {
    width: 100%;
}

.scan-actions-row .button:first-child {
    grid-column: 1 / -1;
}

.scan-list li {
    min-height: 48px;
}

@media (max-width: 700px) {
    .scan-page-shell {
        padding: 6px;
    }

    .scan-panel {
        padding: 10px;
        border-radius: 12px;
    }

    .scanner-camera-card {
        height: 48vh !important;
        min-height: 300px !important;
        border-radius: 16px !important;
    }

    .scanner-line {
        width: 86% !important;
        height: 92px !important;
    }

    .manual-scan-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .manual-scan-row .button {
        width: 100%;
    }
}





/* v72 — clean scanner UI and reliable list layout */
.detector-status,
.active-detector-status {
    display: none !important;
}

.scan-list {
    display: grid !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    list-style: none !important;
}

.scan-list li {
    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 58px !important;
    padding: 9px 10px !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    background: #f7f7f7 !important;
    direction: rtl !important;
}

.scan-index {
    grid-column: 1 !important;
    grid-row: 1 !important;
    justify-self: center !important;
    direction: ltr !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 999px !important;
    background: #222 !important;
    color: #fff !important;
    font-size: 14px !important;
    font-weight: 800 !important;
}

.scan-item-main {
    grid-column: 2 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 3px !important;
    direction: ltr !important;
    text-align: left !important;
}

.scan-barcode {
    display: block !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    text-align: left !important;
    font-family: Consolas, "Courier New", monospace !important;
    font-size: 18px !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
    color: #111 !important;
    overflow-wrap: anywhere !important;
}

.scan-time {
    display: block !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    text-align: left !important;
    color: #666 !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
}

#liveListSection h2 {
    margin-top: 16px !important;
}


/* v73 — stable scanner, no video click, fixed slide-down toast */
.scan-video {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    transform: translateZ(0);
}

.scanner-camera-card {
    contain: layout paint !important;
    overscroll-behavior: contain !important;
    touch-action: none !important;
}

.scan-toast {
    position: fixed !important;
    top: calc(env(safe-area-inset-top, 0px) + 10px) !important;
    right: 10px !important;
    left: 10px !important;
    z-index: 9999 !important;
    margin: 0 auto !important;
    max-width: 520px !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    text-align: center !important;
    font-weight: 800 !important;
    box-shadow: 0 10px 28px rgba(0,0,0,0.22) !important;
    animation: scanToastDropFixed 0.18s ease-out !important;
}

.scan-toast.hidden {
    display: none !important;
}

.scan-toast.warning {
    background: #fff0c7 !important;
    color: #6a4300 !important;
    border: 1px solid #e7c46c !important;
}

.scan-toast.success {
    background: #dff7df !important;
    color: #126312 !important;
    border: 1px solid #9bd29b !important;
}

@keyframes scanToastDropFixed {
    from { transform: translateY(-22px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.camera-active .camera-placeholder {
    display: none !important;
}

.detector-status,
.active-detector-status {
    display: none !important;
}

@media (max-width: 700px) {
    .scanner-camera-card {
        height: 46vh !important;
        min-height: 310px !important;
        max-height: 520px !important;
    }

    .scan-toggle {
        bottom: 14px !important;
    }
}


/* v75 — toast only, scanner engine kept from v73 */
.scan-toast {
    position: fixed !important;
    top: max(0px, env(safe-area-inset-top, 0px)) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 2147483000 !important;
    width: min(100vw, 560px) !important;
    max-width: calc(100vw - 16px) !important;
    margin: 8px auto 0 auto !important;
    padding: 12px 14px !important;
    border-radius: 0 0 16px 16px !important;
    text-align: center !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
    box-shadow: 0 10px 28px rgba(0,0,0,0.22) !important;
    transform: translate3d(0, 0, 0) !important;
    animation: toastSlideDownV75 0.18s ease-out both !important;
    will-change: transform, opacity !important;
    touch-action: manipulation !important;
}

.scan-toast.hidden {
    display: none !important;
}

.scan-toast.closing {
    pointer-events: none !important;
    animation: toastSlideUpFadeOutV75 0.34s ease-in both !important;
}

.scan-toast.warning {
    background: #fff0c7 !important;
    color: #6a4300 !important;
    border: 1px solid #e7c46c !important;
    border-top: none !important;
}

.scan-toast.success {
    background: #dff7df !important;
    color: #126312 !important;
    border: 1px solid #9bd29b !important;
    border-top: none !important;
}

@keyframes toastSlideDownV75 {
    from {
        transform: translate3d(0, -120%, 0);
        opacity: 0;
    }
    to {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
}

@keyframes toastSlideUpFadeOutV75 {
    from {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    to {
        transform: translate3d(0, -120%, 0);
        opacity: 0;
    }
}


/* v76 — ZXing owns camera, video is display-only */
.scan-video {
    pointer-events: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}


/* v77 — scan action buttons above camera + newest-first list */
.scan-actions-top {
    margin: 12px 0 10px 0 !important;
    display: grid !important;
    grid-template-columns: 1.2fr 1fr 0.85fr !important;
    gap: 8px !important;
    align-items: stretch !important;
}

.scan-actions-top .button {
    min-height: 48px !important;
    border-radius: 14px !important;
    font-weight: 900 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    padding: 10px 12px !important;
    white-space: nowrap !important;
}

.scan-actions-top .btn-icon {
    font-size: 18px !important;
    line-height: 1 !important;
}

.scan-action-main {
    box-shadow: 0 8px 18px rgba(0,0,0,0.14) !important;
}

.scan-action-save {
    background: #f7f7f7 !important;
}

.scan-action-cancel {
    background: #f2f2f2 !important;
}

.section-hint {
    font-size: 12px !important;
    color: var(--muted) !important;
    font-weight: 700 !important;
    margin-right: 6px !important;
}

#liveScanList li:first-child {
    border-color: #222 !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.08) !important;
}

@media (max-width: 700px) {
    .scan-actions-top {
        position: sticky !important;
        top: 0 !important;
        z-index: 30 !important;
        background: rgba(255,255,255,0.96) !important;
        backdrop-filter: blur(8px) !important;
        padding: 6px 0 8px 0 !important;
        margin-top: 4px !important;
        grid-template-columns: 1fr 1fr 0.8fr !important;
    }

    .scan-actions-top .button {
        min-height: 44px !important;
        font-size: 13px !important;
        border-radius: 12px !important;
        padding: 8px 7px !important;
        gap: 5px !important;
    }

    .scan-actions-top .btn-icon {
        font-size: 15px !important;
    }
}


/* v78 — refined top actions, one-row buttons, no manual scan row */
.hidden-manual-scan,
.manual-scan-row.hidden-manual-scan {
    display: none !important;
}

.scan-actions-top {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 9px !important;
    align-items: stretch !important;
    margin: 12px 0 12px 0 !important;
    padding: 9px !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 18px !important;
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,246,246,0.96)) !important;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08) !important;
}

.scan-actions-top .button,
.scan-actions-row.scan-actions-top .button,
.scan-actions-row.scan-actions-top .button:first-child {
    grid-column: auto !important;
    width: 100% !important;
    min-height: 48px !important;
    border-radius: 14px !important;
    font-weight: 900 !important;
    letter-spacing: -0.2px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    padding: 9px 8px !important;
    white-space: nowrap !important;
    box-shadow: none !important;
}

.scan-actions-top .btn-icon {
    font-size: 17px !important;
    line-height: 1 !important;
}

.scan-actions-top .scan-action-main {
    background: #111 !important;
    color: #fff !important;
    border-color: #111 !important;
}

.scan-actions-top .scan-action-save {
    background: #ffffff !important;
    color: #111 !important;
    border-color: rgba(0,0,0,0.15) !important;
}

.scan-actions-top .scan-action-cancel {
    background: #f1f1f1 !important;
    color: #333 !important;
    border-color: rgba(0,0,0,0.12) !important;
}

.scan-actions-top .button:active {
    transform: translateY(1px) scale(0.99) !important;
}

.scanner-camera-card {
    margin-top: 10px !important;
}

.camera-placeholder-title {
    font-size: 21px !important;
    font-weight: 900 !important;
}

.camera-placeholder-text {
    font-size: 14px !important;
}

@media (max-width: 700px) {
    .scan-actions-top {
        position: sticky !important;
        top: 0 !important;
        z-index: 50 !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 6px !important;
        padding: 7px !important;
        margin: 6px 0 10px 0 !important;
        border-radius: 16px !important;
        background: rgba(255,255,255,0.96) !important;
        backdrop-filter: blur(10px) !important;
    }

    .scan-actions-top .button,
    .scan-actions-row.scan-actions-top .button,
    .scan-actions-row.scan-actions-top .button:first-child {
        min-height: 42px !important;
        border-radius: 12px !important;
        font-size: 12.5px !important;
        padding: 8px 5px !important;
        gap: 4px !important;
    }

    .scan-actions-top .btn-icon {
        font-size: 14px !important;
    }
}


/* v79 — manual add visible during scan, hidden only after finish/review */
.manual-scan-row,
#manualScanRow {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 8px !important;
    align-items: center !important;
    margin: 12px 0 !important;
    padding: 10px !important;
    border: 1px solid rgba(0,0,0,0.08) !important;
    border-radius: 16px !important;
    background: #f7f7f7 !important;
}

#manualScanRow.hidden,
.manual-scan-row.hidden {
    display: none !important;
}

.hidden-manual-scan:not(.hidden) {
    display: grid !important;
}

.manual-scan-row input {
    min-width: 0 !important;
    min-height: 44px !important;
    border-radius: 12px !important;
}

.manual-scan-row .button {
    min-height: 44px !important;
    border-radius: 12px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
}

#liveListSection {
    display: block;
}

#liveListSection.hidden {
    display: none !important;
}

@media (max-width: 700px) {
    .manual-scan-row,
    #manualScanRow {
        grid-template-columns: minmax(0, 1fr) 86px !important;
        padding: 8px !important;
        gap: 7px !important;
    }

    .manual-scan-row input {
        font-size: 14px !important;
    }
}


/* v80 — review uses top action bar; bottom keeps only back-to-scan */
.scan-actions-top .scan-action-main.inventory-update-mode {
    background: #0f7b3f !important;
    border-color: #0f7b3f !important;
    color: #fff !important;
}

.review-actions-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    margin-top: 12px !important;
}

.review-actions-row .button {
    width: 100% !important;
    min-height: 46px !important;
    border-radius: 14px !important;
    font-weight: 900 !important;
}

#reviewSection .scan-actions-row:not(.review-actions-row) {
    display: none !important;
}


/* v81 — settings readonly branch + report barcode emphasis */
.readonly-info-card {
    border: 1px solid rgba(0,0,0,0.10);
    border-radius: 14px;
    background: #f7f7f7;
    padding: 12px 14px;
    display: grid;
    gap: 4px;
}

.readonly-info-card .readonly-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.readonly-info-card strong {
    color: #111;
    font-size: 16px;
}

.readonly-info-card small {
    color: var(--muted);
    line-height: 1.35;
}

.analysis-table td.barcode-cell,
.analysis-table td.strong-barcode-cell,
.polished-analysis-table td.barcode-cell,
.polished-analysis-table td.strong-barcode-cell {
    font-weight: 900 !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    text-align: left !important;
    font-family: Consolas, "Courier New", monospace !important;
    letter-spacing: 0.2px;
    color: #050505 !important;
}

.analysis-head-barcode {
    font-weight: 900 !important;
}


/* v82 — subtle barcode readability boost in report tables */
.analysis-table td.barcode-cell,
.analysis-table td.strong-barcode-cell,
.polished-analysis-table td.barcode-cell,
.polished-analysis-table td.strong-barcode-cell {
    font-weight: 950 !important;
    font-size: 1.035em !important;
    letter-spacing: 0.28px !important;
    line-height: 1.16 !important;
    white-space: nowrap !important;
    max-width: 126px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    direction: ltr !important;
    unicode-bidi: isolate !important;
    text-align: left !important;
    font-family: Consolas, "Courier New", monospace !important;
}

.analysis-table td.barcode-cell *,
.analysis-table td.strong-barcode-cell *,
.polished-analysis-table td.barcode-cell *,
.polished-analysis-table td.strong-barcode-cell * {
    font-weight: inherit !important;
}


/* v83 — scan close button and unsaved-exit dialog */
.scan-action-cancel .btn-icon {
    font-size: 16px !important;
    font-weight: 900 !important;
}

#saveOnCancelDialog .dialog-actions {
    grid-template-columns: 1fr 1fr;
}

#saveOnCancelYesBtn {
    background: #111 !important;
    border-color: #111 !important;
    color: #fff !important;
}

#saveOnCancelNoBtn {
    background: #f2f2f2 !important;
    color: #222 !important;
    border-color: rgba(0,0,0,0.12) !important;
}


/* v84 — three-option scan exit dialog + stronger back-swipe guard */
#saveOnCancelDialog .dialog-actions {
    grid-template-columns: 1fr 1fr 0.8fr !important;
    gap: 8px !important;
}

#saveOnCancelStayBtn {
    background: #ffffff !important;
    color: #222 !important;
    border-color: rgba(0,0,0,0.16) !important;
}

@media (max-width: 700px) {
    #saveOnCancelDialog .dialog-actions {
        grid-template-columns: 1fr !important;
    }

    #saveOnCancelDialog .dialog-actions .button {
        width: 100% !important;
    }
}


/* v87 — hidden iOS haptic switch fallback for duplicate scans only */
.ios-haptic-switch {
    position: fixed !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}


/* v88 — report table status text colors: 0% / לא תקין stays red, not green */
.data-table.analysis-table tbody tr.status-bad td,
.polished-analysis-table tbody tr.status-bad td,
.analysis-table tbody tr.status-bad td {
    color: #7f1111 !important;
}

.data-table.analysis-table tbody tr.status-bad .barcode-cell,
.polished-analysis-table tbody tr.status-bad .barcode-cell,
.analysis-table tbody tr.status-bad .barcode-cell,
.data-table.analysis-table tbody tr.status-bad .strong-barcode-cell,
.polished-analysis-table tbody tr.status-bad .strong-barcode-cell,
.analysis-table tbody tr.status-bad .strong-barcode-cell {
    color: #5f0b0b !important;
}

.data-table.analysis-table tbody tr.status-bad .match-status-badge,
.polished-analysis-table tbody tr.status-bad .match-status-badge,
.analysis-table tbody tr.status-bad .match-status-badge,
.match-status-bad {
    background: #ffdada !important;
    color: #8a1111 !important;
    border-color: rgba(138,17,17,0.18) !important;
}


/* v88 — sidebar scans link + active current page */
.menu-group-content a.menu-link-active,
.menu-group-content button.menu-link-active {
    background: #111 !important;
    color: #fff !important;
    font-weight: 900 !important;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.menu-group-content a.menu-link-active:hover,
.menu-group-content button.menu-link-active:hover {
    background: #111 !important;
}

.menu-group-content a[data-menu-page="scans"]::before {
    content: "▦";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    margin-left: 6px;
    font-size: 13px;
    opacity: 0.85;
}

.menu-group-content a.menu-link-active[data-menu-page="scans"]::before {
    opacity: 1;
}


/* v98 — destructive project / scan actions */
.danger-zone {
    margin-top: 22px;
    padding: 16px;
    border: 1px solid rgba(138, 17, 17, 0.22);
    background: #fff5f5;
    border-radius: 16px;
}

.danger-zone h2 {
    color: #8a1111;
    margin-bottom: 6px;
}

.button.danger {
    background: #8a1111;
    color: #fff;
    border-color: #8a1111;
}

.button.danger:hover {
    filter: brightness(0.94);
}


/* v99 — scan drafts use the same selectable/action pattern as files */
#draftsList .item-card.selectable {
    cursor: pointer;
}


/* v100 — scan draft view/download/edit */
.scan-view-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 14px 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(0,0,0,0.04);
}

.scan-view-summary strong {
    font-size: 28px;
}


/* v101 — scan draft view search/sort + editable scan name */
.scan-view-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 12px 0;
}

.scan-name-edit-row {
    display: grid;
    gap: 6px;
    margin: 10px 0 12px 0;
    font-weight: 800;
}

.scan-name-edit-row input {
    min-height: 44px;
}

@media (max-width: 700px) {
    .scan-view-controls {
        grid-template-columns: 1fr;
    }
}



/* v106 — top menu cleanup */
.user-bar.app-topbar,
#userBar.user-bar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 10px !important;
}

.topbar-left-actions {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.topbar-icon-btn {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
    background: rgba(255,255,255,0.08) !important;
    color: #ffffff !important;
    cursor: pointer !important;
    line-height: 1 !important;
}

.topbar-icon-btn:hover {
    background: rgba(255,255,255,0.16) !important;
}

.topbar-icon {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.topbar-menu-btn span {
    display: none !important;
}

.topbar-center {
    min-width: 0 !important;
}

.topbar-user,
.topbar-branch,
.topbar-location {
    white-space: nowrap !important;
}

.user-logout {
    font-size: 0 !important;
}

.user-logout .topbar-icon {
    font-size: initial !important;
}

@media (max-width: 700px) {
    .user-bar.app-topbar,
    #userBar.user-bar {
        grid-template-columns: auto minmax(0, 1fr) auto !important;
        gap: 8px !important;
    }

    .topbar-icon-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        border-radius: 10px !important;
    }

    .topbar-icon {
        width: 20px !important;
        height: 20px !important;
    }

    .topbar-user,
    .topbar-branch {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
}



/* v107 — top menu user card, no logout button in bar */
.topbar-user-card {
    min-width: 82px !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    padding: 4px 6px !important;
    color: #ffffff !important;
    line-height: 1.1 !important;
}

.topbar-user-icon {
    width: 32px !important;
    height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,0.22) !important;
    background: rgba(255,255,255,0.08) !important;
    color: #ffffff !important;
}

.topbar-user-icon .topbar-icon {
    width: 20px !important;
    height: 20px !important;
}

.topbar-user-name {
    display: block !important;
    max-width: 124px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #ffffff !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 4px !important;
}

.user-logout {
    display: none !important;
}

.topbar-center {
    min-width: 0 !important;
}

@media (max-width: 700px) {
    .topbar-user-card {
        min-width: 66px !important;
        gap: 4px !important;
        padding: 2px 2px !important;
    }

    .topbar-user-icon {
        width: 28px !important;
        height: 28px !important;
    }

    .topbar-user-icon .topbar-icon {
        width: 18px !important;
        height: 18px !important;
    }

    .topbar-user-name {
        max-width: 82px !important;
        font-size: 11px !important;
        text-underline-offset: 3px !important;
    }
}
