/* =========================================================
   MMIR — Metal Markaz Enterprise ERP Design System
   Modern 2026 UI / UX Engine
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.85);
    --surface-elevated: #ffffff;
    --ink: #0f172a;
    --ink-secondary: #475569;
    --muted: #64748b;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    
    /* Brand & Functional Colors */
    --primary: #ea580c;
    --primary-light: #f97316;
    --primary-dark: #c2410c;
    --primary-subtle: #fff4ec;
    
    --accent: #2563eb;
    --accent-light: #3b82f6;
    --accent-subtle: #eff6ff;
    
    --warning: #d97706;
    --warning-subtle: #fffbeb;
    
    --danger: #dc2626;
    --danger-subtle: #fef2f2;
    
    --sidebar-bg: #262a30;
    --sidebar-surface: #2e3238;
    --sidebar-active: rgba(249, 115, 22, 0.15);
    --sidebar-line: rgba(255, 255, 255, 0.08);

    /* Elevation & Radii */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 4px 12px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 35px -8px rgba(15, 23, 42, 0.12), 0 10px 15px -7px rgba(15, 23, 42, 0.06);
    --shadow-glow-green: 0 8px 25px rgba(249, 115, 22, 0.28);
    --shadow-glow-blue: 0 8px 25px rgba(37, 99, 235, 0.25);
    
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 26px;
    
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --transition: all 0.22s var(--ease);
}

/* Base resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background-color: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.035) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(37, 99, 235, 0.035) 0px, transparent 50%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* Role-based permissions enforcement */
body.role-worker .admin-only {
    display: none !important;
}

/* Shrift & Form element base */
button, input, select, textarea {
    font-family: inherit;
}

::selection {
    background: rgba(249, 115, 22, 0.2);
    color: #c2410c;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ---------- Loader Overlay ---------- */
.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 15, 17, 0.78);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}
.spinner-box {
    position: relative;
    width: 104px;
    height: 104px;
    display: grid;
    place-items: center;
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.logo-loader-text {
    position: relative;
    z-index: 2;
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: #fff;
}
.pulse-ring {
    position: absolute;
    inset: 12px;
    border: 2px solid var(--primary-light);
    border-radius: 50%;
    animation: mmirPulse 1.4s ease-out infinite;
}
@keyframes mmirPulse {
    0% { transform: scale(0.7); opacity: 0.9; }
    70% { transform: scale(1.08); opacity: 0.15; }
    100% { transform: scale(1.15); opacity: 0; }
}

/* ---------- Modern Toast Notification ---------- */
.custom-toast {
    position: fixed;
    right: 28px;
    top: 24px;
    z-index: 100000;
    min-width: 320px;
    max-width: min(440px, calc(100vw - 32px));
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    background: var(--ink);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: translateY(-25px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
    font-weight: 600;
    font-size: 0.92rem;
}
.custom-toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}
.custom-toast.toast-success {
    background: linear-gradient(135deg, #9a3412, #c2410c);
    border-color: #f97316;
}
.custom-toast.toast-error {
    background: linear-gradient(135deg, #991b1b, #b91c1c);
    border-color: #ef4444;
}
.custom-toast.toast-warning {
    background: linear-gradient(135deg, #92400e, #b45309);
    border-color: #f59e0b;
}

/* ---------- Auth Screen ---------- */
/* Login sahifasi: logo bilan brend foni */
.auth-wrapper {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at 28% 45%, rgba(255, 255, 255, 0.10), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(148, 163, 184, 0.12), transparent 45%),
        linear-gradient(135deg, #22252b 0%, #2f343b 55%, #414750 100%);
}
/* Metall panjara naqshi */
.auth-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    pointer-events: none;
}
/* Katta xira emblema — burchakdan chiqib turadi */
.auth-wrapper::after {
    content: "";
    position: absolute;
    right: -6vw;
    bottom: -10vh;
    width: min(55vw, 640px);
    aspect-ratio: 455 / 398;
    background: url("assets/logo-watermark.png?v=5") no-repeat center / contain;
    opacity: 0.05;
    filter: blur(1px);
    pointer-events: none;
}
.auth-layout {
    position: relative;
    z-index: 1;
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    align-items: center;
    gap: 56px;
}
.auth-brand {
    text-align: center;
    animation: authBrandIn 0.8s var(--ease);
}
.auth-brand-logo {
    width: min(360px, 100%);
    height: auto;
    filter: drop-shadow(0 14px 34px rgba(0, 0, 0, 0.5));
}
.auth-brand-tagline {
    margin: 22px auto 0;
    max-width: 340px;
    color: rgba(226, 232, 240, 0.72);
    font-size: 0.98rem;
    line-height: 1.6;
}
@keyframes authBrandIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: none; }
}
.auth-subtitle {
    color: rgba(226, 232, 240, 0.6);
}
@media (max-width: 860px) {
    .auth-layout {
        grid-template-columns: 1fr;
        gap: 28px;
        justify-items: center;
    }
    .auth-brand-logo {
        width: min(220px, 60vw);
    }
    .auth-brand-tagline {
        margin-top: 14px;
        font-size: 0.88rem;
    }
}
.auth-card {
    width: min(420px, 100%);
    padding: 40px 32px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 35px 80px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    animation: authCardIn 0.5s var(--ease);
}
@keyframes authCardIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: none; }
}
.logo-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    color: #fff;
    background: linear-gradient(135deg, #f97316, #ea580c);
    box-shadow: var(--shadow-glow-green);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.08em;
}
.auth-card .form-control {
    min-height: 48px;
    color: #fff;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
}
.auth-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}
.auth-card .form-control:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
    border-color: #fb923c;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
}
.password-input-wrapper {
    position: relative;
}
.btn-toggle-eye {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.btn-toggle-eye:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* ---------- App Shell Structure ---------- */
#app-layout {
    min-height: 100vh;
    display: flex;
}
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: 260px;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    color: #fff;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-line);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.12);
    transition: transform 0.3s var(--ease);
}
.logo-container {
    padding: 6px 10px 20px;
    text-align: center;
    border-bottom: 1px solid var(--sidebar-line);
}
.sidebar .logo-box {
    font-size: 1.1rem;
    padding: 8px 16px;
}
/* Yon paneldagi logotip */
.sidebar-logo {
    display: block;
    width: 150px;
    max-width: 100%;
    height: auto;
    margin: 4px auto 0;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.45));
    transition: transform 0.3s var(--ease), filter 0.3s var(--ease);
}
.sidebar-logo:hover {
    transform: scale(1.03);
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.4));
}
/* Ish sahifalari fonida juda xira emblema (suv belgisi) */
.main-wrapper {
    position: relative;
}
.main-wrapper::before {
    content: "";
    position: fixed;
    right: 3vw;
    bottom: 4vh;
    width: 360px;
    aspect-ratio: 455 / 398;
    background: url("assets/logo-watermark.png?v=5") no-repeat center / contain;
    opacity: 0.035;
    pointer-events: none;
    z-index: 0;
}
.main-content {
    position: relative;
    z-index: 1;
}
/* Yuklanish animatsiyasidagi emblema */
.loader-emblem {
    position: relative;
    z-index: 2;
    width: 60px;
    height: auto;
    animation: loaderEmblem 1.2s ease-in-out infinite;
}
@keyframes loaderEmblem {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.75; }
}
.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--primary);
}
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 18px;
    overflow-y: auto;
}
.nav-btn {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    background: transparent;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.nav-btn i {
    width: 20px;
    text-align: center;
    font-size: 0.95rem;
}
.nav-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(3px);
}
.nav-btn[class*="active-"] {
    color: #fff;
    background: var(--sidebar-active);
    border-color: rgba(249, 115, 22, 0.25);
    box-shadow: inset 3px 0 0 var(--primary-light);
}
.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--sidebar-line);
}

/* ---------- Topbar Header ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.mobile-nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 1.1rem;
}
.page-header-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--ink);
    margin: 0;
    letter-spacing: -0.02em;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-clock {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ink-secondary);
    font-family: "JetBrains Mono", monospace;
}
.topbar-clock i {
    color: var(--primary);
}

/* ---------- Main Content Layout ---------- */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.main-content {
    flex: 1;
    padding: 28px 32px 60px;
}
.page-section {
    display: none;
}
.page-section.active {
    display: block;
    animation: pageFadeIn 0.3s var(--ease);
}
@keyframes pageFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Dashboard KPI Cards ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.kpi-card {
    position: relative;
    overflow: hidden;
    padding: 22px 24px;
    border-radius: var(--radius-lg);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
}
.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}
.kpi-card.kpi-green::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.kpi-card.kpi-blue::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.kpi-card.kpi-amber::before { background: linear-gradient(90deg, #d97706, #fbbf24); }
.kpi-card.kpi-danger::before { background: linear-gradient(90deg, #dc2626, #f87171); }

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.kpi-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kpi-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 1.15rem;
}
.kpi-green .kpi-icon { background: var(--primary-subtle); color: var(--primary); }
.kpi-blue .kpi-icon { background: var(--accent-subtle); color: var(--accent); }
.kpi-amber .kpi-icon { background: var(--warning-subtle); color: var(--warning); }
.kpi-danger .kpi-icon { background: var(--danger-subtle); color: var(--danger); }

.kpi-value {
    font-size: clamp(1rem, 1.2vw, 1.6rem);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
    white-space: nowrap;
}
.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--ink-secondary);
    font-weight: 500;
}

/* Quick Action Buttons on Dashboard */
.quick-actions-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.btn-quick-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}
.btn-quick-action:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* ---------- Custom Cards & Surfaces ---------- */
.custom-card, .list-container {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: var(--shadow-sm);
    padding: 26px;
    margin-bottom: 24px;
    transition: box-shadow 0.25s ease;
}
.custom-card:hover {
    box-shadow: var(--shadow-md);
}
.card-header-clean {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    gap: 12px;
}
.card-header-clean h4, .card-header-clean h5 {
    margin: 0;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
}

/* ---------- Form Controls ---------- */
.form-control, .form-select {
    min-height: 44px;
    border-radius: var(--radius-sm);
    border: 1.5px solid #cbd5e1;
    color: var(--ink);
    background-color: #fff;
    font-size: 0.92rem;
    font-weight: 500;
    transition: var(--transition);
}
.form-control:hover, .form-select:hover {
    border-color: #94a3b8;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3.5px rgba(249, 115, 22, 0.15);
    background-color: #fff;
}
.form-control[readonly] {
    background-color: #f1f5f9;
    color: #334155;
    font-weight: 700;
}
.form-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* ---------- Buttons & Actions ---------- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 10px 18px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}
.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0) scale(0.98);
}
.btn-green {
    color: #fff !important;
    background: linear-gradient(135deg, #ea580c, #f97316) !important;
    border: 0 !important;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}
.btn-green:hover {
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.45);
    filter: brightness(1.05);
}
.btn-orange {
    color: #fff !important;
    background: linear-gradient(135deg, #ea580c, #f97316) !important;
    border: 0 !important;
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.3);
}
.btn-orange:hover {
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
}
.btn-blue {
    color: #fff !important;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6) !important;
    border: 0 !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.btn-outline-custom {
    background: #fff;
    border: 1.5px solid var(--line);
    color: var(--ink-secondary);
}
.btn-outline-custom:hover {
    background: var(--bg);
    border-color: var(--ink-secondary);
    color: var(--ink);
}

/* ---------- Tables & Data Grids ---------- */
.table-responsive {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    overflow: hidden;
}
.table {
    margin-bottom: 0;
    vertical-align: middle;
}
.table thead th {
    padding: 13px 16px;
    background: linear-gradient(180deg, #2a2d33, #1a1b1f) !important;
    color: #f8fafc;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 0;
    white-space: nowrap;
}
/* Ixcham jadval: ko'p ustunli ro'yxatlar konteyner kengligiga sig'ishi uchun */
.table.table-fit {
    font-size: 0.9rem;
}
.table.table-fit thead th {
    white-space: normal;
    padding: 10px 8px;
    line-height: 1.25;
}
.table.table-fit tbody td {
    padding: 9px 8px;
}
.table.table-fit .price-stack {
    line-height: 1.35;
}
.table.table-fit .price-stack div {
    white-space: nowrap;
}

/* Qora sarlavhadagi izohlar (masalan, ish haqi narxi) o'qiladigan bo'lsin */
.table thead th .text-muted,
.table thead th small {
    color: #fed7aa !important;
    font-weight: 600 !important;
    text-transform: none;
}
.table tbody td {
    padding: 14px 16px;
    border-color: #f1f5f9;
    font-size: 0.9rem;
}
.table-hover tbody tr {
    transition: background 0.15s ease;
}
.table-hover tbody tr:hover {
    background-color: #f8fafc !important;
}
.clickable-row {
    cursor: pointer;
}
.clickable-row:hover td {
    background-color: #f0fdf4 !important;
}

/* Low Stock Alert Row */
.row-low-stock {
    background-color: #fff1f2 !important;
}
.row-low-stock td {
    color: var(--danger) !important;
    font-weight: 600;
}
.pulse-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    background: #fee2e2;
    color: #b91c1c;
}
.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: blinkDot 1.2s ease-in-out infinite;
}
@keyframes blinkDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* ---------- Tabs Component ---------- */
.tab-bar {
    display: flex;
    overflow-x: auto;
    border-bottom: 1.5px solid var(--line);
    background: #f8fafc;
    border-radius: var(--radius) var(--radius) 0 0;
}
.ombor-tab, .worker-tab {
    position: relative;
    padding: 14px 22px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}
.ombor-tab:hover, .worker-tab:hover {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.6);
}
.ombor-tab.active, .worker-tab.active {
    color: var(--primary-dark);
    background: #fff;
}
.ombor-tab.active::after, .worker-tab.active::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 3px;
    border-radius: 999px;
    background: var(--primary);
}
.ombor-content, .worker-tab-content {
    display: none;
}
.ombor-content.active, .worker-tab-content.active {
    display: block;
    animation: tabContentIn 0.25s var(--ease);
}
@keyframes tabContentIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Dynamic BOM & Operations Builder ---------- */
.bom-row, .job-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    border: 1px solid var(--line);
    margin-bottom: 8px;
    transition: var(--transition);
}
.bom-row:hover, .job-row:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.btn-remove-row {
    width: 34px;
    height: 34px;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    color: #dc2626;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}
.btn-remove-row:hover {
    background: #fee2e2;
    color: #b91c1c;
    transform: scale(1.05);
}

/* ---------- Production Workbench ---------- */
#production-workbench {
    border: 1.5px solid #cbd5e1 !important;
    background: #ffffff !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-md) !important;
}
.material-requirement-card {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--line);
    margin-bottom: 12px;
}
.material-status-tag {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}
.material-status-tag.status-ok {
    background: #dcfce7;
    color: #166534;
}
.material-status-tag.status-missing {
    background: #fee2e2;
    color: #991b1b;
}

/* ---------- Worker Cards & Stats ---------- */
.worker-row {
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}
.worker-row:hover {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: var(--shadow-sm);
}
.worker-avatar-chip {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    color: var(--primary);
    background: var(--primary-subtle);
    font-weight: 800;
}
.stat-card-box {
    padding: 18px 22px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

/* ---------- Modals ---------- */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}
.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.custom-modal-box {
    width: min(560px, 100%);
    max-height: min(90vh, 920px);
    overflow-y: auto;
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    background: #fff;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.3s var(--ease);
}
.custom-modal-overlay.active .custom-modal-box {
    transform: translateY(0) scale(1);
}
.modal-details-box {
    width: min(920px, 100%);
}

/* ---------- Print Styles for Worker Payslip / Reports ---------- */
@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }
    .sidebar, .topbar, .btn, .tab-bar, .modal, .loader-overlay, .custom-toast {
        display: none !important;
    }
    .main-wrapper {
        margin-left: 0 !important;
    }
    .main-content {
        padding: 0 !important;
    }
    .custom-card, .list-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        padding: 15px !important;
    }
    .table thead th {
        background: #333 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
    }
    .print-only {
        display: block !important;
    }
}

/* ---------- Responsive Layout (Tablets & Mobile) ---------- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        width: 270px;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .mobile-nav-toggle {
        display: grid;
        place-items: center;
    }
    .topbar {
        padding: 0 18px;
    }
    .main-content {
        padding: 18px 16px 50px;
    }
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 14px;
    }
}

@media (max-width: 640px) {
    .topbar-clock {
        display: none;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .worker-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }
    .worker-row > div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    .bom-row, .job-row {
        flex-wrap: wrap;
    }
    .card-header-clean {
        flex-direction: column;
        align-items: flex-start;
    }
}
/* ---------- Menyu papkalari (Ustaxona, Savdo bo'limi) ---------- */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle .nav-caret {
    margin-left: auto;
    width: auto;
    font-size: 0.72rem;
    transition: transform 0.25s ease;
    opacity: 0.7;
}
.nav-group.open > .nav-group-toggle .nav-caret { transform: rotate(180deg); }
.nav-group.has-active > .nav-group-toggle { color: #fff; }
.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 2px;
    margin: 2px 0 6px 22px;
    padding-left: 10px;
    border-left: 1px dashed rgba(148, 163, 184, 0.28);
}
.nav-group.open > .nav-group-items { display: flex; }
.nav-btn.nav-sub { padding: 9px 12px; font-size: 0.84rem; }
.nav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.07);
}
.nav-btn[class*="active-"] .nav-num { color: #121316; background: #fb923c; }
.nav-count {
    margin-left: auto;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: #dc2626;
}

/* ---------- Ishlab chiqarish: bo'lim nom yonida, katta qidiruv ---------- */
.card-header-clean.production-search-head { justify-content: flex-start; }
.production-cat-select { width: 190px; height: 48px; border-radius: 14px; }
.big-search { position: relative; flex: 1 1 320px; min-width: 240px; }
.big-search > i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.05rem;
    pointer-events: none;
}
.big-search input {
    height: 48px;
    padding-left: 48px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
}
.production-empty-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 34px 16px;
    color: #64748b;
    font-weight: 600;
    text-align: left;
}
.production-empty-hint i { font-size: 1.6rem; color: #94a3b8; }
@media (max-width: 768px) {
    .production-cat-select { width: 100%; }
    .card-header-clean.production-search-head { align-items: stretch; }
}

/* Savdo oynalari kengroq — tugmalar bir qatorga sig'adi */
#checkout-modal .custom-modal-box,
#debt-modal .custom-modal-box { width: min(860px, 100%); max-width: 860px !important; }
