:root {
    --ink: #172c24;
    --muted: #53675e;
    --green: #235c43;
    --dark: #142b23;
    --mint: #e7f0e9;
    --paper: #f5f7f2;
    --line: #d8e2d8;
    --white: #fff;
    --error: #8c2929;
}
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--green); text-underline-offset: .16em; }
a:hover { color: var(--dark); }
:focus-visible { outline: 3px solid #b77c30; outline-offset: 3px; }
.top { background: var(--dark); color: var(--white); }
.top-inner, .nav > div, .main { max-width: 1320px; margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2.5rem); }
.top-inner { display: flex; min-height: 76px; justify-content: space-between; align-items: center; gap: .8rem; }
.brand { display: flex; align-items: center; gap: .75rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand img { width: 42px; height: 42px; object-fit: contain; background: #fff; padding: 4px; border-radius: 9px; }
.brand span { font: 1.65rem/1 Georgia, serif; }
.brand small, .account small { display: block; margin-top: .3rem; }
.brand small { font: 600 .65rem/1.15 system-ui, sans-serif; letter-spacing: .11em; text-transform: uppercase; }
.account { display: flex; align-items: center; gap: .75rem; text-align: right; font-size: .85rem; }
.account small { color: #cbe0d3; }
.nav { display: block; background: var(--white); border-bottom: 1px solid var(--line); }
.nav > div { display: flex; flex-wrap: wrap; gap: .25rem; padding-block: .5rem; }
.nav a { text-decoration: none; font-size: .9rem; font-weight: 650; border-radius: .45rem; padding: .48rem .62rem; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--mint); }
.main { padding-block: clamp(1.2rem, 3.5vw, 2.8rem) 4rem; }
.main.auth { max-width: 530px; padding-top: clamp(2rem, 9vw, 6rem); }
.auth .form-grid { grid-template-columns: 1fr; }
.heading { margin-bottom: 1.15rem; }
h1 { font-size: clamp(1.75rem, 4vw, 2.55rem); letter-spacing: -.045em; line-height: 1.15; margin: 0 0 .35rem; font-weight: 720; }
h2 { font-size: 1.16rem; line-height: 1.35; margin: 0 0 .9rem; font-weight: 700; }
h3 { font-size: 1rem; margin: 1.1rem 0 .55rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
.heading p, .empty, .panel > p { color: var(--muted); }
.back { display: inline-block; font-size: .9rem; margin-bottom: .75rem; }
.panel, .stats > div {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: .75rem;
}
.panel { padding: clamp(.85rem, 2.1vw, 1.4rem); margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,180px),1fr)); gap: .65rem; margin-bottom: 1rem; }
.stats > div { padding: .85rem 1rem; }
.stats span { display: block; color: var(--muted); font-size: .85rem; }
.stats strong { display: block; font-size: 1.35rem; margin-top: .25rem; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,215px),1fr)); gap: .8rem; align-items: end; margin-block: .4rem .75rem; }
.filters { grid-template-columns: repeat(auto-fit,minmax(min(100%,155px),1fr)); }
.stack { display: grid; align-items: end; gap: .8rem; max-width: 650px; }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field span { font-size: .84rem; font-weight: 650; }
.field input, .field textarea, .field select {
    height: auto;
    min-height: 42px;
    width: 100%;
    background: var(--white);
    border: 1px solid #adbdaf;
    border-radius: .42rem;
    padding: .45rem .55rem;
    color: var(--ink);
}
.field textarea { resize: vertical; }
.wide { grid-column: 1/-1; }
button, .button {
    align-self: end; justify-self: start;
    display: inline-block;
    border: 1px solid var(--green);
    border-radius: .45rem;
    background: var(--green);
    color: #fff;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    padding: .55rem .85rem;
    text-align: center;
}
button:hover, .button:hover { background: var(--dark); color: #fff; }
button.secondary, .button.secondary { background: var(--white); color: var(--green); }
button.secondary:hover, .button.secondary:hover { background: var(--mint); color: var(--dark); }
.logout button { padding: .35rem .6rem; font-size: .83rem; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-block: .7rem; }
.actions:empty { display: none; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; font-size: .88rem; }
th, td { padding: .65rem .6rem; vertical-align: top; border-bottom: 1px solid var(--line); }
th { text-align: left; white-space: nowrap; background: var(--mint); font-weight: 690; }
tbody tr:last-child td { border-bottom: 0; }
td { min-width: 74px; overflow-wrap: anywhere; }
td .inline-form { font-size: .85rem; margin-bottom: .35rem; }
td .inline-form select { min-width: 170px; max-width: 270px; }
td .inline-form button { margin-top: .25rem; padding: .35rem .5rem; white-space: nowrap; }
.notice { padding: .75rem 1rem; background: var(--mint); border: 1px solid var(--line); border-radius: .5rem; margin-bottom: 1rem; }
.notice.error { color: var(--error); background: #fff3f2; border-color: #ebc9c8; }
.detail { display: grid; grid-template-columns: max-content 1fr; column-gap: 1rem; }
.detail dd { overflow-wrap: anywhere; margin: 0; }
.detail dt, .detail dd { padding-block: .25rem; }
details { margin: .75rem 0; }
summary { cursor: pointer; color: var(--green); font-weight: 650; }
.label-sheet { display: grid; width: max-content; max-width: 100%; gap: 1mm 3mm; overflow-x: auto; margin-top: 1rem; }
.label-a4 { grid-template-columns: repeat(2,90mm); }
.label-single { grid-template-columns: 90mm; }
.print-label {
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
    width: 90mm; height: 70mm; overflow: hidden; padding: 3mm 5mm;
    background: #fff; color: #142b23; border: 1px solid #708475;
    break-inside: avoid; overflow-wrap: anywhere;
    font-size: 9pt; line-height: 1.15;
}
.print-label header { display: flex; align-items: center; gap: 2mm; margin-bottom: 1.1mm; }
.print-label header img { width: 9mm; height: 9mm; object-fit: contain; }
.print-label header strong { font: bold 17pt/1 Georgia,serif; }
.print-label small { display: block; font-size: 7pt; }
.print-label h2 { font-size: 11pt; line-height: 1.07; margin: 0 0 1mm; }
.print-label p { margin: 0 0 1mm; }
.print-label .barcode { width: 57mm; height: 9mm; max-width: 100%; fill: #000; display: block; margin: 1mm 0; }
@media (max-width: 600px) {
    .nav > div { flex-wrap: nowrap; overflow-x: auto; }
    .nav a { white-space: nowrap; }
    .stats { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .stats > div { padding: .65rem .75rem; }
    .account span { max-width: 115px; overflow-wrap: anywhere; }
    .detail { grid-template-columns: 1fr; }
    .detail dd { padding-top: 0; }
}
@media print {
    @page folha { size: A4 portrait; margin: 5mm; }
    @page etiqueta { size: 90mm 70mm; margin: 0; }
    .print-page { background: #fff; }
    .print-page .top, .print-page .nav, .print-page .no-print, .print-page .notice { display: none; }
    .print-page .main { margin: 0; padding: 0; max-width: none; }
    .label-sheet { max-width: none; margin: 0; overflow: visible; }
    .label-a4 { page: folha; }
    .label-single { page: etiqueta; }
    .print-label { print-color-adjust: exact; }
}
