.joy-stack { display: grid; gap: 15px; }
.joy-form { max-width: 780px; }
.joy-span { grid-column: 1 / -1; }
.joy-table { overflow-x: auto; }
.joy-nowrap { white-space: nowrap; }
.joy-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.joy-top { margin-top: 14px; }
.joy-muted { color: var(--muted); }
.joy-inline { display: inline; }
.joy-inline-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.joy-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; }

.joy-metal-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.joy-metal-form input[name="precio_gramo"] { width: 110px; padding: 6px 8px; margin: 0; }
.joy-metal-form select { width: auto; padding: 6px 8px; margin: 0; }
.joy-metal-form .check { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin: 0; }
.joy-metal-form .check input { width: auto; margin: 0; }

.joy-tag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(195px, 1fr)); gap: 12px; margin-top: 14px; }
.joy-tag-card { border: 1px dashed #94a3b8; border-radius: 10px; padding: 10px 12px; background: #fff; display: grid; gap: 4px; }
.joy-tag-head { display: flex; justify-content: space-between; font-size: 13px; }
.joy-tag-head span { font-weight: 700; color: #1d4ed8; }
.joy-tag-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.joy-tag-spec { font-size: 11px; color: var(--muted); }
.joy-barcode { width: 100%; height: 28px; display: block; margin-top: 3px; }

.joy-track-body { background: #eff6ff; }
.joy-track-wrap { max-width: 580px; margin: 0 auto; padding: 18px 14px 40px; display: grid; gap: 14px; }
.joy-track-head { display: flex; align-items: center; gap: 10px; }
.joy-track-head .brand-icon { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg,#2563eb,#1d4ed8); display: grid; place-items: center; color: #fff; }
.joy-track-head .brand-icon svg { width: 20px; height: 20px; color: #fff; }
.joy-track-head small { display: block; color: var(--muted); font-size: 12px; }
.joy-track-head a { margin-left: auto; }

.joy-stepper { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 0; margin: 16px 0 0; }
.joy-stepper li { text-align: center; display: grid; justify-items: center; gap: 4px; color: var(--muted); }
.joy-stepper li span { width: 28px; height: 28px; border-radius: 50%; background: #e2e8f0; color: #475569; font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.joy-stepper li.done span { background: #2563eb; color: #fff; }
.joy-stepper li.current small { color: #1d4ed8; font-weight: 700; }

.joy-warranty-card { border: 2px solid #bfdbfe; padding: 28px; }

.joy-rows { margin: 14px 0 0; border: 1px solid var(--line); border-radius: 9px; min-width: 0; padding: 12px; }
.joy-rows legend { padding-inline: 6px; font-weight: 700; }
.joy-sale-row { display: grid; grid-template-columns: minmax(0, 1fr) 94px; gap: 10px; margin-bottom: 10px; }
.joy-sale-row:last-child { margin-bottom: 0; }
.joy-sale-row select { width: 100%; text-overflow: ellipsis; }
.joy-state { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: #e0f2fe; color: #0369a1; }
.joy-state.recibida, .joy-state.presupuestada { background: #fef3c7; color: #92400e; }
.joy-state.lista, .joy-state.entregada { background: #dbeafe; color: #1d4ed8; }
.joy-facts dt, .joy-balance dt { color: var(--muted); font-size: 13px; }
.joy-facts dd, .joy-balance dd { margin: 3px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.joy-balance { display: flex; flex-wrap: wrap; gap: 12px 24px; border-top: 1px solid var(--line); padding: 12px 0 0; margin-bottom: 0; }
.joy-total { text-align: right; font-size: 18px; font-weight: 700; }
.joy-form textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; resize: vertical;
    font: inherit; color: var(--ink); background: white; border: 1px solid #cbd5e1; border-radius: 7px; }
.joy-print main { max-width: 820px; margin: auto; padding: 20px; }
.joy-print-nav { margin-bottom: 16px; }
@media (max-width: 600px) {
    .panel-title, .page-head { flex-wrap: wrap; }
    .joy-orders table, .joy-orders tbody { display: block; }
    .joy-orders thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .joy-orders tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
    .joy-orders tbody tr:last-child { border-bottom: 0; }
    .joy-orders td { display: block; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
    .joy-orders td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); }
    .joy-order-name { grid-column: 1 / -1; grid-row: 1; font-weight: 700; }
    .joy-order-action { text-align: right; align-self: center; }
}
@media print {
    body.joy-print { background: white; color: #000; }
    .joy-print .panel { border: 0; box-shadow: none; padding: 0; }
    .joy-print-nav { display: none; }
    .joy-tag-print { grid-template-columns: repeat(3, 1fr); gap: 8px; }
    .joy-tag-card { break-inside: avoid; }
}
