/* =========================================================
   Zakazlar.Ru — Design System
   Mustaqil (CDN yo'q), light/dark, responsive.
   ========================================================= */

/* ---------- 1. TOKENS ---------- */

:root {
    /* Neutrals */
    --bg:            #f5f6fa;
    --bg-glow:       rgba(99, 102, 241, .10);
    --surface:       #ffffff;
    --surface-2:     #f8f9fc;
    --surface-3:     #eef0f6;
    --border:        rgba(15, 23, 42, .09);
    --border-strong: rgba(15, 23, 42, .16);

    /* Text */
    --text:          #0f172a;
    --text-muted:    #5b6577;
    --text-faint:    #8b94a6;

    /* Brand */
    --accent:        #4f46e5;
    --accent-hover:  #4338ca;
    --accent-soft:   rgba(79, 70, 229, .10);
    --accent-ring:   rgba(79, 70, 229, .28);
    --on-accent:     #ffffff;

    /* Semantic */
    --success:       #059669;
    --success-soft:  rgba(5, 150, 105, .11);
    --warning:       #b45309;
    --warning-soft:  rgba(180, 83, 9, .12);
    --danger:        #e11d48;
    --danger-soft:   rgba(225, 29, 72, .10);
    --info:          #0369a1;
    --info-soft:     rgba(3, 105, 161, .10);

    /* Zakaz kategoriyalari (karta ikonkalari) */
    --tone-web:     #0284c7;
    --tone-app:     #7c3aed;
    --tone-bot:     #0891b2;
    --tone-quiz:    #be123c;
    --tone-slide:   #c026d3;
    --tone-doc:     #4f46e5;
    --tone-book:    #b45309;
    --tone-food:    #ea580c;
    --tone-design:  #db2777;
    --tone-money:   #0f766e;
    --tone-code:    #475569;
    --tone-default: #64748b;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, .08), 0 2px 4px rgba(15, 23, 42, .04);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, .14), 0 4px 10px rgba(15, 23, 42, .06);
    --shadow-xl: 0 30px 70px rgba(15, 23, 42, .20);

    /* Geometry */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-full: 999px;

    --sidebar-w: 268px;
    --topbar-h: 66px;

    --ease: cubic-bezier(.4, 0, .2, 1);
    --ease-out: cubic-bezier(.16, 1, .3, 1);

    color-scheme: light;
}

/* Dark — sistema tanlovi (foydalanuvchi "light" ni majburlamagan bo'lsa) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:            #0a0d16;
        --bg-glow:       rgba(99, 102, 241, .16);
        --surface:       #121727;
        --surface-2:     #171d31;
        --surface-3:     #1e263d;
        --border:        rgba(148, 163, 184, .13);
        --border-strong: rgba(148, 163, 184, .24);

        --text:          #e8ecf6;
        --text-muted:    #9aa5bd;
        --text-faint:    #6f7b94;

        --accent:        #7c74f5;
        --accent-hover:  #918bf8;
        --accent-soft:   rgba(124, 116, 245, .16);
        --accent-ring:   rgba(124, 116, 245, .38);
        --on-accent:     #ffffff;

        --success:       #34d399;
        --success-soft:  rgba(52, 211, 153, .14);
        --warning:       #fbbf24;
        --warning-soft:  rgba(251, 191, 36, .14);
        --danger:        #fb7185;
        --danger-soft:   rgba(251, 113, 133, .14);
        --info:          #38bdf8;
        --info-soft:     rgba(56, 189, 248, .13);

        --tone-web:     #38bdf8;
        --tone-app:     #a78bfa;
        --tone-bot:     #22d3ee;
        --tone-quiz:    #fb7185;
        --tone-slide:   #e879f9;
        --tone-doc:     #818cf8;
        --tone-book:    #fbbf24;
        --tone-food:    #fb923c;
        --tone-design:  #f472b6;
        --tone-money:   #2dd4bf;
        --tone-code:    #94a3b8;
        --tone-default: #94a3b8;

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
        --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
        --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
        --shadow-xl: 0 30px 70px rgba(0, 0, 0, .7);

        color-scheme: dark;
    }
}

/* Dark — foydalanuvchi tanlovi (tugma orqali) */
:root[data-theme="dark"] {
    --bg:            #0a0d16;
    --bg-glow:       rgba(99, 102, 241, .16);
    --surface:       #121727;
    --surface-2:     #171d31;
    --surface-3:     #1e263d;
    --border:        rgba(148, 163, 184, .13);
    --border-strong: rgba(148, 163, 184, .24);

    --text:          #e8ecf6;
    --text-muted:    #9aa5bd;
    --text-faint:    #6f7b94;

    --accent:        #7c74f5;
    --accent-hover:  #918bf8;
    --accent-soft:   rgba(124, 116, 245, .16);
    --accent-ring:   rgba(124, 116, 245, .38);
    --on-accent:     #ffffff;

    --success:       #34d399;
    --success-soft:  rgba(52, 211, 153, .14);
    --warning:       #fbbf24;
    --warning-soft:  rgba(251, 191, 36, .14);
    --danger:        #fb7185;
    --danger-soft:   rgba(251, 113, 133, .14);
    --info:          #38bdf8;
    --info-soft:     rgba(56, 189, 248, .13);

    --tone-web:     #38bdf8;
    --tone-app:     #a78bfa;
    --tone-bot:     #22d3ee;
    --tone-quiz:    #fb7185;
    --tone-slide:   #e879f9;
    --tone-doc:     #818cf8;
    --tone-book:    #fbbf24;
    --tone-food:    #fb923c;
    --tone-design:  #f472b6;
    --tone-money:   #2dd4bf;
    --tone-code:    #94a3b8;
    --tone-default: #94a3b8;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, .5);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, .6);
    --shadow-xl: 0 30px 70px rgba(0, 0, 0, .7);

    color-scheme: dark;
}


/* ---------- 2. BASE ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI Variable Display", "Segoe UI", Inter, ui-sans-serif,
                 system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv02", "cv03", "cv04", "tnum" 0;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-weight: 660;
    letter-spacing: -.02em;
    line-height: 1.25;
    color: var(--text);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.16rem; }
h4 { font-size: 1.02rem; }

p { margin: 0 0 .75rem; }

a { color: var(--accent); text-decoration: none; transition: color .16s var(--ease); }
a:hover { color: var(--accent-hover); }

svg.ico { flex: none; vertical-align: -.18em; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-full);
    border: 3px solid var(--bg);
}


/* ---------- 3. APP SHELL ---------- */

.app { min-height: 100vh; }

/* Yumshoq fon nuri */
.app::before {
    content: "";
    position: fixed;
    inset: -30% -10% auto -10%;
    height: 620px;
    background: radial-gradient(60% 60% at 50% 0%, var(--bg-glow), transparent 72%);
    pointer-events: none;
    z-index: 0;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 16px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    z-index: 60;
    transition: transform .32s var(--ease-out);
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 4px 8px 22px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.06rem;
    letter-spacing: -.03em;
}
.brand:hover { color: var(--text); }

.brand-mark {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #6366f1, #4f46e5 45%, #7c3aed);
    box-shadow: 0 4px 14px rgba(79, 70, 229, .38), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.brand-sub {
    display: block;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
    line-height: 1;
    margin-top: 3px;
}

.nav-label {
    padding: 14px 10px 6px;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    color: var(--text-muted);
    font-weight: 550;
    font-size: .93rem;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item .ico { opacity: .82; }

.nav-item.is-active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 640;
}
.nav-item.is-active .ico { opacity: 1; }
.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: -16px;
    top: 50%;
    translate: 0 -50%;
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-count {
    margin-left: auto;
    min-width: 22px;
    height: 21px;
    padding: 0 7px;
    display: grid;
    place-items: center;
    font-size: .72rem;
    font-weight: 700;
    border-radius: var(--r-full);
    background: var(--surface-3);
    color: var(--text-muted);
}
.nav-item.is-active .nav-count { background: var(--accent); color: #fff; }

.sidebar-foot { margin-top: auto; padding-top: 14px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text);
    text-align: left;
    transition: border-color .16s var(--ease), background .16s var(--ease);
}
.user-chip:hover { border-color: var(--border-strong); background: var(--surface-3); color: var(--text); }
.user-chip .u-name {
    font-weight: 620;
    font-size: .88rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-chip .u-role { font-size: .74rem; color: var(--text-faint); line-height: 1.2; }

/* --- Avatar --- */
.avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: var(--r-full);
    color: #fff;
    font-weight: 700;
    font-size: .92rem;
    letter-spacing: -.02em;
    background: linear-gradient(140deg, var(--a1), var(--a2));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.avatar.lg { width: 68px; height: 68px; font-size: 1.7rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .78rem; }

.h0  { --a1: #6366f1; --a2: #8b5cf6; }
.h1  { --a1: #0ea5e9; --a2: #2563eb; }
.h2  { --a1: #10b981; --a2: #059669; }
.h3  { --a1: #f59e0b; --a2: #ea580c; }
.h4  { --a1: #f43f5e; --a2: #be123c; }
.h5  { --a1: #8b5cf6; --a2: #6d28d9; }
.h6  { --a1: #06b6d4; --a2: #0891b2; }
.h7  { --a1: #84cc16; --a2: #4d7c0f; }
.h8  { --a1: #ec4899; --a2: #a21caf; }
.h9  { --a1: #14b8a6; --a2: #0f766e; }
.h10 { --a1: #f97316; --a2: #c2410c; }
.h11 { --a1: #64748b; --a2: #334155; }

/* --- Main column --- */
.app-main {
    position: relative;
    z-index: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .32s var(--ease-out);
}

/* Desktopda yon panelni yig'ish (topbar'dagi menyu tugmasi orqali).
   Holat <html> ga qo'yiladi — head'dagi skript uni bo'yalishdan
   oldin tiklaydi, shunda sahifa almashganda miltillash bo'lmaydi. */
@media (min-width: 992px) {
    :root.nav-collapsed .sidebar  { transform: translateX(-100%); }
    :root.nav-collapsed .app-main { margin-left: 0; }
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 clamp(16px, 3vw, 34px);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-bottom: 1px solid var(--border);
}

/* Sarlavha qisqarsin — aks holda topbar tor ekranda sig'may,
   butun sahifa gorizontal siljib ketadi. */
.topbar h1 {
    font-size: 1.12rem;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar .col { min-width: 0; }
.topbar .sub { font-size: .78rem; color: var(--text-faint); line-height: 1.2; }
.topbar-spacer { margin-left: auto; }

.page {
    flex: 1;
    width: 100%;
    max-width: 1340px;
    padding: clamp(20px, 3vw, 32px) clamp(16px, 3vw, 34px) 56px;
}

.foot {
    padding: 20px clamp(16px, 3vw, 34px) 28px;
    border-top: 1px solid var(--border);
    color: var(--text-faint);
    font-size: .82rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
}

/* Mobile drawer */
.scrim {
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(8, 11, 20, .5);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s var(--ease), visibility .28s;
}
body.nav-open .scrim { opacity: 1; visibility: visible; }

/* Scrim faqat mobil drawer uchun — desktopda hech qachon ko'rinmasin
   (mobilda ochib turib oynani kengaytirgan holat uchun). */
@media (min-width: 992px) {
    .scrim { display: none; }
}


/* ---------- 4. BUTTONS ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: .89rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
    cursor: pointer;
    transition: background .16s var(--ease), border-color .16s var(--ease),
                color .16s var(--ease), transform .12s var(--ease), box-shadow .16s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .16);
}
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); box-shadow: 0 6px 18px var(--accent-ring); }

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

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

.btn-ghost { color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.btn-success { background: var(--success-soft); color: var(--success); border-color: transparent; }
.btn-success:hover { background: var(--success); color: #fff; }

.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 11px; font-size: .82rem; border-radius: var(--r-sm); gap: 6px; }
.btn-lg { padding: 12px 22px; font-size: .96rem; border-radius: var(--r-md); }
.btn-block { width: 100%; }

.btn-icon {
    /* <a> ham, <button> ham ishlatiladi — <a> inline bo'lgani uchun
       ikonka markazga tushmasdi. Grid buni ikkalasi uchun ham hal qiladi. */
    display: inline-grid;
    place-items: center;
    flex: none;
    width: 38px;
    height: 38px;
    padding: 0;
    line-height: 0;
    border-radius: var(--r-md);
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
}
/* Ichidagi o'ram (masalan mavzu tugmasidagi .t-sun/.t-moon) ham markazda tursin */
.btn-icon > span { display: grid; place-items: center; }
.btn-icon .ico { vertical-align: 0; }
.btn-icon:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }


/* ---------- 5. CARDS ---------- */

.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px; }
.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.card-body { padding: 20px; }
.card-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* --- Stat tile --- */
.stat {
    position: relative;
    overflow: hidden;
    padding: 19px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.stat-label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}
.stat-hint { margin-top: 5px; font-size: .78rem; color: var(--text-faint); }

.stat-ico {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--accent-soft);
    color: var(--accent);
}
.stat-ico.is-success { background: var(--success-soft); color: var(--success); }
.stat-ico.is-warning { background: var(--warning-soft); color: var(--warning); }
.stat-ico.is-danger  { background: var(--danger-soft);  color: var(--danger); }
.stat-ico.is-info    { background: var(--info-soft);    color: var(--info); }


/* ---------- 6. ORDER CARD ---------- */

.order {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out), border-color .22s var(--ease);
    overflow: hidden;
}
.order:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-strong);
}

/* Yuqoridagi ingichka status chizig'i */
.order::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--stripe, var(--accent));
    opacity: .9;
}
.order { position: relative; }
.order.s-new    { --stripe: linear-gradient(90deg, #6366f1, #8b5cf6); }
.order.s-active { --stripe: linear-gradient(90deg, #f59e0b, #f97316); }
.order.s-done   { --stripe: linear-gradient(90deg, #10b981, #059669); }

.order-body { padding: 19px 20px 16px; flex: 1; }

.order-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

/* Zakaz turiga qarab ranglanadigan ikonka bloki */
.order-ico {
    flex: none;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: color-mix(in srgb, var(--tone) 13%, transparent);
    color: var(--tone);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 18%, transparent);
    transition: transform .22s var(--ease-out);
}
.order:hover .order-ico { transform: scale(1.06) rotate(-3deg); }

.order-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .75rem;
    color: var(--text-faint);
    margin-bottom: 3px;
}
.order-title {
    font-size: 1.02rem;
    font-weight: 650;
    letter-spacing: -.015em;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}
.order-desc {
    margin: 0;
    /* Ikonka (42px) + orasidagi bo'shliq (12px) — sarlavha bilan bir chiziqda */
    padding-left: 54px;
    color: var(--text-muted);
    font-size: .89rem;
    overflow-wrap: anywhere;
}
.order-desc.is-empty { color: var(--text-faint); font-style: italic; }

.order-foot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}


/* ---------- 7. BADGES / PILLS ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px 3px 8px;
    border-radius: var(--r-full);
    font-size: .74rem;
    font-weight: 650;
    letter-spacing: .005em;
    background: var(--surface-3);
    color: var(--text-muted);
}
.badge .ico { width: 13px; height: 13px; }

.badge.b-new    { background: var(--accent-soft);  color: var(--accent); }
.badge.b-active { background: var(--warning-soft); color: var(--warning); }
.badge.b-done   { background: var(--success-soft); color: var(--success); }
.badge.b-info   { background: var(--info-soft);    color: var(--info); }
.badge.b-danger { background: var(--danger-soft);  color: var(--danger); }

/* Kategoriya ranglari */
.t-web     { --tone: var(--tone-web); }
.t-app     { --tone: var(--tone-app); }
.t-bot     { --tone: var(--tone-bot); }
.t-quiz    { --tone: var(--tone-quiz); }
.t-slide   { --tone: var(--tone-slide); }
.t-doc     { --tone: var(--tone-doc); }
.t-book    { --tone: var(--tone-book); }
.t-food    { --tone: var(--tone-food); }
.t-design  { --tone: var(--tone-design); }
.t-money   { --tone: var(--tone-money); }
.t-code    { --tone: var(--tone-code); }
.t-default { --tone: var(--tone-default); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }


/* ---------- 8. FORMS ---------- */

.field { margin-bottom: 16px; }

.label {
    display: block;
    margin-bottom: 6px;
    font-size: .83rem;
    font-weight: 620;
    color: var(--text);
}
.label .opt { font-weight: 500; color: var(--text-faint); }

.input, .textarea, .select {
    display: block;
    width: 100%;
    padding: 10px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .92rem;
    transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.input:focus, .textarea:focus, .select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-ring);
}
.input:disabled, .textarea:disabled {
    background: var(--surface-3);
    color: var(--text-faint);
    cursor: not-allowed;
}
.textarea { resize: vertical; min-height: 104px; line-height: 1.55; }

/* Ikonkali input */
.input-wrap { position: relative; }
.input-wrap > .ico {
    position: absolute;
    top: 50%;
    left: 13px;
    translate: 0 -50%;
    color: var(--text-faint);
    pointer-events: none;
    transition: color .16s var(--ease);
}
.input-wrap:focus-within > .ico { color: var(--accent); }
.input-wrap .input { padding-left: 42px; }

.input-wrap .peek {
    position: absolute;
    top: 50%;
    right: 8px;
    translate: 0 -50%;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
}
.input-wrap .peek:hover { color: var(--text); background: var(--surface-3); }

.hint { margin-top: 6px; font-size: .78rem; color: var(--text-faint); }

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .86rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.check input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Segmented / filter tabs */
.segmented {
    display: inline-flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-2);
}
.segmented a, .segmented button {
    padding: 6px 13px;
    border: 0;
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: .84rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .16s var(--ease), color .16s var(--ease);
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .is-on {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
}


/* ---------- 9. ALERTS / TOASTS ---------- */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    margin-bottom: 16px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    font-size: .88rem;
}
.alert.a-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: color-mix(in srgb, var(--danger) 24%, transparent); }
.alert.a-success { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 24%, transparent); }
.alert.a-info    { background: var(--info-soft);    color: var(--info);    border-color: color-mix(in srgb, var(--info) 24%, transparent); }
.alert.a-warning { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 24%, transparent); }

.toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: min(380px, calc(100vw - 36px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 15px;
    border-radius: var(--r-md);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    font-size: .88rem;
    animation: toast-in .38s var(--ease-out) both;
}
.toast.t-success { border-left: 3px solid var(--success); }
.toast.t-success .ico { color: var(--success); }
.toast.t-danger  { border-left: 3px solid var(--danger); }
.toast.t-danger .ico { color: var(--danger); }
.toast.t-info    { border-left: 3px solid var(--info); }
.toast.t-info .ico { color: var(--info); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px) scale(.97); }
    to   { opacity: 1; transform: none; }
}


/* ---------- 10. MODAL ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .22s var(--ease), visibility .22s;
}
.modal.is-open { opacity: 1; visibility: visible; }
.modal::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(8, 11, 20, .55);
    backdrop-filter: blur(3px);
}

.modal-box {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
    transform: translateY(14px) scale(.97);
    transition: transform .3s var(--ease-out);
}
.modal.is-open .modal-box { transform: none; }
.modal-box.wide { max-width: 620px; }

.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 14px;
}
.modal-title { font-size: 1.04rem; font-weight: 650; }
.modal-body { padding: 0 20px 6px; }
.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 16px 20px 20px;
}

.modal-ico {
    width: 42px;
    height: 42px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--accent);
}
.modal-ico.is-success { background: var(--success-soft); color: var(--success); }
.modal-ico.is-danger  { background: var(--danger-soft);  color: var(--danger); }
.modal-ico.is-warning { background: var(--warning-soft); color: var(--warning); }


/* ---------- 11. EMPTY STATE ---------- */

.empty {
    padding: 60px 24px;
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-lg);
}
.empty-ico {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--accent-soft);
    color: var(--accent);
}
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-muted); max-width: 42ch; margin: 0 auto 18px; }


/* ---------- 12. TABLES ---------- */

.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }

.table { width: 100%; border-collapse: collapse; font-size: .89rem; }
.table th {
    padding: 11px 16px;
    text-align: left;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-faint);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }


/* ---------- 13. PROGRESS / METERS ---------- */

.meter {
    height: 7px;
    border-radius: var(--r-full);
    background: var(--surface-3);
    overflow: hidden;
}
.meter > i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    transition: width .7s var(--ease-out);
}
.meter.m-success > i { background: linear-gradient(90deg, #10b981, #059669); }

/* Yonma-yon kartalar bir xil balandlikda bo'lganda ichini cho'zish */
.card-stretch { display: flex; flex-direction: column; }
.card-stretch > .card-body { flex: 1; display: flex; flex-direction: column; }
.card-stretch .bars { flex: 1; height: auto; min-height: 150px; }

/* Mini bar chart */
.bars {
    display: flex;
    align-items: flex-end;
    gap: 7px;
    height: 108px;
    padding-top: 8px;
}
.bars .bar {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    height: 100%;
}
.bars .bar > i {
    display: block;
    width: 100%;
    max-width: 34px;
    border-radius: 6px 6px 3px 3px;
    background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
    min-height: 3px;
    animation: bar-rise .7s var(--ease-out) both;
}
.bars .bar > span {
    font-size: .7rem;
    color: var(--text-faint);
    white-space: nowrap;
}
@keyframes bar-rise { from { height: 0 !important; } }


/* ---------- 14. AUTH PAGES ---------- */

.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr .95fr;
    background: var(--bg);
}

.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 48px;
    color: #fff;
    background:
        radial-gradient(120% 80% at 15% 10%, #6366f1 0%, transparent 55%),
        radial-gradient(110% 90% at 90% 90%, #7c3aed 0%, transparent 55%),
        linear-gradient(150deg, #312e81, #1e1b4b 55%, #0f0d2b);
}
/* Nozik to'r naqsh */
.auth-aside::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(80% 70% at 50% 40%, #000, transparent 78%);
    -webkit-mask-image: radial-gradient(80% 70% at 50% 40%, #000, transparent 78%);
    pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }

.auth-aside .brand { color: #fff; padding: 0; }
.auth-aside .brand-sub { color: rgba(255, 255, 255, .55); }
.auth-aside .brand-mark { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); }

.auth-pitch { max-width: 30ch; }
.auth-pitch h2 {
    color: #fff;
    font-size: clamp(1.6rem, 2.6vw, 2.15rem);
    letter-spacing: -.035em;
    margin-bottom: 12px;
}
.auth-pitch p { color: rgba(255, 255, 255, .68); font-size: .95rem; }

.auth-points { display: grid; gap: 13px; margin-top: 28px; }
.auth-point { display: flex; align-items: center; gap: 11px; font-size: .9rem; color: rgba(255, 255, 255, .86); }
.auth-point .ico {
    width: 32px;
    height: 32px;
    padding: 7px;
    flex: none;
    border-radius: 9px;
    background: rgba(255, 255, 255, .12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}

.auth-note { font-size: .8rem; color: rgba(255, 255, 255, .45); }

.auth-main {
    display: grid;
    place-items: center;
    padding: 40px 24px;
}
.auth-form { width: 100%; max-width: 380px; animation: rise .5s var(--ease-out) both; }
.auth-form h1 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-form .lead { color: var(--text-muted); font-size: .92rem; margin-bottom: 26px; }

.auth-mobile-brand { display: none; margin-bottom: 24px; }

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
    color: var(--text-faint);
    font-size: .78rem;
}
.divider::before, .divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}


/* ---------- 15. LAYOUT UTILITIES ---------- */

.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }

.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 4px; }
.page-head .lead { color: var(--text-muted); font-size: .92rem; margin: 0; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .82rem; }
.tnum  { font-variant-numeric: tabular-nums; }
.tr { text-align: right; }
.tc { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }

.stagger > * { animation: rise .45s var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .05s; }
.stagger > *:nth-child(3) { animation-delay: .08s; }
.stagger > *:nth-child(4) { animation-delay: .11s; }
.stagger > *:nth-child(5) { animation-delay: .14s; }
.stagger > *:nth-child(6) { animation-delay: .17s; }
.stagger > *:nth-child(7) { animation-delay: .2s; }
.stagger > *:nth-child(8) { animation-delay: .23s; }
.stagger > *:nth-child(9) { animation-delay: .26s; }


/* ---------- 16. RESPONSIVE ---------- */

@media (max-width: 1180px) {
    .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
    body.nav-open .sidebar { transform: none; }
    .app-main { margin-left: 0; }
    .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .auth { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-mobile-brand { display: flex; justify-content: center; }
}

@media (max-width: 700px) {
    body { font-size: 14.5px; }
    .g-2, .g-3, .g-4 { grid-template-columns: 1fr; }
    .g-auto { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 1rem; }
    .topbar .sub { display: none; }
    .stat-value { font-size: 1.7rem; }
    .modal-foot { flex-direction: column-reverse; }
    .modal-foot .btn { width: 100%; }
    .toasts { right: 12px; left: 12px; bottom: 12px; max-width: none; }
}

/* Topbar'dagi "Yangi zakaz" tugmasi tor ekranda yashiriladi —
   xuddi shu amal yon panelda ("Yangi qo'shish") va bo'sh holat
   ekranida ham bor, shuning uchun hech narsa yo'qolmaydi. */
@media (max-width: 620px) {
    .hide-sm { display: none !important; }
}

@media (max-width: 420px) {
    .hide-xs { display: none !important; }
}

/* Harakatni kamaytirish rejimi */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* Chop etish */
@media print {
    .sidebar, .topbar, .foot, .toasts, .btn { display: none !important; }
    .app-main { margin-left: 0; }
    .card, .stat, .order { box-shadow: none; border-color: #ddd; }
}
