:root {
  --bg: #0f1a24;
  --panel: #1a2b3a;
  --text: #e8eef4;
  --muted: #9bb0c3;
  --accent: #2f8f6b;
  --accent-dark: #1f5f48;
  --error: #c45c5c;
  --ok: #3d9a6a;
  --border: #2c4258;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at top, #1c3348 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.panel {
  width: min(420px, 100%);
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.panel-wide {
  width: min(560px, 100%);
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 650;
}

label {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0;
  font-size: 0.9rem;
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #0d1620;
  color: var(--text);
}

select {
  appearance: auto;
  cursor: pointer;
}

button {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
}

a.btn,
button.btn {
  display: block;
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.actions {
  margin: 0.5rem 0 0;
}

a.btn.btn-compact {
  padding: 0.35rem 1rem;
  font-size: 0.9rem;
}

a.btn.btn-dark {
  background: var(--accent-dark);
}

button:hover,
a.btn:hover { filter: brightness(1.05); }

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary,
.secondary-form button,
a.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-weight: 500;
}

.muted { color: var(--muted); font-size: 0.92rem; }
.mono { font-family: ui-monospace, Consolas, monospace; word-break: break-all; }
.error { color: var(--error); }
.ok { color: var(--ok); }
.badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #24384c;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 1rem auto;
  background: white;
  border-radius: 8px;
  padding: 0.5rem;
}

a { color: #7ec8ff; }

.table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
}

.data-table td.payload {
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 28rem;
}

.data-table td.ts {
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}

.data-table td.ts .ts-date,
.data-table td.ts .ts-time {
  display: block;
  white-space: nowrap;
}

.data-table .empty-row td {
  color: var(--muted);
  font-style: italic;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 0.75rem;
}

.inline-actions .btn,
a.btn.btn-inline,
button.btn-inline {
  width: auto;
  margin-top: 0;
  display: inline-block;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
}

.field-with-action {
  display: grid;
  gap: 0.5rem;
}

.field-with-action .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.field-with-action .row select {
  flex: 1 1 12rem;
}

.field-with-action .row .btn {
  flex: 0 0 auto;
  width: auto;
  margin-top: 0;
  align-self: center;
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
}

