/* ==================================================================
   Ontology — styles.css
   Visual language modeled after app.shoal.xyz (master-shoal-repo).
   Dark theme, orange accent (#ff5722), 220px sidebar, 52px header.
   ================================================================== */

:root {
  --bg: #0a0a0a;
  --bg-raised: #111111;
  --bg-alt: #181818;
  --bg-sunken: #050505;

  --border-subtle: #1a1a1a;
  --border: #262626;
  --border-strong: #30323E;
  --border-scroll: #2e303b;

  --accent: #ff5722;
  --accent-soft: rgba(255, 87, 34, 0.08);
  --accent-softer: rgba(255, 87, 34, 0.055);
  --accent-mid: rgba(255, 87, 34, 0.24);
  --accent-glow: 0 10px 26px -10px rgba(255, 87, 34, 0.55);

  --text: #f5f5f5;
  --text-2: #a3a3a3;
  --text-3: #737373;
  --placeholder: #9e9e9e;

  --ok: #3af0a1;
  --warn: #f5b648;
  --danger: #f04a5f;
  --info: #6eb3f7;

  --sidebar-w: 220px;
  --sidebar-w-sm: 56px;
  --header-h: 52px;

  --radius-sm: 4px;
  --radius: 7px;
  --radius-lg: 12px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 0.22s ease-out;
  --t: 0.32s var(--ease);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
  --font-chrome: 'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --font-brand: 'Instrument Serif', 'Fraunces', Georgia, serif;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  overscroll-behavior: none;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-scroll); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: #fff; }

::selection { background: var(--accent-mid); color: var(--text); }

@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
@keyframes softAppear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───── Layout shell ───── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 999;
  transition: width var(--t);
  font-family: var(--font-chrome);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-w-sm); }

.sidebar-top {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 12px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-bottom {
  flex: 0 0 auto;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 14px;
  user-select: none;
  cursor: default;
}
.logo-icon {
  width: 22px; height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}
.logo-text {
  font-family: var(--font-brand);
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  transition: opacity 0.3s ease-out;
}
.sidebar.collapsed .logo-text { opacity: 0; }

.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-section-label {
  font-family: var(--font-chrome);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 10px 6px;
  white-space: nowrap;
  transition: opacity 0.3s ease-out;
}
.sidebar.collapsed .nav-section-label { opacity: 0; height: 6px; padding: 0; overflow: hidden; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 450;
  letter-spacing: 0.003em;
  white-space: nowrap;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg {
  width: 16px; height: 16px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity var(--t-fast), color var(--t-fast);
}
.nav-item:hover { background: rgba(255, 255, 255, 0.028); color: var(--text); }
.nav-item:hover svg { opacity: 0.9; }
.nav-item.active {
  background: var(--accent-softer);
  color: var(--text);
}
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 20px;
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(255, 87, 34, 0.5);
}
.sidebar.collapsed .nav-item { padding: 0 0 0 18px; }
.sidebar.collapsed .nav-item > *:not(svg):not(.nav-badge) { opacity: 0; width: 0; overflow: hidden; }

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--accent);
  color: #140700;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.nav-badge:empty { display: none; }
.sidebar.collapsed .nav-badge { display: none; }

.user-info {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 6px;
  border-radius: var(--radius);
  transition: background var(--t-fast);
}
.user-info:hover { background: rgba(255, 255, 255, 0.025); }
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.user-email {
  font-size: 11.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar.collapsed .user-email { display: none; }

.sidebar-auth-link {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 11.5px;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.sidebar-auth-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.sidebar-auth-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border-strong);
}
.sidebar.collapsed .sidebar-auth-link {
  justify-content: center;
  padding: 0;
}
.sidebar.collapsed .sidebar-auth-link > :not(svg) {
  display: none;
}

.collapse-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-3);
  font-size: 11.5px;
  transition: background var(--t-fast), color var(--t-fast);
}
.collapse-btn:hover { background: rgba(255, 255, 255, 0.03); color: var(--text); }
.collapse-btn svg { width: 14px; height: 14px; transition: transform var(--t); }
.sidebar.collapsed .collapse-btn svg { transform: rotate(180deg); }
.sidebar.collapsed .collapse-btn > :not(svg) { display: none; }

/* ───── Main + header ───── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--t);
}
.sidebar.collapsed + .main,
body.sidebar-collapsed .main { margin-left: var(--sidebar-w-sm); }

.main-header {
  position: sticky;
  top: 0;
  z-index: 90;
  height: var(--header-h);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(10, 10, 10, 0.86);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  font-family: var(--font-chrome);
}

.instance-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12.5px;
  cursor: default;
  transition: background var(--t-fast);
}
.instance-chip:hover { background: transparent; }
.workspace-icon {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #140700;
  font-weight: 700;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.instance-chip svg { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.005em;
  line-height: 1;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform 0.2s, box-shadow 0.25s;
}
.icon-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #140700;
  transform: translateY(-1px);
  box-shadow: var(--accent-glow);
}
.icon-btn-sm {
  width: 28px; height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  background: transparent;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn-sm:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.03); }
.icon-btn-sm svg { width: 14px; height: 14px; }

.content {
  padding: 28px 32px 48px;
  max-width: 1400px;
  animation: softAppear 0.3s ease-out;
}

/* ───── Page header ───── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.overview-hero { margin-bottom: 22px; }

.section-title {
  font-family: var(--font-brand);
  font-style: italic;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.1;
}
h2.section-title { font-size: 26px; }
.card-title, h3.section-title { font-size: 20px; }

.section-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 6px;
  max-width: 720px;
}

/* ───── Stats ───── */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  transition: border-color var(--t-fast);
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-label {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.stat-value {
  font-family: var(--font-chrome);
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
  letter-spacing: -0.01em;
}

/* ───── Dashboard / grids ───── */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) { .dashboard-grid { grid-template-columns: 1fr; } }
.dashboard-left, .dashboard-right { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.sync-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
@media (max-width: 900px) { .sync-layout { grid-template-columns: 1fr; } }

.live-activity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  background:
    radial-gradient(circle at top left, rgba(245, 107, 42, 0.15), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px solid rgba(245, 107, 42, 0.18);
  border-radius: var(--radius-lg);
}
.live-activity[hidden] { display: none !important; }
.live-activity-copy { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.live-activity-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-chrome);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.live-activity-message {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-activity-meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
}
.live-activity-pulse {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(245, 107, 42, 0.6);
  animation: syncPulse 1.8s ease-out infinite;
}
@media (max-width: 900px) {
  .live-activity {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ───── Cards ───── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--t-fast);
}
.card:hover { border-color: var(--border-strong); }
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--font-brand);
  font-style: italic;
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-subtitle {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
}

/* ───── Endpoint cards ───── */
.endpoints-section { display: flex; flex-direction: column; gap: 14px; }
.endpoint-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.endpoint-card {
  display: flex;
  gap: 14px;
  padding: 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--t-fast), transform var(--t-fast), background var(--t-fast);
}
.endpoint-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  background: var(--bg-alt);
}
.endpoint-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
}
.endpoint-card:hover .endpoint-icon { color: var(--accent); background: var(--accent-soft); }
.endpoint-name {
  font-family: var(--font-chrome);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.endpoint-desc {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.45;
}

/* ───── Buttons ───── */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-chrome);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.003em;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform 0.2s, box-shadow 0.25s;
  text-decoration: none;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #140700;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--accent-glow); }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { background: var(--accent); border-color: var(--accent); color: #140700; transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.btn-danger {
  background: transparent;
  border-color: rgba(240, 74, 95, 0.35);
  color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; transform: translateY(-1px); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ───── Search ───── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  transition: border-color var(--t-fast);
}
.search-bar:focus-within { border-color: var(--border-strong); }
.search-bar svg { color: var(--text-3); flex-shrink: 0; width: 16px; height: 16px; }
.search-input {
  flex: 1;
  height: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
}
.search-input::placeholder { color: var(--placeholder); }

/* ───── Filter / form controls ───── */
.filter-bar {
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.form-hint { font-size: 11.5px; color: var(--text-3); }
.form-input,
input[type="text"].form-input,
input[type="email"].form-input,
input[type="number"].form-input,
input[type="password"].form-input,
select.form-input,
textarea.form-input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  transition: border-color var(--t-fast);
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--placeholder); }
select.form-input { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  font-size: 12.5px;
  color: var(--text-2);
}
.form-alert.success { border-color: rgba(58, 240, 161, 0.3); color: var(--ok); background: rgba(58, 240, 161, 0.04); }
.form-alert.warning { border-color: rgba(245, 182, 72, 0.3); color: var(--warn); background: rgba(245, 182, 72, 0.04); }
.form-alert.danger  { border-color: rgba(240, 74, 95, 0.3); color: var(--danger); background: rgba(240, 74, 95, 0.04); }

.settings-meta-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.settings-checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--text);
}
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.settings-actions .form-hint {
  margin: 0;
}
@media (max-width: 900px) {
  .settings-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

.surface-status {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-raised);
}
.surface-status[hidden] { display: none !important; }
.surface-status.warning {
  border-color: rgba(245, 182, 72, 0.3);
  background: rgba(245, 182, 72, 0.05);
}
.surface-status.danger {
  border-color: rgba(240, 74, 95, 0.3);
  background: rgba(240, 74, 95, 0.05);
}
.surface-status.neutral {
  border-color: var(--border);
  background: var(--bg-raised);
}
.surface-status-title {
  font-family: var(--font-chrome);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.surface-status-text {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--text-2);
  max-width: 760px;
}
.surface-status-actions {
  display: flex;
  justify-content: flex-end;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.checkbox-row input[type="checkbox"] { accent-color: var(--accent); }

/* ───── Tables ───── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.data-table thead th {
  text-align: left;
  padding: 12px 14px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-2);
}
.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
}
.page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--border-strong); }
.page-btn.active { background: var(--accent); border-color: var(--accent); color: #140700; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ───── Tags / pills / badges ───── */
.tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag.accent { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent); }
.tag.green  { background: rgba(58, 240, 161, 0.08); border-color: rgba(58, 240, 161, 0.25); color: var(--ok); }
.tag.blue   { background: rgba(110, 179, 247, 0.08); border-color: rgba(110, 179, 247, 0.25); color: var(--info); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.status-badge.success { background: rgba(58, 240, 161, 0.08); border-color: rgba(58, 240, 161, 0.25); color: var(--ok); }
.status-badge.warning { background: rgba(245, 182, 72, 0.08); border-color: rgba(245, 182, 72, 0.25); color: var(--warn); }
.status-badge.danger  { background: rgba(240, 74, 95, 0.08); border-color: rgba(240, 74, 95, 0.3); color: var(--danger); }
.status-badge.neutral { background: rgba(255, 255, 255, 0.04); border-color: var(--border); color: var(--text-2); }
.status-badge.connected { background: rgba(58, 240, 161, 0.08); border-color: rgba(58, 240, 161, 0.25); color: var(--ok); }
.status-badge.live {
  box-shadow: 0 0 0 0 rgba(245, 182, 72, 0.28);
  animation: syncGlow 1.8s ease-out infinite;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  text-transform: uppercase;
  margin-left: 8px;
  line-height: 1.2;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 500;
}
.source-pill svg { width: 10px; height: 10px; }

.integration-pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.integration-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ───── Ops (overview items) ───── */
.ops-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color var(--t-fast);
}
.ops-item + .ops-item { margin-top: 10px; }
.ops-item:hover { border-color: var(--border-strong); }
.ops-item-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ops-item-title { font-size: 13px; font-weight: 500; color: var(--text); }
.ops-item-desc { font-size: 12px; color: var(--text-2); line-height: 1.5; }
.ops-item-link {
  align-self: flex-start;
  font-size: 11.5px;
  color: var(--accent);
  margin-top: 4px;
}
.ops-item-link:hover { text-decoration: underline; }
.ops-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.ops-badge.success { color: var(--ok); border-color: rgba(58, 240, 161, 0.25); background: rgba(58, 240, 161, 0.06); }
.ops-badge.warning { color: var(--warn); border-color: rgba(245, 182, 72, 0.25); background: rgba(245, 182, 72, 0.06); }
.ops-badge.danger  { color: var(--danger); border-color: rgba(240, 74, 95, 0.3); background: rgba(240, 74, 95, 0.06); }
.ops-badge.neutral { color: var(--text-2); }
.ops-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-3);
  font-size: 12.5px;
  text-align: center;
}

/* ───── API key / integrations / config ───── */
.api-key-card, .integrations-card, .sessions-card { display: flex; flex-direction: column; gap: 14px; }

.api-key-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.api-key-value {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}
.api-key-actions { display: flex; gap: 6px; }

.sessions-display { display: flex; align-items: baseline; gap: 10px; }
.session-count {
  font-family: var(--font-chrome);
  font-size: 34px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}
.session-label { font-size: 12.5px; color: var(--text-2); }

.config-section {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.config-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-family: var(--font-chrome);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.config-actions { display: flex; gap: 6px; }
.config-block {
  padding: 10px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}

.integration-fields { display: flex; flex-direction: column; gap: 6px; }
.integration-field {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.integration-field:last-child { border-bottom: none; }
.integration-field-label { font-size: 11.5px; color: var(--text-2); }
.integration-field code {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}
.integration-help { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }
.integration-help code { font-family: var(--font-mono); color: var(--text); }

/* ───── Connection cards (connectors page) ───── */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}
.connection-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.connection-card:hover { border-color: var(--border-strong); }
.connection-card.live {
  border-color: rgba(245, 182, 72, 0.32);
  box-shadow: 0 0 0 1px rgba(245, 182, 72, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.02);
  background:
    linear-gradient(180deg, rgba(245, 182, 72, 0.035), transparent 50%),
    var(--bg-raised);
}
.connection-header { display: flex; align-items: center; gap: 12px; }
.connection-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.telegram-icon { color: #3390ec; }
.fireflies-icon { color: #e8433d; }
.connection-info { flex: 1; min-width: 0; }
.connection-name {
  font-family: var(--font-chrome);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.connection-desc { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.connection-detail { font-size: 12px; color: var(--text-2); line-height: 1.6; }
.connection-detail code { font-family: var(--font-mono); color: var(--text); }
.connection-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}
.connection-stats { display: flex; gap: 18px; padding-top: 6px; }
.conn-stat { display: flex; flex-direction: column; gap: 2px; }
.conn-stat-value { font-family: var(--font-chrome); font-size: 16px; font-weight: 600; color: var(--text); }
.conn-stat-label { font-size: 10.5px; color: var(--text-3); letter-spacing: 0.06em; text-transform: uppercase; }

/* ───── Contact rows + avatars ───── */
.contact-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.contact-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.contact-name { font-weight: 500; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-meta { font-size: 11.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar.blue  { background: rgba(110, 179, 247, 0.12); border-color: rgba(110, 179, 247, 0.3); color: var(--info); }
.avatar.green { background: rgba(58, 240, 161, 0.12); border-color: rgba(58, 240, 161, 0.3); color: var(--ok); }
.avatar.accent { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent); }

/* ───── Merge queue / proposals ───── */
.proposal-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.proposal-card + .proposal-card { margin-top: 12px; }
.proposal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 16px;
  align-items: center;
}
.proposal-arrow { color: var(--accent); font-size: 16px; text-align: center; }
.proposal-evidence {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}
.evidence-item { display: flex; gap: 10px; font-size: 12px; }
.evidence-label { color: var(--text-3); min-width: 120px; }
.proposal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* ───── Jobs / sync log ───── */
.jobs-card, .sync-log-card { display: flex; flex-direction: column; gap: 12px; }
.jobs-list, .sync-log-list { display: flex; flex-direction: column; gap: 8px; }
.jobs-card.live, .sync-log-card.live {
  border-color: rgba(245, 107, 42, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.job-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  transition: border-color var(--t-fast);
}
.job-row:hover { border-color: var(--border); }
.job-row.live {
  border-color: rgba(245, 182, 72, 0.25);
  background:
    linear-gradient(90deg, rgba(245, 182, 72, 0.08), rgba(245, 182, 72, 0.02)),
    var(--bg);
}
.job-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.job-title { font-size: 12.5px; font-weight: 500; color: var(--text); }
.job-meta { font-size: 11.5px; color: var(--text-3); font-family: var(--font-mono); }

.sync-log-empty { padding: 16px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; color: var(--text-3); font-size: 12px; }
.sync-log-entry {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.sync-log-entry.latest {
  border-color: rgba(245, 107, 42, 0.24);
  background:
    linear-gradient(90deg, rgba(245, 107, 42, 0.08), rgba(245, 107, 42, 0.02)),
    var(--bg);
}
.sync-log-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--text-3);
}
.sync-log-dot.info { background: var(--info); }
.sync-log-dot.success { background: var(--ok); }
.sync-log-dot.warning { background: var(--warn); }
.sync-log-dot.danger { background: var(--danger); }
.sync-log-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sync-log-message {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.sync-log-time {
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

@keyframes syncPulse {
  0% { box-shadow: 0 0 0 0 rgba(245, 107, 42, 0.48); }
  70% { box-shadow: 0 0 0 8px rgba(245, 107, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 107, 42, 0); }
}

@keyframes syncGlow {
  0% { box-shadow: 0 0 0 0 rgba(245, 182, 72, 0.22); }
  70% { box-shadow: 0 0 0 6px rgba(245, 182, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 182, 72, 0); }
}

.log-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}
.log-icon { flex-shrink: 0; color: var(--text-2); width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; }
.log-body { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.log-title { font-size: 12.5px; font-weight: 500; color: var(--text); }
.log-desc { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.log-time { font-size: 10.5px; color: var(--text-3); font-family: var(--font-mono); flex-shrink: 0; }

/* ───── Tabs ───── */
.tabs {
  display: flex;
  gap: 4px;
  padding: 3px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
  margin-bottom: 18px;
}
.tab {
  padding: 6px 12px;
  border-radius: 5px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--accent); color: #140700; }

/* ───── Empty states ───── */
.empty, .empty-state {
  padding: 36px 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
}
.empty-state-title { font-size: 14px; color: var(--text); font-weight: 500; }
.empty-state-desc { font-size: 12.5px; color: var(--text-2); max-width: 420px; margin: 0 auto; }

/* ───── Controls row / notes ───── */
.page-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.controls-note { font-size: 12px; color: var(--text-3); }

/* ───── Responsive ───── */
@media (max-width: 720px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--t); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 20px 16px 32px; }
  .main-header { padding: 0 16px; }
  .page-header { flex-direction: column; align-items: stretch; }
}
