/* ==========================================================================
   AI'ni o'qitish sahifasi (/admin/train)
   pages.css dagi .acc-* (hisob sahifasi) karkasi ustiga quriladi.
   ========================================================================== */

.train-badge { margin-left: 4px; }
.acc-nav .nav-count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--primary); color: #fff; }
.acc-nav .nav-count:empty { display: none; }

.train-stats { display: grid; gap: 8px; margin-top: 22px; }
.train-stat { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.train-stat b { font-family: var(--font-display); font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Kirish taqiqlangan ---------- */
.gate { text-align: center; display: grid; justify-items: center; gap: 12px; padding: 48px 28px; }
.gate-icon { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); }
.gate-icon svg { width: 26px; height: 26px; }
.gate code { font-family: var(--font-mono); font-size: 12.5px; background: var(--code-bg); padding: 2px 6px; border-radius: 6px; }

/* ---------- Bosqichlar ---------- */
.steps { display: flex; gap: 6px; margin-bottom: 24px; list-style: none; padding: 0; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.steps li + li::before { content: ""; width: 22px; height: 1px; background: var(--border-strong); margin-right: 2px; }
.steps .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; border: 1px solid var(--border-strong); background: var(--surface); }
.steps li.active { color: var(--text); }
.steps li.active .num { background: var(--grad); border-color: transparent; color: #fff; }
.steps li.done .num { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.35); color: var(--green); }

.step-pane { display: grid; gap: 18px; }

/* ---------- Segmentli tanlov ---------- */
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); transition: background .15s, color .15s; }
.seg button svg { width: 16px; height: 16px; }
.seg button.active { background: var(--bg-elev); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--border-strong); }

/* ---------- Fayl tashlash maydoni ---------- */
.dropzone { position: relative; display: grid; justify-items: center; gap: 8px; padding: 40px 20px; text-align: center; border-radius: 18px; border: 1.5px dashed var(--border-strong); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: rgba(124,127,245,.06); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--primary); }
.dropzone .dz-icon svg { width: 22px; height: 22px; }
.dropzone b { font-size: 15.5px; }
.dropzone small { color: var(--muted); font-size: 13px; }
.dropzone:focus-within { box-shadow: 0 0 0 4px var(--ring); border-color: var(--primary); }

.inline-form { display: flex; gap: 10px; }
.inline-form .input { flex: 1; min-width: 0; }

.source-chip { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.source-chip svg { width: 18px; height: 18px; color: var(--primary); flex: none; }
.source-chip .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-chip button { color: var(--primary); font-weight: 600; font-size: 13.5px; flex: none; }

/* ---------- Formalar ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field-hint { font-size: 12.5px; color: var(--muted); }
.req { color: var(--red); margin-left: 2px; }
textarea.input { height: auto; min-height: 150px; padding: 12px 14px; resize: vertical; line-height: 1.55; }
select.input { appearance: none; padding-right: 38px; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--bg-elev); color: var(--text); }
.input[type="date"] { color-scheme: dark; }
[data-theme="light"] .input[type="date"] { color-scheme: light; }
details.more summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-2); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary svg { width: 16px; height: 16px; transition: transform .2s; }
details.more[open] summary svg { transform: rotate(90deg); }
details.more > .form-grid { margin-top: 14px; }

.mode-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.mode-card:hover { border-color: var(--border-strong); }
.mode-card:has(input:checked) { border-color: var(--primary); background: rgba(124,127,245,.08); box-shadow: 0 0 0 3px var(--ring); }
.mode-card input { position: absolute; opacity: 0; }
.mode-card svg { width: 20px; height: 20px; color: var(--primary); flex: none; margin-top: 1px; }
.mode-card b { display: block; font-size: 14.5px; }
.mode-card small { color: var(--muted); font-size: 12.5px; }

.pick { display: grid; gap: 8px; }
.pick-list { display: grid; gap: 6px; max-height: 260px; overflow: auto; }
.pick-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); text-align: left; font-size: 14px; transition: border-color .15s, background .15s; }
.pick-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pick-item.selected { border-color: var(--primary); background: rgba(124,127,245,.08); }
.pick-item small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.pick-item span { min-width: 0; }

/* ---------- Ogohlantirishlar ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; border: 1px solid; }
.alert svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.alert .grow { flex: 1; min-width: 0; }
.alert .btn { margin-top: 8px; }
.alert-warn { background: rgba(245,196,81,.08); border-color: rgba(245,196,81,.3); color: var(--text-2); }
.alert-warn svg { color: var(--gold); }
.alert-info { background: rgba(124,127,245,.08); border-color: rgba(124,127,245,.3); color: var(--text-2); }
.alert-info svg { color: var(--primary); }
.alert-danger { background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.3); color: var(--text-2); }
.alert-danger svg { color: var(--red); }
.alert-success { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.3); color: var(--text-2); }
.alert-success svg { color: var(--green); }
.alerts { display: grid; gap: 8px; }

/* ---------- Ko'rsatkichlar ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tile { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); display: grid; gap: 2px; font-size: 12.5px; color: var(--muted); }
.tile b { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Bo'laklar jadvali ---------- */
.chunk-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
.chunk-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.chunk-table th, .chunk-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.chunk-table td.num { color: var(--muted); font-variant-numeric: tabular-nums; width: 1%; white-space: nowrap; }
.chunk-table tr.row { cursor: pointer; }
.chunk-table tr.row:hover td { background: var(--surface); }
.chunk-table tr.excerpt td { background: var(--surface); color: var(--text-2); white-space: pre-wrap; font-size: 13px; line-height: 1.6; }
.chunk-scroll { max-height: 420px; overflow: auto; border-radius: 14px; border: 1px solid var(--border); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

/* ---------- Jarayon ---------- */
.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width .5s var(--ease); }
.progress.done i { background: var(--green); }
.progress.failed i { background: linear-gradient(90deg, #f59e0b, #ef4444); }

.job-live { display: grid; gap: 14px; padding: 20px; border-radius: 18px; background: var(--surface-2); border: 1px solid var(--border-strong); }
.job-live-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job-live-head b { font-size: 16px; }
.job-live-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.phases { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14px; }
.phases li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.phases li .ph { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border-strong); flex: none; }
.phases li .ph svg { width: 13px; height: 13px; }
.phases li.done { color: var(--text-2); }
.phases li.done .ph { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.35); color: var(--green); }
.phases li.current { color: var(--text); font-weight: 600; }
.phases li.current .ph { border-color: var(--primary); color: var(--primary); }
.phases li.current .ph .spinner { width: 12px; height: 12px; border-width: 2px; }

.st { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.st-run { background: rgba(124,127,245,.1); border-color: rgba(124,127,245,.3); color: var(--primary); }
.st-done { background: rgba(52,211,153,.1); border-color: rgba(52,211,153,.3); color: var(--green); }
.st-fail { background: rgba(248,113,113,.1); border-color: rgba(248,113,113,.3); color: var(--red); }
.st-off { color: var(--muted); }

.jobs-table td, .src-table td { vertical-align: middle; }
.jobs-table .progress { width: 120px; }
.cell-title { font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-sub { font-size: 12px; color: var(--muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.err-line { font-size: 12px; color: var(--red); margin-top: 4px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 320px; height: 40px; }
.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }
.more-row { display: flex; justify-content: center; margin-top: 14px; }

.busy { position: relative; pointer-events: none; opacity: .7; }

/* ---------- Tezkor yuklash (lex.uz havolalari) ---------- */
.quick { display: grid; gap: 10px; }
.quick textarea { min-height: 84px; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; resize: vertical; }
.quick-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }

.quick-list { display: grid; gap: 10px; margin-top: 16px; }
.quick-list:empty { display: none; }
.qi { display: grid; gap: 10px; padding: 14px 16px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.qi.qi-error { border-color: rgba(248,113,113,.3); }
.qi.qi-done { border-color: rgba(52,211,153,.3); }
.qi-head { display: flex; align-items: flex-start; gap: 12px; }
.qi-head .grow { flex: 1; min-width: 0; }
.qi-title { font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
.qi-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.qi-sub a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); }
.qi .cell-sub { max-width: none; white-space: normal; }
.qi-notes { display: grid; gap: 6px; }
.qi-notes .alert { padding: 9px 12px; font-size: 13px; }
.qi-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qi-fields .field { gap: 4px; }
.qi-fields label { font-size: 12.5px; }
.qi-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.qi-actions .spacer { flex: 1; }
.qi select.input { height: 36px; font-size: 13.5px; }

.quick-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; padding: 12px 16px; border-radius: 14px; background: rgba(124,127,245,.08); border: 1px solid rgba(124,127,245,.3); }

.manual { display: grid; gap: 18px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--border); }
.manual-head { display: flex; justify-content: space-between; align-items: center; }
.manual-head h3 { font-family: var(--font-display); font-size: 17px; }
.manual .steps { margin-bottom: 4px; }

@media (max-width: 860px) {
  .form-grid, .mode-cards, .qi-fields { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .inline-form { flex-direction: column; }
  .train-stats { grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .toolbar .input { max-width: none; }
}

/* ---------- E'tirozlar ---------- */
.seg .seg-count { font-size: 11.5px; color: var(--muted); font-weight: 700; }
.seg .seg-count:empty { display: none; }
.fb-list { display: grid; gap: 14px; }
.fb-empty { padding: 18px 0; text-align: center; }
.fb-item { border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; background: var(--surface); display: grid; gap: 12px; }
.fb-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb-when { margin-left: auto; font-size: 12.5px; }
.fb-label { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.fb-q { font-weight: 600; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-comment { margin: 0; padding: 10px 14px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 10px 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-answer summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text-2); }
.fb-answer-text { margin-top: 8px; max-height: 320px; overflow: auto; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-review { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.fb-fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.fb-fields .input { height: 40px; }
.fb-fields .fb-note { height: auto; min-height: 40px; padding: 9px 14px; resize: vertical; line-height: 1.45; }
.fb-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
@media (max-width: 720px) {
  .fb-fields { grid-template-columns: 1fr; }
  .fb-when { margin-left: 0; width: 100%; }
}

/* ---------- lex.uz yangilanishlari ---------- */
.sync-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.sync-head .btn svg { width: 15px; height: 15px; }
.sync-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.sync-box { display: grid; gap: 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); font-size: 13.5px; }
.sync-box small { font-size: 12px; }
.sync-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.sync-bar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.sync-list { display: grid; gap: 10px; }
.sync-hint { font-size: 13px; margin: 0 0 4px; }
.sync-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.sync-main { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.sync-main .tag { justify-self: start; }
.sync-actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 760px) {
  .sync-stats { grid-template-columns: 1fr; }
  .sync-item { flex-direction: column; }
  .sync-head { flex-direction: column; }
}
