/* =========================
   App Shell
   ========================= */
:root {
    --app-bg: #f6f7fb;

    /* Cut guide */
    --cut-guide-color: rgba(0, 0, 0, 0.55);
    --cut-guide-color-export: #000000;
}

body.app-shell {
    background: var(--app-bg);
}

.app-header {
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .04);
}

.app-title {
    font-size: 1.6rem;
    font-weight: 700;
}

.preview-area {
    min-height: 240px;
}


/* =========================
   Pages & Export (Standard)
   ========================= */
.page {
    width: 794px;
    height: 1123px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: max-content;
    gap: 10px;
    padding: 20px;
    box-sizing: border-box;
    page-break-after: always;
    background: white;
    align-items: start;
}

body.exporting .page {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

body.exporting {
    background: #fff !important;
}


/* =========================
   Labels (Base)
   ========================= */
.etiquette {
    width: 230px;
    height: 180px;
    padding: 10px;
    box-sizing: border-box;
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.etiquette.horizontal {
    grid-column: span 2;
}

body.exporting .etiquette {
    margin: 0 !important;
}


/* =========================
   Cut Guide
   ========================= */

.etiquette {
    position: relative;
    /* required for the overlay border */
}

.etiquette::after {
    content: "";
    position: absolute;
    inset: 0;
    border: 1px solid rgba(0, 0, 0, 0.6);
    pointer-events: none;
    box-sizing: border-box;
    z-index: 2;
}

body.exporting .etiquette::after,
body.exporting-ts .etiquette::after {
    border-color: #000000;
}


/* =========================
   Import UI
   ========================= */
#excel-upload {
    cursor: pointer;
}


/* =========================
   tsRACKS Pages (Dedicated)
   ========================= */
.page-ts {
    width: 794px;
    height: 1123px;
    box-sizing: border-box;
    padding: 20px;
    page-break-after: always;
    background: #ffffff;
}

.page-ts-large {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: flex-start;
    justify-content: flex-start;
}

.page-ts-small {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    align-items: start;
    justify-items: center;
}

body.exporting-ts .page-ts-large {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}

body.exporting-ts .page-ts-small {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: flex-start !important;
}


/* =========================
   tsRACKS Labels
   ========================= */
.etiquette-ts-large {
    width: 15cm;
    height: 8cm;
    display: flex;
    flex-direction: column;
    padding: 0.45cm 0.55cm;
    box-sizing: border-box;
    border-radius: 6px;
    color: #000000;
    font-family: Arial, sans-serif;
    overflow: visible;
}

.etiquette-ts-large .ts-top {
    font-size: 1.15cm;
    font-weight: 900;
    line-height: 1.05;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.etiquette-ts-large .ts-body {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6cm;
    min-width: 0;
}

.etiquette-ts-large .ts-number {
    margin-left: auto;
    max-width: 8.6cm;
    min-width: 0;
    font-size: 3.35cm;
    font-weight: 900;
    line-height: 0.95;
    white-space: nowrap;
    letter-spacing: -0.02em;
    text-align: right;
    flex: 1 1 auto;
}

.etiquette-ts-small {
    width: 3cm;
    height: 15cm;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3cm 0.25cm;
    box-sizing: border-box;
    border-radius: 6px;
    color: #000000;
    font-family: Arial, sans-serif;
    overflow: visible;
}

.etiquette-ts-small .ts-code {
    margin-top: 0.2cm;
    font-size: 0.34cm;
    font-weight: 900;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    letter-spacing: -0.02em;
    width: 100%;
}

.etiquette-ts-small .ts-number-vertical {
    margin-top: 0.25cm;
    font-size: 2.15cm;
    font-weight: 900;
    line-height: 2.05cm;
    text-align: center;
}


/* =========================
   DataMatrix Wrapper
   ========================= */
.dm-wrap {
    background: #ffffff;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.dm-wrap-large {
    padding: 0.22cm;
}

.dm-wrap-small {
    padding: 0.16cm;
}

.ts-dm {
    display: block;
}


/* =========================
   Export Progress Overlay
   ========================= */
.export-progress {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(2px);
}

.export-progress-card {
    width: min(520px, calc(100vw - 40px));
    background: #fff;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .10);
}
/* =========================
   TAG matériel Pages & Labels
   ========================= */
.page-material-tags {
    width: 794px;
    height: 1123px;
    box-sizing: border-box;
    padding: 20px;
    page-break-after: always;
    background: #ffffff;
    display: grid;
    grid-template-columns: repeat(10, max-content);
    grid-auto-rows: max-content;
    gap: 10px;
    align-items: start;
    justify-content: start;
}

.etiquette-material-tag {
    width: 56px;
    height: 70px;
    padding: 4px;
    box-sizing: border-box;
    background: #ffffff;
    color: #000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: Arial, sans-serif;
    overflow: hidden;
}

.etiquette-material-tag .material-tag-title {
    font-size: 7px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.etiquette-material-tag .material-tag-dm {
    display: block;
    width: 30px;
    height: 30px;
}

.etiquette-material-tag .material-tag-code {
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
