:root {
  --bg: #07111f;
  --bg-soft: #0b1829;
  --panel: rgba(13, 28, 47, 0.78);
  --panel-border: rgba(148, 180, 215, 0.14);
  --text: #edf5ff;
  --muted: #8fa6bf;
  --accent: #55e6c1;
  --accent-soft: rgba(85, 230, 193, 0.12);
  --blue: #8cc8ff;
  --blue-soft: rgba(91, 165, 230, 0.12);
  --danger: #ff7a90;
  --danger-soft: rgba(255, 122, 144, 0.12);
  --warning: #f4c96b;
  --warning-soft: rgba(244, 201, 107, 0.12);
  --success: #55e6c1;
  --success-soft: rgba(85, 230, 193, 0.12);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --radius: 20px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(33, 101, 145, 0.28), transparent 34rem),
    radial-gradient(circle at 92% 12%, rgba(45, 170, 145, 0.14), transparent 30rem),
    linear-gradient(145deg, #06101d 0%, #081524 48%, #07111f 100%);
  font-family: "Segoe UI", "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.ambient {
  position: fixed;
  z-index: 0;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.14;
  pointer-events: none;
}

.ambient-one {
  top: -15rem;
  right: -10rem;
  background: #2ecfb1;
}

.ambient-two {
  bottom: -18rem;
  left: -12rem;
  background: #2f78b7;
}

.topbar,
main,
footer {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  width: min(1280px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2rem 0 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 0.35rem);
  align-items: end;
  gap: 0.22rem;
  width: 3rem;
  height: 3rem;
  padding: 0.7rem;
  border: 1px solid rgba(85, 230, 193, 0.3);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(85, 230, 193, 0.18), rgba(85, 230, 193, 0.03));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.brand-mark span {
  display: block;
  border-radius: 1rem;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(85, 230, 193, 0.45);
}

.brand-mark span:nth-child(1) {
  height: 45%;
  opacity: 0.55;
}

.brand-mark span:nth-child(2) {
  height: 75%;
  opacity: 0.8;
}

.brand-mark span:nth-child(3) {
  height: 100%;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 650;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 0.2rem;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

h3 {
  margin-bottom: 0.4rem;
  font-size: 1rem;
  letter-spacing: -0.015em;
}

.nav {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.22rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(9, 22, 38, 0.68);
}

.nav-link {
  padding: 0.48rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
  transition: background 140ms ease, color 140ms ease;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.connection {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(9, 22, 38, 0.7);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.connection-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 0 rgba(244, 201, 107, 0.45);
  animation: ping 1.8s infinite;
}

.connection.live .connection-dot {
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(85, 230, 193, 0.45);
}

.connection.down .connection-dot {
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(255, 122, 144, 0.45);
}

@keyframes ping {
  70% {
    box-shadow: 0 0 0 0.45rem transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

main {
  width: min(1280px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding-bottom: 2rem;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(1280px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 1.2rem 0 2rem;
  color: #5f7690;
  font-size: 0.72rem;
}

.muted {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.hint {
  margin: 0.65rem 0 0;
  color: #7189a2;
  font-size: 0.72rem;
}

.hint code {
  padding: 0.1rem 0.25rem;
  border-radius: 0.25rem;
  background: rgba(4, 12, 23, 0.8);
  color: #b8f4e5;
}

/* ------------------------------------------------------------------------- */
/* Statistics                                                                */
/* ------------------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(16, 35, 58, 0.84), rgba(9, 22, 38, 0.68));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  transition: transform 140ms ease, border-color 140ms ease;
}

.stat-card:hover {
  transform: translateY(-1px);
  border-color: rgba(85, 230, 193, 0.2);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: 0 0 auto;
  border-radius: 0.8rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.online-icon,
.done-icon {
  color: var(--accent);
  background: var(--accent-soft);
}

.offline-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.total-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.pending-icon {
  color: var(--warning);
  background: var(--warning-soft);
}

.running-icon {
  color: var(--blue);
  background: var(--blue-soft);
}

.stat-label {
  margin-bottom: 0.1rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.07em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-value {
  margin-bottom: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

/* ------------------------------------------------------------------------- */
/* Panels and tables                                                         */
/* ------------------------------------------------------------------------- */

.panel {
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.panel + .panel {
  margin-top: 1rem;
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.35rem 1.5rem 1.1rem;
  border-bottom: 1px solid rgba(148, 180, 215, 0.1);
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.panel-head > .button {
  align-self: flex-end;
}

.search input {
  width: min(19rem, 32vw);
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.7rem;
  outline: none;
  background: rgba(6, 16, 29, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.search input::placeholder {
  color: #6f869f;
}

.search input:focus {
  border-color: rgba(85, 230, 193, 0.55);
  box-shadow: 0 0 0 3px rgba(85, 230, 193, 0.1);
}

.filter-group {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  padding: 0.18rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.7rem;
  background: rgba(4, 12, 23, 0.6);
}

.filter-btn {
  padding: 0.42rem 0.6rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 650;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  color: #062019;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(85, 230, 193, 0.35);
  border-radius: 0.7rem;
  background: var(--accent);
  color: #062019;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.button.ghost {
  border-color: var(--panel-border);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

.button.danger {
  border-color: rgba(255, 122, 144, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.button.small {
  padding: 0.42rem 0.65rem;
  font-size: 0.7rem;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid rgba(148, 180, 215, 0.1);
  color: #7890a9;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(148, 180, 215, 0.07);
  vertical-align: middle;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:hover {
  background: rgba(85, 230, 193, 0.045);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.agent-name {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.agent-name > div {
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  border: 1px solid rgba(85, 230, 193, 0.2);
  border-radius: 0.7rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
}

.avatar-large {
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 1rem;
  font-size: 1rem;
}

.agent-name strong {
  display: block;
  max-width: 16rem;
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-name small {
  display: block;
  max-width: 16rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mono {
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.cell-muted {
  color: var(--muted);
  white-space: nowrap;
}

.cell-command {
  max-width: 22rem;
  overflow: hidden;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-inline {
  display: block;
  color: inherit;
  text-decoration: none;
}

.agent-inline:hover strong {
  color: var(--accent);
}

.agent-inline strong {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  font-size: 0.8rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-inline small {
  display: block;
  max-width: 14rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  min-width: 7.5rem;
  text-align: right;
  white-space: nowrap;
}

.row-actions .button {
  padding: 0.38rem 0.55rem;
  font-size: 0.68rem;
  vertical-align: middle;
}

.row-actions .icon-button {
  display: inline-grid;
  vertical-align: middle;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(255, 122, 144, 0.35);
  color: var(--danger);
}

.icon-button.small {
  width: 1.7rem;
  height: 1.7rem;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge::before {
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  content: "";
}

.badge.online,
.badge.done {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.online::before,
.badge.done::before {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(85, 230, 193, 0.7);
}

.badge.offline {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.offline::before {
  background: var(--danger);
}

.badge.pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge.pending::before {
  background: var(--warning);
}

.badge.running {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.running::before {
  background: var(--blue);
  animation: pulse 1.5s infinite;
}

.task-chips {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.4rem;
  border-radius: 0.35rem;
  font-size: 0.64rem;
  font-weight: 700;
  white-space: nowrap;
}

.chip-pending {
  background: var(--warning-soft);
  color: var(--warning);
}

.chip-running {
  background: var(--blue-soft);
  color: var(--blue);
}

.chip-done {
  background: var(--accent-soft);
  color: var(--accent);
}

.chip-empty {
  background: rgba(255, 255, 255, 0.04);
  color: #6f869f;
}

.rel-time.fresh {
  color: var(--accent);
}

.rel-time.stale {
  color: var(--warning);
}

.rel-time.old {
  color: var(--muted);
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.5rem;
  border-top: 1px solid rgba(148, 180, 215, 0.08);
  color: #7189a2;
  font-size: 0.7rem;
}

.pulse-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.pulse {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 3.2rem 1.5rem 3.6rem;
  text-align: center;
}

.empty-state[hidden] {
  display: none;
}

.empty-mark {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  margin-bottom: 0.9rem;
  border: 1px dashed rgba(85, 230, 193, 0.35);
  border-radius: 1rem;
  color: var(--accent);
  font-size: 1.5rem;
}

.empty-state h3 {
  margin-bottom: 0.25rem;
}

.empty-state p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.skeleton-row td {
  padding: 1.1rem 1rem;
}

.skeleton {
  display: block;
  width: 100%;
  height: 1.1rem;
  border-radius: 0.35rem;
  background: linear-gradient(
    90deg,
    rgba(148, 180, 215, 0.08) 25%,
    rgba(148, 180, 215, 0.16) 37%,
    rgba(148, 180, 215, 0.08) 63%
  );
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* ------------------------------------------------------------------------- */
/* Agent details                                                             */
/* ------------------------------------------------------------------------- */

.detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.4rem 0 1.2rem;
}

.back-link {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

.detail-title {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 0.65rem;
}

.detail-title h2 {
  margin-bottom: 0.1rem;
  font-size: 1.35rem;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.15rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.7rem;
  padding: 1.2rem 1.5rem 1.5rem;
}

.info-item {
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(148, 180, 215, 0.1);
  border-radius: 0.8rem;
  background: rgba(4, 12, 23, 0.35);
}

.info-item .label {
  display: block;
  margin-bottom: 0.25rem;
  color: #7189a2;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-item .value {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  font-weight: 600;
}

.value-with-action,
.info-item .value.value-with-action {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.copy-btn {
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  padding: 0;
  border: 1px solid var(--panel-border);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.copy-btn:hover {
  border-color: rgba(85, 230, 193, 0.35);
  color: var(--accent);
}

.command-form {
  display: flex;
  gap: 0.6rem;
  padding: 1.1rem 1.5rem 0.3rem;
}

.command-form input {
  flex: 1;
  min-width: 0;
  padding: 0.72rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.7rem;
  outline: none;
  background: rgba(4, 12, 23, 0.75);
  color: var(--text);
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
}

.command-form input:focus {
  border-color: rgba(85, 230, 193, 0.55);
  box-shadow: 0 0 0 3px rgba(85, 230, 193, 0.1);
}

.command-hint {
  padding: 0 1.5rem 1.1rem;
}

.result-box {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(148, 180, 215, 0.12);
  border-radius: 0.6rem;
  background: rgba(4, 12, 23, 0.82);
  color: #c9d8e8;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.result-box-small {
  max-height: 4.6rem;
  max-width: 18rem;
  padding: 0.45rem 0.55rem;
}

.result-box-large {
  min-height: 12rem;
  max-height: 26rem;
  margin: 1rem 1.35rem;
  font-size: 0.78rem;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
}

.link-button:hover {
  color: #9ff6e1;
}

/* ------------------------------------------------------------------------- */
/* Dashboard                                                                 */
/* ------------------------------------------------------------------------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.chart-card {
  overflow: hidden;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.chart-wide {
  grid-column: span 2;
}

.chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.35rem 0.85rem;
  border-bottom: 1px solid rgba(148, 180, 215, 0.08);
}

.chart-head h2 {
  margin-bottom: 0.15rem;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.legend-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.3rem;
  border-radius: 50%;
}

.legend-dot.accent {
  background: var(--accent);
}

.legend-dot.blue {
  background: var(--blue);
}

.chart-body {
  padding: 1rem 1.2rem 1.2rem;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}

.doughnut-wrap {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.2rem 1.35rem;
  flex-wrap: wrap;
}

.doughnut {
  display: grid;
  place-items: center;
  width: 9rem;
  height: 9rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(rgba(148, 180, 215, 0.15) 0 100%);
}

.doughnut-hole {
  display: grid;
  place-items: center;
  width: 6rem;
  height: 6rem;
  border-radius: 50%;
  background: #0b1829;
  box-shadow: inset 0 0 0 1px rgba(148, 180, 215, 0.08);
  text-align: center;
}

.doughnut-hole strong {
  display: block;
  font-size: 1.4rem;
  letter-spacing: -0.04em;
  line-height: 1;
}

.doughnut-hole span {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
}

.legend-list {
  display: grid;
  flex: 1;
  gap: 0.45rem;
  min-width: 8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.legend-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.legend-swatch {
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 auto;
  border-radius: 0.15rem;
}

.legend-value {
  margin-left: auto;
  color: var(--text);
  font-weight: 700;
}

.os-bars {
  display: grid;
  gap: 0.9rem;
  padding: 1.2rem 1.35rem 1.4rem;
}

.os-bar-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.os-bar-head strong {
  color: var(--text);
}

.os-bar-track {
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148, 180, 215, 0.1);
}

.os-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ecfb1, #8cc8ff);
}

/* ------------------------------------------------------------------------- */
/* Modals and toasts                                                         */
/* ------------------------------------------------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(2, 8, 15, 0.72);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 160ms ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal {
  width: min(32rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: 1.1rem;
  background: #0b1829;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.6);
  transform: translateY(8px) scale(0.985);
  transition: transform 160ms ease;
}

.modal-overlay.show .modal {
  transform: translateY(0) scale(1);
}

.result-modal {
  width: min(52rem, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.35rem 0.9rem;
  border-bottom: 1px solid rgba(148, 180, 215, 0.1);
}

.modal-head h3 {
  margin-bottom: 0;
}

.modal-message {
  margin: 0;
  padding: 1.1rem 1.35rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding: 0 1.35rem 1.25rem;
}

.result-modal .modal-actions {
  padding-top: 0;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, calc(100% - 2rem));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent);
  border-radius: 0.65rem;
  background: rgba(11, 24, 41, 0.97);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 0.8rem;
  pointer-events: auto;
  animation: toast-in 180ms ease both;
}

.toast.error {
  border-left-color: var(--danger);
}

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

.toast.info {
  border-left-color: var(--blue);
}

.toast.hide {
  animation: toast-out 160ms ease both;
}

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

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

/* ------------------------------------------------------------------------- */
/* Help cards                                                                */
/* ------------------------------------------------------------------------- */

.help-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
  margin-top: 1rem;
}

.help-card {
  padding: 1.35rem 1.5rem;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(16, 35, 58, 0.58), rgba(9, 22, 38, 0.5));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.command-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.command-row code {
  flex: 1;
  overflow-x: auto;
  padding: 0.72rem 0.85rem;
  border: 1px solid rgba(148, 180, 215, 0.12);
  border-radius: 0.7rem;
  background: rgba(4, 12, 23, 0.82);
  color: #b8f4e5;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
  white-space: nowrap;
}

.download-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.download-agent {
  margin-top: 0;
}

.steps {
  display: grid;
  gap: 0.55rem;
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.steps span {
  display: grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  border-radius: 0.45rem;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------------- */
/* Responsive                                                                */
/* ------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .connection {
    margin-left: auto;
  }

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

  .chart-wide {
    grid-column: span 1;
  }

  .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-tools {
    justify-content: flex-start;
  }

  .search {
    flex: 1;
  }

  .search input {
    width: 100%;
  }

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

@media (max-width: 720px) {
  .topbar,
  main,
  footer {
    width: min(100% - 1.25rem, 1280px);
  }

  .topbar {
    padding-top: 1.25rem;
  }

  .brand-mark {
    width: 2.7rem;
    height: 2.7rem;
  }

  .connection {
    padding: 0.45rem 0.65rem;
    font-size: 0.7rem;
  }

  .stat-grid {
    gap: 0.55rem;
  }

  .stat-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stat-icon {
    width: 2rem;
    height: 2rem;
  }

  .panel-head,
  .panel-foot,
  .help-card {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .panel-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-group {
    align-self: flex-start;
    flex-wrap: wrap;
  }

  .detail-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-actions {
    width: 100%;
    justify-content: space-between;
  }

  .info-grid {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .command-form {
    flex-direction: column;
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .command-hint {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .command-row {
    align-items: stretch;
    flex-direction: column;
  }

  .doughnut-wrap {
    justify-content: center;
  }

  .chart-legend {
    display: none;
  }

  .panel-foot {
    align-items: flex-start;
    flex-direction: column;
  }

  footer {
    flex-direction: column;
    gap: 0.2rem;
  }
}

/* ------------------------------------------------------------------------- */
/* Authentication, account, and audit additions                              */
/* ------------------------------------------------------------------------- */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.account {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.2rem 0.18rem 0.55rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(9, 22, 38, 0.7);
}

.user-chip {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 650;
  white-space: nowrap;
}

.logout-link {
  padding: 0.32rem 0.55rem;
  font-size: 0.68rem;
}

.select-control {
  padding: 0.58rem 0.7rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.7rem;
  outline: none;
  background: rgba(6, 16, 29, 0.72);
  color: var(--text);
  font: inherit;
  font-size: 0.76rem;
}

.select-control:focus {
  border-color: rgba(85, 230, 193, 0.55);
}

.inline-code {
  padding: 0.1rem 0.25rem;
  border-radius: 0.25rem;
  background: rgba(4, 12, 23, 0.8);
  color: #b8f4e5;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
}

.chip-type-shell {
  background: rgba(255, 255, 255, 0.05);
  color: #9db1c7;
}

.chip-type-file {
  background: var(--blue-soft);
  color: var(--blue);
}

.audit-action {
  display: inline-flex;
  padding: 0.18rem 0.42rem;
  border-radius: 0.35rem;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 650;
  white-space: nowrap;
}

.audit-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: #9db1c7;
}

.audit-success {
  background: var(--accent-soft);
  color: var(--accent);
}

.audit-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.audit-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.audit-details {
  max-width: 26rem;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
}

.login-card {
  padding: 1.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 1.35rem;
  background: linear-gradient(145deg, rgba(16, 35, 58, 0.9), rgba(9, 22, 38, 0.82));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.login-intro {
  margin-bottom: 1.2rem;
  font-size: 0.84rem;
}

.login-error {
  margin-bottom: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 122, 144, 0.28);
  border-radius: 0.65rem;
  background: var(--danger-soft);
  color: #ffc1cb;
  font-size: 0.8rem;
}

.login-form {
  display: grid;
  gap: 0.9rem;
}

.login-form label {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.login-form input {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.65rem;
  outline: none;
  background: rgba(4, 12, 23, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
}

.login-form input:focus {
  border-color: rgba(85, 230, 193, 0.55);
  box-shadow: 0 0 0 3px rgba(85, 230, 193, 0.1);
}

.login-button {
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.72rem;
}

.login-hint {
  margin-top: 1.1rem;
  margin-bottom: 0;
  text-align: center;
}

@media (max-width: 980px) {
  .topbar-actions {
    margin-left: auto;
  }
}

@media (max-width: 720px) {
  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .account {
    margin-left: auto;
  }

  .login-card {
    padding: 1.35rem;
  }
}
