:root {
  --bg0: #08090c;
  --bg1: #10131a;
  --line: #1e2430;
  --text: #e6e9ef;
  --muted: #7a8499;
  --accent: #f0b429;
  --accent-dim: #8a6a1f;
  --danger: #ff5c5c;
  --ok: #3ddc97;
  --warn: #ffc14d;
  --info: #6eb5ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg0);
  color: var(--text);
}

code, .mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

/* —— Auth —— */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-grid {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(240, 180, 41, 0.12), transparent 45%),
    radial-gradient(ellipse at 80% 70%, rgba(110, 181, 255, 0.08), transparent 40%),
    linear-gradient(145deg, var(--bg0) 0%, #0c0e14 50%, var(--bg1) 100%);
  z-index: 0;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: min(420px, 92vw);
  padding: 2.5rem 2.25rem;
  background: rgba(16, 19, 26, 0.85);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.auth-kicker {
  font-size: 0.7rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.auth-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 2.25rem;
  font-weight: 400;
  margin: 0 0 0.75rem;
  line-height: 1.1;
}

.auth-sub {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1.5rem;
}

.auth-sub code {
  font-size: 0.8em;
  color: var(--accent-dim);
}

.auth-error {
  background: rgba(255, 92, 92, 0.12);
  border: 1px solid rgba(255, 92, 92, 0.35);
  color: #ffb4b4;
  padding: 0.65rem 0.85rem;
  border-radius: 3px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.auth-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-form input {
  background: var(--bg0);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.65rem 0.75rem;
  border-radius: 3px;
  font-family: inherit;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: normal;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--accent) 0%, #c99210 100%);
  border: none;
  border-radius: 3px;
  color: #1a1408;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  filter: brightness(1.06);
}

/* —— Dashboard —— */
.dash-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg0);
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 100%);
}

.dash-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dash-mark {
  width: 10px;
  height: 42px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 100%);
  border-radius: 2px;
}

.dash-brand h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.dash-tagline {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.dash-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.refresh-hint {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.user-pill {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.btn-ghost {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  padding: 0.4rem 0.65rem;
}
.btn-ghost:hover { color: var(--text); }

.dash-toolbar {
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.filters select {
  background: var(--bg1);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-family: inherit;
  min-width: 8rem;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 3px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-secondary:hover {
  border-color: var(--muted);
}

.ingest-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  max-width: 28rem;
  line-height: 1.4;
}
.ingest-hint code { color: var(--accent-dim); }

.log-scroller {
  flex: 1;
  overflow: auto;
  padding: 0 0 2rem;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.log-table thead {
  position: sticky;
  top: 0;
  background: var(--bg0);
  z-index: 2;
  box-shadow: 0 1px 0 var(--line);
}

.log-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.log-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.log-table th.sortable:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.log-table th.sort-active {
  color: var(--accent);
}
.sort-icon {
  font-size: 0.8rem;
  vertical-align: middle;
}

.log-table td {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.col-exp {
  width: 1.75rem;
  padding-left: 0.5rem !important;
  padding-right: 0.25rem !important;
  vertical-align: middle;
}
.col-time { width: auto; min-width: 14rem; }
.col-svc { width: 7rem; }
.col-lvl { width: 5.5rem; }
.col-logger { width: 12rem; }

.time-cell {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.35;
  white-space: nowrap;
}

.log-row-main.log-row--clickable {
  cursor: pointer;
  transition: background 0.12s ease;
}
.log-row-main.log-row--clickable:hover {
  background: rgba(255, 255, 255, 0.035);
}
.log-row-open {
  background: rgba(240, 180, 41, 0.07);
}

.chevron {
  display: inline-block;
  transition: transform 0.18s ease;
  color: var(--accent);
  font-size: 0.7rem;
  vertical-align: middle;
}
.log-row-open .chevron {
  transform: rotate(90deg);
}

.log-row-detail td {
  padding: 0 !important;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
}

.detail-json {
  margin: 0;
  padding: 0.75rem 1rem 1rem 2.25rem;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  max-height: min(70vh, 520px);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-clip {
  max-width: 42rem;
  max-height: 2.8em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  white-space: normal;
}

.muted { color: var(--muted); }
.small { font-size: 0.78rem; }

.svc-tag {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: rgba(110, 181, 255, 0.1);
  color: var(--info);
  font-size: 0.75rem;
  font-weight: 600;
}

.lvl {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.lvl-DEBUG { color: var(--muted); }
.lvl-INFO { color: var(--info); }
.lvl-WARNING { color: var(--warn); }
.lvl-ERROR, .lvl-CRITICAL { color: var(--danger); }

.msg {
  word-break: break-word;
  white-space: pre-wrap;
  line-height: 1.45;
}

.exc {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 92, 92, 0.08);
  border-left: 2px solid var(--danger);
  font-size: 0.75rem;
  color: #ffb4b4;
  overflow-x: auto;
}

.btn-danger {
  background: rgba(255, 92, 92, 0.1);
  border: 1px solid rgba(255, 92, 92, 0.3);
  color: #ffb4b4;
  padding: 0.45rem 0.85rem;
  border-radius: 3px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.dash-pagination {
  padding: 2rem;
  display: flex;
  justify-content: center;
}
