:root {
  --bg: #f8fafc;
  --bg-elev: #ffffff;
  --bg-soft: #f1f5f9;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-soft: #edf2f7;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --green: #10b981;
  --green-soft: #ecfdf5;
  --amber: #f59e0b;
  --amber-soft: #fffbeb;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.035);
  --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.08);
  --sidebar-w: 268px;
  --topbar-h: 64px;
}

html[data-theme="dark"] {
  --bg: #060b16;
  --bg-elev: #0c1427;
  --bg-soft: #131d35;
  --text: #f8fafc;
  --text-2: #cbd5e1;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.16);
  --border-soft: rgba(148, 163, 184, 0.1);
  --primary: #3b82f6;
  --primary-soft: rgba(59, 130, 246, 0.16);
  --primary-border: rgba(96, 165, 250, 0.35);
  --green-soft: rgba(16, 185, 129, 0.16);
  --amber-soft: rgba(245, 158, 11, 0.16);
  --red-soft: rgba(239, 68, 68, 0.16);
  --purple-soft: rgba(139, 92, 246, 0.16);
  --shadow-sm: 0 4px 18px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 18px 46px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
html, body, .content, .table-wrap, .card { overflow-anchor: none; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ==================== SIDEBAR ==================== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 42, 0.44);
  backdrop-filter: blur(4px);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  transition: transform 0.22s ease;
}

.brand-bar {
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 15px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: transparent;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.22);
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.brand-link small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}

.sidebar-close {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-2);
  place-items: center;
  cursor: pointer;
}

.sidebar-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-label {
  padding: 10px 10px 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-item {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.nav-item-left { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary);
  font-weight: 700;
}

.nav-badge {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.nav-item.active .nav-badge { background: var(--primary); color: #ffffff; }

.sidebar-foot {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.engine-mini {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.engine-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.engine-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
.dot.err { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.18); }

.mini-switch {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-2);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.mini-switch:hover { border-color: var(--primary); color: var(--primary); }

.home-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-2);
}
.home-back-link:hover { border-color: var(--primary); color: var(--primary); }

/* ==================== MAIN SHELL & TOPBAR ==================== */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  padding: 0 24px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.mobile-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.search-wrap { position: relative; flex: 0 1 380px; min-width: 140px; }
.search-input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-input:focus { background: var(--bg-elev); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn:hover { border-color: var(--primary-border); color: var(--primary); background: var(--primary-soft); }

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 52%, #0ea5e9 100%);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 8px 20px -4px rgba(37, 99, 235, 0.38);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #0284c7 100%);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 12px 26px -4px rgba(37, 99, 235, 0.48);
  transform: translateY(-1px);
}
.btn-green { background: var(--green); border-color: var(--green); color: #ffffff; }
.btn-green:hover { background: #059669; color: #ffffff; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: #ffffff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #ffffff; }
.btn-danger:hover { background: #dc2626; color: #ffffff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; }

.select-mini {
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
}

/* ==================== CONTENT PANELS ==================== */
.content {
  padding: 24px 26px 40px;
  width: min(100%, 1520px);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.025em; }
.page-head p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }

/* ==================== OVERVIEW VIP HERO, GLASS CARDS & PASTEL KPIs ==================== */
.overview-header-row {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.overview-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  border-radius: 22px;
  background: linear-gradient(125deg, #1e40af 0%, #2563eb 52%, #0ea5e9 100%);
  color: #ffffff;
  box-shadow: 0 18px 42px -12px rgba(37, 99, 235, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.overview-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(460px circle at 92% 12%, rgba(255, 255, 255, 0.24), transparent 60%),
    radial-gradient(260px circle at 8% 95%, rgba(56, 189, 248, 0.28), transparent 60%);
  pointer-events: none;
}
.ov-hero-orb {
  position: absolute;
  right: -32px;
  bottom: -44px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}
.ov-hero-left { position: relative; z-index: 1; min-width: 0; }
.ov-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ov-live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.26);
  display: block;
  flex-shrink: 0;
}
.overview-hero h1 { margin: 11px 0 5px; font-size: clamp(21px, 2.3vw, 28px); font-weight: 800; letter-spacing: -0.025em; color: #ffffff; }
.overview-hero p { margin: 0; font-size: 13.5px; line-height: 1.55; color: rgba(255, 255, 255, 0.9); max-width: 580px; }
.ov-hero-actions { position: relative; z-index: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 16px; }

.btn-glass-white { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.28); color: #ffffff; backdrop-filter: blur(8px); }
.btn-glass-white:hover { background: rgba(255, 255, 255, 0.26); color: #ffffff; border-color: rgba(255, 255, 255, 0.45); transform: translateY(-1px); }
.btn-solid-white { background: #ffffff; border: 1px solid #ffffff; color: #0f172a; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.16); }
.btn-solid-white:hover { background: #eff6ff; color: #1d4ed8; border-color: #ffffff; transform: translateY(-1px); }

.overview-meta-pair {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}
.meta-glass-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.meta-glass-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.meta-ico {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.meta-ico.is-green { background: var(--green-soft); color: var(--green); }
.meta-ico.is-blue { background: var(--primary-soft); color: var(--primary); }
.meta-copy { min-width: 0; flex: 1 1 auto; }
.meta-copy small { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; }
.meta-copy strong { display: block; margin-top: 2px; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.meta-sub { display: inline-flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.meta-sub .dot { width: 7px; height: 7px; }

.ov-section-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}
.ov-section-title small { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: 0.07em; color: var(--primary); text-transform: uppercase; }
.ov-section-title h2 { margin: 2px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpi-card {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-body-left { display: flex; align-items: center; gap: 13px; min-width: 0; flex: 1 1 auto; }
.kpi-arrow { font-size: 14px; font-weight: 800; color: var(--muted); opacity: 0.55; transition: transform 0.18s ease, opacity 0.18s ease, color 0.18s ease; flex-shrink: 0; }
.kpi-card:hover .kpi-arrow { transform: translateX(3px); opacity: 1; color: var(--primary); }
.kpi-sky { background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%); border-color: #dbeafe; }
.kpi-emerald { background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%); border-color: #d1fae5; }
.kpi-slate { background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%); border-color: #e2e8f0; }
.kpi-amber { background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%); border-color: #fde68a; }
.kpi-rose { background: linear-gradient(135deg, #ffffff 0%, #fff1f2 100%); border-color: #fecdd3; }
.kpi-indigo { background: linear-gradient(135deg, #ffffff 0%, #eef2ff 100%); border-color: #e0e7ff; }

html[data-theme="dark"] .kpi-sky { background: linear-gradient(135deg, #0c1427 0%, rgba(37, 99, 235, 0.16) 100%); border-color: rgba(59, 130, 246, 0.25); }
html[data-theme="dark"] .kpi-emerald { background: linear-gradient(135deg, #0c1427 0%, rgba(16, 185, 129, 0.15) 100%); border-color: rgba(16, 185, 129, 0.25); }
html[data-theme="dark"] .kpi-slate { background: linear-gradient(135deg, #0c1427 0%, rgba(100, 116, 139, 0.18) 100%); border-color: rgba(148, 163, 184, 0.22); }
html[data-theme="dark"] .kpi-amber { background: linear-gradient(135deg, #0c1427 0%, rgba(245, 158, 11, 0.15) 100%); border-color: rgba(245, 158, 11, 0.26); }
html[data-theme="dark"] .kpi-rose { background: linear-gradient(135deg, #0c1427 0%, rgba(239, 68, 68, 0.15) 100%); border-color: rgba(239, 68, 68, 0.26); }
html[data-theme="dark"] .kpi-indigo { background: linear-gradient(135deg, #0c1427 0%, rgba(99, 102, 241, 0.16) 100%); border-color: rgba(99, 102, 241, 0.28); }

.kpi-meta { min-width: 0; flex: 1 1 auto; }
.kpi-meta small { display: block; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.kpi-val-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.kpi-meta strong { display: inline-block; font-size: 25px; font-weight: 800; line-height: 1.08; font-variant-numeric: tabular-nums; letter-spacing: -0.025em; }
.kpi-runs-val { color: var(--primary); font-size: 20px !important; }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.kpi-delta.is-blue { background: var(--primary-soft); color: var(--primary); }
.kpi-delta.is-green { background: var(--green-soft); color: #059669; }
.kpi-delta.is-amber { background: var(--amber-soft); color: #d97706; }
.kpi-delta.is-red { background: var(--red-soft); color: #dc2626; }
.kpi-sub { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kpi-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg-elev); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.kpi-sky .kpi-icon { color: #2563eb; }
.kpi-emerald .kpi-icon { color: #10b981; }
.kpi-slate .kpi-icon { color: #64748b; }
.kpi-amber .kpi-icon { color: #f59e0b; }
.kpi-rose .kpi-icon { color: #ef4444; }
.kpi-indigo .kpi-icon { color: #6366f1; }

.card-kicker { display: block; font-size: 10px; font-weight: 800; letter-spacing: 0.06em; color: var(--primary); text-transform: uppercase; margin-bottom: 2px; }
.engine-clock-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.spark-wrap { position: relative; height: 104px; width: 100%; margin-top: 10px; padding: 8px 10px; border-radius: 13px; border: 1px solid var(--border); background: var(--bg-soft); }
.spark-wrap canvas { width: 100% !important; height: 100% !important; display: block; cursor: crosshair; }
.spark-tooltip {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.spark-tooltip.visible { opacity: 1; }

.tile-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: var(--bg-elev); border: 1px solid var(--border); color: var(--primary); }
.tile-ico.is-green { color: var(--green); }
.tile-ico.is-amber { color: var(--amber); }
.tile-ico.is-red { color: var(--red); }
.tile-ico.is-purple { color: var(--purple); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.95fr); gap: 18px; }
.ov-bottom-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.9fr); gap: 18px; }
.card { border-radius: 18px; border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow-sm); overflow: hidden; min-width: 0; }
.card-head { padding: 15px 20px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.card-head h2 { margin: 0; font-size: 15.5px; font-weight: 800; }
.card-body { padding: 18px 20px; }

.action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.action-tile { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 10px; cursor: pointer; text-align: left; transition: all 0.15s ease; }
.action-tile:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); transform: translateY(-1px); }
.action-tile.is-busy, .btn.is-busy { opacity: 0.65; pointer-events: none; }

.runtime-spec-grid { margin-top: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.runtime-spec-box { padding: 10px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--bg-soft); min-width: 0; }
.runtime-spec-box small { display: block; font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.runtime-spec-box strong { display: block; margin-top: 2px; font-size: 13.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-cron-list { display: flex; flex-direction: column; gap: 12px; }
.top-cron-item { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--bg-soft); }
.top-cron-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.top-cron-left { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.top-cron-rank { font-size: 11px; font-weight: 800; color: var(--primary); background: var(--primary-soft); border-radius: 7px; padding: 2px 7px; flex-shrink: 0; }
.top-cron-url { font-size: 12.5px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-cron-stat { font-size: 12px; font-weight: 800; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.top-cron-track { height: 5px; border-radius: 999px; background: var(--border); overflow: hidden; }
.top-cron-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%); transition: width 0.3s ease; }

.chart-wrap { height: 205px; width: 100%; position: relative; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; display: block; }

/* ==================== TASKS PAGE PRO HEADER, STATS & TOOLBAR ==================== */
.tasks-hero-banner {
  padding: 20px 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--primary-soft) 100%);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.tasks-hero-copy { min-width: 0; flex: 1 1 320px; }
.tasks-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tasks-kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  display: block;
}
.tasks-hero-copy h1 { margin: 8px 0 4px; font-size: clamp(20px, 2.2vw, 24px); font-weight: 800; letter-spacing: -0.025em; }
.tasks-hero-copy p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.tasks-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.tasks-stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tasks-stat-chip {
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-align: left;
  min-width: 0;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.tasks-stat-chip:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.tasks-stat-chip.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.tchip-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.tasks-stat-chip.is-sky .tchip-ico { background: var(--primary-soft); color: var(--primary); }
.tasks-stat-chip.is-green .tchip-ico { background: var(--green-soft); color: var(--green); }
.tasks-stat-chip.is-amber .tchip-ico { background: var(--amber-soft); color: var(--amber); }
.tasks-stat-chip.is-red .tchip-ico { background: var(--red-soft); color: var(--red); }
.tchip-meta { min-width: 0; }
.tchip-meta small { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.tchip-meta strong { display: block; margin-top: 2px; font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--text); }

.tasks-toolbar-card { overflow: visible; }
.tasks-toolbar {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.tasks-controls-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.tasks-inline-search {
  position: relative;
  width: 220px;
  max-width: 100%;
}
.tasks-inline-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.tasks-inline-search input {
  width: 100%;
  height: 36px;
  padding: 0 11px 0 32px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12.5px;
  outline: none;
}
.tasks-inline-search input:focus { background: var(--bg-elev); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.tasks-sort-select {
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}
.task-count-pill {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

/* ==================== FILTER & TABLE ==================== */
.filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-elev); color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer; transition: all 0.14s ease; }
.filter-pill:hover { border-color: var(--primary-border); color: var(--text); }
.filter-pill.active { background: var(--primary); border-color: var(--primary); color: #ffffff; }
.pill-cnt { padding: 1px 6px; border-radius: 999px; background: var(--bg-soft); color: var(--text-2); font-size: 10.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
.filter-pill.active .pill-cnt { background: rgba(255, 255, 255, 0.24); color: #ffffff; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { padding: 12px 10px; background: var(--bg-soft); border-bottom: 1px solid var(--border); text-align: left; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); white-space: nowrap; }
tbody td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.tasks-table thead th, .tasks-table tbody td { padding: 11px 8px; }
.tasks-table tbody td:first-child { white-space: nowrap; font-size: 12.5px; }
.tasks-table .url-cell { max-width: 190px; }
.tasks-table .tasks-note-sub { max-width: 215px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(37, 99, 235, 0.03); }

.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.st-run { background: var(--green-soft); color: #047857; }
.st-pause { background: var(--bg-soft); color: var(--muted); }
.st-wait { background: var(--amber-soft); color: #b45309; }
.st-exp { background: var(--purple-soft); color: #6d28d9; }
.st-err { background: var(--red-soft); color: #dc2626; }
html[data-theme="dark"] .st-run { color: #34d399; }
html[data-theme="dark"] .st-wait { color: #fcd34d; }
html[data-theme="dark"] .st-exp { color: #c4b5fd; }
html[data-theme="dark"] .st-err { color: #fca5a5; }

.tasks-url-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tasks-url-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.url-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; color: var(--primary); font-weight: 700; }
.tasks-note-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.btn-copy-mini { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: all 0.14s ease; }
.btn-copy-mini:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.delay-chip { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); font-size: 12px; font-weight: 800; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.latency-chip { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 6px; background: var(--bg-soft); font-size: 11px; font-weight: 700; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-actions { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.row-actions .btn-sm { width: 27px; height: 27px; padding: 0; border-radius: 7px; flex-shrink: 0; }
.row-actions .btn-act-run { color: var(--primary); border-color: var(--primary-border); background: var(--primary-soft); }
.row-actions .btn-act-run:hover { background: var(--primary); color: #ffffff; }
.row-actions .btn-act-edit:hover { color: var(--purple); border-color: rgba(124, 58, 237, 0.35); background: var(--purple-soft); }

/* ==================== SUBPAGE HERO, LOGS, TELEGRAM DIRECTORY & AVATARS ==================== */
.subpage-hero-banner {
  padding: 20px 24px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-elev) 0%, var(--primary-soft) 100%);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.subpage-hero-copy { min-width: 0; flex: 1 1 320px; }
.subpage-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.subpage-kicker i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18); display: block; }
.subpage-hero-copy h1 { margin: 8px 0 4px; font-size: clamp(20px, 2.2vw, 24px); font-weight: 800; letter-spacing: -0.025em; }
.subpage-hero-copy p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.subpage-hero-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.subpage-stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.sub-stat-card {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sub-stat-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.sub-stat-card.is-sky .sub-stat-ico { background: var(--primary-soft); color: var(--primary); }
.sub-stat-card.is-green .sub-stat-ico { background: var(--green-soft); color: var(--green); }
.sub-stat-card.is-red .sub-stat-ico { background: var(--red-soft); color: var(--red); }
.sub-stat-card.is-indigo .sub-stat-ico { background: var(--purple-soft); color: var(--purple); }
.sub-stat-card small { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.sub-stat-card strong { display: block; margin-top: 2px; font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }

.logs-toolbar-card { overflow: visible; }
.logs-split-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 0.95fr); gap: 16px; align-items: start; }
.logs-table th, .logs-table td, .backups-table th, .backups-table td { padding: 10px 8px; font-size: 12.5px; }
.logs-table td:first-child { white-space: normal !important; min-width: 84px; line-height: 1.28; font-size: 12px; color: var(--text-2); }
.logs-table .url-cell { max-width: 155px; }
.backups-table strong { word-break: break-word; font-size: 12px; }
.bk-kind-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--primary-soft);
  color: var(--primary);
  margin-right: 6px;
}
.bk-kind-badge.is-logs { background: var(--purple-soft); color: var(--purple); }
.bk-kind-badge.is-config { background: var(--amber-soft); color: #b45309; }

.delay-preset-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.delay-preset-btn {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.14s ease;
}
.delay-preset-btn:hover, .delay-preset-btn.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

.tg-users-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tg-user-card {
  padding: 14px 15px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.tg-user-card:hover { transform: translateY(-2px); border-color: var(--primary-border); background: var(--bg-elev); box-shadow: var(--shadow-sm); }
.tg-user-top { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tg-avatar-wrap { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.tg-avatar-img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg-elev);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.12);
  background: var(--bg-elev);
  display: block;
}
.tg-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: block;
  background: var(--bg-soft);
}
.tg-status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-elev);
}
.tg-status-dot.is-banned { background: var(--red); }
.tg-status-dot.is-idle { background: var(--muted); }
.tg-user-ident { min-width: 0; flex: 1 1 auto; }
.tg-user-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tg-user-name-row strong { font-size: 13.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-role-pill { padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; flex-shrink: 0; background: var(--bg-elev); border: 1px solid var(--border); color: var(--muted); }
.tg-role-pill.is-admin { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); }
.tg-role-pill.is-banned { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.35); color: var(--red); }
.tg-user-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

.tg-user-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 10px;
  border-radius: 11px;
  background: var(--bg-elev);
  border: 1px solid var(--border-soft);
}
.tg-user-stats div { min-width: 0; }
.tg-user-stats small { display: block; font-size: 9.5px; font-weight: 800; text-transform: uppercase; color: var(--muted); }
.tg-user-stats strong { display: block; font-size: 12.5px; font-weight: 800; margin-top: 1px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tg-user-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tg-last-cmd { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-user-inline { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }

/* ==================== FORMS & MODALS ==================== */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field small { font-size: 11.5px; color: var(--muted); }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-soft); color: var(--text); font-size: 13.5px; outline: none; }
.input:focus { background: var(--bg-elev); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); gap: 12px; }
.switch-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.modal-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(15, 23, 42, 0.54); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { width: min(100%, 560px); max-height: 90vh; overflow-y: auto; border-radius: 20px; border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow-md); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 16.5px; font-weight: 800; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border-soft); display: flex; justify-content: flex-end; gap: 8px; }

.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.toast { padding: 12px 16px; border-radius: 12px; background: #0f172a; color: #ffffff; font-size: 13px; font-weight: 600; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25); border-left: 4px solid var(--primary); }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }

.bot-error-banner { padding: 12px 16px; border-radius: 12px; border: 1px solid rgba(239, 68, 68, 0.35); background: var(--red-soft); color: #dc2626; font-size: 13px; font-weight: 600; display: none; }
html[data-theme="dark"] .bot-error-banner { color: #fca5a5; }
.bot-error-banner.show { display: block; }

.sub-stat-ico.is-indigo { background: rgba(79, 70, 229, 0.12); color: #4f46e5; }
.sub-stat-ico.is-green { background: rgba(16, 185, 129, 0.12); color: #059669; }
.sub-stat-ico.is-sky { background: rgba(14, 165, 233, 0.12); color: #0284c7; }
.sub-stat-ico.is-amber { background: rgba(245, 158, 11, 0.14); color: #d97706; }

/* ==================== CONFIG CONSOLE ==================== */
.cfg-engine-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.cfg-engine-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04); transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; min-width: 0; }
.cfg-engine-card:hover { border-color: rgba(37, 99, 235, 0.28); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06); }
.cfg-engine-card > small { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.cfg-engine-card > strong { font-size: 14.5px; font-weight: 800; color: var(--text); line-height: 1.35; min-width: 0; }
.cfg-eng-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.cfg-eng-top > * { min-width: 0; }
.cfg-eng-top .sub-stat-ico { flex-shrink: 0; }
.cfg-eng-action-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-top: 8px; border-top: 1px dashed var(--border); min-width: 0; }
.cfg-eng-action-row .cfg-eng-foot { padding-top: 0; border-top: 0; }
.cfg-eng-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--muted); flex-wrap: wrap; min-width: 0; }
.cfg-hook-url { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; font-size: 11.5px !important; font-weight: 600 !important; color: var(--text-2); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; width: 100%; max-width: 100%; min-width: 0; }

.cfg-layout-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.95fr); gap: 18px; align-items: start; }
.cfg-col-main, .cfg-col-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@media (min-width: 1024px) {
  .cfg-col-side { position: sticky; top: calc(var(--topbar-h, 64px) + 16px); }
}

.input-eye-wrap { position: relative; display: flex; align-items: center; width: 100%; }
.input-eye-wrap .input { padding-right: 44px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing: 0.01em; }
.input-eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s ease, color .15s ease; }
.input-eye-btn:hover { background: var(--bg-soft); color: var(--text); }
.input-eye-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.cfg-test-banner { margin-top: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-soft); font-size: 13px; line-height: 1.5; color: var(--text); display: none; word-break: break-word; }
.cfg-test-banner.is-show { display: flex; align-items: flex-start; gap: 10px; }
.cfg-test-banner.is-ok { background: rgba(16, 185, 129, 0.08); border-color: rgba(16, 185, 129, 0.32); color: #065f46; }
.cfg-test-banner.is-err { background: rgba(239, 68, 68, 0.08); border-color: rgba(239, 68, 68, 0.32); color: #991b1b; }
.cfg-test-banner.is-loading { background: rgba(37, 99, 235, 0.07); border-color: rgba(37, 99, 235, 0.25); color: var(--primary); }

.cfg-switch-stack { display: flex; flex-direction: column; gap: 10px; }
.cfg-switch-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border-radius: 13px; border: 1px solid var(--border); background: var(--bg-soft); cursor: pointer; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.cfg-switch-card:hover { border-color: rgba(37, 99, 235, 0.28); background: var(--bg-elev); box-shadow: 0 3px 10px rgba(15, 23, 42, 0.04); }
.cfg-switch-info { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.cfg-switch-info .tile-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--primary); }
.cfg-switch-info .tile-ico.is-amber { color: var(--amber); background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.24); }
.cfg-switch-info .tile-ico.is-red { color: var(--red); background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.24); }
.cfg-switch-info .tile-ico.is-green { color: var(--green); background: rgba(16, 185, 129, 0.10); border-color: rgba(16, 185, 129, 0.24); }
.cfg-switch-info .tile-ico:not(.is-amber):not(.is-red):not(.is-green) { color: var(--primary); background: rgba(37, 99, 235, 0.10); border-color: rgba(37, 99, 235, 0.24); }
.cfg-switch-info .tile-ico svg { display: block; flex-shrink: 0; }
.cfg-switch-info > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cfg-switch-info strong { font-size: 13.5px; font-weight: 700; color: var(--text); line-height: 1.3; }
.cfg-switch-info > div small, .cfg-switch-info > div span { font-size: 12px; color: var(--muted); line-height: 1.4; display: block; }

.ui-switch { position: relative; display: inline-flex; align-items: center; width: 46px; height: 26px; flex-shrink: 0; }
.ui-switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.ui-slider { position: relative; display: block; width: 46px; height: 26px; border-radius: 999px; background: var(--border); transition: background .22s ease, box-shadow .22s ease; box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.14); pointer-events: none; }
.ui-slider::before { content: ""; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #ffffff; box-shadow: 0 2px 5px rgba(15, 23, 42, 0.22); transition: transform .22s cubic-bezier(.4, 0, .2, 1); }
.ui-switch input:checked + .ui-slider { background: linear-gradient(135deg, var(--primary), #4f46e5); }
.ui-switch input:checked + .ui-slider::before { transform: translateX(20px); }
.ui-switch input:focus-visible + .ui-slider { outline: 2px solid var(--primary); outline-offset: 2px; }

.cfg-save-card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-sm); }
.cfg-dirty-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cfg-dirty-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--green-soft); color: #047857; border: 1px solid rgba(16, 185, 129, 0.28); transition: all .2s ease; }
.cfg-dirty-badge.is-dirty { background: var(--amber-soft); color: #b45309; border-color: rgba(245, 158, 11, 0.35); }
html[data-theme="dark"] .cfg-dirty-badge { color: #34d399; }
html[data-theme="dark"] .cfg-dirty-badge.is-dirty { color: #fcd34d; }
html[data-theme="dark"] .cfg-test-banner.is-ok { color: #34d399; }
html[data-theme="dark"] .cfg-test-banner.is-err { color: #fca5a5; }
.cfg-save-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
.cfg-save-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.cfg-save-actions .btn { flex: 1 1 auto; justify-content: center; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1180px) {
  .overview-header-row, .logs-split-grid { grid-template-columns: 1fr; }
  .overview-meta-pair { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tg-users-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cfg-engine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  .sidebar { transform: translateX(-105%); width: min(84vw, 290px); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .sidebar-close { display: grid; }
  .main { margin-left: 0; }
  .mobile-btn { display: grid; }
  .grid-2, .ov-bottom-grid, .cfg-layout-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .tasks-stat-strip, .subpage-stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tasks-controls-right { width: 100%; margin-left: 0; }
  .tasks-inline-search { flex: 1 1 160px; width: auto; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tbody { display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--bg-soft); }
  .responsive-table tr { padding: 14px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow-sm); }
  .responsive-table td { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border-soft); text-align: right; }
  .responsive-table td:last-child { border-bottom: 0; padding-top: 10px; justify-content: flex-end; }
  .responsive-table td::before { content: attr(data-label); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); flex-shrink: 0; text-align: left; }
  .responsive-table td.no-label::before { display: none; }
  .responsive-table td.no-label { justify-content: center; }
  .tasks-url-cell { align-items: flex-end; max-width: 68%; }
  .tasks-note-sub { max-width: 100%; }
  .tasks-table td[data-label="Thao Tác"]::before { display: none; }
  .row-actions { width: 100%; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
  .row-actions .btn-sm { width: 34px; height: 34px; flex: 1 1 32px; max-width: 44px; border-radius: 9px; }
  .url-cell { max-width: 175px; }
}

@media (max-width: 680px) {
  .tg-users-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 16px 12px 28px; }
  .overview-hero, .tasks-hero-banner, .subpage-hero-banner { padding: 18px 16px; border-radius: 18px; }
  .overview-meta-pair { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi-card { padding: 13px 12px; }
  .kpi-arrow { display: none; }
  .kpi-icon { width: 38px; height: 38px; border-radius: 11px; }
  .kpi-body-left { gap: 10px; }
  .kpi-meta strong { font-size: 21px; }
  .action-grid, .form-grid, .runtime-spec-grid { grid-template-columns: 1fr; }
  .search-wrap { flex: 1 1 auto; }
  .btn-add-label, .select-mini { display: none; }
  .cfg-engine-card { padding: 13px; }
  .cfg-switch-card { padding: 11px 12px; gap: 10px; }
  .cfg-save-actions { flex-direction: column; align-items: stretch; }
  .cfg-save-actions .btn { width: 100%; }
}

@media (max-width: 520px) {
  .cfg-engine-grid { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 360px) {
  .kpi-grid, .tasks-stat-strip, .subpage-stat-strip, .cfg-engine-grid { grid-template-columns: 1fr; }
  .tasks-hero-actions .btn, .subpage-hero-actions .btn { flex: 1 1 auto; }
}

