/* Yaponiya Iqtisodiyoti — Admin: blok muharriri, grafik konstruktori, yangi ekranlar.
   admin.css dagi o‘zgaruvchilarga tayanadi (yorug‘ / qorong‘i mavzu). */

.bad-t { color: var(--down); }
.warn-t { color: var(--warn); }
.req { color: var(--down); font-weight: 400; font-size: 11.5px; }
.be-x {
  width: 24px; height: 24px; border-radius: 5px; border: 0; background: transparent; color: var(--text-3);
  display: inline-grid; place-items: center; cursor: pointer; padding: 0; flex: none;
}
.be-x:hover { background: var(--surface-3); color: var(--text); }
.be-x.danger:hover { background: var(--down-soft); color: var(--down); }
.be-x[disabled] { opacity: .35; pointer-events: none; }
.be-x svg { width: 14px; height: 14px; }

/* yic (charts.js) ↔ admin o‘zgaruvchilari */
.yic-host { --ink: var(--text); --ink-2: var(--text-2); --muted: var(--text-3); --line: var(--border); --f-sans: var(--font-sans); --f-mono: var(--font-mono); }
.cb-ph { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 28px 16px; color: var(--text-3); font-size: 13px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); }
.cb-ph b { color: var(--text-2); font-weight: 500; }
.cb-ph svg { width: 22px; height: 22px; }

/* Grafik konstruktori ko‘rinishi sarlavhasi */
.cb-pv-t { font-weight: 600; font-size: 14.5px; margin-bottom: 8px; color: var(--text); }
.cb-pv-t.ph { color: var(--text-3); font-weight: 500; font-style: italic; }
.cb-pv-s { margin-top: 8px; font-size: 12px; color: var(--text-3); }

/* Fayl turi belgisi */
.file-ext {
  width: 42px; height: 48px; flex: none; border-radius: 6px; display: grid; place-items: center; font: 600 10.5px var(--font-mono);
  background: var(--surface-3); color: var(--text-2); letter-spacing: .02em; position: relative;
}
.file-ext[data-ext="pdf"] { background: #FBE3E4; color: #B42318; }
.file-ext[data-ext="xlsx"], .file-ext[data-ext="xls"], .file-ext[data-ext="csv"] { background: #DFF3E7; color: #0A7146; }
.file-ext[data-ext="docx"] { background: #E3ECFB; color: #1E4FB8; }
.file-ext[data-ext="pptx"] { background: #FCEBDD; color: #B54708; }
:root[data-theme="dark"] .file-ext[data-ext] { filter: saturate(.8) brightness(.85); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .file-ext[data-ext] { filter: saturate(.8) brightness(.85); } }


/* Spreadsheet grid (jadval + konstruktor) */
.tb-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tg-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); }
.tg { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.tg th, .tg td { padding: 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tg tr > :last-child { border-right: 0; }
.tg tbody tr:last-child > * { border-bottom: 0; }
.tg thead th { background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
.tg .tg-rowh { width: 30px; min-width: 30px; text-align: center; font-size: 11px; color: var(--text-3); background: var(--surface-2); font-weight: 500; position: sticky; left: 0; z-index: 1; }
.tg thead .tg-rowh { z-index: 2; }
.tg .tg-rowx { width: 30px; min-width: 30px; text-align: center; background: var(--surface); }
.tg .tg-colh span { display: flex; justify-content: space-between; padding: 2px 3px; }
.tg-cell {
  width: 100%; min-width: 90px; height: 32px; border: 0; background: transparent; padding: 0 9px; color: var(--text); font-size: 13px;
  border-radius: 0; font-variant-numeric: tabular-nums;
}
.tg-cell:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); background: var(--surface); position: relative; z-index: 1; }
.tg-cell.num { text-align: right; font-family: var(--font-mono); font-size: 12.5px; }
.tg-cell.bad { background: var(--down-soft); color: var(--down); }
.tg .tg-head .tg-cell { font-weight: 600; background: var(--surface-2); }
.tg .tg-hl td { background: var(--warn-soft); }
.tg .tg-hl .tg-cell { font-weight: 600; }
.tg-name { font-weight: 600; text-align: right; border-top: 3px solid var(--sc, var(--accent)); height: 34px; }
.cb-lh { font-size: 11.5px; font-weight: 600; color: var(--text-3); text-align: left; padding: 0 9px !important; white-space: nowrap; }

/* Inline format toolbar */
.be-itb {
  position: fixed; z-index: 95; display: flex; gap: 1px; padding: 3px; background: var(--text); color: var(--surface);
  border-radius: 8px; box-shadow: var(--shadow-lg);
}
.be-itb button { width: 30px; height: 28px; border: 0; background: transparent; color: inherit; border-radius: 5px; cursor: pointer; display: grid; place-items: center; font-size: 14px; padding: 0; }
.be-itb button:hover, .be-itb button[aria-pressed="true"] { background: color-mix(in srgb, var(--surface) 18%, transparent); }
.be-itb svg { width: 15px; height: 15px; }
.be-itb .tx { font-size: 13px; font-weight: 600; }
.be-itb sub { font-size: 9px; }

/* Insert menu */
.be-menu {
  position: fixed; z-index: 96; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: dlg-in .12s ease-out;
}
.be-menu-q { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.be-menu-q input { border: 0; background: transparent; flex: 1; min-width: 0; height: 26px; font-size: 13.5px; color: var(--text); }
.be-menu-q input:focus { outline: none; }
.be-menu-list { max-height: min(340px, 52vh); overflow: auto; padding: 4px; }
.be-mi { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.be-mi.on { background: var(--accent-soft); }
.be-mi-ico { width: 32px; height: 32px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; color: var(--text-2); flex: none; }
.be-mi.on .be-mi-ico { color: var(--accent); border-color: var(--accent-soft-2); }
.be-mi-t { display: grid; min-width: 0; }
.be-mi-t b { font-weight: 500; font-size: 13.5px; }
.be-mi-t small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.be-mi-empty { padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.be-menu-foot { display: flex; gap: 12px; padding: 6px 10px; border-top: 1px solid var(--border); font-size: 11px; color: var(--text-3); background: var(--surface-2); }
.be-menu-foot kbd { font-size: 10px; line-height: 14px; margin-right: 2px; }

/* ---------- Dialog: xl (konstruktor) ---------- */
dialog.dlg.xl { width: min(1280px, calc(100vw - 24px)); height: calc(100vh - 32px); max-height: none; }
dialog.dlg.xl .dlg-body { flex: 1; min-height: 0; padding-bottom: 8px; }
dialog.dlg .dlg-body .stack { color: var(--text); }
.pd-opts { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text); }
.pf-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-list { display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.pf-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); cursor: pointer; text-align: left; color: var(--text);
}
.pf-item:hover, .pf-item[aria-pressed="true"] { border-color: var(--accent); }
.pf-item .file-ext { width: 34px; height: 38px; font-size: 9.5px; }
.pf-t { display: grid; min-width: 0; flex: 1; }
.pf-t b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-t small { color: var(--text-3); }
.pf-s { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ---------- Chart builder ---------- */
.cb { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; min-height: 100%; color: var(--text); }
.cb-col { min-width: 0; display: grid; gap: 10px; align-content: start; }
.cb-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.cb-h h3 { font-size: 13px; font-weight: 600; }
.cb-hb { display: flex; gap: 4px; flex-wrap: wrap; }
.cb-gridwrap { max-height: 42vh; }
.cb-series { display: grid; gap: 6px; }
.cb-ser { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; flex-wrap: wrap; }
.cb-ser .select { width: auto; height: 30px; font-size: 12.5px; }
.cb-ser-n { font-weight: 500; flex: 1; min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-ser-act { display: flex; }
.cb-color { position: relative; width: 26px; height: 26px; flex: none; cursor: pointer; }
.cb-color input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.cb-color span { position: absolute; inset: 3px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); pointer-events: none; }
.cb-color:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; border-radius: 6px; }
.cb-set { position: relative; }
.cb-types { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.cb-types button {
  display: grid; justify-items: center; gap: 4px; padding: 8px 4px 6px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 11.5px; color: var(--text-2);
}
.cb-types button svg { width: 20px; height: 20px; }
.cb-types button:hover { border-color: var(--border-strong); color: var(--text); }
.cb-types button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); color: var(--accent); }
.cb-stage { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px 10px; background: var(--surface); position: sticky; top: 0; z-index: 2; box-shadow: var(--shadow-sm); }
.cb-pv { min-height: 120px; }
.cb-pv-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cb-stat { font-size: 12px; color: var(--text-3); }
.cb-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.cb-tabs button {
  border: 0; background: transparent; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--text-3); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.cb-tabs button:hover { color: var(--text); }
.cb-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.cb-panel { padding: 4px 0 8px; }
.cb-pal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.cb-pal button { display: grid; gap: 5px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; color: var(--text-2); }
.cb-pal button:hover { border-color: var(--border-strong); }
.cb-pal button[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cb-pal .sw { display: flex; gap: 2px; }
.cb-pal .sw i { flex: 1; height: 14px; border-radius: 3px; }
.cb-pal .nm { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-colors { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cb-cc { display: inline-flex; align-items: center; gap: 1px; border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.cb-cc input { width: 28px; height: 24px; border: 0; padding: 0; background: none; cursor: pointer; }
.cb-switches { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.cb-rows { display: grid; gap: 6px; }
.cb-row { grid-template-columns: minmax(0, .5fr) minmax(0, 1fr) auto; }
.cb-msg:empty { display: none; }
@media (max-width: 980px) {
  .cb { grid-template-columns: minmax(0, 1fr); }
  .cb-set { order: -1; }
  .cb-stage { position: static; }
  dialog.dlg.xl { height: calc(100vh - 16px); width: calc(100vw - 16px); }
}
@media (max-width: 560px) {
  .cb-types { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cb-pal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Toast action ---------- */
.toast .t-act { margin-top: 6px; }

/* ---------- Template chooser / list ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tpl-card {
  display: grid; grid-template-rows: auto auto 1fr auto; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow-sm); text-align: left; color: var(--text); min-width: 0;
}
button.tpl-card, a.tpl-card { cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
button.tpl-card:hover, a.tpl-card:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.tpl-card h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tpl-card p { color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.tpl-outline { list-style: none; margin: 0; padding: 8px; display: grid; gap: 3px; background: var(--surface-2); border-radius: 7px; font-size: 12px; color: var(--text-2); align-self: start; }
.tpl-outline li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.tpl-outline li svg { width: 13px; height: 13px; color: var(--text-3); flex: none; }
.tpl-outline li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-outline li em { font-style: normal; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tpl-blank { border-style: dashed; place-content: center; justify-items: center; text-align: center; min-height: 180px; }
.tpl-blank .empty-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--text-2); }
.tpl-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tpl-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* ---------- Taxonomy ---------- */
.tx-list { display: grid; gap: 12px; }
.tx-sec { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm); }
.tx-sec.dragging, .tx-cat.dragging { opacity: .4; }
.tx-sec.invalid { border-color: var(--down); }
.tx-sec-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tx-sec-fields { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .8fr) minmax(0, .8fr); gap: 10px; }
.tx-sec-fields .full { grid-column: 1 / -1; }
.tx-sec-fields .input { height: 34px; }
.tx-sec-fields textarea.input { height: auto; }
.tx-tools { display: flex; gap: 2px; align-items: center; }
.tx-cats { display: grid; gap: 4px; padding: 10px 14px 4px; min-height: 44px; }
.tx-cat { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, .7fr) auto auto auto; gap: 8px; align-items: center; padding: 4px; border-radius: 7px; }
.tx-cat:hover, .tx-cat:focus-within { background: var(--surface-2); }
.tx-cat .input, .tx-cat .select { height: 32px; font-size: 13px; }
.tx-cat .select { width: auto; max-width: 170px; }
.tx-cat.invalid .input.invalid { border-color: var(--down); }
.tx-count { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.tx-foot { padding: 4px 14px 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tx-handle { cursor: grab; }
.tx-bar {
  position: sticky; bottom: 0; z-index: 15; margin-top: 16px; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 10px 14px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md);
}
.tx-bar .state { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.id-input { font-family: var(--font-mono); font-size: 12.5px !important; }
.mini-label { font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 2px; display: block; }
@media (max-width: 820px) {
  .tx-sec-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tx-sec-fields > :first-child { grid-column: 1 / -1; }
  .tx-cat { grid-template-columns: auto minmax(0, 1fr) auto; }
  .tx-cat > .tx-cat-id, .tx-cat > .tx-cat-move { grid-column: 2; }
  .tx-cat > .tx-count { grid-column: 3; grid-row: 2; }
}

/* ---------- Media tabs / files ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs a {
  padding: 8px 12px; font-weight: 500; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a .chip { height: 20px; font-size: 11px; }
.files-table td { vertical-align: middle; }
.files-table .file-ext { width: 34px; height: 38px; font-size: 9.5px; }
.files-table .fname { font-weight: 500; overflow: hidden; text-overflow: ellipsis; max-width: 360px; white-space: nowrap; display: block; }
.files-table .fid { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }

.tpl-outline li span { flex: none; max-width: 60%; }
.bad-t svg.i, .hint svg.i { display: inline-block; vertical-align: -3px; width: 14px; height: 14px; }

/* =====================================================================
   V4: aksiya pill’i — [[$NVDA|+1.82%|soft|#hex]] (kanvas, sozlamalar, kompaniyalar)
   ===================================================================== */
:root { --pill-up: #0A8656; --pill-down: #CC2E3B; --pill-flat: #64748B; }
.tkp {
  --c: var(--pc, var(--pill-flat));
  display: inline-flex; align-items: baseline; gap: .34em; padding: .1em .55em .12em; margin: 0 .05em; border-radius: 999px;
  font: 600 .8em/1.3 var(--font-sans); letter-spacing: 0; white-space: nowrap; vertical-align: .04em; text-indent: 0;
  border: 1px solid transparent; cursor: pointer; user-select: none; -webkit-user-select: none;
  background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 86%, var(--text));
  transition: box-shadow .12s, background .12s;
}
.tkp.up { --c: var(--pc, var(--pill-up)); }
.tkp.down { --c: var(--pc, var(--pill-down)); }
.tkp-s { font-weight: 700; }
.tkp-v { font-weight: 600; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.tkp.live .tkp-v { font-weight: 500; font-style: italic; opacity: .8; }
.tkp.live .tkp-v::before { content: ""; display: inline-block; width: .42em; height: .42em; border-radius: 50%; background: currentColor; margin-right: .3em; vertical-align: .12em; opacity: .7; }
.tkp:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 28%, transparent); }
.tkp:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.tkp[data-style="solid"], html[data-pill-style="solid"] .tkp:not([data-style]) { background: var(--c); color: #fff; }
.tkp[data-style="outline"], html[data-pill-style="outline"] .tkp:not([data-style]) { background: transparent; border-color: color-mix(in srgb, var(--c) 62%, transparent); }
.tkp[data-style="text"], html[data-pill-style="text"] .tkp:not([data-style]) { background: transparent; padding: 0 .12em; border-radius: 4px; margin: 0; }
.tkp[data-style="soft"] { background: color-mix(in srgb, var(--c) 13%, transparent); color: color-mix(in srgb, var(--c) 86%, var(--text)); border-color: transparent; }
.be-itb-sep { width: 1px; margin: 4px 3px; background: color-mix(in srgb, var(--surface) 25%, transparent); }
.be-itb button.be-itb-w { width: auto; padding: 0 9px 0 7px; gap: 5px; display: inline-flex; align-items: center; font: 600 12px var(--font-sans); }
