/* =====================================================================
   MuhandisEdu — ilova dizayn tizimi
   Chap sidebar + modal oynalar. Oq fon, to'q matn, bitta ko'k aksent.
   ===================================================================== */

:root {
    --bg:           #ffffff;
    --bg-soft:      #f6f7f9;
    --bg-sidebar:   #fbfcfd;
    --text:         #14171c;
    --text-soft:    #3d444e;
    --text-muted:   #697280;
    --border:       #e4e7ec;
    --border-soft:  #eef0f3;
    --accent:       #14396b;
    --accent-hover: #0f2d55;
    --accent-tint:  #eff4fb;
    --accent-ring:  rgba(20, 57, 107, .14);
    --ok:           #17703f;
    --ok-tint:      #e9f6ee;
    --warn:         #8a5a00;
    --warn-tint:    #fdf4e3;
    --danger:       #b3261e;
    --danger-tint:  #fdecea;

    --r-sm: 7px;
    --r:    10px;
    --r-lg: 14px;

    --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
    --shadow:    0 4px 14px rgba(16,24,40,.07);
    --shadow-lg: 0 18px 48px rgba(16,24,40,.18);

    --sidebar-w: 250px;
    --header-h:  62px;
    --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg-soft);
    color: var(--text);
    font: 14.5px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

/* =====================================================================
   KARKAS
   ===================================================================== */
.app { min-height: 100vh; }

/* ------------------------------------------------------------ sidebar */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.sidebar-brand {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 16.5px;
    font-weight: 660;
    letter-spacing: -.02em;
    color: var(--text);
    flex: none;
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand span { color: var(--accent); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
}

.nav-label {
    font-size: 11px;
    font-weight: 640;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0 10px;
    margin: 18px 0 7px;
}
.nav-label:first-child { margin-top: 4px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: var(--r-sm);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 500;
    transition: background .13s var(--ease), color .13s var(--ease);
}
.nav-link:hover { background: #eef1f5; color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .78; }
.nav-link.active svg { opacity: 1; }
.nav-link .count {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1px 7px;
}

/* foydalanuvchi bloki */
.sidebar-user {
    flex: none;
    border-top: 1px solid var(--border-soft);
    padding: 12px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
}
.user-avatar {
    width: 32px; height: 32px; flex: none;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 640;
}
.user-meta { min-width: 0; flex: 1; }
.user-name {
    font-size: 13.5px; font-weight: 580; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role { font-size: 11.5px; color: var(--text-muted); }
.sidebar-user .btn { width: 100%; justify-content: center; margin-top: 8px; }

/* ------------------------------------------------------------ asosiy */
.main { margin-left: var(--sidebar-w); min-height: 100vh; }

.topbar {
    height: var(--header-h);
    background: rgba(255,255,255,.88);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 30;
}
.topbar h1 {
    margin: 0;
    font-size: 17px;
    font-weight: 620;
    letter-spacing: -.02em;
}
.topbar .actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

.sidebar-toggle {
    display: none;
    background: none; border: none; padding: 6px;
    border-radius: var(--r-sm); cursor: pointer; color: var(--text-soft);
}
.sidebar-toggle svg { width: 22px; height: 22px; }

.content { padding: 26px 28px 64px; max-width: 1280px; }
.page-intro { color: var(--text-muted); font-size: 14px; margin: -6px 0 22px; max-width: 70ch; }

/* =====================================================================
   KOMPONENTLAR
   ===================================================================== */

/* ------------------------------------------------------------ kartalar */
.card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    margin-bottom: 18px;
    overflow: hidden;
}
.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; gap: 12px;
}
.card-head h2 { margin: 0; font-size: 14.5px; font-weight: 620; }
.card-head .sub { color: var(--text-muted); font-size: 13px; margin-left: auto; }
.card-head .btn { margin-left: auto; }
.card-head .sub + .btn { margin-left: 0; }
.card-body { padding: 18px; }

/* ----------------------------------------------------------- statistika */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--r); padding: 17px 18px; box-shadow: var(--shadow-sm);
}
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.stat .label { color: var(--text-muted); font-size: 13px; }
.stat-icon { width: 18px; height: 18px; color: var(--accent); opacity: .5; flex: none; }
.stat .value { font-size: 30px; font-weight: 640; letter-spacing: -.025em; line-height: 1; }
.stat .value.attention { color: var(--warn); }
.stat a { display: inline-block; margin-top: 9px; font-size: 13px; }

/* -------------------------------------------------------------- jadval */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
    text-align: left; padding: 9px 18px;
    font-size: 11.5px; font-weight: 620; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-muted); background: #fafbfc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
td { padding: 11px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: #fbfcfd; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* ------------------------------------------------------------ belgilar */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px; border-radius: 20px;
    font-size: 12px; font-weight: 560; line-height: 1.5;
    white-space: nowrap;
}
.badge.ok     { background: var(--ok-tint);     color: var(--ok); }
.badge.warn   { background: var(--warn-tint);   color: var(--warn); }
.badge.danger { background: var(--danger-tint); color: var(--danger); }
.badge.info   { background: var(--accent-tint); color: var(--accent); }
.badge.muted  { background: var(--bg-soft);     color: var(--text-muted); border: 1px solid var(--border); }

/* ------------------------------------------------------------- tugmalar */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 8px 14px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    background: var(--bg); color: var(--text);
    font: inherit; font-size: 13.5px; font-weight: 560;
    line-height: 1.4; cursor: pointer; white-space: nowrap;
    transition: background .13s var(--ease), border-color .13s var(--ease),
                box-shadow .13s var(--ease), transform .08s var(--ease);
}
.btn:hover { background: #f7f8fa; border-color: #d5dae1; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg-soft); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-tint); border-color: #f0cbc8; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-link { border: none; background: none; color: var(--accent); padding: 4px 6px; font: inherit; font-size: 13px; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.btn-danger-link { border: none; background: none; color: var(--danger); padding: 4px 6px; font: inherit; font-size: 13px; cursor: pointer; }
.btn-danger-link:hover { text-decoration: underline; }

/* -------------------------------------------------------------- formalar */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 13px; font-weight: 560; margin-bottom: 6px; color: var(--text-soft); }
.field .hint { color: var(--text-muted); font-size: 12px; margin-top: 5px; }
.req { color: var(--danger); }

input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font: inherit; font-size: 14px;
    background: var(--bg); color: var(--text);
    transition: border-color .13s var(--ease), box-shadow .13s var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #d5dae1; }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}
input.error, select.error { border-color: var(--danger); }
input.error:focus, select.error:focus { box-shadow: 0 0 0 3px rgba(179,38,30,.12); }
.error-text { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.form-row.cols-2 { grid-template-columns: repeat(2, 1fr); }

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 34px;
}

/* -------------------------------------------------------------- xabarlar */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 15px; border-radius: var(--r); margin-bottom: 18px;
    font-size: 14px; border: 1px solid;
    animation: slide-down .25s var(--ease);
}
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-success { background: var(--ok-tint);     border-color: #c3e5d1; color: var(--ok); }
.alert-error   { background: var(--danger-tint); border-color: #f2cdca; color: var(--danger); }
.alert-warn    { background: var(--warn-tint);   border-color: #efdcb4; color: var(--warn); }

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
}

/* --------------------------------------------- hisob ma'lumotlari bloki */
.credentials {
    border: 1px solid #cfdcef; border-radius: var(--r);
    background: var(--accent-tint); padding: 17px 19px; margin-bottom: 18px;
    animation: slide-down .25s var(--ease);
}
.credentials h3 { margin: 0 0 3px; font-size: 14.5px; font-weight: 620; color: var(--accent); }
.credentials .warn-note { color: var(--warn); font-size: 13px; margin: 0 0 14px; }
.cred-grid { display: flex; gap: 30px; flex-wrap: wrap; }
.cred-grid .k { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.cred-grid .v {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 17px; font-weight: 640; letter-spacing: .01em;
}

/* =====================================================================
   MODAL OYNALAR  (<dialog> + animatsiya)
   ===================================================================== */
dialog.modal {
    width: min(620px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    padding: 0;
    border: none;
    border-radius: var(--r-lg);
    background: var(--bg);
    color: var(--text);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(10px) scale(.985);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}
dialog.modal.is-open { opacity: 1; transform: none; }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }

dialog.modal::backdrop {
    background: rgba(16, 24, 40, .5);
    opacity: 0;
    transition: opacity .2s var(--ease);
}
dialog.modal.is-open::backdrop { opacity: 1; }

.modal-head {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 20px 22px 0;
}
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 630; letter-spacing: -.02em; }
.modal-head p { margin: 5px 0 0; font-size: 13.5px; color: var(--text-muted); }
.modal-close {
    margin-left: auto; flex: none;
    background: none; border: none; padding: 5px; cursor: pointer;
    border-radius: 6px; color: var(--text-muted);
    transition: background .13s var(--ease), color .13s var(--ease);
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-close svg { width: 19px; height: 19px; display: block; }

.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-foot {
    display: flex; gap: 9px; justify-content: flex-end;
    padding: 14px 22px 20px;
    border-top: 1px solid var(--border-soft);
    margin-top: 4px;
}

/* =====================================================================
   YORDAMCHI
   ===================================================================== */
.empty { padding: 44px 20px; text-align: center; color: var(--text-muted); font-size: 14px; }
.empty svg { width: 30px; height: 30px; opacity: .35; display: block; margin: 0 auto 10px; }
.muted { color: var(--text-muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.inline-form { display: inline; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }

/* =====================================================================
   KIRISH SAHIFASI
   ===================================================================== */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 396px; background: var(--bg);
    border: 1px solid var(--border); border-radius: var(--r-lg);
    box-shadow: var(--shadow); padding: 32px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.auth-card .lead { color: var(--text-muted); font-size: 14px; margin: 0 0 22px; }
.auth-card .btn { width: 100%; padding: 10px; }

/* =====================================================================
   MOSLASHUV
   ===================================================================== */
.scrim {
    position: fixed; inset: 0; z-index: 35;
    background: rgba(16,24,40,.4);
    opacity: 0; visibility: hidden;
    transition: opacity .2s var(--ease), visibility .2s var(--ease);
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .24s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { opacity: 1; visibility: visible; }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .topbar { padding: 0 16px; }
    .content { padding: 20px 16px 56px; }
    .modal-head, .modal-body, .modal-foot { padding-left: 18px; padding-right: 18px; }
}

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

/* =====================================================================
   ISH TOPSHIRISH
   ===================================================================== */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0;
    margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.upload-slot {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 16px; margin-bottom: 12px;
    border: 1px dashed var(--border); border-radius: var(--r);
    background: #fcfdfe;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.upload-slot.is-filled { border-style: solid; background: var(--bg); }
.upload-icon {
    width: 40px; height: 40px; flex: none; border-radius: 10px;
    background: var(--accent-tint); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.upload-icon svg { width: 20px; height: 20px; }
.upload-meta { flex: 1; min-width: 0; }
.upload-title { font-weight: 580; font-size: 14.5px; margin-bottom: 3px; }
.upload-hint { color: var(--text-muted); font-size: 13px; }
.upload-file { font-size: 13.5px; }
.upload-analysis { margin-top: 7px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.upload-form { flex: none; }
.upload-form label { cursor: pointer; }

.upload-warnings { margin: 9px 0 0; padding: 0; list-style: none; }
.upload-warnings li {
    display: flex; gap: 8px; align-items: flex-start;
    padding: 6px 10px; margin-bottom: 5px;
    background: var(--warn-tint); border-radius: 6px;
    font-size: 13px; color: var(--warn); line-height: 1.45;
}
.w-icon { width: 15px; height: 15px; flex: none; margin-top: 2px; }

.submit-row {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border-soft);
}
.submit-row .btn { margin-left: auto; }

textarea { resize: vertical; min-height: 74px; font-family: inherit; }

/* ------------------------------------------------------ ish ko'rish */
.file-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.file-box { border: 1px solid var(--border); border-radius: var(--r); padding: 15px; }
.file-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.file-head svg { width: 18px; height: 18px; color: var(--accent); }

table.mini { margin-top: 10px; font-size: 13px; }
table.mini td { padding: 5px 0; border-bottom: 1px solid var(--border-soft); }
table.mini td:first-child { color: var(--text-muted); width: 42%; }
table.mini tr:last-child td { border-bottom: none; }

.preview-link { display: block; margin-top: 12px; }
.preview-link img {
    width: 100%; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; display: block;
}
.preview-link span {
    display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); text-align: center;
}
.preview-link:hover { text-decoration: none; }
.preview-link:hover img { border-color: var(--accent); }

/* =====================================================================
   BAHOLASH
   ===================================================================== */
.grade-table td { vertical-align: top; padding-top: 13px; padding-bottom: 13px; }
.grade-table input[type=number] { width: 68px; text-align: center; }
.grade-table input[type=text] { font-size: 13px; padding: 7px 9px; }

.score-cell { display: flex; align-items: center; gap: 7px; }
.score-cell .muted { font-size: 13px; white-space: nowrap; }

.suggest { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; line-height: 1.45; }
.suggest b { color: var(--accent); }
.sg-icon { width: 14px; height: 14px; color: var(--accent); flex: none; margin-top: 3px; }

.grade-summary {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-soft);
}
.gs-total { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.gs-total b { font-size: 18px; letter-spacing: -.02em; }
.grade-summary .btn:first-of-type { margin-left: auto; }

/* ------------------------------------------------------------ izohlar */
.thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.msg {
    padding: 11px 14px; border-radius: var(--r);
    background: var(--bg-soft); border: 1px solid var(--border-soft);
    font-size: 14px; line-height: 1.5;
}
.msg.is-student { background: var(--accent-tint); border-color: #dfe9f7; }
.msg-head { display: flex; gap: 9px; align-items: center; margin-bottom: 4px; font-size: 12.5px; }
.msg-head b { font-size: 13.5px; }

.comment-form { display: flex; gap: 9px; }
.comment-form input { flex: 1; }

code.expr {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px; background: var(--bg-soft);
    border: 1px solid var(--border-soft); border-radius: 5px; padding: 2px 7px;
}

/* hisob natijalari */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 16px; }
.calc-box { border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.calc-head { font-weight: 580; font-size: 14px; margin-bottom: 14px; color: var(--accent); }
.calc-box .field { margin-bottom: 12px; }
.calc-box label sub { font-size: .8em; }

/* video darslar */
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.video-box { margin: 0; }
.video-frame {
    position: relative; padding-top: 56.25%;
    border-radius: var(--r); overflow: hidden;
    background: #0d1117; border: 1px solid var(--border);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-box figcaption {
    display: flex; align-items: center; gap: 10px;
    margin-top: 9px; font-size: 14px; font-weight: 540;
}
.video-box figcaption form { margin-left: auto; }
input[type=file] { padding: 8px 11px; font-size: 13.5px; }

/* =====================================================================
   TESTLAR
   ===================================================================== */
.question-box { border: 1px solid var(--border); border-radius: var(--r); padding: 15px; margin-bottom: 12px; }
.question-box.is-correct { border-color: #c3e5d1; background: var(--ok-tint); }
.question-box.is-wrong { border-color: #f2cdca; background: var(--danger-tint); }
.q-head { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; font-size: 13px; }
.q-num {
    width: 24px; height: 24px; border-radius: 50%; flex: none;
    background: var(--accent); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 640;
}
.q-text { font-size: 15px; line-height: 1.5; }
.q-answer { margin-top: 9px; font-size: 13.5px; color: var(--text-muted); }
.q-options { margin: 10px 0 0; padding: 0; list-style: none; }
.q-options li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; font-size: 14px; }
.q-options li.is-correct { color: var(--ok); font-weight: 540; }
.o-icon { width: 15px; height: 15px; flex: none; margin-top: 3px; opacity: .55; }
.q-options li.is-correct .o-icon { opacity: 1; }

.option-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.option-row input[type=checkbox] { width: 17px; height: 17px; flex: none; }
.check-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 7px; cursor: pointer;
}
.check-row:hover { background: var(--bg-soft); }
.check-row input { width: 17px; height: 17px; flex: none; }

.q-choices { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.choice {
    display: flex; align-items: flex-start; gap: 11px; padding: 11px 13px;
    border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer;
    transition: border-color .13s var(--ease), background .13s var(--ease);
}
.choice:hover { background: var(--bg-soft); border-color: #d5dae1; }
.choice input { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-tint); }

/* test topshirish karkasi */
.plain-wrap { max-width: 780px; margin: 0 auto; padding: 28px 20px 70px; }
.test-head {
    display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
    position: sticky; top: 0; z-index: 20; padding: 14px 0;
    background: var(--bg-soft);
}
.test-head h1 { margin: 0; font-size: 20px; font-weight: 640; letter-spacing: -.02em; }
.test-head p { margin: 3px 0 0; font-size: 13.5px; }
.timer {
    margin-left: auto; text-align: center; flex: none;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--r); padding: 8px 16px; box-shadow: var(--shadow-sm);
}
.timer-value {
    display: block; font-size: 21px; font-weight: 650; letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}
.timer-label { font-size: 11.5px; color: var(--text-muted); }
.timer.is-urgent { border-color: var(--danger); background: var(--danger-tint); }
.timer.is-urgent .timer-value { color: var(--danger); }

.test-foot {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border);
}
.test-foot .btn { margin-left: auto; }

/* natija */
.result-hero {
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
    padding: 24px 26px; border-radius: var(--r-lg); margin-bottom: 20px;
    border: 1px solid var(--border); background: var(--bg);
}
.result-hero.is-pass { border-color: #c3e5d1; background: var(--ok-tint); }
.result-hero.is-fail { border-color: #f2cdca; background: var(--danger-tint); }
.result-pct { font-size: 46px; font-weight: 650; letter-spacing: -.03em; line-height: 1; }
.result-hero.is-pass .result-pct { color: var(--ok); }
.result-hero.is-fail .result-pct { color: var(--danger); }
.result-verdict { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.result-verdict svg { width: 19px; height: 19px; }
.result-hero .btn { margin-left: auto; }

/* =====================================================================
   PORTFOLIO VA BILDIRISHNOMA
   ===================================================================== */
.comp-row { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.comp-name { width: 210px; flex: none; font-size: 14px; font-weight: 540; }
.comp-bar { flex: 1; height: 9px; border-radius: 20px; background: var(--bg-soft);
            border: 1px solid var(--border-soft); overflow: hidden; }
.comp-fill { height: 100%; background: var(--accent); border-radius: 20px; }
.comp-value { width: 52px; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.comp-meta { width: 90px; font-size: 12.5px; }

.notif { display: flex; align-items: flex-start; gap: 13px; padding: 13px;
         border: 1px solid var(--border-soft); border-radius: var(--r); margin-bottom: 9px; }
.notif.is-new { border-color: #cfdcef; background: var(--accent-tint); }
.notif-icon { width: 34px; height: 34px; flex: none; border-radius: 9px;
              background: var(--bg-soft); color: var(--accent);
              display: flex; align-items: center; justify-content: center; }
.notif-icon svg { width: 17px; height: 17px; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 570; font-size: 14px; }
.notif .btn { flex: none; }

@media (max-width: 640px) {
    .comp-name { width: 130px; font-size: 13px; }
    .comp-meta { display: none; }
}

/* AI ko'rigi — tavsiyaviy */
.ai-summary { margin: 0 0 14px; font-size: 15px; line-height: 1.6; }
.ai-findings { margin: 0; padding: 0; list-style: none; }
.ai-findings li {
    display: flex; gap: 9px; align-items: flex-start;
    padding: 9px 11px; border-radius: var(--r-sm); margin-bottom: 6px;
    font-size: 14px; line-height: 1.5; background: var(--bg-soft);
}
.ai-findings li.sev-missing { background: var(--danger-tint); }
.ai-findings li.sev-warning { background: #fdf6e6; }
.ai-findings li.sev-info    { background: var(--ok-tint); }
.ai-findings .o-icon { margin-top: 3px; opacity: .8; }
.ai-meta { font-size: 12.5px; margin-top: 12px; }
.ai-note {
    display: flex; gap: 9px; align-items: flex-start;
    margin-top: 12px; padding: 11px 13px; font-size: 13px;
    border: 1px dashed var(--border); border-radius: var(--r-sm);
    color: var(--text-muted);
}
.ai-note svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.card-head h2 svg { width: 17px; height: 17px; vertical-align: -3px; margin-right: 6px; }

/* AI ko'rigi — kutish animatsiyasi */
.ai-waiting { display: flex; align-items: center; gap: 16px; padding: 22px 18px; }
.ai-waiting-title { font-weight: 570; font-size: 14.5px; margin-bottom: 2px; }
.ai-scan {
    position: relative; flex: none;
    width: 46px; height: 46px; border-radius: 12px;
    background: var(--accent-tint); border: 1px solid #cfdcef;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center;
}
.ai-scan-icon { width: 20px; height: 20px; color: var(--accent); opacity: .85; }
.ai-scan-line {
    position: absolute; left: 0; right: 0; height: 34%;
    background: linear-gradient(180deg, transparent, rgba(20,57,107,.16), transparent);
    animation: ai-scan 1.8s ease-in-out infinite;
}
@keyframes ai-scan {
    0%   { transform: translateY(-120%); }
    100% { transform: translateY(320%); }
}
@media (prefers-reduced-motion: reduce) {
    .ai-scan-line { animation-duration: 4s; }
}

/* AI mezon taklifi — bosib qo'yiladi, o'zi to'ldirilmaydi */
.ai-suggest { margin-top: 7px; }
.ai-suggest-apply {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; font-size: 12.5px; font-weight: 540;
    border: 1px dashed #cfdcef; border-radius: 20px;
    background: var(--accent-tint); color: var(--accent);
    cursor: pointer; font-family: inherit;
    transition: border-color .13s var(--ease), background .13s var(--ease);
}
.ai-suggest-apply:hover { border-style: solid; background: #e6edf8; }
.ai-suggest-apply .sg-icon { width: 12px; height: 12px; }
.ai-suggest-put { opacity: .7; font-weight: 460; }
.ai-suggest-apply.is-applied { border-style: solid; background: var(--ok-tint);
                               color: var(--ok); border-color: #c3e5d1; }
.ai-suggest-apply.is-applied .ai-suggest-put::before { content: '✓ '; }
.ai-suggest-why { font-size: 12px; margin-top: 4px; line-height: 1.45; }

/* AI so'rov cheklovi */
.ai-left { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.ai-left.is-out {
    padding: 2px 9px; border-radius: 20px; font-size: 12px;
    background: var(--bg-soft); border: 1px solid var(--border);
    color: var(--text-muted);
}

/* Etalon va namuna sxemalari */
.schema-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.schema-box { margin: 0; }
.schema-box img, .namuna-img {
    width: 100%; height: auto; display: block;
    border: 1px solid var(--border); border-radius: var(--r);
    background: #fff;
}
.schema-box img:hover, .namuna-img:hover { border-color: #cfdcef; }
/* Sxemalar SVG: ~700 mm li varaq, yozuvlari o'qilishi uchun kamida 1200 px */
.namuna-img { overflow-x: auto; padding: 6px; }
.namuna-img svg { display: block; width: 100%; height: auto; min-width: 1200px; }
.namuna-links { display: flex; flex-wrap: wrap; gap: 1.2rem; margin: .6rem 0 0; font-size: 13px; }
.schema-box figcaption {
    margin-bottom: 7px; font-size: 13px; font-weight: 540; color: var(--text-muted);
}
.schema-box + .schema-box { margin-top: 20px; }
.schema-svg {
    overflow-x: auto; padding: 6px; background: #fff;
    border: 1px solid var(--border); border-radius: var(--r);
}
.schema-svg svg { display: block; width: 100%; height: auto; min-width: 1200px; }
.namuna-note {
    display: flex; gap: 10px; align-items: flex-start;
    margin-top: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.55;
    background: #fdf6e6; border: 1px solid #f0e0bd; border-radius: var(--r-sm);
}
.namuna-note svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: #b45309; }

/* Topshirish uchun yetishmaydigan narsalar */
.submit-todo { flex: 1; }
.submit-todo-title { font-size: 13px; font-weight: 560; margin-bottom: 6px; }
.submit-todo ul { margin: 0; padding: 0; list-style: none; }
.submit-todo li {
    display: flex; gap: 8px; align-items: flex-start;
    font-size: 13px; line-height: 1.5; color: var(--text-muted);
    padding: 3px 0;
}
.td-icon { width: 14px; height: 14px; flex: none; margin-top: 3px; opacity: .7; }

/* ---------- Tipovoy elementlar katalogi ---------- */
.catalog-search { display: flex; gap: 8px; flex-wrap: wrap; }
.catalog-search input {
    flex: 1; min-width: 240px; padding: .5rem .7rem;
    border: 1px solid var(--border); border-radius: var(--r-sm); font: inherit;
}
.catalog-hint { margin: 12px 0 0; font-size: 12.5px; line-height: 1.7; }
.catalog-hint code {
    background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

.card-body > .catalog-item:first-child { margin-top: -6px; }
.catalog-item { border-bottom: 1px solid var(--border-soft); }
.catalog-item:last-child { border-bottom: 0; }
.catalog-item > summary {
    display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
    padding: 9px 6px; cursor: pointer; list-style: none;
    border-radius: var(--r-sm);
}
.catalog-item > summary::-webkit-details-marker { display: none; }
.catalog-item > summary::before {
    content: '›'; color: var(--text-muted); font-size: 15px; line-height: 1;
    transition: transform .12s var(--ease); display: inline-block;
}
.catalog-item[open] > summary::before { transform: rotate(90deg); }
.catalog-item > summary:hover { background: var(--bg-soft); }
.catalog-item[open] > summary { background: var(--bg-soft); }
.cat-mark { font-weight: 600; font-size: 13.5px; min-width: 190px; }
.cat-size { color: var(--text-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.cat-std  { color: var(--text-muted); font-size: 12px; margin-left: auto; }
.cat-mass { color: var(--text-muted); font-size: 12px; min-width: 58px; text-align: right; }

.catalog-body { display: flex; gap: 22px; flex-wrap: wrap; padding: 4px 6px 16px 20px; }
.cat-img { flex: 0 0 250px; max-width: 100%; }
.cat-img img {
    width: 100%; height: auto; display: block; background: #fff;
    border: 1px solid var(--border); border-radius: var(--r-sm);
}
.cat-facts { flex: 1; min-width: 300px; }
.cat-sub { font-weight: 560; font-size: 13px; margin: 0 0 4px; }
.cat-purpose { margin: 0 0 8px; font-size: 13px; line-height: 1.55; color: var(--text-soft); }
.cat-note {
    display: flex; gap: 8px; align-items: flex-start; margin: 0 0 10px;
    padding: 8px 10px; font-size: 12.5px; line-height: 1.5;
    background: #fdf6e6; border: 1px solid #f0e0bd; border-radius: var(--r-sm);
}
.cat-note svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: #b45309; }

/* muhim ko'rsatkichlar — yorliqchalar */
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.cat-chip {
    font-size: 12px; padding: 2px 9px; border-radius: 20px;
    background: var(--accent-tint); border: 1px solid #dbe6f5;
    color: var(--accent); font-weight: 560; white-space: nowrap;
}

/* qolgan parametrlar — ikki ustunli ixcham ro'yxat */
.cat-specs {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0 24px; margin: 0;
}
.cat-specs > div {
    display: flex; align-items: baseline; gap: 8px;
    padding: 3px 0; border-bottom: 1px dotted var(--border);
    font-size: 12.5px; line-height: 1.5;
}
.cat-specs .k { color: var(--text-muted); white-space: nowrap; }
.cat-specs .v {
    margin-left: auto; text-align: right; font-weight: 540; color: var(--text);
    font-variant-numeric: tabular-nums;
}
.cat-rebar-title { margin: 12px 0 3px; font-weight: 560; font-size: 12.5px; }
.cat-rebar { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.9; }
.cat-rebar .sep { margin: 0 6px; opacity: .5; }

/* Oddiy parametr ro'yxati (blanka, sxema sahifalari) */
.param-list { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; }
.param-list dt { color: var(--text-muted); font-size: 13px; }
.param-list dd { margin: 0; font-size: 13px; font-weight: 540; }

/* Mavzu maqolasi (topics.content_html) */
.topic-article { line-height: 1.7; }
.topic-article h3 { margin: 20px 0 8px; font-size: 16px; }
.topic-article p  { margin: 0 0 10px; }
.topic-article ul { margin: 0 0 12px; padding-left: 20px; }
.topic-article li { margin-bottom: 5px; }
.topic-article code {
    background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; font-size: 12.5px;
}
.topic-article table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 13px; }
.topic-article th, .topic-article td {
    border: 1px solid var(--border); padding: 6px 9px; text-align: left;
}
.topic-article th { background: var(--bg-soft); font-weight: 560; }

/* Materiallar sahifasidagi katalog kartasi */
.material-highlight {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 18px; margin-bottom: 18px;
    background: var(--bg); border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--r); box-shadow: var(--shadow-sm);
    color: var(--text);
}
.material-highlight:hover { text-decoration: none; border-color: #cfdcef; box-shadow: var(--shadow); }
.mh-icon {
    width: 40px; height: 40px; flex: none; border-radius: var(--r-sm);
    background: var(--accent-tint); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.mh-icon svg { width: 21px; height: 21px; }
.mh-text { flex: 1; min-width: 0; }
.mh-text b { display: block; font-size: 14.5px; font-weight: 620; margin-bottom: 3px; }
.mh-text span { color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.mh-go { flex: none; color: var(--accent); font-size: 13.5px; font-weight: 560; }
@media (max-width: 620px) { .mh-go { display: none; } }
