/* ==========================================================================
   DESIGN SYSTEM & VARIABLES (LIGHT / PROFESSIONAL)
   ========================================================================== */
:root {
    /* Surfaces */
    --bg-app: #F5F6F8;
    --bg-surface: #FFFFFF;
    --bg-surface-hover: #F9FAFB;
    --bg-surface-sunken: #F2F4F7;
    --border-glass: #E4E7EC;        /* kept name for compatibility, now a solid light border */
    --border-strong: #D0D5DD;

    /* Text */
    --text-primary: #101828;
    --text-muted: #667085;
    --text-faint: #98A2B3;

    /* Brand / semantic colors */
    --color-primary: #4F46E5;        /* Indigo */
    --color-primary-hover: #4338CA;
    --color-primary-light: #EEF2FF;
    --color-primary-text-on-light: #4338CA;

    --color-success: #12B76A;        /* Green */
    --color-success-hover: #039855;
    --color-success-light: #ECFDF3;

    --color-danger: #F04438;         /* Red */
    --color-danger-hover: #D92D20;
    --color-danger-light: #FEF3F2;

    --color-warning: #F79009;        /* Amber */
    --color-warning-hover: #DC6803;
    --color-warning-light: #FFFAEB;

    --color-info: #0BA5EC;           /* Sky */
    --color-info-hover: #0086C9;
    --color-info-light: #F0F9FF;

    /* Shadows: soft, low-elevation for a light surface */
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, 0.12);

    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --transition-fast: 0.15s ease;
    --transition-smooth: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* No decorative glow blobs in the professional/light theme */
body::before, body::after {
    content: none;
}

/* ==========================================================================
   UTILITY STYLES
   ========================================================================== */
.glass {
    background: #dadcff;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
}

.hidden {
    display: none !important;
}

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

.flex-col-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 15px;
    padding: 40px;
}

.row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.col-4 { flex: 0 0 calc(33.333% - 10px); }
.col-6 { flex: 0 0 calc(50% - 7.5px); }

.badge-role {
    background: var(--color-primary-light);
    border: 1px solid #C7D2FE;
    color: var(--color-primary-text-on-light);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.caja-active-tag {
    background: var(--color-success-light);
    border: 1px solid #A6F4C5;
    color: #027A48;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-top: 3px;
    display: inline-block;
}

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-primary { color: var(--color-primary); }
.text-large { font-size: 1.5rem !important; font-weight: 600 !important; }

.bg-primary { background: var(--color-primary-light); color: var(--color-primary-text-on-light); }
.bg-success { background: var(--color-success-light); color: #027A48; }
.bg-warning { background: var(--color-warning-light); color: #B54708; }
.bg-info { background: var(--color-info-light); color: #026AA2; }
.bg-danger { background: var(--color-danger-light); color: #B42318; }

.large-icon {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    color: var(--text-faint);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 550;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
    box-shadow: var(--shadow-sm);
}
.btn-success:hover {
    background-color: var(--color-success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-success-outline {
    background-color: #ecfdf3;
    border-color: #12b76a;
    color: #027a48;
    box-shadow: var(--shadow-sm);
}
.btn-success-outline:hover {
    background-color: #12b76a;
    border-color: #12b76a;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-surface);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-faint);
}

.btn-danger-outline {
    background-color: transparent;
    border-color: #FDA29B;
    color: var(--color-danger);
}
.btn-danger-outline:hover {
    background-color: var(--color-danger-light);
    border-color: var(--color-danger);
}

.btn-icon {
    padding: 8px;
    border-radius: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-surface-hover);
    border-color: var(--border-strong);
}
.btn-icon.edit:hover {
    color: var(--color-primary);
    border-color: #C7D2FE;
    background: var(--color-primary-light);
}
.btn-icon.delete:hover {
    color: var(--color-danger);
    border-color: #FDA29B;
    background: var(--color-danger-light);
}

.report-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.report-actions .btn {
    min-height: 40px;
    white-space: nowrap;
}

/* ==========================================================================
   INPUTS & FORMS
   ========================================================================== */
.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-group label i {
    width: 16px;
    height: 16px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-fast);
}

.form-control::placeholder {
    color: var(--text-faint);
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

select.form-control {
    cursor: pointer;
}

select.form-control option {
    background-color: #ffffff;
    color: var(--text-primary);
}

/* ==========================================================================
   LOGIN STYLE
   ========================================================================== */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background:
        radial-gradient(circle at 15% 10%, rgba(79, 70, 229, 0.06), transparent 45%),
        radial-gradient(circle at 85% 90%, rgba(18, 183, 106, 0.05), transparent 45%),
        var(--bg-app);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    text-align: center;
    animation: fadeIn 0.4s ease-out;
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg);
}

.login-logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.login-logo {
    height: 70px;
    width: auto;
    object-fit: contain;
}

.logo-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
}

.logo-icon {
    width: 32px;
    height: 32px;
    color: white;
}

.login-card h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-card select, .login-card input {
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 14px;
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.login-card select:focus, .login-card input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.error-msg {
    background: var(--color-danger-light);
    border: 1px solid #FECDCA;
    color: #B42318;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 15px;
}

/* ==========================================================================
   APP CONTAINER LAYOUT
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: #dadcff;
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 25px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-glass);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.logo-circle-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.sidebar-company-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.92rem;
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.menu-item i {
    width: 20px;
    height: 20px;
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-sunken);
}

.menu-item.active {
    color: var(--color-primary-text-on-light);
    background-color: var(--color-primary-light);
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 20px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-profile-widget {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-text-on-light);
}

.user-details {
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

/* MAIN CONTENT */
.main-content {
    flex-grow: 1;
    padding: 25px;
    overflow-y: auto;
    max-height: 100vh;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* ==========================================================================
   PANELS & GENERAL CONTAINER
   ========================================================================== */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 25px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-glass);
    margin-bottom: 20px;
}

.panel-header h2, .panel-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-filters {
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-wrapper {
    position: relative;
    max-width: 450px;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-wrapper input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
}

.search-wrapper input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.btn-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-faint);
    font-size: 1.2rem;
    cursor: pointer;
}
.btn-clear:hover {
    color: var(--text-primary);
}

.filter-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.filter-group input[type="checkbox"] {
    accent-color: var(--color-primary);
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   POS LAYOUT (CAJA)
   ========================================================================== */
.pos-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 80px);
}

.pos-products-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    flex: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    padding: 15px;
    overflow: hidden;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding-top: 10px;
    flex-grow: 1;
}

/* Product Card */
.product-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    position: relative;
    user-select: none;
}

.product-card:hover {
    background: var(--bg-surface-hover);
    border-color: #C7D2FE;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.product-card-image {
    width: 100%;
    height: 110px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--bg-surface-sunken);
    margin-bottom: 8px;
}

.product-card-fallback-image {
    width: 100%;
    height: 110px;
    border-radius: 6px;
    background: var(--bg-surface-sunken);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-faint);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.product-card-fallback-image i {
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
}

.product-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 5px;
    height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--text-primary);
}

.product-card-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-success);
    margin-top: auto;
}

.product-card-stock {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.product-card-stock.low {
    color: var(--color-danger);
    font-weight: 500;
}

.product-card-barcode {
    font-size: 0.65rem;
    color: var(--text-faint);
    font-family: monospace;
}

/* POS CART PANEL */
.pos-cart-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    width: 380px;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    padding: 15px;
    flex-shrink: 0;
}

.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 5px;
}

/* Cart Item */
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-glass);
}

.cart-item-details {
    flex-grow: 1;
    overflow: hidden;
}

.cart-item-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--color-success);
    font-weight: 500;
}

.cart-item-qty-controls {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-surface);
}

.btn-qty {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 24px;
    height: 24px;
    font-size: 0.85rem;
    cursor: pointer;
}
.btn-qty:hover {
    background: var(--bg-surface-sunken);
}

.qty-val {
    width: 26px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.cart-item-total {
    font-size: 0.9rem;
    font-weight: 600;
    width: 65px;
    text-align: right;
    color: var(--text-primary);
}

/* Cart Totals */
.cart-totals {
    border-top: 1px solid var(--border-glass);
    padding-top: 15px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.total-row.main-total {
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 700;
    margin: 10px 0;
}

.total-conversions {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.conversion-badge {
    flex: 1;
    background: var(--bg-surface-sunken);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
}

.currency-label {
    color: var(--text-muted);
    font-weight: 500;
}

.btn-checkout {
    height: 52px;
}

/* ==========================================================================
   TABLES
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.max-height-300 {
    max-height: 300px;
    overflow-y: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-glass);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.table th {
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    background: var(--bg-surface-sunken);
}

.table tbody tr:hover {
    background: var(--bg-surface-hover);
}

.table img.table-prod-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-surface-sunken);
}

.table-compact th, .table-compact td {
    padding: 8px 10px;
    font-size: 0.82rem;
}

.table-colored th {
    background: var(--color-primary-light);
    color: var(--color-primary-text-on-light);
    font-weight: 700;
    text-transform: none;
    letter-spacing: normal;
}
.table-colored tbody tr {
    transition: background 0.2s ease;
}
.table-colored tbody tr:nth-child(even) {
    background: var(--bg-surface-sunken);
}
.table-colored tbody tr:hover {
    background: var(--color-primary-light);
}

/* ==========================================================================
   DASHBOARD STATS
   ========================================================================== */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.kpi-icon-container {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon-container i {
    width: 24px;
    height: 24px;
}

.kpi-data span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kpi-data h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dashboard-charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.chart-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    flex: 1;
    border-radius: var(--radius-md);
    padding: 20px;
    height: 350px;
    display: flex;
    flex-direction: column;
}

.chart-header {
    margin-bottom: 15px;
}

.chart-header h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.chart-container canvas {
    flex-grow: 1;
    width: 100% !important;
    height: 100% !important;
}

.dashboard-bottom-row {
    display: flex;
    gap: 20px;
}

.width-50 {
    width: 50%;
}

.dashboard-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
    padding: 20px;
}

/* ==========================================================================
   SETTINGS LAYOUT
   ========================================================================== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 20px;
}

.logo-setting-container {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    background: var(--bg-surface-sunken);
    padding: 15px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
}

.logo-preview-box {
    width: 80px;
    height: 80px;
    border-radius: 6px;
    border: 1px dashed var(--border-strong);
    overflow: hidden;
    background: var(--bg-surface);
}

.logo-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-fallback-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-faint);
    font-size: 0.65rem;
}

.logo-fallback-box i {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.help-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(16, 24, 40, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    animation: zoomIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content.size-sm { width: 400px; }
.modal-content.size-md { width: 500px; }
.modal-content.size-lg { width: 750px; }

.styled-confirm-content {
    border: 1px solid #f7dcb3;
    background: linear-gradient(180deg, #fffdf9 0%, #fff9ef 100%);
}

#styled-confirm-modal .modal-header {
    background: rgba(247, 148, 9, 0.08);
}

#styled-confirm-modal .modal-header h3 {
    color: #7a4b00;
}

#styled-confirm-modal .modal-header h3 i {
    color: #f79009;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.close-modal {
    font-size: 1.5rem;
    color: var(--text-faint);
    cursor: pointer;
    line-height: 1;
}
.close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-body.scrollable-body {
    max-height: 60vh;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-glass);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-surface-sunken);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Product modal custom columns */
.product-modal-layout {
    display: flex;
    gap: 20px;
}

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

.prod-image-col {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.product-image-uploader {
    width: 100%;
    height: 180px;
    border-radius: var(--radius-sm);
    border: 2px dashed var(--border-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-sunken);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.product-image-uploader:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.product-image-uploader img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-faint);
    font-size: 0.8rem;
    gap: 8px;
}

.barcode-input-wrapper {
    display: flex;
    gap: 8px;
}

.barcode-render-box {
    margin-top: 10px;
    background: white;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    border: 1px solid var(--border-strong);
}

.barcode-render-box svg {
    max-width: 100%;
}

/* Payment modal custom layout */
.payment-total-box {
    background: var(--bg-surface-sunken);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    padding: 15px;
    text-align: center;
    margin-bottom: 20px;
}

.payment-total-box .total-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.payment-total-box h2 {
    font-size: 2.2rem;
    color: var(--color-success);
    font-weight: 700;
    margin: 5px 0;
}

.caja-shipping-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
    border: 1px solid #FDB022;
    background: var(--color-warning-light);
    color: #7A2E0E;
    box-shadow: var(--shadow-sm);
}
.caja-shipping-alert.hidden {
    display: none;
}
.caja-shipping-alert-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #FEF0C7;
    color: #B54708;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}
.caja-shipping-alert-icon svg {
    width: 20px;
    height: 20px;
}
.caja-shipping-alert-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    min-width: 0;
}
.caja-shipping-alert-body strong {
    color: #7A2E0E;
    font-size: 0.95rem;
}
.caja-shipping-alert-body span {
    color: #93370D;
    font-size: 0.85rem;
}
.caja-payment-alert {
    border-color: #F97066;
    background: #FEF3F2;
    color: #7A271A;
}
.caja-payment-alert .caja-shipping-alert-icon {
    background: #FEE4E2;
    color: #B42318;
}
.caja-payment-alert .caja-shipping-alert-body strong {
    color: #7A271A;
}
.caja-payment-alert .caja-shipping-alert-body span {
    color: #912018;
}

.payment-conversions-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.change-box {
    background: var(--color-success-light);
    border: 1px solid #A6F4C5;
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    margin-bottom: 20px;
}

.change-box span {
    font-size: 0.85rem;
    color: #027A48;
}

.change-box h2 {
    font-size: 1.8rem;
    color: var(--color-success);
    font-weight: 700;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   PRINT BOLETA STYLING (window.print())
   ========================================================================== */
/* Hide the print layout on screen */
.print-only {
    display: none;
}

@media print {
    /* Hide everything else on page */
    body:not(.printing-report) * {
        visibility: hidden;
    }
    
    /* Show only the print area and align it */
    body:not(.printing-report) .print-only, body:not(.printing-report) .print-only * {
        visibility: visible;
    }
    
    body:not(.printing-report) .print-only {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 80mm; /* standard POS ticket width */
        background: white !important;
        color: black !important;
        padding: 5mm;
        margin: 0;
        font-family: 'Courier New', Courier, monospace;
        font-size: 11pt;
    }
    
    /* Ticket specific layouts for printing */
    .ticket-wrapper {
        width: 100%;
        text-align: left;
    }
    
    .ticket-logo {
        height: 35px;
        width: auto;
        margin-bottom: 5px;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }
    
    .ticket-header h2 {
        font-size: 13pt;
        font-weight: bold;
        margin: 0;
    }
    
    .ticket-header p {
        font-size: 9pt;
        margin: 2px 0;
    }
    
    .separator {
        font-family: monospace;
        font-size: 10pt;
        margin: 5px 0;
        text-align: center;
    }
    
    .ticket-meta p {
        font-size: 9.5pt;
        text-align: left;
        margin: 2px 0;
    }
    
    .ticket-table {
        width: 100%;
        border-collapse: collapse;
        margin: 5px 0;
    }
    
    .ticket-table th {
        font-size: 9.5pt;
        font-weight: bold;
        border-bottom: 1px dashed black;
        padding-bottom: 3px;
        background: transparent !important;
        color: black !important;
    }
    
    .ticket-table td {
        font-size: 9pt;
        padding: 3px 0;
    }
    
    .align-left { text-align: left; }
    .align-right { text-align: right; }
    
    .ticket-totals {
        margin: 8px 0;
    }
    
    .ticket-total-row {
        display: flex;
        justify-content: space-between;
        font-size: 9.5pt;
        margin-bottom: 2px;
    }
    
    .ticket-grand-total {
        font-weight: bold;
        font-size: 11pt;
        border-top: 1px dashed black;
        border-bottom: 1px dashed black;
        padding: 3px 0;
    }
    
    .ticket-payment-details {
        text-align: left;
        font-size: 9pt;
        margin: 5px 0;
    }
    
    .ticket-payment-details p {
        margin: 2px 0;
    }
    
    .ticket-footer {
        margin-top: 15px;
        font-size: 8.5pt;
        text-align: center;
    }
    
    .ticket-footer p {
        margin: 2px 0;
    }
}

/* ==========================================================================
   PRINT STYLES FOR REPORTS
   ========================================================================== */
@media print {
    body.printing-report {
        background: #fff;
        color: #000;
        margin: 0;
        padding: 0;
        height: auto;
    }
    
    body.printing-report .sidebar, body.printing-report .top-header, body.printing-report .no-print {
        display: none !important;
    }
    
    body.printing-report .main-content {
        padding: 0;
        margin: 0;
        width: 100%;
        max-height: none;
        overflow: visible;
        background: #fff;
    }
    
    body.printing-report .panel.glass {
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0;
    }
    
    body.printing-report .print-only {
        display: block !important;
    }
    
    body.printing-report .data-table {
        border-collapse: collapse;
        width: 100%;
        margin-top: 20px;
    }
    
    body.printing-report .data-table th, body.printing-report .data-table td {
        border: 1px solid #000;
        padding: 8px;
        color: #000;
        font-size: 10pt;
    }
    
    body.printing-report .data-table th {
        background: #f0f0f0 !important;
        color: #000;
        font-weight: bold;
    }
    
    @page {
        margin: 1cm;
        size: auto;
    }
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 1.5rem;
    height: calc(100vh - 180px);
    overflow-x: auto;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) var(--bg-surface-sunken);
}
.kanban-board::-webkit-scrollbar {
    height: 8px;
}
.kanban-board::-webkit-scrollbar-track {
    background: var(--bg-surface-sunken);
    border-radius: 4px;
}
.kanban-board::-webkit-scrollbar-thumb {
    background-color: var(--border-strong);
    border-radius: 4px;
}

.kanban-column {
    flex: 1;
    min-width: 300px;
    background: var(--bg-surface-sunken);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.kanban-column h3 {
    background: var(--bg-surface);
    color: var(--text-primary);
    padding: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
    border-bottom: 1px solid var(--border-glass);
}

.kanban-list {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scrollbar-width: none;
}
.kanban-list::-webkit-scrollbar {
    display: none;
}

.order-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: var(--transition-smooth);
}
.order-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--color-info-hover);
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 0.5rem;
}

.order-card-body {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}
.order-card-body strong {
    color: var(--text-muted);
    font-weight: 600;
}
.order-card-body hr {
    border: none;
    border-top: 1px solid var(--border-glass);
    margin: 0.8rem 0;
}

.order-card-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.order-card-actions button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    letter-spacing: 0;
    transition: var(--transition-fast);
    min-width: 104px;
    box-shadow: none;
}
.order-card-actions .order-action-warning {
    background: var(--color-warning-light);
    color: #92400E;
    border: 1px solid #FDB022;
}
.order-card-actions .order-action-warning:hover {
    background: var(--color-warning);
    color: #111827;
    border-color: var(--color-warning-hover);
}
.order-card-actions .order-action-success {
    background: var(--color-success);
    color: #FFFFFF;
    border: 1px solid var(--color-success-hover);
}
.order-card-actions .order-action-success:hover {
    background: var(--color-success-hover);
    color: #FFFFFF;
}
.order-card-actions .order-action-disabled {
    background: var(--bg-surface-sunken);
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    cursor: not-allowed;
    opacity: 0.85;
}

.tracking-order-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    border: 0;
    background: transparent;
    color: #0567ff;
    font-family: monospace;
    font-weight: 800;
    text-decoration: underline;
    cursor: pointer;
    padding: 2px 0;
}
.tracking-order-link.sent::after,
.tracking-order-link.received::after,
.tracking-order-link.pending::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-left: 7px;
}
.tracking-order-link.sent::after {
    background: var(--color-success);
}
.tracking-order-link.received::after {
    background: #2563EB;
}
.tracking-order-link.pending::after {
    background: var(--color-warning);
}
.tracking-legend {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}
.tracking-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.tracking-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.tracking-dot.pending {
    background: var(--color-warning);
}
.tracking-dot.sent {
    background: var(--color-success);
}
.tracking-dot.received {
    background: #2563EB;
}
.tracking-popover {
    position: absolute;
    left: 0;
    bottom: calc(100% + 10px);
    z-index: 50;
    width: 260px;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: var(--transition-fast);
    pointer-events: none;
}
.tracking-popover::after {
    content: '';
    position: absolute;
    left: 18px;
    bottom: -7px;
    width: 12px;
    height: 12px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-strong);
    border-bottom: 1px solid var(--border-strong);
    transform: rotate(45deg);
}
.tracking-order-link:hover .tracking-popover,
.tracking-order-link:focus .tracking-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.tracking-popover-title {
    display: block;
    margin-bottom: 8px;
    color: var(--color-primary);
    font-weight: 800;
    font-size: 0.82rem;
}
.tracking-popover-row {
    display: grid;
    grid-template-columns: 92px 1fr;
    gap: 8px;
    align-items: start;
    font-size: 0.78rem;
    margin-top: 6px;
}
.tracking-popover-row span {
    color: var(--text-muted);
}
.tracking-popover-row strong {
    color: var(--text-primary);
    font-weight: 700;
    word-break: break-word;
}
.tracking-popover-empty {
    border-radius: 6px;
    background: var(--color-warning-light);
    color: #92400E;
    padding: 9px;
    font-size: 0.8rem;
    font-weight: 700;
}
.tracking-info-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(16, 24, 40, 0.35);
}
.tracking-info-card {
    width: min(420px, 100%);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.tracking-info-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 16px;
    border-bottom: 1px solid var(--border-glass);
    background: var(--color-info-light);
}
.tracking-info-header span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}
.tracking-info-header strong {
    display: block;
    margin-top: 3px;
    color: #0567ff;
    font-size: 1.15rem;
    font-family: monospace;
}
.tracking-info-header button {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.tracking-detail-grid {
    display: grid;
    gap: 10px;
    padding: 16px;
}
.tracking-detail-grid div {
    padding: 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-sunken);
}
.tracking-detail-grid span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 4px;
}
.tracking-detail-grid strong {
    color: var(--text-primary);
    word-break: break-word;
}
.tracking-detail-actions {
    padding: 0 16px 16px;
}
.tracking-detail-actions .btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.tracking-detail-actions svg {
    width: 16px;
    height: 16px;
}
.tracking-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 22px 18px;
    text-align: center;
    color: #92400E;
    background: var(--color-warning-light);
}
.tracking-detail-empty svg {
    width: 34px;
    height: 34px;
}
.tracking-detail-empty span {
    color: #93370D;
    font-size: 0.86rem;
}

/* Notification Badge for Sidebar */
.nav-badge {
    background-color: var(--color-warning);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    height: 22px;
    width: 22px;
    min-width: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    float: right;
    margin-left: 5px;
    padding: 0;
    line-height: 0;
}

/* ==========================================================================
   FACTURA CARTA SII PRINT STYLING
   ========================================================================== */
.factura-print-only {
    display: none;
}

@media print {
    /* If printing a Factura */
    body.printing-factura * {
        visibility: hidden !important;
    }
    body.printing-factura .factura-print-only, body.printing-factura .factura-print-only * {
        visibility: visible !important;
    }
    body.printing-factura .factura-print-only {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        max-width: 8.5in;
        background: white !important;
        color: black !important;
        padding: 10mm;
        margin: 0;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 10pt;
    }
    body.printing-factura .print-only {
        display: none !important;
        visibility: hidden !important;
    }
}

body.printing-factura {
    background: white !important;
}

/* Factura layout styles */
.factura-wrapper {
    width: 100%;
    color: #000 !important;
}
.factura-header-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}
.factura-company-info {
    width: 60%;
    text-align: left;
}
.factura-rut-box {
    width: 38%;
    border: 3px solid red;
    padding: 10px;
    text-align: center;
    background-color: #fff;
    shrink: 0;
}
.factura-customer-container {
    border: 1px solid #000;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
}
.factura-customer-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
}
.factura-customer-table td {
    vertical-align: top;
    color: #000 !important;
}
.factura-items-table {
    width: 100%;
    border-collapse: collapse;
}
.factura-items-table th, .factura-items-table td {
    border: 1px solid #ccc;
    padding: 6px;
    color: #000 !important;
}
.factura-items-table th {
    font-weight: bold;
    background-color: #f2f2f2;
}
.factura-totals-box table td {
    color: #000 !important;
}
.barcode-simulator {
    background: repeating-linear-gradient(90deg, #000, #000 2px, #fff 2px, #fff 4px);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-success {
    background: rgba(18, 183, 106, 0.14);
    color: #027a48;
    border: 1px solid rgba(18, 183, 106, 0.32);
}

.badge-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.24);
}

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

.customer-detail-grid > div {
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
}

.customer-detail-grid span {
    display: block;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.customer-detail-grid strong {
    color: var(--text-main);
    overflow-wrap: anywhere;
}

@media (max-width: 720px) {
    .customer-detail-grid {
        grid-template-columns: 1fr;
    }
}
