/* GenesisPay admin — minimal, fast, dark/light. No animations beyond opacity. */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #14181f;
  --muted: #6b7482;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --tag-bg: #eef1f5;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  --bg: #0d1117;
  --panel: #161b22;
  --border: #2b323c;
  --text: #e6e9ee;
  --muted: #8b94a3;
  --accent: #3b82f6;
  --tag-bg: #1f2630;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 210px;
  flex: 0 0 210px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; padding: 4px 8px 16px; }
.brand span { color: var(--accent); }
.brand.big { font-size: 26px; text-align: center; padding-bottom: 4px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.sidebar nav a:hover { background: var(--tag-bg); color: var(--text); }
.sidebar nav a.active { background: var(--accent); color: var(--accent-text); }
.sidebar-foot { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.whoami { font-size: 12px; color: var(--muted); padding: 0 4px; }

/* Main */
.main { flex: 1; padding: 20px 24px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h1 { font-size: 20px; margin: 0; }
.global-search { display: flex; gap: 8px; flex: 1; max-width: 560px; }
.global-search input { flex: 1; }

/* Panels & grids */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}
.panel h2 { font-size: 14px; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.grid { display: grid; gap: 12px; }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { padding: 14px; border: 1px solid var(--border); border-radius: 10px; }
.stat .num { font-size: 24px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* Controls */
input, select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.wide { width: 100%; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { flex: 1; min-width: 140px; }

/* Tags & status pills */
.tag {
  display: inline-block;
  background: var(--tag-bg);
  border-radius: 6px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
}
.pill { display: inline-block; border-radius: 20px; padding: 2px 10px; font-size: 11px; font-weight: 700; }
.pill.ok, .pill.online, .pill.paid, .pill.credited, .pill.sent, .pill.confirmed, .pill.active { background: rgba(22,163,74,.12); color: var(--ok); }
.pill.warn, .pill.slow, .pill.pending, .pill.confirming, .pill.detected, .pill.underpaid { background: rgba(217,119,6,.12); color: var(--warn); }
.pill.bad, .pill.offline, .pill.failed, .pill.dead, .pill.manual_review, .pill.rejected, .pill.expired, .pill.cancelled, .pill.disabled { background: rgba(220,38,38,.12); color: var(--bad); }
.pill.unknown { background: var(--tag-bg); color: var(--muted); }

.muted { color: var(--muted); }
.alert { background: rgba(220,38,38,.1); color: var(--bad); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  max-width: 420px;
}
.toast.error { background: var(--bad); color: #fff; }

/* Search result */
.search-result { border-left: 4px solid var(--accent); }

/* Login */
.login-body { align-items: center; justify-content: center; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Pager */
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; flex-direction: row; align-items: center; position: static; flex-wrap: wrap; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { border-top: 0; flex-direction: row; align-items: center; }
}
