:root {
  color-scheme: dark;
  --bg: #071011;
  --panel: #0c1718;
  --panel-2: #101e1f;
  --line: #203233;
  --text: #e8f2ef;
  --muted: #8fa5a1;
  --accent: #36d399;
  --accent-2: #7ef0c3;
  --danger: #ff6b72;
  --warning: #ffc857;
  --blue: #67b7ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(54, 211, 153, .11), transparent 28rem),
    radial-gradient(circle at 100% 40%, rgba(103, 183, 255, .07), transparent 30rem),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.shell { max-width: 1680px; margin: auto; padding: 34px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .16em; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 46px); line-height: 1.1; letter-spacing: -.035em; }
.subtitle { margin: 10px 0 0; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 14px; }
.updated { color: var(--muted); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 8px; margin: -8px 0 18px; }
.tab {
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px;
  background: transparent; color: var(--muted); font-weight: 700;
}
.tab:hover { color: var(--text); border-color: #3b5858; }
.tab.active { background: rgba(54,211,153,.12); border-color: rgba(54,211,153,.4); color: var(--accent-2); }
.button, select {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px;
  background: var(--panel-2); color: var(--text);
}
.button.primary { background: var(--accent); border-color: var(--accent); color: #03271a; font-weight: 750; }
.button:hover, select:hover { border-color: #3b5858; }
.button.primary:hover { background: var(--accent-2); }
.button:disabled { opacity: .55; cursor: wait; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { position: relative; overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, rgba(16, 30, 31, .96), rgba(10, 21, 22, .96)); }
.metric::after { content: ""; position: absolute; width: 80px; height: 80px; right: -35px; top: -35px; border: 1px solid rgba(54, 211, 153, .2); border-radius: 50%; }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 8px 0 3px; font-size: 30px; letter-spacing: -.03em; }
.workspace { display: grid; grid-template-columns: 225px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: rgba(10, 20, 21, .92); }
.sidebar { padding: 20px; border-right: 1px solid var(--line); background: rgba(12, 23, 24, .82); }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.panel-title button { border: 0; background: transparent; color: var(--accent); font-size: 12px; }
.status-title { margin-top: 24px; }
.filter-list { display: grid; gap: 5px; }
.filter {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 8px 9px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); text-align: left;
}
.filter:hover { background: rgba(255,255,255,.025); color: var(--text); }
.filter.active { border-color: rgba(54, 211, 153, .38); background: rgba(54, 211, 153, .09); color: var(--accent-2); }
.filter b { min-width: 26px; padding: 1px 6px; border-radius: 999px; background: rgba(255,255,255,.06); color: inherit; font-size: 11px; text-align: center; }
.collector-errors { margin-top: 22px; padding: 10px; border: 1px solid rgba(255,107,114,.3); border-radius: 8px; background: rgba(255,107,114,.07); color: #ff9ca1; font-size: 12px; overflow-wrap: anywhere; }
.content { min-width: 0; }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.search { flex: 1; display: flex; align-items: center; gap: 9px; min-width: 160px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); }
.search span { color: var(--muted); font-size: 18px; }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::placeholder { color: #607572; }
.visible-count { margin-left: auto; color: var(--muted); white-space: nowrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 14px; color: #738b87; font-size: 11px; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
td { padding: 13px 14px; border-top: 1px solid rgba(32, 50, 51, .72); vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.task-name { max-width: 330px; }
.task-name strong { display: block; overflow: hidden; color: #f0f7f5; text-overflow: ellipsis; white-space: nowrap; }
.task-name small { display: block; margin-top: 2px; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.source-badge, .status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; white-space: nowrap; font-size: 11px; font-weight: 700; }
.source-badge { background: rgba(103,183,255,.09); color: #94ccff; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-running { background: rgba(54,211,153,.11); color: var(--accent-2); }
.status-failed { background: rgba(255,107,114,.11); color: #ff959a; }
.status-disabled { background: rgba(143,165,161,.09); color: #8fa5a1; }
.status-success, .status-ok { background: rgba(103,183,255,.1); color: #8bcaff; }
.status-waiting, .status-scheduled, .status-cert-warning { background: rgba(255,200,87,.08); color: #ffd77d; }
.status-stopped { background: rgba(143,165,161,.09); color: #9eb3af; }
.status-upstream-down, .status-cert-expired, .status-no-upstream { background: rgba(255,107,114,.11); color: #ff959a; }
.schedule { max-width: 270px; overflow: hidden; color: #b7c8c5; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.date { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-button { border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; background: transparent; color: var(--muted); white-space: nowrap; }
.log-button:hover { border-color: var(--accent); color: var(--accent); }
.empty { padding: 60px 20px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }
.backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.58); backdrop-filter: blur(2px); }
.drawer { position: fixed; z-index: 21; top: 0; right: 0; width: min(820px, 92vw); height: 100vh; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #081112; box-shadow: -20px 0 70px rgba(0,0,0,.45); transform: translateX(105%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; gap: 18px; padding: 22px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-meta { margin: 6px 0 0; color: var(--muted); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); font-size: 24px; line-height: 1; }
.log-controls { display: flex; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--line); color: var(--muted); flex-wrap: wrap; }
.log-controls .button { margin-left: auto; }
.log-order-hint { padding: 3px 8px; border: 1px solid rgba(54, 211, 153, .28); border-radius: 999px; background: rgba(54, 211, 153, .08); color: var(--accent-2); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.log-output { flex: 1; margin: 0; padding: 18px 22px 50px; overflow: auto; color: #b8ccc7; background: #050b0c; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.log-error { color: #ff858b; }
.proxy-detail { padding: 16px 22px; border-bottom: 1px solid var(--line); max-height: 46vh; overflow: auto; background: #071112; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.detail-grid div span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.detail-grid div strong { display: block; color: var(--text); font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.detail-section { margin-top: 14px; }
.detail-section h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.loc-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(32,50,51,.55); color: #c5d7d3; font-size: 12px; }
.loc-row code { color: #8fd0ff; }
.pill { display: inline-flex; padding: 1px 6px; border-radius: 999px; background: rgba(54,211,153,.12); color: var(--accent-2); font-size: 10px; font-weight: 700; }
.config-excerpt { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #050b0c; color: #9fb7b2; white-space: pre-wrap; word-break: break-word; max-height: 180px; overflow: auto; font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.metric.level-ok { box-shadow: inset 0 0 0 1px rgba(54,211,153,.18); }
.metric.level-warning { box-shadow: inset 0 0 0 1px rgba(255,200,87,.35); }
.metric.level-critical { box-shadow: inset 0 0 0 1px rgba(255,107,114,.4); }
.metric.level-warning strong { color: #ffd77d; }
.metric.level-critical strong { color: #ff9ca1; }
.host-alerts {
  margin: 0 0 14px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(255,200,87,.35); background: rgba(255,200,87,.08);
  color: #ffe2a0; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
.host-alerts.critical {
  border-color: rgba(255,107,114,.4); background: rgba(255,107,114,.1); color: #ffb3b7;
}
.host-alerts strong { letter-spacing: .06em; text-transform: uppercase; font-size: 12px; }
.host-grid {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px;
}
.host-panel {
  border: 1px solid var(--line); border-radius: 14px; background: rgba(10,20,21,.92); overflow: hidden;
}
.host-panel .panel-title {
  margin: 0; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.host-panel .panel-title small { color: var(--muted); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.usage-bar {
  width: 120px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; margin-bottom: 4px;
}
.usage-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.usage-bar > span.level-warning { background: var(--warning); }
.usage-bar > span.level-critical { background: var(--danger); }
@media (max-width: 1100px) {
  .host-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .shell { padding: 20px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .filter-list { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  .status-title { margin-top: 16px; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
}
@media (max-width: 520px) {
  .shell { padding: 13px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 15px; }
  .metric strong { font-size: 24px; }
  .top-actions { width: 100%; justify-content: space-between; }
}
