:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --accent: #6c7ee1;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

header h1 {
  font-size: 18px;
  font-weight: 600;
}

header h1 span {
  color: var(--accent);
}

.caddy-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.ok {
  background: var(--success);
}

.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.tab {
  padding: 10px 20px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel {
  display: none;
  padding: 20px 24px;
}

.panel.active {
  display: block;
}

/* Live Tail */
.tail-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.tail-controls button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.tail-controls button.paused {
  background: var(--warning);
  color: #000;
}

.tail-controls .count {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: auto;
}

#log-stream {
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  height: calc(100vh - 200px);
  overflow-y: auto;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-line {
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-line .ts { color: var(--text-muted); }
.log-line .method { color: var(--accent); font-weight: 600; }
.log-line .path { color: var(--text); }
.log-line .status-2xx { color: var(--success); }
.log-line .status-3xx { color: var(--info); }
.log-line .status-4xx { color: var(--warning); }
.log-line .status-5xx { color: var(--danger); }
.log-line .duration { color: var(--text-muted); }
.log-line .ip { color: var(--text-muted); }

/* Search */
.search-form {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-form input,
.search-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
}

.search-form input::placeholder {
  color: var(--text-muted);
}

.search-form button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

#search-results {
  background: #0a0c10;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
}

#search-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#search-results th {
  background: var(--surface);
  padding: 8px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 500;
  position: sticky;
  top: 0;
}

#search-results td {
  padding: 6px 12px;
  border-top: 1px solid var(--border);
  white-space: nowrap;
}

/* Dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.card h3 {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card canvas {
  max-height: 250px;
}

.stat-row {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 20px;
  flex: 1;
  text-align: center;
}

.stat-box .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.stat-box .label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
}
