/* Juva web-control - Design System */
:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-muted: #f1f5f9;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-border: #c7d2fe;
    --primary-ring: rgba(79, 70, 229, 0.2);

    --ok: #059669;
    --ok-bg: #ecfdf5;
    --ok-border: #a7f3d0;

    --warn: #d97706;
    --warn-bg: #fffbeb;
    --warn-border: #fde68a;

    --bad: #dc2626;
    --bad-bg: #fef2f2;
    --bad-border: #fecaca;

    --neutral: #64748b;
    --neutral-bg: #f1f5f9;
    --neutral-border: #cbd5e1;

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Topbar --- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-xs);
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
}
.brand-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--surface-muted);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}
.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}
.nav-link:hover {
    color: var(--text);
    background: var(--surface-muted);
}
.nav-link.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}
.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}
.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface-muted);
    padding: 5px 12px;
    border-radius: 9999px;
    border: 1px solid var(--border);
}
.user-chip .user-name {
    font-weight: 600;
    color: var(--text);
}
.logout {
    margin: 0;
    display: flex;
    align-items: center;
}

/* --- Container & Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px 64px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}
.page-title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
}
.page-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    transition: color 0.15s;
}
.back-link:hover { color: var(--primary); }

/* --- Cards --- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.card.narrow {
    max-width: 400px;
    margin: 60px auto;
}

/* --- Tabs --- */
.tabs-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    padding-bottom: 0;
    overflow-x: auto;
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
}
.tab-btn:hover {
    color: var(--text);
}
.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}
.tab-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 9999px;
    background: var(--surface-muted);
    color: var(--text-muted);
}
.tab-btn.active .tab-badge {
    background: var(--primary-light);
    color: var(--primary);
}

/* --- Buttons --- */
.btn {
    font: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    line-height: 1.25;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-ring);
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
    background: var(--primary-hover);
}
.btn-secondary {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background: var(--surface-muted);
    border-color: var(--text-muted);
}
.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--text);
}
.btn-danger {
    background: var(--surface);
    border-color: var(--bad-border);
    color: var(--bad);
}
.btn-danger:hover {
    background: var(--bad-bg);
    border-color: var(--bad);
}
.btn-link {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    text-decoration: underline;
}
.btn-link:hover { color: var(--text); }
.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
    border-radius: 5px;
}

/* --- Forms & Inputs --- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.grid-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}
label.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}
input[type=text], input[type=email], input[type=password], input[type=number], textarea, select {
    font: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=number]:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}
input[type=checkbox] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}
textarea { resize: vertical; min-width: 220px; }
.w-xs { width: 75px; } .w-sm { width: 110px; } .w-md { width: 140px; } .w-lg { width: 220px; }
.prefix { color: var(--text-muted); font-size: 14px; font-weight: 500; margin-right: 4px; }
.input-with-prefix { display: inline-flex; align-items: center; }

/* --- Tables --- */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    margin-bottom: 20px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}
.table th {
    background: var(--surface-muted);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--surface-hover); }
.table.compact td { padding: 8px 12px; }
.table .actions {
    white-space: nowrap;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}
.table .actions form { margin: 0; }
tr.inactive, section.inactive { opacity: .6; }
tr.warn td { background: #fffdf5; }
tr.new-row td { background: #fafafa; border-top: 2px dashed var(--border); }

/* --- Badges & Semaphores --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    line-height: 1.3;
}
.badge-ready { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.badge-incomplete { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }
.badge-inactive { background: var(--neutral-bg); color: var(--neutral); border: 1px solid var(--neutral-border); }
.badge-danger { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-border); }
.badge-subtle { background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border); }
.dot-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
}

/* --- Issues & Alerts --- */
.issue-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.issue-chip {
    font-size: 11px;
    background: var(--warn-bg);
    color: var(--warn);
    border: 1px solid var(--warn-border);
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 500;
}

/* --- Flash Messages --- */
.flash {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-xs);
}
.flash-success { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok-border); }
.flash-error { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad-border); }
.flash-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-border); }

/* --- Swatches --- */
.swatches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px;
    margin: 16px 0;
}
.swatch-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}
.swatch-card:hover {
    border-color: var(--border-strong);
    background: var(--surface-muted);
}
.swatch-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}
.dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* --- Mockups --- */
.mockup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin: 16px 0;
}
.mockup-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    text-align: center;
}
.mockup-item figure { margin: 0; }
.mockup-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    background: #f8f8f8;
    display: block;
}
.mockup-item img.checker {
    background: repeating-conic-gradient(#e5e5e5 0% 25%, #f5f5f5 0% 50%) 0 0 / 16px 16px;
}
.mockup-item figcaption {
    padding: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.mockup-item .pending {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    background: var(--surface-muted);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

/* --- Toolbars & Utilities --- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: var(--surface-muted);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.inline-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.danger-zone {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--bad-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.muted { color: var(--text-muted); }
.thumbnail-sm {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    object-fit: contain;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}
.thumbnail-placeholder {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--surface-muted);
    border: 1px dashed var(--border-strong);
    display: grid;
    place-items: center;
    font-size: 18px;
    color: var(--text-subtle);
}

/* --- Dashboard KPIs --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.kpi-card .kpi-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kpi-card .kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.03em;
}
.kpi-card .kpi-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .topbar { padding: 0 16px; height: auto; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
    .nav { width: 100%; overflow-x: auto; padding-bottom: 4px; }
    .container { padding: 16px 12px; }
}

/* --- calibrador y vistas previas con ubicaciones --- */
.calibrator-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 20px; align-items: start; }
.calibrator-help ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.6; font-size: 14px; }
.overlay-box { position: relative; width: 100%; max-width: 720px; margin: 0 auto; }
.overlay-box img { display: block; width: 100%; height: auto; border-radius: 8px; }
.overlay-box img.checker { background: repeating-conic-gradient(#9c9c9c 0% 25%, #c4c4c4 0% 50%) 0 0 / 16px 16px; }
.overlay-box svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.overlay-box .handle { cursor: grab; }
.locations-layout { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) {
    .calibrator-layout, .locations-layout { grid-template-columns: 1fr; }
}
.nowrap { white-space: nowrap; }

/* --- diseños --- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.design-card { display: flex; flex-direction: column; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: #fff; color: inherit; text-decoration: none; overflow: hidden; }
.design-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.design-card.inactive { opacity: .6; }
.design-card__img { display: grid; place-items: center; aspect-ratio: 1; background: #f1f5f9; }
.design-card__img img { width: 100%; height: 100%; object-fit: cover; }
.design-card__body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.design-card__badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.small { font-size: 13px; }
.design-edit { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.category-checks { display: grid; gap: 4px; max-height: 320px; overflow-y: auto; padding: 8px; border: 1px solid var(--border, #e2e8f0); border-radius: 8px; }
.print-preview { display: grid; place-items: center; padding: 12px; border-radius: 8px; margin-bottom: 8px; }
.print-preview img { max-width: 100%; max-height: 320px; }
.checker-bg { background: repeating-conic-gradient(#d4d4d8 0% 25%, #f4f4f5 0% 50%) 0 0 / 16px 16px; }
.dropzone { margin-bottom: 20px; padding: 20px; border: 2px dashed var(--border-strong, #cbd5e1); border-radius: 10px; background: #f8fafc; text-align: center; }
.dropzone.is-over { border-color: var(--primary, #4f46e5); background: #eef2ff; }
.dropzone.is-busy { opacity: .85; }
.dropzone .inline-bar { justify-content: center; }
.dropzone__list { margin: 12px auto 0; padding: 0; max-width: 520px; list-style: none; text-align: left; font-size: 13px; }
.dropzone__list li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px solid #e2e8f0; }
.link-like { color: var(--primary, #4f46e5); text-decoration: underline; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.photo-card { padding: 10px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: #fff; }
.photo-card.is-review { border-color: #f59e0b; background: #fffbeb; }
.photo-card__img { display: block; aspect-ratio: 1; margin-bottom: 8px; border-radius: 6px; background: #f1f5f9; overflow: hidden; }
.photo-card__img img { width: 100%; height: 100%; object-fit: cover; }
.photo-card select { width: 100%; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.pagination { justify-content: center; margin-top: 20px; }
.size-chart-preview { max-width: 360px; border-radius: 8px; border: 1px solid var(--border, #e2e8f0); }
@media (max-width: 900px) { .design-edit { grid-template-columns: 1fr; } }
.status-ok { color: #047857; font-weight: 600; }
.status-bad { color: #b91c1c; font-weight: 600; }

/* ---------- estampas ubicadas (D24) ---------- */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row > .form-group { flex: 1 1 140px; min-width: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.print-tabs, .view-tabs { margin-bottom: 16px; flex-wrap: wrap; overflow: visible; row-gap: 0; } /* todos a la vista, sin scroll lateral */
.print-tabs .tab-btn, .view-tabs .tab-btn { padding: 8px 12px; gap: 8px; }
.print-tab__thumb { flex: none; width: 28px; height: 28px; border-radius: 4px; overflow: hidden; display: grid; place-items: center; }
.print-tab__thumb img { max-width: 100%; max-height: 100%; }
.tab-text { display: flex; flex-direction: column; line-height: 1.2; }
.tab-sub { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.tab-dot[hidden] { display: none; }
.tab-btn.has-warning .tab-sub { color: var(--bad); }
.tab-btn.has-warning .tab-sub::before { content: "⚠ "; }
.tab-btn.is-ok .tab-sub { color: var(--ok); }
[data-tab-panel][hidden] { display: none !important; }
.print-panel { display: flex; flex-direction: column; gap: 12px; }
.print-editor__stage { position: relative; aspect-ratio: 1; border-radius: 8px; background: #f1f5f9; overflow: hidden; touch-action: none; }
.print-editor__mockup { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.print-editor__box { position: absolute; }
.print-editor__max { position: absolute; border: 1.5px dashed rgba(30, 136, 229, .8); pointer-events: none; }
.print-editor__max.is-over { border-color: var(--bad); }
.print-editor__layer { position: absolute; max-width: none; cursor: grab; outline: 1px solid rgba(30, 136, 229, .5); user-select: none; }
.print-editor__layer.is-dragging { cursor: grabbing; }
.notice { margin: 0; padding: 8px 12px; border: 1px solid #fde68a; border-radius: 8px; background: #fffbeb; font-size: 13px; }
.page-actions { align-items: flex-end; text-align: right; }
.print-editor__ghost { position: absolute; max-width: none; opacity: .4; pointer-events: none; outline: 1px dashed rgba(100, 116, 139, .7); }

/* Dashboard: botón para limpiar la caché de la tienda */
.store-refresh { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.store-refresh p { margin: 4px 0 0; max-width: 60ch; }

/* Ficha de diseño en pestañas */
.tab-badge--warn { background: var(--warn-bg); color: var(--warn); }
.design-general { max-width: 760px; display: grid; gap: 20px; }
@media (min-width: 900px) {
    /* Estampas: visor a la izquierda, datos a la derecha */
    .design-prints-tab article.print-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
    .design-prints-tab article.print-panel > .print-editor,
    .design-prints-tab article.print-panel > .print-preview { grid-row: 1 / span 4; }
}
/* Disponibilidad */
.availability { display: grid; gap: 20px; max-width: 900px; }
.mode-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 9999px; cursor: pointer; font-size: 14px; }
.mode-pill:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 600; }
.color-groups { display: grid; gap: 8px; margin-top: 12px; }
.color-check .swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--border-strong, #94a3b8); flex: none; }
.availability-summary { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

/* "Faltan datos" y edición en lote de diseños (D28) */
.photo-card.is-incomplete { border-color: var(--warn); }
.design-card-wrap { position: relative; display: flex; }
.design-card-wrap > .design-card { flex: 1; }
.design-card__pick { position: absolute; top: 8px; left: 8px; z-index: 1; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 3px rgba(15, 23, 42, .2); cursor: pointer; }
.design-card-wrap.is-picked > .design-card { outline: 2px solid var(--primary); outline-offset: -2px; }
.bulk-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 16px; padding: 10px 16px; border: 1px solid var(--primary-border); border-radius: 12px; background: var(--primary-light); box-shadow: 0 6px 20px rgba(15, 23, 42, .12); }
.bulk-bar[hidden] { display: none; }
.bulk-dialog { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 12px; padding: 20px; }
.bulk-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.bulk-section { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.bulk-section select { max-width: 260px; }
.bulk-section .category-checks { max-height: 220px; overflow: auto; }
[data-bulk-choices][hidden], [data-bulk-hint][hidden] { display: none; }
.tabs-nav--wrap { flex-wrap: wrap; overflow: visible; row-gap: 0; }

/* Pedidos y pagos (D29) */
.order-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1000px) { .order-layout { grid-template-columns: 1fr; } }
.totals-admin { display: grid; gap: 4px; max-width: 320px; margin: 12px 0 0 auto; }
.totals-admin > div { display: flex; justify-content: space-between; gap: 12px; }
.totals-admin dt { color: var(--text-muted); }
.totals-admin dd { margin: 0; font-weight: 600; }
.totals-admin .total { border-top: 1px solid var(--border); padding-top: 4px; }
.payment-row { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.payment-row.is-review { border-color: var(--warn); background: var(--warn-bg); }
.payment-row p { margin: 0; }
.review-form { flex-wrap: wrap; }
.add-payment { margin-top: 16px; }
.add-payment > summary { list-style: none; display: inline-flex; }
.history { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.history li { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
a.kpi-card { color: inherit; text-decoration: none; }
a.kpi-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.zone-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.zone-form.is-new { padding-top: 8px; border-top: 1px dashed var(--border); }
.zone-provinces { position: relative; }
.zone-provinces[open] .check-row { position: absolute; z-index: 5; width: 520px; max-width: 80vw; padding: 12px; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 6px 20px rgba(15, 23, 42, .12); }
.w-lg { min-width: 260px; }
/* Con más secciones (pedidos, envíos, cupones, cobros) la barra se desliza de costado en vez de cortarse. */
.topbar > .nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.nav-link { white-space: nowrap; }

/* Menú agrupado (D30) */
.nav-group { position: relative; }
.nav-group > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: "▾"; font-size: 11px; opacity: .7; }
.nav-menu { position: fixed; z-index: 60; min-width: 200px; margin-top: 6px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14); display: grid; gap: 2px; }
.nav-menu__link { padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap; }
.nav-menu__link:hover { background: var(--surface-muted); }
.nav-menu__link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.topbar > .nav { overflow: visible; }
button.is-busy { opacity: .6; cursor: progress; }

/* ABM en tarjetas (cupones, cuentas de cobro): todos los campos visibles en cualquier ancho (D30) */
.crud-cards { display: grid; gap: 16px; }
.crud-card.is-new { border-style: dashed; }
.crud-card__grid { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); align-items: end; }
.crud-card__field { display: grid; gap: 4px; min-width: 0; }
.crud-card__field input:not([type="checkbox"]), .crud-card__field select, .crud-card__field textarea { width: 100%; }
.crud-card__field.is-check { grid-auto-flow: column; justify-content: start; align-items: center; gap: 8px; }
.crud-card__field.is-wide { grid-column: 1 / -1; }
.crud-card__actions { margin-top: 12px; }
.dash-group { margin: 24px 0 10px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.quick-groups { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.crud-card.is-inactive { opacity: .6; }

/* Precios (D30) */
.price-steps { display: grid; gap: 12px 16px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.input-prefix { display: flex; align-items: center; gap: 6px; }
.input-prefix > span { color: var(--text-muted); }
.input-prefix input { width: 100%; min-width: 0; }
.price-garment { border-top: 1px solid var(--border); padding: 10px 0; }
.price-garment > summary { cursor: pointer; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.price-garment > form { margin-top: 10px; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }

/* Producción (D30) */
.production-items { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.production-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.production-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--surface-muted); flex: none; }
.production-item__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.production-item.is-done { opacity: .6; }
.production-item.is-done strong { text-decoration: line-through; }
@media (max-width: 600px) { .production-item { flex-wrap: wrap; } .production-item form { width: 100%; } }

/* Editor visual (D30, wysiwyg.js) */
.wysiwyg { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.wysiwyg__bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-muted); border-radius: 8px 8px 0 0; position: sticky; top: 0; z-index: 1; }
.wysiwyg__btn { min-width: 34px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 6px; background: none; font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
.wysiwyg__btn:hover { background: var(--surface); border-color: var(--border); }
.wysiwyg__btn:disabled { opacity: .4; cursor: default; }
.wysiwyg__sep { width: 1px; margin: 4px 4px; background: var(--border); }
.wysiwyg__area { min-height: 320px; max-height: 70vh; overflow: auto; padding: 12px 16px; outline: none; }
.wysiwyg__area:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent); border-radius: 0 0 8px 8px; }
.prose h2 { font-size: 1.15rem; margin: 1em 0 .4em; }
.prose h3 { font-size: 1rem; margin: 1em 0 .3em; }
.prose p, .prose ul, .prose ol, .prose blockquote { margin: 0 0 .7em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose blockquote { padding: 8px 12px; border-left: 3px solid var(--border); background: var(--surface-muted); }
.prose a { color: var(--primary); text-decoration: underline; }
