/* Qandolatchi — dizayn tokenlari va asosiy uslublar.
   Malina glazuri (accent) — asosiy amal va faol holat; sariyog' — faqat ogohlantirish; pista — muvaffaqiyat. */

:root {
    --bg: #F6F5FA;
    --surface: #FFFFFF;
    --surface-2: #EFEDF5;
    --ink: #221B30;
    --muted: #686279;
    --line: #E2DFEA;

    --accent: #A3245C;
    --accent-hover: #8C1D4E;
    --accent-ink: #FFFFFF;
    --accent-soft: #F8E4ED;

    --butter: #F2C14E;
    --butter-soft: #FDF3D6;
    --butter-ink: #634700;

    --pistachio: #4F7A3D;
    --pistachio-soft: #E6F0DF;

    --danger: #B3261E;
    --danger-soft: #FBE6E4;

    --radius-s: 8px;
    --radius-m: 14px;
    --radius-l: 22px;
    --tap: 48px;

    --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sidebar-w: 264px;
    --tabbar-h: 64px;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #16131D;
        --surface: #201C2A;
        --surface-2: #2A2536;
        --ink: #EEEAF6;
        --muted: #A49EB6;
        --line: #353043;
        --accent: #E2659A;
        --accent-hover: #EC82AE;
        --accent-ink: #1C0F16;
        --accent-soft: #3A1F2D;
        --butter-soft: #3A3020;
        --butter-ink: #F6D27A;
        --pistachio: #8FC27A;
        --pistachio-soft: #22301D;
        --danger: #F2867E;
        --danger-soft: #3A1E1C;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #16131D;
    --surface: #201C2A;
    --surface-2: #2A2536;
    --ink: #EEEAF6;
    --muted: #A49EB6;
    --line: #353043;
    --accent: #E2659A;
    --accent-hover: #EC82AE;
    --accent-ink: #1C0F16;
    --accent-soft: #3A1F2D;
    --butter-soft: #3A3020;
    --butter-ink: #F6D27A;
    --pistachio: #8FC27A;
    --pistachio-soft: #22301D;
    --danger: #F2867E;
    --danger-soft: #3A1E1C;
    color-scheme: dark;
}

/* ---------- Asos ---------- */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }

.num, td.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

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

.icon { flex: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Ilova qobig'i ---------- */

.shell { min-height: 100dvh; }

.brand {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -0.02em;
    color: var(--ink);
    text-decoration: none;
}
.brand:hover { color: var(--ink); }

.sidebar { display: none; }

.main {
    min-height: 100dvh;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.topbar-actions { display: flex; gap: 4px; }

.in-telegram .topbar { display: none; }

.content {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px 16px 32px;
}

.content-plain { padding-top: 48px; }

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: var(--radius-m);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}
.icon-button:hover { background: var(--surface-2); color: var(--ink); }

.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: inline-grid; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .only-dark { display: inline-grid; }
    :root:not([data-theme="light"]) .only-light { display: none; }
}

/* Pastki menyu (telefon) */

.tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab .icon { padding: 3px 14px; box-sizing: content-box; border-radius: 999px; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--accent); }
.tab[aria-current="page"] .icon { background: var(--accent-soft); }

/* Chap menyu (kompyuter) */

@media (min-width: 960px) {
    .shell {
        display: grid;
        grid-template-columns: var(--sidebar-w) 1fr;
    }

    .sidebar {
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
        height: 100dvh;
        padding: 22px 14px 14px;
        background: var(--surface);
        border-right: 1px solid var(--line);
    }

    .sidebar > .brand { padding: 0 10px 18px; }

    .side-nav { flex: 1; overflow-y: auto; }

    .side-group + .side-group { margin-top: 18px; }

    .side-group-title {
        padding: 0 10px 6px;
        color: var(--muted);
        font-size: 13px;
        font-weight: 500;
    }

    .side-link {
        display: flex;
        align-items: center;
        gap: 12px;
        min-height: 40px;
        padding: 8px 10px;
        border-radius: var(--radius-s);
        color: var(--ink);
        font-size: 15px;
        text-decoration: none;
    }
    .side-link:hover { background: var(--surface-2); color: var(--ink); }
    .side-link[aria-current="page"] {
        background: var(--accent-soft);
        color: var(--accent);
        font-weight: 600;
    }

    .side-footer {
        display: flex;
        align-items: center;
        gap: 6px;
        padding-top: 12px;
        border-top: 1px solid var(--line);
    }

    .side-user {
        display: flex;
        flex: 1;
        align-items: center;
        gap: 10px;
        min-width: 0;
        padding: 8px 10px;
        border-radius: var(--radius-s);
        color: var(--ink);
        text-decoration: none;
    }
    .side-user:hover, .side-user[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
    .side-user span { display: flex; flex-direction: column; min-width: 0; }
    .side-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
    .side-user small { color: var(--muted); font-size: 13px; }

    .main { padding-bottom: 0; }
    .topbar, .tabbar { display: none; }
    .content { padding: 36px 40px 48px; }
}

/* ---------- Sahifa elementlari ---------- */

.page-title {
    margin-bottom: 16px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.015em;
}

.page-narrow { max-width: 560px; }
.page-narrow > * + * { margin-top: 16px; }

.section { margin-top: 32px; }

.section-title {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
}

.stack { display: flex; flex-direction: column; gap: 14px; }

/* Bugun: sana — sahifaning asosiy belgisi */

.today { padding: 8px 0 4px; }

.today-date {
    font-size: clamp(44px, 12vw, 72px);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.045em;
}

.today-meta {
    margin-top: 10px;
    color: var(--muted);
    font-size: 17px;
}

.quick {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 24px;
}

@media (min-width: 720px) {
    .quick { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.quick-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    min-height: 116px;
    padding: 14px;
    border-radius: var(--radius-l);
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
}
.quick-tile:hover { border-color: var(--accent); color: var(--ink); }
.quick-tile:active { transform: scale(0.98); }

.quick-tile:first-child {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.quick-tile:first-child small { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.quick-tile:first-child .quick-icon { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); color: var(--accent-ink); }
.quick-tile:first-child:hover { background: var(--accent-hover); color: var(--accent-ink); }

.quick-icon {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-m);
    background: var(--accent-soft);
    color: var(--accent);
}

.quick-text { display: flex; flex-direction: column; }
.quick-text strong { font-size: 17px; font-weight: 600; line-height: 1.25; }
.quick-text small { color: var(--muted); font-size: 14px; }

.empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: var(--radius-m);
    color: var(--muted);
}
.empty p { max-width: 62ch; }
.empty-icon { color: var(--accent); }

.menu-list {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    overflow: hidden;
}
.menu-list li + li { border-top: 1px solid var(--line); }

.menu-link {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 52px;
    padding: 12px 16px;
    color: var(--ink);
    font-size: 16px;
    text-decoration: none;
}
.menu-link .icon { color: var(--accent); }
.menu-link:hover { background: var(--surface-2); color: var(--ink); }

.facts {
    margin: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
}
.facts > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
}
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }

/* ---------- Tugmalar va formalar ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-m);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.button-block { width: 100%; }

.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--accent-hover); color: var(--accent-ink); }

.button-secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button-secondary:hover { background: var(--surface-2); color: var(--ink); }

.button-danger { background: var(--danger-soft); color: var(--danger); }
.button-danger:hover { background: var(--danger); color: var(--surface); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 15px; font-weight: 500; }

input[type="text"], input[type="tel"], input[type="number"], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 17px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
input[aria-invalid="true"] { border-color: var(--danger); }

.phone-input {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
}
.phone-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.phone-prefix {
    display: grid;
    place-items: center;
    padding: 0 4px 0 14px;
    color: var(--muted);
    font-size: 17px;
    font-variant-numeric: tabular-nums;
}
.phone-input input {
    border: 0;
    background: transparent;
    padding-left: 6px;
    font-variant-numeric: tabular-nums;
}
.phone-input input:focus-visible { box-shadow: none; }

.code-input {
    font-size: 30px !important;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.notice {
    padding: 12px 14px;
    border-radius: var(--radius-m);
    font-size: 15px;
}
.notice-danger { background: var(--danger-soft); color: var(--danger); }
.notice-warning { background: var(--butter-soft); color: var(--butter-ink); }
.notice-success { background: var(--pistachio-soft); color: var(--pistachio); }

/* ---------- Kirish sahifalari ---------- */

.auth-page { background: var(--bg); }

.auth {
    display: flex;
    flex-direction: column;
    gap: 36px;
    width: 100%;
    max-width: 420px;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 56px 16px 32px;
}

.auth-mark { display: flex; flex-direction: column; gap: 2px; }
.brand-large { font-size: 34px; letter-spacing: -0.035em; }
.auth-tagline { color: var(--muted); }

.auth-body > * + * { margin-top: 18px; }

.auth-title { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth-lead { color: var(--muted); }
.auth-hint { color: var(--muted); font-size: 14px; }

/* ---------- Ma'lumotnomalar (M4) ---------- */

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 16px;
}
.page-head .page-title { margin-bottom: 0; }
.page-lead { color: var(--muted); max-width: 62ch; }
.section-lead { margin-bottom: 12px; }
.small { font-size: 14px; }

@media (min-width: 900px) { .page-wide-md { max-width: 720px; } }

.back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    color: var(--muted);
    font-size: 15px;
    text-decoration: none;
}
.back::before { content: "\2039"; font-size: 22px; line-height: 1; }
.back:hover { color: var(--accent); }

.flash {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-m);
    background: var(--pistachio-soft);
    color: var(--pistachio);
    font-weight: 500;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-bottom: 16px;
}
.toolbar input[type="search"] { flex: 1 1 0; min-width: 0; width: auto; }
.toolbar .check { order: 3; flex-basis: 100%; min-height: 36px; }
@media (min-width: 720px) { .toolbar .check { order: 0; flex-basis: auto; } }
.toolbar-submit { min-height: var(--tap); }

input[type="search"] {
    width: 100%;
    min-height: var(--tap);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 17px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: var(--tap);
    color: var(--muted);
    font-size: 15px;
    cursor: pointer;
}
.check input, .choice input, .segmented input { accent-color: var(--accent); }
.check input { width: 20px; height: 20px; }

/* Ro'yxat qatorlari */

.rows {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    overflow: hidden;
}
.rows > li + li { border-top: 1px solid var(--line); }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 64px;
    padding: 12px 16px;
    color: var(--ink);
    text-decoration: none;
}
a.row:hover { background: var(--surface-2); color: var(--ink); }
.row-main, .row-end { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main strong { font-weight: 600; overflow-wrap: anywhere; }
.row-main small, .row-end small { color: var(--muted); font-size: 14px; }
.row-main .badge, .row-main .tag { align-self: flex-start; margin-top: 4px; }
.row-end { align-items: flex-end; flex-shrink: 0; text-align: right; }
.row-muted { opacity: 0.62; }

.badge, .tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}
.badge { background: var(--surface-2); color: var(--muted); }
.badge-warn { background: var(--butter-soft); color: var(--butter-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.tag { background: var(--accent-soft); color: var(--accent); }

/* Forma yordamchilari */

.field-hint { color: var(--muted); font-size: 14px; }
.field-error { color: var(--danger); font-size: 14px; }
.field-error:empty { display: none; }
.optional { color: var(--muted); font-size: 13px; font-weight: 400; }
fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }

.segmented {
    display: flex;
    padding: 4px;
    gap: 4px;
    border-radius: var(--radius-m);
    background: var(--surface-2);
}
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.segmented span {
    display: grid;
    place-items: center;
    min-height: 40px;
    padding: 6px 10px;
    border-radius: calc(var(--radius-m) - 4px);
    color: var(--muted);
    font-weight: 500;
    cursor: pointer;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(34 27 48 / 0.12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.segmented input:disabled + span { cursor: not-allowed; opacity: 0.45; }

.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
    cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex-shrink: 0; }
.choice > span { display: flex; flex-direction: column; gap: 2px; }
.choice small { color: var(--muted); font-size: 14px; }

.danger-zone {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 32px !important;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.button-ghost { background: transparent; color: var(--muted); }
.button-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* Mijoz narxlari */

.price-list {
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
}
.price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(130px, 170px);
    align-items: center;
    gap: 6px 12px;
    padding: 12px 16px;
}
.price-row + .price-row { border-top: 1px solid var(--line); }
.price-name { display: flex; flex-direction: column; min-width: 0; }
.price-name small { color: var(--muted); font-size: 14px; }
.price-input { position: relative; }
.price-input input { padding-right: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.price-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}
.price-row .field-error { grid-column: 1 / -1; }

/* Mahsulotlar */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-l);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
}
.product-card:hover { border-color: var(--accent); color: var(--ink); }
.product-thumb {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    background: var(--accent-soft);
    color: var(--accent);
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-body { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.product-body strong { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.product-body small { color: var(--muted); font-size: 13px; }
.product-body .badge { align-self: flex-start; margin-top: 4px; }

.product-hero { display: grid; gap: 16px; }
@media (min-width: 640px) { .product-hero { grid-template-columns: 260px minmax(0, 1fr); align-items: start; } }
.product-photo {
    overflow: hidden;
    aspect-ratio: 1;
    border-radius: var(--radius-l);
    background: var(--accent-soft);
}
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 100%;
    color: var(--accent);
    font-size: 15px;
}
.upload { display: flex; flex-direction: column; gap: 6px; }
.upload-label { position: relative; overflow: hidden; }
.upload-label input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-label:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* hidden atributi komponent display qoidalaridan ustun */
[hidden] { display: none !important; }
.notice + .toolbar { margin-top: 12px; }

/* ---------- Kirim va ombor (M5) ---------- */

input[type="date"], input[type="time"] {
    width: 100%;
    min-height: var(--tap);
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-m);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 17px;
}
select[aria-invalid="true"] { border-color: var(--danger); }
.text-ok { color: var(--pistachio); }

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); color: var(--ink); }

.day + .day { margin-top: 20px; }
.day-title { margin-bottom: 8px; color: var(--muted); font-size: 15px; font-weight: 600; }

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    margin-bottom: 12px;
}
.section-head .section-title { margin-bottom: 0; }

/* Kirim qatorlari: xomashyo + miqdor + olib tashlash */
.line-list { display: flex; flex-direction: column; gap: 8px; margin: 0 0 10px; padding: 0; list-style: none; }
.line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(104px, 140px) 44px;
    align-items: center;
    gap: 8px;
}
.line-error { grid-column: 1 / -1; }
.line-remove { width: 44px; height: var(--tap); font-size: 22px; color: var(--muted); }
.line-remove[hidden] { display: grid !important; visibility: hidden; }

.qty-input { position: relative; display: block; }
.qty-input input { padding-right: 48px; text-align: right; font-variant-numeric: tabular-nums; }
.qty-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 14px;
    pointer-events: none;
}
.file-input { font: inherit; font-size: 15px; color: var(--muted); }

/* To'lov */
.pay-form { margin-bottom: 12px; }
.inline-pay { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.facts + .pay-form, .facts + .rows, .pay-form + .rows { margin-top: 12px; }

.cancel-inline { position: relative; }
.cancel-inline summary {
    color: var(--muted);
    font-size: 14px;
    cursor: pointer;
    list-style: none;
}
.cancel-inline summary::-webkit-details-marker { display: none; }
.cancel-inline[open] summary { color: var(--ink); }
.cancel-inline form { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.cancel-inline input { width: 180px; min-height: 40px; padding: 8px 10px; font-size: 15px; }
.cancel-inline .button { min-height: 40px; padding: 8px 14px; }

.cancel-block summary { list-style: none; }
.cancel-block summary::-webkit-details-marker { display: none; }
.cancel-block[open] summary { margin-bottom: 14px; }

.invoice { display: block; max-width: 360px; margin-bottom: 12px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-m); }
.invoice img { display: block; width: 100%; height: auto; }

/* Yetkazib beruvchi balansi */
.balance {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    margin-bottom: 16px;
    border-radius: var(--radius-l);
    background: var(--pistachio-soft);
}
.balance-debt { background: var(--accent-soft); }
.balance-label { color: var(--muted); font-size: 14px; font-weight: 500; }
.balance-value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.balance-debt .balance-value { color: var(--accent); }
.balance-meta { color: var(--muted); font-size: 14px; }
.notice + .facts, .page-head + .facts { margin-top: 12px; }

/* ---------- M6: retsept va ishlab chiqarish ---------- */
.button-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.preview { padding: 14px 16px 6px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.preview .section-title { margin-bottom: 6px; }
.preview .notice { margin-bottom: 8px; }
.preview .rows { border: 0; border-radius: 0; background: transparent; }
.preview .row { padding-left: 0; padding-right: 0; }
.preview-cost { padding: 10px 0; border-top: 1px solid var(--line); }

.shortage { margin-bottom: 16px; }
.shortage ul { margin: 8px 0 0; padding-left: 18px; }
.shortage li + li { margin-top: 4px; }

.day-nav {
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    margin-bottom: 12px;
    text-align: center;
}
.day-nav a.icon-button { font-size: 24px; text-decoration: none; color: var(--ink); }
.day-total { margin-top: 12px; text-align: right; color: var(--muted); }
.day-total strong { color: var(--ink); }

.history-version { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.history-version + .history-version { margin-top: 8px; }
.history-version summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    padding: 12px 14px;
    cursor: pointer;
    list-style: none;
}
.history-version summary::-webkit-details-marker { display: none; }
.history-version summary small { color: var(--muted); font-size: 14px; }
.history-version .rows { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.rows + .facts { margin-top: 12px; }

/* ---------- M7: savdo, qaytarish, yaroqsiz ombor ---------- */
.line-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-top: -2px;
    color: var(--muted);
    font-size: 14px;
}
.line-meta strong { color: var(--ink); font-weight: 600; }
.line-meta select { width: auto; min-height: 40px; padding: 6px 32px 6px 10px; font-size: 15px; }
.line-meta .qty-input input { min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-size: 15px; }
.line-meta .qty-input { width: 150px; }
.line-list-sale .line + .line { padding-top: 10px; border-top: 1px dashed var(--line); }

.sale-total {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: var(--radius-l);
    background: var(--surface-2);
}
.sale-total > div { display: flex; justify-content: space-between; gap: 12px; }
.sale-total .grand { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.sale-total .muted strong { color: var(--ink); font-weight: 600; }

.pay-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--radius-m); background: var(--surface-2); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
    display: grid;
    place-items: center;
    min-height: 40px;
    border-radius: calc(var(--radius-m) - 3px);
    color: var(--muted);
    font-weight: 500;
    cursor: pointer;
}
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.12); }
.segmented input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }

.debt-positive { color: var(--accent); }
.debt-negative { color: var(--pistachio); }
.row-end .debt-positive, .row-end .debt-negative { font-weight: 600; }

.actions-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.actions-row .button { padding-left: 8px; padding-right: 8px; }
.op-kind { font-size: 13px; }
.price-edit { display: inline-flex; align-items: center; gap: 8px; }
.link-pair { display: flex; gap: 12px; }

/* ---------- M8: hisobotlar ---------- */
.report-filter input[type="date"] { flex: 1 1 140px; min-width: 0; width: auto; }
.report-filter select { flex: 1 1 160px; min-width: 0; width: auto; }
.presets { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 0; font-size: 15px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
table.report { width: 100%; border-collapse: collapse; font-size: 15px; }
table.report th, table.report td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.report th { background: var(--surface-2); font-weight: 600; font-size: 14px; }
table.report tbody tr:last-child td { border-bottom: 0; }
table.report tfoot td { border-top: 1px solid var(--line); border-bottom: 0; }
table.report .num { text-align: right; font-variant-numeric: tabular-nums; }
table.report tr.strong td { font-weight: 600; }
table.report tr.warn td, table.report tr.warn a { color: var(--danger); }
.report-summary { margin-top: 16px; padding: 14px 16px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); line-height: 1.6; }
.report-summary div { white-space: pre-wrap; }
.presets { margin-bottom: 14px; }
.report-notes { margin-top: 12px; display: grid; gap: 4px; }
.report-notes p { margin: 0; }

/* ---------- M9: bosh sahifa va grafik ---------- */
:root { --chart-bar: #A3245C; --chart-bar-dim: #D9A6BD; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --chart-bar: #D9558E; --chart-bar-dim: #6E3550; } }
:root[data-theme="dark"] { --chart-bar: #D9558E; --chart-bar-dim: #6E3550; }
.text-warn { color: var(--butter-ink); }
.tally { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.tally a { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; color: var(--ink); text-decoration: none; min-width: 0; }
.tally a + a { border-left: 1px solid var(--line); }
.tally a:hover strong { color: var(--accent); }
.tally strong { font-size: 32px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; }
.tally span { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.tally-hint { margin: 8px 0 0; }
.low-stock { margin-top: 12px; }
.low-stock ul { margin: 6px 0 0; padding-left: 18px; }
.low-stock a { color: inherit; font-weight: 600; }
.money-hero { display: flex; flex-direction: column; gap: 4px; padding: 18px 16px; margin-bottom: 10px; border-radius: var(--radius-m); background: var(--accent-soft); }
.money-hero-label { color: var(--muted); font-size: 15px; }
.money-hero-value { font-size: clamp(30px, 8vw, 40px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.money-hero-meta { color: var(--muted); font-size: 15px; }
.money-hero-meta strong { color: var(--ink); font-weight: 600; }
.facts dt a { color: inherit; }
.chart { position: relative; margin: 0; padding: 12px 8px 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-base { stroke: var(--line); stroke-width: 1; }
.chart-hit { fill: transparent; }
.chart-bar { fill: var(--chart-bar); }
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { fill: var(--accent-hover); }
.chart-col:focus { outline: none; }
.chart-col:focus-visible .chart-hit { fill: var(--surface-2); }
.chart-value { fill: var(--ink); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-axis { fill: var(--muted); font-size: 16px; }
.is-today .chart-axis { fill: var(--ink); font-weight: 600; }
.chart-tip { position: absolute; top: 4px; transform: translateX(-50%); padding: 6px 10px; border-radius: var(--radius-s); background: var(--ink); color: var(--bg); font-size: 14px; white-space: nowrap; pointer-events: none; }
.chart-table { margin-top: 8px; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 15px; min-height: 36px; display: flex; align-items: center; }
.chart-table table { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }
.time-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; }
.inline-rename { display: flex; gap: 8px; align-items: center; min-width: 0; }
.inline-rename input { flex: 1 1 auto; min-width: 0; }
.category-actions { flex-direction: row; align-items: center; gap: 4px; flex-wrap: wrap; }
.category-actions form { margin: 0; }
.category-list .row { flex-direction: column; align-items: stretch; gap: 6px; }
.category-list .row-end { align-items: center; justify-content: flex-start; }
.category-list .row-end form:last-child { margin-left: auto; }
.audit-details { margin-top: 6px; }
.audit-details summary { cursor: pointer; color: var(--accent); font-size: 15px; min-height: 32px; display: inline-flex; align-items: center; }
.audit-caption { margin: 8px 0 4px; color: var(--muted); font-size: 13px; }
.audit-fields { margin: 0; display: grid; gap: 2px; font-size: 14px; }
.audit-fields div { display: flex; gap: 8px; min-width: 0; }
.audit-fields dt { color: var(--muted); flex: 0 0 auto; }
.audit-fields dd { margin: 0; overflow-wrap: anywhere; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.category-actions .icon-button { color: var(--ink); }
.category-actions .icon-button:disabled { opacity: 0.35; }
