/* ============================================================
   Do'kon paneli — dizayn tizimi
   Shriftlar: Manrope (matn), Space Grotesk (raqamlar/brend)
   ============================================================ */

@font-face {
    font-family: 'Manrope';
    src: url('fonts/manrope.woff2') format('woff2');
    font-weight: 200 800;
    font-display: swap;
}
@font-face {
    font-family: 'Space Grotesk';
    src: url('fonts/space-grotesk.woff2') format('woff2');
    font-weight: 300 700;
    font-display: swap;
}

:root {
    /* Yuzalar */
    --bg: #f5f4ef;
    --surface: #ffffff;
    --surface-2: #faf9f5;
    --line: #e8e6dc;
    --line-soft: #f0eee5;

    /* Matn */
    --ink: #1a1914;
    --ink-2: #52504a;
    --muted: #8c897d;

    /* Brend (interfeys) */
    --accent: #0e8f66;
    --accent-deep: #0a6e4f;
    --accent-soft: #e2f3ec;
    --danger: #cf3d3d;
    --danger-soft: #fbecec;

    /* Ma'lumot ranglari (grafiklar bilan bir xil) */
    --data-blue: #2a78d6;
    --data-blue-soft: #e9f1fb;
    --data-orange: #d05a22;
    --data-orange-soft: #fcefe8;
    --data-green: #14855f;
    --data-green-soft: #e3f5ee;
    --violet: #6d4fc4;
    --violet-soft: #efeafb;

    /* Yon panel */
    --side: #0f1d17;
    --side-2: #14261e;
    --side-ink: #9db3a7;
    --side-line: rgba(255, 255, 255, .08);

    --radius: 16px;
    --shadow: 0 1px 2px rgba(26, 25, 20, .04), 0 10px 28px -14px rgba(26, 25, 20, .12);
    --font: 'Manrope', 'Segoe UI', system-ui, sans-serif;
    --font-num: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }

::selection { background: #cdeadd; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.025em; margin: 0; }
h2 { font-size: .98rem; font-weight: 750; letter-spacing: -.01em; margin: 0 0 14px; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.ico { flex: none; vertical-align: -3px; }

/* ============ Joylashuv ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 236px;
    background:
        radial-gradient(420px 260px at -30% -10%, rgba(23, 178, 126, .16), transparent 65%),
        linear-gradient(175deg, var(--side-2), var(--side) 55%);
    color: var(--side-ink);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
}

.brand {
    display: flex; align-items: center; gap: 11px;
    padding: 22px 20px 18px;
}
.brand-mark {
    width: 36px; height: 36px; flex: none;
    border-radius: 11px;
    background: linear-gradient(140deg, #19b57f, #0a6e4f);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px -2px rgba(14, 143, 102, .5), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name {
    font-family: var(--font-num);
    font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em;
    color: #fff;
}
.brand-name small { display: block; font-family: var(--font); font-size: .68rem; font-weight: 500; color: var(--side-ink); letter-spacing: .02em; margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px; flex: 1; }
.nav-label {
    font-size: .64rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: rgba(157, 179, 167, .6);
    padding: 14px 12px 6px;
}
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px;
    border-radius: 11px;
    color: var(--side-ink);
    font-weight: 600; font-size: .9rem;
    transition: background .14s, color .14s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #eef4f0; text-decoration: none; }
.nav a.active {
    background: linear-gradient(140deg, #14a273, #0c7c58);
    color: #fff;
    box-shadow: 0 6px 16px -6px rgba(16, 156, 110, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.nav a .ico { opacity: .85; }
.nav a.active .ico { opacity: 1; }

.sidebar-user {
    margin: 12px 12px 14px;
    padding: 11px 12px;
    border: 1px solid var(--side-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    display: flex; align-items: center; gap: 10px;
}
.avatar {
    width: 34px; height: 34px; flex: none;
    border-radius: 50%;
    background: linear-gradient(140deg, #2c4a3c, #1b3129);
    border: 1px solid rgba(255, 255, 255, .12);
    color: #d7e5dd;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-num); font-weight: 700; font-size: .92rem;
}
.sidebar-user .who { min-width: 0; flex: 1; }
.u-name { color: #f2f6f3; font-weight: 700; font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.u-role { font-size: .7rem; color: var(--side-ink); }
.logout {
    color: var(--side-ink);
    display: flex; padding: 7px; border-radius: 9px;
    transition: background .14s, color .14s;
}
.logout:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }

.main {
    flex: 1;
    margin-left: 236px;
    padding: 30px 36px 52px;
    max-width: 1280px;
    width: 100%;
}

/* ============ Sahifa boshi ============ */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 14px; flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-head .sub { color: var(--muted); font-size: .86rem; margin-top: 3px; }

/* ============ Kartochkalar ============ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 20px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
@media (max-width: 1080px) and (min-width: 641px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; gap: 10px; } }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex; align-items: center; gap: 13px;
}
.stat-ico {
    width: 42px; height: 42px; flex: none;
    border-radius: 13px;
    display: flex; align-items: center; justify-content: center;
}
.stat-ico.blue   { background: var(--data-blue-soft);   color: var(--data-blue); }
.stat-ico.orange { background: var(--data-orange-soft); color: var(--data-orange); }
.stat-ico.green  { background: var(--data-green-soft);  color: var(--data-green); }
.stat-ico.red    { background: var(--danger-soft);      color: var(--danger); }
.stat-label { color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .01em; }
.stat-value {
    font-family: var(--font-num);
    font-size: 1.28rem; font-weight: 700; letter-spacing: -.01em;
    white-space: nowrap; margin-top: 1px;
}
.stat-value .cur { font-family: var(--font); font-size: .72rem; font-weight: 600; color: var(--muted); }
.stat-value.neg { color: var(--danger); }

/* Bugungi tushum qatori */
.pay-strip {
    display: flex; gap: 8px 26px; flex-wrap: wrap; align-items: center;
    padding: 14px 22px;
}
.pay-strip .lead { color: var(--muted); font-size: .8rem; font-weight: 700; letter-spacing: .02em; }
.pay-item { display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-2); font-weight: 600; }
.pay-item strong { font-family: var(--font-num); font-weight: 700; color: var(--ink); }
.pay-chip {
    width: 28px; height: 28px; border-radius: 9px; flex: none;
    display: flex; align-items: center; justify-content: center;
}
.pay-chip.green  { background: var(--data-green-soft);  color: var(--data-green); }
.pay-chip.blue   { background: var(--data-blue-soft);   color: var(--data-blue); }
.pay-chip.violet { background: var(--violet-soft);      color: var(--violet); }
.pay-chip.orange { background: var(--data-orange-soft); color: var(--data-orange); }

/* ============ Ikki ustun ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.chart-box { height: 300px; position: relative; }
.chart-box-sm { height: 250px; position: relative; }

/* ============ Formalar ============ */
.field { margin-bottom: 12px; }
.field label {
    display: block;
    font-size: .76rem; font-weight: 700; letter-spacing: .01em;
    color: var(--ink-2);
    margin-bottom: 6px;
}
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    font: inherit;
    font-size: .9rem;
    color: var(--ink);
    transition: border-color .14s, box-shadow .14s;
}
input:hover, select:hover { border-color: #d5d2c4; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14, 143, 102, .16);
}
input::placeholder { color: #b4b1a4; }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin-bottom: 0; flex: 1 1 150px; }
.form-row .field.wide { flex: 2 1 220px; }
.form-row .actions { flex: none; display: flex; gap: 8px; }

/* ============ Tugmalar ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    font: inherit; font-size: .88rem; font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: filter .14s, background .14s, border-color .14s, box-shadow .14s;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: linear-gradient(180deg, #12a273, var(--accent-deep));
    color: #fff;
    box-shadow: 0 4px 10px -3px rgba(14, 143, 102, .5), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--ink-2);
}
.btn-ghost:hover { background: var(--surface-2); border-color: #d5d2c4; color: var(--ink); }
.btn-sm { padding: 6px 12px; font-size: .8rem; border-radius: 9px; }
.btn-block { width: 100%; }

/* Ikonka-tugmalar (jadval amallari) */
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--muted);
    cursor: pointer;
    transition: all .14s;
}
.btn-icon:hover { color: var(--ink); border-color: #d5d2c4; background: var(--surface-2); text-decoration: none; }
.btn-icon.danger:hover { color: var(--danger); border-color: #ecc7c7; background: var(--danger-soft); }

/* ============ Jadval ============ */
.table-wrap { overflow-x: auto; margin: 0 -6px; padding: 0 6px; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left;
    font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted);
    padding: 8px 11px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
td { padding: 10px 11px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: .88rem; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: none; }
.num {
    text-align: right;
    font-family: var(--font-num);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
td.actions { text-align: right; white-space: nowrap; }
td.actions form { display: inline-block; margin-left: 4px; }
.muted { color: var(--muted); }
.pos { color: var(--data-green); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* ============ Nishonlar ============ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: .74rem; font-weight: 700; letter-spacing: .01em;
    background: #efede5; color: var(--ink-2);
}
.badge.blue   { background: var(--data-blue-soft);  color: #1c5cab; }
.badge.green  { background: var(--data-green-soft); color: var(--data-green); }
.badge.violet { background: var(--violet-soft);     color: var(--violet); }
.badge.orange { background: var(--data-orange-soft); color: var(--data-orange); }
.badge.red    { background: var(--danger-soft);      color: var(--danger); }

/* ============ Xabarlar ============ */
.flash {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-weight: 600; font-size: .88rem;
    border: 1px solid transparent;
}
.flash-success { background: var(--accent-soft); color: var(--accent-deep); border-color: #c8e8da; }
.flash-error   { background: var(--danger-soft); color: var(--danger); border-color: #f0d2d2; }

/* ============ Filtrlar ============ */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; }

.seg {
    display: inline-flex;
    background: #eceae0;
    border-radius: 12px;
    padding: 3px; gap: 2px;
}
.seg a {
    padding: 6px 15px;
    border-radius: 9px;
    color: var(--ink-2); font-weight: 700; font-size: .84rem;
    transition: all .14s;
}
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(26, 25, 20, .14); }

/* ============ Kirish sahifasi ============ */
.login-body {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(560px 380px at 82% -8%, rgba(23, 178, 126, .2), transparent 65%),
        radial-gradient(480px 340px at -8% 108%, rgba(23, 178, 126, .12), transparent 60%),
        linear-gradient(165deg, #14261e, #0f1d17 55%, #0b1611);
    padding: 22px;
    font-family: var(--font);
}
.login-card {
    background: var(--surface);
    border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
    padding: 38px 36px 32px;
    width: 100%; max-width: 392px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.login-brand .t {
    font-family: var(--font-num); font-weight: 700; font-size: 1.22rem; letter-spacing: -.01em;
}
.login-brand .t small { display: block; font-family: var(--font); font-size: .74rem; font-weight: 500; color: var(--muted); margin-top: -1px; }
.login-card h1 { font-size: 1.14rem; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: .86rem; margin: 0 0 20px; }

/* ============ Bo'sh holat ============ */
.empty {
    text-align: center;
    color: var(--muted);
    padding: 26px 10px;
    font-size: .88rem;
}
.empty .ico { display: block; margin: 0 auto 8px; opacity: .45; }

/* ============ Telefon ============ */
@media (max-width: 860px) {
    .layout { flex-direction: column; }
    .sidebar { position: static; width: 100%; }
    .brand { padding: 14px 16px 6px; }
    .nav { flex-direction: row; overflow-x: auto; padding: 6px 12px 10px; scrollbar-width: none; }
    .nav::-webkit-scrollbar { display: none; }
    .nav-label { display: none; }
    .nav a { padding: 8px 13px; white-space: nowrap; }
    .sidebar-user { margin: 0; border: none; border-top: 1px solid var(--side-line); border-radius: 0; padding: 9px 16px; background: none; }
    .main { margin-left: 0; padding: 18px 14px 44px; }
    .chart-box { height: 240px; }
    .page-head { margin-bottom: 16px; }
    .card, .stat { padding: 15px 16px; }
}
