/* ================================================================
   Data Aggregator — "SaaS Dashboard" uslubi (ochiq tema, binafsha urg'u)
   Ilhom: Figma "SaaS Dashboard (Base)" UI Kit
   ================================================================ */

:root,
[data-theme="light"] {
  --bg: #f3f4fb;
  --surface: #ffffff;
  --surface-2: #f6f7fc;
  --surface-3: #eef0f8;
  --border: #e9ebf3;
  --text: #1b1d2a;
  --text-soft: #4a4d60;
  --muted: #8b90a7;
  --accent: #6c5ce7;
  --accent-2: #8b7cf0;
  --accent-soft: #efedfd;
  --accent-ring: rgba(108, 92, 231, 0.14);
  --green: #23c16b;
  --green-soft: #e3f7ec;
  --red: #f36b6b;
  --red-soft: #fdeaea;
  --yellow: #f7b23b;
  --yellow-soft: #fdf1dd;
  --blue: #4c9aff;
  --blue-soft: #e6f0ff;
  --pink: #ff6b9a;
  --pink-soft: #ffe8f0;
  --badge-bg: #eef0f8;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 6px 22px rgba(26, 28, 54, 0.06);
  --shadow-sm: 0 2px 10px rgba(26, 28, 54, 0.05);
  --shadow-lg: 0 18px 50px rgba(26, 28, 54, 0.16);
}

[data-theme="dark"] {
  --bg: #12131c;
  --surface: #1b1d29;
  --surface-2: #222536;
  --surface-3: #2a2d40;
  --border: #2b2e42;
  --text: #eaecf5;
  --text-soft: #c2c6d6;
  --muted: #868ba3;
  --accent: #7c6cf0;
  --accent-2: #9a8bf5;
  --accent-soft: #272449;
  --accent-ring: rgba(124, 108, 240, 0.22);
  --green: #34d17e;
  --green-soft: #17301f;
  --red: #ff7777;
  --red-soft: #331c1c;
  --yellow: #f7b23b;
  --yellow-soft: #322813;
  --blue: #5aa3ff;
  --blue-soft: #16233a;
  --pink: #ff77a3;
  --pink-soft: #331c26;
  --badge-bg: #2a2d40;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Inter", "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

a { color: inherit; }

/* ==== Topbar (tepa panel) ==== */
header {
  background: transparent;
  position: sticky;
  top: 0;
  z-index: 30;
}
.header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
h1 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.stats-line { font-size: 0.76rem; color: var(--muted); font-weight: 500; }
.only-mobile { display: none; }

.actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }

input[type="search"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 15px;
  border-radius: 999px;
  font-size: 0.9rem;
  min-width: 210px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
}
input[type="search"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn-icon { padding: 9px 11px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px var(--accent-ring); }
.btn-primary:hover { background: var(--accent-2); color: #fff; filter: none; }
.btn:disabled { opacity: 0.6; cursor: wait; }

.status {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  height: 0;
  overflow: hidden;
  transition: 0.2s;
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 600;
}
.status.show { height: auto; padding: 4px 24px 6px; }
.status.error { color: var(--red); }

/* ==== Layout: sidebar + asosiy ustun ==== */
.layout {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px 24px 0;
  display: grid;
  grid-template-columns: 244px 1fr;
  gap: 22px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  box-shadow: 0 6px 16px var(--accent-ring);
}
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.sidebar-head { padding: 4px 12px 10px; }
#source-filter {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 0.83rem;
}
#source-filter:focus { outline: none; border-color: var(--accent); }
.sidebar-backdrop { display: none; }

.tabs {
  overflow-y: auto;
  padding: 4px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.src-group-special { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; }

.tab {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background 0.13s, color 0.13s;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab .tab-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
[data-theme="dark"] .tab.active { color: var(--accent-2); }
.tab .badge {
  background: var(--badge-bg);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.7rem;
  font-weight: 700;
}
.tab.active .badge { background: var(--accent); color: #fff; }
.tab .refresh-one { opacity: 0; font-size: 0.82rem; transition: opacity 0.15s; }
.tab:hover .refresh-one { opacity: 0.7; }
.tab .refresh-one:hover { opacity: 1; }

/* Guruh sarlavhasi (yopib/ochib bo'ladi) */
.src-group { margin-top: 6px; }
.group-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 800;
}
.group-head:hover { color: var(--text); }
.group-name { flex: 1; text-align: left; }
.group-badge { font-size: 0.66rem; opacity: 0.75; font-weight: 700; }
.group-chevron { transition: transform 0.15s; display: inline-block; font-size: 0.66rem; }
.src-group:not(.collapsed) .group-chevron { transform: rotate(90deg); }
.src-group.collapsed .group-body { display: none; }
.group-body { display: flex; flex-direction: column; gap: 2px; }
.sidebar-empty { color: var(--muted); font-size: 0.82rem; text-align: center; padding: 16px; }

.main-col { min-width: 0; display: flex; flex-direction: column; gap: 18px; padding-bottom: 8px; }

/* ==== Sahifa sarlavhasi (dashboard head) ==== */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 4px;
}
.page-title { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.page-sub { font-size: 0.8rem; color: var(--muted); }

/* ==== Stat kartalar qatori (rangli doira ikon) ==== */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.stat-icon {
  width: 52px; height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--blue-soft); color: var(--blue); }
.stat-icon.yellow { background: var(--yellow-soft); color: var(--yellow); }
.stat-icon.pink { background: var(--pink-soft); color: var(--pink); }
.stat-icon.purple { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green { background: var(--green-soft); color: var(--green); }
.stat-icon.red { background: var(--red-soft); color: var(--red); }
.stat-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.stat-num { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }

/* ==== Umumiy karta (Reports / Analytics / jadval / bars) ==== */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.card-head h3 { font-size: 1.02rem; font-weight: 700; }
.card-head .card-menu { color: var(--muted); font-weight: 700; letter-spacing: 2px; cursor: default; }
.card-head .head-actions { display: flex; gap: 6px; align-items: center; }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
.dash-grid.two { grid-template-columns: 1.6fr 1fr; }
.dash-grid.even { grid-template-columns: 1fr 1fr; }

/* ==== Highlights (jonli KPI strip) ==== */
.highlights {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}
.highlights:empty { display: none; }
.hl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hl-top { font-size: 0.72rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.hl-value { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.hl-sub { font-size: 0.76rem; color: var(--muted); font-weight: 600; }
.hl-sub.up { color: var(--green); }
.hl-sub.down { color: var(--red); }
.hl-card.clickable { cursor: pointer; transition: transform 0.12s, box-shadow 0.12s; }
.hl-card.clickable:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.hl-spark { margin-top: 6px; height: 32px; }
.hl-spark:empty { display: none; }

/* ==== Reports area chart ==== */
.reports-chart { min-height: 220px; }
.reports-meta { display: flex; justify-content: space-between; margin-top: 8px; font-size: 0.8rem; color: var(--muted); }
.reports-meta .up { color: var(--green); font-weight: 700; }
.reports-meta .down { color: var(--red); font-weight: 700; }

/* ==== Analytics donut ==== */
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.donut-svg { width: 190px; height: 190px; }
.donut-center-num { font-size: 1.5rem; font-weight: 800; fill: var(--text); }
.donut-center-lbl { font-size: 0.72rem; fill: var(--muted); }
.donut-legend { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-soft); font-weight: 600; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ==== Recent runs jadval ==== */
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.dash-table th, .dash-table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.dash-table th { color: var(--muted); font-weight: 600; font-size: 0.76rem; }
.dash-table tr:last-child td { border-bottom: none; }
.dash-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 700;
}
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.err { background: var(--red-soft); color: var(--red); }

/* ==== Top manbalar bars ==== */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 118px 1fr auto; align-items: center; gap: 10px; font-size: 0.82rem; }
.bar-name { color: var(--text-soft); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.bar-val { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ==== Browse (toolbar + kategoriya + kartalar) ==== */
.browse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 20px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-info { font-size: 0.86rem; color: var(--text-soft); font-weight: 600; }
.toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-label { font-size: 0.78rem; color: var(--muted); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.sort-wrap { display: flex; align-items: center; gap: 6px; }
.select-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 0.8rem;
  cursor: pointer;
}

.cat-filter { padding: 12px 0 2px; display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.cat-filter:empty { padding: 0; }
.cat-pill {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: 0.13s;
}
.cat-pill:hover { border-color: var(--accent); color: var(--text); }
.cat-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.content {
  padding: 14px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.13s, transform 0.13s, border-color 0.13s;
}
.card:hover { border-color: transparent; box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .cat {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}
.card .title { font-weight: 700; font-size: 0.98rem; line-height: 1.35; }
.card .title a { color: var(--text); text-decoration: none; }
.card .title a:hover { color: var(--accent); }
.card .summary { color: var(--muted); font-size: 0.85rem; }
.card .meta { color: var(--muted); font-size: 0.74rem; margin-top: auto; }
.card-actions { display: flex; align-items: center; gap: 6px; }

.copy-btn, .fav-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 2px;
  transition: color 0.15s, transform 0.1s;
}
.copy-btn:hover { transform: scale(1.12); color: var(--accent); }
.fav-btn:hover { transform: scale(1.2); }
.fav-btn.on { color: var(--yellow); }
.card-spark { height: 32px; cursor: pointer; }
.card-spark:hover { opacity: 0.85; }
.spark-empty { font-size: 0.72rem; color: var(--muted); }

.tab-fav.active { background: var(--yellow-soft); color: #b9821b; }
.tab-fav.active .badge { background: var(--yellow); color: #fff; }

.src-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--muted); opacity: 0.45; }
.src-dot.ok { background: var(--green); opacity: 1; }
.src-dot.err { background: var(--red); opacity: 1; }

.delta { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.delta.up { color: var(--green); background: var(--green-soft); }
.delta.down { color: var(--red); background: var(--red-soft); }
.delta.flat { color: var(--muted); background: var(--badge-bg); }

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px; }

footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 8px 24px 28px;
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.autorefresh { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.autorefresh input { accent-color: var(--accent); }

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==== Sparkline / chart SVG ==== */
.spark { width: 100%; height: 32px; display: block; }
.spark-line { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-area { stroke: none; opacity: 0.16; }
.spark.up .spark-line, .spark.up .spark-area { stroke: var(--green); fill: var(--green); }
.spark.down .spark-line, .spark.down .spark-area { stroke: var(--red); fill: var(--red); }

.chart { width: 100%; height: auto; }
.chart-line { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { stroke: none; }
.chart.up .chart-line, .chart.up .chart-dot { stroke: var(--accent); fill: var(--accent); }
.chart.down .chart-line, .chart.down .chart-dot { stroke: var(--accent); fill: var(--accent); }
.chart .grid { stroke: var(--border); stroke-width: 1; opacity: 0.7; }
.chart .axis { fill: var(--muted); font-size: 11px; }

/* ==== Modal (grafik / alert / tarix) ==== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 22, 44, 0.42);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 100;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(720px, 100%);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-lg);
}
.modal-lg { width: min(940px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 1.12rem; font-weight: 800; }
.modal-ranges { display: flex; gap: 8px; margin: 14px 0; align-items: center; flex-wrap: wrap; }
.modal-export { margin-left: auto; display: flex; gap: 8px; }
.range-btn {
  padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-soft); cursor: pointer; font-size: 0.82rem; font-weight: 600;
}
.range-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-chart { min-height: 200px; }
.modal-foot { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.82rem; color: var(--muted); }
.modal-foot .up { color: var(--green); font-weight: 700; }
.modal-foot .down { color: var(--red); font-weight: 700; }

#alerts-btn { position: relative; }
.alert-count {
  display: none; position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: 0.64rem; font-weight: 800;
  min-width: 16px; height: 16px; line-height: 16px; text-align: center;
  border-radius: 999px; padding: 0 4px;
}
.alert-count.on { display: block; }

.modal-alert {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border); flex-wrap: wrap;
}
.modal-alert-label { font-size: 0.85rem; color: var(--muted); }
.alert-op, .alert-threshold {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 10px; border-radius: 9px; font-size: 0.85rem;
}
.alert-threshold { width: 130px; }
.alert-msg { font-size: 0.82rem; }
.alert-msg.ok { color: var(--green); }
.alert-msg.err { color: var(--red); }

.alerts-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.alert-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2);
}
.alert-row.fired { border-color: var(--red); background: var(--red-soft); }
.alert-row.off { opacity: 0.55; }
.alert-title { font-weight: 700; font-size: 0.92rem; }
.alert-cond { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.alert-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ==== Tarix explorer ==== */
.hist-coverage {
  font-size: 0.8rem; color: var(--text-soft);
  background: var(--accent-soft); border: 1px solid transparent;
  border-radius: 10px; padding: 9px 13px; margin: 14px 0;
}
.hist-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.hist-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.hist-controls select, .hist-controls input {
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 8px 10px; border-radius: 9px; font-size: 0.85rem; min-width: 132px;
}
.hist-controls #hist-run { min-width: auto; align-self: flex-end; }
.hist-chart { margin-bottom: 12px; }
.hist-chart:empty { display: none; }
.hist-count { font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.hist-table-wrap { max-height: 44vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.hist-table th, .hist-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.hist-table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 700; z-index: 1; }
.hist-table tr:last-child td { border-bottom: none; }
.hist-table tbody tr:hover { background: var(--surface-2); }

/* ==== Responsiv ==== */
@media (max-width: 980px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid.two, .dash-grid.even { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-flex; }
  h1 { font-size: 1.1rem; }
  .actions { gap: 6px; }
  input[type="search"] { min-width: 140px; flex: 1; }
  .layout { display: block; padding: 8px 16px 0; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 84%; max-width: 320px; max-height: none; height: 100%;
    z-index: 60; border-radius: 0;
    transform: translateX(-105%); transition: transform 0.22s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(20, 22, 44, 0.45); z-index: 55; }
  .content { grid-template-columns: 1fr; }
  .header-inner { padding: 14px 16px 8px; }
  footer { padding: 8px 16px 24px; }
}
@media (max-width: 560px) {
  .stat-cards { grid-template-columns: 1fr; }
  .hist-controls { flex-direction: column; align-items: stretch; }
  .hist-controls select, .hist-controls input { min-width: 0; width: 100%; }
}
