:root {
  --indigo: #1e40af;
  --indigo-hover: #1d3a9c;
  --emerald: #047857;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --amber-bg: #fefce8;
  --amber-text: #854d0e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }
code { background: #f3f4f6; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.wordmark-img { height: 48px; width: auto; mix-blend-mode: multiply; object-fit: contain; margin: -6px -4px; }
.wordmark-img.sm { height: 38px; margin: -5px -3px; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.pill-discovery {
  background: var(--emerald-soft);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}
.subtitle { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.lead { margin: 0 0 16px; color: #374151; }
.security-callout {
  display: flex;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #14532d;
  margin-bottom: 18px;
}
.login-form label { display: block; margin-bottom: 14px; }
.login-form label span { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13px; }
input, select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
.masked-secret {
  -webkit-text-security: disc;
  text-security: disc;
}
.btn-primary {
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--indigo-hover); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.full-width { width: 100%; }
.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.sample-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.sample-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.sample-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sample-card {
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sample-card:hover { border-color: var(--emerald); background: #f8fffb; }
.sample-card strong { font-size: 13px; }
.sample-card span { font-size: 11.5px; color: var(--muted); }
.text-danger { color: var(--danger) !important; }

/* 1080p Sidebar Rail */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar-header { padding: 0 6px 18px; border-bottom: 1px solid var(--border); }
.sidebar-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.nav-section { margin-top: 18px; }
.nav-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 10px 8px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: var(--emerald-soft); color: var(--emerald); font-weight: 600; }
.nav-badge {
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-item.active .nav-badge { background: #d1fae5; color: var(--emerald); }

.facet-box { display: flex; flex-direction: column; gap: 10px; padding: 0 6px; font-size: 12px; }
.facet-group-title { font-weight: 600; color: #374151; margin-bottom: 4px; }
.facet-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  background: transparent;
  border: none;
  padding: 3px 6px;
  border-radius: 5px;
  cursor: pointer;
  color: #4b5563;
  font-size: 12px;
}
.facet-btn:hover, .facet-btn.active { background: var(--emerald-soft); color: var(--emerald); font-weight: 600; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11.5px; color: var(--muted); }

.main-canvas { flex: 1; padding: 28px 32px; overflow-y: auto; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }

.search-bar { display: flex; gap: 8px; min-width: 420px; }
.review-split {
  display: grid;
  grid-template-columns: minmax(480px, 1.3fr) minmax(380px, 1fr);
  gap: 20px;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.table-card { padding: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f9fafb;
}
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:hover { background: #f8fafc; }

.empty-box {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
  color: var(--muted);
}
.doc-body {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  max-height: 320px;
  overflow-y: auto;
  margin-top: 12px;
}
.ingest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.ingest-grid label span { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #374151; }
.status-banner {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--emerald-soft);
  border: 1px solid var(--emerald-border);
  color: #065f46;
  font-size: 13px;
}
.status-banner.err {
  background: var(--danger-bg);
  border-color: #fecaca;
  color: var(--danger);
}
.stack { display: flex; flex-direction: column; gap: 12px; }
.diff-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: #f9fafb;
  border-radius: 6px;
  font-size: 12.5px;
  margin-top: 6px;
}
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge-ok { background: var(--emerald-soft); color: var(--emerald); }
.badge-warn { background: var(--amber-bg); color: var(--amber-text); }
.badge-err { background: var(--danger-bg); color: var(--danger); }

/* Workspace Hub Landing Page & Clickable Brand */
.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}
.brand-btn:hover { opacity: 0.85; }
.pill-desk {
  background: #eef2ff;
  color: var(--indigo);
  border: 1px solid #c7d2fe;
}
.btn-discovery {
  background: var(--emerald);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-discovery:hover { background: #065f46; }
.btn-discovery:disabled, .btn-primary:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}
.home-shell { min-height: 100vh; display: flex; flex-direction: column; }
.home-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-user-bar { display: flex; align-items: center; gap: 12px; }
.home-container {
  max-width: 980px;
  width: 100%;
  margin: 48px auto;
  padding: 0 24px;
}
.home-intro h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-top: 28px;
}
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}
.hub-card-locked { opacity: 0.72; background: #fafafa; }
.hub-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hub-card h2 { margin: 0 0 6px; font-size: 18px; }
.hub-stats {
  margin: 14px 0 20px;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: #374151;
}
.hub-actions { margin-top: auto; }
