/* 
   ==========================================================================
   SMART LABEL PRO - COMPONENTS (ORGANIZED & STANDARDIZED)
   - Logical grouping: Cards -> Forms -> Buttons -> Status -> Data -> Modals
   ========================================================================== */

/* --- 1. CARDS & CONTAINERS --- */
.card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: var(--gutter);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--gutter);
}

.stack-clinical { display: flex !important; flex-direction: column !important; gap: 18px !important; }
.stack-compact  { display: flex !important; flex-direction: column !important; gap: 9px !important; }

.stack-clinical > * { margin-top: 0 !important; margin-bottom: 0 !important; }
.stack-compact > *  { margin-top: 0 !important; margin-bottom: 0 !important; }

.section-card {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--gutter);
    overflow: hidden;
}

/* Advanced Filters Panel Hardening */
#advanced-filters-panel.section-card {
    background: #fff;
    padding: 9px 18px;
    margin-bottom: 0;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

#tab-catalogue #advanced-filters-panel,
#tab-tags #advanced-filters-panel {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 0;
}

#advanced-filters-panel .search-bar {
    gap: 12px;
    margin-bottom: 0;
}

#tab-catalogue #advanced-filters-panel .search-bar,
#tab-tags #advanced-filters-panel .search-bar {
    justify-content: flex-end;
    gap: 18px; /* Adheres strictly to the 9px rhythm law */
    margin-bottom: 0;
}

#advanced-filters-panel .info-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0 12px;
    height: var(--slim-height);
}

#advanced-filters-panel .btn-secondary {
    background: var(--bg-surface);
}

#advanced-filters-panel .search-input {
    background-color: transparent;
    border: none;
    padding: 0 4px;
    min-width: 0;
    height: 100%;
    box-shadow: none;
}

#advanced-filters-panel select.search-input {
    background-position: right 0px center;
    padding-right: 20px;
}

#advanced-filters-panel .info-label {
    font-size: 0.65rem;
    color: #64748b;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--slim-height);
    min-height: var(--slim-height);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: var(--slim-height);
    min-height: var(--slim-height);
}

.clinical-page-root {
    padding: var(--gutter) 0 0 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.clinical-main-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--gutter);
    gap: var(--gutter);
    margin-bottom: 0;
}

.clinical-main-card.table-card {
    flex: 1;
    min-height: 0;
}

.clinical-scroll-area {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* --- 2. HEADERS & TITLES --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: var(--slim-height);
}

.page-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: var(--slim-height);
    padding: 0 12px 0 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--slim-radius);
    box-shadow: var(--shadow-sm);
    line-height: 1;
}

.card-title,
.modal-header-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: var(--slim-height);
    padding: 0 12px 0 8px;
    background: var(--primary-light);
    border: 1px solid var(--border-color);
    border-radius: var(--slim-radius);
    line-height: 1;
}



.page-title .sl-icon, 
.modal-header-title .sl-icon,
.card-title .sl-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}



/* --- 3. FORM ELEMENTS (SEARCH, INPUTS, SELECTS) --- */
.search-bar {
    display: flex;
    gap: 18px;
    align-items: center;
    margin-bottom: 18px;
}

.search-container {
    position: relative;
    flex: 1;
}

.search-input {
    height: var(--slim-height);
    border: 1px solid var(--border-color);
    border-radius: var(--slim-radius);
    padding: 0 12px;
    font-size: 0.7rem;
    font-family: inherit;
    background-color: var(--bg-surface);
    color: var(--text-main);
    transition: .2s;
    outline: none;
    display: inline-flex;
    align-items: center;
    width: 100%;
    min-width: 150px;
}

select.search-input {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    padding-right: 30px;
    cursor: pointer;
    color: var(--text-muted);
}

select.search-input option,
select.search-input optgroup {
    color: var(--text-muted) !important;
    background-color: var(--bg-surface) !important;
}

/* Products Catalogue & Tag Fleet - Custom Status Dropdown */
#ean-filter-status,
#tag-filter-status {
    background-color: var(--bg-surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
    color: var(--text-muted);
    border-color: var(--border-color);
    font-weight: 600;
}

#ean-filter-status option,
#tag-filter-status option {
    background-color: var(--bg-surface) !important;
    color: var(--text-muted) !important;
}

#ean-filter-status:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.1);
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.1);
}

.search-input[readonly],
.search-input:disabled,
select.search-input:disabled {
    background-color: var(--bg-main);
    color: var(--text-muted);
    opacity: 0.7;
    cursor: not-allowed;
}

.search-input.input-invalid {
    border-color: var(--status-danger) !important;
    background-color: #fff5f5 !important;
    color: var(--status-danger) !important;
}

.form-input-bold {
    font-weight: 700;
    color: var(--primary-dark);
    background: var(--bg-surface);
    border-color: var(--border-color);
}

.form-input-bold:disabled,
select.form-input-bold:disabled {
    color: var(--text-muted);
    background-color: var(--bg-disabled);
    opacity: 0.7;
    cursor: not-allowed;
}

.input-imported,
.search-input.input-imported,
.form-input-bold.input-imported,
.bp-main .search-input.input-imported,
.bp-modal-split .search-input.input-imported {
    background: #64748b !important;
    color: #ffffff !important;
    border-color: #475569 !important;
    font-weight: 700 !important;
}

.mandatory-highlight {
    background-color: #fffbeb !important;
    border-color: #fcd34d !important;
    color: #0f172a !important;
    box-shadow: 0 0 0 1px #fcd34d !important;
}

.alert-highlight {
    background-color: #fff7ed !important;
    border-color: #f97316 !important;
    box-shadow: 0 0 0 1px #f97316 !important;
    transition: all 0.3s ease;
}

.input-imported option,
.input-imported option:checked,
select option:checked {
    background-color: #64748b !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.input-imported option:not(:checked) {
    color: rgba(255, 255, 255, 0.7) !important;
}

.input-file-slim {
    padding: 0 !important;
    display: flex;
    align-items: center;
    color: var(--text-main);
    font-size: 0.75rem;
}

.input-file-slim::file-selector-button,
.input-file-slim::-webkit-file-upload-button {
    height: calc(var(--slim-height) - 2px);
    margin: 0;
    margin-right: 12px;
    padding: 0 12px;
    border: none;
    border-right: 1px solid var(--border-color);
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: 0.2s;
}

.input-with-unit {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-unit input {
    padding-right: 42px;
    min-width: 0;
}

.input-unit {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.7rem;
    pointer-events: none;
    font-weight: 700;
}



.checkbox-center {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.info-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: none;
    text-align: left;
    white-space: nowrap;
}

/* --- 4. BUTTONS & INTERACTIVE --- */
.btn {
    height: var(--slim-height);
    min-width: 105px;
    padding: 0 12px;
    border-radius: var(--slim-radius);
    border: 1px solid var(--border-color);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    font-size: .7rem;
    font-family: inherit;
    transition: .2s;
    background: #f9fafb;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Unified Button Icon Spacing Baseline */
.btn .sl-icon {
    width: 14px !important;
    height: 14px !important;
}

.btn:has(.sl-icon) {
    justify-content: center;
    padding: 0 12px;
    gap: 6px;
}



.btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background: #475569;
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-light {
    background: #f8fafc;
    color: var(--text-muted);
    border-color: var(--border-color);
}

.btn-light:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}



.btn-red {
    background: #ef4444;
    color: #ffffff;
    border-color: #dc2626;
}

.btn-red:hover {
    background: #dc2626;
    color: #ffffff;
    border-color: #b91c1c;
    box-shadow: var(--shadow-md);
}



.btn-header {
    width: 130px;
    min-width: 130px;
    padding: 0 4px;
    justify-content: center;
    flex-shrink: 0;
}

#btn-toggle-filters.active {
    background: var(--primary-color);
    color: var(--bg-surface);
    border-color: var(--primary-color);
}

#btn-toggle-filters.active:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    min-width: var(--slim-height);
    width: var(--slim-height);
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
}

.btn-slim {
    height: 28px;
    padding: 0 10px;
    min-width: 80px;
    font-size: 0.65rem;
}



/* --- 5. STATUS, BADGES & INDICATORS --- */
.alert {
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.alert-badge {
    height: 18px;
    min-width: 24px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.alert-red {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecdd3;
}

.alert-orange {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.alert-green {
    background: #f0fdf4;
    color: rgb(21, 128, 61);
    border: 1px solid #dcfce7;
    transition: border-color 0.2s ease;
}
.alert-green:hover {
    border-color: rgb(21, 128, 61);
}

.alert-blue {
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-soft-blue {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #dbeafe;
}

.status-cartouche {
    width: fit-content;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    height: var(--slim-height);
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}


/* LED Indicators */
.led-preview-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
}

.led-color-name {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.led-preview {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1.5px #e2e8f0, 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.bg-color-rouge { background-color: #ef4444 !important; }
.bg-color-vert  { background-color: #22c55e !important; }
.bg-color-bleu  { background-color: #3b82f6 !important; }
.bg-color-cyan  { background-color: #06b6d4 !important; }
.bg-color-violet { background-color: #8b5cf6 !important; }
.bg-color-blanc { background-color: #f1f5f9 !important; border: 2px solid #e2e8f0; }

.color-rouge  { color: #ef4444 !important; }
.color-vert   { color: #10b981 !important; }
.color-bleu   { color: #3b82f6 !important; }
.color-jaune  { color: #f59e0b !important; }
.color-orange { color: #f97316 !important; }
.color-cyan   { color: #06b6d4 !important; }
.color-violet { color: #8b5cf6 !important; }
.color-blanc  { color: var(--text-muted) !important; }

@keyframes led-pulse {
    0% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.2); }
    50% { opacity: 0.7; transform: scale(1.1); box-shadow: 0 0 10px 2px currentColor; }
    100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); }
}

.pulse-red, .pulse-green, .pulse-blue, .pulse-yellow, .pulse-orange, .pulse-cyan, .pulse-purple, .pulse-white {
    animation: led-pulse 2s infinite ease-in-out;
}

/* --- 6. TAB SYSTEMS --- */
.clinical-tabs {
    display: flex;
    align-items: center;
    gap: 9px;
    height: var(--slim-height);
}

.tab-item {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: var(--slim-height);
    padding: 0 12px;
    border-radius: var(--slim-radius);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.tab-item:hover {
    background: var(--bg-main);
    color: var(--primary-color);
}

.tab-item.active {
    background: #64748b;
    color: #fff;
    border-color: #64748b;
    box-shadow: var(--shadow-sm);
}

.tab-item.active:hover {
    background: #475569;
    color: #fff;
}

.tab-item .sl-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-pane, .tag-tab-content {
    display: none;
    flex-direction: column;
    gap: 18px;
    padding: 0;
}

.tab-pane.active { display: flex; }

/* Enforce zero margin on direct children of tabs to rely on gap */
.tab-pane > *, .tag-tab-content > * {
    margin-bottom: 0 !important;
}

.staff-editor-grid {
    display: grid;
    grid-template-columns: min-content 1fr min-content 1fr auto auto;
    gap: 9px 18px;
    align-items: center;
}

.staff-tab-content { width: 100%; }

/* --- 7. DATA PRESENTATION (TABLES, METRICS, VITALS) --- */
.table-responsive {
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 10px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table tr:last-child td:first-child { border-bottom-left-radius: 10px; }
.data-table tr:last-child td:last-child  { border-bottom-right-radius: 10px; }

.data-table thead th {
    position: sticky;
    top: 0;
    z-index: 20;
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.70rem;
    font-weight: 700;
    padding: 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.data-table thead th:first-child {
    border-left: 1px solid var(--border-color);
    border-top-left-radius: 10px;
}

.data-table thead th:last-child { border-top-right-radius: 10px; }

.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-family: 'IBM Plex Mono', monospace;
    white-space: nowrap;
    vertical-align: middle;
}
.table-v-compact td { padding: 4px 12px; }
.table-v-compact th { padding: 4px 12px; }

.data-table td:first-child { border-left: 1px solid var(--border-color); }
.data-table tbody tr:nth-child(odd) { background: var(--bg-surface); }
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table tbody tr {
    transition: background-color 0.15s ease;
}
.data-table tbody tr:hover td {
    background: var(--bg-main);
    cursor: pointer;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.page-btn {
    min-width: var(--slim-height);
    height: var(--slim-height);
    border-radius: var(--slim-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn.active, .q-filter.active {
    background: var(--primary-color);
    color: var(--bg-surface);
    border-color: var(--primary-color);
}

.table-footer-row {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Table Specializations */
.ap-table th:first-child, .ap-table td:first-child { padding-left: 12px; }
.ap-table th:last-child, .ap-table td:last-child { padding-right: 12px; }



/* Metrics */
.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metric-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.metric-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.metric-tile {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--gutter);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: 0.2s;
}

.metric-tile:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

/* Tag Vitals */


/* --- 8. LAYOUT PRIMITIVES (COMPONENT-LEVEL) --- */

.grid-dgccrf-main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 18px;
}


.product-details-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}



.span-6, .span-all { grid-column: 1 / -1; }
.span-rows-7 { grid-row: span 7; }
.span-rows-8 { grid-row: span 8; }

/* Bulletproof Clinical Foundation 7.0 (Hard Grid Isolation) */
.bp-modal-split {
    display: grid;
    grid-template-columns: max-content 1fr;
    width: auto;
    margin: 0;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.03);
}

.bp-modal-split.hidden {
    display: none;
}

.bp-card-capsule {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    padding: 18px;
    margin: 0;
}

.bp-card-capsule.hidden {
    display: none;
}

.field-mandatory {
    border: 1px solid #fcd34d;
    background-color: #fffbeb;
}

.bp-sidebar {
    width: auto;
    padding: 18px;
    background: #ffffff;
    display: grid;
    grid-template-columns: max-content 160px;
    gap: 9px 18px;
    align-content: start;
    align-items: center;
    border-right: 1px solid var(--border-color);
}

.bp-main {
    width: auto;
    padding: 18px;
    background: #f8fafc;
    display: grid;
    grid-template-columns: max-content 160px max-content 160px;
    gap: 9px 18px;
    align-content: start;
    align-items: center;
    overflow-y: auto;
}

.bp-main .search-input { background-color: var(--bg-surface); }
.bp-main .span-3 { grid-column: span 3; }

#tab-prod-specs select[multiple] {
    height: auto;
    background: var(--bg-surface);
    padding-right: 12px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 18px 9px 18px;
    margin-bottom: 0;
}

.modal-body {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(95vh - 140px);
    padding: 9px 18px;
}

.modal-body:last-child,
.modal-body:has(+ .modal-footer.hidden),
.modal-body:has(+ .modal-footer-compact.hidden),
.modal-body:has(+ .modal-footer-naked.hidden) {
    padding-bottom: 18px;
}

.modal-body-flush { padding: 0 !important; }
.modal-body-scrollable {
    max-height: calc(98vh - 140px);
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-footer, .modal-footer-compact {
    display: flex;
    align-items: center;
    margin-top: 0;
    padding: 9px 18px 18px 18px;
}

.modal-footer { justify-content: flex-end; gap: 9px; }

.modal-footer-compact {
    justify-content: flex-end;
    gap: 9px;
    background: transparent;
}

/* Modal Width Helpers */
.modal-lg { max-width: 1000px; }
.modal-800 { max-width: 800px; }
.modal-750 { max-width: 750px; }

.modal-542 { width: 542px; min-width: 542px; }
.modal-450 { width: 450px; min-width: 450px; max-width: 450px; }
.modal-fit { width: fit-content; min-width: 0; }

.modal-close {
    width: var(--slim-height);
    height: var(--slim-height);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--slim-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.modal-close:hover {
    background: var(--bg-alt);
    color: var(--primary-color);
    border-color: var(--border-color);
}

.modal-close .sl-icon { font-size: 0.85rem; }

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* --- 8b. MIGRATED FIELD & MODULE ROWS --- */
.field-row, .module-row, .row-block {
    padding: 9px 0;
}

.stack-clinical > .field-row,
.stack-clinical > .module-row,
.stack-clinical > .row-block {
    padding-top: 0;
    padding-bottom: 0;
}

.field-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.row-block {
    display: block;
}

.map-iframe {
    display: block;
    border: none;
}

.module-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: var(--slim-height);
}

.module-n {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.module-d {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1;
    margin-top: 3px;
    opacity: 0.8;
}

.modal-footer-naked {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 9px 18px 18px 18px;
}


/* --- 9. OVERLAY SYSTEMS (MODALS, TOASTS) --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-backdrop.modal-visible { display: flex; }

.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0;
    width: fit-content;
    min-width: 720px;
    height: fit-content;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.3s ease-out;
}

.modal-confirm {
    padding: var(--gutter);
    min-width: 420px;
    width: auto;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 12000;
}

.toast {
    min-width: 280px;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: var(--gutter);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s ease-out;
    pointer-events: auto;
}

.toast-msg {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
}

.toast .sl-icon { font-size: 1.1rem; flex-shrink: 0; }

.toast-success { border-left: 4px solid var(--status-success); }
.toast-success .sl-icon { color: var(--status-success); }
.toast-error { border-left: 4px solid var(--status-danger); }
.toast-error .sl-icon { color: var(--status-danger); }
.toast-warning { border-left: 4px solid var(--status-warning); }
.toast-warning .sl-icon { color: var(--status-warning); }
.toast-info { border-left: 4px solid var(--status-info); }
.toast-info .sl-icon { color: var(--status-info); }

.toast-fade-out {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.4s ease-in;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

/* --- 10. SPECIALIZED MODULES (ESL, CAMERA, AUDIT) --- */

/* Physical ESL Bezel & Display */
.esl-bezel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.8);
    border: 1px solid #1e293b;
    position: relative;
    display: block;
    box-sizing: border-box;
}

.esl-screen {
    background: #ffffff;
    border: 3px solid #000000;
    border-radius: 2px;
    overflow: hidden;
    position: absolute;
    top: 12px;
    left: 12px;
    display: block;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
    box-sizing: border-box;
    z-index: 10;
}

.esl-screen iframe { display: block; border: none; width: 100%; height: 100%; }

/* ── E-Ink Realistic Simulation Filter Application ──────────────────
   Simulates physical paper texture and remapped pigment colors.
   Applied directly to the preview iframe to preserve export layout.
   ────────────────────────────────────────────────────────────────── */
body.eink-realistic-active .esl-screen iframe {
    filter: url(#eink-realistic-filter);
    transition: filter 0.25s ease;
}

.esl-led {
    position: absolute;
    top: 10px;
    right: 6px;
    width: 16px;
    height: 8px;
    background: #334155;
    border-radius: 2px;
    z-index: 20;
    animation: esl-blink-slow 2s infinite ease-in-out;
}

@keyframes esl-blink-slow {
    0%, 100% { background-color: #334155; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3); }
    50% { background-color: #22c55e; box-shadow: 0 0 15px #22c55e, 0 0 5px #22c55e; }
}


.esl-barcode-vertical {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.esl-barcode-vertical-img {
    display: block;
    width: 100px;
    height: 16px;
    object-fit: contain;
    transform: rotate(90deg);
    transform-origin: center center;
    opacity: 1;
}


/* Camera & Scanner */
.camera-preview {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-preview video { width: 100% !important; height: 100% !important; object-fit: cover; position: relative; z-index: 5; }
.camera-preview #qr-shaded-region, .camera-preview canvas { position: absolute !important; z-index: 6 !important; }

.camera-preview-large {
    width: 100%;
    max-width: 720px;
    height: 405px;
    margin: 0 auto;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-preview-large video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.guide-box {
    width: 80%;
    height: 70%;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
}

.guide-text {
    margin-top: 18px;
    color: #fff;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 20px;
}

.scanner-init-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: #000;
    color: #fff;
    z-index: 10;
    transition: opacity 0.3s;
}

.scanner-init-overlay.hidden { opacity: 0; pointer-events: none; }

/* Audit & Timeline System */
.audit-scroll-area, .modal-history-content {
    max-height: 550px;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.modal-body .modal-history-content {
    max-height: min(550px, calc(95vh - 180px));
    padding: 18px;
}

#modal-shared-audit .modal-body {
    overflow-y: hidden;
}

.audit-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    z-index: 1;
    flex-shrink: 0;
    color: var(--text-muted);
}
.audit-icon .sl-icon { width: 12px; height: 12px; }

.audit-icon-pulse {
    animation: clinical-pulse 2s infinite;
    border-color: #22c55e !important;
    background: #f0fdf4 !important;
    color: #15803d !important;
    z-index: 2 !important;
}




.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.audit-item { display: flex; gap: 16px; position: relative; }
.audit-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 8px;
    top: 20px;
    bottom: -18px;
    width: 2px;
    background: #e2e8f0;
}

.audit-content { flex: 1; background: transparent; border: none; border-radius: 0; padding: 0; }
.audit-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.audit-event { font-weight: 700; font-size: 0.85rem; color: #1e293b; }
.audit-user-inline { font-weight: 500; color: #64748b; font-size: 0.8rem; }
.audit-time { font-size: 0.75rem; color: #94a3b8; font-family: 'JetBrains Mono', monospace; }



@keyframes clinical-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}



/* --- 11. MODULE SPECIFIC COMPONENTS (SHIMS) --- */

/* Shop / License */
.shop-header-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.clinical-tile-layout { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.tile-col-left { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 60px; border-right: 1px solid var(--border-color); padding-right: 18px; }
.support-card-success { 
    background: var(--status-success-bg); 
    border: 1px solid #dcfce7; 
    transition: border-color 0.2s ease;
}
.support-card-success:hover { 
    border-color: var(--status-success); 
}
.support-card-success .metric-label,
.support-card-success .metric-value,
.support-card-success .metric-sub,
.support-card-success .sl-icon {
    color: rgb(21, 128, 61);
}

/* Tag / Product / OFF */
.action-card-clinical {
    background: var(--bg-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: visible;
}
.action-card-clinical > *:first-child {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}
.action-card-clinical > *:last-child {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}
.action-card-body {
    position: relative;
    overflow: visible;
}
.action-card-header {
    background: #f1f5f9;
    padding: 9px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: none;
}
.action-card-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.action-card-footer-specs {
    background: #f8fafc;
    padding: 9px 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

/* EAN Auto-complete Dropdown */
.ean-dropdown {
    position: absolute;
    top: 100%;
    left: 18px;
    right: 18px;
    z-index: 9999;
    background: var(--bg-surface, #ffffff);
    border: 1px solid #94a3b8;
    border-radius: 0px;
    box-shadow: none;
    max-height: 320px;
    overflow-y: auto;
    display: none;
    margin-top: 2px;
}
.ean-dropdown-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background-color: var(--bg-surface, #ffffff);
}
.ean-dropdown-item:hover {
    background-color: var(--bg-slate-50, #f8fafc);
}
.ean-dropdown-item:last-child {
    border-bottom: none;
}
.ean-dropdown-name {
    font-weight: 600;
    font-size: 12px;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.ean-dropdown-brand {
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 0 0 110px;
    margin-left: 6px;
}
.ean-dropdown-ean {
    font-size: 10px;
    color: #64748b;
    flex: 0 0 100px;
    text-align: left;
    margin-left: 6px;
}
.ean-dropdown-price {
    font-weight: 600;
    font-size: 11px;
    color: #0f172a;
    flex: 0 0 65px;
    text-align: right;
    margin-left: 6px;
}
.ean-dropdown-empty {
    padding: 10px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.modal-off { max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.off-grid { display: grid; grid-template-columns: max-content 1fr; gap: 18px; }

/* Dashboard / Analytics */
.hours-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.schedule-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 0 6px 0; background: #f8fafc; border-radius: 12px; text-align: center; border: 1px solid var(--border-color); transition: transform 0.2s; overflow: hidden; }
.schedule-item:hover { transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }
.freq-container { display: flex; align-items: flex-end; gap: 1.5px; height: 38px; width: 100%; padding: 6px 8px 0 8px; box-sizing: border-box; }
.freq-bar { flex: 1; border-radius: 2px 2px 0 0; transition: height 0.3s ease; background: #cbd5e1; height: var(--freq-h, 2px); }
.schedule-day { font-size: 0.65rem; font-weight: 700; color: var(--text-muted); text-transform: capitalize; letter-spacing: 0.05em; padding: 0 8px; }
.schedule-time { font-family: 'JetBrains Mono', monospace; font-weight: 600; font-size: 0.65rem; color: var(--text-muted); }
.freq-high { background: var(--status-danger) !important; opacity: 0.8; }
.freq-normal { background: var(--status-info) !important; opacity: 0.6; }
.timebar-ticks { display: flex; width: 100%; padding: 0 8px; box-sizing: border-box; gap: 1.5px; border-top: 1px solid #cbd5e1; margin-top: 1px; }
.tick-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.tick-line { width: 1px; height: 3px; background: #cbd5e1; margin-bottom: 1px; }
.tick-label { font-family: 'JetBrains Mono', monospace; font-size: 0.55rem; color: var(--text-muted); line-height: 1; }

@media (max-width: 1024px) {
    .hours-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 640px) {
    .hours-grid { grid-template-columns: repeat(2, 1fr); }
}
.alert-list { display: grid; grid-template-columns: repeat(auto-fill, 220px); gap: 18px; margin-top: 0; }
.alert-item { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; cursor: pointer; transition: all 0.2s; }
.alert-item:hover { border-color: var(--primary-color); background: var(--primary-light); transform: translateY(-2px); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08); }
.alert-label { display: flex; align-items: center; gap: 12px; flex: 1; }
.alert-icon-box { width: 24px; height: 24px; background: #f1f5f9; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.2s; }
.alert-item:hover .alert-icon-box { background: #fff; }
.alert-icon-box .sl-icon { width: 14px !important; height: 14px !important; background-color: var(--primary-color); }

/* Other Components */
.google-btn { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 14px; border-radius: 16px; background: var(--bg-surface); color: var(--text-main); font-weight: 700; border: 1px solid var(--border-color); transition: .2s; text-decoration: none !important; }
.google-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }

/* --- 12. MOBILE COMPONENT SCALING --- */
@media (max-width: 1024px) {
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; margin: 12px 0; min-height: auto; height: auto; }
    .card-header { height: auto; min-height: auto; flex-wrap: wrap; gap: 8px; }
    .header-actions { width: 100%; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; justify-content: flex-start; scrollbar-width: none; }
    .header-actions::-webkit-scrollbar { display: none; }
    .header-actions .btn { flex-shrink: 0; }
    .search-bar { flex-wrap: wrap; flex-direction: row; gap: 8px; }
    .search-bar .search-container { width: 100%; }
    .search-bar select.search-input, .search-bar .btn { flex: 1; width: auto; min-width: 0; height: var(--slim-height); }
    .clinical-main-card { padding: 12px; border-radius: 12px 12px 0 0; border-bottom: none; flex: 1; }
    .clinical-page-root { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
    .status-cartouche { display: none; }
    .table-responsive { overflow-x: auto; }
}

/* --- 13. GLOBAL SCROLLBAR UTILITIES --- */
.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }



/* --- 15. FIRMWARE UPDATE STATES --- */
.fw-disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
    pointer-events: none;
}
#fw-update-log {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* --- 16. MOBILE UX OVERRIDES (MAX-WIDTH: 480PX) --- */
@media (max-width: 480px) {
    /* Modal Resizing & Centering */
    .modal {
        min-width: 0 !important;
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 94vh !important;
        margin: auto !important;
        border-radius: var(--radius-md) !important;
    }
    .modal-confirm {
        min-width: 0 !important;
        width: 90vw !important;
        max-width: 90vw !important;
    }
    .modal-542, .modal-750, .modal-800, .modal-450 {
        width: 95vw !important;
        min-width: 0 !important;
        max-width: 95vw !important;
    }
    .modal-body {
        max-height: calc(85vh - 120px) !important;
        padding: 9px 12px !important;
        gap: 12px !important;
    }
    .modal-close {
        width: 38px !important;
        height: 38px !important;
    }

    /* Grids & Splits Layout Collapsing */
    .bp-modal-split {
        grid-template-columns: 1fr !important;
        border: none !important;
    }
    .bp-sidebar {
        grid-template-columns: 1fr !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-color) !important;
        padding: 12px !important;
        gap: 8px !important;
    }
    .bp-main {
        grid-template-columns: 1fr !important;
        padding: 12px !important;
        gap: 8px !important;
    }
    .product-details-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .span-2, .span-3, .span-4, .span-5, .span-6, .span-all {
        grid-column: 1 / -1 !important;
    }
    .shop-header-grid, .grid-3, .hours-grid, .grid-cols-2, .grid-cols-3, .grid-cols-4 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .staff-editor-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Field Rows Collapsing on Mobile */
    .field-row, .field-row.flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    .field-row .info-label {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        text-align: left !important;
    }

    /* Spacing Reduction */
    .stack-clinical {
        gap: 12px !important;
    }
    .gap-18 {
        gap: 10px !important;
    }
    .gap-24 {
        gap: 12px !important;
    }
    .p-18 {
        padding: 12px !important;
    }

    /* Fixed width adjustments */
    .w-110, .w-120, .w-130, .w-140, .w-150, .w-160, .w-200, .w-210, .w-300, .w-400, .w-450 {
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
    }
    
    /* Auto-complete drop down fix */
    .ean-dropdown {
        left: 12px !important;
        right: 12px !important;
    }

    /* Telemetry Header Wrapping */
    .action-card-header {
        flex-wrap: wrap !important;
        height: auto !important;
        padding: 12px 8px !important;
        gap: 8px !important;
    }
    .action-card-header .flex-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
        justify-content: flex-start !important;
        width: 100%;
    }
    .action-card-header .btn {
        flex: 1 1 calc(50% - 8px) !important;
        min-width: 0 !important;
        height: 36px !important;
    }
    .action-card-body {
        padding: 12px !important;
    }
    .action-card-body .flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .action-card-body .flex-row .flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    /* Tap Target Ergonomics & Readability */
    body {
        font-size: 0.9rem !important;
    }
    .btn, select.search-input, .search-input, select, input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="tel"], input[type="password"] {
        height: 40px !important;
        min-height: 40px !important;
        font-size: 16px !important; /* Forces 16px to prevent iOS Auto-zoom */
    }
    .btn-header {
        height: var(--slim-height) !important;
        min-height: var(--slim-height) !important;
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
        padding: 0 12px !important;
        width: max-content !important;
        min-width: 130px !important;
    }
    .tab-item {
        height: 38px !important;
        font-size: 0.85rem !important;
        padding: 0 10px !important;
        gap: 4px !important;
    }
    .clinical-tabs {
        height: auto !important;
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .page-btn {
        width: 38px !important;
        height: 38px !important;
        font-size: 0.85rem !important;
    }
    .pagination {
        gap: 4px !important;
    }
    .modal-footer, .modal-footer-compact {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 12px !important;
        height: auto !important;
    }
    .modal-footer .flex-1, .modal-footer-compact .flex-1 {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 8px !important;
    }
    .modal-footer .btn, .modal-footer-compact .btn {
        width: 100% !important;
        justify-content: center !important;
        margin: 0 !important;
    }
    .modal-footer-naked {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 12px !important;
    }
    .modal-footer-naked .btn {
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Alert details layout */
    .alert-list {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .alert-item {
        width: 100% !important;
    }

    /* Table adjustments */
    .data-table td, .data-table th {
        padding: 8px 6px !important;
        font-size: 0.8rem !important;
    }
    .data-table th {
        font-size: 0.75rem !important;
    }
    
    /* Hide decorative components on small viewports */
    .status-cartouche {
        display: none !important;
    }

    /* Nested Flex Rows inside Form Fields */
    .field-row .flex-row:not(.password-shield-wrapper) {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: 100% !important;
    }

    /* Open Food Facts Modal Optimization */
    #modal-off-result .modal-body > .section-card:first-child > .flex-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }
    #modal-off-result .off-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 4px 0 !important;
        width: 100% !important;
    }
    #modal-off-result .off-grid .info-label {
        margin-top: 6px !important;
    }
    #modal-off-result .off-grid .info-label:first-child {
        margin-top: 0 !important;
    }

    /* Shop Settings Google PlaceID row */
    #modal-settings .modal-body > .flex-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 6px !important;
    }
    #modal-settings .modal-body > .flex-row > .info-label {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        text-align: left !important;
    }

    /* Database Import Modal Footer Buttons */
    #modal-database form .flex-row.justify-end {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    #modal-database form .flex-row.justify-end .btn {
        width: 100% !important;
        margin: 0 !important;
    }
}

/* Password Visibility Toggle */
.password-shield-wrapper {
    position: relative;
    display: flex;
}
.password-shield-wrapper input[type="password"],
.password-shield-wrapper input[type="text"] {
    padding-right: 32px;
}
.btn-toggle-password {
    background: none;
    border: none;
    position: absolute;
    right: 8px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
}
.btn-toggle-password:hover {
    color: var(--text-main);
}

/* Product Details History Grid Layout */
.audit-timeline .audit-meta-grid {
    display: grid;
    grid-template-columns: max-content max-content max-content 1fr;
    gap: 4px 12px;
    align-items: center;
    margin-top: 8px;
    width: 100%;
}

.audit-timeline .audit-meta-grid.is-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.audit-timeline .audit-meta-grid.is-inline .audit-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.audit-timeline .audit-meta-grid.is-inline .pill-label {
    grid-column: auto;
    margin-left: 0;
}

.audit-timeline .audit-meta-grid.is-inline .pill-value {
    grid-column: auto;
}


.audit-timeline .audit-meta-pill {
    display: contents;
}

.audit-timeline .pill-label {
    grid-column: 1;
    font-weight: 700;
    color: #475569;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    height: 18px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    width: fit-content;
    margin-left: 0;
}

.audit-timeline .pill-value {
    grid-column: 2 / -1;
    font-size: 0.7rem;
    color: #1e293b;
    font-weight: 400;
}

.audit-timeline .pill-value-before {
    grid-column: 2;
    font-size: 0.7rem;
    color: #64748b;
    font-weight: 400;
    text-align: right;
}

.audit-timeline .pill-value-arrow {
    grid-column: 3;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    text-align: center;
}

.audit-timeline .pill-value-after {
    grid-column: 4;
    font-size: 0.7rem;
    color: #1e293b;
    font-weight: 600;
}



