:root {
    --primary: #D3AFF5; 
    --primary-hover: #c69be8;
    --accent-green: #B5E86E;
    --accent-green-hover: #a2dc57;
    --bg-app: #FFFFFF;
    --main: #FFFFFF;
    --main-grey: #e4e4e7;
    --text-primary: #18181b;
    --text-muted: #71717a;
    --border-card: #e5e5ea;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-app);
    color: #18181b;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- HEADER CAD MINIMAL --- */
#app-header,
#app-header.header-cad-minimal {
    height: 48px;
    background: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid #e5e5ea;
    box-shadow: none;
    z-index: 30;
}

.header-brand-area {
    display: flex;
    align-items: center;
}

.brand-isotipo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
}

.brand-isotipo-link:hover {
    opacity: 0.8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header-text {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-header-text:hover {
    color: var(--muted);
    background: #e4e4e7;
}

.header-auth-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header-auth {
    background: transparent;
    border: none;
    color: #52525b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 9999px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-header-auth:hover {
    color: var(--muted);
    background: #e4e4e7;
}

.btn-header-auth.primary, #btnAbrirAuthModal, .btn-pill-auth {
    background: #D3AFF5 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 9999px !important;
    padding: 7px 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.8px !important;
    text-transform: uppercase !important;
    box-shadow: none !important;
    transition: background 0.2s ease, transform 0.1s ease !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.btn-header-auth.primary:hover, #btnAbrirAuthModal:hover, .btn-pill-auth:hover {
    background: #B5E86E !important;
    color: #fff!important;
}

/* User Profile Badge (Navbar) */
.user-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid #e5e5ea;
    border-radius: 9999px;
    padding: 4px 12px 4px 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.user-profile-badge:hover, .user-profile-badge.active {
    background: #fafafa;
    border-color: #d4d4d8;
}

.user-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #D3AFF5;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* --- ESTRUCTURA WORKSPACE 3 COLUMNAS --- */
.croaket-workspace {
    display: grid;
    grid-template-columns: 280px 1fr 310px;
    gap: 0;
    height: calc(100vh - 48px);
    overflow: hidden;
    background: var(--bg-app);
}

.box-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #555;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* --- COLUMNA 1: IZQUIERDA (CATÁLOGO Y HERRAMIENTAS) --- */
.col-izquierda { 
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bg-app);
    border-right: 1px solid #e5e5ea;
}

.panel-boceto-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    gap: 14px;
    overflow-y: auto;
    background: var(--bg-app);
}

/* Pestañas de modo (Pill Segmented Toggle) */
.tabs-modo-container {
    display: flex;
    background: #e4e4e7;
    border-radius: 9999px;
    padding: 3px;
    gap: 4px;
    flex-shrink: 0;
}

.btn-tab-modo {
    flex: 1;
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    color: #71717a;
    background: transparent;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-tab-modo.active {
    background: var(--primary) !important;
    color: #ffffff !important;
    box-shadow: none !important;
}

.btn-tab-modo.inactive {
    background: transparent;
    color: #71717a;
}

.btn-tab-modo:hover:not(.active) {
    color: #18181b;
}

/* Formularios y Selectores Pill en Modo Catálogo */
.vista-preset {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
}

.form-group-cad {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lbl-cad-section {
    display: block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #71717a;
    margin-bottom: 2px;
}

.pill-input-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-card);
    border-radius: 9999px;
    padding: 0 14px;
    height: 30px;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
    width: 100%;
}

.pill-input-box:focus-within {
    border-color: #d4d4d8;
    background: #ffffff;
}

.pill-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #71717a;
    margin-right: 10px;
    flex-shrink: 0;
}

.pill-select {
    border: none;
    background: transparent;
    outline: none;
    font-size: 12px;
    font-weight: 600;
    color: #939393;
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    padding-right: 20px;
}

.pill-chevron {
    position: absolute;
    right: 12px;
    width: 14px;
    height: 14px;
    color: #71717a;
    pointer-events: none;
}

.row-escala-pill {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-opciones-escala {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    flex-shrink: 0;
}

.btn-opciones-escala:hover {
    transform: scale(1.08);
    opacity: 0.85;
}

.icon-opciones-purple {
    width: 24px;
    height: 18px;
    display: block;
    filter: brightness(0);
}

.btn-pill-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid #d4d4d8;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #3f3f46;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-pill-icon:hover {
    border-color: #18181b;
    color: #18181b;
    background: #f4f4f6;
}

/* Galería de Modelos */
.seccion-modelos-cad {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 6px;
}

.galeria-modelos-box {
    background: #e4e4e7;
    border: none;
    border-radius: 14px;
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
}

.galeria-piezas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.preset-card {
    background: #ffffff !important;
    border: 1px solid #e4e4e7 !important;
    border-radius: 10px !important;
    padding: 10px 8px !important;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    outline: none;
}

.preset-card:hover {
    border-color: #a1a1aa !important;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.06);
}

.preset-card.is-selected {
    border: 2px solid #18181b !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08) !important;
}

/* Canvas Dibujo Libre */
.canvas-wrapper {
    background: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.toolbar-fixed {
    background: #f5f5f5;
    border-bottom: 1px solid #ccc;
    padding: 4px;
    display: flex;
    gap: 4px;
    justify-content: center;
}

.toolbar-fixed label {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    border: 1px solid #ccc;
    font-size: 12px;
}

.toolbar-fixed input[type="radio"] { display: none; }
.toolbar-fixed input[type="radio"]:checked + span {
    background: var(--primary);
    color: white;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

#bocetoCanvas {
    background: #dcdcdc;
    width: 100%;
    height: 240px; 
    display: block;
}

.btn-generar-cta {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.75rem;
    width: 100%;
}

/* --- COLUMNA 2: CENTRO (LIENZO & VISTA TABS) --- */
.col-centro {
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border-right: 1px solid #e5e5ea;
}

.header-lienzo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    height: 48px;
    background: var(--bg-app);
    border-bottom: 1px solid #e5e5ea;
    box-sizing: border-box;
    flex-shrink: 0;
}

.tabs-vista {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-vista {
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #52525b;
    cursor: pointer;
    padding: 6px 16px;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease;
}

.btn-vista:hover {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-vista.active {
    background: #ffffff;
    border-color: #18181b;
    color: #18181b;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.btn-vista.active::after {
    display: none;
}

.header-lienzo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pill-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d4d4d8;
    color: var(--muted);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-pill-export:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.btn-history-action {
    gap: 5px;
    padding: 6px 12px;
}

.btn-history-action:disabled,
.btn-history-action.disabled {
    opacity: 0.35;
    cursor: not-allowed !important;
    pointer-events: none;
    border-color: #e4e4e7;
    color: var(--muted);
}

.wrapper-vista {
    flex: 1;
    position: relative;
    width: 100%;
    height: calc(100% - 48px);
}

.visor-3d-container {
    background: var(--bg-app);
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#canvas-3d { width: 100%; height: 100%; background: var(--bg-app); }

/* Barra Superior Flotante de Opciones 3D (Floating Capsule) */
.controls-row-overlay {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 5px 12px;
    border-radius: 9999px;
    border: 1px solid #d8d8e0;
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 11px;
    color: #3f3f46;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    user-select: none;
}

.controls-row-overlay select {
    border: 1px solid #e4e4e7;
    background: #ffffff;
    padding: 3px 8px;
    border-radius: 9999px;
    font-size: 11px;
    color: #18181b;
    font-weight: 600;
    outline: none;
}

.btn-control-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #3f3f46;
    border-radius: 9999px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-control-pill:hover {
    background: #f4f4f6;
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.btn-control-pill.btn-pill-accent {
    border-color: #e9d5ff;
    background: #faf5ff;
    color: #D3AFF5;
}

.btn-control-pill.btn-pill-accent:hover {
    background: #f3e8ff;
    border-color: #D3AFF5;
}

.history-quick-controls {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0 2px;
}

.btn-control-icon-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    padding: 0;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    border-radius: 9999px;
    color: #3f3f46;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-control-icon-pill:hover:not(:disabled) {
    background: #f4f4f6;
    border-color: var(--primary, #7c3aed);
    color: var(--primary, #7c3aed);
}

.btn-control-icon-pill:disabled,
.btn-control-icon-pill.disabled {
    opacity: 0.32;
    cursor: not-allowed !important;
    pointer-events: none;
}

.btn-flotante-3d {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 10;
    background: #ffffff;
    border: 1px solid #d4d4d8;
    padding: 6px 14px;
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    cursor: pointer;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
    color: #18181b;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.btn-flotante-3d:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

/* VISTA 2D GRID */
.grid-patron-2d {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 12px;
    padding: 12px;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

#textoPatron, #canvas-svg {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px;
    height: 100%;
    overflow-y: auto;
}

/* --- COLUMNA 3: DERECHA (INSPECTOR Y ARMADO DE PIEZAS) --- */
.col-derecha {
    background: #ffffff;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    padding: 16px;
    box-sizing: border-box;
    height: 100%;
}

.panel-card-cad {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.panel-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#patternInput {
    width: 100%;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    padding: 10px;
    border: 1px solid #d4d4d8;
    border-radius: 8px;
    background: #fcfcfd;
    color: #18181b;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#patternInput:focus {
    border-color: #18181b;
}

/* Card Armado de Piezas */
.card-armado-piezas {
    margin-top: auto;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.armado-container {
    background: #f8f8fa;
    border: 1px solid #ebeeef;
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
}

.armado-container > .btn-add-pieza {
    display: none; /* Reemplazado por el botón destacado de ensamblaje */
}

.pieza-item {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: #18181b;
    transition: all 0.15s;
}

.pieza-item:hover {
    border-color: #d4d4d8;
}

.pieza-item.is-selected {
    border: 1px solid #D3AFF5 !important;
    border-left: 4px solid #D3AFF5 !important;
    background: #fcf8ff !important;
}

.btn-agregar-ensamblaje {
    width: 100%;
    border: 1px solid #d4d4d8;
    background: #ffffff;
    color: var(--muted);
    padding: 10px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-agregar-ensamblaje:hover {
    background: #D3AFF5;
    color: #18181b;
    border-color: #c69df0;
}

/* IMPRESIÓN / PDF */
@media print {
    body * { visibility: hidden; }
    .grid-patron-2d, .grid-patron-2d * { visibility: visible; }
    .grid-patron-2d {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
}

/* --- NUEVAS CLASES EXTRAÍDAS DE ESTILOS EN LÍNEA --- */

.tabs-modo-container {
    display: flex;
    gap: 5px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 5px;
}

.btn-tab-modo {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 100px;
    font-weight: bold;
    cursor: pointer;
}

.btn-tab-modo.active {
    background: var(--primary);
    color: white;
}

.btn-tab-modo.inactive {
    background: #e0e0e0;
    color: #555;
}

.vista-preset {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden; /* Permite que la galería gestione su propio scroll */
}

.vista-preset, .vista-dibujo {
    display: block;
}

.vista-oculta {
    display: none !important;
}

.lbl-form-sm {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    display: block;
    margin-bottom: 4px;
}

.lbl-form-md {
    font-size: 11px;
    font-weight: bold;
    color: #555;
    display: block;
    margin-bottom: 6px;
}

.select-preset-cat, .select-preset-scale {
    width: 100%;
    padding: 6px;
    border-radius: 100px;
    border: 1px solid var(--primary);
    margin-bottom: 10px;
    font-weight: bold;
    background-color: var(--main);
    font-size: 12px;
}

.btn-toggle-avanzado {
    /**width: 100%;
    padding: 6px;
    border-radius: 6px;
    margin-bottom: 10px;
    background: #e3f2fd;**/
    background: none;
    border: none;
    color: var(--primary);
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
}

.panel-avanzado-preset {
    display: none;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 10px;
}

.lbl-subseccion {
    font-size: 10px;
    font-weight: bold;
    color: #444;
    margin-bottom: 4px;
}

.row-medidas-avanzadas {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.col-flex-1 {
    flex: 1;
}

.input-medida-num {
    width: 100%;
    padding: 4px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 11px;
    box-sizing: border-box;
}

.btn-proporcion-lock {
    padding: 3px 5px;
    background: #e0e0e0;
    border: 1px solid #bbb;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.galeria-piezas-grid {
    flex: 1; /* Absorbe todo el espacio vertical sobrante */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    max-height: calc(100vh - 380px);
    overflow-y: auto;
    padding-right: 3px;
}

.margin-top-10 { margin-top: 10px; }
.margin-top-8 { margin-top: 8px; }
.margin-top-6 { margin-top: 6px; }
.margin-top-4 { margin-top: 4px; }
.font-size-11 { font-size: 11px; }

.select-tension-sm {
    font-size: 11px;
    padding: 2px;
}

.drag-handle-bar {
    cursor: move;
    padding: 2px 6px;
    background: #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    user-select: none;
}

.regla-canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.canvas-3d-render {
    width: 100%;
    height: 100%;
}

.titulo-guia-pasos {
    margin-top: 0;
    color: #1976d2;
    font-size: 14px;
}

.help-text-sm {
    font-size: 10px;
    color: #777;
    margin-bottom: 4px;
}

.panel-header-sub {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.txt-sub-blue {
    font-weight: bold;
    font-size: 12px;
    color: #1976d2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-sub {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: #666;
}

.dpad-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    background: #fafafa;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
}

.lbl-dpad {
    font-size: 10px;
    font-weight: bold;
    color: #555;
}

.dpad-grid {
    display: grid;
    grid-template-columns: repeat(3, 26px);
    gap: 2px;
    justify-content: center;
}

.btn-dpad {
    width: 26px;
    height: 26px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
}

.btn-dpad-center {
    border: 1px solid var(--primary);
    background: #e3f2fd;
    color: #1976d2;
}

.dpad-depth-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.btn-dpad-depth {
    padding: 2px 6px;
    font-size: 9px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.sliders-rot-wrapper {
    margin-bottom: 8px;
    background: #fafafa;
    padding: 6px;
    border-radius: 6px;
    border: 1px solid #f0f0f0;
}

.slider-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.lbl-slider {
    font-size: 10px;
    font-weight: bold;
    color: #555;
}

.val-slider {
    font-size: 10px;
    color: #666;
    font-weight: bold;
}

.range-slider {
    width: 100%;
    cursor: pointer;
}

.check-espejo-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e3f2fd;
    padding: 6px 8px;
    border-radius: 6px;
}

.lbl-check-espejo {
    font-size: 11px;
    font-weight: bold;
    color: #0d47a1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cursor-pointer {
    cursor: pointer;
}

.vista-oculta {
    display: none !important;
}
/* Croaket Studio — visual system and responsive workspace. */
:root { --primary: #D3AFF5; --main: #fff; --main-grey: #e8e6eb; --ink: #29262e; --muted: #969696; --soft: #f5f4f7; --lavender: #D3AFF5; }
body { color: var(--ink); background: #f3f2f5; height: 100dvh; font-size: 12px; }
button, select, input { font: inherit; }
button { cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
button:hover { filter: brightness(.97); }
.material-symbols-outlined { font-size: 18px; vertical-align: middle; font-weight: 400; }
#app-header { height: 64px; flex-shrink: 0; background: #fff; padding: 0 24px; gap: 28px; box-shadow: none; border-color: var(--main-grey); }
.logo-brand { font-family: Inter, sans-serif; font-size: 23px; letter-spacing: -1px; color: #27232c; gap: 8px; }
.brand-mark { color: var(--primary); font-size: 36px; line-height: 1; }
.brand-tag { margin: 6px 0 0 3px; font-size: 9px; letter-spacing: 1.6px; font-weight: 600; color: var(--muted); }
.project-title { display: flex; align-items: center; gap: 18px; font-weight: 500; }
.project-divider { color: #d2ced8; font-weight: 400; font-size: 22px; }
.project-type { color: var(--muted); font-size: 11px; font-weight: 400; }
.btn-exportar-pdf { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--primary); padding: 10px 14px; border-radius: 7px; font-weight: 500; }
.btn-exportar-pdf:hover { background: #6540a4; }
.header-export { margin-left: auto; }
.croaket-workspace { grid-template-columns: 272px minmax(0,1fr) 292px; height: auto; flex: 1; min-height: 0; gap: 0; }
.col-izquierda, .col-derecha { background: white; padding: 0; gap: 0; min-height: 0; scrollbar-width: thin; scrollbar-color: #d9d4df transparent; }
.col-izquierda { border-right: 1px solid var(--main-grey); }
.col-derecha { border-left: 1px solid var(--main-grey); }
.panel-boceto-container { padding: 24px 18px 16px; height: auto; min-height: 100%; border: 0; }
.section-heading { padding-bottom: 24px; }
.eyebrow { font-size: 9px; font-weight: 600; letter-spacing: 1.6px; color: #8b8298; }
.section-heading h1 { font-size: 24px; letter-spacing: -.8px; font-weight: 600; margin: 7px 0; }
.section-heading p { color: var(--muted); font-size: 11px; line-height: 1.6; }
.tabs-modo-container { background: var(--soft); border: 1px solid #eeecf1; padding: 3px; border-radius: 100px; margin-bottom: 24px; gap: 3px; }
.btn-tab-modo { border-radius: 100px; padding: 8px; font-size: 11px; font-weight: 500; }
.btn-tab-modo.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px #29262e15; }
.btn-tab-modo.inactive { background: transparent; color: var(--muted); }
.lbl-form-sm, .lbl-form-md { color: #615b69; font-weight: 500; font-size: 11px; margin-bottom: 8px; }
.select-preset-cat, .select-preset-scale { border-radius: 6px; border: 1px solid #e6e2ea; background: #faf9fb; font-weight: 400; padding: 10px; margin-bottom: 18px; color: var(--ink); }
.btn-toggle-avanzado { display: flex; align-items: center; gap: 7px; padding: 0 0 22px; color: var(--primary); font-weight: 500; }
.lbl-form-md { border-top: 1px solid var(--main-grey); padding-top: 20px; margin-bottom: 12px; }
.galeria-piezas-grid { gap: 9px; max-height: none; overflow: visible; padding: 0; }
.preset-card { border: 1px solid #e8e4ec !important; border-radius: 8px !important; padding: 7px 7px 11px !important; background: white !important; min-width: 0; }
.preset-card > div:first-child { background: #f5f3f8 !important; height: 88px !important; margin-bottom: 9px !important; overflow: hidden; }
.preset-card:nth-child(3n+2) > div:first-child { background: #f2f5f0 !important; }
.preset-card:nth-child(3n) > div:first-child { background: #fbf1eb !important; }
.preset-card > div:last-child { font-weight: 500 !important; font-size: 10px !important; line-height: 1.5 !important; }
.preset-card:hover { border-color: #b79bdc !important; }
.preset-card.is-selected { border-color: var(--primary) !important; box-shadow: 0 0 0 1px var(--primary); background: #faf7ff !important; }
.col-centro { min-width: 0; border: 0; border-radius: 0; box-shadow: none; }
.header-lienzo { height: 56px; flex-shrink: 0; background: #fff; padding: 0 20px; border-color: var(--main-grey); }
.tabs-vista { gap: 5px; }
.btn-vista { display: flex; align-items: center; gap: 7px; font-weight: 500; font-size: 11px; padding: 9px 11px; color: var(--muted); }
.btn-vista.active { background: var(--lavender); color: #fff; border-color: transparent; }
#btnDescargarPDF { background: transparent; color: var(--muted); padding: 8px; }
.wrapper-vista { min-height: 0; height: auto; }
.visor-3d-container { background: #f3f2f5; }
.controls-row-overlay { top: 16px; left: 50%; transform: translateX(-50%); right: auto; max-width: calc(100% - 32px); flex-wrap: wrap; gap: 8px 10px; padding: 6px 14px; border: 1px solid #e1dde6; border-radius: 9999px; box-shadow: 0 4px 14px rgba(41, 38, 46, 0.08); font-weight: 500; font-size: 11px; z-index: 25; }
.controls-row-overlay label { display: flex; align-items: center; gap: 5px; }
.controls-row-overlay select { background: #f5f4f7; border: 0; padding: 5px 4px; color: #5b5366; font-size: 10px; }
#btnFlipY { padding: 5px 8px; background: #fff; border: 1px solid #e7e2ed; border-radius: 5px; font-size: 10px; }
.drag-handle-bar { background: transparent; color: #a29aa9; padding: 2px; }
.btn-flotante-3d { bottom: 22px; right: 22px; border: 1px solid #e0dce5; border-radius: 8px; padding: 11px 15px; box-shadow: 0 3px 12px #29262e0a; font-weight: 500; }
.canvas-empty-state { position: absolute; z-index: 6; left: 50%; top: 50%; transform: translate(-50%,-43%); width: min(400px,90%); text-align: center; pointer-events: none; user-select: none; }
.canvas-empty-state * { pointer-events: none; user-select: none; }
.canvas-empty-state[hidden] { display: none; }
.empty-art { width: 230px; margin: 0 auto 14px; }
.canvas-empty-state h2 { font-size: clamp(20px,2vw,28px); font-weight: 500; letter-spacing: -1px; margin: 12px 0; }
.canvas-empty-state p { font-size: 12px; color: var(--muted); line-height: 1.85; }
.empty-cta { pointer-events: auto !important; margin-top: 22px; padding: 11px 16px; background: #fff; border: 1px solid #dfd9e8; border-radius: 7px; color: #6f4a9f; font-size: 11px; cursor: pointer; }
.empty-cta span { padding-left: 16px; }
.inspector-heading { display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 16px 18px; font-weight: 600; border-bottom: 1px solid var(--main-grey); }
.inspector-badge { margin-left: auto; font-size: 10px; font-weight: 400; color: var(--primary); background: var(--lavender); padding: 4px 7px; border-radius: 4px; }
.panel-card { padding: 22px 18px; border: 0; border-bottom: 1px solid var(--main-grey); }
.label-seccion { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 14px; }
.code-badge { color: #93899f; font-size: 8px; letter-spacing: 1px; font-weight: 500; }
.help-text-sm { font-size: 10px; line-height: 1.8; margin-bottom: 10px; color: #8b8393; }
.help-text code { font-family: Consolas, monospace; }
#patternInput { min-height: 124px; line-height: 1.8; border-color: #e8e3ed; background: #f8f7fa; padding: 12px; color: #7654a1; font-size: 11px; }
.armado-container { padding: 0; border: 0; background: transparent; max-height: 230px; gap: 7px; }
.pieza-item { padding: 9px 7px; border: 1px solid #e8e3ed; min-height: 38px; }
.pieza-item.is-selected { border: 1px solid #d9caed !important; background: #f3edfb !important; }
.pieza-item [id^="texto-nombre"] { font-size: 11px !important; font-weight: 500 !important; }
.pieza-item button { min-width: 24px; min-height: 26px; }
.btn-add-pieza { font-weight: 500; color: var(--primary); padding: 11px; border: 1px dashed #d1c3e4; margin-top: 3px; }
.btn-add-pieza:hover { background: #f6f1fc; }
.panel-header-sub { border: 0; margin-bottom: 18px; }
.txt-sub-blue { color: var(--ink); font-size: 12px; font-weight: 600; }
.btn-toggle-sub { padding: 5px; }
.dpad-wrapper { background: #faf9fb; padding: 10px 7px; border-color: #eeeaf2; }
.btn-dpad { border-color: #e2dce8; width: 28px; height: 28px; color: #756b81; }
.dpad-grid { grid-template-columns: repeat(3,28px); gap: 3px; }
.btn-dpad-center { background: var(--lavender); }
.btn-dpad-depth { padding: 7px; border-color: #e2dce8; color: #756b81; }
.sliders-rot-wrapper { background: transparent; border: 0; padding: 10px 0; }
.lbl-slider, .lbl-dpad { font-weight: 400; color: #766d80; }
.slider-row-header { margin: 5px 0 9px; }
.range-slider { accent-color: var(--primary); height: 4px; margin-bottom: 14px; }
.val-slider { background: var(--soft); padding: 4px 8px; border-radius: 4px; font-weight: 400; }
.check-espejo-wrapper { background: var(--soft); padding: 11px 8px; }
.lbl-check-espejo { font-weight: 400; color: #6a6176; gap: 8px; }
input[type="checkbox"], input[type="range"] { accent-color: var(--primary); }
.canvas-wrapper { border-color: #e4dfeb; }
.toolbar-fixed { background: var(--soft); border-color: #e4dfeb; padding: 8px; gap: 8px; }
.toolbar-fixed label { width: 32px; height: 32px; border-color: #e4dfeb; }
.toolbar-fixed input[type="radio"] { display: block; position: absolute; opacity: 0; width: 1px; height: 1px; }
.toolbar-fixed label:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn-generar-cta { text-transform: none; padding: 11px; font-weight: 500; }
.grid-patron-2d { gap: 16px; padding: 20px; background: #f3f2f5; }
.caja-patron-texto, .caja-patron-svg { min-width: 0; min-height: 0; }
.titulo-guia-pasos { color: var(--ink); margin-bottom: 12px; }
#textoPatron, #canvas-svg { background: #fff; border-color: #e4dfeb; height: calc(100% - 28px); }
.workspace-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; height: 30px; background: #fff; border-top: 1px solid var(--main-grey); padding: 0 20px; color: #938b9b; font-size: 9px; }
.workspace-footer > span { display: flex; align-items: center; gap: 7px; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #8aa68a; }
.footer-star { color: var(--primary); font-size: 16px; }
@media (min-width: 1500px) { .croaket-workspace { grid-template-columns: 292px minmax(0,1fr) 310px; } .panel-boceto-container, .panel-card { padding-left: 24px; padding-right: 24px; } }
@media (max-width: 1100px) { .croaket-workspace { grid-template-columns: 240px minmax(0,1fr) 260px; } .project-type { display: none; } .header-lienzo { padding: 0 8px; } .btn-vista { padding: 8px; font-size: 10px; } .panel-card { padding: 18px 12px; } .controls-row-overlay { max-width: calc(100% - 24px); } }
@media (max-width: 850px) { body { height: auto; min-height: 100dvh; overflow: auto; } #app-header { padding: 0 16px; gap: 16px; } .project-title { display: none; } .croaket-workspace { grid-template-columns: 220px minmax(0,1fr); overflow: visible; flex: none; } .col-centro { height: 680px; } .col-izquierda { max-height: 680px; } .col-derecha { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); overflow: visible; border-top: 1px solid var(--main-grey); } .inspector-heading { grid-column: 1 / -1; } .panel-card { border-right: 1px solid var(--main-grey); } .workspace-footer { margin-top: auto; } }
@media (max-width: 560px) { #app-header { height: 60px; } .brand-tag { display: none; } .logo-brand { font-size: 21px; } .header-export { font-size: 10px; padding: 9px 10px; } .croaket-workspace { display: flex; flex-direction: column; } .col-centro { order: 0; height: 560px; flex: none; } .col-izquierda { order: 1; max-height: none; } .col-derecha { order: 2; display: flex; } .panel-boceto-container { padding: 22px 20px; } .section-heading { padding-bottom: 16px; } .galeria-piezas-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .panel-card { padding: 20px; } .grid-patron-2d { grid-template-columns: 1fr; } .caja-patron-texto, .caja-patron-svg { min-height: 300px; } .workspace-footer > span:nth-child(2) { display: none; } .empty-art { width: 170px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* SVG identity and icons: inherit the control color in every state. */
.ui-icon { display: inline-block; width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.ui-icon-asset { display: inline-block; vertical-align: middle; flex-shrink: 0; object-fit: contain; }
.brand-mark { display: block; width: 36px; height: 36px; }
.footer-mark { width: 16px; height: 16px; }
.btn-dpad, .btn-toggle-sub, .btn-proporcion-lock { display: inline-flex; align-items: center; justify-content: center; }
.btn-dpad .ui-icon, .btn-toggle-sub .ui-icon { width: 14px; height: 14px; }
.btn-dpad-depth, #btnFlipY, .btn-flotante-3d { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.btn-dpad-depth .ui-icon, #btnFlipY .ui-icon { width: 13px; height: 13px; }
.drag-handle-bar .ui-icon { width: 12px; height: 18px; }
.btn-proporcion-lock { min-width: 28px; min-height: 28px; }
.btn-proporcion-lock .ui-icon, .pieza-item .ui-icon, .pieza-item .ui-icon-asset { width: 15px; height: 15px; }
.pieza-item button { display: inline-flex; align-items: center; justify-content: center; color: #766b82; }
.pieza-item button:hover { color: var(--primary); background: #eae2f4 !important; border-radius: 4px; }
.toolbar-fixed label > span { display: inline-flex; align-items: center; justify-content: center; }
#iconoModoPan { display: inline-flex; }
.empty-cta .ui-icon { width: 14px; height: 14px; margin-left: 14px; }
.indicador-clip .ui-icon { width: 14px; height: 14px; }

/* --- ESTILOS DEL MODAL DE CONFIRMACIÓN Y DIÁLOGOS CAD --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-content {
    background: #ffffff;
    padding: 24px;
    border-radius: 20px;
    width: 340px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    text-align: left;
    border: 1px solid #e4e4e7;
}

.modal-content-sm {
    width: 380px;
}

.modal-header-styled {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e4e4e7;
}

.modal-title-with-icon {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title-with-icon h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #18181b;
}

.modal-title-with-icon .modal-icon {
    color: var(--primary, #D3AFF5);
}

.btn-cerrar-modal {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    transition: background 0.15s ease;
}

.btn-cerrar-modal:hover {
    background: #f4f4f5;
}

.modal-body-styled {
    margin-bottom: 16px;
}

.modal-desc {
    font-size: 12px;
    color: #71717a;
    line-height: 1.5;
    margin: 0 0 12px 0;
}

.input-croaket-select {
    width: 100%;
    padding: 8px 12px;
    border-radius: 9999px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    font-size: 12px;
    color: #18181b;
    outline: none;
    transition: border-color 0.2s ease;
}

.input-croaket-select:focus {
    border-color: #D3AFF5;
}

.modal-footer-styled {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid #e4e4e7;
}

.btn-primario-modal {
    background: #D3AFF5;
    color: #18181b;
    border: none;
    border-radius: 9999px;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primario-modal:hover {
    background: #B5E86E;
}

.btn-secundario-modal {
    background: #e4e4e7;
    color: #18181b;
    border: none;
    border-radius: 9999px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-secundario-modal:hover {
    background: #d4d4d8;
}

.btn-modal {
    padding: 8px 18px;
    border: none;
    border-radius: 9999px;
    font-weight: 700;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: #e4e4e7;
    color: #18181b;
}

.btn-modal-cancel:hover { background: #d4d4d8; }

.btn-modal-accept {
    background: #B5E86E;
    color: #18181b;
}

.btn-modal-accept:hover { background: #a4dc5a; }

/**resetear pieza **/
.btn-reset-pieza {
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: #fff;
    border: 1px solid #ffcdd2;
    color: #d32f2f;
    border-radius: 6px;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-reset-pieza:hover {
    background: #ffebee;
    border-color: #ef5350;
}

/* --- FIX DE SCROLL PARA LA GALERÍA DE FIGURAS --- */
.col-izquierda {
    height: 100%;
    overflow: hidden !important;
}

.panel-boceto-container {
    height: 100% !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vista-preset, #vistaPreset {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.galeria-piezas-grid, #galeriaPiezas {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    overflow-y: auto !important; /* Forzamos la barra de desplazamiento */
    max-height: none !important;
    min-height: 0;
    padding-right: 6px;
    padding-bottom: 20px;
}

/* Scrollbar personalizada sutil */
#galeriaPiezas::-webkit-scrollbar {
    width: 5px;
}
#galeriaPiezas::-webkit-scrollbar-track {
    background: transparent;
}
#galeriaPiezas::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}
#galeriaPiezas::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* --- ALERTA DE ERROR Y ADVERTENCIAS EN PATRÓN --- */
.alerta-error {
    margin-top: 8px;
    padding: 9px 12px;
    background: #ffebee;
    border: 1px solid #ef5350;
    border-radius: 6px;
    color: #c62828;
    font-size: 11.5px;
    line-height: 1.45;
    font-weight: 500;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(198, 40, 40, 0.08);
    transition: all 0.25s ease;
}

.alerta-error.alerta-banner-error {
    background: #fef2f2 !important;
    border: 1px solid #ef4444 !important;
    color: #991b1b !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.12) !important;
}

.alerta-error.alerta-banner-warning {
    background: #fffbeb !important;
    border: 1px solid #f59e0b !important;
    color: #92400e !important;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.12) !important;
}

/* Modificadores dinámicos del editor de patrón #patternInput */
#patternInput.input-error-bloqueante {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16) !important;
    background-color: #fffafb !important;
}

#patternInput.input-aviso-advertencia {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16) !important;
    background-color: #fffdf7 !important;
}

/* --- BURBUJA FLOTANTE DE EDICIÓN 2D --- */
.burbuja-edicion {
    position: absolute;
    z-index: 1200;
    background: #ffffff;
    border: 1px solid #90caf9;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 8px 10px;
    min-width: 140px;
}

.burbuja-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #1976d2;
}

.btn-cerrar-burbuja {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: #888;
    line-height: 1;
    padding: 0 2px;
}

.btn-cerrar-burbuja:hover {
    color: #333;
}

.burbuja-acciones {
    display: flex;
    gap: 4px;
}

.btn-punto {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f9fa;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.btn-punto:hover {
    background: #fbf7ff;
    border-color: #D3AFF5;
    color: #18181b;
}

/* --- CHECKBOX MODO ESPEJO --- */
.checkbox-espejo-wrapper {
    margin-top: 10px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f5f5f7;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.lbl-checkbox-espejo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.lbl-checkbox-espejo input[type="checkbox"] {
    cursor: pointer;
    accent-color: #D3AFF5;
    width: 15px;
    height: 15px;
}

/* --- ACCIONES DE ENCABEZADO Y PERSISTENCIA --- */
.header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-nuevo-proyecto {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ffffff;
    color: #4b4553;
    border: 1px solid #dcd7e3;
    padding: 9px 13px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-nuevo-proyecto:hover {
    background: #f6f4f9;
    border-color: #c7c0d2;
    color: #1e1b22;
}

.status-dot.status-saved {
    background: #4caf50 !important;
}

.status-dot.status-saving {
    background: #ff9800 !important;
}

/* ========================================================
   MODO OSCURO GLOBAL (GLOBAL DARK THEME)
   ======================================================== */
html.theme-dark,
body.theme-dark {
    --main: #181820;
    --main-grey: #2e2e3c;
    background-color: #121217 !important;
    color: #e2e8f0 !important;
}

body.theme-dark #app-header {
    background: #181820 !important;
    border-bottom: 1px solid #2a2a38 !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.4) !important;
}

body.theme-dark .logo-brand {
    color: #93c5fd !important;
}

body.theme-dark .brand-tag {
    color: var(--primary) !important;
}

body.theme-dark .project-title {
    color: #cbd5e1 !important;
}

body.theme-dark .project-divider {
    color: #64748b !important;
}

body.theme-dark .project-type {
    color: #94a3b8 !important;
}

body.theme-dark .croaket-workspace {
    background: #121217 !important;
}

body.theme-dark .col-izquierda,
body.theme-dark .col-centro,
body.theme-dark .col-derecha {
    background: #121217 !important;
}

body.theme-dark .panel-boceto-container,
body.theme-dark .panel-armado-container,
body.theme-dark .panel-card {
    background: #181820 !important;
    border-color: #2a2a38 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .box-title,
body.theme-dark .lbl-form-sm,
body.theme-dark .lbl-checkbox-espejo span {
    color: #94a3b8 !important;
}

body.theme-dark .tabs-modo-container {
    background: #121217 !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .btn-tab-modo.active {
    background: #22222d !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-tab-modo.inactive {
    background: transparent !important;
    color: #64748b !important;
}

body.theme-dark .select-preset-cat,
body.theme-dark .select-preset-scale,
body.theme-dark #direccionTejido {
    background: #22222d !important;
    color: #f8fafc !important;
    border: 1px solid #333346 !important;
}

body.theme-dark #patternInput {
    background: #15151c !important;
    color: #f8fafc !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark #patternInput.input-error-bloqueante {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28) !important;
    background: #1e1316 !important;
}

body.theme-dark #patternInput.input-aviso-advertencia {
    border-color: #f59e0b !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28) !important;
    background: #1e1811 !important;
}

body.theme-dark .alerta-error.alerta-banner-error {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: #ef4444 !important;
    color: #fca5a5 !important;
}

body.theme-dark .alerta-error.alerta-banner-warning {
    background: rgba(245, 158, 11, 0.16) !important;
    border-color: #f59e0b !important;
    color: #fcd34d !important;
}

body.theme-dark #textoPatron {
    background: #15151c !important;
    color: #cbd5e1 !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .lista-piezas-armado {
    background: #181820 !important;
}

body.theme-dark .item-pieza-armado {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .item-pieza-armado.activa {
    background: #2e1e3e !important;
    border-color: var(--primary) !important;
}

body.theme-dark #canvas-svg,
body.theme-dark .canvas-wrapper {
    background: #15151c !important;
    border-color: #2a2a38 !important;
}

body.theme-dark .toolbar-fixed {
    background: #22222d !important;
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .toolbar-fixed label {
    background: #2e2e3d !important;
    border-color: #3a3a4c !important;
    color: #f8fafc !important;
}

body.theme-dark .workspace-footer {
    background: #181820 !important;
    border-top: 1px solid #2a2a38 !important;
    color: #94a3b8 !important;
}

body.theme-dark .btn-nuevo-proyecto,
body.theme-dark .btn-exportar-pdf {
    background: #22222d !important;
    color: #f8fafc !important;
    border-color: #333346 !important;
}

body.theme-dark .btn-nuevo-proyecto:hover,
body.theme-dark .btn-exportar-pdf:hover {
    background: #2e2e3d !important;
    border-color: #4a4a60 !important;
}

body.theme-dark .modal-content {
    background: #181820 !important;
    color: #f8fafc !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .modal-content h3 {
    color: #f8fafc !important;
}

body.theme-dark .modal-content p {
    color: #94a3b8 !important;
}

body.theme-dark .btn-modal-cancel {
    background: #2e2e3d !important;
    color: #cbd5e1 !important;
}

body.theme-dark .btn-reset-pieza {
    background: #2e2230 !important;
    border-color: #4a2d50 !important;
    color: #fca5a5 !important;
}

/* Lienzo central y pestañas */
body.theme-dark .header-lienzo {
    background: #181820 !important;
    border-color: #2a2a38 !important;
}

body.theme-dark .btn-vista {
    color: #94a3b8 !important;
    background: transparent !important;
}

body.theme-dark .btn-vista.active {
    background: #2e1e3e !important;
    color: #AB77DC !important;
    border-color: transparent !important;
}

/* Barra flotante de controles 3D */
body.theme-dark .controls-row-overlay {
    background: #1e1e28 !important;
    border: 1px solid #2a2a38 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.5) !important;
}

body.theme-dark .controls-row-overlay select {
    background: #2a2a38 !important;
    color: #f8fafc !important;
    border: 1px solid #3a3a4c !important;
}

body.theme-dark #btnFlipY {
    background: #2a2a38 !important;
    color: #f8fafc !important;
    border: 1px solid #3a3a4c !important;
}

body.theme-dark .drag-handle-bar {
    background: #2a2a38 !important;
    color: #cbd5e1 !important;
}

/* Empty state del Canvas 3D */
body.theme-dark .canvas-empty-state {
    background: #14141a !important;
    color: #e2e8f0 !important;
}

body.theme-dark .canvas-empty-state h2 {
    color: #f8fafc !important;
}

body.theme-dark .canvas-empty-state p {
    color: #94a3b8 !important;
}

body.theme-dark .empty-cta {
    background: #2e1e3e !important;
    color: #AB77DC !important;
    border-color: var(--primary) !important;
}

body.theme-dark .btn-flotante-3d {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

/* Columna Izquierda: Catálogo y Medidas */
body.theme-dark .preset-card {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .preset-card > div:first-child {
    background: #181820 !important;
}

body.theme-dark .preset-card > div:last-child {
    color: #f8fafc !important;
}

body.theme-dark .preset-card.is-selected {
    background: #2e1e3e !important;
    border: 2px solid var(--primary) !important;
}

body.theme-dark .btn-toggle-avanzado {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .panel-avanzado-preset {
    background: #181820 !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .input-medida-num {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-proporcion-lock {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .metrics-box {
    background: #181820 !important;
    border: 1px solid #2a2a38 !important;
    color: #cbd5e1 !important;
}

body.theme-dark .select-tension-sm {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .caja-patron-texto {
    background: #181820 !important;
    border-color: #2a2a38 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .titulo-guia-pasos {
    color: #93c5fd !important;
}

/* Columna Derecha: Inspector */
body.theme-dark .inspector-heading {
    color: #f8fafc !important;
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .inspector-badge {
    background: #2e1e3e !important;
    color: #AB77DC !important;
}

body.theme-dark .code-badge {
    background: #2a2a38 !important;
    color: #c4b5fd !important;
}

body.theme-dark .label-seccion {
    color: #e2e8f0 !important;
}

body.theme-dark .help-text {
    color: #94a3b8 !important;
}

body.theme-dark .panel-header-sub {
    color: #e2e8f0 !important;
}

body.theme-dark .txt-sub-blue {
    color: #93c5fd !important;
}

body.theme-dark .btn-toggle-sub {
    color: #94a3b8 !important;
    background: transparent !important;
}

body.theme-dark .dpad-wrapper {
    background: #15151c !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .btn-dpad {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #cbd5e1 !important;
}

body.theme-dark .btn-dpad:hover {
    background: #2e2e3d !important;
    color: #ffffff !important;
}

body.theme-dark .btn-dpad-center {
    background: #2e1e3e !important;
    color: #AB77DC !important;
    border-color: var(--primary) !important;
}

body.theme-dark .btn-dpad-depth {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #cbd5e1 !important;
}

body.theme-dark .lbl-slider,
body.theme-dark .lbl-dpad,
body.theme-dark .val-slider,
body.theme-dark .lbl-subseccion {
    color: #94a3b8 !important;
}

/* Componentes de Usuario, Dropdown y Modales (Base) */
.user-profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    color: #18181b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.user-profile-badge:hover,
.user-profile-badge.active {
    background: #fdfaff;
    border-color: #D3AFF5;
    box-shadow: 0 0 0 2px rgba(211, 175, 245, 0.25);
}

.user-dropdown-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e5ea;
    z-index: 2500;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.user-dropdown-popover.open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Componentes de Usuario, Dropdown y Modales */
body.theme-dark .user-profile-badge,
body.dark .user-profile-badge {
    background: #1e1e28 !important;
    border-color: #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .user-profile-badge:hover,
body.theme-dark .user-profile-badge.active {
    background: #282836 !important;
    border-color: var(--primary) !important;
}

body.theme-dark .user-dropdown-popover {
    background: #181820 !important;
    border-color: #2a2a38 !important;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .dropdown-user-header {
    background: #1e1e28 !important;
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .dropdown-user-name {
    color: #f8fafc !important;
}

body.theme-dark .dropdown-user-email {
    color: #94a3b8 !important;
}

body.theme-dark .dropdown-item-btn {
    color: #cbd5e1 !important;
}

body.theme-dark .dropdown-item-btn:hover {
    background: #242432 !important;
    color: #ffffff !important;
}

body.theme-dark .dropdown-item-btn.logout:hover {
    background: #3b181e !important;
    color: #f87171 !important;
}

body.theme-dark .dropdown-divider-line {
    background: #2a2a38 !important;
}

body.theme-dark .theme-status-pill {
    background: #262635 !important;
    color: #cbd5e1 !important;
}

/* ========================================================
   MODALES DE AUTENTICACIÓN Y USUARIO (BASE LIGHT MODE)
   ======================================================== */
.auth-modal-dialog {
    background: #ffffff;
    width: 420px;
    max-width: 92vw;
    border-radius: 16px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2), 0 4px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    animation: authModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes authModalPop {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.auth-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.auth-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #e2e8f0;
    padding: 3px;
    border-radius: 10px;
}
.auth-tab-btn {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 700;
    border: none;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.15s ease;
}
.auth-tab-btn.active {
    background: #ffffff;
    color: var(--primary, #AB77DC);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.auth-tab-btn:hover:not(.active) {
    color: #1e293b;
}
.auth-modal-header .btn-cerrar-burbuja {
    background: transparent;
    border: none;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s;
}
.auth-modal-header .btn-cerrar-burbuja:hover {
    background: #e2e8f0;
    color: #1e293b;
}
.auth-modal-body {
    padding: 24px;
}
.auth-error-banner {
    display: none;
    padding: 10px 14px;
    border-radius: 8px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 16px;
}
.auth-error-banner:not(:empty) {
    display: block;
}
.auth-field {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    text-align: left;
}
.auth-field label {
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.auth-field input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.15s;
}
.auth-field input:focus {
    outline: none;
    border-color: var(--primary, #AB77DC);
    box-shadow: 0 0 0 3px rgba(171, 119, 220, 0.15);
}
.auth-submit-btn {
    width: 100%;
    padding: 11px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    background: var(--primary, #AB77DC);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
    margin-top: 6px;
    box-shadow: 0 2px 6px rgba(171, 119, 220, 0.25);
}
.auth-submit-btn:hover {
    filter: brightness(0.93);
    transform: translateY(-1px);
}
.auth-submit-btn:active {
    transform: translateY(0);
}
.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 18px 0;
    font-size: 12px;
    color: #94a3b8;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e2e8f0;
}
.auth-divider::before {
    margin-right: 12px;
}
.auth-divider::after {
    margin-left: 12px;
}
.btn-google-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-google-auth:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

body.theme-dark .auth-modal-dialog,
body.theme-dark .profile-modal-dialog,
body.theme-dark .cropper-modal-dialog,
body.theme-dark .projects-modal-dialog {
    background: #181820 !important;
    border: 1px solid #2a2a38 !important;
    color: #f8fafc !important;
}

body.theme-dark .auth-modal-header {
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .auth-modal-header h3 {
    color: #f8fafc !important;
}

body.theme-dark .auth-tab-btn {
    color: #94a3b8 !important;
}

body.theme-dark .auth-tab-btn.active {
    color: #f8fafc !important;
    border-bottom-color: var(--primary) !important;
}

body.theme-dark .auth-field label {
    color: #cbd5e1 !important;
}

body.theme-dark .auth-field input {
    background: #15151c !important;
    border: 1px solid #2a2a38 !important;
    color: #f8fafc !important;
}

body.theme-dark .profile-avatar-row {
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .profile-avatar-row h4 {
    color: #f8fafc !important;
}

body.theme-dark .profile-avatar-row p {
    color: #94a3b8 !important;
}

body.theme-dark .profile-info-grid {
    background: #15151c !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .profile-stat-box {
    color: #94a3b8 !important;
}

body.theme-dark .profile-stat-value {
    color: #f8fafc !important;
}

body.theme-dark .cropper-controls-row {
    background: #181820 !important;
    border-color: #2a2a38 !important;
}

body.theme-dark .btn-cropper-icon {
    background: #22222d !important;
    border-color: #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-cropper-icon:hover {
    background: #2e2e3d !important;
}

body.theme-dark .cropper-modal-dialog > div:last-child {
    background: #181820 !important;
    border-top: 1px solid #2a2a38 !important;
}

body.theme-dark .project-card-item {
    background: #1e1e28 !important;
    border: 1px solid #2a2a38 !important;
}

body.theme-dark .project-card-item:hover {
    border-color: var(--primary) !important;
    background: #261f33 !important;
}

body.theme-dark .project-card-info h4 {
    color: #f8fafc !important;
}

body.theme-dark .project-card-info p {
    color: #94a3b8 !important;
}

body.theme-dark .btn-proj-action {
    background: #262635 !important;
    border-color: #333346 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .btn-proj-action:hover {
    background: #323246 !important;
}

body.theme-dark .btn-proj-action.open {
    background: var(--primary) !important;
    color: #ffffff !important;
}

body.theme-dark .btn-proj-action.delete:hover {
    background: #451a1a !important;
    color: #fca5a5 !important;
    border-color: #7f1d1d !important;
}

body.theme-dark #inputBuscarProyectos,
body.theme-dark #inputBuscarAdminUsuarios {
    background: #15151c !important;
    border-color: #2a2a38 !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-header-auth {
    background: #22222d !important;
    border: 1px solid #333346 !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-header-auth:hover {
    background: #2e2e3d !important;
}

body.theme-dark .btn-header-auth.primary {
    background: var(--primary) !important;
    color: #ffffff !important;
}

body.theme-dark .project-title-clickable:hover {
    background: #242432 !important;
    border-color: #3a3a4c !important;
    color: #AB77DC !important;
}

body.theme-dark .project-title-clickable:hover .btn-edit-title-icon {
    color: #AB77DC !important;
}

body.theme-dark #inputNombreProyecto,
body.theme-dark #inputDescripcionProyecto {
    background: #15151c !important;
    border-color: #2a2a38 !important;
    color: #f8fafc !important;
}

/* ==========================================================================
   SISTEMA DE ACCESORIOS 3D (OJOS DE SEGURIDAD Y BOTONES)
   ========================================================================== */

.panel-header-badge {
    background: #ede2fa;
    color: #18181b;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 10px;
    letter-spacing: 0.5px;
}

.catalogo-accesorios-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
}

.card-tipo-accesorio {
    background: #ffffff;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.card-tipo-accesorio:hover {
    border-color: var(--primary);
    background: #fbf8fd;
}

.card-tipo-accesorio.is-selected {
    border-color: #D3AFF5;
    background: #f3e5f5;
    box-shadow: 0 0 0 1px #D3AFF5;
}

.card-tipo-accesorio .icono-acc {
    width: 22px;
    height: 22px;
    color: #18181b;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-tipo-accesorio .titulo-acc {
    font-size: 10px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.row-opciones-accesorio {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
    background: #fdfdfd;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 8px 10px;
}

.pills-tamanos {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-pill-tamano {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #ccc;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #444;
}

.btn-pill-tamano.is-selected {
    background: #D3AFF5;
    color: #fff;
    border-color: #D3AFF5;
}

.paleta-colores-acc {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.btn-color-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1px #bbb;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-color-swatch:hover {
    transform: scale(1.15);
}

.btn-color-swatch.is-selected {
    box-shadow: 0 0 0 2px #D3AFF5;
    transform: scale(1.15);
}

.btn-colocar-accesorio {
    background: #D3AFF5;
    color: #18181b;
    border: none;
    border-radius: 9999px;
    padding: 9px 14px;
    font-size: 11.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-colocar-accesorio:hover {
    background: #B5E86E;
    color: #18181b;
}

.btn-colocar-accesorio.activo {
    background: #B5E86E;
    color: #18181b;
    animation: pulsoColocacion 1.5s infinite;
}

@keyframes pulsoColocacion {
    0% { box-shadow: 0 0 0 0 rgba(181, 232, 110, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(181, 232, 110, 0); }
    100% { box-shadow: 0 0 0 0 rgba(181, 232, 110, 0); }
}

.banner-modo-colocacion {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    background: rgba(33, 33, 33, 0.94);
    color: #fff;
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.banner-modo-colocacion button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    border-radius: 10px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}

.banner-modo-colocacion button:hover {
    background: rgba(255,255,255,0.35);
}

.lista-accesorios-colocados {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    max-height: 160px;
    overflow-y: auto;
}

.item-accesorio-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
}

.item-accesorio-info {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.item-accesorio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.callout-accesorio {
    margin: 4px 0 6px 8px;
    padding: 6px 10px;
    background: #fff8e1;
    border-left: 3.5px solid #ffb300;
    border-radius: 4px;
    font-size: 11.5px;
    color: #795548;
    line-height: 1.35;
    display: flex;
    align-items: center;
    gap: 6px;
}

body.theme-dark .panel-header-badge {
    background: #261f33 !important;
    color: #ede2fa !important;
}

body.theme-dark .card-tipo-accesorio {
    background: #1c1c28 !important;
    border-color: #2e2e40 !important;
    color: #e2e8f0 !important;
}

body.theme-dark .card-tipo-accesorio .titulo-acc {
    color: #e2e8f0 !important;
}

body.theme-dark .card-tipo-accesorio .icono-acc {
    color: #D3AFF5 !important;
}

body.theme-dark .card-tipo-accesorio.is-selected {
    background: #2d1e3d !important;
    border-color: var(--primary) !important;
}

body.theme-dark .row-opciones-accesorio {
    background: #181822 !important;
    border-color: #2a2a3a !important;
}

body.theme-dark .btn-pill-tamano {
    background: #222230 !important;
    border-color: #333346 !important;
    color: #cbd5e1 !important;
}

body.theme-dark .btn-pill-tamano.is-selected {
    background: var(--primary) !important;
    color: #ffffff !important;
}

body.theme-dark .item-accesorio-card {
    background: #1c1c28 !important;
    border-color: #2a2a3a !important;
    color: #f1f5f9 !important;
}

body.theme-dark .callout-accesorio {
    background: #2a2012 !important;
    border-left-color: #ffb300 !important;
    color: #ffe082 !important;
}

/* ==========================================================================
   BARRA DE PUNTOS DE CROCHET (MULTI-STITCH TOOLBAR & MODAL)
   ========================================================================== */
.barra-puntos-crochet {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 4px 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.pills-puntos-scroll {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    flex: 1;
    padding-bottom: 2px;
}

.pills-puntos-scroll::-webkit-scrollbar {
    height: 4px;
}

.pills-puntos-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.btn-punto-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    user-select: none;
}

.btn-punto-pill:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

.btn-punto-pill .punto-simbolo {
    font-family: monospace;
    font-weight: 800;
    color: #0284c7;
}

.btn-punto-pill .punto-abrev {
    font-size: 10px;
    color: #64748b;
}

.btn-punto-pill.is-active {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1;
    box-shadow: 0 0 0 1px #0284c7;
}

.btn-punto-pill.is-active .punto-abrev {
    color: #0284c7;
    font-weight: 700;
}

.btn-insertar-punto-editor {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #0284c7;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.btn-insertar-punto-editor:hover {
    background: #0369a1;
}

.btn-convertir-vuelta-trigger {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #166534;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-convertir-vuelta-trigger:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

.btn-convertir-vuelta-trigger .ui-icon {
    width: 13px;
    height: 13px;
}

/* Modo oscuro para Multi-Stitch */
body.theme-dark .barra-puntos-crochet {
    background: #181824 !important;
    border-color: #2b2b3d !important;
}

body.theme-dark .pills-puntos-scroll::-webkit-scrollbar-thumb {
    background: #3b3b52 !important;
}

body.theme-dark .btn-punto-pill {
    background: #202030 !important;
    border-color: #333346 !important;
    color: #cbd5e1 !important;
}

body.theme-dark .btn-punto-pill:hover {
    background: #28283d !important;
    border-color: #4b4b66 !important;
    color: #f8fafc !important;
}

body.theme-dark .btn-punto-pill .punto-simbolo {
    color: #38bdf8 !important;
}

body.theme-dark .btn-punto-pill .punto-abrev {
    color: #94a3b8 !important;
}

body.theme-dark .btn-punto-pill.is-active {
    background: #0c4a6e !important;
    border-color: #38bdf8 !important;
    color: #e0f2fe !important;
    box-shadow: 0 0 0 1px #38bdf8 !important;
}

body.theme-dark .btn-punto-pill.is-active .punto-abrev {
    color: #bae6fd !important;
}

body.theme-dark .btn-convertir-vuelta-trigger {
    background: #064e3b !important;
    border-color: #059669 !important;
    color: #a7f3d0 !important;
}

body.theme-dark .btn-convertir-vuelta-trigger:hover {
    background: #065f46 !important;
}

/* Soporte modo oscuro para nuevos componentes CAD Minimal */
body.theme-dark #app-header,
body.theme-dark #app-header.header-cad-minimal,
body.theme-dark .col-izquierda,
body.theme-dark .col-centro,
body.theme-dark .col-derecha,
body.theme-dark .header-lienzo,
body.theme-dark .panel-boceto-container {
    background: #18181f;
    border-color: #272732;
}

body.theme-dark .croaket-workspace {
    background: #121217;
}

body.theme-dark .tabs-modo-container {
    background: #23232c;
}

body.theme-dark .btn-tab-modo.active {
    background: #2d2d38;
    color: #f4f4f7;
}

body.theme-dark .btn-tab-modo.inactive {
    color: #9494a3;
}

body.theme-dark .lbl-cad-section {
    color: #a1a1aa;
}

body.theme-dark .pill-input-box,
body.theme-dark .btn-pill-icon,
body.theme-dark .btn-pill-export,
body.theme-dark .btn-agregar-ensamblaje,
body.theme-dark .panel-card-cad,
body.theme-dark .card-armado-piezas,
body.theme-dark .btn-flotante-3d {
    background: #1f1f28;
    border-color: #333342;
    color: #f4f4f7;
}

body.theme-dark .pill-select {
    color: #f4f4f7;
}

body.theme-dark .pill-dot {
    background: #e4e4e7;
}

body.theme-dark .galeria-modelos-box,
body.theme-dark .armado-container {
    background: #14141a;
    border-color: #282834;
}

body.theme-dark .preset-card {
    background: #1e1e27 !important;
    border-color: #313140 !important;
    color: #f4f4f7;
}

body.theme-dark .preset-card.is-selected {
    border-color: #AB77DC !important;
    background: #252433 !important;
}

body.theme-dark .pieza-item {
    background: #1e1e27;
    border-color: #2c2c3a;
    color: #f4f4f7;
}

body.theme-dark .pieza-item.is-selected {
    border-color: #AB77DC !important;
    border-left: 4px solid #AB77DC !important;
    background: #242332 !important;
}

body.theme-dark .btn-vista {
    color: #8f8fa0;
}

body.theme-dark .btn-vista.active {
    color: #f4f4f7;
}

body.theme-dark .btn-vista.active::after {
    background: #f4f4f7;
}

body.theme-dark .btn-header-text,
body.theme-dark .btn-header-auth {
    color: #a1a1aa;
}

body.theme-dark .btn-header-text:hover,
body.theme-dark .btn-header-auth:hover {
    color: #f4f4f7;
    background: #262633;
}

body.theme-dark .btn-header-auth.primary,
body.theme-dark #btnAbrirAuthModal,
body.theme-dark .btn-pill-auth,
body.dark .btn-header-auth.primary,
body.dark #btnAbrirAuthModal,
body.dark .btn-pill-auth {
    background: #AB77DC !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

body.theme-dark .btn-header-auth.primary:hover,
body.theme-dark #btnAbrirAuthModal:hover,
body.theme-dark .btn-pill-auth:hover,
body.dark .btn-header-auth.primary:hover,
body.dark #btnAbrirAuthModal:hover,
body.dark .btn-pill-auth:hover {
    background: #B5E86E !important;
    color: #18181b !important;
}

body.theme-dark .btn-control-icon-pill,
body.dark .btn-control-icon-pill {
    background: #2a2a38;
    border-color: #3a3a4c;
    color: #f8fafc;
}

body.theme-dark .btn-control-icon-pill:hover:not(:disabled),
body.dark .btn-control-icon-pill:hover:not(:disabled) {
    background: #3f3f5a;
    border-color: #8b5cf6;
    color: #c4b5fd;
}

body.theme-dark .btn-history-action:disabled,
body.dark .btn-history-action:disabled {
    background: transparent !important;
    border-color: #333342 !important;
    color: #6b7280 !important;
}

body.theme-dark .btn-control-pill {
    background: #22222d;
    border-color: #343444;
    color: #f4f4f7;
}

body.theme-dark .controls-row-overlay {
    background: rgba(26, 26, 35, 0.92);
    border-color: #353545;
    color: #f4f4f7;
}

body.theme-dark .controls-row-overlay select {
    background: #1e1e27;
    border-color: #353545;
    color: #f4f4f7;
}


/* ==========================================================================
   CORRECCIÓN ESTRICTA DE PALETA DE COLORES, SVGS DINÁMICOS Y CONTRASTE DARK
   ========================================================================== */

/* 1. ADAPTACIÓN DINÁMICA DE ÍCONOS SVG */
/* Modo Claro: Negro (#1A181C / #000000) */
.ui-icon,
svg:not([fill*="#"]):not([stroke*="#"]) {
    stroke: currentColor;
    color: #1A181C;
}

.ui-icon-asset,
.btn-header-auth img,
.btn-header-text img,
.btn-vista img,
.btn-pill-export img,
.btn-proj-pill img,
.btn-admin-pill img,
.dropdown-item-btn img,
.btn-flotante-3d img,
.btn-opciones-escala img,
.btn-cerrar-modal img {
    filter: brightness(0);
}

/* Modo Oscuro: Gris Claro (#9CA3AF / #E5E7EB) */
body.theme-dark .ui-icon,
body.dark .ui-icon,
html.dark .ui-icon,
html.theme-dark .ui-icon,
body.theme-dark svg:not([fill*="#"]):not([stroke*="#"]):not([class*="color-"]),
body.dark svg:not([fill*="#"]):not([stroke*="#"]):not([class*="color-"]),
html.dark svg:not([fill*="#"]):not([stroke*="#"]):not([class*="color-"]) {
    stroke: currentColor;
    color: #9CA3AF !important;
}

body.theme-dark .ui-icon-asset,
body.dark .ui-icon-asset,
html.dark .ui-icon-asset,
html.theme-dark .ui-icon-asset,
body.theme-dark .btn-header-auth img,
body.dark .btn-header-auth img,
body.theme-dark .btn-header-text img,
body.dark .btn-header-text img,
body.theme-dark .btn-vista img,
body.dark .btn-vista img,
body.theme-dark .btn-pill-export img,
body.dark .btn-pill-export img,
body.theme-dark .btn-proj-pill img,
body.dark .btn-proj-pill img,
body.theme-dark .btn-admin-pill img,
body.dark .btn-admin-pill img,
body.theme-dark .dropdown-item-btn img,
body.dark .dropdown-item-btn img,
body.theme-dark .btn-flotante-3d img,
body.dark .btn-flotante-3d img,
body.theme-dark .btn-opciones-escala img,
body.dark .btn-opciones-escala img,
body.theme-dark .btn-cerrar-modal img,
body.dark .btn-cerrar-modal img,
body.theme-dark img[src*="assets/"]:not([src*="Logo"]):not([src*="croaket-mark"]):not([src*="google"]),
body.dark img[src*="assets/"]:not([src*="Logo"]):not([src*="croaket-mark"]):not([src*="google"]),
html.dark img[src*="assets/"]:not([src*="Logo"]):not([src*="croaket-mark"]):not([src*="google"]),
html.theme-dark img[src*="assets/"]:not([src*="Logo"]):not([src*="croaket-mark"]):not([src*="google"]) {
    filter: brightness(0) invert(0.68) !important;
}

/* En botones primarios o rojos con fondo oscuro */
.btn-admin-pill.delete:hover img,
.btn-proj-pill.delete:hover img {
    filter: brightness(0) invert(1) !important;
}

/* 2. SIMPLIFICACIÓN Y TIPOGRAFÍA DE LA BARRA DE NAVEGACIÓN */
.btn-header-text,
.btn-header-auth {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    text-transform: uppercase !important;
    padding: 5px 12px !important;
    border-radius: 9999px !important;
}

.btn-header-auth.primary,
#btnAbrirAuthModal,
.btn-pill-auth {
    background: #D3AFF5 !important;
    color: #18181b !important;
    border: none !important;
    border-radius: 9999px !important;
    padding: 5px 16px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.6px !important;
    text-transform: uppercase !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background 0.2s ease, transform 0.1s ease !important;
}

.btn-header-auth.primary:hover,
#btnAbrirAuthModal:hover,
.btn-pill-auth:hover {
    background: #B5E86E !important;
    color: #18181b !important;
}

.user-profile-badge {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    padding: 3px 10px 3px 4px !important;
    border-radius: 9999px !important;
}

/* 3. COMPONENTE FLOTANTE Y ARRASTRABLE: panelControles3D */
#panelControles3D {
    touch-action: none;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.drag-handle-bar {
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    border-radius: 9999px;
    background: rgba(0, 0, 0, 0.05);
    color: #71717a;
    transition: background 0.15s, color 0.15s;
    user-select: none;
}

.drag-handle-bar:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #18181b;
}

.drag-handle-bar:active,
#panelControles3D.is-dragging .drag-handle-bar {
    cursor: grabbing;
}

#panelControles3D.is-dragging {
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
    opacity: 0.96;
    user-select: none;
}

body.theme-dark .drag-handle-bar,
body.dark .drag-handle-bar {
    background: rgba(255, 255, 255, 0.08);
    color: #a1a1aa;
}

body.theme-dark .drag-handle-bar:hover,
body.dark .drag-handle-bar:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
}

/* 4. MODALES, DROPDOWNS Y COMPONENTES EN MODO OSCURO (ALTO CONTRASTE) */
body.theme-dark,
body.dark,
html.dark,
html.theme-dark {
    --primary: #AB77DC;
    --primary-hover: #9b61d3;
}

body.theme-dark .auth-modal-header,
body.dark .auth-modal-header,
html.dark .auth-modal-header,
html.theme-dark .auth-modal-header {
    background: #181820 !important;
    border-bottom: 1px solid #2a2a38 !important;
}

body.theme-dark .auth-modal-header h3,
body.dark .auth-modal-header h3,
body.theme-dark .auth-modal-header h4,
body.dark .auth-modal-header h4,
html.dark .auth-modal-header h3 {
    color: #f4f4f5 !important;
}

body.theme-dark .projects-modal-dialog,
body.theme-dark .profile-modal-dialog,
body.theme-dark .auth-modal-dialog,
body.theme-dark .cropper-modal-dialog,
body.theme-dark .modal-content,
body.dark .projects-modal-dialog,
body.dark .profile-modal-dialog,
body.dark .auth-modal-dialog,
body.dark .cropper-modal-dialog,
body.dark .modal-content,
html.dark .projects-modal-dialog,
html.dark .profile-modal-dialog,
html.dark .auth-modal-dialog {
    background: #181820 !important;
    border: 1px solid #2a2a38 !important;
    color: #f4f4f5 !important;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5) !important;
}

body.theme-dark .btn-cerrar-modal,
body.dark .btn-cerrar-modal {
    color: #9ca3af !important;
}

body.theme-dark .btn-cerrar-modal:hover,
body.dark .btn-cerrar-modal:hover {
    background: #2a2a38 !important;
    color: #ffffff !important;
}

/* Inputs, Selects y Textareas en Modo Oscuro */
body.theme-dark select,
body.dark select,
body.theme-dark select option,
body.dark select option,
html.dark select option {
    background: #1e1e28 !important;
    color: #f4f4f5 !important;
    border-color: #363649 !important;
}

body.theme-dark input[type="text"],
body.dark input[type="text"],
body.theme-dark input[type="email"],
body.dark input[type="email"],
body.theme-dark input[type="password"],
body.dark input[type="password"],
body.theme-dark textarea,
body.dark textarea,
body.theme-dark .input-proyectos-pill,
body.dark .input-proyectos-pill,
body.theme-dark .auth-field input,
body.dark .auth-field input,
body.theme-dark #inputBuscarAdminUsuarios,
body.dark #inputBuscarAdminUsuarios,
body.theme-dark #inputBuscarProyectos,
body.dark #inputBuscarProyectos,
body.theme-dark #perfilInputNombre,
body.dark #perfilInputNombre,
body.theme-dark #inputNombreProyecto,
body.dark #inputNombreProyecto,
body.theme-dark #inputDescripcionProyecto,
body.dark #inputDescripcionProyecto {
    background: #22222d !important;
    color: #f4f4f5 !important;
    border: 1px solid #363649 !important;
}

body.theme-dark input::placeholder,
body.dark input::placeholder,
body.theme-dark textarea::placeholder,
body.dark textarea::placeholder {
    color: #71717a !important;
}

body.theme-dark #perfilInputEmail,
body.dark #perfilInputEmail {
    background: #15151c !important;
    color: #a1a1aa !important;
    border: 1px solid #2a2a38 !important;
}

/* Modal Perfil Estadísticas */
body.theme-dark #perfilForm > div > div,
body.dark #perfilForm > div > div {
    background: #22222d !important;
    color: #9ca3af !important;
}

body.theme-dark #perfilStatProyectos,
body.dark #perfilStatProyectos,
body.theme-dark #perfilStatFecha,
body.dark #perfilStatFecha {
    color: #f4f4f5 !important;
}

/* Botones en Modo Oscuro */
body.theme-dark .btn-header-auth.primary,
body.dark .btn-header-auth.primary,
body.theme-dark #btnAbrirAuthModal,
body.dark #btnAbrirAuthModal,
body.theme-dark .btn-pill-auth,
body.dark .btn-pill-auth,
body.theme-dark .btn-nuevo-proj-pill,
body.dark .btn-nuevo-proj-pill,
body.theme-dark .btn-proj-pill.open,
body.dark .btn-proj-pill.open,
body.theme-dark .role-badge-pill.admin,
body.dark .role-badge-pill.admin,
body.theme-dark .btn-admin-pill.role,
body.dark .btn-admin-pill.role {
    background: #AB77DC !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

body.theme-dark .btn-header-auth.primary:hover,
body.dark .btn-header-auth.primary:hover,
body.theme-dark #btnAbrirAuthModal:hover,
body.dark #btnAbrirAuthModal:hover,
body.theme-dark .btn-pill-auth:hover,
body.dark .btn-pill-auth:hover,
body.theme-dark .btn-nuevo-proj-pill:hover,
body.dark .btn-nuevo-proj-pill:hover,
body.theme-dark .btn-proj-pill.open:hover,
body.dark .btn-proj-pill.open:hover,
body.theme-dark .btn-admin-pill.role:hover,
body.dark .btn-admin-pill.role:hover {
    background: #B5E86E !important;
    color: #18181b !important;
}

body.theme-dark .btn-proj-pill,
body.dark .btn-proj-pill {
    background: #222230 !important;
    border: 1px solid #363649 !important;
    color: #f4f4f5 !important;
}

body.theme-dark .btn-proj-pill:hover,
body.dark .btn-proj-pill:hover {
    background: #2d2d40 !important;
    border-color: #AB77DC !important;
    color: #ffffff !important;
}

body.theme-dark .preset-card.is-selected,
body.dark .preset-card.is-selected {
    border-color: #AB77DC !important;
    background: #261f33 !important;
}

body.theme-dark .pieza-item.is-selected,
body.dark .pieza-item.is-selected {
    border-color: #AB77DC !important;
    border-left: 4px solid #AB77DC !important;
    background: #261f33 !important;
}

body.theme-dark .card-tipo-accesorio.is-selected,
body.dark .card-tipo-accesorio.is-selected {
    border-color: #AB77DC !important;
    background: #261f33 !important;
}

body.theme-dark .card-tipo-accesorio .icono-acc,
body.dark .card-tipo-accesorio .icono-acc {
    color: #AB77DC !important;
}

body.theme-dark .btn-pill-tamano.is-selected,
body.dark .btn-pill-tamano.is-selected {
    background: #AB77DC !important;
    border-color: #AB77DC !important;
    color: #ffffff !important;
}

body.theme-dark .panel-header-badge,
body.dark .panel-header-badge {
    background: #AB77DC !important;
    color: #ffffff !important;
}


/* ==========================================================================
   EDITOR DE PATRÓN EN GRILLA / CUADERNO (TIPO EXCEL) & TABS PANEL DERECHO
   ========================================================================== */

/* 1. Tabs del Panel Derecho (Pill Toggle idéntico a catálogo/dibujo) */
.tabs-panel-derecho {
    margin: 24px 24px 0px;
}

.vista-panel-derecho {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 2. Encabezado del Editor */
.editor-patron-desc {
    font-size: 11.5px;
    color: var(--text-muted, #71717a);
    line-height: 1.5;
    margin-bottom: 10px;
}

.link-leer-mas {
    color: var(--primary, #D3AFF5);
    text-decoration: underline;
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
    transition: color 0.15s ease;
}

.link-leer-mas:hover {
    color: var(--text-primary, #18181b);
}

/* 3. Tarjeta y Tabla de la Grilla (Estilo Cuaderno / Excel) */
.grid-cuaderno-card {
    background: #ffffff;
    border: 1.5px solid #e4e4e7;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.grid-cuaderno-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.grid-cuaderno-table thead th {
    background: #f4f4f6;
    color: #71717a;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 7px 10px;
    border-bottom: 1.5px solid #e4e4e7;
    text-align: left;
    user-select: none;
}

.grid-cuaderno-table th.th-grid-row {
    width: 64px;
    text-align: center;
    border-right: 1.5px solid #e4e4e7;
}

.grid-cuaderno-table th.th-grid-actions {
    width: 44px;
    text-align: center;
}

/* Filas activas */
.grid-patron-row {
    border-bottom: 1px solid #f0f0f4;
    transition: background 0.12s ease;
}

.grid-patron-row:hover {
    background: #fafafa;
}

.cell-grid-row-id {
    width: 64px;
    text-align: center;
    padding: 5px 4px;
    border-right: 1px solid #f0f0f4;
    user-select: none;
}

.row-badge-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 9999px;
    background: #f0f0f4;
    font-size: 10.5px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-weight: 800;
    color: #52525b;
    letter-spacing: 0.5px;
}

.cell-grid-input {
    padding: 2px 8px;
}

.input-cell-patron {
    width: 100%;
    box-sizing: border-box;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12.5px;
    font-weight: 600;
    color: #18181b;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 5px 8px;
    outline: none;
    transition: all 0.15s ease;
}

.input-cell-patron:focus {
    background: #ffffff;
    border-color: #D3AFF5;
    box-shadow: 0 0 0 2px rgba(211, 175, 245, 0.25);
}

.cell-grid-actions {
    width: 44px;
    text-align: center;
    padding: 4px;
}

.btn-grid-del-row {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    transition: all 0.15s ease;
}

.btn-grid-del-row:hover {
    opacity: 1;
    background: #fee2e2;
}

.btn-grid-del-row:hover img {
    filter: brightness(0) invert(0.2) sepia(1) saturate(5000%) hue-rotate(345deg);
}

/* Fila Bloqueada / Inactiva (Placeholder) */
.grid-patron-row-locked {
    background: #f8fafc;
    border-bottom: 1px dashed #cbd5e1;
    cursor: pointer;
    transition: background 0.15s ease;
}

.grid-patron-row-locked:hover {
    background: #f1f5f9;
}

.cell-locked-id .row-badge-pill {
    background: #e2e8f0;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

.cell-locked-input {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
    padding: 8px 12px;
    user-select: none;
}

.btn-grid-add-row {
    background: #D3AFF5;
    color: #18181b;
    border: none;
    border-radius: 9999px;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.18s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.btn-grid-add-row:hover {
    background: #B5E86E;
    color: #18181b;
    transform: scale(1.08);
}

/* 4. Modo Oscuro para la Grilla y Tabs */
body.theme-dark .grid-cuaderno-card,
body.dark .grid-cuaderno-card {
    background: #181820;
    border-color: #2a2a38;
}

body.theme-dark .grid-cuaderno-table thead th,
body.dark .grid-cuaderno-table thead th {
    background: #1e1e28;
    color: #9ca3af;
    border-bottom-color: #2a2a38;
}

body.theme-dark .grid-cuaderno-table th.th-grid-row,
body.dark .grid-cuaderno-table th.th-grid-row {
    border-right-color: #2a2a38;
}

body.theme-dark .grid-patron-row,
body.dark .grid-patron-row {
    border-bottom-color: #242432;
}

body.theme-dark .grid-patron-row:hover,
body.dark .grid-patron-row:hover {
    background: #1e1e28;
}

body.theme-dark .cell-grid-row-id,
body.dark .cell-grid-row-id {
    border-right-color: #242432;
    color: #cbd5e1;
}

body.theme-dark .row-badge-pill,
body.dark .row-badge-pill {
    background: #232332;
    color: #e2e8f0;
}

body.theme-dark .input-cell-patron,
body.dark .input-cell-patron {
    color: #f4f4f5;
}

body.theme-dark .input-cell-patron:focus,
body.dark .input-cell-patron:focus {
    background: #1e1e28;
    border-color: #AB77DC;
    box-shadow: 0 0 0 2px rgba(171, 119, 220, 0.25);
}

body.theme-dark .grid-patron-row-locked,
body.dark .grid-patron-row-locked {
    background: #15151e;
    border-bottom-color: #2c2c3d;
}

body.theme-dark .grid-patron-row-locked:hover,
body.dark .grid-patron-row-locked:hover {
    background: #1b1b26;
}

body.theme-dark .cell-locked-id .row-badge-pill,
body.dark .cell-locked-id .row-badge-pill {
    background: #1e1e28;
    color: #71717a;
    border-color: #363649;
}

body.theme-dark .btn-grid-add-row,
body.dark .btn-grid-add-row {
    background: #AB77DC;
    color: #ffffff;
}

body.theme-dark .btn-grid-add-row:hover,
body.dark .btn-grid-add-row:hover {
    background: #B5E86E;
    color: #18181b;
}

body.theme-dark .btn-grid-del-row:hover,
body.dark .btn-grid-del-row:hover {
    background: #3b181e;
}

/* ============================================================================
   SELECTOR DE COLOR DE HILO Y PINTADO POR FILAS EN CROAKET STUDIO
   ============================================================================ */

.selector-color-patron-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 9px 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.selector-color-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.selector-color-lbl {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--text-muted, #71717a);
    text-transform: uppercase;
}

.btn-aplicar-color-todo {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(211, 175, 245, 0.18);
    border: 1px solid rgba(211, 175, 245, 0.5);
    color: #4a1d75;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn-aplicar-color-todo:hover {
    background: #B5E86E;
    border-color: #9ed454;
    color: #1a3300;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(181, 232, 110, 0.35);
}

.selector-color-body {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Botón disparador circular (Color Swatch Circle) */
.btn-trigger-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 1.5px #d4d4d8, 0 2px 5px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
}

.btn-trigger-color-swatch:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #7c3aed, 0 3px 8px rgba(124, 58, 237, 0.35);
}

.color-swatch-circle-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: block;
    transition: background-color 0.12s ease;
}

.swatches-colores-hilo {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.swatch-color-btn {
    width: 19px;
    height: 19px;
    border-radius: 50%;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s ease;
    flex-shrink: 0;
}

.swatch-color-btn:hover {
    transform: scale(1.22);
    box-shadow: 0 0 0 2px #18181b, 0 3px 6px rgba(0, 0, 0, 0.15);
}

.swatch-color-btn.is-active {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px #7c3aed, 0 2px 8px rgba(124, 58, 237, 0.4);
}

/* ============================================================================
   POPOVER SELECTOR DE COLOR PROFESIONAL (DRAGGABLE & FLOATING)
   ============================================================================ */

.popover-color-picker {
    position: fixed;
    z-index: 1200;
    width: 310px;
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22), 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    user-select: none;
    box-sizing: border-box;
    touch-action: none;
}

.popover-color-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    padding-bottom: 6px;
    border-bottom: 1px solid #f4f4f6;
}

.popover-color-header:active {
    cursor: grabbing;
}

.popover-color-drag-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #18181b;
}

.popover-color-title {
    font-size: 13px;
    font-weight: 700;
    color: #18181b;
}

.btn-close-popover {
    background: transparent;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.btn-close-popover:hover {
    background: #f4f4f5;
    color: #18181b;
}

/* Canvas de gradientes: Solid + SV Area */
.popover-color-canvas-wrap {
    display: flex;
    height: 125px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e4e4e7;
    position: relative;
}

.popover-solid-preview {
    width: 85px;
    height: 100%;
    flex-shrink: 0;
    transition: background-color 0.06s ease;
}

.popover-sv-area {
    flex: 1;
    height: 100%;
    position: relative;
    cursor: crosshair;
    background-color: #ff0000;
    overflow: hidden;
}

.popover-sv-white-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #ffffff, transparent);
    pointer-events: none;
}

.popover-sv-black-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent, #000000);
    pointer-events: none;
}

.popover-sv-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #ffffff;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.8), inset 0 0 2px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
    top: 50%;
    left: 50%;
}

/* Slider de Tono RGB (Hue Spectrum) */
.popover-hue-wrap {
    margin-top: 2px;
}

.hue-range-slider {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
    background: linear-gradient(to right, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.hue-range-slider::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.hue-range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

/* Campo HEX con label flotante */
.popover-hex-box {
    display: flex;
    align-items: center;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    padding: 6px 10px;
    position: relative;
    background: #ffffff;
    margin-top: 4px;
}

.popover-hex-lbl {
    position: absolute;
    top: -7px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 800;
    color: #71717a;
    background: #ffffff;
    padding: 0 6px;
    letter-spacing: 0.5px;
}

.popover-hex-box input {
    border: none;
    outline: none;
    width: 100%;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #18181b;
    background: transparent;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.btn-copy-hex {
    background: transparent;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-copy-hex:hover {
    color: #18181b;
    background: #f4f4f5;
}

/* Tarjetas de valores RGB, CMYK, HSV, HSL */
.popover-values-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.popover-val-card {
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    padding: 5px 3px;
    text-align: center;
    background: #fafafa;
}

.popover-val-lbl {
    display: block;
    font-size: 9px;
    font-weight: 800;
    color: #71717a;
    margin-bottom: 2px;
}

.popover-val-num {
    display: block;
    font-size: 9px;
    font-weight: 600;
    color: #27272a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Indicador de color en la columna ROW de la grilla */
.color-chip-row {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.cell-grid-row-id:hover .color-chip-row {
    transform: scale(1.3);
}

.cell-grid-row-id {
    cursor: pointer;
    user-select: none;
}

/* Resaltado de fila al hacer hover o foco (AMARILLO CÁLIDO E INTENSO) */
.grid-patron-row.is-glow-highlight {
    background-color: rgba(255, 230, 0, 0.28) !important;
    transition: background-color 0.15s ease;
}

/* Modo oscuro para selector de color y popover */
body.theme-dark .selector-color-patron-card,
body.dark .selector-color-patron-card {
    background: #1c1c24;
    border-color: #2b2b38;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .btn-aplicar-color-todo,
body.dark .btn-aplicar-color-todo {
    background: rgba(171, 119, 220, 0.22);
    border-color: rgba(171, 119, 220, 0.5);
    color: #e9d5ff;
}

body.theme-dark .btn-aplicar-color-todo:hover,
body.dark .btn-aplicar-color-todo:hover {
    background: #B5E86E;
    border-color: #9ed454;
    color: #1a3300;
}

body.theme-dark .btn-trigger-color-swatch,
body.dark .btn-trigger-color-swatch {
    border-color: #242432;
    box-shadow: 0 0 0 1.5px #3f3f50, 0 2px 6px rgba(0, 0, 0, 0.4);
}

body.theme-dark .swatch-color-btn,
body.dark .swatch-color-btn {
    border-color: #242432;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

body.theme-dark .swatch-color-btn.is-active,
body.dark .swatch-color-btn.is-active {
    box-shadow: 0 0 0 2px #AB77DC, 0 2px 8px rgba(171, 119, 220, 0.4);
}

body.theme-dark .color-chip-row,
body.dark .color-chip-row {
    border-color: rgba(255, 255, 255, 0.35);
}

body.theme-dark .grid-patron-row.is-glow-highlight,
body.dark .grid-patron-row.is-glow-highlight {
    background-color: rgba(255, 230, 0, 0.22) !important;
}

body.theme-dark .popover-color-picker,
body.dark .popover-color-picker {
    background: #1e1e28;
    border-color: #2f2f3d;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.theme-dark .popover-color-title,
body.dark .popover-color-title {
    color: #f4f4f7;
}

body.theme-dark .btn-close-popover,
body.dark .btn-close-popover {
    color: #a1a1aa;
}

body.theme-dark .btn-close-popover:hover,
body.dark .btn-close-popover:hover {
    background: #2a2a38;
    color: #f4f4f7;
}

body.theme-dark .popover-color-canvas-wrap,
body.dark .popover-color-canvas-wrap {
    border-color: #333342;
}

body.theme-dark .popover-hex-box,
body.dark .popover-hex-box {
    background: #181822;
    border-color: #333342;
}

body.theme-dark .popover-hex-lbl,
body.dark .popover-hex-lbl {
    background: #181822;
    color: #a1a1aa;
}

body.theme-dark .popover-hex-box input,
body.dark .popover-hex-box input {
    color: #f4f4f7;
}

body.theme-dark .btn-copy-hex,
body.dark .btn-copy-hex {
    color: #a1a1aa;
}

body.theme-dark .btn-copy-hex:hover,
body.dark .btn-copy-hex:hover {
    color: #f4f4f7;
    background: #2a2a38;
}

body.theme-dark .popover-val-card,
body.dark .popover-val-card {
    background: #181822;
    border-color: #333342;
}

body.theme-dark .popover-val-lbl,
body.dark .popover-val-lbl {
    color: #a1a1aa;
}

body.theme-dark .popover-val-num,
body.dark .popover-val-num {
    color: #f4f4f7;
}

body.theme-dark .popover-color-header,
body.dark .popover-color-header {
    border-bottom-color: #2b2b38;
}

body.theme-dark .popover-color-drag-title,
body.dark .popover-color-drag-title {
    color: #f4f4f7;
}

/* ============================================================================
   HERRAMIENTA MODO COSER / HILADO (LAYER SEWING TOOL)
   ============================================================================ */

.btn-pill-accent-sew {
    background: #f3e8ff;
    color: #6b21a8;
    border: 1px solid #d8b4fe;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-pill-accent-sew:hover {
    background: #B5E86E;
    color: #18181b;
    border-color: #a3e635;
}

.btn-pill-accent-sew.is-active {
    background: #B5E86E !important;
    color: #18181b !important;
    border-color: #84cc16 !important;
    box-shadow: 0 0 0 2px rgba(181, 232, 110, 0.5);
    animation: pulsoColocacion 1.5s infinite;
}

body.theme-dark .btn-pill-accent-sew,
body.dark .btn-pill-accent-sew {
    background: #2a1b3d;
    color: #e9d5ff;
    border-color: #4a2870;
}

body.theme-dark .btn-pill-accent-sew:hover,
body.dark .btn-pill-accent-sew:hover {
    background: #B5E86E;
    color: #18181b;
    border-color: #a3e635;
}

/* ==========================================================================
   BANNER MODO COSER (TOOLBAR FIJO COMPACTO ESTILO FIGMA)
   ========================================================================== */
.banner-modo-coser {
    position: fixed !important;
    bottom: 24px !important;
    top: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 960 !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    min-width: max-content !important;
    max-width: calc(100vw - 32px) !important;
    height: 38px !important;
    min-height: 38px !important;
    box-sizing: border-box !important;
    background: rgba(255, 255, 255, 0.98);
    color: #18181b;
    padding: 0 10px 0 12px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07), 0 2px 6px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid #e4e4e7;
    user-select: none;
    pointer-events: auto;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.banner-coser-status-group {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
}

.banner-coser-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 9999px;
    background: rgba(211, 175, 245, 0.35);
    color: #7e22ce;
    flex-shrink: 0;
}

.banner-coser-texto {
    font-size: 11px;
    font-weight: 600;
    color: #27272a;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.banner-coser-texto b {
    color: #18181b;
    font-weight: 700;
    background: #f4f4f7;
    padding: 1px 5px;
    border-radius: 4px;
}

.banner-coser-texto svg {
    color: #7e22ce;
    vertical-align: -2px;
}

.banner-coser-divider {
    width: 1px;
    height: 16px;
    background: #e4e4e7;
    flex-shrink: 0;
    margin: 0 2px;
}

.control-grosor-hilo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px 8px;
    height: 26px;
    box-sizing: border-box;
    border-radius: 9999px;
    font-size: 10px;
    flex-shrink: 0;
}

.control-grosor-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    color: #475569;
}

.control-grosor-label svg {
    color: #7e22ce;
}

.slider-grosor-hilo {
    width: 55px;
    height: 3px;
    accent-color: #AB77DC;
    cursor: pointer;
    vertical-align: middle;
}

.val-grosor-badge {
    font-size: 10px;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: #6b21a8;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    padding: 1px 5px;
    border-radius: 9999px;
    min-width: 24px;
    text-align: center;
}

.banner-coser-actions {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.btn-cortar-hebra {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #B5E86E;
    border: 1px solid #9edb4f;
    color: #1a3809;
    height: 26px;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(181, 232, 110, 0.3);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-cortar-hebra:hover {
    background: #c3f77b;
    color: #0f2405;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(181, 232, 110, 0.4);
}

.btn-salir-coser {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f4f4f7;
    border: 1px solid #d4d4d8;
    color: #52525b;
    height: 26px;
    padding: 0 10px;
    box-sizing: border-box;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-salir-coser:hover {
    background: #e4e4e7;
    color: #18181b;
    transform: translateY(-1px);
}

/* Modo oscuro para Dock de Modo Coser */
body.theme-dark .banner-modo-coser,
body.dark .banner-modo-coser {
    background: rgba(26, 26, 35, 0.96) !important;
    border-color: #353545 !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5) !important;
    color: #f4f4f7 !important;
}

body.theme-dark .banner-coser-badge-icon,
body.dark .banner-coser-badge-icon {
    background: rgba(171, 119, 220, 0.25);
    color: #d8b4fe;
}

body.theme-dark .banner-coser-texto,
body.dark .banner-coser-texto {
    color: #f4f4f7;
}

body.theme-dark .banner-coser-texto b,
body.dark .banner-coser-texto b {
    background: #353545;
    color: #ffffff;
}

body.theme-dark .banner-coser-divider,
body.dark .banner-coser-divider {
    background: #353545;
}

body.theme-dark .control-grosor-hilo,
body.dark .control-grosor-hilo {
    background: #20202b;
    border-color: #353545;
    color: #e4e4e7;
}

body.theme-dark .control-grosor-label,
body.dark .control-grosor-label {
    color: #a1a1aa;
}

body.theme-dark .val-grosor-badge,
body.dark .val-grosor-badge {
    background: #2e1065;
    border-color: #581c87;
    color: #e9d5ff;
}

body.theme-dark .btn-salir-coser,
body.dark .btn-salir-coser {
    background: #272733;
    border-color: #3f3f50;
    color: #d4d4d8;
}

body.theme-dark .btn-salir-coser:hover,
body.dark .btn-salir-coser:hover {
    background: #353545;
    color: #ffffff;
}

/* ==========================================================================
   SISTEMA DE TOASTS / NOTIFICACIONES CROAKET (DISEÑO CLARO Y LIMPIO)
   ========================================================================== */
.croaket-toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(16px) scale(0.96);
    opacity: 0;
    z-index: 2500;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 6px 14px 6px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #e4e4e7;
    color: #18181b;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                bottom 0.2s ease;
}

.croaket-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.croaket-toast-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 9999px;
    font-size: 11px;
    flex-shrink: 0;
}

/* Variantes según tipo */
.croaket-toast.toast-exito,
.croaket-toast.toast-success {
    background: rgba(255, 255, 255, 0.98);
    border-color: #bbf7d0;
    color: #14532d;
}
.croaket-toast.toast-exito .croaket-toast-icon-badge,
.croaket-toast.toast-success .croaket-toast-icon-badge {
    background: #dcfce7;
    border: 1px solid #86efac;
    color: #15803d;
}

.croaket-toast.toast-info {
    background: rgba(255, 255, 255, 0.98);
    border-color: #e9d5ff;
    color: #3b0764;
}
.croaket-toast.toast-info .croaket-toast-icon-badge {
    background: #f3e8ff;
    border: 1px solid #d8b4fe;
    color: #7e22ce;
}

.croaket-toast.toast-warning {
    background: rgba(255, 255, 255, 0.98);
    border-color: #fde68a;
    color: #78350f;
}
.croaket-toast.toast-warning .croaket-toast-icon-badge {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #b45309;
}

.croaket-toast.toast-error {
    background: rgba(255, 255, 255, 0.98);
    border-color: #fecaca;
    color: #991b1b;
}
.croaket-toast.toast-error .croaket-toast-icon-badge {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #dc2626;
}

/* Modo oscuro para Toasts */
body.theme-dark .croaket-toast,
body.dark .croaket-toast {
    background: rgba(26, 26, 35, 0.96);
    border-color: #353545;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
    color: #f4f4f7;
}

body.theme-dark .croaket-toast.toast-exito,
body.dark .croaket-toast.toast-exito {
    border-color: #166534;
    color: #bbf7d0;
}

body.theme-dark .croaket-toast.toast-info,
body.dark .croaket-toast.toast-info {
    border-color: #581c87;
    color: #e9d5ff;
}

body.theme-dark .croaket-toast.toast-warning,
body.dark .croaket-toast.toast-warning {
    border-color: #854d0e;
    color: #fde68a;
}

body.theme-dark .croaket-toast.toast-error,
body.dark .croaket-toast.toast-error {
    border-color: #991b1b;
    color: #fecaca;
}

/* Callout técnico de costuras en el patrón */
.seccion-costuras-patron {
    margin-top: 14px;
    padding: 10px 12px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 8px;
}

body.theme-dark .seccion-costuras-patron,
body.dark .seccion-costuras-patron {
    background: #1f1a29;
    border-color: #3b2852;
}




/* ==========================================================================
   MEJORAS GLOBALES UI/UX: PANEL CONTROLES 3D LIBRE & COLOR DE HILO FIGMA
   ========================================================================== */

/* 1. Panel de Controles 3D: Posición fija sin límites, tamaño inicial perfecto y libre movimiento */
#panelControles3D {
    position: fixed;
    top: 136px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 950 !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    min-width: max-content !important;
    max-width: none !important;
    padding: 7px 18px !important;
    border-radius: 9999px !important;
    display: flex;
    align-items: center !important;
    gap: 12px !important;
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid #d8d8e0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
    user-select: none;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

#panelControles3D.is-dragging {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22) !important;
    opacity: 0.96;
}

#panelControles3D select,
#panelControles3D button,
#panelControles3D input {
    pointer-events: auto !important;
    user-select: auto;
}

#wrapperVista3D.vista-oculta #panelControles3D {
    display: none !important;
}

#dragHandle3D {
    cursor: grab;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border-radius: 6px;
    color: #71717a;
    transition: background 0.15s ease, color 0.15s ease;
}

#dragHandle3D:hover {
    background: rgba(0, 0, 0, 0.07);
    color: #18181b;
}

#panelControles3D.is-dragging #dragHandle3D {
    cursor: grabbing;
}

body.theme-dark #panelControles3D,
body.dark #panelControles3D {
    background: rgba(26, 26, 35, 0.96) !important;
    border-color: #353545 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
    color: #f4f4f7 !important;
}

body.theme-dark #dragHandle3D:hover,
body.dark #dragHandle3D:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Acciones en la cabecera del selector de color */
.selector-color-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-restablecer-extras {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #f4f4f7;
    border: 1px solid #d4d4d8;
    color: #52525b;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.btn-restablecer-extras:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: translateY(-1px);
}

body.theme-dark .btn-restablecer-extras,
body.dark .btn-restablecer-extras {
    background: #272733;
    border-color: #3f3f50;
    color: #d4d4d8;
}

body.theme-dark .btn-restablecer-extras:hover,
body.dark .btn-restablecer-extras:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #fca5a5;
}

/* 2. Rediseño del Panel Color de Hilo estilo Inspector / Figma */
.color-hilo-figma-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #fbfafc;
    border: 1px solid #e4e2e8;
    border-radius: 12px;
    padding: 6px 10px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.color-hilo-figma-row:hover {
    border-color: #c69df0;
    background: #ffffff;
}

.btn-color-hilo-swatch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 2px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}

.btn-color-hilo-swatch:hover {
    opacity: 0.85;
}

.color-preview-rect {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: inline-block;
    flex-shrink: 0;
}

.color-hex-text {
    font-size: 12px;
    font-weight: 700;
    color: #18181b;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    letter-spacing: 0.5px;
}

.color-opacity-pill {
    font-size: 10px;
    font-weight: 600;
    color: #71717a;
    background: #f4f4f5;
    padding: 2px 5px;
    border-radius: 4px;
}

.color-hilo-actions-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.input-hex-directo {
    width: 72px;
    font-size: 11px;
    font-family: 'SF Mono', 'Fira Code', Menlo, monospace;
    font-weight: 600;
    color: #18181b;
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 6px;
    padding: 4px 6px;
    text-align: center;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.input-hex-directo:focus {
    border-color: #AB77DC;
    box-shadow: 0 0 0 2px rgba(171, 119, 220, 0.2);
}

.btn-icon-palette-trigger {
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #52525b;
    transition: all 0.15s ease;
}

.btn-icon-palette-trigger:hover {
    background: #D3AFF5;
    border-color: #c69df0;
    color: #18181b;
}

/* Modo Oscuro para Color de Hilo */
body.theme-dark .color-hilo-figma-row,
body.dark .color-hilo-figma-row {
    background: #1e1e27 !important;
    border-color: #353545 !important;
}

body.theme-dark .color-hex-text,
body.dark .color-hex-text {
    color: #f4f4f7 !important;
}

body.theme-dark .color-opacity-pill,
body.dark .color-opacity-pill {
    background: #272736 !important;
    color: #a1a1aa !important;
}

body.theme-dark .input-hex-directo,
body.dark .input-hex-directo {
    background: #272736 !important;
    border-color: #3f3f50 !important;
    color: #f4f4f7 !important;
}

body.theme-dark .btn-icon-palette-trigger,
body.dark .btn-icon-palette-trigger {
    background: #272736 !important;
    border-color: #3f3f50 !important;
    color: #d4d4d8 !important;
}

/* ==========================================================================
   VISUALIZADOR DE LA PIEZA ACTUAL (HEADER & VIEWPORT CHIP)
   ========================================================================== */
.badge-pieza-activa-top {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 13px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 500;
    color: #4b5563;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(171, 119, 220, 0.08);
    user-select: none;
}
.badge-pieza-activa-top:hover {
    border-color: #d8b4fe;
    background: #f5ebff;
}
.badge-pieza-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #D3AFF5;
    box-shadow: 0 0 0 2px rgba(211, 175, 245, 0.4);
    flex-shrink: 0;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.badge-pieza-label {
    color: #6b7280;
    font-size: 10px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 600;
}
.badge-pieza-nombre {
    color: #6b21a8;
    font-weight: 700;
    font-size: 12px;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chip HUD Flotante en el Viewport 3D */
.chip-pieza-activa-visor {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 90;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 9999px;
    font-size: 11px;
    color: #374151;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.03);
    pointer-events: none;
    user-select: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #D3AFF5;
    box-shadow: 0 0 0 2px rgba(211, 175, 245, 0.45);
    flex-shrink: 0;
    transition: background-color 0.2s ease;
}
.chip-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 500;
}
.chip-nombre {
    font-size: 11.5px;
    color: #1e293b;
    font-weight: 700;
}

/* --- MODO OSCURO PARA VISUALIZADOR DE PIEZA ACTIVA --- */
body.theme-dark .badge-pieza-activa-top,
body.dark .badge-pieza-activa-top {
    background: #242031 !important;
    border-color: #403653 !important;
    color: #e2e8f0 !important;
}
body.theme-dark .badge-pieza-label,
body.dark .badge-pieza-label {
    color: #a78bfa !important;
}
body.theme-dark .badge-pieza-nombre,
body.dark .badge-pieza-nombre {
    color: #f3e8ff !important;
}

body.theme-dark .chip-pieza-activa-visor,
body.dark .chip-pieza-activa-visor {
    background: rgba(26, 26, 35, 0.92) !important;
    border-color: rgba(60, 60, 75, 0.9) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}
body.theme-dark .chip-label,
body.dark .chip-label {
    color: #94a3b8 !important;
}
body.theme-dark .chip-nombre,
body.dark .chip-nombre {
    color: #f8fafc !important;
}

