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

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #1c2128;
  --bg-card: #1c2128;
  --bg-card-hover: #22272e;
  --bg-input: #0d1117;
  --border: #30363d;
  --border-light: #3d444d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --green: #3fb950;
  --green-dim: #238636;
  --yellow: #d29922;
  --red: #f85149;
  --red-dim: #da3633;
  --purple: #bc8cff;
  --orange: #f0883e;
  --gold: #f5c542;
  --gold-dim: #b8941f;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}

/* ── Layout ── */
.app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.brand-icon {
  font-size: 26px;
  color: var(--gold);
  filter: drop-shadow(0 0 8px rgba(245,197,66,0.5));
}

.brand-text {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.3px;
}

.brand-version {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
  font-size: 14px;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(245,197,66,0.08);
  color: var(--gold);
}

.nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-dot.active {
  background: var(--green);
  box-shadow: 0 0 6px rgba(63,185,80,0.5);
}

/* ── Main Content ── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

.page {
  display: none;
  animation: fadeIn 200ms ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ── Welcome Banner ── */
.welcome-banner {
  background: linear-gradient(135deg, rgba(245,197,66,0.08) 0%, rgba(63,185,80,0.06) 100%);
  border: 1px solid rgba(245,197,66,0.2);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: bannerIn 500ms ease;
}

.welcome-banner .banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.welcome-banner .banner-text {
  flex: 1;
}

.welcome-banner .banner-text h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 2px;
}

.welcome-banner .banner-text p {
  font-size: 13px;
  color: var(--text-secondary);
}

.welcome-banner .banner-providers {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.welcome-banner .provider-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-primary);
}

.provider-chip .chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.welcome-banner .banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  line-height: 1;
}

@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.provider-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.card-title h3 {
  font-size: 15px;
  font-weight: 600;
}

.status-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: rgba(63,185,80,0.15);
  color: var(--green);
}

.status-badge.configured {
  background: rgba(210,153,34,0.15);
  color: var(--yellow);
}

.status-badge.error {
  background: rgba(248,81,73,0.15);
  color: var(--red);
}

.status-badge.unconfigured {
  background: rgba(110,118,129,0.15);
  color: var(--text-muted);
}

.auto-discovered-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(245,197,66,0.12);
  color: var(--gold);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-left: 8px;
}

/* ── Forms & Inputs ── */
.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
  transition: border-color var(--transition);
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.1);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  line-height: 1;
}

.btn-primary {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent-dim);
}

.btn-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--border);
}

.btn-danger:hover {
  background: rgba(248,81,73,0.1);
  border-color: var(--red-dim);
}

.btn-success {
  background: var(--green-dim);
  color: #fff;
  border-color: var(--green-dim);
}

.btn-success:hover {
  background: var(--green);
  border-color: var(--green);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-group {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn .spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Model Tags ── */
.model-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}

.model-tag {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: 'SF Mono', Monaco, monospace;
}

/* ══════════════════════════════════════════
   ── Batting Order (Task Router)
   ══════════════════════════════════════════ */

.task-section {
  margin-bottom: 32px;
}

.task-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.task-icon {
  font-size: 20px;
}

.task-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.task-header .task-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Lineup card container */
.lineup-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.lineup-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(245,197,66,0.04);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.lineup-card-header .lineup-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lineup-list {
  display: flex;
  flex-direction: column;
  min-height: 48px;
  padding: 4px;
  transition: background var(--transition);
}

.lineup-list.drag-over {
  background: rgba(245,197,66,0.03);
}

.lineup-list .empty-state {
  text-align: center;
  padding: 24px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* Individual lineup entry */
.lineup-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  cursor: grab;
  transition: all var(--transition);
  user-select: none;
  position: relative;
}

.lineup-entry:last-child {
  border-bottom: none;
}

.lineup-entry:hover {
  background: var(--bg-card-hover);
}

.lineup-entry.dragging {
  opacity: 0.4;
  background: rgba(245,197,66,0.05);
}

.lineup-entry .drag-handle {
  color: var(--text-muted);
  cursor: grab;
  font-size: 13px;
  line-height: 1;
  opacity: 0.5;
  transition: opacity var(--transition);
}

.lineup-entry:hover .drag-handle {
  opacity: 1;
}

/* Rank badge */
.rank-badge {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.rank-badge.rank-1 {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: #000;
  box-shadow: 0 0 10px rgba(245,197,66,0.3);
}

.rank-badge.rank-2 {
  background: linear-gradient(135deg, #c0c0c0 0%, #8a8a8a 100%);
  color: #000;
}

.rank-badge.rank-3 {
  background: linear-gradient(135deg, #cd7f32 0%, #8b5e3c 100%);
  color: #fff;
}

.rank-badge.rank-n {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Provider pill in lineup */
.lineup-provider {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 110px;
}

.lineup-provider .prov-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lineup-provider .prov-name {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Model name in lineup */
.lineup-model {
  font-size: 13px;
  font-weight: 600;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
  flex: 1;
}

/* Role label */
.lineup-role {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.lineup-role.role-primary {
  background: rgba(245,197,66,0.15);
  color: var(--gold);
}

.lineup-role.role-fallback {
  background: rgba(139,148,158,0.1);
  color: var(--text-muted);
}

/* Remove button */
.lineup-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all var(--transition);
  opacity: 0;
  flex-shrink: 0;
}

.lineup-entry:hover .lineup-remove {
  opacity: 1;
}

.lineup-remove:hover {
  color: var(--red);
  background: rgba(248,81,73,0.1);
}

/* Add model button row */
.lineup-add-btn {
  padding: 8px 16px;
  border-top: 1px solid rgba(48,54,61,0.5);
}

.lineup-add-btn .btn {
  width: 100%;
  justify-content: center;
  padding: 8px 14px;
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 12px;
}

.lineup-add-btn .btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245,197,66,0.04);
}

/* ── Add Model Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 150ms ease;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.modal-header p {
  font-size: 12px;
  color: var(--text-muted);
}

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Provider section in modal */
.modal-provider-section {
  margin-bottom: 16px;
}

.modal-provider-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-provider-header .prov-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.modal-model-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
}

.modal-model-item:hover {
  background: rgba(245,197,66,0.06);
  color: var(--gold);
}

.modal-model-item.already-added {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.modal-model-item .model-check {
  color: var(--green);
  font-size: 14px;
}

/* ── Profiles ── */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.profile-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.profile-card.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), var(--shadow-lg);
}

.profile-card.active::after {
  content: 'ACTIVE';
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold);
  background: rgba(245,197,66,0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.profile-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

.profile-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.profile-card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.profile-models {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.profile-models .model-tag {
  font-size: 10px;
}

/* ── Toast Notifications ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: toastIn 300ms ease;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.95); }
}

/* ── Sync indicator ── */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--green);
  padding: 2px 8px;
  background: rgba(63,185,80,0.1);
  border-radius: 10px;
  font-weight: 500;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

/* ── Provider key visibility toggle ── */
.input-wrapper {
  position: relative;
}

.input-wrapper .toggle-vis {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.input-wrapper .toggle-vis:hover {
  color: var(--text-secondary);
}

/* ══════════════════════════════════════════
   ── Support Page
   ══════════════════════════════════════════ */

.support-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 36px;
}

.support-link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.support-link-card:hover {
  border-color: var(--gold);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.support-link-icon {
  font-size: 28px;
  flex-shrink: 0;
  width: 40px;
  text-align: center;
}

.support-link-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.support-link-card p {
  font-size: 12px;
  color: var(--text-secondary);
}

.provider-getstarted-section {
  margin-bottom: 36px;
}

.provider-getstarted-section h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.provider-getstarted-section > p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.provider-getstarted-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}

.provider-signup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.provider-signup-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.provider-signup-card .prov-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.provider-signup-card h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}

.provider-signup-card p {
  font-size: 11px;
  color: var(--text-muted);
}

.provider-signup-card .signup-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 16px;
  transition: transform var(--transition);
}

.provider-signup-card:hover .signup-arrow {
  transform: translateX(3px);
  color: var(--text-secondary);
}

.support-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

.support-footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.support-footer a:hover {
  text-decoration: underline;
}

/* ══════════════════════════════════════════
   ── Health Indicators
   ══════════════════════════════════════════ */

.card-status-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.health-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.health-dot.health-green {
  background: var(--green);
  box-shadow: 0 0 6px rgba(63,185,80,0.5);
}

.health-dot.health-yellow {
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(210,153,34,0.5);
}

.health-dot.health-red {
  background: var(--red);
  box-shadow: 0 0 6px rgba(248,81,73,0.5);
}

.health-latency {
  font-size: 11px;
  color: var(--green);
  font-family: 'SF Mono', Monaco, monospace;
  font-weight: 500;
}

.health-latency.slow {
  color: var(--yellow);
}

/* ══════════════════════════════════════════
   ── Ollama Model Browser
   ══════════════════════════════════════════ */

.ollama-source-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.ollama-source-tabs {
  display: flex;
  gap: 4px;
}

.ollama-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  background: transparent;
  color: var(--text-secondary);
}

.ollama-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.ollama-tab.active {
  background: rgba(245,197,66,0.08);
  color: var(--gold);
  border-color: var(--gold-dim);
}

.ollama-tab .prov-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.ollama-source-url {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, monospace;
  padding: 3px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
}

.ollama-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.ollama-section-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.ollama-count {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-tertiary);
  border-radius: 10px;
}

.ollama-model-list {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.ollama-model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(48,54,61,0.5);
  transition: background var(--transition);
}

.ollama-model-row:last-child {
  border-bottom: none;
}

.ollama-model-row:hover {
  background: var(--bg-card-hover);
}

.ollama-model-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.ollama-model-name {
  font-size: 13px;
  font-weight: 600;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
  min-width: 140px;
}

.ollama-model-desc {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ollama-model-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, monospace;
  min-width: 120px;
  text-align: right;
}

.ollama-disk-size {
  color: var(--accent);
  font-weight: 500;
}

.wizard-install-output {
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  color: #7ee787;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.wizard-manual-install summary:hover {
  color: var(--text-secondary);
}

.ollama-model-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
  justify-content: flex-end;
}

.ollama-installed-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  background: rgba(63,185,80,0.12);
  color: var(--green);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ollama-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 120px;
}

.ollama-progress .ollama-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--accent-dim);
  border-radius: 3px;
  transition: width 200ms ease;
}

.ollama-progress span {
  font-size: 10px;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, monospace;
  min-width: 45px;
  text-align: right;
}

.ollama-empty {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ══════════════════════════════════════════
   ── Cost Tracker
   ══════════════════════════════════════════ */

.cost-summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.cost-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-align: center;
}

.cost-card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.cost-card-value {
  font-size: 28px;
  font-weight: 800;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.cost-card-value.cost-green { color: var(--green); }
.cost-card-value.cost-yellow { color: var(--yellow); }
.cost-card-value.cost-red { color: var(--red); }

.cost-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 28px;
}

.cost-chart-container h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.cost-chart-wrapper {
  height: 220px;
  position: relative;
}

.cost-tables-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cost-table-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.cost-table-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
}

.cost-table thead th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.cost-table tbody td {
  padding: 8px;
  font-size: 13px;
  border-bottom: 1px solid rgba(48,54,61,0.3);
  color: var(--text-primary);
}

.cost-table tbody td .prov-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.cost-table tbody tr:last-child td {
  border-bottom: none;
}

.cost-model-name {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px !important;
}

.cost-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

/* CSS chart fallback */
.css-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 200px;
  padding-bottom: 20px;
}

.css-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.css-bar {
  width: 100%;
  min-height: 2px;
  border-radius: 2px 2px 0 0;
  transition: height 300ms ease;
}

.css-bar-label {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ══════════════════════════════════════════
   ── A/B Compare
   ══════════════════════════════════════════ */

.compare-controls {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.compare-prompt-area {
  margin-bottom: 16px;
}

.compare-prompt-area label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compare-prompt-area textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  transition: border-color var(--transition);
}

.compare-prompt-area textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.1);
}

.compare-selectors {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.compare-selector {
  flex: 1;
}

.compare-selector label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.compare-selector select {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  cursor: pointer;
}

.compare-selector select:focus {
  border-color: var(--accent);
}

.compare-vs {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-muted);
  padding-bottom: 8px;
  flex-shrink: 0;
}

.compare-options {
  margin-bottom: 16px;
}

.compare-options label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.compare-options input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--accent);
}

.compare-btn {
  padding: 10px 28px;
  font-size: 14px;
}

.compare-loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.compare-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.compare-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.compare-result-card.compare-error {
  border-color: var(--red-dim);
}

.compare-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.compare-result-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.compare-badges {
  display: flex;
  gap: 6px;
}

.compare-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 10px;
  font-weight: 600;
}

.badge-fast {
  background: rgba(88,166,255,0.12);
  color: var(--accent);
}

.badge-cheap {
  background: rgba(63,185,80,0.12);
  color: var(--green);
}

.badge-longer {
  background: rgba(188,140,255,0.12);
  color: var(--purple);
}

.compare-response-text {
  flex: 1;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  max-height: 350px;
  overflow-y: auto;
  margin-bottom: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.compare-result-error {
  padding: 20px;
  color: var(--red);
  font-size: 13px;
}

.compare-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.compare-metric {
  text-align: center;
  padding: 8px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.compare-metric-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 600;
}

.compare-metric span:last-child {
  font-size: 13px;
  font-weight: 700;
  font-family: 'SF Mono', Monaco, monospace;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════
   ── Ollama Setup Wizard
   ══════════════════════════════════════════ */

.wizard-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}

.wizard-section-ok {
  border-color: rgba(63,185,80,0.3);
}

.wizard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.wizard-header h3 {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.wizard-step {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  background: var(--accent-dim);
  color: #fff;
  flex-shrink: 0;
}

.wizard-step-ok {
  background: var(--green-dim);
  color: #fff;
}

.wizard-status {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.wizard-status-warn {
  background: rgba(210,153,34,0.15);
  color: var(--yellow);
}

.wizard-status-ok {
  background: rgba(63,185,80,0.15);
  color: var(--green);
}

.wizard-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.wizard-commands {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wizard-cmd {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.wizard-cmd-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.wizard-cmd-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wizard-cmd-row code {
  flex: 1;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 13px;
  color: var(--accent);
}

.wizard-packs h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.wizard-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.wizard-pack-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all var(--transition);
}

.wizard-pack-card:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}

.wizard-pack-done {
  border-color: rgba(63,185,80,0.3);
  opacity: 0.7;
}

.wizard-pack-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.wizard-pack-card h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 0;
}

.wizard-pack-card p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.wizard-pack-models {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.wizard-pack-models .model-tag-installed {
  border-color: var(--green-dim);
  color: var(--green);
}

.wizard-pack-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'SF Mono', Monaco, monospace;
  margin-bottom: 6px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    min-width: 60px;
  }
  .brand-text, .brand-version, .nav-label, .sidebar-footer span {
    display: none;
  }
  .sidebar-brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 10px; }
  .main { padding: 20px; }
  .card-grid { grid-template-columns: 1fr; }
  .cost-summary-cards { grid-template-columns: repeat(2, 1fr); }
  .cost-tables-row { grid-template-columns: 1fr; }
  .compare-selectors { flex-direction: column; }
  .compare-vs { text-align: center; padding: 0; }
  .compare-results-grid { grid-template-columns: 1fr; }
  .wizard-pack-grid { grid-template-columns: 1fr; }
}
