:root {
    color-scheme: light;
    --ink: #152126;
    --muted: #65747a;
    --line: #dbe4e5;
    --paper: #fff;
    --brand: #087f79;
    --brand-deep: #075a57;
    --brand-soft: #e5f5f2;
    --screen: #071619;
}

* { box-sizing: border-box; }

html { background: var(--screen); }

body {
    margin: 0;
    color: var(--ink);
    background: var(--screen);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

.print-toolbar {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-height: 72px;
    padding: 12px max(24px, calc((100vw - 210mm) / 2));
    color: #d7e9e7;
    background: rgba(7, 22, 25, .96);
    border-bottom: 1px solid rgba(94, 234, 212, .18);
    backdrop-filter: blur(16px);
}

.print-toolbar a { color: #a9bfbd; text-decoration: none; font-size: .86rem; font-weight: 700; }
.print-toolbar > div { display: flex; align-items: center; gap: 14px; }
.print-toolbar span { color: #89a3a1; font-size: .76rem; }
.print-toolbar button,
.print-error a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 17px;
    color: #05201e;
    background: #5eead4;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: .85rem;
    font-weight: 850;
    text-decoration: none;
    cursor: pointer;
}

.print-report {
    width: 210mm;
    min-height: 297mm;
    margin: 24px auto 56px;
    padding: 14mm;
    background: var(--paper);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .48);
}

.print-batch-summary {
    display: flex;
    align-items: baseline;
    gap: 8px;
    width: 210mm;
    margin: 22px auto 0;
    padding: 13px 16px;
    color: #c6dcda;
    background: #0d282b;
    border: 1px solid #1d4546;
    border-radius: 13px;
}
.print-batch-summary strong { color: #5eead4; font-size: 1.15rem; }
.print-batch-summary span { font-size: .8rem; }
.print-report--batch { margin-bottom: 28px; }

.print-report__header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 18px;
    padding-bottom: 9mm;
    border-bottom: 1.5px solid var(--ink);
}

.print-brand { display: flex; align-items: center; gap: 12px; }
.print-brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: #fff;
    background: var(--brand);
    border-radius: 13px;
    font-size: 1.25rem;
    font-weight: 950;
}
.print-brand strong { display: block; font-size: 1.42rem; letter-spacing: .18em; }
.print-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: .67rem; text-transform: uppercase; letter-spacing: .08em; }

.print-report__id { text-align: right; }
.print-report__id small { display: block; color: var(--muted); font-size: .62rem; font-weight: 850; text-transform: uppercase; letter-spacing: .12em; }
.print-report__id strong { display: block; margin-top: 2px; color: var(--brand-deep); font-size: 1.55rem; }
.print-report__id time { display: block; margin-top: 5px; color: var(--muted); font-size: .7rem; }

.print-title { padding: 8mm 0 5mm; }
.print-title p { margin: 0 0 5px; color: var(--brand); font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .14em; }
.print-title h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.045em; }
.print-title span { display: block; margin-top: 6px; color: var(--muted); font-size: .8rem; line-height: 1.45; }

.print-identity {
    display: grid;
    grid-template-columns: 1.25fr repeat(3, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.print-identity > div { min-height: 56px; padding: 10px 11px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.print-identity > div:nth-child(4n) { border-right: 0; }
.print-identity > div:nth-last-child(-n+4) { border-bottom: 0; }
.print-identity small,
.print-summary dt {
    display: block;
    color: var(--muted);
    font-size: .58rem;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.print-identity strong { display: block; margin-top: 5px; font-size: .78rem; line-height: 1.3; overflow-wrap: anywhere; }

.print-section { margin-top: 8mm; }
.print-section > header { display: flex; align-items: center; gap: 9px; margin-bottom: 3.5mm; }
.print-section > header span { display: grid; place-items: center; width: 25px; height: 25px; color: #fff; background: var(--brand); border-radius: 8px; font-size: .66rem; font-weight: 900; }
.print-section > header h2 { margin: 0; font-size: .96rem; letter-spacing: -.015em; }
.print-section > header::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.print-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 0; }
.print-summary > div { padding: 11px; background: #f5f8f8; border-radius: 10px; }
.print-summary dd { margin: 5px 0 0; font-size: .76rem; font-weight: 750; line-height: 1.35; }

.print-components { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.print-component { min-height: 92px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; break-inside: avoid; }
.print-component h3 { margin: 0 0 9px; font-size: .81rem; }
.print-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.print-tags span { padding: 4px 7px; color: #315054; background: #edf3f3; border-radius: 6px; font-size: .6rem; font-weight: 720; line-height: 1.25; }
.print-component p { margin: 9px 0 0; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.print-component p b { color: var(--ink); }

.print-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.print-photos figure { margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; break-inside: avoid; }
.print-photos img { display: block; width: 100%; height: 72mm; object-fit: contain; background: #edf2f2; }
.print-photos figcaption { display: flex; justify-content: space-between; gap: 10px; padding: 9px 11px; color: var(--muted); font-size: .62rem; }
.print-photos figcaption b { color: var(--ink); }
.print-empty { margin: 0; padding: 12px 14px; color: var(--muted); background: #f5f8f8; border-radius: 9px; font-size: .75rem; }

.print-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 10mm; padding-top: 5mm; color: var(--muted); border-top: 1px solid var(--line); font-size: .59rem; }

.print-error-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; color: #d7e9e7; }
.print-error { width: min(500px, 100%); padding: 36px; text-align: center; background: #0d282b; border: 1px solid #1d4546; border-radius: 22px; }
.print-error .print-brand-mark { margin: 0 auto; }
.print-error h1 { margin: 14px 0 8px; color: #fff; }
.print-error p { color: #91aaa9; }
.print-error a { margin-top: 14px; }

@page { size: A4; margin: 5mm; }

@media print {
    html, body { background: #fff; }
    body { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    .print-toolbar, .print-batch-summary { display: none !important; }
    .print-report {
        width: auto;
        height: 280mm;
        min-height: 0;
        margin: 0;
        padding: 4mm 5mm 3mm;
        overflow: hidden;
        box-shadow: none;
        break-inside: avoid;
    }
    .print-report--batch { break-after: page; }
    .print-report--batch:last-of-type { break-after: auto; }
    .print-report__header { gap: 10px; padding-bottom: 3mm; }
    .print-brand { gap: 8px; }
    .print-brand-mark { width: 30px; height: 30px; border-radius: 9px; font-size: .9rem; }
    .print-brand strong { font-size: 1rem; }
    .print-brand small { margin-top: 1px; font-size: .48rem; }
    .print-report__id small { font-size: .47rem; }
    .print-report__id strong { font-size: 1.05rem; }
    .print-report__id time { margin-top: 2px; font-size: .52rem; }
    .print-title { padding: 3mm 0 2.5mm; }
    .print-title p { margin-bottom: 2px; font-size: .5rem; }
    .print-title h1 { font-size: 1.22rem; }
    .print-title span { margin-top: 2px; font-size: .58rem; }
    .print-identity { border-radius: 7px; }
    .print-identity > div { min-height: 35px; padding: 5px 7px; }
    .print-identity small, .print-summary dt { font-size: .45rem; }
    .print-identity strong { margin-top: 2px; font-size: .59rem; }
    .print-section { margin-top: 3.2mm; }
    .print-section > header { gap: 6px; margin-bottom: 1.5mm; }
    .print-section > header span { width: 18px; height: 18px; border-radius: 5px; font-size: .48rem; }
    .print-section > header h2 { font-size: .7rem; }
    .print-summary { gap: 5px; }
    .print-summary > div { padding: 6px 7px; border-radius: 6px; }
    .print-summary dd { margin-top: 2px; font-size: .56rem; line-height: 1.2; }
    .print-components { gap: 5px; }
    .print-component { min-height: 0; padding: 6px 7px; border-radius: 6px; }
    .print-component h3 { margin-bottom: 4px; font-size: .61rem; }
    .print-tags { gap: 3px; }
    .print-tags span { padding: 2px 4px; border-radius: 4px; font-size: .47rem; line-height: 1.15; }
    .print-component p { margin-top: 4px; font-size: .48rem; line-height: 1.25; }
    .print-photos { gap: 6px; }
    .print-photos figure { border-radius: 6px; }
    .print-photos img { height: 44mm; }
    .print-photos figcaption { padding: 4px 6px; font-size: .48rem; }
    .print-empty { padding: 7px 9px; font-size: .55rem; }
    .print-footer { margin-top: 3mm; padding-top: 2mm; font-size: .46rem; }
    .print-report__header,
    .print-identity,
    .print-summary,
    .print-component,
    .print-photos figure,
    .print-section > header { break-inside: avoid; }
    .print-section--photos { break-before: auto; }
}

@media (max-width: 850px) {
    .print-toolbar { padding: 12px 18px; }
    .print-toolbar span { display: none; }
    .print-report { width: calc(100% - 20px); min-height: auto; margin: 10px auto 28px; padding: 22px; }
    .print-batch-summary { width: calc(100% - 20px); margin-top: 10px; }
    .print-identity { grid-template-columns: 1fr 1fr; }
    .print-identity > div:nth-child(n) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .print-identity > div:nth-child(2n) { border-right: 0; }
    .print-identity > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (max-width: 560px) {
    .print-toolbar a { max-width: 125px; }
    .print-toolbar button { padding: 0 13px; }
    .print-report { padding: 16px; }
    .print-report__header { grid-template-columns: 1fr; }
    .print-report__id { text-align: left; }
    .print-identity,
    .print-summary,
    .print-components,
    .print-photos { grid-template-columns: 1fr; }
    .print-identity > div:nth-child(n) { border-right: 0; border-bottom: 1px solid var(--line); }
    .print-identity > div:last-child { border-bottom: 0; }
    .print-photos img { height: 250px; }
}
