/* ═══════════════════════════════════════════════════════════════
   TRQ Extractor — admin UI stylesheet
   Theme: dark, Inter sans + JetBrains mono. Minimal, dense.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0a0a0b;
  --panel:       #111116;
  --panel-2:     #15151c;
  --border:      #232330;
  --fg:          #e7e9ee;
  --muted:       #7c8591;
  --accent:      #38bdf8;
  --accent-dim:  #1d4ed880;
  --ok:          #22c55e;
  --off:         #4b5563;
  --warn:        #f59e0b;
  --err:         #ef4444;
  --mono:        "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans:        "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius:      8px;
  --radius-sm:   6px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }
code {
  background: rgba(255,255,255,0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ──── Layout shell (sidebar + main) ──── */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.brand-mark {
  display: inline-flex;
  width: 32px; height: 32px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: var(--accent);
}
.brand-mark.big { width: 56px; height: 56px; border-radius: 12px; }
.brand-name { font-weight: 700; letter-spacing: -0.02em; }
.brand-sub  { color: var(--muted); font-size: 0.78rem; font-family: var(--mono); margin-top: 2px; }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-section-label {
  color: var(--muted);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-weight: 500;
  transition: background 80ms ease;
}
.nav-item:hover { background: rgba(255,255,255,0.03); text-decoration: none; }
.nav-item.active {
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
}
.nav-ico { display: inline-flex; opacity: 0.85; }

.sidebar-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.user-block {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--panel-2); color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 0.85rem;
}
.user-info { overflow: hidden; }
.user-email { font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role {
  font-size: 0.7rem;
  padding: 1px 6px;
  display: inline-block;
  border-radius: 4px;
  margin-top: 2px;
}
.role-admin  { background: rgba(34, 197, 94, 0.15); color: var(--ok); }
.role-member { background: rgba(124, 133, 145, 0.2); color: var(--muted); }

/* ──── Main area ──── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.page-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.page-sub   { margin: 4px 0 0; font-size: 0.85rem; }
.topbar-status {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-family: var(--mono);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}

.page { padding: 24px 28px 60px; max-width: 1200px; }

/* ──── Cards ──── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 22px;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.card-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card-head .muted { font-weight: 400; }

/* ──── Tables ──── */
table.strategies {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.strategies th, .strategies td {
  padding: 10px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.strategies th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}
.strategies tbody tr:last-child td { border-bottom: none; }
.strategies tbody tr:hover { background: rgba(255,255,255,0.015); }

/* ──── Settings list rows (key/value with meta) ──── */
.settings-list { display: flex; flex-direction: column; }
.settings-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-main { flex: 1; min-width: 0; }
.settings-row-label {
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 4px;
}
.settings-row-desc { color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }
.settings-row-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  color: var(--muted); font-size: 0.75rem;
  font-family: var(--mono);
}
.settings-row-key { color: var(--accent); }
.settings-row-actions { display: flex; gap: 8px; flex-shrink: 0; }

.settings-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px;
  color: var(--muted);
}

/* ──── Pills ──── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}
.pill-on   { background: rgba(34, 197, 94, 0.12); color: var(--ok); }
.pill-off  { background: rgba(75, 85, 99, 0.22); color: var(--muted); }
.pill-info { background: rgba(56, 189, 248, 0.12); color: var(--accent); }
.pill-warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.pill-err  { background: rgba(239, 68, 68, 0.15); color: var(--err); }

/* ──── Chips (provider tags etc.) ──── */
.provider-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--fg);
}
.chip-primary {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.35);
  color: var(--accent);
}

textarea.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* ──── Stat grid (keeper summary, etc.) ──── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px 18px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
}
.stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stat-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--fg);
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}

/* ──── RPC pool / overview card ──── */
.rpc-pool { padding: 14px 18px; }
.rpc-chain {
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.rpc-chain:last-child { border-bottom: none; }
.rpc-chain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.rpc-chain-name {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
}
.rpc-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.rpc-provider {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.74rem;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.rpc-provider .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
}
.rpc-provider.unhealthy .dot {
  background: var(--err);
  box-shadow: 0 0 6px var(--err);
}
.rpc-provider .transport {
  color: var(--muted);
  font-size: 0.66rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
}

/* ──── Buttons ──── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1;
  transition: background 80ms ease, border-color 80ms ease;
}
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-primary {
  background: var(--accent);
  color: #07131a;
}
.btn-primary:hover { background: #62ccfa; }
.btn-secondary {
  background: rgba(255,255,255,0.04);
  border-color: var(--border);
  color: var(--fg);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--fg); background: rgba(255,255,255,0.04); }

/* ──── Forms ──── */
.field { display: flex; flex-direction: column; margin-bottom: 14px; }
.field-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}
input, textarea, select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 0.9rem;
}
textarea { font-family: var(--mono); resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* ──── Modal ──── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  width: min(520px, 92vw);
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 12px;
}

/* ──── Toast ──── */
.toast-host {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 100;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.87rem;
  transform: translateX(60px);
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-ok    { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--err); }
.toast-info  { border-left: 3px solid var(--accent); }

/* ──── Login ──── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(800px at 20% 10%, rgba(56,189,248,0.12), transparent),
    radial-gradient(600px at 80% 70%, rgba(34,197,94,0.08), transparent),
    var(--bg);
}
.login-card {
  width: min(420px, 92vw);
  padding: 36px 32px 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}
.login-brand { text-align: center; margin-bottom: 20px; }
.login-brand h1 { font-size: 1.3rem; margin: 16px 0 4px; }
.login-brand p  { margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-foot {
  text-align: center;
  margin-top: 16px;
  font-size: 0.76rem;
  display: inline-flex; align-items: center; gap: 6px;
  width: 100%;
  justify-content: center;
}
.error-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

/* ──── Utility ──── */
.muted  { color: var(--muted); }
.small  { font-size: 0.78rem; }
.center { text-align: center; }
.pad    { padding: 40px 20px; }

.ico { vertical-align: middle; flex-shrink: 0; }

h1, h2, h3 { letter-spacing: -0.01em; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar   { display: none; }
}
