/* Deliberately dark-only: this is a log console, and a light theme would be a
   worse tool for the job. No CDN — everything here ships inside the binary. */
:root {
  --bg: #0b0e14;
  --bg-raised: #11151f;
  --bg-hover: #161b27;
  --border: #222836;
  --text: #c9d1d9;
  --text-dim: #6e7891;
  --accent: #4c9aff;
  --trace: #6e7891;
  --debug: #8b93a7;
  --info: #4ec9b0;
  --warn: #e3b341;
  --error: #f85149;
  --ok: #3fb950;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* ---- top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.brand span { color: var(--accent); }
.logo { width: 18px; height: 18px; display: block; border-radius: 4px; margin-right: 7px; }
.logo-lg { width: 52px; height: 52px; display: block; margin-bottom: 14px; border-radius: 11px; }

.nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
}
.nav-link:hover { color: var(--text); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); }
.card a { color: var(--accent); }

.spacer { flex: 1; }

/* ---- controls ---- */
input[type="text"], input[type="password"], select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
input[type="text"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--accent);
}
#search { min-width: 200px; flex: 1 1 200px; }

button {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover { background: var(--bg-hover); border-color: #333d52; }
button.on { border-color: var(--accent); color: var(--accent); }
button.danger:hover { border-color: var(--error); color: var(--error); }
button.primary { background: var(--accent); border-color: var(--accent); color: #06101f; font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }

/* ---- connection status ---- */
.status { display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.dot.live { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.paused { background: var(--warn); }
.dot.down { background: var(--error); }

/* ---- log list ---- */
#logs { flex: 1; overflow-y: auto; overflow-x: hidden; }

.row {
  display: grid;
  grid-template-columns: 92px 54px minmax(0, auto) 1fr;
  gap: 10px;
  padding: 3px 14px;
  border-bottom: 1px solid rgba(34, 40, 54, .5);
  align-items: baseline;
}
.row:hover { background: var(--bg-hover); }
.row.expandable { cursor: pointer; }

.ts { color: var(--text-dim); white-space: nowrap; font-size: 12px; }
.lvl { font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.lvl-0 { color: var(--trace); }
.lvl-1 { color: var(--debug); }
.lvl-2 { color: var(--info); }
.lvl-3 { color: var(--warn); }
.lvl-4 { color: var(--error); }
.row.lvl-row-4 { background: rgba(248, 81, 73, .07); }
.row.lvl-row-3 { background: rgba(227, 179, 65, .05); }

.meta { color: var(--accent); white-space: nowrap; opacity: .85; font-size: 12px; }
.meta .dev { color: var(--text-dim); }

.msg { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.msg.collapsed { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caret { color: var(--text-dim); margin-right: 4px; display: inline-block; width: 10px; }

/* ---- status bar ---- */
.statusbar a { color: var(--text-dim); }
.statusbar a:hover { color: var(--accent); }
.statusbar {
  display: flex;
  gap: 16px;
  padding: 5px 14px;
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  flex-wrap: wrap;
}

.empty { padding: 40px 14px; color: var(--text-dim); text-align: center; }

.support-line { color: var(--text-dim); font-size: 12px; margin-top: 28px; }
.support-line a { color: var(--text-dim); }
.support-line a:hover { color: var(--accent); }

/* ---- centred card, used by the login page ---- */
.center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  width: 100%;
  max-width: 420px;
}
.card h1 { margin: 0 0 6px; font-size: 18px; }
.card p { margin: 0 0 18px; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.card input { width: 100%; margin-bottom: 12px; padding: 9px 10px; font-size: 13px; }
.card button { width: 100%; padding: 9px; font-size: 13px; }
.error-msg { color: var(--error); font-size: 12px; margin-top: 12px; min-height: 16px; }

/* ---- tables, used by the devices page ---- */
.wrap { flex: 1; overflow: auto; padding: 20px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .4px; }
td.dim, .dim { color: var(--text-dim); }
tr.revoked td { opacity: .45; }

.token-box {
  background: var(--bg);
  border: 1px solid var(--ok);
  border-radius: 6px;
  padding: 12px;
  margin: 14px 0;
  /* pre-wrap so the multi-line curl example keeps its line breaks, and
     break-word so a long token still wraps instead of overflowing. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ok);
  line-height: 1.6;
}
.hint { color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.row-form { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.row-form input { flex: 1 1 160px; }
code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
