:root {
    --bg: #f7f4ef;
    --panel: #fffdf9;
    --text: #262321;
    --muted: #746d66;
    --line: #e4ded6;
    --primary: #8f2942;
    --primary-dark: #6f1d33;
    --accent: #21766a;
    --warning: #a66a18;
    --danger: #a83c32;
    --shadow: 0 12px 35px rgba(38, 35, 33, 0.08);
    --content-max: 1180px;
    --content-pad: 24px;
}

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    width: 100%;
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    overflow-x: hidden;
}

img,
video,
canvas,
svg {
    max-width: 100%;
}

a {
    color: inherit;
}

input,
textarea,
select,
button {
    font: inherit;
    max-width: 100%;
    min-width: 0;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 12px 13px;
    outline: none;
    min-height: 46px;
}

input[type="file"] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(143, 41, 66, 0.13);
}

label {
    display: grid;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

code {
    display: inline-block;
    max-width: 100%;
    background: #f1ebe4;
    border-radius: 6px;
    color: #453d37;
    line-height: 1.35;
    overflow-wrap: anywhere;
    padding: 3px 6px;
    white-space: normal;
    word-break: normal;
}

.product-code,
.code-value {
    max-width: 100%;
    line-height: 1.35;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: normal;
}

.product-price,
.product-size,
.product-stock {
    overflow-wrap: normal;
    white-space: nowrap;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 253, 249, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 18px;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    align-items: center;
    padding: 14px var(--content-pad);
}

.topbar-inner > *,
.page-shell > *,
.panel > * {
    min-width: 0;
}

.brand,
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.brand strong,
.login-brand h1 {
    display: block;
    margin: 0;
    line-height: 1;
}

.brand small,
.login-brand p {
    display: block;
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.brand-mark {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border-radius: 8px;
    background: var(--text);
    color: #fff;
    font-weight: 900;
    letter-spacing: 0;
}

.main-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.main-nav a {
    border-radius: 8px;
    color: var(--muted);
    padding: 10px 12px;
    text-decoration: none;
    font-weight: 700;
}

.main-nav a:hover,
.main-nav a.active {
    background: #f1ebe4;
    color: var(--text);
}

.session-box,
.actions-row,
.button-stack {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}

.session-box form {
    margin: 0;
    min-width: 0;
}

.session-box span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.session-user {
    display: grid;
    gap: 2px;
    text-align: right;
}

.session-user small {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
}

.export-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.page-shell {
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 30px var(--content-pad) 56px;
}

.page-heading,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.page-heading > *,
.section-heading > * {
    min-width: 0;
}

.page-heading h1,
.section-heading h2 {
    margin: 0;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.page-heading h1 {
    font-size: 2.35rem;
}

.section-heading h2 {
    font-size: 1.25rem;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.panel,
.metric,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel {
    width: 100%;
    max-width: 100%;
    margin-bottom: 18px;
    padding: clamp(16px, 3vw, 24px);
}

.narrow-panel {
    max-width: 680px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    padding: 10px 16px;
    text-decoration: none;
    font-weight: 850;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

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

.button-ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}

.button-danger {
    background: #fff1ee;
    border-color: #efc7c0;
    color: var(--danger);
}

.button-danger:hover {
    background: #ffe4df;
    border-color: #dc9e94;
}

.button-small {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.85rem;
}

.button-full {
    width: 100%;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.metric-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
    display: grid;
    gap: 8px;
    padding: 20px;
}

.metric span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.25;
}

.metric strong {
    font-size: 1.8rem;
}

.summary-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.summary-toolbar strong {
    display: block;
    font-size: 1rem;
}

.period-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.period-filter label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
}

.period-filter select {
    min-width: 190px;
    background: #fff;
    font-weight: 800;
}

.dashboard-grid,
.product-detail-grid,
.scanner-grid,
.form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.product-detail-grid {
    column-gap: 18px;
    row-gap: 24px;
}

.product-detail-grid > .product-card {
    grid-column: 1;
    grid-row: 1;
}

.product-detail-grid > .qr-panel {
    grid-column: 2;
    grid-row: 1 / span 2;
}

.product-detail-grid > .quick-sale-section {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
    max-width: none;
    margin: 0;
}

.quick-sale-section form {
    display: grid;
    gap: 16px;
}

.quick-sale-section button[type="submit"] {
    margin-top: 4px;
}

.dashboard-grid > *,
.product-detail-grid > *,
.scanner-grid > *,
.form-grid > * {
    min-width: 0;
}

.form-section {
    display: grid;
    gap: 18px;
}

.input-grid,
.filters {
    display: grid;
    gap: 14px;
    align-items: end;
}

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

.input-grid.three,
.filters {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
}

.filters label {
    min-width: 0;
}

.sales-filters {
    grid-template-columns: minmax(220px, 1.4fr) minmax(145px, 0.8fr) minmax(145px, 0.8fr) minmax(150px, 0.9fr) auto;
    gap: 16px;
}

.sales-filters.has-user-filter {
    grid-template-columns: minmax(220px, 1.4fr) minmax(145px, 0.8fr) minmax(145px, 0.8fr) minmax(150px, 0.9fr) minmax(150px, 0.9fr) auto;
}

.sales-filters input[type="date"],
.sales-filters select[name="sort"] {
    min-width: 0;
    width: 100%;
}

.sales-filters .filter-actions {
    display: flex;
    align-items: end;
    gap: 12px;
    white-space: nowrap;
}

.sales-filters .filter-actions .button {
    flex: 0 0 auto;
}

.size-field {
    position: relative;
    display: block;
    width: 100%;
    margin: 22px 0 0;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: #fff;
    padding: 28px 24px 20px;
}

.size-label {
    position: absolute;
    top: -11px;
    left: 24px;
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    padding: 0 8px;
}

.size-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.size-pill {
    position: relative;
    display: inline-flex;
    margin: 0;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.size-pill input[type="radio"] {
    position: absolute;
    width: 1px;
    height: 1px;
    min-height: 0 !important;
    opacity: 0;
    pointer-events: none;
    appearance: none;
    margin: 0;
}

.size-pill span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 700;
    padding: 0 14px;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.size-pill span:hover {
    transform: translateY(-1px);
    border-color: var(--text);
}

.size-pill input[type="radio"]:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(143, 41, 66, 0.13);
}

.size-pill input[type="radio"]:checked + span {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.variant-stock-field {
    position: relative;
    width: 100%;
    margin: 22px 0 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 22px;
}

.variant-stock-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
}

.variant-stock-heading .size-label {
    position: static;
    display: block;
    padding: 0;
    margin-bottom: 5px;
}

.variant-stock-heading small,
.computed-status span {
    color: var(--muted);
}

.variant-stock-heading > strong {
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--bg);
    padding: 9px 13px;
    font-size: 0.85rem;
}

.variant-stock-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(90px, 1fr));
    gap: 12px;
}

.variant-stock-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
}

.variant-stock-item > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: var(--text);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
}

.variant-stock-item input {
    min-width: 0;
    min-height: 42px;
    text-align: center;
    padding: 8px;
}

.computed-status {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
}

.computed-status strong {
    margin-top: 4px;
}

.variant-stock-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
}

.variant-stock-summary span {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 4px 8px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.variant-qr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.qr-size-selector {
    margin-bottom: 18px;
}

.qr-size-selector > span {
    display: block;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 700;
}

.qr-size-options {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.qr-size-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 750;
    padding: 0 14px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.qr-size-pill:hover {
    border-color: var(--text);
    transform: translateY(-1px);
}

.qr-size-pill:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 3px rgba(143, 41, 66, 0.13);
}

.qr-size-pill.active,
.qr-size-pill[aria-pressed="true"] {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.variant-qr-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    align-self: start;
    width: 100%;
    max-width: 380px;
    height: auto;
    min-height: 0;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px 16px 16px;
    text-align: center;
}

.variant-qr-card canvas,
.variant-qr-card > img {
    display: block;
    width: min(100%, 220px);
    height: auto;
    margin: 10px auto;
    flex: 0 0 auto;
}

.variant-qr-card canvas[hidden],
.variant-qr-card > img[hidden] {
    display: none;
}

.variant-qr-card code {
    display: block;
    margin: 0;
}

.variant-qr-card small {
    display: block;
    margin: 3px 0 0;
    color: var(--muted);
    line-height: 1.35;
}

.variant-qr-card > strong {
    display: block;
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.variant-qr-card .eyebrow {
    margin: 0 0 5px;
}

.variant-qr-card .button-stack {
    margin-top: 10px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 1040px;
}

.data-table th:nth-child(1),
.data-table td:nth-child(1) {
    width: 82px;
}

.data-table th:nth-child(3),
.data-table td:nth-child(3) {
    width: 140px;
}

.data-table th:nth-child(4),
.data-table td:nth-child(4) {
    width: 220px;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    width: 112px;
}

.data-table th:nth-child(6),
.data-table td:nth-child(6) {
    width: 76px;
}

.data-table th:nth-child(7),
.data-table td:nth-child(7) {
    width: 118px;
}

.data-table th:nth-child(8),
.data-table td:nth-child(8) {
    width: 230px;
}

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 13px 10px;
    text-align: left;
    vertical-align: middle;
    overflow-wrap: anywhere;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.data-table small,
.compact-list small {
    display: block;
    color: var(--muted);
    margin-top: 3px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.pagination-link {
    display: inline-flex;
    min-width: 44px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 9px 13px;
    text-decoration: none;
    font-weight: 850;
}

.pagination-link:hover {
    border-color: var(--primary);
}

.pagination-link.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-link.is-disabled {
    background: #f8f5f0;
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.7;
}

.pagination-link.is-disabled:hover {
    border-color: var(--line);
}

.pagination-ellipsis {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    color: var(--muted);
    font-weight: 850;
}

.pagination-mobile-status {
    display: none;
    color: var(--muted);
    font-weight: 850;
    text-align: center;
}

.compact-action {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 0.75rem;
    font-weight: 900;
    margin-top: 7px;
    padding: 5px 9px;
}

.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
}

.actions-col {
    width: 230px;
}

.sales-table {
    min-width: 1160px;
}

.sales-table th:nth-child(1),
.sales-table td:nth-child(1) {
    width: 128px;
}

.sales-table th:nth-child(2),
.sales-table td:nth-child(2) {
    width: 190px;
}

.sales-table th:nth-child(3),
.sales-table td:nth-child(3) {
    width: 72px;
}

.sales-table th:nth-child(4),
.sales-table td:nth-child(4) {
    width: 116px;
}

.sales-table th:nth-child(5),
.sales-table td:nth-child(5) {
    width: 130px;
}

.sales-table .sale-code,
.sales-table .payment-method {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.sales-table th:nth-child(6),
.sales-table td:nth-child(6) {
    width: 118px;
}

.sales-table th:nth-child(7),
.sales-table td:nth-child(7) {
    width: 185px;
}

.sales-table th:nth-child(8),
.sales-table td:nth-child(8) {
    width: 220px;
}

.thumb {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
    color: var(--muted);
    font-size: 0.75rem;
}

.thumb-empty,
.placeholder {
    background: #f1ebe4;
}

.product-card,
.scan-card {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr);
    gap: 20px;
}

.product-card > *,
.scan-card > * {
    min-width: 0;
}

.product-photo {
    width: 100%;
    aspect-ratio: 4 / 5;
    border: 1px solid var(--line);
    border-radius: 8px;
    object-fit: cover;
}

.product-photo.placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-weight: 800;
}

.product-gallery {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    gap: 8px;
}

.gallery-thumbs button {
    display: block;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    padding: 0;
}

.gallery-thumbs button.active {
    border-color: var(--text);
}

.gallery-thumbs img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.product-info {
    display: grid;
    align-content: start;
    gap: 16px;
    min-width: 0;
}

.product-info h2 {
    margin: 0;
    overflow-wrap: anywhere;
}

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

.detail-list div {
    border-bottom: 1px solid var(--line);
    min-width: 0;
    padding-bottom: 10px;
}

.detail-list dt {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 900;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 4px 0 0;
    font-weight: 800;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.description {
    margin: 0;
    color: var(--muted);
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.badge {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 900;
}

.badge-success {
    background: #e6f4ef;
    color: var(--accent);
}

.badge-warning {
    background: #fff1dc;
    color: var(--warning);
}

.badge-danger {
    background: #ffe9e5;
    color: var(--danger);
}

.qr-panel {
    display: grid;
    align-content: start;
    gap: 16px;
}

.qr-print-card {
    display: grid;
    justify-items: center;
    gap: 8px;
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    padding: 18px;
    text-align: center;
}

.qr-print-card canvas,
.qr-print-card img {
    width: 260px;
    height: 260px;
}

.qr-print-card small {
    color: var(--muted);
}

.image-preview {
    display: grid;
    width: 100%;
    aspect-ratio: 4 / 5;
    place-items: center;
    overflow: hidden;
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 800;
}

.image-block {
    display: grid;
    gap: 10px;
}

.image-section-title {
    margin: 0;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.2;
}

.product-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
    gap: 14px;
    align-items: start;
    min-width: 0;
}

.product-images-grid.is-empty {
    grid-template-columns: 1fr;
    min-height: 94px;
    place-items: center;
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 800;
    padding: 14px;
    text-align: center;
}

.image-empty {
    margin: 0;
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    font-weight: 800;
    padding: 14px;
    text-align: center;
}

.product-image-card {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin: 0;
}

.product-image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.product-image-card-main {
    border-color: var(--text);
}

.image-main-badge,
.image-new-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    border-radius: 999px;
    background: var(--text);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    padding: 5px 8px;
}

.image-new-badge {
    background: var(--primary);
}

.image-actions {
    display: grid;
    gap: 7px;
    padding: 8px;
}

.image-choice {
    display: block;
    margin: 0;
}

.image-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.image-choice span,
.image-choice-button {
    display: flex;
    width: 100%;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 850;
    padding: 8px;
    text-align: center;
    white-space: normal;
}

.image-choice-button:hover {
    border-color: var(--text);
    background: #f8f3ed;
}

.image-choice input:checked + span {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.image-choice-danger span {
    border-color: #efc7c0;
    color: var(--danger);
}

.image-choice-danger input:checked + span {
    border-color: var(--danger);
    background: #ffe4df;
    color: var(--danger);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.compact-list {
    display: grid;
}

.compact-list a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
    text-decoration: none;
}

.compact-list a:last-child {
    border-bottom: 0;
}

.movements-footer-link {
    margin-top: 16px;
}

.dashboard-summary-list {
    display: grid;
    margin: 0;
}

.inventory-alerts {
    grid-template-columns: 1fr;
}

.sales-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-summary-list > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    border-top: 1px solid var(--line);
    padding: 16px 0;
}

.sales-summary > div + div {
    border-left: 1px solid var(--line);
    padding-left: 20px;
}

.sales-summary > div:not(:last-child) {
    padding-right: 20px;
}

.dashboard-summary-list dt {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.3;
}

.dashboard-summary-list dd {
    flex: 0 0 auto;
    margin: 0;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.dashboard-summary-list .summary-text-value {
    min-width: 0;
    max-width: 65%;
    font-size: 1rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-align: right;
}

.dashboard-grid-wide {
    grid-column: 1 / -1;
}

.summary-period-label {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
}

.recent-sale-main {
    display: block;
    min-width: 0;
}

.recent-sale-main > strong {
    display: block;
    overflow-wrap: anywhere;
}

.recent-sale-total {
    flex: 0 0 auto;
    white-space: nowrap;
}

.empty-state,
.help-text {
    color: var(--muted);
}

.empty-state {
    margin: 0;
    padding: 18px;
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    text-align: center;
}

.alert {
    margin-bottom: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 13px 14px;
    font-weight: 750;
}

.alert-success {
    background: #e6f4ef;
    border-color: #b9ddd0;
    color: #1e6c61;
}

.alert-warning {
    background: #fff1dc;
    border-color: #efd1a6;
    color: #80520e;
}

.alert-danger {
    background: #ffe9e5;
    border-color: #efc0b8;
    color: #8f3028;
}

body.modal-open {
    overflow: hidden;
}

.confirm-modal[hidden] {
    display: none !important;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    padding: 20px;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: rgba(38, 35, 33, 0.48);
    cursor: pointer;
    padding: 0;
}

.confirm-dialog {
    position: relative;
    width: min(460px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 24px 70px rgba(38, 35, 33, 0.22);
    padding: clamp(18px, 4vw, 26px);
}

.confirm-dialog h2 {
    margin: 0 0 12px;
    font-size: 1.4rem;
    line-height: 1.1;
}

.confirm-dialog p {
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.45;
}

.confirm-detail {
    border: 1px dashed #cfc5bc;
    border-radius: 8px;
    background: #fff;
    color: var(--text) !important;
    font-weight: 800;
    padding: 12px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.sale-detail-dialog {
    width: min(780px, 100%);
    max-height: calc(100dvh - 40px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

@supports not (height: 100dvh) {
    .sale-detail-dialog {
        max-height: calc(100vh - 40px);
    }
}

[data-sale-detail-content] {
    min-width: 0;
    max-width: 100%;
}

.sale-detail-dialog > .confirm-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    background: var(--panel);
    padding-top: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

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

.sale-detail-header h2,
.sale-detail-header p {
    margin: 0;
}

.sale-detail-header p {
    color: var(--muted);
}

.sale-detail-totals {
    display: grid;
    min-width: 150px;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
    text-align: right;
}

.sale-detail-totals span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.sale-detail-totals strong {
    font-size: 1.25rem;
}

.sale-detail-items {
    display: grid;
    gap: 10px;
}

.sale-detail-item {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
}

.sale-detail-item > div {
    min-width: 0;
}

.sale-detail-item small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.sale-detail-numbers {
    display: grid;
    gap: 3px;
    text-align: right;
}

.sale-detail-numbers span {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
}

.scanner-panel {
    display: grid;
    gap: 16px;
}

.qr-reader {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    min-height: 360px;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #151311;
}

.qr-reader video,
.qr-reader canvas,
.qr-reader img {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    border-radius: 18px;
    object-fit: cover !important;
}

.qr-reader > div,
#qr-reader__scan_region {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

#qr-reader__scan_region video,
#qr-reader__scan_region canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

#qr-reader__dashboard_section {
    display: none !important;
}

.camera-select-field[hidden] {
    display: none !important;
}

.manual-lookup {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.scan-product-picker[hidden] {
    display: none !important;
}

.scan-product-card {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 14px;
}

.scan-product-photo {
    display: grid;
    width: 104px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f1ebe4;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    object-fit: cover;
}

.scan-product-body {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.scan-product-body h3 {
    margin: 0;
    font-size: 1.12rem;
    line-height: 1.2;
}

.scan-product-body > small {
    color: var(--muted);
    font-weight: 750;
    line-height: 1.35;
}

.scan-size-field {
    display: grid;
    gap: 10px;
}

.scan-size-field > span {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 800;
}

.scan-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scan-size-pill {
    display: inline-grid;
    min-width: 74px;
    min-height: 48px;
    place-items: center;
    gap: 2px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    padding: 7px 12px;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.scan-size-pill strong {
    line-height: 1;
}

.scan-size-pill small {
    color: inherit;
    font-size: 0.7rem;
    font-weight: 750;
    line-height: 1;
}

.scan-size-pill:hover:not(:disabled) {
    border-color: var(--text);
    transform: translateY(-1px);
}

.scan-size-pill.active,
.scan-size-pill[aria-pressed="true"] {
    border-color: var(--text);
    background: var(--text);
    color: #fff;
}

.scan-size-pill:disabled {
    cursor: not-allowed;
    opacity: 0.42;
}

.scanner-message {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f4f1ed;
    color: var(--muted);
    padding: 13px 14px;
    font-size: 0.94rem;
    font-weight: 800;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.scanner-message:empty,
.scanner-message[hidden] {
    display: none !important;
}

.scanner-message.success {
    border-color: #b9ddd0;
    background: #e6f4ef;
    color: #1e6c61;
}

.scanner-message.danger {
    border-color: #efc0b8;
    background: #ffe9e5;
    color: #8f3028;
}

.scanner-message.info {
    border-color: #d9cbbd;
    background: #f4f1ed;
    color: var(--text);
}

.sale-cart-panel {
    display: grid;
    gap: 16px;
}

.cart-items {
    display: grid;
    gap: 12px;
}

.cart-item {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 12px;
}

.cart-item-photo {
    display: grid;
    width: 92px;
    aspect-ratio: 1;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f1ebe4;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 800;
    object-fit: cover;
}

.cart-item-body {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.cart-item-heading {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.cart-item-heading > div {
    min-width: 0;
}

.cart-item-heading strong {
    display: block;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.cart-item-heading small {
    display: block;
    color: var(--muted);
    margin-top: 5px;
    line-height: 1.35;
}

.cart-item-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.cart-item-meta span {
    display: grid;
    gap: 2px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.cart-item-meta strong {
    color: var(--text);
    font-size: 0.92rem;
}

.quantity-control {
    display: inline-grid;
    grid-template-columns: 44px minmax(42px, auto) 44px;
    gap: 8px;
    align-items: center;
    justify-self: start;
}

.quantity-control strong {
    display: grid;
    min-height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fffdf9;
    font-size: 1rem;
}

.cart-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.cart-summary > div {
    display: grid;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 13px;
}

.cart-summary span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.cart-summary strong {
    font-size: 1.35rem;
}

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: min(440px, 100%);
}

.login-panel {
    padding: clamp(22px, 5vw, 34px);
}

.login-form {
    display: grid;
    gap: 16px;
    margin-top: 24px;
}

.login-brand {
    margin-bottom: 18px;
}

.login-brand h1 {
    font-size: 2rem;
}

@media (max-width: 1100px) {
    .sales-filters,
    .sales-filters.has-user-filter {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }

    .sales-filters .filter-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

@media (max-width: 1024px) {
    :root {
        --content-pad: 18px;
    }

    .topbar-inner {
        grid-template-columns: auto 1fr auto;
        gap: 12px;
        padding: 12px 18px;
    }

    .main-nav a {
        padding: 9px 10px;
    }

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

    .dashboard-grid,
    .product-detail-grid,
    .scanner-grid,
    .form-grid {
        grid-template-columns: 1fr;
    }

    .product-detail-grid {
        gap: 20px;
    }

    .product-detail-grid > .product-card,
    .product-detail-grid > .qr-panel,
    .product-detail-grid > .quick-sale-section {
        grid-column: 1;
        grid-row: auto;
    }

    .input-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .sales-filters,
    .sales-filters.has-user-filter {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sales-filters select[name="sort"] {
        width: 100%;
        min-width: 0;
    }

    .sales-filters .filter-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-column: 1 / -1;
        width: 100%;
    }

    .sales-filters .filter-actions .button {
        width: 100%;
    }

    .filters .button {
        width: 100%;
    }
}

@media (max-width: 768px) {
    :root {
        --content-pad: 16px;
    }

    .topbar-inner {
        position: sticky;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px;
        padding: 10px var(--content-pad);
    }

    .brand {
        grid-column: 1;
        grid-row: 1;
        gap: 9px;
    }

    .brand-mark {
        width: 38px;
        height: 38px;
        font-size: 0.86rem;
    }

    .brand strong {
        font-size: 0.98rem;
    }

    .brand small {
        font-size: 0.72rem;
    }

    .main-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        padding: 2px 0 1px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .main-nav::-webkit-scrollbar {
        display: none;
    }

    .main-nav a {
        flex: 0 0 auto;
        min-height: 38px;
        padding: 9px 11px;
        white-space: nowrap;
    }

    .session-box {
        grid-column: 2;
        grid-row: 1;
        justify-content: flex-end;
        gap: 6px;
    }

.session-user {
        display: none;
    }

    .topbar .button {
        min-height: 38px;
        padding: 8px 10px;
        font-size: 0.86rem;
        white-space: nowrap;
    }

    .page-shell {
        padding-top: 20px;
        padding-bottom: 24px;
    }

    .page-heading,
    .section-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 14px;
    }

    .page-heading h1 {
        font-size: 1.9rem;
    }

    .section-heading h2 {
        font-size: 1.12rem;
    }

    .panel {
        margin-bottom: 14px;
        padding: 16px;
    }

    .export-actions {
        justify-content: stretch;
    }

    .page-heading > .button {
        width: 100%;
    }

    .export-actions .button {
        width: 100%;
    }

    .pagination {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        gap: 8px;
    }

    .pagination-pages {
        display: none;
    }

    .pagination-link {
        width: 100%;
        min-width: 0;
        padding: 10px 12px;
    }

    .pagination-mobile-status {
        display: inline-flex;
        min-height: 44px;
        align-items: center;
        justify-content: center;
        padding: 0 6px;
        font-size: 0.92rem;
        white-space: nowrap;
    }

    .metric-grid,
    .metric-grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .metric {
        padding: 16px;
    }

    .metric strong {
        font-size: 1.55rem;
    }

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

    .period-filter {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .period-filter select {
        width: 100%;
        min-width: 0;
    }

    .sales-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-summary-list > div:nth-child(n) {
        border-left: 0;
        padding: 14px 0;
    }

    .recent-sales-list {
        gap: 10px;
    }

    .recent-sales-list a,
    .recent-sales-list a:last-child {
        align-items: flex-start;
        flex-direction: column;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        padding: 14px;
    }

    .recent-sale-total {
        font-size: 1.05rem;
    }

    .input-grid.two,
    .input-grid.three,
    .filters,
    .sales-filters,
    .sales-filters.has-user-filter,
    .manual-lookup,
    .product-card,
    .scan-card {
        grid-template-columns: 1fr;
    }

    .product-card,
    .scan-card {
        gap: 16px;
    }

    .product-card .detail-list,
    .scan-card .detail-list {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .product-card .detail-list div,
    .scan-card .detail-list div {
        display: grid;
        grid-template-columns: minmax(88px, auto) minmax(0, 1fr);
        gap: 12px;
        align-items: start;
        padding: 11px 0;
    }

    .product-card .detail-list dt,
    .scan-card .detail-list dt {
        align-self: start;
    }

    .product-card .detail-list dd,
    .scan-card .detail-list dd {
        justify-self: end;
        margin: 0;
        text-align: right;
    }

    .size-field {
        margin-top: 20px;
        padding: 26px 18px 18px;
    }

    .size-options {
        gap: 9px;
    }

    .size-pill span {
        min-width: 42px;
        height: 42px;
    }

    .variant-stock-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .variant-stock-heading > strong {
        align-self: flex-start;
    }

    .variant-stock-grid,
    .variant-qr-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions-row,
    .button-stack {
        align-items: stretch;
    }

    .page-shell .actions-row > *,
    .page-shell .button-stack > *,
    .page-shell .filters .button,
    .page-shell .manual-lookup .button {
        width: 100%;
    }

    .button {
        min-height: 48px;
        padding: 12px 15px;
    }

    .button-small {
        min-height: 44px;
    }

    .table-wrap {
        overflow: visible;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .data-table {
        border-collapse: separate;
        border-spacing: 0;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody {
        display: grid;
        gap: 12px;
    }

    .data-table tr {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: #fff;
        padding: 12px;
    }

    .data-table td {
        display: grid;
        grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
        gap: 10px;
        align-items: center;
        border-bottom: 1px solid #f0eae3;
        padding: 9px 0;
        text-align: right;
    }

    .data-table td:last-child {
        border-bottom: 0;
    }

    .data-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 0.75rem;
        font-weight: 900;
        text-align: left;
        text-transform: uppercase;
    }

    .data-table td[data-label="Foto"] {
        grid-template-columns: 1fr;
        justify-items: start;
        text-align: left;
    }

    .data-table td[data-label="Foto"]::before {
        display: none;
    }

    .data-table .table-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .data-table .table-actions .button {
        width: 100%;
    }

    .sales-table .table-actions {
        grid-template-columns: 1fr;
    }

    .sales-table td.sale-code,
    .sales-table td.payment-method {
        width: 100%;
        min-width: 0;
        overflow-x: auto;
    }

    .data-table code {
        justify-self: end;
        text-align: left;
    }

    .data-table td[data-label="Codigo"],
    .data-table td[data-label="Precio"],
    .data-table td[data-label="Talle"],
    .data-table td[data-label="Stock"],
    .data-table td[data-label="Cant."] {
        align-items: start;
    }

    .thumb {
        width: 82px;
        height: 82px;
    }

    .product-photo {
        max-height: 420px;
    }

    .scan-card .product-photo {
        max-height: 320px;
    }

    .qr-reader {
        min-height: 340px;
        aspect-ratio: 1 / 1;
    }

    .qr-reader > div {
        max-width: 100% !important;
    }

    .qr-reader video {
        object-fit: cover;
    }

    .cart-item {
        grid-template-columns: 78px minmax(0, 1fr);
        gap: 12px;
        padding: 10px;
    }

    .cart-item-photo {
        width: 78px;
    }

    .cart-item-heading {
        display: grid;
        gap: 10px;
    }

    .cart-item-heading .button {
        width: 100%;
    }

    .cart-item-meta {
        grid-template-columns: 1fr;
    }

    .quantity-control {
        width: 100%;
        grid-template-columns: 48px minmax(0, 1fr) 48px;
    }

    .qr-print-card {
        padding: 14px;
    }

    .confirm-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .confirm-actions .button {
        width: 100%;
    }

    .sale-detail-modal {
        place-items: start center;
        overflow: hidden;
        padding: 16px 14px;
    }

    .sale-detail-dialog {
        width: 100%;
        max-width: 100%;
        max-height: calc(100dvh - 32px);
        margin: 0 auto;
    }

    @supports not (height: 100dvh) {
        .sale-detail-dialog {
            max-height: calc(100vh - 32px);
        }
    }

    .sale-detail-header {
        display: grid;
    }

    .sale-detail-totals {
        text-align: left;
    }

    .sale-detail-item {
        grid-template-columns: 58px minmax(0, 1fr);
        max-width: 100%;
        overflow: hidden;
    }

    .sale-detail-numbers {
        grid-column: 1 / -1;
        text-align: left;
    }
}

@media (max-width: 480px) {
    :root {
        --content-pad: 12px;
    }

    .topbar-inner {
        align-items: center;
        gap: 6px;
    }

    .brand small {
        display: none;
    }

    .topbar .button {
        min-height: 36px;
        padding: 7px 7px;
    }

    .page-shell {
        padding-top: 16px;
    }

    .page-heading h1 {
        font-size: 1.72rem;
    }

    .metric-grid,
    .metric-grid.three,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .product-card .detail-list div,
    .scan-card .detail-list div {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .product-card .detail-list dd,
    .scan-card .detail-list dd {
        justify-self: stretch;
        text-align: left;
    }

    .size-options {
        justify-content: flex-start;
    }

    .size-pill {
        flex: 0 0 auto;
    }

    .variant-stock-field {
        padding: 16px;
    }

    .variant-stock-grid,
    .variant-qr-grid {
        grid-template-columns: 1fr;
    }

    .variant-qr-card {
        max-width: 100%;
        padding: 12px 14px 14px;
    }

    .variant-qr-card canvas,
    .variant-qr-card > img {
        width: min(100%, 210px);
        margin-top: 8px;
        margin-bottom: 8px;
    }

    .data-table td {
        grid-template-columns: 1fr;
        justify-items: stretch;
        text-align: left;
    }

    .data-table td::before {
        margin-bottom: 2px;
    }

    .data-table code {
        justify-self: start;
    }

    .data-table .table-actions {
        grid-template-columns: 1fr;
    }

    .cart-item {
        grid-template-columns: 1fr;
    }

    .cart-item-photo {
        width: 100%;
        max-height: 220px;
    }

    .cart-summary {
        grid-template-columns: 1fr;
    }

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

    .qr-reader {
        min-height: 320px;
    }

    .qr-print-card canvas,
    .qr-print-card img {
        width: min(260px, 100%);
        height: auto;
    }

    .login-body {
        align-items: start;
        padding: 16px 12px;
    }

    .login-panel {
        padding: 20px 16px;
    }

    .login-brand h1 {
        font-size: 1.72rem;
    }
}

@media print {
    body {
        background: #fff;
    }

    .topbar,
    .page-heading,
    .product-detail-grid > .product-card,
    .narrow-panel,
    .button-stack,
    .help-text,
    .alert {
        display: none !important;
    }

    .page-shell,
    .panel {
        width: auto;
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
    }

    .product-detail-grid {
        display: block;
    }

    .qr-panel {
        display: block;
    }

    .qr-print-card {
        width: 72mm;
        min-height: 92mm;
        border: 1px solid #111;
        padding: 6mm;
    }

    body.variant-printing .variant-qr-grid {
        display: block;
    }

    body.variant-printing .qr-panel > .section-heading,
    body.variant-printing .qr-size-selector {
        display: none !important;
    }

    body.variant-printing .variant-qr-card {
        display: none;
    }

    body.variant-printing .variant-qr-card.print-target {
        display: block;
        width: 72mm;
        min-height: 92mm;
        border: 1px solid #111;
        padding: 6mm;
    }
}
@media (max-width: 620px) {
    .scan-product-card {
        grid-template-columns: 1fr;
    }

    .scan-product-photo {
        width: min(180px, 100%);
        margin: 0 auto;
    }

    .scan-size-pill {
        min-width: calc(50% - 5px);
    }

    .scan-product-body > .button {
        width: 100%;
    }
}