/* ============================================
   Design System — 2026ingreso
   Modern Pharmacy Product Management
   ============================================ */

/* --- CSS Variables --- */
:root {
    /* Primary palette */
    --primary: #0f1b4c;
    --primary-light: #1a2d7a;
    --primary-dark: #080e2a;
    --primary-glow: rgba(15, 27, 76, 0.3);

    /* Accent colors */
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --accent-cyan: #06b6d4;

    /* Neutrals */
    --bg-body: #f0f2f7;
    --bg-card: #ffffff;
    --bg-card-alt: #f8fafc;
    --bg-hover: #f1f5f9;
    --bg-input: #f8fafc;
    --border: #e2e8f0;
    --border-focus: var(--accent-blue);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-on-dark: #ffffff;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Radii */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

    /* Transitions */
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --duration: 200ms;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* --- Glass Card --- */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--duration) var(--ease);
}

/* --- Header --- */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #2c3e8c 100%);
    padding: var(--space-md) var(--space-xl);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(15, 27, 76, 0.3);
}

.header-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--accent-cyan);
    backdrop-filter: blur(10px);
}

.header-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-on-dark);
    letter-spacing: -0.3px;
}

.header-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-glow {
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    }

    50% {
        box-shadow: 0 2px 20px rgba(59, 130, 246, 0.5);
    }
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-danger-ghost {
    background: transparent;
    color: var(--accent-red);
    border: none;
    padding: 2px 4px;
    font-size: 0.75rem;
}

.btn-danger-ghost:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* --- Main Content --- */
.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* --- Context Bar --- */
.context-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
}

.context-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.context-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
}

.context-label i {
    color: var(--primary);
}

.context-info {
    margin-left: auto;
}

.input-with-btn {
    display: flex;
    gap: 4px;
}

/* --- Inputs --- */
.input-text,
.input-select {
    font-family: inherit;
    font-size: 0.85rem;
    padding: var(--space-sm) 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: all var(--duration) var(--ease);
    outline: none;
    width: 100%;
}

.input-text:focus,
.input-select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    background: white;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix {
    display: flex;
    align-items: center;
    padding: 0 10px;
    background: var(--bg-card-alt);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.input-with-prefix .input-text {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

textarea.input-text {
    resize: vertical;
    min-height: 60px;
}

.text-center {
    text-align: center;
}

/* --- Search --- */
.search-container {
    display: flex;
    align-items: center;
    padding: 6px var(--space-md);
    gap: var(--space-sm);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1rem;
}

.search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.95rem;
    padding: var(--space-sm) 0;
    color: var(--text-primary);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-spinner {
    color: var(--accent-blue);
    font-size: 1rem;
}

/* --- Badge --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
}

/* --- Product Table --- */
.products-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.product-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: fixed;
}

.product-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.product-table th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 8px;
    border-bottom: 2px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

.product-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-table tbody tr {
    transition: background var(--duration) var(--ease);
}

.product-table tbody tr:nth-child(even) {
    background: var(--bg-card-alt);
}

.product-table tbody tr:hover {
    background: #e8f4fd !important;
}

/* Column classes */
.col-codigo {
    width: 90px;
}

.col-producto {
    width: 280px;
    white-space: normal !important;
}

.col-pres {
    width: 155px;
    padding: 12px 10px !important;
}

.col-costo {
    width: 72px;
    text-align: center;
}

.col-precio {
    width: 72px;
    text-align: center;
}

.col-fecha {
    width: 80px;
    text-align: center;
}

.col-iva {
    width: 55px;
    text-align: center;
}

.col-acc {
    width: 62px;
    text-align: center;
}

/* Cost/price column backgrounds — Drastic distinction */
th.bg-cost,
td.bg-cost {
    background: #E0F2FE !important;
}

/* Clear Sky Blue for Costs */
th.bg-price,
td.bg-price {
    background: #DCFCE7 !important;
}

/* Clear Mint Green for Sales */

/* --- Lugar Sub-row (beneath each product) --- */
.lugar-subrow td {
    padding: 0 !important;
    border-bottom: 3px solid #cbd5e1 !important;
    /* Thicker, darker separator between product blocks */
}

.lugar-subrow-cell {
    padding: 8px 12px !important;
    background: rgba(248, 250, 252, 0.4);
    /* Subrow area slightly tinted to group it with product above */
}

.lugar-subrow-content {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    /* Centered locations */
    gap: 12px !important;
    flex-wrap: wrap !important;
}

.lugar-subrow-icon {
    color: var(--primary);
    font-size: 0.8rem;
    flex-shrink: 0;
    margin-right: 4px;
}

/* Main product row — remove its bottom border since the subrow handles it */
.product-main-row td {
    border-bottom: none !important;
}

/* --- Location Badge (in sub-row) --- */
.lugar-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px;
    padding: 4px 12px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s var(--ease);
    box-shadow: var(--shadow-sm);
    width: auto !important;
    /* Ensure it doesn't take 100% width */
}

.lugar-badge:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.lugar-badge.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.lugar-badge .lugar-name {
    /* pointer-events: none; removed to allow clicks */
    display: inline-block;
}

.lugar-badge .lugar-remove {
    color: var(--accent-red);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 700;
    opacity: 0.5;
    transition: opacity 0.2s;
    margin-left: 2px;
}

.lugar-badge .lugar-remove:hover {
    opacity: 1;
}

.lugar-badge.active .lugar-remove {
    color: rgba(255, 255, 255, 0.7);
}

.lugar-badge.active .lugar-remove:hover {
    color: white;
}

/* --- Inline Editable --- */
.cell-editable {
    cursor: pointer;
    position: relative;
    transition: background var(--duration) var(--ease);
    border-radius: 3px;
    padding: 2px 4px;
}

.cell-editable:hover {
    background: rgba(59, 130, 246, 0.06);
}

.cell-editable:hover::after {
    content: "✎";
    position: absolute;
    right: 2px;
    top: 1px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.inline-input {
    width: 100%;
    padding: 4px 6px;
    border: 2px solid var(--accent-blue);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    background: white;
    animation: input-appear 150ms var(--ease);
}

@keyframes input-appear {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Cost / price inputs in table */
.table-input {
    width: 95%;
    max-width: 68px;
    padding: 3px 6px;
    font-size: 0.9rem;
    font-family: inherit;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    text-align: center;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    box-shadow: var(--shadow-sm);
}

.table-input:hover:not(:disabled) {
    border-color: var(--accent-blue);
    background: #f8fafc !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.table-input:focus {
    background: white !important;
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* Disabled cost inputs (no location selected) */
.table-input.cost-input:disabled {
    background: repeating-linear-gradient(-45deg,
            #f8fafc,
            #f8fafc 3px,
            #f1f5f9 3px,
            #f1f5f9 6px);
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-muted);
    border-color: #e2e8f0;
}

/* Presentation toggle */
.pres-toggle {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent-green);
}

.units-input {
    width: 50px;
    padding: 2px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    transition: all 0.2s;
}

/* IVA toggle */
.iva-toggle {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent-green);
}

/* Date cells */
.date-cell {
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 6px !important;
}

.date-info-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: relative;
    padding: 6px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s var(--ease);
}

.date-info-group.is-latest {
    background: #fffbeb;
    border-color: #fef3c7;
    box-shadow: var(--shadow-sm);
}

.venc-group {
    background: #fef2f2;
    border-color: #fee2e2;
}

.date-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.is-latest .date-label {
    color: var(--accent-orange);
}

.venc-group .date-label {
    color: var(--accent-red);
}

.date-ingreso {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.date-vencimiento {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
}

.date-lugar-tag {
    font-size: 0.62rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
    background: white;
    padding: 1px 6px;
    border-radius: 10px;
    border: 1px solid #fde68a;
    margin-top: 2px;
}

/* Stock cell */
.stock-cell {
    font-weight: 700;
    color: var(--primary);
}

.stock-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Product info */
.product-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.3;
}

.product-generic {
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-top: 2px;
}

.product-lab {
    display: flex;
    width: fit-content;
    background: #e0e7ff;
    color: var(--primary-light);
    font-size: 0.72rem;
    padding: 2px 10px;
    border-radius: 20px;
    font-weight: 600;
    margin-top: 4px;
}

.product-funcion {
    display: flex;
    width: fit-content;
    background: #f3e8ff;
    color: var(--accent-purple);
    font-size: 0.72rem;
    padding: 2px 10px;
    border-radius: 20px;
    margin-top: 4px;
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-pres-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.pres-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pres-label {
    font-size: 0.8rem;
    line-height: 1.3;
    font-weight: 700;
    color: var(--primary);
    text-transform: none;
    letter-spacing: -0.01em;
}

.units-input {
    width: 100%;
    max-width: 78px;
    padding: 3px 8px;
    border: 1.5px solid #cbd5e1;
    background: white !important;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.units-input:hover {
    border-color: var(--accent-blue);
    background: #f8fafc !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.units-input:focus {
    background: white !important;
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* --- Pagination --- */
.pagination-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.page-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0 var(--space-sm);
}

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-xl) var(--space-md);
    overflow-y: auto;
    animation: fade-in 200ms var(--ease);
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-container {
    width: 100%;
    max-width: 720px;
    border-radius: var(--radius-xl);
    animation: slide-up 300ms var(--ease);
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    color: white;
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--duration);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.modal-body {
    padding: var(--space-lg) var(--space-xl);
    max-height: 65vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-top: 1px solid var(--border);
}

/* --- Form Sections --- */
.form-section {
    margin-bottom: var(--space-lg);
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-md);
    border-bottom: 2px solid #e0e7ff;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.form-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.form-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.span-2 {
    grid-column: span 2;
}

.form-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-label.required::after {
    content: " *";
    color: var(--accent-red);
}

.checkbox-group {
    display: flex;
    align-items: flex-end;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.cost-preview {
    background: #f0f4ff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
}

.cost-preview i {
    color: var(--accent-orange);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    min-width: 280px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-lg);
    animation: toast-in 300ms var(--ease);
}

.toast.toast-out {
    animation: toast-out 300ms var(--ease) forwards;
}

.toast-success {
    background: var(--accent-green);
}

.toast-error {
    background: var(--accent-red);
}

.toast-info {
    background: var(--accent-blue);
}

.toast-warning {
    background: var(--accent-orange);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* --- Loading State --- */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    gap: var(--space-md);
}

.loading-state i {
    font-size: 2rem;
    color: var(--accent-blue);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    gap: var(--space-sm);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--border);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .main-content {
        padding: var(--space-md);
    }

    .context-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .context-info {
        margin-left: 0;
    }

    .form-grid,
    .form-grid.cols-3,
    .form-grid.cols-4 {
        grid-template-columns: 1fr;
    }

    .form-group.span-2 {
        grid-column: span 1;
    }

    .modal-container {
        max-width: 100%;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Row saving animation */
.row-saving {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.row-saved {
    animation: flash-green 600ms var(--ease);
}

@keyframes flash-green {
    0% {
        background: rgba(16, 185, 129, 0.2) !important;
    }

    100% {
        background: transparent;
    }
}

/* --- Product Update Status Highlighting --- */
/* Updated products (dates >= 2025): pastel orange */
.row-updated,
.row-updated td {
    background-color: #FFE0B2 !important;
}

.row-updated td input.table-input {
    background-color: #FFF3E0 !important;
}

/* Not updated products (no dates or dates < 2025): pastel blue */
.row-not-updated,
.row-not-updated td {
    background-color: #BBDEFB !important;
}

.row-not-updated td input.table-input {
    background-color: #E3F2FD !important;
}