:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.09);
  --text: #e9eef8;
  --muted: rgba(233, 238, 248, 0.72);
  --border: rgba(255, 255, 255, 0.12);
  --focus: rgba(70, 153, 255, 0.45);
  --primary: #3b82f6;
  --danger: #ef4444;
  --ok: #22c55e;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 30% 10%, rgba(59,130,246,0.22), transparent 55%),
              radial-gradient(900px 700px at 80% 40%, rgba(34,197,94,0.12), transparent 60%),
              var(--bg);
  color: var(--text);
}

.wrap { max-width: 860px; margin: 0 auto; padding: 18px 14px 48px; }
.header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 8px 4px 18px; }
.header h1 { margin: 0; font-size: 28px; letter-spacing: 0.2px; }
.sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.headerRight { display: flex; align-items: center; gap: 10px; }
.whoami { font-size: 12px; color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card {
  background: linear-gradient(180deg, var(--panel), rgba(255,255,255,0.03));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
  margin: 12px 0;
}
.card h2 { margin: 0 0 8px; font-size: 18px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.grow { flex: 1; min-width: 220px; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
}
.span2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
input {
  background: rgba(0,0,0,0.22);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 16px;
  outline: none;
}
input:focus { border-color: rgba(59,130,246,0.65); box-shadow: 0 0 0 4px var(--focus); }

.textarea {
  background: rgba(0,0,0,0.22);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 12px;
  font-size: 14px;
  line-height: 1.35;
  outline: none;
  resize: vertical;
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
.textarea:focus { border-color: rgba(59,130,246,0.65); box-shadow: 0 0 0 4px var(--focus); }

.btn {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: rgba(59,130,246,0.22); border-color: rgba(59,130,246,0.45); }
.btn.secondary { background: rgba(255,255,255,0.04); }
.btn.danger { background: rgba(239,68,68,0.18); border-color: rgba(239,68,68,0.4); }

.msg { margin-top: 10px; min-height: 18px; color: var(--muted); font-size: 13px; }
.msg.ok { color: rgba(34,197,94,0.9); }
.msg.err { color: rgba(239,68,68,0.95); }

.cardHead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pill {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.pill.ok { color: rgba(34,197,94,0.95); border-color: rgba(34,197,94,0.35); background: rgba(34,197,94,0.12); }
.pill.bad { color: rgba(239,68,68,0.95); border-color: rgba(239,68,68,0.35); background: rgba(239,68,68,0.12); }

.tableWrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 10px 10px; border-top: 1px solid var(--border); vertical-align: top; }
.table th { text-align: left; color: var(--muted); font-weight: 600; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; }
.table td.actions, .table th.actions { width: 120px; text-align: right; }
.table td.notes { color: var(--muted); }

.chart { margin: 10px 0 6px; }
.chart svg { width: 100%; height: 120px; display: block; }

.footer { margin-top: 14px; padding: 10px 6px; }

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
  .span2 { grid-column: 1; }
  .header { align-items: stretch; flex-direction: column; }
  .headerRight { justify-content: space-between; }
}

