.opt-stack { display: grid; gap: 15px; }
.opt-form { max-width: 780px; }
.opt-span { grid-column: 1 / -1; }
.opt-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.opt-muted { color: var(--muted); margin: 5px 0; }
.opt-table { overflow-x: auto; }
.opt-nowrap { white-space: nowrap; }
.opt-facts { margin: 12px 0 18px; }
.opt-facts dt { font-weight: 700; }
.opt-facts dd { margin: 0; overflow-wrap: anywhere; }
.opt-notes { white-space: pre-wrap; overflow-wrap: anywhere; }
.opt-filter { margin-bottom: 0; }
.opt-ojo { min-width: 0; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px; }
.opt-ojo legend { padding: 0 6px; font-weight: 650; color: var(--forest-dark); }
.opt-measurements { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.opt-measurements.opt-m7 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.opt-measurement-table td { font-variant-numeric: tabular-nums; }

.opt-state {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    padding: 3px 9px;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}
.opt-state.pendiente { background: #fef3c7; color: #92400e; }
.opt-state.laboratorio { background: #e0f2fe; color: #0369a1; }
.opt-state.lista { background: #dbeafe; color: #1d4ed8; }
.opt-state.entregada { background: #e8eeff; color: #1e40af; }

.opt-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #eff6ff;
    color: #1d4ed8;
    white-space: nowrap;
}
.opt-chip.warn { background: #fef3c7; color: #92400e; }
.opt-chip.danger { background: #fee2e2; color: #b91c1c; }

.opt-nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #2563eb;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
#submenus a { display: flex; align-items: center; gap: 8px; }

.opt-metrics-compact { margin: 12px 0; }
.opt-calc-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
}
.opt-calc-box span { font-size: 12px; color: #1e40af; }
.opt-calc-box strong { font-size: 20px; color: #1d4ed8; }

.opt-sale-line {
    display: grid;
    grid-template-columns: minmax(220px, 3fr) 90px 130px auto;
    gap: 10px;
    align-items: end;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.opt-sale-line output { display: block; padding: 9px 0; text-align: right; font-weight: 700; }
.opt-scan-input { max-width: 380px; margin-top: 6px; }

.opt-inline-update { display: flex; gap: 6px; align-items: center; }
.opt-inline-update input { width: 86px; padding: 6px 8px; margin: 0; }

.opt-tag-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin-top: 14px;
}
.opt-tag-card {
    border: 1px dashed #94a3b8;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    display: grid;
    gap: 5px;
}
.opt-tag-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 13px; }
.opt-tag-head span { font-weight: 700; color: #1d4ed8; }
.opt-tag-model { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-barcode-svg { width: 100%; height: 34px; display: block; }
.opt-tag-code { text-align: center; font: 600 11px/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; color: #0f172a; }

.opt-stack textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; resize: vertical; font: inherit;
    color: var(--ink); background: #fff; border: 1px solid #cbd5e1; border-radius: 7px; }

.opt-cutline { border: 0; border-top: 2px dashed #94a3b8; margin: 24px 0; }
.opt-print main { max-width: 840px; margin: auto; padding: 18px; }
.opt-print .panel { padding: 22px; }
.opt-print-actions { margin: 0 0 16px; }
.opt-print .opt-measurement-table th { white-space: normal; }
.opt-print footer { color: var(--muted); margin-top: 24px; }

@media (max-width: 1020px) {
    .opt-measurements.opt-m7 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .opt-measurements { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .opt-sale-line { grid-template-columns: 1fr 80px; }
}
@media (max-width: 540px) {
    .opt-measurements, .opt-measurements.opt-m7 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .panel-title, .page-head { flex-wrap: wrap; }
    .opt-print .opt-measurement-table th, .opt-print .opt-measurement-table td { padding: 8px; }
}
@media print {
    body.opt-print { background: white; color: #000; }
    .opt-print main { max-width: none; margin: 0; padding: 0; }
    .opt-print .panel { border: 0; box-shadow: none; padding: 0; }
    .opt-print-actions { display: none; }
    .opt-print .opt-table { overflow: visible; }
    .opt-tag-print { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .opt-tag-card { break-inside: avoid; }
}
