

:root {

  --series-1: #2a78d6; --series-2: #1baf7a; --series-3: #eda100; --series-4: #008300;
  --series-5: #4a3aa7; --series-6: #e34948; --series-7: #e87ba4; --series-8: #eb6834;

  --status-good: #0ca30c; --status-warn: #fab219; --status-serious: #ec835a; --status-crit: #d03b3b;

  --chart-grid: #e1e0d9; --chart-axis: #c3c2b7; --chart-muted: #898781;
}
[data-theme="dark"] {
  --series-1: #3987e5; --series-2: #199e70; --series-3: #c98500; --series-4: #008300;
  --series-5: #9085e9; --series-6: #e66767; --series-7: #d55181; --series-8: #d95926;
  --status-good: #0ca30c; --status-warn: #fab219; --status-serious: #ec835a; --status-crit: #d03b3b;
  --chart-grid: #2c2c2a; --chart-axis: #383835; --chart-muted: #898781;
}

.page-wide { max-width: 1600px; padding: 20px 24px 64px; }
.header-inner.header-wide { max-width: none; padding: 0 24px; }

.header-nav { display: flex; align-items: center; gap: 4px; }
.header-nav a {
  font-size: 13px; color: var(--muted-foreground); text-decoration: none;
  padding: 6px 10px; border-radius: var(--radius-md); transition: color .15s, background .15s;
}
.header-nav a:hover { color: var(--foreground); background: var(--muted); }
.header-nav a.active { color: var(--foreground); font-weight: 500; }
.header-user { display: flex; align-items: center; gap: 10px; }
.header-user .who { font-size: 12.5px; color: var(--muted-foreground); }

.toolbar {
  display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap;
  padding: 14px 0 16px;
}
.toolbar-group { display: flex; align-items: center; gap: 6px; }
.toolbar-label { font-size: 12px; color: var(--muted-foreground); white-space: nowrap; }
.toolbar-sep { width: 1px; height: 22px; background: var(--border); }
.toolbar-spacer { flex: 1 1 auto; }

.segmented { display: inline-flex; gap: 4px; }
.segmented .btn { height: 1.9rem; padding: 0 11px; font-size: 12.5px; }
.btn[aria-pressed="true"] {
  background: var(--primary); color: var(--primary-foreground); border-color: var(--primary);
}
[data-theme="dark"] .btn[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }

.btn[aria-pressed="true"]:hover:not(:disabled),
.segmented .btn[aria-pressed="true"]:hover:not(:disabled) {
  background: color-mix(in oklch, var(--primary) 86%, transparent);
  color: var(--primary-foreground); border-color: var(--primary);
}

.search-wrap { position: relative; display: inline-flex; align-items: center; }
.search-wrap .search-icon {
  position: absolute; left: 9px; width: 15px; height: 15px; color: var(--muted-foreground);
  pointer-events: none;
}
.input.search-input { width: 200px; padding-left: 30px; transition: width .2s, border-color .15s; }
.input.search-input:focus { width: 260px; }

.refresh-status {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  color: var(--muted-foreground); min-height: 20px;
}
.refresh-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--status-good); flex-shrink: 0; }
.refresh-status.is-updating .refresh-dot { background: var(--status-warn); animation: pulse 1s ease-in-out infinite; }
.refresh-status.is-error .refresh-dot { background: var(--status-crit); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.active-filters { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; padding-bottom: 12px; }
.active-filters:empty { display: none; }
.filter-cat { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-cat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); font-weight: 600; margin-right: 2px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 5px 3px 11px;
  font-size: 12.5px; border-radius: var(--radius-md); border: 1px solid var(--border);
  background: var(--muted); color: var(--foreground);
}
.filter-chip.is-warn { border-color: var(--status-warn); color: var(--status-serious); }
.filter-chip.is-crit { border-color: var(--status-crit); color: var(--status-crit); }
.filter-chip .chip-x {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border: none; background: color-mix(in oklch, var(--foreground) 12%, transparent); color: var(--foreground);
  cursor: pointer; opacity: 1; border-radius: 5px; flex-shrink: 0; padding: 0;
}
.filter-chip .chip-x:hover { background: color-mix(in oklch, var(--foreground) 24%, transparent); }
.filter-chip .chip-x svg { width: 14px; height: 14px; display: block; }

.ms { position: relative; display: inline-block; }
.ms-btn {
  display: inline-flex; align-items: center; gap: 8px; min-width: 150px; height: 1.9rem;
  padding: 0 10px; font-size: 13px; color: var(--foreground); background: var(--background);
  border: 1px solid var(--input); border-radius: var(--radius-lg); cursor: pointer;
  transition: border-color .15s;
}
.ms-btn:hover { border-color: var(--ring); }
[data-theme="dark"] .ms-btn { background: color-mix(in oklch, var(--input) 30%, transparent); }
.ms-btn .ms-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-btn .ms-count {
  display: none; min-width: 18px; padding: 1px 6px; font-size: 11px; font-weight: 600; text-align: center;
  border-radius: 10px; background: color-mix(in oklch, var(--primary) 15%, transparent); color: var(--foreground);
}
.ms-btn.has-count .ms-count { display: inline-block; }
.ms-btn .ms-caret { width: 14px; height: 14px; color: var(--muted-foreground); flex-shrink: 0; }
.ms-btn:disabled { cursor: default; }

.ms-block { display: block; width: 100%; }
.ms-block .ms-btn { width: 100%; height: auto; min-height: 2.25rem; }
.ms-block .ms-dropdown { width: 100%; }

.ms-btn .ms-spin { display: none; }
.ms.is-loading .ms-btn .ms-spin {
  display: inline-block; width: 13px; height: 13px; flex-shrink: 0;
  border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
.ms.is-loading .ms-btn .ms-caret { display: none; }
.ms.is-loading .ms-btn .ms-label { color: var(--muted-foreground); }

.ms-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; width: 280px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px color-mix(in oklch, var(--foreground) 18%, transparent); overflow: hidden;
}
.ms-search { width: 100%; height: 36px; padding: 0 12px; border: none; border-bottom: 1px solid var(--border);
  background: transparent; color: var(--foreground); font-size: 13px; outline: none; font-family: var(--font-sans); }
.ms-list { max-height: 280px; overflow-y: auto; scrollbar-width: thin; padding: 4px; }
.ms-item {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--radius-md);
  cursor: pointer; font-size: 13px; color: var(--foreground);
}
.ms-item:hover { background: var(--muted); }
.ms-item .ms-check {
  display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border: 1px solid var(--input); border-radius: 4px; flex-shrink: 0; color: transparent;
}
.ms-item[aria-checked="true"] .ms-check { background: var(--primary); border-color: var(--primary); color: var(--primary-foreground); }
.ms-item .ms-check svg { width: 11px; height: 11px; }
.ms-item .ms-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-item .ms-meta { font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.ms-footer { display: flex; justify-content: space-between; padding: 6px 8px; border-top: 1px solid var(--border); }
.ms-footer button { font-size: 12px; background: none; border: none; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-md); color: var(--muted-foreground); }
.ms-footer button:hover { background: var(--muted); color: var(--foreground); }

.srv-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 300px), 1fr)); }

.mon-card {
  display: flex; flex-direction: column; background: var(--card); color: var(--card-foreground);
  border-radius: var(--radius-xl); box-shadow: var(--card-ring); overflow: hidden;
  transition: box-shadow .2s, opacity .2s;
}
.mon-card:hover { box-shadow: 0 0 0 1px color-mix(in oklch, var(--foreground) 18%, transparent), 0 4px 16px color-mix(in oklch, var(--foreground) 6%, transparent); }
.mon-card.state-warn { box-shadow: 0 0 0 1px var(--status-warn); }
.mon-card.state-crit { box-shadow: 0 0 0 1px var(--status-crit); }
.mon-card.state-down { opacity: .72; }

.mon-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px 9px; border-bottom: 1px solid var(--border); }
.mon-os { display: flex; flex-shrink: 0; }
.mon-os svg { display: block; }
.mon-name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.mon-name { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mon-ip { font-family: var(--font-mono); font-size: 11px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.mon-status { flex-shrink: 0; }

.status-badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; font-size: 11px; font-weight: 500;
  border-radius: var(--radius-md); white-space: nowrap; border: 1px solid var(--border);
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-badge.up { color: var(--status-good); border-color: color-mix(in oklch, var(--status-good) 40%, transparent); } .status-badge.up .dot { background: var(--status-good); }
.status-badge.down { color: var(--status-crit); border-color: color-mix(in oklch, var(--status-crit) 40%, transparent); }
.status-badge.down .dot { background: var(--status-crit); }
.status-badge.unknown { color: var(--muted-foreground); } .status-badge.unknown .dot { background: var(--chart-axis); }
.status-badge.disabled { color: var(--muted-foreground); } .status-badge.disabled .dot { background: var(--muted-foreground); }
.status-badge .uptime { font-variant-numeric: tabular-nums; }

.mon-body { display: flex; flex-direction: column; gap: 10px; padding: 11px 13px 12px; flex: 1; }

.chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; padding-bottom: 3px; scrollbar-width: thin; }
.chips::-webkit-scrollbar { height: 5px; }
.chips::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.mon-body .chips:empty { display: none; }
.mon-body .chips:empty + .chart-wrap { margin-top: auto; }
.chip {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 54px;
  padding: 6px 9px; border-radius: var(--radius-md); background: var(--muted); border: 1px solid transparent;
}

.card-ping { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-ping:last-child { margin-bottom: 0; }
.card-ping-ip { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted-foreground); white-space: nowrap; }
.card-ping-now { font-size: 10px; font-weight: 700; flex-shrink: 0; }
.card-ping-now.up { color: var(--status-good); } .card-ping-now.down { color: var(--status-crit); }
.uptime-bar.mini { flex: 1; gap: 1px; }
.uptime-bar.mini .up-cell { height: 14px; border-radius: 1px; }
.chip.sev-warn { border-color: color-mix(in oklch, var(--status-warn) 45%, transparent); background: color-mix(in oklch, var(--status-warn) 8%, var(--muted)); }
.chip.sev-crit { border-color: color-mix(in oklch, var(--status-crit) 45%, transparent); background: color-mix(in oklch, var(--status-crit) 8%, var(--muted)); }
.chip-val { font-size: 18px; font-weight: 700; line-height: 1.05; font-variant-numeric: tabular-nums; }
.chip.sev-warn .chip-val { color: var(--status-serious); }
.chip.sev-crit .chip-val { color: var(--status-crit); }
.chip-lbl { font-size: 9.5px; letter-spacing: .3px; color: var(--muted-foreground); text-transform: uppercase; white-space: nowrap; }
.chip.metric-null .chip-val { color: var(--muted-foreground); }

.chart-wrap { position: relative; cursor: pointer; }
svg.ch { display: block; width: 100%; overflow: visible; }
svg.ch .gl { stroke: var(--chart-grid); stroke-width: 1; }
svg.ch .gy, svg.ch .gx { font-size: 9px; fill: var(--chart-muted); font-family: var(--font-sans); }
svg.ch .guide { stroke: var(--chart-axis); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
svg.ch .crosshair { stroke: var(--foreground); stroke-width: 1; opacity: .25; stroke-dasharray: 3 3; pointer-events: none; }
svg.ch .chart-empty { fill: var(--muted-foreground); font-size: 11px; font-family: var(--font-sans); }
svg.ch .dot-mark { fill: var(--series-1); }

.stroke-s1 { stroke: var(--series-1); } .fill-s1 { fill: var(--series-1); }
.stroke-s2 { stroke: var(--series-2); } .fill-s2 { fill: var(--series-2); }
.stroke-s3 { stroke: var(--series-3); } .fill-s3 { fill: var(--series-3); }
.stroke-s4 { stroke: var(--series-4); } .fill-s4 { fill: var(--series-4); }
.stroke-s5 { stroke: var(--series-5); } .fill-s5 { fill: var(--series-5); }
.stroke-s6 { stroke: var(--series-6); } .fill-s6 { fill: var(--series-6); }
.stroke-s7 { stroke: var(--series-7); } .fill-s7 { fill: var(--series-7); }
.stroke-s8 { stroke: var(--series-8); } .fill-s8 { fill: var(--series-8); }

.legend { display: flex; gap: 10px; flex-wrap: wrap; }
.legend .li { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted-foreground); }
.legend .ld { width: 12px; height: 3px; border-radius: 2px; }

.mon-card.is-skeleton .chips .chip, .mon-card.is-skeleton .chart-wrap, .mon-card.is-skeleton .sk, .chart-wrap.is-loading {
  background: linear-gradient(90deg, var(--muted) 25%, color-mix(in oklch, var(--muted) 55%, transparent) 50%, var(--muted) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--radius-md);
}
.mon-card.is-skeleton .chart-wrap, .chart-wrap.is-loading { height: 104px; }
.mon-card.is-skeleton .chip { min-width: 54px; height: 44px; border: none; }
.sk { display: block; }
.sk-os { width: 18px; height: 18px; flex-shrink: 0; }
.sk-name { width: 60%; max-width: 150px; height: 12px; margin-bottom: 5px; }
.sk-ip { width: 40%; max-width: 90px; height: 9px; }
.sk-badge { width: 58px; height: 18px; margin-left: auto; border-radius: 9px; flex-shrink: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

.chart-tip {
  position: fixed; z-index: 9999; display: none; pointer-events: none; min-width: 130px;
  padding: 8px 11px; font-size: 11.5px; line-height: 1.7;
  background: var(--card); color: var(--card-foreground);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: 0 6px 24px color-mix(in oklch, var(--foreground) 22%, transparent);
}
.chart-tip .tip-time { font-size: 10px; color: var(--muted-foreground); margin-bottom: 5px; font-weight: 600; }
.chart-tip .tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip .tip-sw { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.chart-tip .tip-name { flex: 1; color: var(--muted-foreground); }
.chart-tip .tip-val { font-weight: 700; font-variant-numeric: tabular-nums; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 20px; }
.pager-info { font-size: 12.5px; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.pager-nav { display: inline-flex; align-items: center; gap: 4px; }
.pager-nav .btn { height: 1.9rem; min-width: 1.9rem; padding: 0 8px; font-variant-numeric: tabular-nums; }
.pager-nav .btn.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.pager-ellipsis { color: var(--muted-foreground); padding: 0 4px; }

.page-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 72px 20px; }
.page-state .state-icon-wrap { width: 44px; height: 44px; }
.page-state .spinner {
  width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}

.admin-cols { display: grid; grid-template-columns: 340px 1fr; gap: 20px; align-items: stretch; }
@media (max-width: 860px) { .admin-cols { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: 11.5px; font-weight: 500; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .04em; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: none; }
.table .row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.role-pill { display: inline-flex; padding: 1px 8px; font-size: 11px; font-weight: 500; border-radius: 10px; border: 1px solid var(--border); }
.role-pill.admin { color: var(--series-1); border-color: color-mix(in oklch, var(--series-1) 40%, transparent); }
.link-token { font-family: var(--font-mono); font-size: 12px; color: var(--muted-foreground); }
.badges { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.detail-topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 0 18px; }
.detail-topbar .btn { height: 2rem; }
.detail-topbar .segmented .btn { height: 1.9rem; padding: 0 10px; font-size: 12.5px; }
.section { margin-bottom: 28px; }
.section-title { font-size: 12px; font-weight: 600; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: .05em; padding-bottom: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }

.vm-card { display: flex; align-items: center; gap: 16px; background: var(--card); color: var(--card-foreground);
  border-radius: var(--radius-xl); box-shadow: var(--card-ring); padding: 16px 18px; margin-bottom: 24px; }
.vm-card-os { flex-shrink: 0; display: inline-flex; }
.vm-card-info { min-width: 0; }
.vm-card-name { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.vm-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; font-size: 13px;
  color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.vm-card-chips { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) { .vm-card { flex-wrap: wrap; } .vm-card-chips { margin-left: 0; width: 100%; } }

.metric-bar { height: 7px; background: var(--muted); border-radius: 4px; overflow: hidden; }
.metric-bar .fill { height: 100%; border-radius: 4px; }
.mini-metric { margin-bottom: 14px; }
.mini-metric-top { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; margin-bottom: 6px; }
.mini-metric-top .k { color: var(--muted-foreground); }
.mini-metric-top .v { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mini-metric-sub { font-size: 11.5px; color: var(--muted-foreground); margin-top: 5px; font-variant-numeric: tabular-nums; }

.disk-unit { display: grid; grid-template-columns: 230px 1fr; gap: 18px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; background: color-mix(in oklch, var(--muted) 30%, transparent); }
.disk-info { display: flex; flex-direction: column; gap: 5px; }
.disk-info-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 6px; }
.disk-info-note { font-size: 12px; color: var(--muted-foreground); }
.disk-unit-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; align-content: start; }
.disk-stat { display: flex; justify-content: space-between; font-size: 12.5px; }
.disk-stat .k { color: var(--muted-foreground); }
.disk-stat .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.disk-bar { height: 7px; background: color-mix(in oklch, var(--foreground) 10%, transparent); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.disk-bar .fill { height: 100%; border-radius: 4px; }
@media (max-width: 720px) { .res-card, .res-card-ping { flex-basis: 88vw; width: 88vw; } }

.ping-target { margin-bottom: 18px; }
.ping-target-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 7px; }
.ping-ip { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ping-now { font-size: 12.5px; font-weight: 600; color: var(--muted-foreground); }
.ping-now.up { color: var(--status-good); }
.ping-now.down { color: var(--status-crit); }
.uptime-bar { display: flex; gap: 2px; align-items: stretch; }
.up-cell { flex: 1 1 0; height: 30px; min-width: 2px; border-radius: 2px; }
.up-cell.up { background: var(--status-good); }
.up-cell.down { background: var(--status-crit); }
.up-cell.nodata { background: color-mix(in oklch, var(--foreground) 12%, transparent); }

.disk-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px 14px; }
.disk-box .box-title { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); text-align: center; margin-bottom: 6px; }
.ping-box .ping-target:last-child { margin-bottom: 0; }
.up-cell { cursor: default; }
.up-cell:hover { outline: 2px solid color-mix(in oklch, var(--foreground) 45%, transparent); outline-offset: -1px; }

@media (max-width: 720px) {
  .metric-grid { grid-template-columns: 1fr; }
  .disk-unit { grid-template-columns: 1fr; }
  .disk-unit-charts { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .page-wide { padding: 16px 14px 48px; }
  .header-nav .nav-text { display: none; }
  .toolbar { gap: 8px; }
  .input.search-input, .input.search-input:focus { width: 100%; }
  .search-wrap { flex: 1 1 160px; }
  .table th.hide-sm, .table td.hide-sm { display: none; }
}
