:root {
  --navy: #0a1f44;
  --blue: #2b659e;
  --blue-soft: #e6f0fa;
  --band: #d5ebff;
  --teal: #0f8d70;
  --teal-soft: #e7f6f2;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1d253c;
  --muted: #5d6f8d;
  --line: #dfe4ed;
  --good: #1b7248;
  --good-soft: #e3f3ea;
  --warn: #8f5d00;
  --warn-soft: #fbf0d9;
  --bad: #ae3126;
  --bad-soft: #fbe7e4;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 3px 14px rgba(29, 37, 60, .07);
  --shadow-up: 0 14px 30px rgba(29, 37, 60, .14);
  --grad: linear-gradient(270deg, #19ae8b 0%, #23939f 50%, #3e7bb6 100%);
  --grad-action: linear-gradient(90deg, #2f6ea8 0%, #0f8d70 100%);
  --font: "Montserrat", "Segoe UI", Arial, sans-serif;
  --nq-head: 120px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--teal); }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.28rem; } h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
ul { margin: 0; padding-left: 1.2em; }
:focus-visible { outline: 3px solid #19ae8b; outline-offset: 2px; }
.container { width: 100%; max-width: 1560px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.prose { white-space: pre-line; }
.nowrap { white-space: nowrap; }

/* Tugmalar */
.btn { display: inline-block; background: var(--grad-action); color: #fff; border: 0; border-radius: 12px; padding: 11px 18px; font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; text-align: center; transition: filter .2s ease, transform .2s ease, background .2s ease; }
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); color: #fff; }
.btn-outline { background: transparent; color: var(--blue); box-shadow: inset 0 0 0 1.5px #a9c4e0; }
.btn-outline:hover { background: var(--blue-soft); color: var(--blue); filter: none; }
.btn-danger { background: var(--bad); }
.btn-danger-outline { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1.5px #e3a8a1; }
.btn-danger-outline:hover { background: var(--bad-soft); color: var(--bad); filter: none; }
.btn-light { background: #fff; color: var(--navy); }
.btn-light:hover { color: var(--navy); }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 9px; }
.btn[disabled] { background: #c5ced8; box-shadow: none; cursor: not-allowed; filter: none; transform: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-align: left; }
.link-button:hover { color: var(--teal); }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; min-width: 0; }

/* Sahifa sarlavhasi */
.page-head { background: url("../img/nq-rosette.svg") right 6% top -96px / 340px no-repeat, var(--band); padding: 30px 0 34px; }
.page-head h1 { margin: 0; font-size: 2rem; font-weight: 500; color: #061422; }
.page-head p { margin: 8px 0 0; color: #3a4a66; max-width: 860px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; color: #475262; font-size: 1rem; }
.crumbs a { display: inline-flex; color: #475262; }
.crumbs a:hover { color: var(--teal); }
.crumbs .ic { font-size: .95rem; opacity: .6; }
.crumbs .crumb-home .ic { font-size: 1.3rem; opacity: 1; color: #23939f; }
.crumbs span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(620px, 100%); }
.page-body { padding: 40px 24px 64px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Kartochkalar */
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card-link { display: block; color: inherit; transition: transform .25s ease, box-shadow .25s ease; }
.card-link:hover { color: inherit; transform: translateY(-4px); box-shadow: var(--shadow-up); }
.note-card { border-top: 6px solid #3e7bb6; }
.note-card:nth-child(even) { border-top-color: #19ae8b; }
.note-card:hover h3 { color: var(--blue); }
.note-card__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tile-ic { flex: none; width: 54px; height: 54px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-size: 1.7rem; }
.note-card:nth-child(even) .tile-ic { background: var(--teal-soft); color: var(--teal); }
.meta { list-style: none; padding: 0; margin: 0 0 4px; font-size: .9rem; }
.meta li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.meta li:last-child { border-bottom: 0; }
.meta li span:first-child { color: var(--muted); }
.meta li span:last-child { text-align: right; font-weight: 500; }

/* Yangilik kartochkasi */
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 20px; }
.post-card { display: flex; flex-direction: column; color: var(--text); }
.post-card:hover { color: var(--text); }
.post-media { position: relative; display: block; height: 260px; border-radius: var(--radius); overflow: hidden; background: url("../img/nq-rosette.svg") right -80px top -70px / 320px no-repeat, linear-gradient(135deg, #3e7bb6, #23939f 55%, #19ae8b); box-shadow: var(--shadow); transition: transform .3s ease, box-shadow .3s ease; }
.post-card:nth-child(3n+2) .post-media { background: url("../img/nq-rosette.svg") right -80px top -70px / 320px no-repeat, linear-gradient(135deg, #0a1f44, #1f5a88); }
.post-card:nth-child(3n) .post-media { background: url("../img/nq-rosette.svg") right -80px top -70px / 320px no-repeat, linear-gradient(135deg, #0f6f66, #23939f); }
.post-card:hover .post-media { transform: translateY(-4px); box-shadow: var(--shadow-up); }
.post-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.post-date { position: absolute; left: 14px; bottom: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 10px; background: var(--grad-action); color: #fff; font-size: .86rem; font-weight: 500; }
.post-card h3 { font-size: 1.1rem; font-weight: 500; margin: 14px 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; transition: color .2s ease; }
.post-card:hover h3 { color: var(--blue); }
.post-card p { color: var(--muted); font-size: .92rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.article { max-width: 920px; margin: 0 auto; }
.article-meta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .92rem; margin-bottom: 16px; }
.article-meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-lead { font-size: 1.08rem; font-weight: 500; color: #3a4a66; }
.article-image { width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--radius); margin-bottom: 22px; }

.check-list { list-style: none; padding: 0; }
.check-list li { padding: 8px 0 8px 26px; position: relative; border-bottom: 1px solid var(--line); }
.check-list li:last-child { border-bottom: 0; }
.check-list li::before { content: ""; position: absolute; left: 2px; top: 15px; width: 12px; height: 12px; background: var(--grad); border-radius: 50%; }

/* Hujjatlar */
.doc-row { display: flex; gap: 16px; align-items: center; background: var(--surface); padding: 16px 20px; border-radius: 14px; margin-bottom: 12px; box-shadow: var(--shadow); transition: transform .22s ease, box-shadow .22s ease; }
.doc-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-up); }
.doc-row .doc-main { flex: 1; min-width: 0; }
.doc-row strong { font-weight: 600; }
.format-tag { flex: none; background: var(--blue-soft); color: var(--blue); font-size: .78rem; font-weight: 700; width: 54px; height: 54px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.sticky-card { position: sticky; top: 124px; border-top: 6px solid #19ae8b; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.chip { background: #fff; color: var(--text); border-radius: 20px; padding: 7px 16px; font-size: .9rem; font-weight: 500; box-shadow: var(--shadow); transition: background .2s ease; }
.chip:hover { background: var(--blue-soft); color: var(--text); }
.chip.active, .chip.active:hover { background: var(--grad-action); color: #fff; }

/* Aloqa */
.contact-card { color: #fff; border-radius: var(--radius); padding: 28px; background: url("../img/nq-rosette.svg") right -130px bottom -130px / 420px no-repeat, linear-gradient(135deg, #2f6ea8, #2a7a78); box-shadow: var(--shadow); }
.contact-card h2 { font-size: 1.45rem; margin-bottom: 20px; }
.contact-list { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 16px; }
.contact-list li { display: flex; gap: 14px; align-items: center; }
.contact-list small { display: block; font-size: .84rem; opacity: .85; }
.contact-list b { font-weight: 500; overflow-wrap: anywhere; }
.contact-list a { color: #fff; }
.contact-ic { flex: none; width: 46px; height: 46px; border-radius: 12px; background: rgba(255, 255, 255, .16); display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }

/* Kirish sahifalari */
.auth-stage { display: flex; align-items: center; justify-content: center; padding: 56px 16px; min-height: calc(100vh - var(--nq-head) - 200px); background: url("../img/nq-rosette.svg") right -170px center / 620px no-repeat, url("../img/nq-rosette.svg") left -240px bottom -240px / 560px no-repeat, radial-gradient(900px 500px at 85% 0, rgba(62, 123, 182, .35), transparent 70%), radial-gradient(900px 500px at 0 100%, rgba(25, 174, 139, .18), transparent 70%), var(--navy); }
.auth-card { position: relative; width: 100%; padding: 34px 32px 28px; border-radius: 20px; overflow: hidden; box-shadow: 0 24px 60px rgba(3, 12, 30, .4); }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--grad); }
.auth-card h1 { font-size: 1.6rem; margin-bottom: 18px; }

/* Holat belgilari */
.badge { display: inline-block; border-radius: 12px; padding: 3px 11px; font-size: .78rem; font-weight: 600; background: var(--blue-soft); color: var(--blue); white-space: nowrap; }
.badge-accepted, .badge-valid, .badge-passed, .badge-published, .badge-present, .badge-online { background: var(--good-soft); color: var(--good); }
.badge-submitted, .badge-in_review, .badge-applications_closed, .badge-excused, .badge-blended { background: var(--warn-soft); color: var(--warn); }
.badge-rejected, .badge-revoked, .badge-failed, .badge-absent, .badge-blocked { background: var(--bad-soft); color: var(--bad); }
.badge-draft, .badge-cancelled, .badge-archived, .badge-none { background: #e9edf1; color: var(--muted); }
.badge-offline { background: #fbf1dc; color: var(--warn); }

/* Formalar */
.field { margin-bottom: 16px; }
.field label, .field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.required { color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel], input[type=search], input[type=date], input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #cfd8e3; border-radius: var(--radius-sm); font: inherit; font-size: .95rem; background: #fff; color: var(--text); transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: #23939f; box-shadow: 0 0 0 3px rgba(25, 174, 139, .18); }
textarea { resize: vertical; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: .875rem; margin-top: 3px; }
.help { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.field-check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.field-check input { width: auto; }
.field ul[id], .field div[id] > div { list-style: none; padding: 0; }
.field div[id] label { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.field div[id] label input { width: auto; }
.form-narrow { max-width: 460px; margin: 0 auto; }
.form-medium { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; background: var(--surface); padding: 16px 18px; border-radius: var(--radius); box-shadow: var(--shadow); }
.filter-bar > * { flex: 1 1 170px; }
.filter-bar .field { margin: 0; }
.filter-bar .btn { flex: 0 0 auto; }

/* Xabarlar */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 12px; border: 1px solid transparent; }
.alert-success { background: var(--good-soft); color: var(--good); border-color: #bfe2cf; }
.alert-info { background: var(--blue-soft); color: var(--blue); border-color: #c8dcf0; }
.alert-warning { background: var(--warn-soft); color: var(--warn); border-color: #eedbb0; }
.alert-error { background: var(--bad-soft); color: var(--bad); border-color: #f2c9c4; }
.messages { padding-top: 16px; }
.dev-note { background: var(--warn-soft); border: 1px dashed #d9b466; border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; font-size: .92rem; }

/* Jadval */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; border-radius: 0; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid #eaeef3; vertical-align: top; }
th { color: #3a4a66; font-weight: 600; font-size: .8rem; background: #eef3fa; white-space: nowrap; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f7fafd; }
tr:last-child td { border-bottom: 0; }
td .field-compact, td select, td input { min-width: 130px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.pagination { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 28px; }

/* Kabinet va panel */
.app-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding-top: 28px; padding-bottom: 64px; align-items: start; }
.side-nav { background: var(--surface); border-radius: 14px; position: sticky; top: 120px; max-height: calc(100vh - 136px); overflow-y: auto; box-shadow: var(--shadow); }
.side-head { position: sticky; top: 0; z-index: 1; color: #fff; padding: 15px 16px; font-size: 1.1rem; font-weight: 600; line-height: 1.25; background: url("../img/nq-rosette.svg") right -46px top -56px / 160px no-repeat, linear-gradient(90deg, #2f6ea8, #2a7a78); }
.side-head small { display: block; margin-top: 2px; font-size: .82rem; font-weight: 400; opacity: .9; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav a { display: flex; align-items: center; gap: 11px; color: var(--text); padding: 11px 16px; font-size: .9rem; font-weight: 500; border-bottom: 1px solid #eef1f5; transition: padding .2s ease, background .2s ease, color .2s ease; }
.side-nav a:last-child { border-bottom: 0; }
.side-nav a .ic { font-size: 1.15rem; color: var(--muted); }
.side-nav a:hover { color: var(--teal); padding-left: 20px; }
.side-nav a:hover .ic { color: var(--teal); }
.side-nav a.active { background: var(--teal-soft); color: var(--teal); font-weight: 600; box-shadow: inset 3px 0 0 #19ae8b; }
.side-nav a.active .ic { color: var(--teal); }
.nav-count { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; font-size: .74rem; margin-left: auto; }
.side-group { font-size: .72rem; font-weight: 700; color: var(--muted); padding: 14px 16px 5px; text-transform: uppercase; letter-spacing: .04em; }
.content-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.content-head h1 { margin: 0; font-size: 1.6rem; font-weight: 600; }
.stat { background: var(--surface); border-top: 5px solid #3e7bb6; border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); transition: transform .25s ease, box-shadow .25s ease; }
.stat:nth-child(even) { border-top-color: #19ae8b; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-up); }
.stat-value { font-size: 1.85rem; font-weight: 700; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 500; }
.stack > * + * { margin-top: 20px; }
.kv { display: grid; grid-template-columns: minmax(130px, 220px) minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.module { border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; background: #fff; box-shadow: var(--shadow); }
.module h3 { margin-bottom: 6px; }
.card .module { background: #f6f9fc; box-shadow: none; }
.material-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; flex-wrap: wrap; }
.notice-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notice-row:last-child { border-bottom: 0; }
.notice-unread { font-weight: 600; }
details summary { cursor: pointer; color: var(--blue); }
.changes { font-size: .85rem; margin-top: 4px; }

/* Grafik */
.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; }
.bar-fill { display: block; height: 14px; min-width: 3px; background: var(--blue); border-radius: 0 4px 4px 0; transition: background .1s; }
.bar-row:hover .bar-fill { background: var(--navy); }
.bar-value { font-weight: 600; font-variant-numeric: tabular-nums; }

dialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 16px 50px rgba(0, 0, 0, .3); font-family: var(--font); }
dialog::backdrop { background: rgba(10, 31, 68, .6); }
dialog .btn-row { justify-content: flex-end; margin-top: 16px; }
.error-page { text-align: center; padding: 90px 16px; }
.error-page .code { font-size: 5.5rem; font-weight: 800; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 1290px) {
  :root { --nq-head: 112px; }
  .grid-4, .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-layout { grid-template-columns: 250px minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .detail-layout, .app-layout { grid-template-columns: minmax(0, 1fr); }
  .side-nav { position: static; max-height: none; display: flex; overflow-x: auto; gap: 4px; padding: 6px; }
  .side-nav a { white-space: nowrap; border-bottom: 0; border-radius: 8px; padding: 9px 12px; }
  .side-nav a:hover { padding-left: 12px; }
  .side-nav a.active { box-shadow: none; }
  .side-group, .side-head { display: none; }
  .sticky-card { position: static; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  :root { --nq-head: 92px; }
  .container, .page-body { padding-left: 16px; padding-right: 16px; }
  .page-head { background-size: 220px; background-position: right -60px top -60px, center; padding: 22px 0 24px; }
  .page-head h1 { font-size: 1.5rem; }
  .auth-stage { padding: 28px 16px; background-size: 340px, 320px, auto, auto, auto; }
  .auth-card { padding: 28px 20px 22px; }
  .doc-row { flex-wrap: wrap; }
  .doc-row .doc-main { flex: 1 1 calc(100% - 70px); }
  .doc-row .btn { width: 100%; }
}
@media (max-width: 600px) {
  .grid-3, .form-grid, .post-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dd { margin-bottom: 8px; }
  h1 { font-size: 1.55rem; }
  .bar-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
}
