@import url('https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500&family=Geist:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #000;
  --bg-1: #0a0a0a;
  --bg-2: #111;
  --bg-3: #1a1a1a;
  --border: #222;
  --border-bright: #333;
  --text: #ededed;
  --text-2: #888;
  --text-3: #555;
  --accent: oklch(65% 0.22 250);
  --accent-dim: oklch(65% 0.22 250 / 0.15);
  --green: oklch(72% 0.18 145);
  --green-dim: oklch(72% 0.18 145 / 0.15);
  --red: oklch(65% 0.22 25);
  --red-dim: oklch(65% 0.22 25 / 0.15);
  --yellow: oklch(80% 0.18 85);
  --yellow-dim: oklch(80% 0.18 85 / 0.15);
  --radius: 6px;
  --sidebar-w: 220px;
  --topbar-h: 52px;
  font-size: 14px;
}

:root.light {
  --bg: #ffffff;
  --bg-1: #f9f9f9;
  --bg-2: #f1f1f1;
  --bg-3: #e8e8e8;
  --border: #e0e0e0;
  --border-bright: #c8c8c8;
  --text: #0a0a0a;
  --text-2: #555;
  --text-3: #999;
  --accent: oklch(50% 0.22 250);
  --accent-dim: oklch(50% 0.22 250 / 0.12);
  --green: oklch(48% 0.18 145);
  --green-dim: oklch(48% 0.18 145 / 0.12);
  --red: oklch(50% 0.22 25);
  --red-dim: oklch(50% 0.22 25 / 0.12);
  --yellow: oklch(55% 0.18 85);
  --yellow-dim: oklch(55% 0.18 85 / 0.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-1);
}
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* Sidebar */
.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.sidebar-logo .logo-mark {
  width: 24px; height: 24px;
  background: var(--accent);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #000;
}
.sidebar-nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  cursor: pointer; color: var(--text-2); font-size: 13px;
  transition: background 0.1s, color 0.1s; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--bg-3); color: var(--text); }
.nav-item svg { flex-shrink: 0; }
.sidebar-bottom { padding: 12px 8px; border-top: 1px solid var(--border); }

/* Topbar */
.topbar-title { font-weight: 500; font-size: 14px; }
.topbar-spacer { flex: 1; }
.topbar-badge {
  font-size: 11px; font-family: 'Geist Mono', monospace;
  color: var(--text-2); background: var(--bg-3);
  border: 1px solid var(--border); border-radius: 4px; padding: 2px 8px;
}

/* Cards */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 13px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }

/* Grid */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }

/* Stat card */
.stat-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1; font-family: 'Geist Mono', monospace; }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 8px 12px;
  color: var(--text-2); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-2); }
.mono { font-family: 'Geist Mono', monospace; font-size: 12px; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 500;
}
.pill-green { background: var(--green-dim); color: var(--green); }
.pill-red { background: var(--red-dim); color: var(--red); }
.pill-yellow { background: var(--yellow-dim); color: var(--yellow); }
.pill-blue { background: var(--accent-dim); color: var(--accent); }
.pill-gray { background: var(--bg-3); color: var(--text-2); }

/* Log level */
.level-info { color: var(--text-2); }
.level-warning { color: var(--yellow); }
.level-error { color: var(--red); }
.level-debug { color: var(--text-3); }

/* Dot */
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--text-3); }
.dot-yellow { background: var(--yellow); }

/* Drawer */
.drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 100;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: 520px; background: var(--bg-1); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.drawer-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-title { font-size: 15px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; }
.drawer-close {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  padding: 4px; border-radius: 4px;
}
.drawer-close:hover { color: var(--text); background: var(--bg-3); }

/* Log entry */
.log-entry { padding: 10px 0; border-bottom: 1px solid var(--border); }
.log-entry:last-child { border-bottom: none; }
.log-entry-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.log-entry-time { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-3); }
.log-entry-message { font-size: 13px; color: var(--text-2); word-break: break-word; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border-bright);
  border-radius: var(--radius); padding: 12px 16px; font-size: 13px;
  min-width: 260px; max-width: 380px;
  animation: slide-in 0.2s ease;
}
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } }

/* Login */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--bg);
}
.login-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 40px; width: 360px;
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; font-weight: 600; font-size: 15px; }
.login-logo .logo-mark { width: 28px; height: 28px; background: var(--accent); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #000; }
.login-label { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.login-input {
  width: 100%; background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  font-size: 14px; font-family: inherit; outline: none; margin-bottom: 12px;
  transition: border-color 0.15s;
}
.login-input:focus { border-color: var(--border-bright); }
.btn-primary {
  width: 100%; background: var(--text); color: #000;
  border: none; border-radius: var(--radius); padding: 10px 16px;
  font-size: 14px; font-weight: 500; font-family: inherit;
  cursor: pointer; transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.login-error { color: var(--red); font-size: 12px; margin-bottom: 12px; }

/* Section header */
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.section-sub { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }

/* Empty */
.empty { padding: 48px; text-align: center; color: var(--text-3); font-size: 13px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-bright); border-radius: 3px; }

/* Refresh btn */
.btn-ghost {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 12px; color: var(--text-2); font-size: 12px; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s;
}
.btn-ghost:hover { border-color: var(--border-bright); color: var(--text); }

/* Search */
.search-input {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px; color: var(--text);
  font-size: 13px; font-family: inherit; outline: none; width: 240px;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--border-bright); }

/* Worker card */
.worker-card {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
}
.worker-type { font-size: 13px; font-weight: 500; }
.worker-id { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--text-3); }
