*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f8f8fa;
  --sidebar-bg: #fff;
  --card-bg: #fff;
  --border: #e5e7eb;
  --text: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --purple-dark: #5b21b6;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #2563eb;
  --blue-light: #dbeafe;
  --orange: #d97706;
  --orange-light: #fef3c7;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

html { font-size: 14px; }
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--purple); text-decoration: none; }
code, .mono {
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85em;
}
code {
  background: var(--bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--purple);
}

/* LAYOUT */
.layout {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-logo {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-size: 0.93rem;
}

.nav-item:hover {
  background: var(--bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--purple-light);
  color: var(--purple);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.net-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--orange-light);
  color: var(--orange);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content;
}

.sidebar-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* CONTENT */
.content {
  flex: 1;
  margin-left: 220px;
  padding: 0 32px 40px;
}

/* TOPBAR */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  transition: background 0.3s;
}

.status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stats-grid.small {
  grid-template-columns: repeat(3, 1fr);
  max-width: 600px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  word-break: break-all;
}

.stat-value.mono {
  font-size: 0.95rem;
  font-weight: 600;
}

/* BLOCKS TABLE */
.blocks-section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.live-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-light);
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.blocks-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.blocks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.blocks-table thead {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.blocks-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.blocks-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.blocks-table tr:last-child td {
  border-bottom: none;
}

.block-row.new-row {
  animation: flash-in 0.6s ease;
}

@keyframes flash-in {
  from { background: var(--purple-light); }
  to { background: transparent; }
}

.hash-cell {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.placeholder-row td {
  text-align: center;
  color: var(--text-tertiary);
  padding: 30px;
}

.type-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tag-pow {
  background: var(--blue-light);
  color: var(--blue);
}

.tag-pos {
  background: var(--purple-light);
  color: var(--purple);
}

/* INFO SECTION */
.info-section {
  margin-bottom: 28px;
}

.info-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow);
}

.info-key {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.info-val {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
}

/* FAUCET */
.faucet-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.faucet-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.faucet-card h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.faucet-sub {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 18px;
}

.faucet-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.faucet-form label {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.faucet-form input[type="text"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg);
  color: var(--text);
}

.faucet-form input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.btn-primary {
  padding: 10px 20px;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--purple-dark);
}

.faucet-info {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.faucet-info h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.faucet-info ol {
  padding-left: 18px;
}

.faucet-info li {
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

/* ALERTS */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 0.88rem;
}

.alert-ok {
  background: var(--green-light);
  color: var(--green);
  border: 1px solid #a7f3d0;
}

.alert-ok code {
  display: block;
  margin-top: 6px;
  word-break: break-all;
  font-size: 0.78rem;
  background: rgba(0,0,0,0.05);
  color: var(--green);
}

.alert-err {
  background: var(--red-light);
  color: var(--red);
  border: 1px solid #fecaca;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 0 16px 32px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .faucet-section { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
