:root {
  --bg: #090a0f;
  --bg-elevated: #11131c;
  --card: #131620;
  --card-hover: #191d2b;
  --border: #232738;
  --text: #eef0f6;
  --muted: #8a90a6;
  --accent: #10b981;
  --accent-bg: rgba(16, 185, 129, 0.14);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 0.14);
  --warn: #f59e0b;
  --danger: #ef4444;
  --code-bg: #0c0e16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  padding-bottom: 60px;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Topbar */
.topbar {
  background: #06070b;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  padding: 8px 0;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.conn-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.conn-pill code {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

.dot.ok {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.dot.warn {
  background: var(--warn);
}

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

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Navbar */
.navbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.brand-icon {
  font-size: 26px;
  background: var(--accent-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.nav-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--card);
}

.nav-btn.active {
  color: var(--text);
  background: var(--card);
  border-color: var(--border);
}

.counter-badge {
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Hero Search */
.hero {
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.04) 0%, transparent 100%);
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.search-box input {
  flex: 1;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
}

.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toast-msg {
  font-size: 12.5px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-left: 6px;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: #032219;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-xs {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.btn-xs:hover {
  background: var(--card-hover);
}

.btn-accent {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--accent);
}

/* Stats Grid */
.main-content {
  padding-top: 24px;
}

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

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

/* Cards & Grids */
.tab-pane {
  display: none;
}

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

.dual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(460px, 1fr));
  gap: 20px;
}

@media (max-width: 960px) {
  .dual-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
}

/* Feed List */
.feed-list {
  divide-y: 1px solid var(--border);
}

.feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}

.feed-item:last-child {
  border-bottom: none;
}

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

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

.feed-badge {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.feed-main {
  min-width: 0;
}

.feed-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  font-weight: 600;
}

.feed-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-right {
  text-align: right;
  flex-shrink: 0;
}

/* Links & Badges */
.link {
  color: var(--blue);
  cursor: pointer;
  text-decoration: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.link:hover {
  text-decoration: underline;
}

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.pill.success {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.3);
}

.pill.method {
  background: var(--blue-bg);
  color: #60a5fa;
  border-color: rgba(59, 130, 246, 0.3);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.2);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

.right {
  text-align: right;
}

.empty-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* Forms */
.tx-form {
  padding: 20px;
}

.form-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.form-group input, .form-group select {
  background: var(--code-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 12px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

/* Inspector Detail Table */
.detail-list {
  padding: 8px 20px 20px;
}

.detail-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  align-items: start;
}

@media (max-width: 640px) {
  .detail-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.detail-key {
  color: var(--muted);
  font-weight: 500;
}

.detail-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
}

pre.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
  margin: 6px 0 0;
  max-height: 260px;
}

/* WebSocket Console */
.ws-console {
  background: var(--code-bg);
  padding: 16px 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  min-height: 420px;
  max-height: 600px;
  overflow-y: auto;
}

.ws-entry {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ws-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 480px;
  width: 100%;
  padding: 24px;
}

.modal h3 {
  margin: 0 0 6px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}
