/* =====================================================
   1. VARIABLES DE DISEÑO & BASE GENERAL (TIENDA MITATA)
   ===================================================== */
:root {
    /* PALETA CORPORATIVA OFICIAL (#ba93a7) */
    --brand-pink: #ba93a7;
    --brand-pink-hover: #9c7389;
    --brand-pink-dark: #7a4f66;
    --brand-pink-soft: #f7f1f4;
    --brand-pink-glow: rgba(186, 147, 167, 0.28);
    --accent: #b4536e;

    /* BASE NEUTRAL & CONTRASTES */
    --primary: #18181b;
    --primary-hover: #27272a;
    --bg: #fcfafb;
    --surface: #ffffff;
    --surface-subtle: #f8f3f6;
    --text-main: #1c1917;
    --text-muted: #78716c;
    --border-subtle: #f0e6ec;
    --border-strong: #dfcbd7;

    /* GEOMETRÍA & SOMBRAS */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    --shadow-subtle: 0 2px 10px rgba(186, 147, 167, 0.08);
    --shadow-card: 0 8px 24px rgba(186, 147, 167, 0.12);
    --shadow-modal: 0 16px 48px rgba(28, 25, 23, 0.22);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    letter-spacing: -0.01em;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button,
input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

.message {
    min-height: 20px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-muted);
}

main {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 20px 40px;
    flex: 1;
}


/* =====================================================
   2. FORMULARIOS BASE & BOTONES
   ===================================================== */
label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-main);
    outline: none;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 3px var(--brand-pink-glow);
}

textarea {
    resize: vertical;
}

button[type="submit"] {
    width: 100%;
    margin-top: 20px;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-pink-hover) 100%);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: 0 4px 16px var(--brand-pink-glow);
    transition: transform 0.15s ease, filter 0.15s ease;
}

button[type="submit"]:hover {
    filter: brightness(0.95);
}

button[type="submit"]:active {
    transform: scale(0.98);
}

.secondary-button {
    padding: 9px 16px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--surface);
    color: var(--text-main);
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s ease;
}

.secondary-button:hover {
    background: var(--surface-subtle);
    border-color: var(--brand-pink);
    color: var(--brand-pink-dark);
}

.secondary-button:active {
    transform: scale(0.96);
}

.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--surface);
    color: var(--brand-pink-dark);
    box-shadow: var(--shadow-subtle);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
    background: var(--brand-pink-soft);
    border-color: var(--border-strong);
}

.icon-button:active {
    transform: scale(0.92);
}

.cart-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--brand-pink-dark);
    color: white;
    font-size: 10px;
    font-weight: 800;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface);
    box-shadow: 0 2px 6px var(--brand-pink-glow);
}

.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.option-button {
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-main);
    border-radius: var(--radius-full);
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    transition: all 0.2s var(--ease-out);
}

.option-button:hover {
    background: var(--surface-subtle);
    border-color: var(--brand-pink);
}

.option-button.selected {
    background: var(--brand-pink);
    color: white;
    border-color: var(--brand-pink);
    box-shadow: 0 3px 10px var(--brand-pink-glow);
}

.quick-price-btn {
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
}


/* =====================================================
   3. LOGIN & HEADER
   ===================================================== */
.login-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, var(--bg) 0%, var(--surface-subtle) 100%);
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    padding: 36px 30px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    text-align: center;
}

.login-logo-container {
    margin-bottom: 16px;
}

.login-logo {
    height: 44px;
    max-width: 180px;
    object-fit: contain;
}

.login-box h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.login-box p {
    color: var(--text-muted);
    font-size: 13.5px;
    margin-bottom: 22px;
}

.login-box form {
    text-align: left;
}

.app-header {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 120;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

.header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.status-pill.online {
    background: #e7f6ea;
    color: #1b632e;
}

.status-pill.offline {
    background: #fff3d6;
    color: #8a6410;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.count-pill {
    background: var(--surface-subtle);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
}

.mode-pill.mode-tpv {
    background: var(--brand-pink-soft);
    color: var(--brand-pink-dark);
}

.mode-pill.mode-gestor {
    background: #eff6ff;
    color: #1e40af;
}

.header-logo {
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-logo {
    height: 34px;
    max-width: 160px;
    object-fit: contain;
    display: block;
}

.inventory-switch {
    display: inline-flex;
    background: var(--surface-subtle);
    padding: 3px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.switch-btn {
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    transition: all 0.2s var(--ease-out);
}

.switch-btn.active {
    background: var(--brand-pink);
    color: white;
    box-shadow: 0 2px 8px var(--brand-pink-glow);
}

.labels-mode-banner {
    background: linear-gradient(90deg, var(--brand-pink) 0%, #a47b91 100%);
    color: white;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    box-shadow: 0 4px 14px var(--brand-pink-glow);
}

.labels-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
}


/* =====================================================
   4. PANEL DE CONTROL DEL GESTOR
   ===================================================== */
.manager-dashboard-view {
    padding: 24px 20px;
    max-width: 1280px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
}

.dash-top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 14px;
    flex-wrap: wrap;
    gap: 12px;
}

.dash-master-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.col-span-1 { grid-column: span 1; }
.col-span-2 { grid-column: span 2; }
.col-span-5 { grid-column: 1 / -1; }

.dash-quick-btn {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 18px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.2s var(--ease-out), box-shadow 0.2s, border-color 0.2s;
}

.dash-quick-btn:hover {
    transform: translateY(-2px);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
}

.dash-quick-btn:active {
    transform: scale(0.97);
}

.dash-quick-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--brand-pink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-pink-dark);
}

.dash-quick-btn span {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.manager-card {
    background: var(--surface);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.manager-card-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.manager-card-title-bar h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.manager-card-title-bar span {
    font-size: 11px;
    color: var(--text-muted);
}

.dash-card-highlight {
    background: var(--surface-subtle);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    margin-bottom: 12px;
}

.danger-zone-card {
    background: #fff8f8;
    border: 1.5px dashed #f8b4b4;
}

.bulk-price-section {
    background: var(--surface);
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-subtle);
    margin-bottom: 20px;
}

.bulk-grid-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
}

.checkbox-label input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--brand-pink);
    cursor: pointer;
}

.danger-button {
    background: #b00020 !important;
    color: white !important;
    border-radius: var(--radius-sm);
    font-weight: 700;
    transition: all 0.15s ease;
}

.danger-button:hover {
    background: #8b0019 !important;
}

.danger-button:active {
    transform: scale(0.97);
}

.danger-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.wipe-warning-box {
    background: #fde8e8;
    border: 1px solid #f8b4b4;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 13px;
    color: #9b1c1c;
    line-height: 1.5;
}

.wipe-warning-box ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
}


/* =====================================================
   5. BOTONES FLOTANTES (FAB)
   ===================================================== */
.fab-filters-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-pink);
    color: white;
    border: none;
    box-shadow: 0 8px 24px var(--brand-pink-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out), background 0.2s;
}

.fab-options-button {
    position: fixed;
    bottom: 92px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out), background 0.2s;
}

.fab-filters-button:hover,
.fab-options-button:hover {
    transform: scale(1.06);
}

.fab-filters-button:active,
.fab-options-button:active {
    transform: scale(0.94);
}

.fab-indicator-dot {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid white;
}

.filters-modal-content {
    max-width: 500px;
}

.filters-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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


/* =====================================================
   6. GRID DE PRODUCTOS & CARDS (ESTILO TIENDA ONLINE)
   ===================================================== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.item-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-subtle);
    cursor: pointer;
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out), border-color 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: var(--border-strong);
}

.item-card:active {
    transform: scale(0.98);
}

.item-card.label-selected-card {
    border: 2px solid var(--brand-pink-dark);
    box-shadow: 0 4px 16px var(--brand-pink-glow);
}

.item-card-image {
    width: 100%;
    aspect-ratio: 1 / 1.15;
    background: #f4ecf0;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s var(--ease-out);
}

.item-card:hover .item-card-image img {
    transform: scale(1.04);
}

.card-photos-count-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(28, 25, 27, 0.75);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
}

.no-image {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
}

.item-card-content {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    justify-content: space-between;
}

.item-selection {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.item-card h3 {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.sale-badge {
    background: var(--brand-pink-dark);
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.stagnant-badge {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
}

.item-card-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.old-price {
    text-decoration: line-through;
    color: #a8a29e;
    font-size: 0.82rem;
    font-weight: 500;
}

.sale-price {
    color: var(--brand-pink-dark);
}

.item-card-size-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.size-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-xs);
}

.size-pill.size-available {
    background: var(--surface-subtle);
    color: var(--brand-pink-dark);
    border: 1px solid var(--border-subtle);
}

.size-pill.size-out {
    background: #fdf2f2;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
    text-decoration: line-through;
    opacity: 0.7;
}

.card-label-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed var(--border-subtle);
}

.card-counter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.card-counter-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    border-radius: var(--radius-xs);
    font-weight: bold;
    font-size: 14px;
    transition: background 0.15s ease;
}

.card-counter-btn:hover {
    background: var(--surface-subtle);
}

.card-counter-display {
    font-size: 14px;
    font-weight: 800;
    min-width: 24px;
    text-align: center;
}

.card-quick-stock-btn {
    font-size: 11px;
    padding: 3px 8px;
    background: var(--surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-weight: 600;
}


/* =====================================================
   7. DETALLE DE PRODUCTO (UNA SOLA LÍNEA COMPACTA)
   ===================================================== */
.detail-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) 1fr;
    gap: 24px;
    margin-bottom: 20px;
}

.gallery-compact-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-photo-carousel-main {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1.15;
    border-radius: var(--radius-md);
    background: #f4ecf0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.detail-photo-carousel-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.15s ease;
}

.carousel-nav-btn:hover {
    background: white;
}

.carousel-nav-btn.prev { left: 8px; }
.carousel-nav-btn.next { right: 8px; }

.detail-thumbnails-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.detail-thumb-img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: var(--radius-xs);
    border: 2px solid transparent;
    cursor: pointer;
    background: #f4ecf0;
    flex-shrink: 0;
    transition: all 0.2s var(--ease-out);
}

.detail-thumb-img:hover {
    transform: scale(1.05);
}

.detail-thumb-img.active {
    border-color: var(--brand-pink);
}

.detail-info-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.detail-header h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.detail-colors {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.detail-total {
    display: flex;
    flex-direction: column;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
}

.detail-total strong {
    font-size: 24px;
    font-weight: 800;
    color: var(--brand-pink-dark);
}

.detail-total span {
    color: var(--text-muted);
    font-size: 12px;
}

.detail-location {
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
}

.detail-location-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.detail-location-header h4 {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
}

.detail-location-price {
    font-weight: 800;
    font-size: 14px;
    color: var(--brand-pink-dark);
}

/* FILA DE STOCK EN UNA SOLA LÍNEA */
.detail-stock-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12.5px;
    flex-wrap: nowrap !important;
}

.detail-stock-row:last-child {
    border-bottom: none;
}

.detail-size {
    font-weight: 800;
    color: var(--text-main);
    min-width: 44px;
    flex-shrink: 0;
}

.user-stock-status-tpv {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.user-status-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

/* Selector de estado compacto */
.user-status-select {
    padding: 5px 8px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: var(--radius-xs);
    border: 1.5px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-main);
    max-width: 118px;
    flex-shrink: 1;
    height: 32px;
}

.user-customer-input {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #f6c042;
    border-radius: var(--radius-xs);
    background: #fffef7;
    max-width: 120px;
    height: 32px;
}

.user-save-status-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xs);
    background: var(--surface);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.user-save-status-btn:hover {
    background: var(--brand-pink);
    color: white;
    border-color: var(--brand-pink);
}

.user-save-status-btn:active {
    transform: scale(0.94);
}

.sell-unit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius-xs);
    background: #1b632e;
    color: white;
    font-weight: 700;
    font-size: 11.5px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(27, 99, 46, 0.2);
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.sell-unit-button:hover {
    background: #144d24;
}

.sell-unit-button:active {
    transform: scale(0.96);
}

.detail-notes {
    margin-top: 15px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
}

.detail-notes h3 {
    margin: 0 0 6px 0;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.detail-notes p {
    white-space: pre-wrap;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
}


/* =====================================================
   8. PREVIEWS DE FOTOS EN EDITOR
   ===================================================== */
.editor-photos-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.editor-preview-thumb-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--border-strong);
    background: #f4ecf0;
}

.editor-preview-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.editor-preview-thumb-wrap.new-upload {
    border: 2px dashed var(--brand-pink-dark);
}

.remove-photo-thumb-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(28, 25, 27, 0.8);
    color: white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}


/* =====================================================
   9. MODALES GENERALES (CABECERA FIJA Y SCROLL INTERNO)
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(28, 25, 27, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#delete-item-modal { z-index: 600 !important; }
#online-order-modal { z-index: 650 !important; }

/* Contenedor modal con límite de pantalla estricto */
.modal-content {
    width: 100%;
    max-width: 720px;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-modal);
    border: 1px solid var(--border-subtle);
    position: relative;
}

/* Cabecera pegajosa: NUNCA se oculta el botón [X] */
.modal-header {
    position: sticky;
    top: -24px;
    margin: -24px -24px 16px -24px;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 20;
}

.modal-header h2 {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.close-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
}

.close-button:hover {
    background: var(--brand-pink-soft);
}

.close-button:active {
    transform: scale(0.92);
}

.help-text {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 16px;
}

/* Modales de Ajustes */
.settings-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 10px;
    margin-bottom: 16px;
}

.settings-tab-btn {
    padding: 7px 16px;
    border-radius: var(--radius-full);
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s var(--ease-out);
}

.settings-tab-btn.active {
    background: var(--brand-pink);
    color: white;
    border-color: var(--brand-pink);
    box-shadow: 0 2px 8px var(--brand-pink-glow);
}

.settings-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    min-height: 44px;
}

.settings-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}

.settings-tag-remove {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
}

/* Carrito y TPV */
.cart-modal-content {
    max-width: 520px;
}

.cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    margin: 12px 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px;
    background: var(--surface-subtle);
}

.cart-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-subtle);
}

.cart-summary {
    background: var(--surface-subtle);
    padding: 14px;
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 14px;
    border: 1px solid var(--border-subtle);
}

.cart-summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    color: var(--text-muted);
}

.cart-total-row {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
    border-top: 1px dashed var(--border-strong);
    padding-top: 8px;
    margin-top: 4px;
}

.cart-total-row strong:last-child {
    color: var(--brand-pink-dark);
}

.cart-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.tpv-btn {
    padding: 11px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 700;
    text-align: center;
    transition: all 0.15s ease;
}

.tpv-btn:active {
    transform: scale(0.98);
}

.tpv-btn-print {
    background: var(--primary);
    color: white;
}

.tpv-btn-gift {
    background: var(--surface-subtle);
    border: 1px solid var(--border-strong);
    color: var(--text-main);
}

.tpv-btn-checkout {
    background: linear-gradient(135deg, var(--brand-pink) 0%, var(--brand-pink-hover) 100%);
    color: white;
    box-shadow: 0 4px 14px var(--brand-pink-glow);
}

.labels-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}


/* =====================================================
   10. HISTORIALES (TICKETS, PEDIDOS Y TRASLADOS CON RELIEVE)
   ===================================================== */
.recent-tickets-list,
.notifications-list,
.transfers-history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
}

/* Tarjeta individual de Ticket */
.recent-ticket-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-subtle);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.recent-ticket-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card);
    transform: translateY(-1px);
}

.recent-ticket-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.recent-ticket-title {
    font-weight: 800;
    font-size: 13.5px;
    color: var(--text-main);
}

.recent-ticket-meta {
    font-size: 11.5px;
    color: var(--text-muted);
}

.recent-ticket-price {
    font-weight: 800;
    font-size: 15px;
    color: var(--brand-pink-dark);
}

.reprint-ticket-btn {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    background: var(--surface-subtle);
    color: var(--brand-pink-dark);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    transition: all 0.15s ease;
}

.reprint-ticket-btn:hover {
    background: var(--brand-pink);
    color: white;
    border-color: var(--brand-pink);
}

/* Tarjeta individual de Pedido Web */
.order-notification-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1.5px solid var(--border-subtle);
    border-left: 4px solid var(--brand-pink);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-subtle);
    cursor: pointer;
    transition: all 0.15s ease;
}

.order-notification-card:hover {
    background: var(--surface-subtle);
    border-color: var(--brand-pink-dark);
    box-shadow: var(--shadow-card);
}

.order-code-badge {
    font-weight: 800;
    font-size: 13px;
    color: var(--brand-pink-dark);
    font-family: monospace;
}

.order-deadline-badge {
    font-size: 10.5px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--brand-pink-soft);
    color: var(--brand-pink-dark);
}

/* Tarjeta individual de Traslados */
.transfer-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xs);
    font-size: 12px;
    box-shadow: var(--shadow-subtle);
}

.transfers-balance-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.transfer-card {
    background: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
}

.transfer-card-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.transfer-card-amount {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-main);
}

.net-balance-card {
    border: 2px solid var(--brand-pink-dark);
    background: var(--brand-pink-soft);
}


/* =====================================================
   11. IMPRESIÓN TÉRMICA (BIXOLON SRP-330II & NIIMBOT)
   ===================================================== */
.thermal-receipt,
.thermal-labels-sheet {
    display: none;
}

@media print {
    @page {
        size: 80mm auto;
        margin: 0;
    }

    html, body {
        width: 80mm !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    #app-section,
    #login-section,
    .modal,
    .fab-filters-button,
    .fab-options-button {
        display: none !important;
    }

    .thermal-receipt {
        display: block !important;
        position: static !important;
        width: 72mm !important;
        margin: 0 auto !important;
        padding: 4mm 2mm 8mm 2mm !important;
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        line-height: 1.2;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .receipt-header {
        text-align: center;
        margin-bottom: 8px;
        border-bottom: 1px dashed #000;
        padding-bottom: 6px;
    }

    .receipt-header h1 {
        font-size: 15px;
        margin: 0 0 3px 0;
        font-weight: bold;
    }

    .receipt-header p {
        margin: 1px 0;
        font-size: 11px;
    }

    .receipt-meta {
        margin-bottom: 6px;
        font-size: 11px;
        border-bottom: 1px dashed #000;
        padding-bottom: 4px;
    }

    .receipt-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 8px;
        font-size: 11px;
    }

    .receipt-table th {
        text-align: left;
        border-bottom: 1px solid #000;
        padding-bottom: 3px;
    }

    .receipt-table td {
        padding: 3px 0;
    }

    .receipt-totals {
        border-top: 1px dashed #000;
        padding-top: 5px;
        margin-bottom: 8px;
    }

    .receipt-row {
        display: flex;
        justify-content: space-between;
        margin: 1px 0;
    }

    .receipt-total-big {
        font-size: 14px;
        font-weight: bold;
        border-top: 1px solid #000;
        padding-top: 3px;
        margin-top: 3px;
    }

    .receipt-footer {
        text-align: center;
        border-top: 1px dashed #000;
        padding-top: 6px;
        font-size: 10px;
    }

    .thermal-labels-sheet {
        display: block !important;
        position: static !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    .single-thermal-label {
        width: 48mm;
        height: 28mm;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        margin: 0 auto;
        padding: 1.5mm;
        page-break-after: always;
        break-after: page;
    }
}


/* =====================================================
   12. MEDIA QUERIES (RESPONSIVE)
   ===================================================== */
@media (max-width: 900px) {
    .dash-master-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dash-master-grid .col-span-2,
    .dash-master-grid .col-span-1 {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .app-header {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding: 10px 14px;
    }

    .header-center { order: 1; }
    .header-right-actions {
        order: 2;
        width: 100%;
        justify-content: center;
    }

    main {
        padding: 12px 14px;
    }

    .items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .dash-master-grid {
        grid-template-columns: 1fr;
    }

    .dash-master-grid .col-span-2,
    .dash-master-grid .col-span-1 {
        grid-column: span 1;
    }

    .detail-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modal {
        padding: 8px;
        align-items: flex-end; /* Efecto bottom-sheet natural en móviles */
    }

    .modal-content {
        max-height: 90dvh;
        padding: 18px 16px;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-header {
        top: -18px;
        margin: -18px -16px 14px -16px;
        padding: 14px 16px;
    }

    .filters-grid,
    .cart-actions-grid {
        grid-template-columns: 1fr;
    }

    .fab-filters-button {
        bottom: 18px;
        right: 18px;
        width: 52px;
        height: 52px;
    }

    .fab-options-button {
        bottom: 80px;
        right: 18px;
        width: 52px;
        height: 52px;
    }
}
