/* ============================================================
   Tiba Agent — Reset va bazaviy uslublar
   ============================================================ */

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

* {
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    letter-spacing: var(--tracking-normal);
    font-weight: var(--weight-regular);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    overflow-x: hidden;
    transition: background-color var(--dur-base) var(--ease-out),
                color var(--dur-base) var(--ease-out);
}

/* ── Sarlavhalar ─────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text);
    text-wrap: balance;
}

h1 { font-size: var(--text-3xl); letter-spacing: var(--tracking-tighter); }
h2 { font-size: var(--text-2xl); letter-spacing: var(--tracking-tighter); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); }

p {
    text-wrap: pretty;
}

/* ── Havolalar ───────────────────────────────────────────── */

a {
    color: var(--brand);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out),
                opacity var(--dur-fast) var(--ease-out);
}

a:hover {
    color: var(--brand-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ── Media ───────────────────────────────────────────────── */

img, svg, video, canvas {
    display: block;
    max-width: 100%;
}

img {
    height: auto;
    object-fit: cover;
}

svg.ico {
    width: 1.25em;
    height: 1.25em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.15em;
}

/* ── Forma elementlari ───────────────────────────────────── */

input, button, textarea, select {
    font: inherit;
    color: inherit;
    letter-spacing: inherit;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    cursor: not-allowed;
}

textarea {
    resize: vertical;
    min-height: 96px;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

input[type="file"] {
    cursor: pointer;
}

::placeholder {
    color: var(--text-tertiary);
    opacity: 1;
}

/* ── Ro'yxatlar va jadvallar ─────────────────────────────── */

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ── Tanlash va scroll ───────────────────────────────────── */

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

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* ── Yordamchi ───────────────────────────────────────────── */

hr {
    border: none;
    height: 1px;
    background: var(--border);
    margin: var(--space-6) 0;
}

code, pre, kbd {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

code {
    background: var(--surface-3);
    padding: 0.15em 0.45em;
    border-radius: var(--radius-xs);
    color: var(--text);
}

strong, b {
    font-weight: var(--weight-semibold);
}

small {
    font-size: var(--text-xs);
}

[hidden] {
    display: none !important;
}

/* ── Harakatni kamaytirish ───────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Chop etish ──────────────────────────────────────────── */

@media print {
    .app-sidebar,
    .app-header,
    .mobile-nav,
    .toast-stack,
    .btn {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }
}
