:root {
  --bg-canvas: #090B10;
  --bg-rail: #0E1118;
  --bg-hover: #151A25;
  --bg-active: #182030;
  --bg-elevated: #111622;
  --hairline: rgba(255, 255, 255, 0.07);
  --hairline-soft: rgba(255, 255, 255, 0.06);
  --hairline-strong: rgba(255, 255, 255, 0.14);

  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #7B89A0;
  --text-dim: #64748B;

  --accent-blue: #38BDF8;
  --accent-indigo: #6366F1;
  --accent-green: #22C55E;
  --accent-emerald: #10B981;
  --accent-amber: #F59E0B;
  --accent-red: #EF4444;
  --accent-crimson: #F43F5E;

  --font-sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html, body {
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

.hidden {
  display: none !important;
}

.tabular {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Custom ultra-thin scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* =========================================================
   TOPBAR (52px sticky, backdrop blur, hairline bottom)
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 11, 16, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--hairline);
}

.topbar-inner {
  max-width: 1480px;
  margin: 0 auto;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.brand-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.brand-name {
  font-weight: 700;
  color: var(--text-primary);
}

.brand-sep {
  color: var(--text-dim);
}

.brand-sub {
  font-weight: 500;
  color: var(--text-secondary);
}

.topbar-divider {
  width: 1px;
  height: 16px;
  background: var(--hairline);
  flex-shrink: 0;
}

.sse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, 0.02);
}

.sse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.sse-badge.status-online {
  color: #4ADE80;
  border-color: rgba(34, 197, 94, 0.25);
  background: rgba(34, 197, 94, 0.08);
}

.sse-badge.status-online .sse-dot {
  animation: pulseDot 2s infinite ease-in-out;
}

.sse-badge.status-connecting {
  color: #FBBF24;
  border-color: rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.08);
}

.sse-badge.status-offline {
  color: #FDA4AF;
  border-color: rgba(244, 63, 94, 0.3);
  background: rgba(244, 63, 94, 0.1);
}

.viewer-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.viewer-chip strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Global Search (Center) */
.topbar-center {
  flex: 1 1 180px;
  max-width: 420px;
  min-width: 0;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  border-radius: 7px;
  background: var(--bg-rail);
  border: 1px solid var(--hairline);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.search-box:hover {
  border-color: var(--hairline-strong);
}

.search-box:focus-within {
  background: var(--bg-canvas);
  border-color: rgba(56, 189, 248, 0.55);
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0 36px 0 30px;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-kbd {
  position: absolute;
  right: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  pointer-events: none;
}

.search-box:focus-within .search-kbd {
  opacity: 0.45;
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-primary);
}

/* Topbar Right Actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: transparent;
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.health-pill.is-ok {
  color: #6EE7B7;
  background: rgba(16, 185, 129, 0.08);
  border-color: rgba(16, 185, 129, 0.24);
}

.health-pill.is-ok:hover {
  background: rgba(16, 185, 129, 0.14);
}

.health-pill.is-alert {
  color: #FECDD3;
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.45);
}

.health-pill.is-alert:hover {
  background: rgba(244, 63, 94, 0.24);
}

.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.health-pill.is-alert .health-dot {
  display: none;
}

.top-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid var(--hairline);
  background: var(--bg-rail);
  color: var(--text-primary);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.top-btn:hover {
  background: var(--bg-hover);
  border-color: var(--hairline-strong);
}

.top-btn-discord {
  color: #C7D2FE;
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.1);
}

.top-btn-discord:hover {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.45);
}

.top-btn-cta {
  background: var(--text-primary);
  color: #090B10;
  border-color: var(--text-primary);
  font-weight: 600;
}

.top-btn-cta:hover {
  background: #FFFFFF;
  border-color: #FFFFFF;
}

.bell-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

.alert-dot {
  position: absolute;
  top: -2px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  border: 1.5px solid var(--bg-rail);
}

.mobile-controls {
  display: none;
}

/* =========================================================
   DESKTOP 3-COLUMN WORKSPACE (max-width: 1480px)
   ========================================================= */
.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 312px;
  min-height: calc(100vh - 52px);
  align-items: stretch;
}

@media (min-width: 1482px) {
  .app-shell {
    border-left: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
  }
}

/* Left Rail (248px) */
.sidebar-left {
  background: var(--bg-rail);
  border-right: 1px solid var(--hairline);
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.rail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 4px;
  text-transform: uppercase;
}

.rail-sep {
  height: 1px;
  background: var(--hairline);
  flex-shrink: 0;
}

/* 4-column Server Matrix */
.server-matrix {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.srv-cell {
  height: 28px;
  padding: 0 5px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-secondary);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.srv-cell.is-all {
  grid-column: span 2;
  justify-content: space-between;
  padding: 0 8px;
}

.srv-cell.has-events {
  justify-content: space-between;
  padding: 0 5px;
}

.srv-cell:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--hairline);
}

.srv-cell.active {
  background: var(--bg-active);
  border-color: rgba(56, 189, 248, 0.5);
  color: #FFFFFF;
  font-weight: 600;
}

.srv-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.srv-cnt {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.srv-cell.active .srv-cnt {
  color: var(--accent-blue);
}

/* Category Navigation (replaces 5 KPI cards) */
.cat-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-item {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.cat-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.cat-item.active {
  background: var(--bg-hover);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--accent-blue);
}

.cat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-dot-all { background: var(--accent-blue); }
.cat-dot-boss { background: #F43F5E; }
.cat-dot-skh { background: #22C55E; }
.cat-dot-rare { background: #FBBF24; }
.cat-dot-maint { background: #FB7185; }

.cat-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-count {
  font-size: 11.5px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.cat-item.active .cat-count {
  color: var(--text-primary);
}

/* 25-Channel Dropdown */
.channel-select {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  color-scheme: dark;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.14s ease;
}

.channel-select:hover {
  border-color: var(--hairline-strong);
}

.channel-select:focus {
  border-color: rgba(56, 189, 248, 0.55);
}

.channel-select optgroup,
.channel-select option {
  background: var(--bg-rail);
  color: var(--text-primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.footer-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.footer-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* =========================================================
   CENTER COLUMN: LIVE FEED (HERO)
   ========================================================= */
.feed-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
}

/* Urgent Maintenance Banner */
.urgent-maint-banner {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(244, 63, 94, 0.35);
  background: linear-gradient(90deg, rgba(244, 63, 94, 0.14), rgba(244, 63, 94, 0.04));
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.urgent-maint-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #FECDD3;
  letter-spacing: 0.02em;
}

.urgent-maint-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.urgent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.38);
  color: #FFE4E6;
}

.urgent-chip.is-pending {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.38);
  color: #FDE68A;
}

.urgent-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: pulseDot 1.1s infinite;
}

/* Feed Toolbar (1 row, 44px, zero orphaned wrap) */
.feed-toolbar {
  position: sticky;
  top: 52px;
  z-index: 20;
  height: 44px;
  min-height: 44px;
  padding: 0 16px;
  background: rgba(9, 11, 16, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.feed-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.filter-breadcrumb {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clear-chip {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.1);
  color: #7DD3FC;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.clear-chip:hover {
  background: rgba(56, 189, 248, 0.18);
}

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

.feed-count {
  font-size: 11.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pause-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: var(--bg-rail);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.pause-btn:hover {
  background: var(--bg-hover);
  border-color: var(--hairline-strong);
  color: var(--text-primary);
}

.pause-btn.is-paused {
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.42);
  color: #FCD34D;
}

/* Activity Stream Rows */
.feed-stream {
  display: flex;
  flex-direction: column;
}

.feed-item {
  --item-accent: #8B5CF6;
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline-soft);
  border-left: 2.5px solid var(--item-accent);
  transition: background-color 0.12s ease;
}

.feed-item:hover {
  background: var(--bg-hover);
}

.feed-item.is-new {
  animation: rowEnter 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.item-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-rail);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  margin-top: 1px;
}

.item-icon-box img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.item-glyph {
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.item-meta-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.tag-server {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #E2E8F0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  white-space: nowrap;
  flex-shrink: 0;
}

.meta-sep {
  color: var(--text-dim);
  font-size: 11px;
  flex-shrink: 0;
}

.tag-channel {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 500;
  color: #CBD5E1;
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
}

.tag-channel span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.channel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tag-kind {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.kind-spawn { background: rgba(244, 63, 94, 0.14); color: #FDA4AF; border: 1px solid rgba(244, 63, 94, 0.28); }
.kind-kill { background: rgba(16, 185, 129, 0.13); color: #6EE7B7; border: 1px solid rgba(16, 185, 129, 0.26); }
.kind-countdown { background: rgba(245, 158, 11, 0.13); color: #FCD34D; border: 1px solid rgba(245, 158, 11, 0.26); }
.kind-skh { background: rgba(34, 197, 94, 0.13); color: #86EFAC; border: 1px solid rgba(34, 197, 94, 0.26); }
.kind-rare { background: rgba(251, 191, 36, 0.13); color: #FDE68A; border: 1px solid rgba(251, 191, 36, 0.26); }
.kind-maint { background: rgba(255, 42, 85, 0.16); color: #FECDD3; border: 1px solid rgba(255, 42, 85, 0.34); }

.item-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.item-content {
  font-size: 13.5px;
  line-height: 1.5;
  color: #E2E8F0;
  word-break: break-word;
}

.hl-player { color: #FBBF24; font-weight: 600; }
.hl-boss { color: #F472B6; font-weight: 600; }
.hl-location { color: #38BDF8; font-weight: 500; }
.hl-item { color: #4ADE80; font-weight: 600; }
.hl-maint { color: #FDA4AF; font-weight: 600; }

/* Clean Typographic Empty State (No giant dashed box) */
.stream-empty {
  padding: 64px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
  opacity: 0.7;
  margin-bottom: 4px;
}

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 400px;
}

/* =========================================================
   RIGHT CONTEXT RAIL (312px)
   ========================================================= */
.rail-right {
  background: var(--bg-rail);
  border-left: 1px solid var(--hairline);
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.rail-right .rail-section {
  padding: 16px;
}

.rail-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.rail-heading-row h2 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text-primary);
}

.rail-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radar-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
  animation: pulseDot 1.6s infinite ease-in-out;
  flex-shrink: 0;
}

.boss-count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.14);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.rail-muted-count {
  font-size: 11px;
  color: var(--text-muted);
}

.boss-list {
  display: flex;
  flex-direction: column;
  margin: 0 -16px;
}

.boss-row {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--hairline-soft);
  border-left: 2.5px solid transparent;
  background: transparent;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.boss-row:last-child {
  border-bottom: none;
}

.boss-row:hover {
  background: var(--bg-hover);
}

.boss-row.is-filtered {
  background: var(--bg-active);
  border-left-color: var(--accent-blue);
}

.boss-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-canvas);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.boss-icon-box img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.boss-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.boss-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boss-loc {
  font-size: 11.5px;
  color: var(--accent-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.boss-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
}

.boss-timer {
  color: var(--text-secondary);
  font-weight: 600;
}

.rail-empty {
  padding: 16px 16px 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Maintenance Today in Right Rail */
.maint-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.maint-ok-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 0;
}

.ok-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  flex-shrink: 0;
}

.maint-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--hairline);
}

.maint-row.is-active {
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.08);
}

.maint-row.is-pending {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.07);
}

.maint-row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.maint-state-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.maint-row.is-active .maint-state-dot {
  background: var(--accent-crimson);
  animation: pulseDot 1.1s infinite;
}

.maint-row.is-pending .maint-state-dot {
  background: var(--accent-amber);
}

.maint-row.is-done .maint-state-dot {
  background: var(--accent-emerald);
}

.maint-row-sub {
  padding-left: 12px;
  font-size: 11px;
  color: var(--text-secondary);
}

.maint-row.is-active .maint-row-sub {
  color: #FECDD3;
}

/* =========================================================
   ALERT SETTINGS MODAL (Preserved 100%)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 6, 10, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: var(--bg-rail);
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
}

.modal-head h3 {
  font-size: 14.5px;
  font-weight: 700;
}

.btn-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
}

.modal-note {
  font-size: 12px;
  color: var(--text-muted);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}

.modal-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.server-check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.chk-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--hairline);
  font-size: 12px;
  cursor: pointer;
}

.chk-pill:hover {
  background: var(--bg-hover);
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--hairline);
}

.btn-modal-ghost,
.btn-modal-primary {
  height: 32px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-modal-ghost {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--text-primary);
}

.btn-modal-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--hairline-strong);
}

.btn-modal-primary {
  background: var(--text-primary);
  border: 1px solid var(--text-primary);
  color: #090B10;
}

.btn-modal-primary:hover {
  background: #FFFFFF;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

@keyframes rowEnter {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   COMPACT DESKTOP (961px .. 1180px)
   ========================================================= */
@media (max-width: 1180px) and (min-width: 961px) {
  .topbar-inner {
    padding: 0 12px;
    gap: 10px;
  }

  .topbar-left {
    gap: 8px;
  }

  .topbar-right {
    gap: 6px;
  }

  .top-btn,
  .health-pill {
    padding: 0 8px;
  }
}

/* =========================================================
   RESPONSIVE MOBILE (<= 960px)
   ========================================================= */
@media (max-width: 960px) {
  .topbar-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar-left {
    order: 1;
    gap: 8px;
  }

  .topbar-right {
    order: 2;
    gap: 6px;
  }

  .topbar-center {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .search-kbd {
    display: none;
  }

  .mobile-controls {
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--hairline);
    background: var(--bg-rail);
  }

  /* 1-row horizontal scrollable server pills */
  .mobile-server-strip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    border-bottom: 1px solid var(--hairline);
  }

  .mobile-server-strip::-webkit-scrollbar {
    display: none;
  }

  .mob-srv-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
  }

  .mob-srv-pill.active {
    background: var(--bg-active);
    border-color: rgba(56, 189, 248, 0.55);
    color: #FFFFFF;
    font-weight: 600;
  }

  .mob-srv-cnt {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 10.5px;
    color: var(--text-muted);
  }

  .mob-srv-pill.active .mob-srv-cnt {
    color: var(--accent-blue);
  }

  /* 3 Navigation Tabs */
  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-tab {
    height: 38px;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
  }

  .mobile-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.02);
  }

  /* Single column stack on mobile */
  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 170px);
  }

  .sidebar-left {
    position: static;
    height: auto;
    border-right: none;
    background: var(--bg-canvas);
  }

  .sidebar-scroll {
    padding: 16px 12px;
  }

  .sidebar-servers-section {
    display: none;
  }

  .sidebar-footer {
    padding: 12px;
    background: var(--bg-canvas);
  }

  /* Flatten right rail on mobile so Boss section & Maintenance section can show on separate tabs */
  .rail-right {
    display: contents;
  }

  .rail-sep-desktop {
    display: none;
  }

  .boss-section,
  .maint-section {
    padding: 16px 12px;
    background: var(--bg-canvas);
  }

  .maint-section {
    border-top: 1px solid var(--hairline);
  }

  .boss-list {
    margin: 0 -12px;
  }

  .boss-row {
    padding: 10px 12px;
  }

  .rail-empty {
    padding: 12px 12px 4px 12px;
  }

  .feed-toolbar {
    position: static;
    padding: 0 12px;
  }

  .feed-item {
    padding: 12px;
  }

  .panel-hidden-mobile {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .brand-sep,
  .brand-sub,
  .topbar-divider,
  .top-btn-label {
    display: none;
  }

  .topbar-left {
    width: 100%;
    justify-content: space-between;
  }

  .brand {
    margin-right: auto;
  }

  .topbar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .health-pill {
    margin-right: auto;
    height: 26px;
    padding: 0 8px;
    font-size: 11px;
  }

  .brand-logo {
    width: 24px;
    height: 24px;
  }

  .sse-badge {
    padding: 0 7px;
    font-size: 11px;
  }

  .top-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 12px;
  }

  .item-meta {
    flex-wrap: wrap;
  }

  .item-meta-left {
    flex-wrap: wrap;
    overflow: visible;
  }

  .checkbox-grid,
  .server-check-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 340px) {
  .viewer-chip {
    display: none;
  }
}
