/* ============================================================
   AGENT.CTRL — Telegram Mini App  v9
   ============================================================ */

:root {
  --bg:      var(--tg-theme-bg-color,           #0b0e14);
  --bg2:     var(--tg-theme-secondary-bg-color, #12161f);
  --fg:      var(--tg-theme-text-color,         #e6eaf2);
  --muted:   var(--tg-theme-hint-color,         #7a8799);
  --link:    var(--tg-theme-link-color,         #60a5fa);
  --btn:     var(--tg-theme-button-color,       #3b82f6);
  --btn-fg:  var(--tg-theme-button-text-color,  #ffffff);

  --ok:      #34d399;
  --warn:    #fbbf24;
  --danger:  #f87171;
  --idle:    #4b5563;
  --purple:  #a78bfa;

  --glass:        rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.09);
  --shadow:       0 2px 16px rgba(0, 0, 0, 0.45);
  --radius:       14px;
  --radius-sm:    10px;
  --nav-h:        64px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
::-webkit-scrollbar { width: 0; height: 0; }

/* ============================================================
   TOPBAR
   ============================================================ */
#topbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--glass-border);
}
#topbar h1 {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.2px;
}
button.ghost {
  background: transparent;
  color: var(--link);
  border: none;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}
button.ghost:active { background: var(--glass); }

/* ============================================================
   MAIN
   ============================================================ */
main { padding: 14px 12px 0; }
.screen { display: flex; flex-direction: column; gap: 14px; }

/* ============================================================
   BOTTOM NAV
   ============================================================ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(11, 14, 20, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--glass-border);
  display: flex;
  align-items: stretch;
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  padding: 8px 4px;
  position: relative;
  transition: color 0.15s;
}
.nav-btn svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  transition: stroke 0.15s, transform 0.15s;
}
.nav-btn.active { color: var(--btn); }
.nav-btn.active svg { transform: scale(1.1); }
.nav-btn:active { opacity: 0.7; }

.nav-badge {
  position: absolute;
  top: 6px; right: calc(50% - 14px);
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  line-height: 1;
}
.nav-badge-live { background: var(--warn); animation: glow-pulse 1.3s ease-in-out infinite; }

/* ============================================================
   DASHBOARD — STATS ROW
   ============================================================ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.stat-card.accent { border-color: rgba(59,130,246,0.35); background: rgba(59,130,246,0.07); }
.stat-card.ok     { border-color: rgba(52,211,153,0.35); background: rgba(52,211,153,0.07); }
.stat-val {
  font-size: 22px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-card.accent .stat-val { color: var(--btn); }
.stat-card.ok     .stat-val { color: var(--ok); }
.stat-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ============================================================
   DASHBOARD — DASH BLOCK
   ============================================================ */
.dash-block {
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dash-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--glass-border);
}
.dash-block-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}
.dash-link {
  background: transparent;
  border: none;
  color: var(--link);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
}
.dash-link:active { opacity: 0.6; }
.dash-block-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================
   DASHBOARD — NEXT RUN
   ============================================================ */
.next-run-item {
  display: flex;
  align-items: center;
  gap: 12px;
}
.next-run-info { flex: 1; min-width: 0; }
.next-run-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.next-run-cron {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}
.next-run-when {
  font-size: 12px;
  font-weight: 700;
  color: var(--warn);
  background: rgba(251,191,36,0.1);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-family: ui-monospace, monospace;
}

/* ============================================================
   DASHBOARD — SYSTEM MINI BARS
   ============================================================ */
.sys-mini-row { display: flex; flex-direction: column; gap: 8px; }
.sys-mini-bar { display: flex; align-items: center; gap: 8px; }
.sys-mini-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 32px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.mini-bar-track {
  flex: 1;
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.sys-mini-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  width: 72px;
  text-align: right;
  font-family: ui-monospace, monospace;
  flex-shrink: 0;
}

/* ============================================================
   DASHBOARD — RAG MINI
   ============================================================ */
.rag-mini-stats {
  font-size: 13px;
  margin-bottom: 2px;
}
.rag-mini-num { font-weight: 800; font-size: 16px; }

/* ============================================================
   FILTER ROW
   ============================================================ */
.filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 0;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.filter-btn.active {
  background: var(--btn);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(59,130,246,0.35);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.hero { padding-top: 18px; }

/* ============================================================
   AGENT CARDS
   ============================================================ */
.agent-card {
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 13px 14px;
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.agent-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 30% 50%, rgba(59,130,246,0.08), transparent 70%);
  transition: opacity 0.2s;
  pointer-events: none;
}
.agent-card:active { transform: scale(0.975); }
.agent-card:active::before { opacity: 1; }

.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }

.agent-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.agent-name-row .name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 4px;
}

/* ── Inline run button ── */
.run-btn {
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.3);
  color: var(--btn);
  width: 36px; height: 36px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.run-btn:active { background: rgba(59,130,246,0.25); transform: scale(0.9); }
.run-btn:disabled { opacity: 0.4; cursor: default; transform: none; }

/* ── Avatar ── */
.avatar {
  font-size: 22px;
  width: 44px; height: 44px;
  display: inline-flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--bg), rgba(59,130,246,0.12));
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.avatar.lg { font-size: 30px; width: 56px; height: 56px; border-radius: 18px; }

/* ── Name / Role ── */
.name { font-weight: 700; font-size: 15px; line-height: 1.2; }
.name.lg { font-size: 19px; }
.role { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ── Status dot ── */
.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--idle);
  flex-shrink: 0;
  transition: background 0.2s;
}
.status-dot.lg { width: 13px; height: 13px; }
.status-dot.idle    { background: var(--idle); }
.status-dot.running { background: var(--warn); box-shadow: 0 0 8px var(--warn); animation: glow-pulse 1.3s ease-in-out infinite; }
.status-dot.ok      { background: var(--ok);   box-shadow: 0 0 8px var(--ok); }
.status-dot.error   { background: var(--danger); box-shadow: 0 0 8px var(--danger); }

@keyframes glow-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.8); }
}

/* ── Status badge ── */
.status-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
.status-badge.idle    { background: rgba(75,85,99,0.25);    color: var(--idle); }
.status-badge.running { background: rgba(251,191,36,0.15);  color: var(--warn); }
.status-badge.ok      { background: rgba(52,211,153,0.15);  color: var(--ok); }
.status-badge.error   { background: rgba(248,113,113,0.15); color: var(--danger); }

/* ── Divider ── */
.divider { height: 1px; background: var(--glass-border); margin: 10px 0; }

/* ── Desc ── */
.desc {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.45;
}

/* ── Chips ── */
.chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  padding: 3px 9px;
  border-radius: 999px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ── Agent notes ── */
.agent-notes {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.5;
  border-left: 2px solid rgba(167,139,250,0.3);
  padding-left: 10px;
}

/* ============================================================
   ACTIONS BUTTONS
   ============================================================ */
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  flex: 1;
  min-width: 90px;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--fg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.btn:active { opacity: 0.75; transform: scale(0.97); }
.btn.primary { background: var(--btn); color: #fff; border: none; box-shadow: 0 2px 12px rgba(59,130,246,0.35); }
.btn.primary:active { box-shadow: none; }
.btn.danger { color: var(--danger); border-color: rgba(248,113,113,0.3); }

/* ============================================================
   KV GRID
   ============================================================ */
.section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 16px 0 8px;
}
.kv-grid {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 13px;
}
.kv-grid .k { color: var(--muted); font-weight: 500; }
.kv-grid .v { word-break: break-all; }
.kv-grid .v.mono { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--link); }

/* ============================================================
   RUNS
   ============================================================ */
.runs-list { display: flex; flex-direction: column; gap: 6px; }

.run-item {
  background: var(--bg2);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--idle);
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.08s;
}
.run-item:active { transform: scale(0.985); }
.run-item.ok      { border-left-color: var(--ok); }
.run-item.error   { border-left-color: var(--danger); }
.run-item.running { border-left-color: var(--warn); }

.run-item .row1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.run-item .agent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-item .when { color: var(--muted); font-size: 11px; white-space: nowrap; flex-shrink: 0; }
.run-item .run-status { font-size: 11px; font-weight: 700; margin-top: 3px; }
.run-item.ok      .run-status { color: var(--ok); }
.run-item.error   .run-status { color: var(--danger); }
.run-item.running .run-status { color: var(--warn); }
.run-item .out {
  margin-top: 8px;
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted);
  max-height: 72px;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
  padding: 6px 8px;
}

/* ============================================================
   SYSTEM METRICS
   ============================================================ */
.sys-metrics-grid { display: flex; flex-direction: column; gap: 12px; }

.sys-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sys-bar-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  width: 36px;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.sys-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 999px;
  overflow: hidden;
}
.sys-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.sys-bar-val {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  font-family: ui-monospace, monospace;
  width: 80px;
  text-align: right;
  flex-shrink: 0;
}
.sys-load-val {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--link);
  letter-spacing: 1px;
}

/* ============================================================
   SERVICES LIST
   ============================================================ */
.services-list { display: flex; flex-direction: column; }

.svc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
}
.svc-item:last-child { border-bottom: none; }
.svc-name { font-weight: 600; font-family: ui-monospace, monospace; }
.svc-status {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 10px;
  border-radius: 999px;
}
.svc-status.ok    { background: rgba(52,211,153,0.12);  color: var(--ok); }
.svc-status.error { background: rgba(248,113,113,0.12); color: var(--danger); }

/* ============================================================
   MEMORY (RAG)
   ============================================================ */
.memory-stats-row { min-height: 36px; }
.mem-stats-inner {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mem-stat-pill {
  display: flex;
  align-items: baseline;
  gap: 5px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  flex: 1;
  min-width: 80px;
}
.mem-stat-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--purple);
  line-height: 1;
}
.mem-stat-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.memory-list { display: flex; flex-direction: column; gap: 8px; }
.memory-item {
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--purple);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.memory-source {
  font-size: 12px;
  font-weight: 700;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--purple);
  word-break: break-all;
}
.memory-summary {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
  opacity: 0.85;
}
.memory-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.memory-badge {
  background: rgba(167,139,250,0.12);
  color: var(--purple);
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

/* ============================================================
   QUICK LINKS
   ============================================================ */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.links-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  padding: 16px 14px;
  text-decoration: none;
  color: var(--fg);
  cursor: pointer;
  transition: transform 0.1s ease;
  position: relative;
  overflow: hidden;
}
.links-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(96,165,250,0.07), transparent 60%);
  pointer-events: none;
}
.links-item:active { transform: scale(0.96); }
.links-icon  { font-size: 28px; line-height: 1; }
.links-label { font-size: 14px; font-weight: 700; }
.links-desc  { font-size: 11px; color: var(--muted); line-height: 1.4; }
.links-arrow { position: absolute; top: 12px; right: 12px; color: var(--muted); font-size: 16px; opacity: 0.5; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.empty-icon { font-size: 36px; display: block; margin-bottom: 10px; opacity: 0.5; }

/* ============================================================
   FORM
   ============================================================ */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.field input, .field textarea, .field select {
  background: var(--bg2);
  color: var(--fg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--btn);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.field textarea.mono { font-family: ui-monospace, monospace; font-size: 12px; }

/* ============================================================
   TOAST
   ============================================================ */
#toast {
  position: fixed;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 36, 48, 0.95);
  backdrop-filter: blur(16px);
  color: var(--fg);
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  z-index: 200;
  font-size: 13px;
  font-weight: 500;
  max-width: 88%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  pointer-events: none;
}
#toast.error { border-color: rgba(248,113,113,0.5); color: var(--danger); }
#toast.ok    { border-color: rgba(52,211,153,0.5);  color: var(--ok); }

/* ============================================================
   FATAL
   ============================================================ */
.fatal {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.fatal .fatal-icon { font-size: 48px; }
.fatal h2 { color: var(--fg); font-size: 20px; }
.fatal p { font-size: 14px; max-width: 280px; line-height: 1.5; }

/* ============================================================
   LOG BOX
   ============================================================ */
.log-box {
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(230,234,242,0.8);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 55vh;
  overflow: auto;
}
.log-box:empty::before { content: "(пусто)"; color: var(--muted); font-style: italic; }

.log-src-tabs { display: flex; gap: 6px; }
.log-src {
  flex: 1;
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.log-src.active {
  background: var(--btn);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(59,130,246,0.3);
}
.log-content-box { max-height: calc(100vh - 200px); font-size: 10.5px; }

/* ============================================================
   FILES
   ============================================================ */
.files-group-heading {
  font-size: 10px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 14px 4px 6px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: opacity 0.1s;
}
.file-item:active { opacity: 0.65; }
.file-ico  { font-size: 16px; flex-shrink: 0; color: var(--muted); }
.file-name { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { font-size: 11px; color: var(--muted); font-family: ui-monospace, monospace; flex-shrink: 0; }
.file-path-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
}
.file-path-text {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-icon {
  background: transparent;
  border: none;
  color: var(--link);
  font-size: 17px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: background 0.1s;
}
.btn-icon:active { background: var(--glass); }
.file-content-box { max-height: calc(100vh - 200px); font-size: 11px; }

/* ============================================================
   UTILS
   ============================================================ */
.muted { color: var(--muted); font-size: 13px; }

/* ============================================================
   LOADING SKELETON
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, rgba(255,255,255,0.04) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
  height: 60px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
