/* SNSysInfoMonitor dashboard ------------------------------------------------ */

:root {
  --bg: #070b16;
  --bg-soft: #0c1222;
  --surface: #121a2d;
  --surface-2: #172033;
  --border: #23304d;
  --border-soft: #1b2540;
  --text: #e8eefc;
  --muted: #8fa2c4;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.14);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.14);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

/* A component that sets its own ``display`` beats the user-agent rule for the
   ``hidden`` attribute, which silently left overlays such as the client's token
   gate on screen even after the element was hidden.  Make the attribute
   authoritative once, for every page of both consoles.

   ``hidden="until-found"`` is excluded on purpose: it hides through
   ``content-visibility`` and must stay findable by the browser. */
[hidden]:not([hidden="until-found"]) {
  display: none !important;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 12% -12%, rgba(77, 163, 255, 0.16), transparent 60%),
    radial-gradient(900px 520px at 105% 0%, rgba(52, 211, 153, 0.1), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui,
    -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.01em;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 5px;
}

.muted {
  color: var(--muted);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: #1d2841;
  border-color: #2f3f63;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, #4da3ff, #2f7fe0);
  border-color: #2f7fe0;
  color: #04101f;
  font-weight: 600;
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #62b0ff, #3a8bea);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn.danger {
  color: #ffc9c9;
  border-color: rgba(248, 113, 113, 0.45);
  background: var(--danger-soft);
}

.btn.danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.24);
  border-color: rgba(248, 113, 113, 0.75);
}

/* ------------------------------------------------------------------ login */

.login-page {
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 30px 28px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  background: linear-gradient(140deg, #4da3ff, #34d399);
  color: #04101f;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.03em;
}

.brand h1 {
  font-size: 17px;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
}

.field {
  display: block;
  margin-bottom: 15px;
}

.field > span {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #0b1324;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.login-card .btn.primary {
  width: 100%;
  padding: 11px;
  margin-top: 4px;
  font-size: 14.5px;
}

.alert {
  margin: 0 0 13px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid rgba(248, 113, 113, 0.4);
  color: #ffc9c9;
  font-size: 13px;
}

.error-text {
  margin: 12px 0 0;
  font-size: 12px;
}

.hint {
  margin: 18px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
}

/* ----------------------------------------------------------------- header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 22px;
  background: rgba(7, 11, 22, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-left .brand-mark {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  font-size: 13px;
  border-radius: 10px;
}

.brand-text strong {
  display: block;
  font-size: 15px;
}

.brand-text span {
  font-size: 12px;
  font-family: var(--mono);
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}

.conn .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.conn.live {
  color: #bff5e2;
  border-color: rgba(52, 211, 153, 0.4);
  background: var(--ok-soft);
}

.conn.live .dot {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
  animation: pulse 1.8s infinite;
}

.conn.down {
  color: #ffd0d0;
  border-color: rgba(248, 113, 113, 0.4);
  background: var(--danger-soft);
}

.conn.down .dot {
  background: var(--danger);
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 9px rgba(52, 211, 153, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

/* ------------------------------------------------------------------ shell */

.wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 22px 60px;
}

/* ------------------------------------------------------------------ stats */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 13px 16px;
}

.stat .label {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.stat .value {
  font-size: 24px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.stat .value small {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 5px;
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--muted);
}

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

.swatch.stale {
  background: var(--warn);
}

.swatch.offline {
  background: var(--muted);
}

/* ---------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.toolbar input[type="search"] {
  max-width: 320px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.switch input {
  appearance: none;
  width: 38px;
  height: 21px;
  border-radius: 999px;
  background: #1b2540;
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  transition: background 0.18s ease;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch input:checked {
  background: var(--accent-soft);
  border-color: rgba(77, 163, 255, 0.5);
}

.switch input:checked::after {
  transform: translateX(17px);
  background: var(--accent);
}

/* ------------------------------------------------------------------- grid */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.card {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 15px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: rgba(77, 163, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

/* The card is a ``div`` (it holds its own buttons), so it needs an explicit
   keyboard focus ring. */
.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  min-width: 0;
}

.card-title h3 {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-title p {
  margin: 1px 0 0;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status badge plus (for offline clients) the delete action. */
.card-side {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.card-delete {
  opacity: 0.7;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.card:hover .card-delete,
.card:focus-within .card-delete,
.card-delete:focus-visible {
  opacity: 1;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge.online {
  color: #9df0cd;
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.35);
}

.badge.stale {
  color: #ffe08a;
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.35);
}

.badge.offline {
  color: #b6c4dd;
  background: rgba(143, 162, 196, 0.12);
  border-color: rgba(143, 162, 196, 0.28);
}

.metrics {
  display: grid;
  gap: 9px;
}

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

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
}

.metric-row .name {
  color: var(--muted);
}

.metric-row .val {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: #0d1526;
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4da3ff, #34d399);
  transition: width 0.45s ease;
}

.bar.warn > i {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.bar.danger > i {
  background: linear-gradient(90deg, #fb923c, #f87171);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* -------------------------------------------------------- layout editing */

.order-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid rgba(77, 163, 255, 0.4);
  border-radius: var(--radius-sm);
}

.order-bar[hidden] {
  display: none;
}

.order-hint {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  font-size: 12.5px;
}

.order-hint strong {
  font-size: 12.5px;
  color: #d6e8ff;
  letter-spacing: 0.02em;
}

.order-actions {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}

.order-error {
  flex: 1 0 100%;
  margin: 0;
}

/* While the layout editor is open, every card drags. */
.grid.ordering .card {
  cursor: grab;
  border-style: dashed;
}

.grid.ordering .card:hover {
  transform: none;
  box-shadow: none;
}

.grid.ordering .card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.drag-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  font-family: var(--mono);
  color: var(--muted);
}

.drag-bar .drag-handle {
  letter-spacing: 0.08em;
}

.drag-bar .drag-index {
  color: #d6e8ff;
}

/* ----------------------------------------------------------------- drawer */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
}

.drawer[hidden] {
  display: none;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.66);
  backdrop-filter: blur(2px);
}

.drawer-panel {
  position: relative;
  width: min(760px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slide-in 0.22s ease;
}

@keyframes slide-in {
  from {
    transform: translateX(26px);
    opacity: 0;
  }
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 20px;
  background: rgba(12, 18, 34, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.drawer-head h2 {
  font-size: 17px;
}

.drawer-head p {
  margin: 2px 0 0;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--muted);
}

.drawer-body {
  padding: 18px 20px 46px;
  display: grid;
  gap: 18px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 11px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
}

.tile .name {
  font-size: 12px;
  color: var(--muted);
}

.tile .value {
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  margin-top: 1px;
}

.tile .sub {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

.kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px 18px;
  font-size: 13px;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border-soft);
}

.kv .k {
  color: var(--muted);
}

.kv .v {
  font-family: var(--mono);
  text-align: right;
  word-break: break-all;
}

.disk-list {
  display: grid;
  gap: 10px;
}

.disk-item {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  display: grid;
  gap: 7px;
}

.disk-item .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
}

.disk-item .mount {
  font-family: var(--mono);
  font-weight: 600;
}

.disk-item .meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-family: var(--mono);
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill.ok {
  color: #9df0cd;
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.35);
}

.pill.bad {
  color: #ffc9c9;
  background: var(--danger-soft);
  border-color: rgba(248, 113, 113, 0.35);
}

/* ----------------------------------------------------------------- charts */

.ranges {
  display: inline-flex;
  gap: 6px;
}

.range {
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.range.active {
  color: #d6e8ff;
  border-color: rgba(77, 163, 255, 0.55);
  background: var(--accent-soft);
}

/* ---------------------------------------------------------------- confirm */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.66);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal-panel h3 {
  font-size: 16px;
}

.modal-text {
  margin: 10px 0 0;
  font-size: 13.5px;
  line-height: 1.65;
}

.modal-text b {
  font-family: var(--mono);
  font-weight: 600;
}

.modal-error {
  color: #ffc9c9;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.charts {
  display: grid;
  gap: 13px;
}

.chart-meta {
  font-size: 12px;
  font-family: var(--mono);
  margin-bottom: 9px;
}

.chart {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px 9px;
}

.chart figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.chart figcaption b {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.chart-body {
  position: relative;
  height: 96px;
}

.chart-body svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.chart-body .hover-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.chart-tip {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -120%);
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(6, 10, 20, 0.96);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chart-tip.show {
  opacity: 1;
}

.chart-legend {
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend i {
  width: 9px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(143, 162, 196, 0.35);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ inbox */

/* The 站内信 entry point in the top bar: a bell with the unread counter. */
.inbox-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.inbox-btn .bell {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inbox-btn.unread {
  color: #ffd9d9;
  border-color: rgba(248, 113, 113, 0.45);
  background: var(--danger-soft);
}

.inbox-count {
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #2b0606;
  font-size: 11px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.inbox[hidden] {
  display: none;
}

.inbox {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  justify-content: flex-end;
}

.inbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 14, 0.55);
  backdrop-filter: blur(2px);
}

.inbox-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  height: 100%;
  background: var(--bg-soft);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slide-in 0.22s ease;
}

.inbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 15px 18px;
  background: rgba(12, 18, 34, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.inbox-head h3 {
  font-size: 16px;
}

.inbox-head p {
  margin: 3px 0 0;
  font-size: 12px;
}

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

.inbox-hint {
  margin: 0;
  padding: 9px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--warn-soft);
  font-size: 11.5px;
  color: #ffe1a3;
}

.inbox-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 30px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.alert {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.alert:hover {
  background: var(--surface-2);
}

.alert:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.alert.busy {
  opacity: 0.6;
  cursor: progress;
}

.alert.info {
  border-left-color: var(--accent);
}

.alert.warning {
  border-left-color: var(--warn);
}

.alert.critical {
  border-left-color: var(--danger);
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.09), transparent 55%), var(--surface);
}

.alert.read .alert-message {
  color: var(--muted);
}

.alert.flash {
  animation: alert-flash 1.2s ease;
}

@keyframes alert-flash {
  0%,
  100% {
    border-color: var(--border);
  }
  35% {
    border-color: var(--accent);
  }
}

.alert-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.alert-sev {
  font-size: 11.5px;
  font-weight: 600;
}

.alert-sev.info {
  color: var(--accent);
}

.alert-sev.warning {
  color: var(--warn);
}

.alert-sev.critical {
  color: var(--danger);
}

.alert-time {
  margin-left: auto;
  font-size: 11.5px;
  font-family: var(--mono);
}

/* How long the condition had been true when the alert was sent: the client's
   notification engine reports it as ``event.elapsed`` (a 网站不可用 rule with a
   保持失败时长 uses this to say 已持续 5 分钟 next to the message). */
.alert-duration {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
  font-family: var(--mono);
}

.alert-ack {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 6px;
}

.alert-message {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.alert-meta {
  margin: 5px 0 0;
  font-size: 11.5px;
  font-family: var(--mono);
}

/* --------------------------------------------------------------- bubbles */

/* 气泡提示: a short-lived card in the top-right corner for every new alert. */
.toasts {
  position: fixed;
  top: 74px;
  right: 22px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  appearance: none;
  text-align: left;
  font: inherit;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(9, 14, 26, 0.97);
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in 0.22s ease;
}

.toast:hover {
  border-color: #2f3f63;
}

.toast.leaving {
  animation: toast-out 0.2s ease forwards;
}

@keyframes toast-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}

@keyframes toast-out {
  to {
    transform: translateX(20px);
    opacity: 0;
  }
}

.toast-mark {
  width: 8px;
  flex: 0 0 8px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--accent);
}

.toast.info .toast-mark {
  background: var(--accent);
}

.toast.warning .toast-mark {
  background: var(--warn);
}

.toast.critical .toast-mark {
  background: var(--danger);
}

.toast.resolved .toast-mark {
  background: var(--ok);
}

.toast-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.toast-title {
  font-size: 12.5px;
  font-weight: 600;
}

.toast-text {
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.toast-meta {
  font-size: 11.5px;
  color: var(--muted);
  font-family: var(--mono);
}

/* A compact variant of the switch, for the inbox header. */
.switch.small {
  font-size: 12px;
  gap: 6px;
}

.switch.small input {
  width: 30px;
  height: 17px;
}

.switch.small input::after {
  width: 11px;
  height: 11px;
}

.switch.small input:checked::after {
  transform: translateX(13px);
}

@media (max-width: 720px) {
  .wrap,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .order-actions {
    width: 100%;
    margin-left: 0;
  }

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

  .toasts {
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  .inbox-panel {
    width: 100%;
  }
}
