/* =========================================================
   ХОДИМЛАРНИ САМАРАДОРЛИК KPI НАЗОРАТ ТИЗИМИ
   Design System v2.0
   ========================================================= */


/* =========================================================
   1. VARIABLES
   ========================================================= */

:root {
    --primary: #49677f;
    --primary-hover: #3d5a70;
    --primary-dark: #354f63;
    --primary-soft: #edf3f7;

    --sidebar-bg: #45657c;
    --sidebar-bg-dark: #3b596e;
    --sidebar-text: rgba(255,255,255,.86);
    --sidebar-muted: rgba(255,255,255,.60);

    --background: #f5f7f9;
    --surface: #ffffff;
    --surface-soft: #f9fafb;
    --surface-hover: #f7f9fa;

    --text: #2f3742;
    --text-secondary: #56616d;
    --text-muted: #7c8792;
    --text-light: #9aa3ac;

    --border: #e0e5e9;
    --border-strong: #ccd5dc;

    --success: #3f8f62;
    --success-dark: #30734d;
    --success-bg: #edf7f1;
    --success-border: #a7d1b6;

    --danger: #bf5a5a;
    --danger-dark: #9f4444;
    --danger-bg: #fbefef;
    --danger-border: #dfaaaa;

    --warning: #a88142;
    --warning-dark: #876731;
    --warning-bg: #faf5e9;
    --warning-border: #dfc998;

    --info: #557b98;
    --info-bg: #edf4f8;

    --sidebar-width: 250px;
    --topbar-height: 66px;

    --radius-small: 7px;
    --radius: 11px;
    --radius-large: 15px;

    --shadow-small:
        0 2px 8px rgba(35,50,65,.04);

    --shadow:
        0 5px 20px rgba(35,50,65,.06);

    --shadow-large:
        0 12px 35px rgba(35,50,65,.09);
}


/* =========================================================
   2. RESET
   ========================================================= */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    width: 100%;
    min-height: 100vh;
    overflow-x: hidden;

    background: var(--background);
    color: var(--text);

    font-family:
        "Segoe UI",
        Arial,
        sans-serif;

    font-size: 14px;

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}


/* =========================================================
   3. APP
   ========================================================= */

.app-body {
    min-height: 100vh;
}

.app-shell {
    width: 100%;
    min-height: 100vh;
}


/* =========================================================
   4. SIDEBAR
   ========================================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;

    width: var(--sidebar-width);

    display: flex;
    flex-direction: column;

    overflow: hidden;

    background:
        linear-gradient(
            180deg,
            var(--sidebar-bg) 0%,
            var(--sidebar-bg-dark) 100%
        );

    color: #ffffff;

    transition:
        transform .2s ease;
}


/* =========================================================
   5. BRAND
   ========================================================= */

.sidebar-brand {
    min-height: 86px;
    padding: 10px 12px;

    display: flex;
    align-items: center;
    gap: 10px;

    overflow: hidden;

    border-bottom:
        1px solid rgba(255,255,255,.10);

    text-decoration: none;
}

.sidebar-logo {
    width: 52px;
    height: 52px;

    min-width: 52px;
    max-width: 52px;

    min-height: 52px;
    max-height: 52px;

    flex: 0 0 52px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;
}

.sidebar-logo img {
    display: block;

    width: 52px !important;
    height: 52px !important;

    min-width: 52px !important;
    max-width: 52px !important;

    min-height: 52px !important;
    max-height: 52px !important;

    object-fit: contain;
}

.sidebar-brand-text {
    min-width: 0;
    flex: 1;

    display: block;
}

.sidebar-brand .brand-title {
    display: block;

    margin: 0;

    color: #ffffff;

    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
}

.sidebar-brand .brand-subtitle {
    display: block;

    margin-top: 4px;

    color: var(--sidebar-muted);

    font-size: 8.5px;
    line-height: 1.25;
}


/* =========================================================
   6. NAVIGATION
   ========================================================= */

.sidebar-nav {
    flex: 1;

    padding: 15px 10px 24px;

    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 10px;
}

.nav-section-title {
    padding: 8px 10px 7px;

    color: rgba(255,255,255,.45);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: .08em;
}

.nav-link {
    min-height: 43px;

    margin: 3px 0;
    padding: 9px 11px;

    display: flex;
    align-items: center;
    gap: 11px;

    border-radius: 9px;

    color: var(--sidebar-text);

    text-decoration: none;

    transition:
        background .15s ease,
        color .15s ease,
        transform .15s ease;
}

.nav-link:hover {
    background: rgba(255,255,255,.09);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(255,255,255,.96);
    color: var(--primary-dark);

    font-weight: 700;

    box-shadow:
        0 2px 6px rgba(15,30,40,.08);
}

.nav-link.disabled {
    opacity: .42;
    cursor: default;
    pointer-events: none;
}

.nav-icon {
    width: 22px;
    flex: 0 0 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;
}

.nav-label {
    min-width: 0;
}


/* =========================================================
   7. MAIN AREA
   ========================================================= */

.main-area {
    width:
        calc(
            100% - var(--sidebar-width)
        );

    min-height: 100vh;

    margin-left:
        var(--sidebar-width);
}


/* =========================================================
   8. TOPBAR
   ========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;

    width: 100%;
    min-height: var(--topbar-height);

    padding: 0 22px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;

    background: rgba(255,255,255,.97);

    border-bottom:
        1px solid var(--border);

    backdrop-filter: blur(7px);
}

.topbar-left {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-heading {
    margin: 0;

    color: var(--text);

    font-size: 18px;
    font-weight: 700;
    line-height: 1.25;
}


/* =========================================================
   9. USER
   ========================================================= */

.user-chip {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 9px;
}

.user-avatar {
    width: 38px;
    height: 38px;

    flex: 0 0 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--primary-soft);
    color: var(--primary);

    font-size: 14px;
    font-weight: 800;
}

.user-meta {
    min-width: 0;
    line-height: 1.15;
}

.user-name {
    max-width: 265px;

    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;

    color: var(--text);

    font-size: 12px;
    font-weight: 700;
}

.user-role {
    margin-top: 4px;

    color: var(--text-muted);

    font-size: 10px;
}


/* =========================================================
   10. CONTENT
   ========================================================= */

.content {
    width: 100%;
    padding: 22px;
}

.page-container {
    width: 100%;
    max-width: 1440px;

    margin: 0 auto;
}


/* =========================================================
   11. CARDS
   ========================================================= */

.card {
    width: 100%;

    background: var(--surface);

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 18px;
}

.card-header {
    min-height: 62px;

    padding: 16px 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    border-bottom:
        1px solid var(--border);
}

.card-title {
    margin: 0;

    color: var(--text);

    font-size: 15px;
    font-weight: 700;
}

.card-subtitle {
    margin-top: 5px;

    color: var(--text-muted);

    font-size: 11px;
    line-height: 1.45;
}

.card-body {
    padding: 18px;
}


/* =========================================================
   12. STATS
   ========================================================= */

.stats-grid {
    width: 100%;
    margin-bottom: 18px;

    display: grid;

    grid-template-columns:
        repeat(4, minmax(0,1fr));

    gap: 14px;
}

.stat-card {
    min-width: 0;

    padding: 17px;

    background: var(--surface);

    border:
        1px solid var(--border);

    border-radius: var(--radius);

    box-shadow: var(--shadow);
}

.stat-label {
    color: var(--text-muted);

    font-size: 11px;
    font-weight: 600;
}

.stat-value {
    margin-top: 7px;

    color: var(--text);

    font-size: 27px;
    font-weight: 800;

    letter-spacing: -.02em;
}

.stat-note {
    margin-top: 5px;

    color: var(--text-light);

    font-size: 10px;
    line-height: 1.35;
}


/* =========================================================
   13. QUICK LINKS
   ========================================================= */

.quick-grid {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(3, minmax(0,1fr));

    gap: 13px;
}

.quick-link {
    display: block;

    padding: 15px;

    border:
        1px solid var(--border);

    border-radius: 9px;

    background: var(--surface-soft);

    color: var(--text);

    text-decoration: none;

    transition:
        transform .15s ease,
        background .15s ease,
        border-color .15s ease,
        box-shadow .15s ease;
}

a.quick-link:hover {
    transform: translateY(-1px);

    background: #ffffff;

    border-color: #c2ccd4;

    box-shadow: var(--shadow-small);
}

.quick-link-title {
    font-size: 12.5px;
    font-weight: 700;
}

.quick-link-desc {
    margin-top: 5px;

    color: var(--text-muted);

    font-size: 10.5px;
    line-height: 1.45;
}


/* =========================================================
   14. FORMS
   ========================================================= */

.form-grid {
    width: 100%;

    display: grid;

    grid-template-columns:
        repeat(2, minmax(0,1fr));

    gap: 15px;
}

.form-group {
    min-width: 0;
}

.form-group label {
    display: block;

    margin-bottom: 7px;

    color: var(--text-secondary);

    font-size: 11px;
    font-weight: 700;
}

.form-control {
    width: 100%;
    min-height: 42px;

    padding: 9px 11px;

    border:
        1px solid var(--border-strong);

    border-radius: var(--radius-small);

    outline: none;

    background: #ffffff;
    color: var(--text);

    font-size: 13px;

    transition:
        border-color .15s ease,
        box-shadow .15s ease,
        background .15s ease;
}

.form-control:focus {
    border-color: #8ba7ba;

    box-shadow:
        0 0 0 3px rgba(73,103,127,.10);
}

.form-control:disabled {
    background: #f1f3f5;
    color: var(--text-muted);

    cursor: not-allowed;
}

.form-control::placeholder {
    color: #abb3bb;
}

.form-hint {
    margin-top: 5px;

    color: var(--text-muted);

    font-size: 10px;
    line-height: 1.35;
}

input[type="file"].form-control {
    padding: 7px 9px;
}


/* =========================================================
   15. BUTTONS
   ========================================================= */

.btn {
    min-height: 40px;

    padding: 9px 15px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;

    border:
        1px solid transparent;

    border-radius: 8px;

    cursor: pointer;

    text-decoration: none;

    font-size: 12px;
    font-weight: 700;

    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .15s ease;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text-secondary);

    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-soft);
    border-color: var(--border-strong);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: var(--success-dark);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: var(--danger-dark);
}

.btn:disabled {
    opacity: .56;
    cursor: not-allowed;
}

.btn:not(:disabled):active {
    transform: translateY(1px);
}


/* =========================================================
   16. TABLES
   ========================================================= */

.table-toolbar {
    width: 100%;
    margin-bottom: 12px;

    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.table-wrap {
    width: 100%;

    overflow: auto;

    border:
        1px solid var(--border);

    border-radius: 9px;

    background: #ffffff;
}

.data-table {
    width: 100%;

    border-collapse: collapse;

    background: #ffffff;
    color: var(--text);

    font-size: 12px;
}

.data-table th,
.data-table td {
    padding: 9px 10px;

    border-bottom:
        1px solid var(--border);

    vertical-align: middle;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;

    background: #f1f4f6;
    color: #4c5863;

    text-align: left;

    font-size: 10.5px;
    font-weight: 700;

    white-space: nowrap;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: #fafbfc;
}

.data-table tr.row-positive {
    background: #f5faf7;
}

.data-table tr.row-negative {
    background: #fdf6f6;
}

.plan-input,
.fact-input {
    min-width: 100px;
    max-width: 130px;
}


/* =========================================================
   17. HELPERS
   ========================================================= */

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success-dark);
}

.text-danger {
    color: var(--danger-dark);
}

.text-warning {
    color: var(--warning-dark);
}


/* =========================================================
   18. BADGES
   ========================================================= */

.badge {
    min-height: 23px;

    padding: 3px 8px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    white-space: nowrap;

    font-size: 10px;
    font-weight: 700;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-dark);

    border:
        1px solid var(--success-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-dark);

    border:
        1px solid var(--danger-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-dark);

    border:
        1px solid var(--warning-border);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}


/* =========================================================
   19. ALERTS
   ========================================================= */

.alert {
    padding: 11px 13px;

    border-radius: 8px;

    font-size: 12px;
    line-height: 1.45;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-dark);

    border:
        1px solid var(--success-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-dark);

    border:
        1px solid var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-dark);

    border:
        1px solid var(--warning-border);
}


/* =========================================================
   20. TOAST
   ========================================================= */

.toast {
    position: fixed;

    top: 80px;
    right: 22px;

    z-index: 3000;

    min-width: 300px;
    max-width: 520px;

    padding: 13px 15px;

    display: none;

    border-radius: 9px;

    box-shadow:
        0 8px 26px rgba(35,50,65,.13);

    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

.toast.show {
    display: block;
}

.toast-success {
    background: var(--success-bg);
    color: var(--success-dark);

    border:
        1px solid var(--success-border);
}

.toast-error {
    background: var(--danger-bg);
    color: var(--danger-dark);

    border:
        1px solid var(--danger-border);
}

.toast-warning {
    background: var(--warning-bg);
    color: var(--warning-dark);

    border:
        1px solid var(--warning-border);
}


/* =========================================================
   21. MOBILE SIDEBAR
   ========================================================= */

.mobile-menu-button {
    width: 40px;
    height: 40px;

    display: none;

    align-items: center;
    justify-content: center;

    border:
        1px solid var(--border);

    border-radius: 8px;

    background: #ffffff;
    color: var(--text);

    cursor: pointer;
}

.sidebar-overlay {
    display: none;
}


/* =========================================================
   22. RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {

    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0,1fr));
    }

    .quick-grid {
        grid-template-columns:
            repeat(2, minmax(0,1fr));
    }
}


@media (max-width: 900px) {

    .sidebar {
        transform:
            translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform:
            translateX(0);
    }

    .main-area {
        width: 100%;
        margin-left: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;

        z-index: 950;

        border: 0;

        background:
            rgba(25,35,45,.27);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .user-name {
        max-width: 180px;
    }
}


@media (max-width: 700px) {

    .topbar {
        padding: 0 14px;
    }

    .content {
        padding: 14px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .quick-grid {
        grid-template-columns: 1fr;
    }

    .user-meta {
        display: none;
    }

    .page-heading {
        font-size: 16px;
    }

    .card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .card-header .btn {
        width: 100%;
    }

    .topbar-logout {
        padding-left: 11px;
        padding-right: 11px;
    }
}


@media (max-width: 520px) {

    .content {
        padding: 10px;
    }

    .card-body {
        padding: 14px;
    }

    .card-header {
        padding: 14px;
    }

    .toast {
        left: 12px;
        right: 12px;

        min-width: 0;
        max-width: none;
    }

    .sidebar {
        width: 235px;
    }
}


/* =========================================================
   23. PRINT
   ========================================================= */

@media print {

    .sidebar,
    .topbar,
    .mobile-menu-button,
    .sidebar-overlay,
    .btn,
    .toast {
        display: none !important;
    }

    .main-area {
        width: 100%;
        margin: 0;
    }

    .content {
        padding: 0;
    }

    .card,
    .stat-card {
        box-shadow: none;

        border:
            1px solid #cccccc;
    }

    body {
        background: #ffffff;
    }
}
