*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel2: #1c222b;
  --border: #2a3038;
  --fg: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --ok: #3fb950;
  --warn: #d29922;
  --err: #f85149;
}

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; font-size: 14px; }
code { font-family: 'SF Mono', Menlo, monospace; font-size: 13px; }
.muted { color: var(--muted); }

header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 1.1rem; margin: 0; }
header .conn { margin-left: auto; padding: 0.2rem 0.6rem; border-radius: 999px; background: var(--panel2); font-size: 12px; }
header .conn.ok { color: var(--ok); }
header .conn.bad { color: var(--err); }

nav#tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); padding: 0 1.5rem; background: var(--panel); }
nav#tabs .tab {
  background: transparent; border: 0; color: var(--muted); padding: 0.7rem 1rem;
  border-bottom: 2px solid transparent; cursor: pointer; font: inherit;
}
nav#tabs .tab:hover { color: var(--fg); }
nav#tabs .tab.active { color: var(--fg); border-bottom-color: var(--accent); }
nav#tabs .count { display: inline-block; min-width: 1.2rem; padding: 0 0.3rem; margin-left: 0.3rem; background: var(--panel2); border-radius: 999px; font-size: 11px; color: var(--muted); }

main { padding: 1.5rem; }
.panel { display: none; }
.panel.active { display: block; }

.row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.row.right { justify-content: flex-end; }
.filters { display: flex; gap: 0.5rem; margin-left: auto; }

table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
th, td { padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
th { background: var(--panel2); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }
tbody tr:hover { background: var(--panel2); }
.right { text-align: right; }

.status { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.status.Pending  { background: rgba(210, 153, 34, 0.15); color: var(--warn); }
.status.Settled  { background: rgba(63, 185, 80, 0.15); color: var(--ok); }
.status.Failed   { background: rgba(248, 81, 73, 0.15); color: var(--err); }
.status.Declined { background: rgba(248, 81, 73, 0.15); color: var(--err); }
.dir-in  { color: var(--ok); }
.dir-out { color: var(--warn); }

button {
  background: var(--accent); color: #0e1116; border: 0; padding: 0.5rem 0.9rem; border-radius: 5px; cursor: pointer; font: inherit; font-weight: 600;
}
button:hover { filter: brightness(1.1); }
button[value="cancel"], button.secondary {
  background: var(--panel2); color: var(--fg); border: 1px solid var(--border);
}
button.danger { background: var(--err); }
button.row-action { padding: 0.25rem 0.55rem; font-size: 12px; }

input, select {
  background: var(--bg); color: var(--fg); border: 1px solid var(--border); padding: 0.5rem; border-radius: 5px; font: inherit; width: 100%;
}
label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 12px; color: var(--muted); margin-bottom: 0.7rem; }
label input, label select { color: var(--fg); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1rem; }
.card h3 { margin: 0 0 0.7rem 0; font-size: 14px; }
.card .hint { font-size: 11px; color: var(--muted); margin: 0.3rem 0 0.7rem 0; }

dialog {
  background: var(--panel); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; min-width: 420px; max-width: 720px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h3 { margin-top: 0; }

article pre { background: var(--bg); padding: 0.75rem; border: 1px solid var(--border); border-radius: 5px; overflow: auto; font-size: 12px; max-height: 50vh; }

.toast {
  position: fixed; bottom: 1rem; right: 1rem; background: var(--panel); border: 1px solid var(--border); border-radius: 6px;
  padding: 0.7rem 1rem; max-width: 380px; z-index: 1000; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.toast.ok  { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
.toast .ttype { display: block; font-size: 11px; color: var(--muted); margin-bottom: 0.2rem; }

.flash { animation: flash 1.2s ease-out; }
@keyframes flash {
  0%   { background: rgba(88, 166, 255, 0.4); }
  100% { background: transparent; }
}
