:root {
  --bg: #0a1017;
  --panel: #111923;
  --panel-alt: #16202d;
  --border: #223042;
  --text: #e5edf5;
  --muted: #8ea0b5;
  --green: #10b981;
  --green-bg: rgba(16, 185, 129, 0.14);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.14);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.14);
  --cyan: #38bdf8;
  --cyan-bg: rgba(56, 189, 248, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 16, 23, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16px;
}

.dot-live {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.dot-live.paused {
  background: var(--amber);
  box-shadow: none;
}

.infra-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.infra-strip span {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--cyan-bg);
  color: var(--cyan);
}

.badge-live {
  background: var(--red-bg);
  color: var(--red);
}

.badge-green {
  background: var(--green-bg);
  color: var(--green);
}

.badge-red {
  background: var(--red-bg);
  color: var(--red);
}

.badge-amber {
  background: var(--amber-bg);
  color: var(--amber);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--cyan);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #041019;
}

.btn-warn {
  background: var(--amber-bg);
  border-color: var(--amber);
  color: var(--amber);
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.full-width {
  width: 100%;
}

.alert {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--amber);
  background: var(--amber-bg);
  color: #fde68a;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
}

.metric-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.muted {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}

.wallet-chip {
  font-size: 12px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
}

.presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.preset-card {
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.preset-card.active {
  border-color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.35);
}

.preset-title {
  font-weight: 700;
  font-size: 14px;
}

.auditor-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

input[type="text"],
input[type="number"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.auditor-bar input[type="text"] {
  flex: 1;
  min-width: 260px;
}

.small-input {
  width: 190px;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.audit-preview {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.tab.active {
  background: var(--panel);
  border-color: var(--border);
  color: var(--cyan);
}

.tab-panel {
  display: none;
}

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

.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}

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

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  background: var(--panel-alt);
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.text-cyan { color: var(--cyan); }

.reason-list {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

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

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-card h2 {
  margin: 0;
  font-size: 18px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.error-text {
  color: var(--red);
  font-size: 12px;
}

a {
  color: var(--cyan);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
