/* ============================================================
   NIU Masshtab — admin panel
   ============================================================ */

:root {
    /* Ranglar */
    --bg:            #f4f6fa;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --border:        #e3e8ef;
    --border-strong: #cbd3df;

    --text:          #16202c;
    --text-2:        #48566a;
    --muted:         #7a8798;

    --brand:         #2563eb;
    --brand-dark:    #1d4ed8;
    --brand-soft:    #eaf1fe;

    --green:         #0f7b3f;
    --green-soft:    #e6f6ec;
    --red:           #c02626;
    --red-soft:      #fdecec;
    --amber:         #8a5a00;
    --amber-soft:    #fff5e0;

    --sidebar:       #101a27;
    --sidebar-2:     #1a2635;
    --sidebar-text:  #93a3b8;

    /* O'lchamlar */
    --sidebar-w: 244px;
    --radius:    12px;
    --radius-sm: 8px;

    --shadow-sm: 0 1px 2px rgba(16, 26, 39, .06);
    --shadow:    0 2px 8px rgba(16, 26, 39, .07);
    --shadow-lg: 0 12px 32px rgba(16, 26, 39, .16);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }

/* ============================================================
   Skelet: chap menyu + kontent
   ============================================================ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex: 0 0 var(--sidebar-w);
    background: var(--sidebar);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 20px 18px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: .01em;
}
.sidebar__brand .mark {
    width: 32px; height: 32px;
    flex: 0 0 32px;
    border-radius: 9px;
    background: linear-gradient(140deg, #3b82f6, #1d4ed8);
    display: grid; place-items: center;
    font-size: 14px; font-weight: 700;
}
.sidebar__brand small {
    display: block;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--sidebar-text);
    letter-spacing: .02em;
}

.sidebar__nav { flex: 1; overflow-y: auto; padding: 6px 12px 18px; }

.sidebar__group {
    padding: 16px 10px 7px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: #5d6b7e;
}

.sidebar a.item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 11px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 14.5px;
    transition: background .12s, color .12s;
}
.sidebar a.item:hover { background: var(--sidebar-2); color: #fff; text-decoration: none; }
.sidebar a.item.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar a.item .ico { width: 18px; text-align: center; font-size: 15px; flex: 0 0 18px; }

.sidebar__foot {
    border-top: 1px solid #1e2b3b;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 11px;
}
.sidebar__foot .avatar {
    width: 34px; height: 34px; flex: 0 0 34px;
    border-radius: 50%;
    background: var(--sidebar-2);
    display: grid; place-items: center;
    font-weight: 650; font-size: 13px; color: #cfd8e3;
}
.sidebar__foot .who { min-width: 0; flex: 1; }
.sidebar__foot .who b { display: block; font-size: 13.5px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar__foot .who span { font-size: 11.5px; color: var(--sidebar-text); }
.sidebar__foot a.out { color: var(--sidebar-text); font-size: 17px; line-height: 1; }
.sidebar__foot a.out:hover { color: #ff8f80; text-decoration: none; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { flex: 1; min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; font-weight: 400; }

.burger {
    display: none;
    background: none; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 38px; height: 38px;
    font-size: 17px; color: var(--text);
    cursor: pointer; padding: 0;
}
.burger:hover { background: var(--surface-2); }

.content { padding: 24px 26px 56px; max-width: 1240px; width: 100%; }

.backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(10, 16, 24, .45);
    z-index: 35;
}

/* ============================================================
   Kartochka va setka
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
}
.card__head {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.card__head h2 { flex: 1; min-width: 0; }
.card__head .note { color: var(--muted); font-size: 13px; }
.card__body { padding: 20px; }
.card__body.flush { padding: 0; }

.grid { display: grid; gap: 16px; }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Statistika plitasi */
.tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}
.tile .label {
    color: var(--muted); font-size: 12.5px; font-weight: 550;
    display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
}
.tile .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.tile .value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.tile .sub { color: var(--muted); font-size: 12.5px; margin-top: 5px; }

/* ============================================================
   Formalar
   ============================================================ */

label { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }

/* Turi yozilmagan <input> ham shu ro'yxatga tushishi uchun ataylab
   "kerak bo'lmaganlarini chiqarib tashlash" usuli ishlatilgan:
   input[type=text] selektori type atributi yo'q maydonni tanlamaydi. */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=submit]):not([type=button]):not([type=hidden]),
select, textarea {
    width: 100%;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
input::placeholder { color: #a3adbb; }
input[readonly] { background: var(--surface-2); }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8798' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; min-width: 0; }
.row > .shrink { flex: 0 0 auto; }

/* Tugmalar */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 17px;
    font: inherit;
    font-weight: 550;
    color: #fff;
    background: var(--brand);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s, box-shadow .12s, opacity .12s;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; }
button:disabled { opacity: .55; cursor: not-allowed; }

.btn-ghost, button.ghost {
    background: var(--surface); color: var(--text); border-color: var(--border-strong);
}
.btn-ghost:hover, button.ghost:hover { background: var(--surface-2); }

.btn-danger, button.danger { background: var(--red); }
.btn-danger:hover, button.danger:hover { background: #a11f1f; }

.btn-sm, button.sm { padding: 6px 12px; font-size: 13.5px; }
.btn-lg { padding: 12px 22px; font-size: 15.5px; }

/* ============================================================
   Jadval
   ============================================================ */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    position: sticky; top: 0;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 11.5px; font-weight: 650;
    text-transform: uppercase; letter-spacing: .05em;
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.tight { padding-top: 0; }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .icon { font-size: 30px; opacity: .55; display: block; margin-bottom: 10px; }
.empty p { margin: 0 0 14px; }

/* ============================================================
   Kichik elementlar
   ============================================================ */

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2.5px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
    background: var(--surface-2); color: var(--text-2);
}
.badge.ok   { background: var(--green-soft); color: var(--green); }
.badge.off  { background: var(--red-soft);   color: var(--red); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.info { background: var(--brand-soft); color: var(--brand-dark); }

.muted { color: var(--muted); }
.mono  { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: .94em; }
.nowrap { white-space: nowrap; }

.flash {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    border: 1px solid transparent;
}
.flash.ok   { background: var(--green-soft); color: var(--green); border-color: #bfe6cd; }
.flash.err  { background: var(--red-soft);   color: var(--red);   border-color: #f4c4c4; }
.flash.warn { background: var(--amber-soft); color: var(--amber); border-color: #f0dcae; }
.flash .x { margin-left: auto; cursor: pointer; opacity: .6; background: none; border: none;
    color: inherit; padding: 0 2px; font-size: 17px; line-height: 1; }
.flash .x:hover { opacity: 1; background: none; }

/* ============================================================
   To'lov formasi
   ============================================================ */

.steps { display: flex; gap: 0; margin-bottom: 20px; flex-wrap: wrap; }
.step {
    display: flex; align-items: center; gap: 9px;
    padding: 0 18px 0 0; margin-right: 18px;
    color: var(--muted); font-size: 13.5px; font-weight: 550;
    border-right: 1px solid var(--border);
}
.step:last-child { border-right: none; margin-right: 0; padding-right: 0; }
.step .n {
    width: 24px; height: 24px; flex: 0 0 24px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--border); color: var(--muted);
    font-size: 12.5px; font-weight: 700;
}
.step.done .n, .step.active .n { background: var(--brand); color: #fff; }
.step.active { color: var(--text); }
.step.done { color: var(--green); }
.step.done .n { background: var(--green); }

.search-bar { display: flex; gap: 10px; align-items: stretch; }
.search-bar input {
    font-size: 17px; padding: 13px 15px;
    font-family: ui-monospace, "SF Mono", Consolas, monospace;
    letter-spacing: .06em; text-transform: uppercase;
}
.search-bar button { padding-left: 22px; padding-right: 22px; }

.student {
    display: block; width: 100%; text-align: left;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 15px 17px;
    margin-bottom: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.student:hover { border-color: var(--border-strong); background: var(--surface-2); }
.student.selected { border-color: var(--brand); background: var(--brand-soft); }
.student .top { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.student .nm { font-size: 15.5px; font-weight: 650; }
.student .meta { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.student .money {
    display: flex; gap: 18px; flex-wrap: wrap;
    margin-top: 11px; padding-top: 11px;
    border-top: 1px solid var(--border);
    font-size: 13.5px;
}
.student .money b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.student .money .k { color: var(--muted); font-size: 12px; }

.student.blocked {
    opacity: .72;
    cursor: not-allowed;
    background: var(--surface-2);
    border-style: dashed;
}
.student.blocked:hover { border-color: var(--border); }
.blocked-note {
    margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--border);
    color: var(--red); font-size: 13.5px; font-weight: 550;
}

/* Bonus kimga yozilishi */
.bonus-box {
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    min-height: 44px;
}
.bonus-box b { display: block; font-size: 15px; }
.bonus-box .why { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.bonus-box.manager { background: var(--green-soft); border-color: #bfe6cd; }
.bonus-box.manager b { color: var(--green); }
.bonus-box.undiruv { background: var(--brand-soft); border-color: #c3d8fb; }
.bonus-box.undiruv b { color: var(--brand-dark); }
.bonus-box.unknown { background: var(--amber-soft); border-color: #f0dcae; }
.bonus-box.unknown b { color: var(--amber); }

#dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 26px 20px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    background: var(--surface-2);
    transition: border-color .12s, background .12s;
}
#dropzone:hover, #dropzone.hover { border-color: var(--brand); background: var(--brand-soft); }
#dropzone .big { font-size: 26px; display: block; margin-bottom: 8px; opacity: .7; }
#dropzone img { max-width: 100%; max-height: 280px; border-radius: var(--radius-sm);
    box-shadow: var(--shadow); }

.submit-bar {
    position: sticky; bottom: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-bottom: 18px;
}
.submit-bar .summary { flex: 1; min-width: 200px; font-size: 14px; color: var(--text-2); }
.submit-bar .summary b { color: var(--text); font-size: 16px; }

.thumb {
    height: 36px; width: 36px; object-fit: cover;
    border-radius: 6px; border: 1px solid var(--border);
    cursor: zoom-in; display: block;
}

/* Rasm ko'rish oynasi */
.lightbox {
    position: fixed; inset: 0; z-index: 60;
    background: rgba(10, 16, 24, .82);
    display: none; align-items: center; justify-content: center;
    padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--radius);
    box-shadow: var(--shadow-lg); }
.lightbox .close {
    position: absolute; top: 18px; right: 22px;
    background: none; border: none; color: #fff; font-size: 30px; cursor: pointer;
    line-height: 1; padding: 4px 10px;
}
.lightbox .close:hover { background: none; opacity: .75; }

/* ============================================================
   Kirish sahifasi
   ============================================================ */

.login-wrap {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background: linear-gradient(160deg, #f4f6fa 0%, #e8eef8 100%);
}
.login-card {
    width: 100%; max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 32px 30px;
}
.login-card .logo {
    width: 46px; height: 46px; margin: 0 auto 16px;
    border-radius: 13px;
    background: linear-gradient(140deg, #3b82f6, #1d4ed8);
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 18px;
}
.login-card h1 { text-align: center; font-size: 19px; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13.5px; margin: 5px 0 24px; }
.login-card button { width: 100%; padding: 12px; }

/* ============================================================
   Moslashuvchanlik
   ============================================================ */

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
    body.nav-open .backdrop { display: block; }
    .main { margin-left: 0; }
    .burger { display: grid; place-items: center; }
    .topbar { padding: 0 16px; }
    .content { padding: 18px 16px 48px; }
}

@media (max-width: 560px) {
    body { font-size: 14.5px; }
    .card__body { padding: 16px; }
    .topbar h1 { font-size: 17px; }
    .topbar .sub { display: none; }
    .search-bar { flex-direction: column; }
    .submit-bar { flex-direction: column; align-items: stretch; }
    .submit-bar button, .submit-bar .btn { width: 100%; }
}

@media print {
    .sidebar, .topbar, .submit-bar, .burger { display: none !important; }
    .main { margin-left: 0; }
    .card { box-shadow: none; }
}
