:root {
  color-scheme: dark;
  --bg: #0d1118;
  --panel: #171c26;
  --panel-2: #1d2430;
  --line: #2b3546;
  --text: #eef4ff;
  --muted: #9fb0c8;
  --accent: #6057f6;
  --ok: #22c58b;
  --warn: #f7b955;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

aside {
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 22px 14px;
}

.brand {
  height: 42px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 800;
  margin-bottom: 20px;
}

aside button, header button {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  cursor: pointer;
}

aside button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 28px rgba(96, 87, 246, .28);
}

main { min-width: 0; }

header {
  min-height: 92px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 28px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
p { color: var(--muted); margin-top: 6px; }

header button {
  width: auto;
  background: var(--accent);
  color: white;
  padding: 11px 18px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 28px 0;
}

article, .list, .empty, pre {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

article { padding: 16px; }
article span { display: block; color: var(--muted); font-size: 13px; }
article strong { display: block; margin-top: 8px; font-size: 24px; }

.view { display: none; padding: 22px 28px; }
.view.active { display: block; }

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

.list { overflow: hidden; }

.split {
  display: grid;
  grid-template-columns: minmax(460px, 1.05fr) minmax(360px, .95fr);
  gap: 14px;
  align-items: start;
}

.row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(120px, .8fr) 120px minmax(220px, 1.4fr) 86px;
  gap: 14px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.action-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.action-row:hover, .row.selected { background: rgba(96, 87, 246, .12); }

.row:last-child { border-bottom: 0; }
.row b { display: block; }
.row small, .account-card small { color: var(--muted); }
.pill { color: #0b121a; background: var(--warn); border-radius: 999px; padding: 6px 9px; font-weight: 800; font-size: 12px; width: fit-content; }
.pill.ok { background: var(--ok); }
.pill.warn { background: var(--warn); }
.open { color: white; background: var(--accent); text-decoration: none; border-radius: 8px; padding: 9px 11px; text-align: center; font-weight: 800; }

.empty, pre { padding: 18px; color: var(--muted); }
pre { white-space: pre-wrap; }

input {
  min-width: 280px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

input:focus { border-color: var(--accent); }

.detail-panel {
  position: sticky;
  top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.detail-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-head a {
  color: white;
  background: var(--accent);
  text-decoration: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 800;
}

.messages {
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 14px;
}

.message {
  max-width: 84%;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel-2);
}

.message.outgoing {
  margin-left: auto;
  background: rgba(96, 87, 246, .22);
  border-color: rgba(96, 87, 246, .35);
}

.message p {
  color: var(--text);
  margin-top: 6px;
  white-space: pre-wrap;
}

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

.account-card {
  display: grid;
  gap: 12px;
}

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

.metric-line strong {
  color: var(--text);
  font-size: 20px;
}

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  aside { display: flex; overflow-x: auto; gap: 8px; padding: 10px; }
  .brand { display: none; }
  aside button { white-space: nowrap; width: auto; }
  header, .section-title { align-items: start; flex-direction: column; }
  .stats { grid-template-columns: 1fr; padding: 14px; }
  .view { padding: 14px; }
  .row { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
  input { min-width: 100%; }
}
