/* HiFlight enterprise shell */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --hf-bg: #f4f6f8;
  --hf-surface: #ffffff;
  --hf-border: #e2e8f0;
  --hf-text: #0f172a;
  --hf-muted: #64748b;
  --hf-brand: #0d9488;
  --hf-brand-dark: #0f766e;
  --hf-accent: #22c55e;
  --hf-sidebar: #0b1220;
  --hf-sidebar-text: #94a3b8;
  --hf-sidebar-active: #ffffff;
  --hf-gradient: linear-gradient(135deg, #0d9488 0%, #22c55e 55%, #84cc16 100%);
  --hf-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
}

html[data-theme="dark"] {
  --hf-bg: #070b12;
  --hf-surface: #0f172a;
  --hf-border: #1e293b;
  --hf-text: #f1f5f9;
  --hf-muted: #94a3b8;
  --hf-sidebar: #030712;
}

body.hf-app {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--hf-bg) !important;
  color: var(--hf-text);
}

.hf-layout {
  display: flex;
  min-height: 100vh;
}

.hf-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--hf-sidebar);
  color: var(--hf-sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 40;
  overflow-x: hidden;
  overflow-y: hidden;
}

.hf-sidebar nav {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 0.5rem;
}

.hf-sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.hf-sidebar-brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hf-sidebar-brand .hf-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--hf-gradient);
  color: #fff;
}

.hf-nav-section {
  padding: 0.75rem 0.75rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.hf-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  box-sizing: border-box;
  width: calc(100% - 1rem);
  max-width: 100%;
  padding: 0.6rem 0.85rem;
  margin: 0.1rem 0.5rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--hf-sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.hf-nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.hf-nav-item.active {
  background: rgba(34, 197, 94, 0.12);
  color: #ecfdf5;
  box-shadow: inset 3px 0 0 var(--hf-accent);
}

.hf-nav-item.active i {
  color: var(--hf-accent);
}

.hf-nav-item i {
  width: 1.1rem;
  text-align: center;
  opacity: 0.85;
}

.hf-main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hf-topbar {
  background: var(--hf-surface);
  border-bottom: 1px solid var(--hf-border);
  box-shadow: inset 0 3px 0 0 transparent;
  background-image: linear-gradient(var(--hf-surface), var(--hf-surface)),
    linear-gradient(90deg, #0d9488, #22c55e, #84cc16);
  background-origin: border-box;
  background-clip: padding-box, border-box;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}

.hf-topbar h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--hf-text);
}

.hf-topbar p {
  font-size: 0.8rem;
  color: var(--hf-muted);
  margin: 0.15rem 0 0;
}

.hf-content {
  padding: 1.5rem;
  flex: 1;
}

.hf-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.hf-kpi {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--hf-shadow);
  border-left: 3px solid transparent;
}

.hf-kpi-accent {
  border-left-color: var(--hf-accent);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.04) 0%, var(--hf-surface) 55%);
}

.hf-card-accent .hf-card-header {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.06) 0%, transparent 70%);
}

.hf-card-accent {
  border-top: 2px solid rgba(34, 197, 94, 0.35);
}

.hf-card-disabled {
  opacity: 0.92;
}

.hf-kpi-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--hf-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.hf-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--hf-text);
  margin-top: 0.35rem;
  line-height: 1.2;
}

.hf-kpi-sub {
  font-size: 0.75rem;
  color: var(--hf-muted);
  margin-top: 0.25rem;
}

.hf-card {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: 12px;
  box-shadow: var(--hf-shadow);
  overflow: hidden;
}

.hf-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--hf-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hf-card-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
}

.hf-card-body {
  padding: 1.25rem;
}

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

.hf-tab {
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--hf-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
}

.hf-tab.active {
  color: var(--hf-brand-dark);
  border-bottom-color: var(--hf-accent);
  font-weight: 600;
}

.hf-tabs-accent {
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.05) 0%, var(--hf-surface) 100%);
}

.hf-tab-panel {
  margin-top: 1rem;
}

.hf-btn-primary {
  background: var(--hf-gradient);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.hf-btn-primary:hover { opacity: 0.92; }
.hf-btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.hf-btn-secondary {
  background: var(--hf-surface);
  color: var(--hf-text);
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.hf-alert-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--hf-border);
}

.hf-alert-row:last-child { border-bottom: none; }

.hf-severity-error { color: #dc2626; }
.hf-severity-warning { color: #d97706; }
.hf-severity-info { color: #2563eb; }

.hf-chart-bar-wrap {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding-top: 0.5rem;
}

.hf-chart-bar {
  flex: 1;
  min-width: 8px;
  background: linear-gradient(180deg, #0d9488 0%, #22c55e 100%);
  border-radius: 4px 4px 0 0;
  opacity: 0.85;
}

.hf-sql-editor {
  width: 100%;
  min-height: 200px;
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--hf-text);
  resize: vertical;
}

html[data-theme="dark"] .hf-sql-editor {
  background: #1e293b;
}

.hf-pipeline-select {
  width: 100%;
  max-width: 400px;
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: var(--hf-surface);
  color: var(--hf-text);
}

.hf-model-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--hf-border);
}

.hf-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--hf-muted);
}

/* Toggle switch */
.hf-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--hf-border);
}
.hf-toggle-row:last-child { border-bottom: none; }
.hf-toggle-label { font-weight: 600; font-size: 0.875rem; display: block; }
.hf-toggle-hint { font-size: 0.75rem; color: var(--hf-muted); display: block; margin-top: 0.15rem; }
.hf-toggle {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  border: none;
  background: #cbd5e1;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s;
}
.hf-toggle.on { background: var(--hf-gradient); }
.hf-toggle-knob {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform 0.2s;
}
.hf-toggle.on .hf-toggle-knob { transform: translateX(20px); }

/* Materialization editor */
.hf-mat-panel { margin: 0.75rem 0; }
.hf-mat-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.hf-mat-tab {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  background: var(--hf-surface);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--hf-muted);
}
.hf-mat-tab.active {
  border-color: var(--hf-accent);
  color: var(--hf-brand-dark);
  background: rgba(34, 197, 94, 0.08);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}
.hf-mat-info {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: #f0fdf4;
  border: 1px solid rgba(34, 197, 94, 0.2);
  margin-bottom: 0.75rem;
}
.hf-mat-info h4 { margin: 0 0 0.35rem; font-size: 0.9rem; color: var(--hf-brand-dark); }
.hf-mat-info p { margin: 0; font-size: 0.8rem; color: var(--hf-text); line-height: 1.45; }
.hf-mat-hint { margin-top: 0.35rem !important; color: var(--hf-muted) !important; font-size: 0.75rem !important; }
.hf-mat-incremental .hf-mat-info { background: #eff6ff; border-color: rgba(37, 99, 235, 0.2); }
.hf-mat-table .hf-mat-info { background: #fffbeb; border-color: rgba(217, 119, 6, 0.2); }
.hf-mat-fields { display: grid; gap: 0.35rem; }
.hf-mat-fields label { font-size: 0.75rem; font-weight: 600; color: var(--hf-muted); }

.hf-model-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.hf-model-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--hf-border);
  background: var(--hf-surface);
  font-size: 0.8rem;
  cursor: pointer;
}
.hf-model-chip.active {
  border-color: var(--hf-accent);
  background: rgba(34, 197, 94, 0.1);
  color: var(--hf-brand-dark);
  font-weight: 600;
}
.hf-chip-mini {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(13, 148, 136, 0.12);
  color: var(--hf-brand-dark);
  text-transform: uppercase;
}
.hf-model-editor {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--hf-border);
  border-radius: 10px;
  border-left: 3px solid var(--hf-accent);
  background: #fafbfc;
}
.hf-input {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}
.hf-field-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.hf-field-label {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hf-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.hf-field-row .hf-pipeline-select {
  width: auto;
  min-width: 14rem;
  max-width: 400px;
  flex: 0 0 auto;
}

.hf-banner {
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-bottom: 1rem;
  border: 1px solid var(--hf-border);
  background: #f8fafc;
}
.hf-banner-ok { background: #f0fdf4; border-color: rgba(34, 197, 94, 0.3); color: #166534; }
.hf-banner-warn { background: #fffbeb; border-color: rgba(217, 119, 6, 0.35); color: #92400e; }
.hf-banner-info { background: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, rgba(13, 148, 136, 0.06) 100%); border-color: rgba(34, 197, 94, 0.25); color: #134e4a; font-size: 0.85rem; line-height: 1.5; }
.hf-banner-info code { background: rgba(34, 197, 94, 0.15); padding: 0.1rem 0.35rem; border-radius: 4px; font-size: 0.8rem; }

.hf-chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  color: var(--hf-brand-dark);
  font-weight: 500;
}
.hf-status-pill {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--hf-muted);
  text-transform: capitalize;
}
.hf-status-pill.active, .hf-status-pill.success { background: #dcfce7; color: #166534; }
.hf-status-pill.fail { background: #fee2e2; color: #991b1b; }
.hf-flow { font-size: 0.8rem; color: var(--hf-muted); }
.hf-table { width: 100%; font-size: 0.85rem; border-collapse: collapse; }
.hf-table th { text-align: left; padding: 0.5rem; color: var(--hf-muted); font-weight: 500; }
.hf-table td { padding: 0.6rem 0.5rem; border-top: 1px solid var(--hf-border); }
.hf-td-strong { font-weight: 600; }
.hf-chart-labels { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--hf-muted); margin-top: 0.5rem; }
.hf-exec-list { display: flex; flex-direction: column; gap: 0.5rem; }
.hf-exec-row { display: flex; align-items: center; gap: 0.75rem; font-size: 0.8rem; padding: 0.4rem 0; border-bottom: 1px solid var(--hf-border); }
.hf-exec-time { color: var(--hf-muted); margin-left: auto; font-size: 0.75rem; }
.hf-btn-ghost { background: none; border: none; color: var(--hf-muted); cursor: pointer; margin-left: auto; padding: 0.5rem; }
.hf-btn-ghost:hover { color: var(--hf-accent); }
.hf-btn-group { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.hf-msg.ok { color: #166534; font-size: 0.8rem; margin-top: 0.75rem; }
.hf-msg.error { color: #991b1b; font-size: 0.8rem; margin-top: 0.75rem; }
.hf-runs-list { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--hf-border); }
.hf-runs-list h4 { font-size: 0.85rem; margin: 0 0 0.5rem; }
.hf-run-row { display: flex; gap: 0.75rem; align-items: center; font-size: 0.8rem; padding: 0.35rem 0; }
.hf-alert-title { font-weight: 600; font-size: 0.9rem; }
.hf-alert-msg { font-size: 0.8rem; color: var(--hf-muted); margin-top: 0.25rem; }
.hf-alert-meta { font-size: 0.7rem; color: var(--hf-muted); margin-top: 0.35rem; }
.hf-quality-copy { font-size: 0.875rem; color: var(--hf-muted); line-height: 1.5; }

.hf-table-code {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.78rem;
  background: rgba(13, 148, 136, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--hf-brand-dark);
}

.hf-quality-table { margin-top: 0.25rem; }
.hf-quality-score {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 7rem;
}
.hf-quality-bar {
  flex: 1;
  height: 6px;
  background: var(--hf-border);
  border-radius: 999px;
  overflow: hidden;
}
.hf-quality-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--hf-gradient);
}
.hf-quality-fill.hf-quality-good { background: linear-gradient(90deg, #0d9488, #22c55e); }
.hf-quality-fill.hf-quality-warn { background: linear-gradient(90deg, #d97706, #fbbf24); }
.hf-quality-fill.hf-quality-bad { background: linear-gradient(90deg, #dc2626, #f87171); }
.hf-quality-num {
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 1.75rem;
  text-align: right;
}
.hf-quality-num.hf-quality-good { color: #166534; }
.hf-quality-num.hf-quality-warn { color: #b45309; }
.hf-quality-num.hf-quality-bad { color: #991b1b; }

.hf-layer-pill {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}
.hf-layer-raw { background: #ecfdf5; color: #047857; }
.hf-layer-curated { background: #e0f2fe; color: #0369a1; }

.hf-issues-cell {
  max-width: 11rem;
  white-space: nowrap;
  vertical-align: middle;
  overflow: visible;
}

.hf-issues-compact {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.hf-issues-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  max-width: 10.5rem;
  padding: 0;
  border: none;
  background: none;
  font-size: 0.75rem;
  font-weight: 500;
  color: #b45309;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hf-issues-trigger:hover {
  color: #92400e;
  text-decoration: underline;
}

.hf-issues-trigger i {
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Parent .hf-card uses overflow:hidden; allow the issues popover to extend outside the card */
.hf-card:has(.hf-issues-popover),
.hf-card-body:has(.hf-issues-popover) {
  overflow: visible;
}

.hf-issues-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 100;
  min-width: 15rem;
  max-width: 22rem;
  max-height: 14rem;
  overflow-y: auto;
  padding: 0.35rem 0;
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.hf-issues-popover-item {
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--hf-text);
  border-bottom: 1px solid var(--hf-border);
}

.hf-issues-popover-item:last-child {
  border-bottom: none;
}

.hf-issue-ok {
  font-size: 0.75rem;
  color: #166534;
  font-weight: 500;
}

.hf-table-link {
  border: none;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.hf-table-link:hover {
  background: rgba(13, 148, 136, 0.16);
  color: var(--hf-accent);
}

.hf-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.hf-modal {
  background: var(--hf-surface);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  max-width: min(960px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.hf-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--hf-border);
}
.hf-modal-header h3 { margin: 0; font-size: 1.05rem; }
.hf-modal-sub { margin: 0.25rem 0 0; font-size: 0.78rem; color: var(--hf-muted); }
.hf-modal-close {
  background: none;
  border: none;
  color: var(--hf-muted);
  cursor: pointer;
  padding: 0.35rem;
  font-size: 1rem;
}
.hf-modal-body {
  padding: 1rem 1.25rem 1.25rem;
  overflow: auto;
}
.hf-preview-table-wrap { overflow-x: auto; }
.hf-preview-data { font-size: 0.78rem; }
.hf-preview-data td { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hf-cell-empty { color: var(--hf-muted); font-style: italic; }
.hf-preview-note {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
  color: var(--hf-muted);
  line-height: 1.4;
}

.hf-model-editor-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  gap: 1.25rem;
  margin-top: 0.75rem;
  align-items: start;
}
@media (max-width: 900px) {
  .hf-model-editor-layout { grid-template-columns: 1fr; }
}
.hf-source-catalog {
  border: 1px solid var(--hf-border);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgba(13, 148, 136, 0.04);
}
.hf-source-catalog h4 { margin: 0 0 0.35rem; font-size: 0.85rem; }
.hf-catalog-meta { font-size: 0.75rem; margin: 0 0 0.5rem; color: var(--hf-muted); }
.hf-catalog-table { font-size: 0.75rem; }
.hf-catalog-table th { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.03em; }
.hf-col-pick {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--hf-brand-dark);
  cursor: pointer;
  text-align: left;
}
.hf-col-pick:hover { text-decoration: underline; color: var(--hf-accent); }
.hf-col-pick.suggested { font-weight: 600; }
.hf-pk-cell { text-align: center; width: 2.5rem; }

/* Feature maintenance (e.g. File Search unavailable on cloud) */
.hf-maintenance-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22rem;
  padding: 2rem 1rem;
}
.hf-maintenance-card {
  max-width: 32rem;
  text-align: center;
  padding: 2.5rem 2rem;
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: 14px;
  box-shadow: var(--hf-shadow);
}
.hf-maintenance-icon {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.12), rgba(34, 197, 94, 0.1));
  color: var(--hf-accent);
  font-size: 1.35rem;
}
.hf-maintenance-title {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--hf-text);
}
.hf-maintenance-lead {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--hf-text);
  margin: 0 0 0.75rem;
}
.hf-maintenance-detail {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--hf-muted);
  margin: 0 0 1.25rem;
}
.hf-maintenance-status {
  margin: 0;
}
.hf-maintenance-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #fffbeb;
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: #92400e;
}

/* File Search — teal/green gradient shell (matches Metrics, UltraBullet) */
.hf-fs-intro {
  margin-bottom: 1.5rem;
}
.hf-fs-intro h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hf-text);
  margin: 0 0 0.35rem;
}
.hf-fs-intro p {
  font-size: 0.9rem;
  color: var(--hf-muted);
  margin: 0;
}
.hf-fs-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.hf-fs-index-count {
  font-size: 0.75rem;
  color: var(--hf-muted);
  margin-left: auto;
}
.hf-fs-connected {
  font-size: 0.8rem;
  color: var(--hf-brand-dark);
  font-weight: 500;
}
.hf-fs-connected i { color: var(--hf-accent); }
.hf-fs-google-btn {
  background: var(--hf-surface);
  color: var(--hf-brand-dark);
  border: 1px solid rgba(13, 148, 136, 0.45);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.hf-fs-google-btn:hover {
  background: linear-gradient(90deg, rgba(13, 148, 136, 0.08) 0%, rgba(34, 197, 94, 0.06) 100%);
  border-color: var(--hf-accent);
}
.hf-fs-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-radius: 12px;
  box-shadow: var(--hf-shadow);
  border-top: 2px solid rgba(34, 197, 94, 0.35);
  overflow: hidden;
}
.hf-fs-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.03) 0%, var(--hf-surface) 12%);
}
.hf-fs-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--hf-muted);
}
.hf-fs-empty-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: inline-block;
  background: linear-gradient(135deg, #0d9488 0%, #22c55e 55%, #84cc16 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hf-fs-empty-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--hf-text);
  margin-bottom: 0.35rem;
}
.hf-fs-msg-row {
  display: flex;
  margin-bottom: 0.75rem;
}
.hf-fs-msg-row.user { justify-content: flex-end; }
.hf-fs-msg-row.assistant { justify-content: flex-start; }
.hf-fs-bubble {
  max-width: 48rem;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}
.hf-fs-bubble.user {
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 38%, #22c55e 72%, #4ade80 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.22);
}
.hf-fs-bubble.assistant {
  background: var(--hf-surface);
  color: var(--hf-text);
  border: 1px solid var(--hf-border);
}
.hf-fs-bubble.assistant:not(.error) {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.06) 0%, var(--hf-surface) 100%);
  border-color: rgba(34, 197, 94, 0.2);
}
.hf-fs-bubble.error {
  background: #fef2f2;
  border-color: rgba(220, 38, 38, 0.25);
  color: #991b1b;
}
.hf-fs-bubble i.fa-robot { color: var(--hf-brand); }
.hf-fs-bubble i.fa-user { opacity: 0.9; }
.hf-fs-file-card {
  background: var(--hf-surface);
  border: 1px solid var(--hf-border);
  border-left: 3px solid var(--hf-accent);
  border-radius: 8px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  color: var(--hf-text);
}
.hf-fs-file-card .fa-file { color: var(--hf-brand); }
.hf-fs-file-card a {
  color: var(--hf-brand-dark);
  font-weight: 500;
}
.hf-fs-file-card a:hover { color: var(--hf-accent); }
.hf-fs-badge-drive {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
}
.hf-fs-badge-gmail {
  background: rgba(220, 38, 38, 0.1);
  color: #991b1b;
}
.hf-fs-badge-local {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}
.hf-fs-spinner {
  border-color: transparent;
  border-bottom-color: var(--hf-brand);
}
.hf-fs-input-area {
  border-top: 1px solid var(--hf-border);
  padding: 1rem;
  background: linear-gradient(180deg, var(--hf-surface) 0%, rgba(34, 197, 94, 0.04) 100%);
}
.hf-fs-input {
  flex: 1;
  min-width: 0;
  padding: 0.65rem 1rem;
  border: 1px solid var(--hf-border);
  border-radius: 10px;
  font-size: 0.875rem;
  background: var(--hf-surface);
  color: var(--hf-text);
}
.hf-fs-input:focus {
  outline: none;
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
.hf-fs-input::placeholder { color: var(--hf-muted); }
.hf-fs-search-btn {
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 38%, #22c55e 72%, #4ade80 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  padding: 0.65rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.2);
  transition: opacity 0.15s, box-shadow 0.15s;
}
.hf-fs-search-btn:hover:not(:disabled) {
  opacity: 0.95;
  box-shadow: 0 6px 16px rgba(13, 148, 136, 0.28);
}
.hf-fs-search-btn:disabled {
  background: #e2e8f0;
  color: #64748b;
  border-color: #cbd5e1;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.7;
}
.hf-fs-tip {
  font-size: 0.75rem;
  color: var(--hf-muted);
  margin-top: 0.5rem;
}
.hf-fs-tip i { color: var(--hf-accent); }
html[data-theme="dark"] .hf-fs-bubble.error {
  background: rgba(127, 29, 29, 0.25);
  color: #fecaca;
}
html[data-theme="dark"] .hf-fs-file-card {
  background: var(--hf-bg);
}

/* Override legacy purple header when shell is active */
.hf-layout .gradient-bg { display: none; }

/* —— Auth (sign in / register) —— */
.hf-auth-shell {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  background: #070b12;
}

.hf-auth-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(13, 148, 136, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 75%, rgba(34, 197, 94, 0.28) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 60% 10%, rgba(56, 189, 248, 0.18) 0%, transparent 45%),
    linear-gradient(160deg, #030712 0%, #0b1220 40%, #0f172a 100%);
  z-index: 0;
}

.hf-auth-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.hf-auth-orb-1 {
  width: 320px;
  height: 320px;
  top: -80px;
  left: -60px;
  background: #0d9488;
}
.hf-auth-orb-2 {
  width: 280px;
  height: 280px;
  bottom: -40px;
  right: 10%;
  background: #22c55e;
}
.hf-auth-orb-3 {
  width: 200px;
  height: 200px;
  top: 40%;
  right: -40px;
  background: #38bdf8;
  opacity: 0.35;
}

.hf-auth-grid {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  max-width: 960px;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}
@media (min-width: 900px) {
  .hf-auth-grid {
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
  }
}

.hf-auth-brand {
  color: #f8fafc;
  padding: 0.5rem 0;
}
.hf-auth-brand-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.hf-auth-logo {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: #0c1524;
  border: 2px solid transparent;
  background-clip: padding-box;
  box-shadow:
    0 0 0 2px rgba(13, 148, 136, 0.5),
    0 8px 24px -8px rgba(34, 197, 94, 0.4);
  position: relative;
}
.hf-auth-logo::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, #0d9488 0%, #22c55e 55%, #84cc16 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  z-index: -1;
}
.hf-auth-logo i {
  font-size: 1.35rem;
  background: var(--hf-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hf-auth-logo-sm {
  width: 40px;
  height: 40px;
  border-radius: 11px;
}
.hf-auth-logo-sm i {
  font-size: 1.1rem;
}
.hf-auth-brand h1 {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
  background: var(--hf-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hf-auth-brand .hf-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--hf-gradient);
  color: #fff;
  -webkit-text-fill-color: #fff;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.hf-auth-tagline {
  font-size: 1.125rem;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.5;
  margin: 0 0 1.5rem;
  max-width: 28rem;
}
.hf-auth-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.hf-auth-features li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  color: #94a3b8;
}
.hf-auth-features i {
  width: 1.25rem;
  text-align: center;
  color: #4ade80;
}
.hf-auth-feature-note {
  color: #64748b;
  font-weight: 400;
}

.hf-auth-card {
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 2rem 2rem 1.75rem;
  box-shadow:
    0 0 0 1px rgba(13, 148, 136, 0.12),
    0 24px 48px -12px rgba(0, 0, 0, 0.45),
    0 0 80px -20px rgba(34, 197, 94, 0.25);
  backdrop-filter: blur(12px);
}
html[data-theme="dark"] .hf-auth-card {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.12);
}

.hf-auth-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--hf-text);
  margin: 0 0 0.25rem;
}
.hf-auth-card-sub {
  font-size: 0.8125rem;
  color: var(--hf-muted);
  margin: 0 0 1.5rem;
}

.hf-auth-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #f1f5f9;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}
html[data-theme="dark"] .hf-auth-tabs {
  background: #1e293b;
}
.hf-auth-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 10px;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--hf-muted);
  background: transparent;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.hf-auth-tab.active {
  color: #fff;
  background: var(--hf-gradient);
  box-shadow: 0 4px 14px -4px rgba(13, 148, 136, 0.55);
}
.hf-auth-tab:not(.active):hover {
  color: var(--hf-text);
  background: rgba(255, 255, 255, 0.6);
}

.hf-auth-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hf-muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hf-auth-field {
  margin-bottom: 1rem;
}
.hf-auth-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--hf-border);
  border-radius: 10px;
  font-size: 0.9375rem;
  color: var(--hf-text);
  background: var(--hf-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hf-auth-input:focus {
  outline: none;
  border-color: var(--hf-brand);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}
.hf-auth-hint {
  font-size: 0.75rem;
  color: var(--hf-muted);
  margin-top: 0.35rem;
}

.hf-auth-error {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8125rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  margin-bottom: 1rem;
}
html[data-theme="dark"] .hf-auth-error {
  background: rgba(127, 29, 29, 0.25);
  border-color: rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

.hf-auth-submit {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 38%, #22c55e 72%, #4ade80 100%);
  box-shadow: 0 8px 24px -8px rgba(13, 148, 136, 0.55);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}
.hf-auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -6px rgba(34, 197, 94, 0.5);
}
.hf-auth-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.hf-auth-footer {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hf-border);
  font-size: 0.75rem;
  color: var(--hf-muted);
  text-align: center;
}
