/* =====================================================================
   AdPanel — Telegram uslubidagi shaffof (glass) dizayn
   Kunduzgi/tungi rejim · SVG ikonkalar · web + mobil (pastki navigatsiya)
   ===================================================================== */

/* ---------- Ranglar: kunduzgi (asosiy) ---------- */
:root {
  color-scheme: light;
  --accent: #2ea6ef;
  --accent-2: #229ed9;
  --accent-grad: linear-gradient(135deg, #2ea6ef, #6c5ce7);
  --accent-soft: rgba(46,166,239,0.14);
  --ok: #30b953;   --ok-soft: rgba(48,185,83,0.15);
  --warn: #f2a93c; --warn-soft: rgba(242,169,60,0.18);
  --err: #ef4444;  --err-soft: rgba(239,68,68,0.13);

  --bg: #eef3f8;
  --blob-1: rgba(46,166,239,0.24);
  --blob-2: rgba(108,92,231,0.16);
  --blob-3: rgba(48,185,83,0.14);

  --glass: rgba(255,255,255,0.66);
  --glass-strong: rgba(255,255,255,0.88);
  --glass-2: rgba(255,255,255,0.5);
  --glass-border: rgba(255,255,255,0.75);
  --line: rgba(15,25,45,0.08);
  --shadow: 0 10px 30px -8px rgba(15,25,45,0.12), 0 1px 2px rgba(15,25,45,0.05);
  --shadow-lg: 0 24px 60px -12px rgba(15,25,45,0.24);
  --count-bg: rgba(0,0,0,0.07);

  --text: #0f1a2d;
  --text-2: #445064;
  --text-dim: #6b7789;
  --hover: rgba(15,25,45,0.05);
  --input-bg: rgba(255,255,255,0.78);

  --radius: 16px; --radius-sm: 12px; --radius-xs: 9px; --radius-lg: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------- Tungi rejim ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b131e;
    --blob-1: rgba(46,166,239,0.20); --blob-2: rgba(108,92,231,0.15); --blob-3: rgba(48,185,83,0.09);
    --glass: rgba(20,29,41,0.6); --glass-strong: rgba(20,29,41,0.9); --glass-2: rgba(255,255,255,0.045);
    --glass-border: rgba(255,255,255,0.08); --line: rgba(255,255,255,0.075);
    --shadow: 0 10px 30px -8px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3); --shadow-lg: 0 24px 70px -12px rgba(0,0,0,0.6);
    --count-bg: rgba(255,255,255,0.09);
    --text: #eef2f6; --text-2: #b7c1cf; --text-dim: #7e8b9c;
    --hover: rgba(255,255,255,0.055); --input-bg: rgba(255,255,255,0.055);
    --ok: #3fd463; --warn: #ffb648; --err: #ff6259;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b131e;
  --blob-1: rgba(46,166,239,0.20); --blob-2: rgba(108,92,231,0.15); --blob-3: rgba(48,185,83,0.09);
  --glass: rgba(20,29,41,0.6); --glass-strong: rgba(20,29,41,0.9); --glass-2: rgba(255,255,255,0.045);
  --glass-border: rgba(255,255,255,0.08); --line: rgba(255,255,255,0.075);
  --shadow: 0 10px 30px -8px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3); --shadow-lg: 0 24px 70px -12px rgba(0,0,0,0.6);
  --count-bg: rgba(255,255,255,0.09);
  --text: #eef2f6; --text-2: #b7c1cf; --text-dim: #7e8b9c;
  --hover: rgba(255,255,255,0.055); --input-bg: rgba(255,255,255,0.055);
  --ok: #3fd463; --warn: #ffb648; --err: #ff6259;
}

/* ---------- Asos ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(640px 420px at 6% 8%, var(--blob-1), transparent 70%),
    radial-gradient(720px 520px at 94% 18%, var(--blob-2), transparent 70%),
    radial-gradient(640px 520px at 50% 105%, var(--blob-3), transparent 70%);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 25px; }
h3 { font-size: 16px; margin-bottom: 8px; letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- Ikonkalar ---------- */
.i { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.btn .i, .menu-item .i, .theme-toggle .i { margin-right: 1px; }
.nav-ico { width: 20px; height: 20px; }
.bottom-nav .i { width: 22px; height: 22px; }
.stat-ico .i { width: 19px; height: 19px; }
.brand-mark, .login-mark {
  display: inline-block; width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-grad); box-shadow: 0 6px 16px -4px var(--accent-soft);
  position: relative;
}
.brand-mark::after, .login-mark::after {
  content: ""; position: absolute; inset: 8px; border-radius: 4px;
  background: rgba(255,255,255,.92); clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.login-mark { width: 44px; height: 44px; border-radius: 14px; margin-bottom: 14px; }
.login-mark::after { inset: 12px; }

/* ---------- Glass panel ---------- */
.card, .sidebar, .topbar, .menu-panel, .select-bar, .flash, .stat, .bar, .bottom-nav {
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 20px 14px;
  border-radius: 0; border-width: 0 1px 0 0; box-shadow: none;
}
.sidebar h1 { font-size: 19px; padding: 4px 10px 22px; display: flex; align-items: center; gap: 11px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 14.5px; font-weight: 550; transition: background .15s, color .15s, transform .1s;
}
.sidebar nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px -6px var(--accent-soft); }
.sidebar nav a.active .i { stroke: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.admin-badge {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-radius: var(--radius-sm); background: var(--glass-2); border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px; font-weight: 600;
}
.admin-badge .i { color: var(--accent); }
.topbar .admin-badge { padding: 5px 10px; font-size: 12.5px; }
.main { flex: 1; min-width: 0; padding: 26px 30px 90px; max-width: 1260px; }
.topbar { display: none; }

/* Tema tugmasi */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  padding: 10px 13px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--glass-2); color: var(--text-2); cursor: pointer; font: inherit; font-size: 14px; font-weight: 500;
}
.theme-toggle:hover { background: var(--hover); color: var(--text); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .i { margin: 0; }

/* ---------- Kartalar ---------- */
.card { border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card.box { border-color: var(--accent); }
.flash {
  display: flex; align-items: flex-start; gap: 12px; justify-content: space-between;
  border-radius: var(--radius); padding: 13px 16px; margin-bottom: 16px;
  border-left: 4px solid var(--accent); font-size: 14px;
}
.flash span { flex: 1; padding-top: 1px; }
.flash-ico { color: var(--accent); margin-top: 2px; }
.flash-close { background: none; border: none; color: var(--text-dim); cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; }
.flash-close:hover { background: var(--hover); color: var(--text); }
.flash-close .i { margin: 0; width: 15px; height: 15px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--text-dim); font-size: 13.5px; margin-top: 5px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { border-radius: var(--radius); padding: 18px; display: block; color: inherit; transition: transform .12s, box-shadow .12s; }
a.stat:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); color: inherit; }
.stat-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.stat-ico.ok { background: var(--ok-soft); color: var(--ok); }
.stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat-ico.err { background: var(--err-soft); color: var(--err); }
.stat-ico.accent { background: var(--accent-soft); color: var(--accent); }
.stat-ico.neutral { background: var(--hover); color: var(--text-dim); }
.stat .num { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; line-height: 1.1; }
.stat .label { color: var(--text-dim); font-size: 13px; margin-top: 5px; font-weight: 500; }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent-grad); color: #fff; border: 1px solid transparent;
  padding: 10px 16px; border-radius: var(--radius-sm); cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  box-shadow: 0 6px 16px -4px var(--accent-soft);
  transition: transform .08s, filter .15s, box-shadow .15s;
}
.btn .i { stroke: #fff; }
.btn:hover { filter: brightness(1.07); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--glass-2); color: var(--text); border-color: var(--line); box-shadow: none; }
.btn.secondary .i { stroke: var(--text-2); }
.btn.secondary:hover { background: var(--hover); }
.btn.danger { background: var(--err); box-shadow: 0 6px 16px -4px var(--err-soft); }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.small .i { width: 15px; height: 15px; }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; filter: none; }
.btn-count { background: rgba(255,255,255,.25); padding: 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.btn.secondary .btn-count { background: var(--count-bg); color: var(--text-2); }
button.link { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 0 4px; font-weight: 600; }

/* ---------- Formalar ---------- */
input, select, textarea {
  background: var(--input-bg); border: 1px solid var(--line); color: var(--text);
  padding: 10px 13px; border-radius: var(--radius-sm); width: 100%; font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder { color: var(--text-dim); }
input[type=checkbox] { width: auto; accent-color: var(--accent); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; color: var(--text-2); font-size: 13px; font-weight: 600; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin: 0; flex: 1 1 200px; min-width: 160px; }
.form-row .field:has(> .btn) { flex: 0 0 auto; }
.hint { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; line-height: 1.6; }
.error { display: flex; align-items: center; gap: 8px; color: var(--err); background: var(--err-soft); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13.5px; font-weight: 500; }
.empty { color: var(--text-dim); padding: 32px; text-align: center; font-size: 14px; }
.dim { color: var(--text-dim); }
.small { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); margin-top: 4px; line-height: 1.4; }
.small .i { width: 13px; height: 13px; }
.small b { color: var(--text); }
.small.err { color: var(--err); }
.small.err .i { stroke: var(--err); }
.small.dim { opacity: .85; }

/* ---------- Belgilar (badge) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.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.muted { background: var(--hover); color: var(--text-dim); }

/* ---------- Jadval ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-dim); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: none; }
.table-card { padding: 0; overflow: hidden; }
table.channels th { position: sticky; top: 0; z-index: 1; background: var(--glass-strong); }
table.channels tr.row { transition: background .1s; }
table.channels tr.row:hover td { background: var(--hover); }
table.channels tr.row:has(input:checked) td { background: var(--accent-soft); }
.col-check { width: 40px; }
.col-check input { width: 18px; height: 18px; cursor: pointer; }
.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.ch-title { font-weight: 650; }
.ch-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }
.ch-meta span, .ch-meta a { display: inline-flex; align-items: center; gap: 4px; }
.ch-meta .i { width: 13px; height: 13px; }
table.channels td[data-label="Holat"] { min-width: 210px; }
table.channels td[data-label="Tayyorlik"] { min-width: 220px; }
table.ya td[data-label="Yandex holati"] { max-width: 340px; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; }

/* ---------- Filtr chiplari ---------- */
.filters { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.filter-group { display: flex; align-items: flex-start; gap: 10px; }
.filter-label { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 82px; padding-top: 8px; font-size: 11.5px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.filter-label .i { width: 14px; height: 14px; }
.folder-tabs { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.folder-tab {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 6px 13px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--glass);
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; user-select: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: background .15s, color .15s, border-color .15s, transform .08s;
}
.folder-tab:hover { background: var(--hover); color: var(--text); text-decoration: none; border-color: var(--text-dim); }
.folder-tab:active { transform: translateY(1px); }
.folder-tab.active { background: var(--accent-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 16px -4px var(--accent-soft); }
.folder-tab .count { background: var(--count-bg); padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; min-width: 22px; text-align: center; }
.folder-tab.active .count { background: rgba(255,255,255,.25); }
.folder-tab .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.st-ready .dot, .st-connected .dot { background: var(--ok); }
.st-pending .dot, .st-ads_paused .dot { background: var(--warn); }
.st-not_ready .dot, .st-rejected .dot, .st-error .dot { background: var(--err); }
.folder-tab.active .dot { background: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
.status-tabs .search-wrap, .status-tabs input.search { margin-left: auto; }

/* Qidiruv maydoni ikonka bilan */
.search-wrap { position: relative; flex: 1 1 220px; min-width: 180px; display: flex; align-items: center; }
.search-wrap .search-ico { position: absolute; left: 13px; color: var(--text-dim); pointer-events: none; }
.search-wrap input.search { padding-left: 36px; }
input.search { border-radius: 999px; min-height: 36px; padding-top: 7px; padding-bottom: 7px; font-size: 13px; }

/* ---------- Kanallar sahifasi ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar form { margin: 0; }
.toolbar .search-wrap { margin-left: auto; }
details.help { margin-top: 14px; }
details.help summary { cursor: pointer; color: var(--accent); font-size: 13.5px; font-weight: 600; user-select: none; list-style: none; display: inline-flex; align-items: center; gap: 7px; }
details.help summary::-webkit-details-marker { display: none; }
details.help summary .i { color: var(--accent); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 12px; padding: 16px 18px; border-radius: var(--radius-sm); background: var(--glass-2); font-size: 13px; color: var(--text-2); line-height: 1.8; }
.help-grid b { color: var(--text); }
.help-grid ol { margin: 4px 0 8px; padding-left: 20px; }
.help-grid p { margin: 0; }
.help-grid .badge { margin-right: 6px; }

/* Qator menyusi */
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; display: inline-flex; white-space: nowrap; }
details.menu summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 254px;
  background: var(--glass-strong); border-radius: var(--radius); padding: 7px; box-shadow: var(--shadow-lg); text-align: left;
}
.menu-panel form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none; color: var(--text); padding: 10px 12px; border-radius: var(--radius-xs); cursor: pointer; font: inherit; font-size: 14px; white-space: nowrap; }
.menu-item:disabled { opacity: .4; cursor: not-allowed; }
.menu-item .i { color: var(--text-dim); }
.menu-item:hover { background: var(--hover); }
.menu-sep { border-top: 1px solid var(--line); margin: 6px 4px; }
.menu-field { padding: 4px 12px 8px; }
.menu-field label { display: block; font-size: 11.5px; color: var(--text-dim); margin-bottom: 4px; font-weight: 600; }
.menu-field select { padding: 7px 30px 7px 10px; font-size: 13px; }

/* Tanlanganlar paneli */
.select-bar {
  position: sticky; bottom: calc(14px + var(--safe-b)); z-index: 30; margin-top: 14px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  border-radius: var(--radius); padding: 12px 16px; border-color: var(--accent); box-shadow: var(--shadow-lg);
  background: var(--glass-strong);
}
.select-info { white-space: nowrap; font-weight: 650; }
.select-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; flex: 1; }
.select-move { display: inline-flex; gap: 7px; align-items: center; margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); }
.select-move select { width: auto; padding: 7px 30px 7px 11px; font-size: 13px; }
.select-connect { display: inline-flex; gap: 7px; align-items: center; }
.select-connect select { width: auto; min-width: 140px; padding: 7px 30px 7px 11px; font-size: 13px; }

/* Toolbardagi "Tayyorlarni ulash" - forma + majburiy akkount tanlovi bitta guruh */
.inline-form { display: inline-flex; gap: 0; align-items: stretch; }
.inline-select {
  width: auto; min-width: 140px; border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  border-right: none; font-size: 13.5px;
}
.inline-form .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- Tasdiqlash oynasi (confirm modal) ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(8,12,20,0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-card {
  width: 100%; max-width: 380px; padding: 24px; border-radius: var(--radius-lg); text-align: center;
  background: var(--glass-strong); border: 1px solid var(--glass-border); box-shadow: var(--shadow-lg);
  animation: modal-in .16s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-ico {
  width: 44px; height: 44px; margin: 0 auto 14px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; background: var(--warn-soft); color: var(--warn);
}
.modal-ico .i { width: 22px; height: 22px; }
.modal-card p { margin: 0 0 20px; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ---------- Yandex akkountlar ---------- */
.acc-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.acc-title { font-size: 18px; font-weight: 700; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.acc-meta { color: var(--text-dim); font-size: 13.5px; margin-top: 5px; }
.acc-meta b { color: var(--text); }
.acc-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.acc-actions form { margin: 0; }
.row-actions { display: flex; gap: 7px; flex-wrap: nowrap; justify-content: flex-end; }
.row-actions form { margin: 0; }
.row-actions .btn { white-space: nowrap; }

/* ---------- Login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; text-align: center; }
.login-card .field { text-align: left; }
.login-card h2 { margin-bottom: 4px; }
.login-theme { position: fixed; top: calc(16px + var(--safe-t)); right: 16px; }

/* ---------- Jonli brauzer ---------- */
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 16px; border-radius: 0; border-width: 0 0 1px; box-shadow: none; }
.bar .title { flex: 1; font-size: 14px; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
.bar .title .i { color: var(--text-dim); }

/* =====================================================================
   MOBIL (≤ 760px) — Telegram uslubidagi pastki navigatsiya
   ===================================================================== */

.bottom-nav { display: none; }

@media (max-width: 760px) {
  .sidebar { display: none; }
  .layout { flex-direction: column; }
  .main { padding: calc(14px + var(--safe-t)) 14px calc(90px + var(--safe-b)); }
  h2 { font-size: 21px; }

  /* Yuqori panel: faqat brend + tema tugmasi */
  .topbar {
    display: block; position: sticky; top: 0; z-index: 40;
    border-radius: 0; border-width: 0 0 1px; padding: calc(10px + var(--safe-t)) 14px 10px;
  }
  .topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .topbar-brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 10px; }
  .topbar-right { display: flex; align-items: center; gap: 8px; }

  /* Pastda qotib turadigan navigatsiya (Telegram uslubi) */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    padding: 8px 4px calc(6px + var(--safe-b)); border-radius: 0; border-width: 1px 0 0;
    justify-content: space-around;
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text-dim); font-size: 10.5px; font-weight: 600; padding: 4px 8px; border-radius: 12px; flex: 1; max-width: 84px; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a .i { stroke-width: 2.2; }

  .page-head { align-items: flex-start; }
  .page-head .head-actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .page-head .head-actions .btn { width: 100%; }
  .card { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat .num { font-size: 23px; }

  .filter-group { flex-direction: column; gap: 5px; }
  .filter-label { flex: none; padding: 0; }
  .folder-tab { min-height: 38px; }
  .status-tabs .search-wrap { margin-left: 0; flex-basis: 100%; }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-wrap { margin-left: 0; flex-basis: auto; }
  .toolbar form { width: 100%; }
  .toolbar .btn { width: 100%; }
  .inline-form { flex-direction: row; }
  .inline-select { flex: 1; min-width: 0; }
  .inline-form .btn { flex-shrink: 0; width: auto; white-space: nowrap; }
  .help-grid { grid-template-columns: 1fr; }

  /* Jadval -> kartalar */
  table.channels, table.channels tbody, table.channels tr, table.channels td { display: block; }
  table.channels thead { display: none; }
  table.channels tr.row { position: relative; border-bottom: 1px solid var(--line); padding: 14px 14px 14px 48px; }
  table.channels tr.row:last-child { border-bottom: none; }
  table.channels tr.row td { border: none; padding: 4px 0; background: none !important; }
  table.channels tr.row:has(input:checked) { background: var(--accent-soft); }
  table.channels tr.row td.col-check { position: absolute; left: 14px; top: 14px; width: auto; padding: 0; }
  table.channels tr.row td.col-check input { width: 22px; height: 22px; }
  table.channels td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); margin: 7px 0 3px; font-weight: 700; }
  table.channels td[data-label="Kanal"]::before { display: none; }
  table.channels td.col-actions { text-align: left; white-space: normal; padding-top: 10px; width: auto; }
  table.channels td.col-actions::before { display: none; }
  table.channels td[data-label="Holat"], table.channels td[data-label="Tayyorlik"] { min-width: 0; }
  table.ya td[data-label="Yandex holati"] { max-width: none; }
  table.ya tr.row { padding-left: 14px; }
  details.menu, details.menu summary { display: flex; width: 100%; justify-content: center; }
  details.menu summary.btn { width: 100%; }
  .menu-panel { position: static; margin-top: 8px; box-shadow: none; border: 1px solid var(--line); }

  /* Oddiy jadvallar (jurnal, telegram) -> kartalar */
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; }
  table.responsive thead { display: none; }
  table.responsive tbody tr { border-bottom: 1px solid var(--line); padding: 12px 0; }
  table.responsive tbody tr:last-child { border-bottom: none; }
  table.responsive td { border: none; padding: 3px 0; }
  table.responsive td[data-label]::before { content: attr(data-label); display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 700; margin-top: 5px; }
  table.responsive td.actions { padding-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; white-space: normal; }
  table.responsive td.actions form { display: block; }
  table.responsive td.actions .btn { width: 100%; }

  .select-bar { bottom: calc(72px + var(--safe-b)); padding: 12px; flex-direction: column; align-items: stretch; gap: 10px; }
  .select-info { display: flex; align-items: center; justify-content: space-between; width: 100%; }
  .select-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; width: 100%; }
  .select-actions .btn { width: 100%; }
  .select-connect { grid-column: 1 / -1; display: flex; gap: 7px; }
  .select-connect select { flex: 1; min-width: 0; }
  .select-connect .btn { flex-shrink: 0; width: auto; }
  .select-move { grid-column: 1 / -1; margin-left: 0; padding-left: 0; border-left: none; padding-top: 8px; border-top: 1px solid var(--line); }
  .select-move select { flex: 1; }

  .acc-actions { width: 100%; display: grid; grid-template-columns: 1fr; gap: 7px; }
  .acc-actions form { min-width: 0; }
  .acc-actions .btn { width: 100%; }
  .row-actions { justify-content: flex-start; flex-direction: column; align-items: stretch; }
  .row-actions form { width: 100%; }
  .row-actions .btn { width: 100%; }

  .form-row { flex-direction: column; align-items: stretch; }
  .form-row .field, .form-row .field:has(> .btn) { flex: 1 1 auto; min-width: 0; }
  .form-row .btn { width: 100%; }
}

/* ---------- AI Agent (terminal) ---------- */
.term-card {
  padding: 8px; background: #0b131e; display: flex; flex-direction: column; gap: 8px;
  height: calc(100dvh - 260px); min-height: 320px;
}
.term-card.term-fullscreen {
  position: fixed; inset: 0; z-index: 60; border-radius: 0; margin: 0; height: 100dvh;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(8px + env(safe-area-inset-left, 0px));
  padding-right: calc(8px + env(safe-area-inset-right, 0px));
}
.term-body { position: relative; flex: 1 1 auto; min-height: 0; }
.term-body #terminal { height: 100%; padding: 6px; }
.term-card .xterm-viewport::-webkit-scrollbar { width: 10px; }
.term-card .xterm-viewport::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 6px; }

.term-scroll-btns {
  position: absolute; right: 14px; bottom: 14px; z-index: 5;
  display: flex; flex-direction: column; gap: 8px;
}
.term-scroll-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,29,41,0.85); backdrop-filter: blur(6px);
  color: #eef2f6; display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 6px 16px -4px rgba(0,0,0,0.4);
  touch-action: none; -webkit-tap-highlight-color: transparent; user-select: none;
}
.term-scroll-btn:active { background: rgba(46,166,239,0.35); }
.term-scroll-btn .i { width: 20px; height: 20px; stroke: #eef2f6; }
.term-scroll-btn .i.ico-up { transform: rotate(180deg); }

.term-fullscreen-btn { position: absolute; top: 10px; right: 10px; bottom: auto; }

/* ---- Maxsus tugmalar (Ctrl+C, Esc, Tab, strelkalar) - gorizontal surish ---- */
.term-keys {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px; flex: 0 0 auto; scrollbar-width: thin;
}
.term-key-btn {
  flex: 0 0 auto; white-space: nowrap; padding: 7px 13px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
  color: #eef2f6; font-size: 13px; font-weight: 600; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.term-key-btn:active { background: rgba(46,166,239,0.3); }
.term-key-btn.danger { border-color: rgba(239,68,68,0.4); color: #ff8b83; }
.term-key-btn.danger:active { background: rgba(239,68,68,0.25); }

/* ---- Yozish paneli (mobilga mos: textarea + mikrofon + yuborish) ---- */
.term-compose {
  display: flex; align-items: flex-end; gap: 8px; flex-wrap: nowrap;
  background: rgba(255,255,255,0.045); border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm); padding: 6px;
}
.term-mic-lang {
  height: 40px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,29,41,0.85); color: #eef2f6; font-size: 12px; font-weight: 600;
  padding: 0 4px; cursor: pointer; flex: 0 0 auto;
}
.term-compose-input {
  flex: 1 1 auto; min-width: 0; resize: none; max-height: 120px;
  background: rgba(20,29,41,0.6); color: #eef2f6; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px; line-height: 1.4;
}
.term-compose-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.term-compose-input::placeholder { color: rgba(238,242,246,0.4); }
.term-compose-btn {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(20,29,41,0.85); color: #eef2f6; display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.term-compose-btn .i { width: 19px; height: 19px; stroke: #eef2f6; }
.term-compose-btn.primary { background: var(--accent-grad); border-color: transparent; }
.term-compose-btn:active { filter: brightness(1.15); }
.term-compose-btn.recording { background: var(--err); animation: term-mic-pulse 1.1s ease-in-out infinite; }
.term-compose-btn.busy { background: var(--accent); opacity: 0.85; cursor: progress; }
.term-compose-btn:disabled { opacity: 0.3; cursor: not-allowed; animation: none; }
.term-mic-hint { font-size: 12.5px; color: var(--text-dim); padding: 0 4px; }
.term-mic-hint.err { color: var(--err); }
@keyframes term-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.55); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

@media (max-width: 480px) {
  .term-mic-lang { width: 46px; font-size: 11px; }
  .term-compose-btn { width: 40px; height: 40px; }
  .term-key-btn { padding: 6px 11px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
