/* ============================================================
   StockFlow v3 Design System
   Mobile-first · Light/Dark · Glassmorphism · Premium
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --brand-primary: #4361ee; --brand-primary-light: #6a85f2; --brand-primary-dark: #2e44b5;
    --brand-accent: #f72585; --brand-success: #06d6a0; --brand-warning: #ffd166; --brand-danger: #ef476f;
    --bg-base: #f0f2f5; --bg-surface: #ffffff; --bg-glass: rgba(255,255,255,0.72);
    --text-primary: #1a1a2e; --text-secondary: #6b7280; --text-tertiary: #9ca3af; --text-inverse: #fff;
    --border-color: #e5e7eb;
    --border-radius: 14px; --border-radius-sm: 8px; --border-radius-lg: 20px; --border-radius-full: 9999px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06); --shadow-md: 0 4px 14px rgba(0,0,0,0.08); --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px; --space-xl: 32px; --space-2xl: 48px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-size-xs: 0.75rem; --font-size-sm: 0.875rem; --font-size-base: 1rem; --font-size-lg: 1.125rem; --font-size-xl: 1.5rem; --font-size-2xl: 2rem;
    --transition-fast: 150ms cubic-bezier(0.4,0,0.2,1); --transition-base: 250ms cubic-bezier(0.4,0,0.2,1);
    --nav-height: 64px; --bottom-nav-height: 72px; --max-width: 520px;
}
[data-theme="dark"] {
    --bg-base: #0f0f1a; --bg-surface: #1a1a2e; --bg-glass: rgba(26,26,46,0.88);
    --text-primary: #f0f0f5; --text-secondary: #9ca3af; --text-tertiary: #6b7280;
    --border-color: #2d2d44;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3); --shadow-md: 0 4px 14px rgba(0,0,0,0.4); --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
}

/* Reset */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-family: var(--font-family); font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { background: var(--bg-base); color: var(--text-primary); line-height: 1.5; min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }

/* === MODE SELECTION SCREEN === */
.mode-screen { position: fixed; inset: 0; z-index: 5000; background: var(--bg-base); display: flex; align-items: center; justify-content: center; animation: fadeIn 400ms; }
.mode-screen.hidden { display: none; }
.mode-screen__inner { text-align: center; padding: var(--space-xl); width: 100%; max-width: 400px; }
.mode-screen__logo { margin-bottom: var(--space-lg); animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.mode-screen__title { font-size: var(--font-size-2xl); font-weight: 800; margin-bottom: var(--space-xs); }
.mode-screen__subtitle { color: var(--text-secondary); margin-bottom: var(--space-2xl); font-size: var(--font-size-sm); }
.mode-screen__buttons { display: flex; flex-direction: column; gap: var(--space-md); }
.mode-btn { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); padding: var(--space-xl) var(--space-lg); background: var(--bg-surface); border: 2px solid var(--border-color); border-radius: var(--border-radius-lg); cursor: pointer; transition: all var(--transition-fast); font-family: var(--font-family); color: var(--text-primary); }
.mode-btn:hover, .mode-btn:active { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(67,97,238,0.15); transform: translateY(-2px); }
.mode-btn__title { font-size: var(--font-size-lg); font-weight: 700; }
.mode-btn__desc { font-size: var(--font-size-xs); color: var(--text-secondary); }
.mode-screen__version { margin-top: var(--space-2xl); font-size: var(--font-size-xs); color: var(--text-tertiary); }

/* === APP SHELL === */
.app-shell { min-height: 100dvh; }
.app-shell.hidden { display: none; }

/* === TOP NAV === */
.top-nav { position: fixed; top: 0; left: 0; right: 0; height: var(--nav-height); background: var(--bg-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 var(--space-md); z-index: 1000; }
.top-nav__brand { display: flex; align-items: center; gap: var(--space-sm); font-weight: 800; font-size: var(--font-size-lg); color: var(--brand-primary); }
.conn-status { display: flex; align-items: center; gap: 6px; margin-left: var(--space-sm); padding: 4px 10px; background: rgba(0,0,0,0.05); border-radius: var(--border-radius-full); }
[data-theme="dark"] .conn-status { background: rgba(255,255,255,0.05); }
.conn-status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-success); position: relative; }
.conn-status--offline .conn-status__dot { background: var(--brand-danger); }
.conn-status--online .conn-status__dot::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 1.5px solid var(--brand-success); animation: pulse 2s infinite; }
.conn-status__text { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(2.5); opacity: 0; } }

.top-nav__actions { display: flex; align-items: center; gap: 2px; }

/* === BOTTOM NAV === */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottom-nav-height); background: var(--bg-glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-around; z-index: 1000; padding-bottom: env(safe-area-inset-bottom, 0); }
.bottom-nav__item { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--space-xs) var(--space-md); border-radius: var(--border-radius-sm); color: var(--text-tertiary); text-decoration: none; font-size: var(--font-size-xs); font-weight: 500; transition: all var(--transition-fast); cursor: pointer; border: none; background: none; }
.bottom-nav__item.active, .bottom-nav__item:hover { color: var(--brand-primary); }
.bottom-nav__item.active { background: rgba(67,97,238,0.1); }

/* === FAB === */
.fab { position: fixed; bottom: calc(var(--bottom-nav-height) + var(--space-md)); right: var(--space-md); width: 56px; height: 56px; border-radius: var(--border-radius-full); background: linear-gradient(135deg, var(--brand-primary), var(--brand-primary-dark)); color: #fff; border: none; cursor: pointer; box-shadow: 0 4px 20px rgba(67,97,238,0.4); z-index: 1001; display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.fab:hover { transform: scale(1.1) translateY(-2px); box-shadow: 0 6px 28px rgba(67,97,238,0.5); }
.fab:active { transform: scale(0.95); }

/* === MAIN CONTENT === */
.main-content { padding-top: calc(var(--nav-height) + var(--space-md)); padding-bottom: calc(var(--bottom-nav-height) + var(--space-md) + 60px); padding-left: var(--space-md); padding-right: var(--space-md); max-width: var(--max-width); margin: 0 auto; min-height: 100dvh; }

/* === PAGE === */
.page { animation: pageIn var(--transition-base) ease-out; }
@keyframes pageIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.page-header { margin-bottom: var(--space-lg); }
.page-title { font-size: var(--font-size-xl); font-weight: 800; line-height: 1.2; }
.page-subtitle { font-size: var(--font-size-sm); color: var(--text-secondary); margin-top: 2px; }

/* === CARDS === */
.card { background: var(--bg-surface); border-radius: var(--border-radius); border: 1px solid var(--border-color); padding: var(--space-lg); box-shadow: var(--shadow-sm); transition: all var(--transition-fast); }
.card--interactive:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* === STAT CARDS === */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.stat-card { text-align: center; padding: var(--space-md); position: relative; overflow: hidden; }
.stat-card__icon { margin-bottom: var(--space-xs); opacity: 0.9; display: flex; justify-content: center; }
.stat-card__value { font-size: var(--font-size-xl); font-weight: 800; line-height: 1.1; margin-bottom: 2px; }
.stat-card__label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }
.stat-card--gradient-blue { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; }
.stat-card--gradient-green { background: linear-gradient(135deg, #11998e, #38ef7d); color: #fff; border: none; }
.stat-card--gradient-purple { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; border: none; }
.stat-card--gradient-orange { background: linear-gradient(135deg, #f97316, #fb923c); color: #fff; border: none; }
.stat-card--gradient-blue .stat-card__value, .stat-card--gradient-blue .stat-card__label,
.stat-card--gradient-green .stat-card__value, .stat-card--gradient-green .stat-card__label,
.stat-card--gradient-purple .stat-card__value, .stat-card--gradient-purple .stat-card__label,
.stat-card--gradient-orange .stat-card__value, .stat-card--gradient-orange .stat-card__label { color: #fff; }

/* === QUICK ACTIONS === */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.quick-action { display: flex; flex-direction: column; align-items: center; gap: var(--space-sm); padding: var(--space-lg) var(--space-sm); background: var(--bg-surface); border-radius: var(--border-radius); border: 1px solid var(--border-color); cursor: pointer; transition: all var(--transition-fast); text-decoration: none; color: inherit; }
.quick-action:active { transform: scale(0.96); }
.quick-action__icon { width: 48px; height: 48px; border-radius: var(--border-radius-sm); display: flex; align-items: center; justify-content: center; }
.quick-action__icon--entry { background: rgba(6,214,160,0.12); color: var(--brand-success); }
.quick-action__icon--exit { background: rgba(239,71,111,0.12); color: var(--brand-danger); }
.quick-action__icon--invoice { background: rgba(67,97,238,0.12); color: var(--brand-primary); }
.quick-action__label { font-size: var(--font-size-sm); font-weight: 600; }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm); padding: 14px var(--space-lg); border-radius: var(--border-radius); font-family: var(--font-family); font-size: var(--font-size-base); font-weight: 600; border: none; cursor: pointer; transition: all var(--transition-fast); min-height: 52px; width: 100%; text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--brand-primary); color: var(--text-inverse); box-shadow: var(--shadow-md); }
.btn--primary:hover:not(:disabled) { background: var(--brand-primary-dark); }
.btn--success { background: var(--brand-success); color: var(--text-inverse); }
.btn--danger { background: var(--brand-danger); color: var(--text-inverse); }
.btn--ghost { background: transparent; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn--icon { width: 40px; min-height: 40px; padding: 0; border-radius: var(--border-radius-sm); background: transparent; color: var(--text-secondary); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: color var(--transition-fast); }
.btn--icon:hover { color: var(--brand-primary); }
.btn--sm { min-height: 40px; padding: 10px var(--space-md); font-size: var(--font-size-sm); }
.btn--loading { pointer-events: none; opacity: 0.8 !important; }
.btn--loading .btn__text { display: none; }
.btn--loading .spinner { display: inline-block; }

/* === INPUTS === */
.input-group { margin-bottom: var(--space-md); }
.input-group__label { display: block; font-size: var(--font-size-sm); font-weight: 600; color: var(--text-secondary); margin-bottom: var(--space-xs); }
.input { width: 100%; padding: 14px var(--space-md); border-radius: var(--border-radius); border: 1.5px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); font-family: var(--font-family); font-size: var(--font-size-base); outline: none; transition: border-color var(--transition-fast), box-shadow var(--transition-fast); min-height: 52px; appearance: none; -webkit-appearance: none; }
.input:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(67,97,238,0.12); }
select.input { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.input--search { padding-left: 44px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
.input-hint { font-size: var(--font-size-xs); color: var(--text-tertiary); margin-top: var(--space-xs); }

/* === PRODUCT LIST === */
.product-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.product-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-md) var(--space-lg); background: var(--bg-surface); border-radius: var(--border-radius); border: 1px solid var(--border-color); cursor: pointer; transition: all var(--transition-fast); text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); }
.product-item:active { transform: scale(0.98); }
.product-item__info { flex: 1; min-width: 0; }
.product-item__name { font-weight: 600; font-size: var(--font-size-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: var(--space-xs); }
.product-item__meta { display: flex; gap: var(--space-sm); align-items: center; margin-top: 3px; }
.product-item__ref { font-size: var(--font-size-xs); color: var(--text-tertiary); font-family: monospace; }
.product-item__price { font-size: var(--font-size-xs); color: var(--text-secondary); font-weight: 500; }
.product-item__stock { padding-left: var(--space-md); flex-shrink: 0; }

/* === TOGGLE GROUP === */
.toggle-group { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); margin-bottom: var(--space-lg); }
.toggle-btn { padding: var(--space-md); border-radius: var(--border-radius); border: 2px solid var(--border-color); background: var(--bg-surface); font-family: var(--font-family); font-size: var(--font-size-base); font-weight: 600; cursor: pointer; transition: all var(--transition-fast); text-align: center; display: flex; align-items: center; justify-content: center; gap: var(--space-sm); color: var(--text-primary); }
.toggle-btn.active--entry { border-color: var(--brand-success); background: rgba(6,214,160,0.08); color: var(--brand-success); }
.toggle-btn.active--exit { border-color: var(--brand-danger); background: rgba(239,71,111,0.08); color: var(--brand-danger); }

/* === QTY SELECTOR === */
.qty-selector { display: flex; align-items: center; gap: var(--space-md); justify-content: center; margin: var(--space-md) 0; }
.qty-selector__btn { width: 52px; height: 52px; border-radius: var(--border-radius-full); border: 2px solid var(--border-color); background: var(--bg-surface); color: var(--text-primary); font-size: var(--font-size-xl); font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--transition-fast); }
.qty-selector__btn:active { transform: scale(0.9); }
.qty-selector__value { font-size: var(--font-size-2xl); font-weight: 800; min-width: 64px; text-align: center; }

/* === SERIAL LIST === */
.serial-list { display: flex; flex-direction: column; gap: var(--space-xs); margin-top: var(--space-sm); }
.serial-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) var(--space-md); background: rgba(67,97,238,0.06); border-radius: var(--border-radius-sm); font-size: var(--font-size-sm); font-family: monospace; font-weight: 500; }
.serial-item__remove { background: none; border: none; color: var(--brand-danger); cursor: pointer; font-size: var(--font-size-base); padding: 2px 6px; }

/* === SECTION HEADER === */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-md); }
.section-header__title { font-size: var(--font-size-lg); font-weight: 700; }
.section-header__action { font-size: var(--font-size-sm); color: var(--brand-primary); font-weight: 600; text-decoration: none; cursor: pointer; background: none; border: none; }

/* === TOAST === */
.toast-container { position: fixed; top: calc(var(--nav-height) + var(--space-md)); left: var(--space-md); right: var(--space-md); z-index: 2000; display: flex; flex-direction: column; gap: var(--space-sm); pointer-events: none; max-width: var(--max-width); margin: 0 auto; }
.toast { padding: var(--space-md) var(--space-lg); border-radius: var(--border-radius); font-weight: 600; font-size: var(--font-size-sm); animation: toastIn var(--transition-base) ease-out; pointer-events: auto; display: flex; align-items: center; gap: var(--space-sm); box-shadow: var(--shadow-lg); }
.toast--success { background: var(--brand-success); color: #fff; }
.toast--error { background: var(--brand-danger); color: #fff; }
.toast--info { background: var(--brand-primary); color: #fff; }
.toast__icon { width: 28px; height: 28px; border-radius: var(--border-radius-full); background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: var(--font-size-base); flex-shrink: 0; }
@keyframes toastIn { from { opacity:0; transform:translateY(-20px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(-20px); } }

/* === MOVEMENT ITEMS === */
.movement-item { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-md) 0; border-bottom: 1px solid var(--border-color); }
.movement-item:last-child { border-bottom: none; }
.movement-item__icon { width: 36px; height: 36px; border-radius: var(--border-radius-full); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-weight: 700; font-size: var(--font-size-sm); }
.movement-item__icon--in { background: rgba(6,214,160,0.12); color: var(--brand-success); }
.movement-item__icon--out { background: rgba(239,71,111,0.12); color: var(--brand-danger); }
.movement-item__info { flex: 1; min-width: 0; }
.movement-item__label { font-weight: 500; font-size: var(--font-size-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.movement-item__date { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.movement-item__qty { font-weight: 700; flex-shrink: 0; font-size: var(--font-size-sm); }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--border-radius-full); font-size: var(--font-size-xs); font-weight: 600; line-height: 1.4; }
.badge--success { background: rgba(6,214,160,0.15); color: #059669; }
.badge--danger { background: rgba(239,71,111,0.15); color: var(--brand-danger); }
.badge--warning { background: rgba(255,209,102,0.2); color: #b8860b; }
.badge--info { background: rgba(67,97,238,0.12); color: var(--brand-primary); }

/* === INVOICE === */
.invoice-line { display: flex; align-items: center; justify-content: space-between; padding: var(--space-sm) 0; border-bottom: 1px solid var(--border-color); font-size: var(--font-size-sm); }
.invoice-line__remove { color: var(--brand-danger); cursor: pointer; background: none; border: none; font-size: var(--font-size-lg); padding: var(--space-xs); }
.invoice-total-row { display: flex; justify-content: space-between; padding: var(--space-sm) 0; font-size: var(--font-size-sm); }
.invoice-total-row--total { border-top: 2px solid var(--border-color); padding-top: var(--space-md); font-size: var(--font-size-lg); font-weight: 800; }
.verifactu-badge { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); background: rgba(6,214,160,0.1); border: 1px solid rgba(6,214,160,0.3); border-radius: var(--border-radius-sm); font-size: var(--font-size-xs); font-weight: 600; color: #059669; margin-top: var(--space-md); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-lg); color: var(--text-tertiary); display: flex; flex-direction: column; align-items: center; gap: var(--space-md); }
.empty-state__icon { opacity: 0.3; }
.empty-state__text { font-size: var(--font-size-sm); font-weight: 500; opacity: 0.8; }

/* SKELETON */
.skeleton { background: linear-gradient(90deg, var(--border-color) 25%, var(--bg-base) 50%, var(--border-color) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--border-radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton--text { height: 16px; width: 70%; margin-bottom: var(--space-sm); }
.skeleton--title { height: 32px; width: 50%; margin-bottom: var(--space-lg); }
.skeleton--card { height: 100px; margin-bottom: var(--space-sm); border-radius: var(--border-radius); opacity: 0.6; }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1500; display: flex; align-items: flex-end; justify-content: center; animation: fadeIn var(--transition-fast); }
.modal-overlay.hidden { display: none; }
.modal { background: var(--bg-surface); border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0; padding: var(--space-lg); width: 100%; max-width: var(--max-width); max-height: 85vh; overflow-y: auto; animation: slideUp var(--transition-base); }
.modal__handle { width: 40px; height: 4px; background: var(--border-color); border-radius: 2px; margin: 0 auto var(--space-lg); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* === SCANNER === */
.scanner-area { width: 100%; aspect-ratio: 4/3; background: #000; border-radius: var(--border-radius); overflow: hidden; position: relative; }
.scanner-area video { width: 100%; height: 100%; object-fit: cover; }
.scanner-area__overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.scanner-area__guide { width: 60%; height: 40%; border: 2px solid var(--brand-primary); border-radius: var(--border-radius-sm); box-shadow: 0 0 0 9999px rgba(0,0,0,0.4); }

/* === SPINNER === */
.spinner { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 800ms linear infinite; }
.spinner--lg { width: 48px; height: 48px; border-width: 4px; border-top-color: var(--brand-primary); margin-bottom: var(--space-md); display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === OVERLAYS (Hardening) === */
.loader-overlay, .success-overlay { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: var(--space-lg); }
.loader-overlay { background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.success-overlay { background: var(--bg-base); }
.loader-card, .success-card { background: var(--bg-surface); border-radius: var(--border-radius-lg); padding: var(--space-2xl); text-align: center; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); animation: scaleIn 300ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.loader-card__text { font-weight: 700; color: var(--text-primary); font-size: var(--font-size-lg); }
.success-card__icon { width: 80px; height: 80px; background: rgba(6,214,160,0.15); color: var(--brand-success); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto var(--space-lg); }
.success-card__icon svg { width: 44px; height: 44px; }
.success-card__title { font-size: var(--font-size-xl); font-weight: 800; margin-bottom: var(--space-xs); }
.success-card__message { color: var(--text-secondary); margin-bottom: var(--space-lg); }
.success-card__content { margin-bottom: var(--space-xl); text-align: left; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* === UTILITIES === */
.mt-sm { margin-top: var(--space-sm); } .mt-md { margin-top: var(--space-md); } .mt-lg { margin-top: var(--space-lg); }
.mb-md { margin-bottom: var(--space-md); } .mb-lg { margin-bottom: var(--space-lg); }
.text-center { text-align: center; } .text-secondary { color: var(--text-secondary); }
.text-success { color: var(--brand-success); } .text-danger { color: var(--brand-danger); } .text-accent { color: var(--brand-primary); font-weight: 600; }
.fw-bold { font-weight: 700; } .hidden { display: none !important; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 2px; }

/* v3.2 Audit & Status */
.status-indicator { display: flex; align-items: center; gap: 6px; background: rgba(0,0,0,0.05); padding: 4px 10px; border-radius: 20px; }
[data-theme="dark"] .status-indicator { background: rgba(255,255,255,0.05); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot--online { background: var(--brand-success); box-shadow: 0 0 8px var(--brand-success); }
.status-dot--offline { background: var(--brand-danger); }

.audit-item { display: flex; align-items: center; gap: var(--space-md); padding: var(--space-sm); border-bottom: 1px solid var(--border-color); animation: fadeIn 0.3s ease; }
.audit-item:last-child { border-bottom: none; }
.audit-item__status { width: 6px; height: 6px; border-radius: 50%; }
.audit-item__status--success { background: var(--brand-success); }
.audit-item__status--error { background: var(--brand-danger); }
.audit-item__info { flex: 1; min-width: 0; }
.audit-item__action { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }
.audit-item__detail { font-size: 0.65rem; color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-item__time { font-size: 0.65rem; font-weight: 500; color: var(--text-secondary); opacity: 0.7; }

.card--ghost { background: transparent; border: 1px dashed var(--border-color); box-shadow: none; }
