:root {
  --bg: #1a1d21;
  --surface: #23272e;
  --surface-2: #1c1f24;
  --text: #f4f7fa;
  --muted: #a7b2c0;
  --accent: #5390d2;
  --ok: #42c77a;
  --down: #f15b5b;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(83, 144, 210, 0.15), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(255, 255, 255, 0.04), transparent 35%),
    var(--bg);
  color: var(--text);
}

.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: var(--surface-2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 8px 16px;
  z-index: 100;
}

.notice-host {
  position: fixed;
  right: 12px;
  top: 76px;
  z-index: 200;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 24px));
}

.notice {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 10px 12px;
  font-size: 13px;
  background: rgba(20, 24, 30, 0.95);
  color: #f3f7ff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.25);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.notice.ok {
  border-color: rgba(66, 199, 122, 0.6);
}

.notice.warn {
  border-color: rgba(230, 165, 34, 0.7);
}

.notice.error {
  border-color: rgba(241, 91, 91, 0.75);
}

.notice.hide {
  opacity: 0;
  transform: translateY(-4px);
}

.desktop-header-tabs {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.desktop-header-tabs .tab-btn {
  padding: 7px 10px;
  font-size: 12px;
}

.clock-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clock {
  font-size: 26px;
  font-weight: 700;
}

.ip {
  font-size: 18px;
  font-weight: 600;
}

.desktop-layout {
  margin-top: 80px;
  padding: 14px;
  display: block;
}

.desktop-tab-content {
  display: none;
}

.desktop-tab-content.active {
  display: block;
}

.desktop-home-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 12px;
}

.main-left {
  min-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
}

.main-right {
  display: grid;
  gap: 12px;
  align-content: start;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 12px;
  backdrop-filter: blur(2px);
}

.block {
  margin-bottom: 12px;
}

.section-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(var(--group-count, 1), minmax(0, 1fr));
  gap: 10px;
}

.bookmark-group {
  margin-top: 0;
}

.bookmark-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}

.bookmark-group-title {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.home-fill-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-height: 420px;
}

.home-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  min-height: 180px;
}

.home-panel-wide {
  grid-column: 1 / -1;
  min-height: 210px;
}

.metric-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.metric-line strong {
  color: var(--text);
}

.tiny-meter {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 5px;
}

.tiny-fill {
  height: 100%;
  border-radius: 999px;
}

.bookmark {
  border-radius: var(--radius);
  background: #2a2f37;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 8px 8px 20px;
  min-height: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  position: relative;
  user-select: none;
  cursor: pointer;
}

.bookmark:active {
  transform: translateY(1px);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  position: absolute;
  left: 6px;
  top: 6px;
}

.bookmark-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.2;
  word-break: break-word;
}

.status-online {
  background: var(--ok);
}

.status-offline {
  background: var(--down);
}

.list {
  display: grid;
  gap: 8px;
}

.list-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
}

.node-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
}

.node-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.node-name {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.health-badge {
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 9px;
  border: 1px solid transparent;
}

.health-good {
  color: #c6f6da;
  background: rgba(66, 199, 122, 0.16);
  border-color: rgba(66, 199, 122, 0.55);
}

.health-warn {
  color: #ffe7ad;
  background: rgba(230, 165, 34, 0.16);
  border-color: rgba(230, 165, 34, 0.55);
}

.health-critical {
  color: #ffd4d4;
  background: rgba(241, 91, 91, 0.16);
  border-color: rgba(241, 91, 91, 0.6);
}

.node-metrics {
  display: grid;
  gap: 8px;
}

.metric-row {
  display: grid;
  gap: 4px;
}

.metric-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}

.metric-label span {
  color: var(--text);
  font-weight: 700;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s ease;
}

.meter-good {
  background: linear-gradient(90deg, #2fbf71, #56d39a);
}

.meter-warn {
  background: linear-gradient(90deg, #d8a12f, #f5c25f);
}

.meter-critical {
  background: linear-gradient(90deg, #cc4d4d, #ff7a7a);
}

.net-row {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: #d8e3f1;
}

.node-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.node-action-btn {
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 700;
}

.node-action-btn.warn {
  border-color: rgba(230, 165, 34, 0.8);
  background: rgba(230, 165, 34, 0.16);
}

.node-action-btn.danger {
  border-color: rgba(241, 91, 91, 0.8);
  background: rgba(241, 91, 91, 0.16);
}

.node-action-btn:hover {
  filter: brightness(1.08);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid rgba(83, 144, 210, 0.7);
  color: var(--text);
  background: rgba(83, 144, 210, 0.15);
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
}

.wol-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.wol-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.wol-card-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.wol-power-btn {
  justify-self: start;
  border: 1px solid rgba(46, 215, 120, 0.85);
  background: radial-gradient(circle at 20% 20%, rgba(86, 255, 165, 0.45), rgba(17, 93, 54, 0.9));
  color: #f3fff8;
  font-weight: 800;
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06) inset, 0 4px 18px rgba(25, 170, 92, 0.4);
}

.wol-power-btn:hover {
  filter: brightness(1.08);
}

.wol-power-btn:active {
  transform: translateY(1px);
}

.mobile-layout {
  display: none;
}

.mobile-tabs {
  position: sticky;
  top: 68px;
  z-index: 90;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  background: rgba(26, 29, 33, 0.95);
  padding: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 7px 2px;
  font-size: 11px;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--text);
  background: rgba(83, 144, 210, 0.2);
  border-color: rgba(83, 144, 210, 0.8);
}

.tab-content {
  display: none;
  padding: 10px;
  margin-top: 6px;
}

.tab-content.active {
  display: block;
}

.form-wrap {
  display: grid;
  gap: 8px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="password"] {
  background: #101317;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text);
  padding: 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-btn {
  border: none;
  border-radius: 6px;
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
}

.vm-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.vm-actions button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}

.vm-node-group {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.vm-node-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.vm-node-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.vm-node-meta {
  font-size: 12px;
  color: var(--muted);
}

.vm-card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.vm-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px;
}

.vm-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}

.vm-title-wrap {
  min-width: 0;
}

.vm-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vm-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .desktop-layout {
    display: none;
  }

  .desktop-header-tabs {
    display: none;
  }

  .mobile-layout {
    display: block;
    margin-top: 68px;
    padding-bottom: 20px;
  }

  .clock {
    font-size: 20px;
  }

  .ip {
    font-size: 14px;
  }

  .top-header {
    height: 72px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .mobile-tabs {
    top: 72px;
  }

  .notice-host {
    top: 82px;
  }

  .bookmark-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .bookmark-cards-grid {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 6px;
  }

  .bookmark {
    font-size: 12px;
  }

  .home-fill-grid {
    display: none;
  }
}
