:root {
  --bg: #1a1f24;
  --panel: #242b33;
  --line: #3a4550;
  --text: #e8eef2;
  --muted: #9aabba;
  --accent: #2f9e7b;
  --accent-hover: #268a6a;
  --danger: #c45c5c;
  --warn: #c4a35a;
  --open: #d4a017;
  --closed: #2f9e7b;
  --font: "Segoe UI", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", "SFMono-Regular", monospace;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 10% -10%, #2a3a40 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #243038 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}
button, input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
}
button:hover { border-color: #5a6a78; }
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #062018;
  font-weight: 600;
}
button.primary:hover { background: var(--accent-hover); }
button.danger { border-color: var(--danger); color: #f0c0c0; }
button.ghost { background: transparent; }
button.active, .filter.active, .tab.active {
  border-color: var(--accent);
  color: #b8f0dc;
}
input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #151a1f;
}
label { display: block; margin-bottom: 0.9rem; font-size: 0.9rem; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: #ffb4b4; margin-top: 0.75rem; }
.panel {
  background: color-mix(in srgb, var(--panel) 92%, black);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.5rem;
}
.login-panel {
  width: min(380px, calc(100% - 2rem));
  margin: 12vh auto;
}
.login-panel h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
.login-panel button[type="submit"] {
  width: 100%;
  margin-top: 0.4rem;
  background: var(--accent);
  border-color: var(--accent);
  color: #062018;
  font-weight: 600;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}
.tabs { display: flex; gap: 0.4rem; }
.badge {
  margin-left: 0.6rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.on { border-color: var(--accent); color: #b8f0dc; }
.badge.off { border-color: var(--warn); color: #f0dfb0; }
.content { padding: 1rem 1.2rem 2rem; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.filters { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #2c3540; }
tbody tr.selected { background: #314038; }
.status-pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.8rem;
}
.status-pill.open { background: #3a3218; color: #f0d48a; }
.status-pill.closed { background: #1a3a30; color: #9ee0c8; }
.detail {
  margin-top: 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #171c21;
  padding: 1rem;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.detail-head h2 { margin: 0; font-size: 1.1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.9rem 0; }
.json {
  margin: 0;
  padding: 0.9rem;
  overflow: auto;
  max-height: 55vh;
  background: #101418;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.empty { padding: 1.5rem; color: var(--muted); }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
