:root {
  --bg: #0f1115;
  --surface: #151a21;
  --surface-2: #1a2028;
  --border: #232a35;
  --text: #e6e9ef;
  --muted: #9aa4b2;

  --ok: #4aa38f;
  --warn: #caa252;
  --crit: #c45c5c;
  --info: #6b8bbf;

  --accent: #7b7fd1;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  padding: 22px;
  background: var(--bg);
  color: var(--text);
  font:
    16px/1.45 system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
}

#loginBox {
  max-width: 400px;
  margin: 0 auto;
  height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Header */
.header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pill {
  align-self: flex-start;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 20%, black);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, black);
  font-weight: 650;
  font-size: 13px;
}
.title h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.subtitle {
  color: var(--muted);
  font-size: 13px;
}
.right {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  color: var(--muted);
}
.clock {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  color: var(--text);
}
.updated {
  font-size: 13px;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18) inset;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.panel-actions {
  display: flex;
  gap: 10px;
}

.filters input {
  width: 260px;
  max-width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 10px;
  color: var(--text);
}

.btn {
  background: color-mix(in oklab, var(--accent) 18%, black);
  border: 1px solid color-mix(in oklab, var(--accent) 45%, black);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  font-weight: 650;
  cursor: pointer;
}
.btn:hover {
  filter: brightness(1.06);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn.danger {
  background: color-mix(in oklab, var(--crit) 18%, black);
  border: 1px solid color-mix(in oklab, var(--crit) 45%, black);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Cards inside form */
.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card {
  background: color-mix(in oklab, var(--surface) 85%, black);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.card-title {
  font-weight: 750;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.row {
  display: grid;
  gap: 10px;
}
.row-3 {
  grid-template-columns: repeat(3, 1fr);
}
.row-2 {
  grid-template-columns: 1fr auto;
  align-items: end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
input,
select,
textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 10px;
  color: var(--text);
  outline: none;
}
textarea {
  resize: vertical;
  min-height: 72px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: color-mix(in oklab, var(--accent) 60%, var(--border));
}

/* Segmented severity */
.segmented {
  display: flex;
  gap: 8px;
  background: transparent;
}
.seg {
  flex: 1;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 750;
  cursor: pointer;
}
.seg.active[data-sev="info"] {
  border-color: color-mix(in oklab, var(--info) 60%, var(--border));
}
.seg.active[data-sev="warn"] {
  border-color: color-mix(in oklab, var(--warn) 60%, var(--border));
}
.seg.active[data-sev="crit"] {
  border-color: color-mix(in oklab, var(--crit) 60%, var(--border));
}

/* Switch */
.field.inline {
  align-items: flex-start;
}
.switch {
  position: relative;
  display: inline-block;
  width: 56px;
  height: 32px;
}
.switch input {
  display: none;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: 0.2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 24px;
  width: 24px;
  left: 4px;
  top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider {
  border-color: color-mix(in oklab, var(--ok) 55%, var(--border));
}
.switch input:checked + .slider:before {
  transform: translateX(22px);
}

/* Existing list */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding-right: 4px;
}
.ex-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in oklab, var(--surface) 75%, black);
  padding: 10px;
  cursor: pointer;
}
.ex-item:hover {
  filter: brightness(1.05);
}
.ex-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.badge[data-sev="info"] .dot {
  background: var(--info);
}
.badge[data-sev="warn"] .dot {
  background: var(--warn);
}
.badge[data-sev="crit"] .dot {
  background: var(--crit);
}

.ex-title {
  font-weight: 800;
}
.ex-meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}
.ex-desc {
  margin-top: 6px;
  color: color-mix(in oklab, var(--text) 86%, black);
  font-size: 13px;
}

/* Danger card */
.card.danger {
  border-color: color-mix(in oklab, var(--crit) 40%, var(--border));
}
.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

#entryList {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Responsive */
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .filters input {
    width: 100%;
  }
}
@media (max-width: 760px) {
  .row-3 {
    grid-template-columns: 1fr;
  }
}
