/* Olimpiada boshqaruv paneli — asosiy uslublar */
:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #1b2333;
  --muted: #667085;
  --line: #e3e7ef;
  --brand: #2453d6;
  --brand-soft: #e8eefc;
  --side: #121a2e;
  --side-ink: #c5cde0;
  --ok: #12805c;
  --ok-soft: #e3f6ee;
  --warn: #b35c00;
  --warn-soft: #fff3e0;
  --err: #c0262d;
  --err-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.hidden { display: none !important; }

/* --- Layout --- */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh;
          background: linear-gradient(to right, var(--side) 236px, transparent 236px); }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; position: sticky; top: 0;
        height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 16px; padding: 4px 10px 16px; display: flex; gap: 8px; align-items: center; }
.brand small { display: block; font-weight: 400; color: #8b95ad; font-size: 11.5px; }
.nav-title { text-transform: uppercase; font-size: 10.5px; letter-spacing: .08em; color: #7782a0; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 9px; color: var(--side-ink); padding: 7px 10px; border-radius: 7px; margin: 1px 0; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; }
.nav .ico { width: 18px; text-align: center; }
.main { min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; padding: 12px 24px; background: var(--panel);
       border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top .who { display: flex; align-items: center; gap: 12px; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.menu-btn { display: none; background: none; border: 0; font-size: 22px; cursor: pointer; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; left: -260px; width: 250px; z-index: 50; transition: left .2s; }
  .side.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-block; }
  .content { padding: 16px; }
  .top { padding: 10px 16px; }
}

/* --- Cards --- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.grid > .card, .grid > * + .card, .grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.stat { padding: 16px 18px; }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 12.5px; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
       padding: 7px 13px; border-radius: 8px; font: inherit; font-weight: 500; cursor: pointer; line-height: 1.3; white-space: nowrap; }
.btn:hover { background: #f6f7fb; text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #1c44b5; }
.btn.danger { color: var(--err); border-color: #f2c4c6; }
.btn.danger:hover { background: var(--err-soft); }
.btn.ok { background: var(--ok); color: #fff; border-color: var(--ok); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* --- Forms --- */
label { display: block; font-weight: 500; margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=url], input[type=search],
input[type=datetime-local], input[type=date], input[type=color], select, textarea {
  width: 100%; border: 1px solid #cfd6e3; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--ink);
}
input[type=color] { height: 38px; padding: 3px; cursor: pointer; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a9bdf3; border-color: var(--brand); }
textarea { resize: vertical; }
select[multiple] { min-height: 140px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; }
.form-narrow { max-width: 760px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.filters > * { flex: 1 1 150px; max-width: 280px; }
.filters .grow { flex: 2 1 240px; max-width: none; }
.filters .btns { flex: 0 0 auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--brand-soft); color: var(--brand); border-radius: 20px; padding: 2px 10px; font-size: 12.5px; cursor: pointer; border: 0; font: inherit; }
.multi-box { border: 1px solid #cfd6e3; border-radius: 8px; padding: 8px 10px; max-height: 200px; overflow: auto; background: #fff; }
.multi-box .check { font-weight: 400; margin: 3px 0; }

/* --- Tables --- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #f8f9fc; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
tr.inactive td { color: #98a2b3; }
tr.place-1 td { background: #fff8db; } tr.place-2 td { background: #f2f3f5; } tr.place-3 td { background: #fbeee0; }

/* --- Badges & alerts --- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; background: #eef1f6; color: #475467; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.blue { background: var(--brand-soft); color: var(--brand); }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert.success { background: var(--ok-soft); border-color: #b5e4d0; color: #0b5e43; }
.alert.error { background: var(--err-soft); border-color: #f2c4c6; color: #8f1a20; }
.alert.info { background: var(--brand-soft); border-color: #c9d6f7; color: #1d3f9e; }
.alert.warn { background: var(--warn-soft); border-color: #f5d3a7; color: #874400; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* --- Pagination --- */
.pager { display: flex; gap: 4px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }

/* --- Ball kiritish --- */
.enter td { padding: 6px 10px; }
.enter input.score { width: 74px; text-align: center; font-weight: 600; padding: 6px; }
.enter .of { color: var(--muted); font-size: 12px; }
.enter tr.saved td { background: #effaf4; }
.enter tr.flash td { animation: flash 1.2s ease; }
.enter tr.error td { background: var(--err-soft); }
.enter .err { color: var(--err); font-size: 12px; }
.enter .pct { font-weight: 700; }
.ginputs { display: flex; gap: 6px; flex-wrap: wrap; }
.ginputs .gi { display: flex; flex-direction: column; align-items: center; }
.ginputs .gi small { color: var(--muted); font-size: 11px; }
@keyframes flash { from { background: #c8f1db; } to { background: #effaf4; } }
.progress { height: 8px; background: #edf0f5; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--ok); }

/* --- Login --- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px;
              background: radial-gradient(circle at 20% 10%, #e3eaff, transparent 50%), var(--bg); }
.login { width: 100%; max-width: 380px; }

/* --- Sertifikat dizayneri --- */
.designer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .designer { grid-template-columns: 1fr; } }
.canvas { position: relative; width: 100%; user-select: none; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
.canvas img { display: block; width: 100%; pointer-events: none; }
.tf { position: absolute; white-space: nowrap; cursor: move; padding: 0 2px; outline: 1px dashed transparent; line-height: 1.15; }
.tf:hover { outline-color: #7a9cf0; }
.tf.sel { outline: 2px solid var(--brand); background: rgba(36, 83, 214, .07); }
.tf .mw { position: absolute; top: 100%; height: 2px; background: rgba(36,83,214,.35); display: none; }
.tf.sel .mw { display: block; }
@font-face { font-family: "DSans"; src: url("/static/fonts/DejaVuSans.ttf"); }
@font-face { font-family: "DSans"; font-weight: 700; src: url("/static/fonts/DejaVuSans-Bold.ttf"); }
@font-face { font-family: "DSerif"; src: url("/static/fonts/DejaVuSerif.ttf"); }
@font-face { font-family: "DSerif"; font-weight: 700; src: url("/static/fonts/DejaVuSerif-Bold.ttf"); }

/* --- Turli --- */
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }
.chart-box { position: relative; height: 260px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.diff { font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; max-width: 480px; }
@media print {
  .side, .top, .no-print, .pager { display: none !important; }
  .layout { display: block; } .content { padding: 0; } .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}

/* --- Bot matnlari sahifasi --- */
.texts-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 10px 12px; margin-bottom: 8px; }
.texts-bar input[type=search] { flex: 1; min-width: 0; }
.tgroup { padding: 0; }
.tgroup > summary { padding: 14px 18px; cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tgroup > summary::-webkit-details-marker { display: none; }
.tgroup > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.tgroup[open] > summary::before { transform: rotate(90deg); }
.tgroup[open] > summary { border-bottom: 1px solid var(--line); }
.trow { padding: 12px 18px; border-bottom: 1px dashed var(--line); }
.trow:last-child { border-bottom: 0; }
.trow-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.trow textarea, .trow input[type=text] { width: 100%; }
.trow.has-error { background: var(--err-soft); }
.err-text { color: var(--err); font-size: 13px; margin-top: 4px; font-weight: 600; }
.sticker-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.slot { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.slot-title { font-weight: 600; }
.slot-now { min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #f8f9fc; border-radius: 8px; }
.slot-form { display: flex; gap: 6px; }
.slot-form input { width: 70px; flex: 1; text-align: center; font-size: 18px; }
.big-emoji { font-size: 48px; line-height: 1.1; }
img.stk { width: 72px; height: 72px; object-fit: contain; }
.steps { margin: 4px 0 12px; padding-left: 20px; }
.sticker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stk-item { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stk-btns { display: flex; gap: 4px; justify-content: center; }
.emoji-pop { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
.emoji-toggle { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--brand); font-size: 26px; cursor: pointer; box-shadow: 0 4px 14px rgba(36,83,214,.35); }
.emoji-list { display: none; width: 300px; max-height: 260px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px; box-shadow: 0 8px 24px rgba(16,24,40,.18); }
.emoji-pop.open .emoji-list { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-list button { border: 0; background: none; font-size: 21px; padding: 4px; cursor: pointer; border-radius: 6px; }
.emoji-list button:hover { background: var(--brand-soft); }
@media (max-width: 700px) { .texts-bar { flex-wrap: wrap; } .emoji-list { width: 260px; } }

/* --- Telegram xabarnomalar --- */
.link-code { background: var(--brand-soft); border: 1px dashed #b7c7f3; border-radius: 10px; padding: 14px; }
.code-big { font: 700 20px/1.2 ui-monospace, Consolas, monospace; background: #fff; padding: 4px 10px; border-radius: 6px; user-select: all; }

/* --- E'tirozlar --- */
.appeal { border-left: 4px solid var(--warn); }
.appeal.accepted { border-left-color: var(--ok); }
.appeal.rejected { border-left-color: var(--err); }
.appeal-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.appeal-text { white-space: pre-wrap; background: #f8f9fc; border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.appeal-answer { white-space: pre-wrap; font-size: 13px; color: #344054; margin-bottom: 8px; }
.appeal-form textarea { width: 100%; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); display: inline-flex; gap: 6px; align-items: center; }
.tabs a:hover { text-decoration: none; background: var(--brand-soft); }
.tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tabs a.active .badge { background: rgba(255,255,255,.25); color: #fff; }

/* --- Davomat --- */
.att-counts { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: stretch; }
.att-stat { flex: 1 1 140px; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 14px; font: inherit; cursor: pointer; text-align: left; }
.att-stat b { display: block; font-size: 24px; }
.att-stat.came b { color: var(--ok); } .att-stat.absent b { color: var(--err); } .att-stat.unmarked b { color: var(--warn); }
.att-stat:hover { border-color: var(--brand); }
.att-bar { flex-basis: 100%; height: 8px; background: #eef1f6; border-radius: 4px; overflow: hidden; display: flex; }
.att-bar .came { background: var(--ok); } .att-bar .absent { background: var(--err); }
.att-filters { display: flex; flex-direction: column; gap: 10px; }
.att-q { font-size: 18px !important; padding: 12px 14px !important; width: 100%; }
.chip-radio input { display: none; }
.chip-radio span { display: inline-block; padding: 5px 12px; border-radius: 20px; background: #eef1f6; cursor: pointer; font-size: 13px; }
.chip-radio input:checked + span { background: var(--brand); color: #fff; }
.att-row.came { background: var(--ok-soft); }
.att-row.absent { background: var(--err-soft); }
.att-btns { white-space: nowrap; text-align: right; }
.att-btns .btn { padding: 7px 12px; }
.att-yes.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.att-no.on { background: var(--err); color: #fff; border-color: var(--err); }
.att-name { font-weight: 600; }
.mobile-only { display: none; }
@media (max-width: 700px) {
  .hide-sm { display: none; } .mobile-only { display: block; font-weight: 400; }
  .att-btns .btn { padding: 8px 9px; font-size: 13px; }
}
.danger-zone { border-color: #f2c4c6; }
.danger-zone h2 { color: var(--err); }

/* --- Sertifikat shablonlari (kartochkalar) --- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tpl-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.tpl-card.inactive { opacity: .75; }
.tpl-thumb { display: flex; align-items: center; justify-content: center; background: #e9edf3; height: 190px; border: 0; padding: 10px; cursor: pointer; width: 100%; }
.tpl-thumb img { max-width: 100%; max-height: 170px; box-shadow: 0 2px 10px rgba(0,0,0,.15); background: #fff; }
.tpl-card.pick:hover { border-color: var(--brand); }
.tpl-body { padding: 10px 12px; }
.tpl-title { display: flex; justify-content: space-between; gap: 6px; align-items: flex-start; margin-bottom: 4px; }
.tpl-add { align-items: center; justify-content: center; min-height: 160px; border-style: dashed; color: var(--brand); font-weight: 600; }
.mt-s { margin-top: 6px; }
.job { padding: 10px 12px; border-radius: 8px; background: var(--brand-soft); margin-top: 10px; }
.job.ok { background: var(--ok-soft); }
.job.err { background: var(--err-soft); color: var(--err); }
.job .bar { height: 6px; background: #fff; border-radius: 4px; margin-top: 6px; overflow: hidden; }
.job .bar span { display: block; height: 100%; background: var(--brand); transition: width .4s; }

/* --- Joylashtirish --- */
.room-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.room-chip { display: flex; flex-direction: column; min-width: 92px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.room-chip:hover { border-color: var(--brand); text-decoration: none; }
.room-chip small { color: var(--muted); font-size: 11.5px; }
.room-chip.off { opacity: .55; }
.room-chip.bad { border-color: #f5b5b5; background: #fff7f7; }
.room-chip.empty { opacity: .6; }
details.inline-edit { display: inline-block; position: relative; }
details.inline-edit > summary { list-style: none; }
details.inline-edit > summary::-webkit-details-marker { display: none; }
details.inline-edit[open] > form:first-of-type { min-width: 300px; }
.seat-layout { display: grid; grid-template-columns: 1fr 320px; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .seat-layout { grid-template-columns: 1fr; } }
.board { background: #334155; color: #fff; text-align: center; font-weight: 700; letter-spacing: .3em; border-radius: 8px; padding: 6px; width: 50%; margin: 0 auto 14px; }
.seat-grid { display: flex; flex-direction: column; gap: 12px; overflow-x: auto; }
.seat-row { display: flex; gap: 22px; justify-content: center; }
.desk { display: flex; gap: 3px; padding: 4px; background: #e2e8f0; border-radius: 8px; }
.seat { position: relative; width: 104px; height: 74px; border: 2px solid transparent; border-radius: 6px; background: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 4px 6px; font: inherit; text-align: left; overflow: hidden; }
.seat .no { position: absolute; top: 3px; left: 6px; font-size: 11px; font-weight: 700; color: #1e3a8a; }
.seat .code { position: absolute; top: 3px; right: 6px; font-size: 11px; color: #475569; }
.seat .nm { font-weight: 600; font-size: 12.5px; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.seat .nm2 { font-size: 11.5px; color: #334155; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.seat .sent { position: absolute; bottom: 2px; right: 4px; font-size: 11px; }
.seat.free { background: #fff; border: 2px dashed #cbd5e1; }
.seat.free.unused { opacity: .45; }
.seat.off { background: #f1f5f9; color: #94a3b8; align-items: center; justify-content: center; }
.seat.bad { border-color: #dc2626; box-shadow: 0 0 0 2px #fecaca; }
.seat.picked { outline: 3px solid var(--brand); outline-offset: 1px; }
.seat:hover { filter: brightness(.97); }
.legend { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.legend .sw { width: 16px; height: 16px; border-radius: 4px; flex: none; }
.legend b { margin-left: auto; }
@media (max-width: 700px) {
  .seat { width: 74px; height: 60px; padding: 3px 4px; }
  .seat .nm { font-size: 11px; } .seat .nm2 { display: none; }
  .seat-row { gap: 10px; justify-content: flex-start; }
  .board { width: auto; }
}

/* --- Avtomatik tekshiruv --- */
.review-item { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
@media (max-width: 700px) { .review-item { grid-template-columns: 1fr; } }
.review-img img { width: 100%; border: 1px solid var(--line); border-radius: 6px; }
.ans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 4px; }
.ans { border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 12.5px; background: #fff; }
.ans.ok { background: #dcfce7; border-color: #86efac; }
.ans.bad { background: #fee2e2; border-color: #fca5a5; }
.ans small { color: #166534; margin-left: 2px; }

/* Bosh sahifa: olimpiada bosqichlari */
.flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.flow-step { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; background: #fff; }
.flow-step:hover { border-color: #94a3b8; }
.flow-step .dot { flex: 0 0 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: #e2e8f0; color: #475569; }
.flow-step.done { background: #f0fdf4; border-color: #bbf7d0; }
.flow-step.done .dot { background: #22c55e; color: #fff; }
.flow-step.doing { background: #eff6ff; border-color: #bfdbfe; }
.flow-step.doing .dot { background: #2453d6; color: #fff; }

/* Qulf bannerlari */
.lockbox { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lockline { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px 0; }

/* ======================================================================
   Mobil ilova ko'rinishi (PWA): pastki menyu, drawer, kartochkali jadvallar
   ====================================================================== */
.backdrop, .tabbar, .drawer-user, .drawer-logout, .app-title, .avatar-btn { display: none; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; margin-bottom: 16px; }
.quick a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; background: var(--panel);
           border: 1px solid var(--line); border-radius: 12px; color: var(--ink); font-weight: 600; font-size: 13px; box-shadow: var(--shadow); text-align: center; }
.quick a:hover { text-decoration: none; border-color: var(--brand); background: var(--brand-soft); }
.quick i { font-style: normal; font-size: 24px; line-height: 1.1; }

@media (max-width: 900px) {
  :root { --tab-h: 58px; --top-h: 52px; }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  body.noscroll { overflow: hidden; }
  /* yuqori panel: ilova sarlavhasi + profil */
  .top { padding: calc(6px + env(safe-area-inset-top)) 14px 6px; min-height: var(--top-h); }
  .menu-btn, .top .who, .crumbs { display: none; }
  .app-title { display: block; font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .avatar-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font: 700 15px var(--font); }
  /* drawer */
  .side { left: -100%; width: min(86vw, 330px); height: 100dvh; padding-top: calc(12px + env(safe-area-inset-top)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 60; }
  .side.open { left: 0; }
  .backdrop { z-index: 55; }
  .backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .55); }
  .brand { display: none; }
  .drawer-user { display: flex; align-items: center; gap: 10px; color: #fff; padding: 4px 6px 14px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.12); }
  .drawer-user .avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
  .drawer-x { margin-left: auto; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 50%; width: 34px; height: 34px; font-size: 15px; }
  .nav a { padding: 12px 10px; font-size: 15px; }
  .drawer-logout { display: block; margin-top: 18px; }
  /* pastki menyu */
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid var(--line);
            height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(16,24,40,.06); }
  .tabbar a, .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative;
            color: var(--muted); background: none; border: 0; font: 500 11px var(--font); text-decoration: none; min-width: 0; }
  .tabbar i { font-style: normal; font-size: 22px; line-height: 1; }
  .tabbar .on { color: var(--brand); font-weight: 700; }
  .tabbar .on::before { content: ""; position: absolute; top: 0; width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }
  /* kontent */
  .content { padding: 14px 12px 24px; }
  h1 { font-size: 20px; }
  .card { padding: 14px; border-radius: 12px; }
  .page-head { align-items: stretch; margin-bottom: 12px; }
  .page-head > .btns, .page-head > a.btn { width: 100%; }
  .page-head .btns .btn { flex: 1; justify-content: center; }
  .btn { min-height: 42px; padding: 9px 14px; }
  .btn.sm { min-height: 36px; }
  input[type=text], input[type=password], input[type=number], input[type=url], input[type=search],
  input[type=datetime-local], input[type=date], select, textarea { font-size: 16px; padding: 10px 12px; min-height: 44px; }
  .filters > *, .filters .grow { flex: 1 1 calc(50% - 8px); max-width: none; }
  .filters .grow { flex-basis: 100%; }
  .filters .btns { flex-basis: 100%; }
  .filters .btns .btn { flex: 1; justify-content: center; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs a { white-space: nowrap; flex: 0 0 auto; }
  .stat .v { font-size: 22px; }
  .quick { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .quick a { padding: 10px 2px; font-size: 11.5px; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: 8px; }
  .emoji-pop { bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom)); }
  .texts-bar { top: var(--top-h); }
  .chart-box { height: 220px; }
}

/* Jadvallar telefonda kartochka ko'rinishida */
@media (max-width: 700px) {
  .table-wrap { border: 0; background: none; overflow: visible; border-radius: 0; }
  table.rc, table.rc tbody { display: block; }
  table.rc thead { display: none; }
  table.rc tr { display: block; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; box-shadow: var(--shadow); }
  table.rc tbody tr:hover { background: #fff; }
  table.rc td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border: 0; border-bottom: 1px dashed var(--line);
                text-align: right; min-height: 32px; background: transparent !important; word-break: break-word; }
  table.rc td:last-child { border-bottom: 0; }
  table.rc td::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; text-align: left; flex: 0 0 34%; }
  table.rc td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; }
  table.rc td[data-label=""]::before { display: none; }
  table.rc td:empty { display: none; }
  table.rc td[colspan] { display: block; text-align: center; }
  table.rc td[colspan]::before { display: none; }
  table.rc tr.place-1 { background: #fff8db; } table.rc tr.place-2 { background: #f4f5f7; } table.rc tr.place-3 { background: #fbeee0; }
  table.rc tr.inactive { opacity: .65; }
  .enter input.score { width: 84px; font-size: 18px; }
  .pager a, .pager span { padding: 9px 13px; }
  .progress { min-width: 120px; }
}
.fold-box, .fold-btn { display: none; }
@media (max-width: 700px) {
  form.filters .fold-btn { display: inline-flex; flex: 1 1 100%; justify-content: center; }
  form.filters .fold-box { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 100%; max-width: none; }
  form.filters .fold-box[hidden] { display: none; }
  form.filters .fold-box > * { flex: 1 1 calc(50% - 8px); max-width: none; }
  .grid.g4:has(> .stat) { grid-template-columns: 1fr 1fr; gap: 10px; }
}
/* Ball kiritish: telefonda ixcham kartochka (ID · ism · sinf bir qatorda) */
@media (max-width: 700px) {
  .enter table.rc tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; }
  .enter table.rc td { flex: 1 1 100%; }
  .enter table.rc td[data-label="ID"], .enter table.rc td[data-label="Ishtirokchi"], .enter table.rc td[data-label="Sinf"] {
    flex: 0 1 auto; border-bottom: 0; padding: 4px 0; justify-content: flex-start; text-align: left; }
  .enter table.rc td[data-label="ID"]::before, .enter table.rc td[data-label="Ishtirokchi"]::before, .enter table.rc td[data-label="Sinf"]::before { display: none; }
  .enter table.rc td[data-label="ID"] { font-weight: 700; font-size: 16px; }
  .enter table.rc td[data-label="Sinf"]::after { content: "-sinf"; color: var(--muted); }
}
@media (max-width: 700px) {
  .enter table.rc td[data-label="Sinf"] { gap: 0; }
  .enter table.rc td[data-label="Ball"], .enter table.rc td[data-label="Foiz"] { flex: 1 1 40%; }
  .enter table.rc td[data-label="Ball"]::before, .enter table.rc td[data-label="Foiz"]::before { flex-basis: auto; }
}
.guide-row { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.guide-thumb { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }
@media (max-width: 700px) { .guide-row { grid-template-columns: 1fr; } .guide-thumb { max-width: 220px; } }

/* Yordam sahifasi */
.how h3 { margin: 18px 0 8px; color: var(--brand); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.how h3:first-child { margin-top: 0; }
.how-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.how-step:last-child { border-bottom: 0; }
.how-n { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.mt-s { margin-top: 8px; }
.faq { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; }
.faq > summary { padding: 12px 14px; cursor: pointer; font-weight: 600; list-style: none; }
.faq > summary::-webkit-details-marker { display: none; }
.faq > summary::after { content: "▾"; float: right; color: var(--muted); }
.faq[open] > summary { border-bottom: 1px solid var(--line); }
.faq[open] > summary::after { content: "▴"; }
.faq-body { padding: 4px 14px 10px; font-size: 13.5px; }
.faq-body ol, .faq-body ul { padding-left: 20px; }
