:root {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-2: #f4f4f5;
  --border: #e4e4e7;
  --border-soft: #f4f4f5;
  --text: #09090b;
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --accent: #18181b;
  --accent-dark: #09090b;
  --accent-2: #27272a;
  --selected: #f4f4f5;
  --selected-text: #09090b;
  --hover: #f4f4f5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --ok: #16a34a;
  --ring: #18181b;
  --font: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Cascadia Code", "Roboto Mono", Consolas, ui-monospace, monospace;
  --radius: 8px;
  --radius-sm: 6px;
}

:root.dark {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #09090b;
  --panel-2: #18181b;
  --border: #27272a;
  --border-soft: #1f1f23;
  --text: #fafafa;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --accent: #fafafa;
  --accent-dark: #fafafa;
  --accent-2: #e4e4e7;
  --selected: #27272a;
  --selected-text: #fafafa;
  --hover: #18181b;
  --danger: #f87171;
  --danger-bg: #450a0a;
  --ok: #4ade80;
  --ring: #fafafa;
}

* {
  box-sizing: border-box;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  width: 100%;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 0;
}

.nav-link {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.topbar-spacer {
  flex: 1;
  min-width: 8px;
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
}

.icon-button:hover {
  background: var(--hover);
  color: var(--text);
}

.refresh-button,
.text-button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-weight: 500;
  white-space: nowrap;
}

.refresh-button:hover,
.text-button:hover {
  background: var(--hover);
}

.refresh-button:disabled,
.text-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.sync-state,
.status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot,
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.status-dot.offline,
.dot.offline {
  background: var(--danger);
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
  }

  .primary-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-link {
    flex: 0 0 auto;
  }
}
