/* Mobileri CRM — Professional App Design System */
:root {
    --sidebar-width: 280px;
    --sidebar-collapsed: 84px;
    --mobile-nav-height: 68px;
    --topbar-height: 72px;
    --brand-950: #020617;
    --brand-900: #0f172a;
    --brand-800: #1e293b;
    --brand-700: #334155;
    --brand-600: #2563eb;
    --brand-500: #3b82f6;
    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-text: #475569;
    --sidebar-text-active: #1e40af;
    --sidebar-hover: #f1f5f9;
    --sidebar-active-bg: #eff6ff;
    --surface-0: #ffffff;
    --surface-1: #f8fafc;
    --surface-2: #f1f5f9;
    --surface-3: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 8px 24px rgba(15, 23, 42, .06);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, .10);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, .16);
    --transition: .22s cubic-bezier(.4, 0, .2, 1);
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body.app-body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: radial-gradient(circle at top right, rgba(59,130,246,.08), transparent 28%), linear-gradient(180deg, var(--surface-1) 0%, var(--surface-2) 100%);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .9375rem;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: #1d4ed8; }
.app-loader { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; background: rgba(248,250,252,.92); backdrop-filter: blur(8px); transition: opacity .35s ease, visibility .35s ease; }
.app-loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.app-loader-inner { text-align: center; }
.app-loader-bar { width: 120px; height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 1rem auto 0; }
.app-loader-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--brand-500), var(--brand-600)); border-radius: inherit; animation: loaderSlide 1s ease-in-out infinite; }
@keyframes loaderSlide { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.wrapper { min-height: 100vh; min-height: 100dvh; position: relative; }
.main-content { min-width: 0; }
.sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); background: var(--sidebar-bg); border-right: 1px solid var(--sidebar-border); min-height: 100dvh; position: sticky; top: 0; height: 100dvh; z-index: 1040; flex-shrink: 0; transition: width var(--transition), min-width var(--transition), transform var(--transition); box-shadow: 1px 0 0 rgba(15,23,42,.04), 4px 0 24px rgba(15,23,42,.04); }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: var(--topbar-height); padding: 1rem 1.1rem; border-bottom: 1px solid var(--sidebar-border); background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); }
.sidebar-brand-link { display: flex; align-items: center; gap: .85rem; min-width: 0; color: var(--text-primary); }
.sidebar-brand-link:hover { color: var(--brand-600); opacity: 1; }
.sidebar-logo { flex-shrink: 0; border-radius: 12px; box-shadow: 0 4px 14px rgba(37,99,235,.18); }
.sidebar-brand-text { display: block; font-size: .98rem; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.sidebar-brand-sub { display: block; font-size: .72rem; color: var(--text-muted); font-weight: 500; }
.sidebar-scroll { padding: .85rem .75rem 1rem; }
.sidebar-section-title { font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); padding: 1.15rem .85rem .45rem; }
.sidebar-link { display: flex; align-items: center; gap: .85rem; padding: .72rem .85rem; margin-bottom: .18rem; border-radius: var(--radius-sm); color: var(--sidebar-text); font-size: .9rem; font-weight: 500; transition: background var(--transition), color var(--transition), transform var(--transition); }
.sidebar-link:hover { background: var(--sidebar-hover); color: var(--text-primary); transform: translateX(2px); }
.sidebar-link.active { background: var(--sidebar-active-bg); color: var(--sidebar-text-active); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-600); }
.sidebar-link-icon { width: 1.35rem; display: inline-flex; justify-content: center; flex-shrink: 0; color: var(--text-muted); }
.sidebar-link.active .sidebar-link-icon { color: var(--brand-600); }
.sidebar-link-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer { padding: .85rem; border-top: 1px solid var(--sidebar-border); background: #f8fafc; }
.sidebar-footer-card { display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; border-radius: var(--radius-sm); background: #fff; border: 1px solid var(--sidebar-border); color: var(--sidebar-text); font-size: .78rem; }
.sidebar-footer-card strong { display: block; color: var(--text-primary); font-size: .82rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.35); backdrop-filter: blur(2px); z-index: 1035; }
.sidebar-overlay.show { display: block; }
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); min-width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar-brand-copy, body.sidebar-collapsed .sidebar-link-text, body.sidebar-collapsed .sidebar-section-title, body.sidebar-collapsed .sidebar-footer-card div { display: none; }
body.sidebar-collapsed .sidebar-brand-link, body.sidebar-collapsed .sidebar-link, body.sidebar-collapsed .sidebar-footer-card { justify-content: center; }
body.sidebar-collapsed #sidebarCollapse i { transform: rotate(180deg); }
@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); }
    .sidebar.open { transform: translateX(0); }
    body.sidebar-collapsed .sidebar { width: var(--sidebar-width); min-width: var(--sidebar-width); }
    body.sidebar-collapsed .sidebar-brand-copy, body.sidebar-collapsed .sidebar-link-text, body.sidebar-collapsed .sidebar-section-title, body.sidebar-collapsed .sidebar-footer-card div { display: block; }
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--topbar-height); padding: .85rem 1.25rem; background: rgba(255,255,255,.82); backdrop-filter: blur(16px); border-bottom: 1px solid rgba(226,232,240,.95); position: sticky; top: 0; z-index: 1020; }
.topbar-start, .topbar-end { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.topbar-title { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.03em; }
.breadcrumb { margin-top: .15rem; font-size: .78rem; --bs-breadcrumb-divider: '›'; }
.btn-icon, .btn-ghost { width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-secondary); padding: 0; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--surface-3); color: var(--text-primary); }
.btn-user { display: inline-flex; align-items: center; gap: .75rem; padding: .35rem .55rem .35rem .35rem; border: 1px solid var(--surface-3); border-radius: 999px; background: var(--surface-0); box-shadow: var(--shadow-xs); }
.user-name { display: block; font-size: .84rem; font-weight: 700; }
.user-role { display: block; font-size: .72rem; color: var(--text-muted); }
.avatar-sm { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-600), var(--brand-500)); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .88rem; font-weight: 800; }
.topbar-badge { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .65rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 2px solid #fff; }
.app-dropdown { border: 1px solid var(--surface-3); border-radius: var(--radius); padding: .35rem; min-width: 240px; box-shadow: var(--shadow-md) !important; }
.app-dropdown .dropdown-item { border-radius: 10px; padding: .65rem .85rem; display: flex; align-items: center; gap: .65rem; }
.page-content { padding: 1.35rem 1.35rem calc(1.35rem + var(--mobile-nav-height)); animation: fadeInUp .35s ease; }
@media (min-width: 992px) { .page-content { padding-bottom: 1.75rem; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.35rem; }
.page-header h1, .page-header h2 { margin: 0; font-size: clamp(1.25rem, 2vw, 1.55rem); font-weight: 800; letter-spacing: -.03em; }
.card { background: var(--surface-0); border: 1px solid rgba(226,232,240,.95); border-radius: var(--radius); box-shadow: var(--shadow-xs); overflow: hidden; }
.card-header { background: transparent; border-bottom: 1px solid var(--surface-3); padding: 1rem 1.2rem; font-weight: 700; }
.stat-card { border: 1px solid rgba(226,232,240,.95); transition: transform var(--transition), box-shadow var(--transition); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--brand-600); }
.stat-card.success::before { background: var(--success); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.info::before { background: var(--info); }
.stat-card.dark::before { background: var(--brand-900); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.stat-card .stat-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; }
.stat-card .stat-value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat-card .stat-label { color: var(--text-secondary); font-size: .82rem; margin-top: .35rem; font-weight: 500; }
.table-wrapper { overflow-x: auto; border-radius: var(--radius-sm); }
.table thead th { background: var(--surface-1); font-weight: 700; color: var(--text-secondary); font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--surface-3); white-space: nowrap; padding: .9rem 1rem; }
.table tbody td { padding: .9rem 1rem; vertical-align: middle; border-bottom: 1px solid rgba(226,232,240,.75); }
.table tbody tr:hover { background: rgba(248,250,252,.85); }
.btn { border-radius: 12px; font-size: .875rem; font-weight: 600; padding: .55rem 1rem; }
.btn-primary { background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); border: none; box-shadow: 0 8px 20px rgba(37,99,235,.22); }
.btn-primary:hover { background: linear-gradient(180deg, #4f8ff7, #1d4ed8); transform: translateY(-1px); }
.form-control, .form-select { border: 1px solid var(--surface-3); border-radius: 12px; min-height: 44px; font-size: .9rem; padding: .65rem .9rem; }
.form-control:focus, .form-select:focus { border-color: rgba(37,99,235,.55); box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.form-label { font-weight: 600; font-size: .84rem; color: var(--text-secondary); }
.badge { font-size: .72rem; font-weight: 700; padding: .38em .72em; border-radius: 999px; }
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.alert { border: none; border-radius: var(--radius-sm); box-shadow: var(--shadow-xs); }
.mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom)); padding: .45rem .35rem calc(.45rem + env(safe-area-inset-bottom)); display: flex; background: rgba(255,255,255,.92); backdrop-filter: blur(18px); border-top: 1px solid rgba(226,232,240,.95); z-index: 1030; box-shadow: 0 -8px 30px rgba(15,23,42,.08); }
.mobile-nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; border: none; background: transparent; color: var(--text-muted); font-size: .68rem; font-weight: 600; border-radius: 12px; padding: .35rem .2rem; }
.mobile-nav-item.active { color: var(--brand-600); background: rgba(37,99,235,.08); }
.login-page { min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: var(--brand-950); }
@media (min-width: 992px) { .login-page { grid-template-columns: 1.05fr 1fr; } }
.login-hero { display: none; position: relative; overflow: hidden; padding: 3rem; color: #fff; }
@media (min-width: 992px) { .login-hero { display: flex; flex-direction: column; justify-content: space-between; } }
.login-hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 20%, rgba(59,130,246,.35), transparent 35%), linear-gradient(160deg, #020617 0%, #0f172a 45%, #172554 100%); }
.login-hero > * { position: relative; z-index: 1; }
.login-hero-brand { display: flex; align-items: center; gap: 1rem; }
.login-hero-brand img { width: 56px; height: 56px; border-radius: 16px; }
.login-hero-brand h1 { margin: 0; font-size: 1.5rem; font-weight: 800; }
.login-hero-content h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; font-weight: 800; max-width: 12ch; }
.login-hero-features { display: grid; gap: .85rem; margin-top: 2rem; }
.login-feature { display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; border-radius: var(--radius); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.login-feature i { width: 38px; height: 38px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: rgba(37,99,235,.18); color: #93c5fd; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(180deg, var(--surface-1), var(--surface-0)); }
.login-card { width: 100%; max-width: 440px; background: rgba(255,255,255,.92); border: 1px solid rgba(226,232,240,.95); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.login-card-header { padding: 2rem 2rem 1rem; text-align: center; }
.login-card-header .logo-wrap { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 18px; display: grid; place-items: center; background: linear-gradient(180deg, var(--brand-500), var(--brand-600)); box-shadow: 0 16px 30px rgba(37,99,235,.28); }
.login-card-header .logo-wrap i { color: #fff; font-size: 1.6rem; }
.login-card-header h2 { margin: 0; font-size: 1.45rem; font-weight: 800; }
.login-body { padding: 0 2rem 2rem; }
.login-install-hint { margin-top: 1rem; padding: .85rem 1rem; border-radius: var(--radius-sm); background: var(--surface-1); border: 1px dashed var(--surface-3); font-size: .82rem; color: var(--text-secondary); display: none; }
.login-install-hint.show { display: block; }
.app-toast-stack { z-index: 9999; }
.toast-item { min-width: 300px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); animation: slideInRight .35s ease; }
@keyframes slideInRight { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.search-box { position: relative; }
.search-box .form-control { padding-left: 2.4rem; }
.search-box .search-icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.production-timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.production-timeline::before { content: ''; position: absolute; left: 1.15rem; top: 0; bottom: 0; width: 2px; background: var(--surface-3); }
.timeline-item { display: flex; gap: 1rem; padding-bottom: 1.25rem; }
.timeline-icon { width: 2.25rem; height: 2.25rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; border: 2px solid var(--surface-3); }
.timeline-icon.done { background: var(--success); color: #fff; border-color: var(--success); }
.timeline-icon.active { background: var(--info); color: #fff; border-color: var(--info); }
.timeline-icon.blocked { background: var(--danger); color: #fff; border-color: var(--danger); }
.timeline-icon.pending { background: #fff; color: var(--text-muted); }
.order-detail-header { background: linear-gradient(135deg, var(--brand-900), #1e3a8a); color: #fff; border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.35rem; }
.order-number-badge { background: rgba(255,255,255,.12); border-radius: 999px; padding: .3rem .8rem; font-size: .84rem; font-weight: 700; display: inline-block; margin-bottom: .5rem; }
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--text-muted); }
.empty-state i { font-size: 2.6rem; opacity: .28; margin-bottom: .85rem; display: block; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.btn-xs { font-size: .72rem; padding: .22rem .55rem; border-radius: 8px; }
.bg-opacity-15 { --bs-bg-opacity: .15; }
.bom-table .qty-input { max-width: 90px; }
.select2-container--bootstrap-5 .select2-selection { border-color: var(--surface-3); border-radius: 12px; min-height: 44px; }
@media (max-width: 575.98px) { .page-content { padding: 1rem 1rem calc(1rem + var(--mobile-nav-height)); } .stat-card .stat-value { font-size: 1.45rem; } }
@media print { .sidebar, .topbar, .mobile-nav, .sidebar-overlay, #toastContainer, #appLoader { display: none !important; } .page-content { padding: 0 !important; } }
@media (display-mode: standalone) { .topbar { padding-top: calc(.85rem + env(safe-area-inset-top)); } }

/* Product images */
.product-thumb { width: 52px; height: 52px; border-radius: 12px; overflow: hidden; border: 1px solid var(--surface-3); background: var(--surface-1); flex-shrink: 0; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-thumb-placeholder { display: grid; place-items: center; color: var(--brand-600); background: linear-gradient(135deg, #eff6ff, #f8fafc); font-size: 1.15rem; }
.product-photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
@media (max-width: 575.98px) { .product-photo-grid { grid-template-columns: repeat(2, 1fr); } }
.product-photo-slot { position: relative; }
.product-photo-input { position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none; }
.product-photo-label { display: block; cursor: pointer; margin: 0; }
.product-photo-preview { aspect-ratio: 1; border: 2px dashed var(--surface-3); border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; background: var(--surface-1); color: var(--text-muted); font-size: .72rem; font-weight: 600; overflow: hidden; transition: border-color var(--transition), background var(--transition); }
.product-photo-preview i { font-size: 1.25rem; color: var(--brand-600); }
.product-photo-preview img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.product-photo-slot.has-image .product-photo-preview { border-style: solid; border-color: rgba(37,99,235,.25); position: relative; }
.product-photo-slot:hover .product-photo-preview { border-color: var(--brand-500); background: #eff6ff; }
.product-photo-remove { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border: none; border-radius: 50%; background: rgba(220,38,38,.92); color: #fff; display: grid; place-items: center; font-size: .7rem; cursor: pointer; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,.15); }

/* Dashboard product carousel */
.product-showcase .card-header { background: linear-gradient(180deg, #fff, #f8fafc); }
.product-carousel { position: relative; padding: 1.25rem 3rem 2.5rem; }
.product-carousel-viewport { overflow: hidden; border-radius: var(--radius); }
.product-carousel-track { display: flex; transition: transform .55s cubic-bezier(.4, 0, .2, 1); will-change: transform; }
.product-carousel-slide { flex: 0 0 100%; min-width: 0; padding: 0 .5rem; }
.product-carousel-card { display: grid; grid-template-columns: minmax(200px, 340px) 1fr; gap: 1.5rem; align-items: center; padding: 1.25rem; background: linear-gradient(135deg, #f8fafc 0%, #ffffff 55%, #eff6ff 100%); border: 1px solid var(--surface-3); border-radius: var(--radius-lg); min-height: 220px; }
@media (max-width: 767.98px) { .product-carousel-card { grid-template-columns: 1fr; text-align: center; } .product-carousel { padding: 1rem 2.75rem 2.25rem; } }
.product-carousel-thumb { width: 100%; aspect-ratio: 4/3; border-radius: var(--radius); font-size: 2.5rem; box-shadow: var(--shadow-sm); }
.product-carousel-thumb img { object-fit: cover; }
.product-carousel-code { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-600); background: rgba(37,99,235,.1); padding: .25rem .65rem; border-radius: 999px; margin-bottom: .5rem; }
.product-carousel-title { margin: 0 0 .65rem; font-size: clamp(1.15rem, 2vw, 1.55rem); font-weight: 800; letter-spacing: -.03em; color: var(--text-primary); }
.product-carousel-desc { color: var(--text-secondary); font-size: .9rem; margin-bottom: 1rem; line-height: 1.6; }
.product-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 1px solid var(--surface-3); border-radius: 50%; background: #fff; color: var(--text-secondary); display: grid; place-items: center; cursor: pointer; z-index: 2; box-shadow: var(--shadow-xs); transition: background var(--transition), color var(--transition), border-color var(--transition); }
.product-carousel-nav:hover { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.product-carousel-prev { left: .75rem; }
.product-carousel-next { right: .75rem; }
.product-carousel-dots { display: flex; justify-content: center; gap: .45rem; margin-top: 1rem; }
.product-carousel-dot { width: 8px; height: 8px; border-radius: 999px; border: none; padding: 0; background: var(--surface-3); cursor: pointer; transition: width var(--transition), background var(--transition); }
.product-carousel-dot.active { width: 24px; background: var(--brand-600); }
