/* Edigration v0.1 — main stylesheet */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e3e8ee;
  --border-2: #d0d7de;
  --divider: #eef1f4;
  --text-1: #0a1929;
  --text-2: #4a5568;
  --text-3: #718096;
  --text-4: #a0aec0;
  --navy-900: #0a1929;
  --accent: #6157d9;
  --accent-hover: #4f46c4;
  --accent-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #ecfdf5;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text-1); font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
body.centered { display: grid; place-items: center; grid-template-columns: 1fr; }

/* Sidebar */
.sidebar { background: var(--navy-900); color: #cbd5e0; display: flex; flex-direction: column; }
.brand { padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; }
.brand .mark { width: 28px; height: 28px; background: linear-gradient(135deg, #6157d9, #8b7ff5); border-radius: 6px; display: grid; place-items: center; color: white; font-weight: 700; font-size: 14px; }
.brand .name { color: white; font-weight: 600; font-size: 15px; }
.brand .name .tag { display: inline-block; margin-left: 4px; font-size: 10px; padding: 1px 5px; background: rgba(255,255,255,0.1); border-radius: 3px; color: var(--text-4); font-family: ui-monospace, monospace; }
.brand-center { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; justify-content: center; }
.brand-center .mark { width: 36px; height: 36px; background: linear-gradient(135deg, #6157d9, #8b7ff5); border-radius: 8px; display: grid; place-items: center; color: white; font-weight: 700; font-size: 18px; }
.brand-center .name { font-weight: 700; font-size: 20px; color: var(--text-1); }

.nav-group { padding: 18px 12px 6px; }
.nav-group-label { font-family: ui-monospace, monospace; font-size: 10px; color: #5a6878; text-transform: uppercase; letter-spacing: 0.1em; padding: 0 8px 8px; font-weight: 500; }
.nav-item { display: block; padding: 8px 10px; border-radius: 4px; color: #b0bcc8; text-decoration: none; font-size: 13px; font-weight: 500; cursor: pointer; margin-bottom: 1px; border-left: 2px solid transparent; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: white; }
.nav-item.active { background: rgba(97,87,217,0.12); color: white; border-left-color: var(--accent); }

.sb-footer { margin-top: auto; padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; }
.av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, #6157d9, #8b7ff5); display: grid; place-items: center; color: white; font-weight: 600; font-size: 12px; }
.who .n { color: white; font-size: 12px; font-weight: 500; }
.who .r { color: #6a7886; font-size: 10px; text-transform: capitalize; }

/* Main */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; }
.crumb { font-size: 13px; color: var(--text-3); }
.crumb a { color: var(--text-3); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb .sep { margin: 0 6px; color: var(--text-4); }
.crumb .current { color: var(--text-1); font-weight: 500; }
.top-right { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 13px; color: var(--text-2); }

.page { padding: 28px; flex: 1; overflow-y: auto; }
.page-h { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; }
.page-h h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.page-h .sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.card.empty { text-align: center; padding: 40px 24px; }
.card.empty h2 { font-size: 18px; margin-bottom: 8px; }
.card.empty p { color: var(--text-3); margin-bottom: 16px; }
.card ul { padding-left: 20px; }
.card ul li { padding: 4px 0; font-size: 14px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
thead th.r { text-align: right; }
tbody td { padding: 12px; border-bottom: 1px solid var(--divider); }
tbody td.r { text-align: right; font-family: ui-monospace, monospace; }
tbody tr:last-child td { border-bottom: none; }

.cn { font-weight: 500; }
.cm { font-size: 11px; color: var(--text-3); margin-top: 2px; font-family: ui-monospace, monospace; }
.cm.error { color: var(--red); }

.type { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.05em; font-family: ui-monospace, monospace; }
.type-auto { background: #f5f0ff; color: #7c3aed; }
.type-manual { background: var(--accent-soft); color: var(--accent); }

.status { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 12px; display: inline-flex; align-items: center; }
.status-active, .status-enabled { background: var(--green-soft); color: var(--green); }
.status-paused, .status-disabled { background: var(--amber-soft); color: var(--amber); }
.status-error { background: var(--red-soft); color: var(--red); }
.status-archived { background: var(--surface-2); color: var(--text-3); }

/* Forms */
form label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text-2); font-weight: 500; }
form label small { color: var(--text-4); font-weight: normal; margin-left: 4px; }
form input { display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 14px; margin-top: 4px; font-family: inherit; background: white; color: var(--text-1); }
form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(97,87,217,0.1); }

.btn { font-family: inherit; font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: var(--radius); cursor: pointer; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-1); text-decoration: none; display: inline-block; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.block { display: block; width: 100%; padding: 10px; text-align: center; }
.btn-sm { font-size: 12px; padding: 4px 10px; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: var(--red-soft); color: var(--red); border: 1px solid #fee2e2; }
.alert-success { background: var(--green-soft); color: var(--green); border: 1px solid #d1fae5; }

/* Auth card */
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 36px 40px; max-width: 400px; width: 100%; box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.auth-card h1 { font-size: 22px; margin-bottom: 20px; text-align: center; }
.muted { color: var(--text-3); font-size: 14px; }

/* ====================================================
   v0.2 additions
   ==================================================== */

/* Page header */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 16px; }
.page-header h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.page-header .muted { font-size: 13px; }
.page-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 600; color: var(--text-1); font-family: ui-monospace, monospace; }

/* Card rows */
.row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.row .card { margin: 0; min-width: 0; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

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

.section-header { margin: 24px 0 12px; }
.section-header h2 { font-size: 18px; font-weight: 600; }

/* Cycle status */
.cycle-status { display: flex; flex-direction: column; gap: 8px; }
.cycle-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.cycle-row:last-child { border-bottom: none; }
.cycle-label { color: var(--text-3); }
.cycle-value { font-weight: 500; color: var(--text-1); }
.cycle-value.status-success { color: var(--green); }
.cycle-value.status-error { color: var(--red); }
.cycle-value.status-running { color: var(--accent); }
.cycle-row.error .cycle-value { color: var(--red); font-size: 12px; max-width: 60%; text-align: right; word-break: break-word; }

/* Advice summary */
.advice-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.adv-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--divider); font-size: 13px; }
.adv-row strong { font-family: ui-monospace, monospace; }

/* Data table - aliasing on existing styles */
.data-table { width: 100%; }
.data-table .small { font-size: 11px; }

/* Pills */
.pill { display: inline-block; padding: 2px 8px; font-size: 11px; font-weight: 500; border-radius: 10px; background: var(--surface-2); color: var(--text-2); text-transform: capitalize; }
.pill-active, .pill-enabled, .pill-applied { background: var(--green-soft); color: var(--green); }
.pill-paused, .pill-pending { background: var(--amber-soft); color: var(--amber); }
.pill-error, .pill-rejected { background: var(--red-soft); color: var(--red); }
.pill-archived, .pill-skipped { background: var(--surface-2); color: var(--text-3); }
.pill-approved { background: var(--accent-soft); color: var(--accent); }

/* Advice cards */
.advice-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.advice-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.advice-keyword { font-size: 15px; }
.advice-change { font-family: ui-monospace, monospace; font-size: 16px; margin: 10px 0; }
.advice-change .from { color: var(--text-3); text-decoration: line-through; }
.advice-change .to { font-weight: 600; }
.advice-change .to.up { color: var(--green); }
.advice-change .to.down { color: var(--red); }
.advice-reasoning { color: var(--text-2); margin: 10px 0; font-size: 13px; line-height: 1.6; }
.advice-impact { font-size: 12px; color: var(--text-3); margin: 6px 0 12px; }
.advice-actions { display: flex; gap: 8px; align-items: center; padding-top: 12px; border-top: 1px solid var(--divider); }
.advice-form { display: inline-flex; margin: 0; }

/* Action badges */
.action-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; font-family: ui-monospace, monospace; margin-right: 8px; }
.action-bid_decrease, .action-bid_decrease { background: #fef3c7; color: #92400e; }
.action-bid_increase, .action-bid_increase { background: #d1fae5; color: #065f46; }
.action-pause_keyword { background: #fee2e2; color: #991b1b; }
.action-add_negative { background: #e0e7ff; color: #3730a3; }

/* Confidence pill */
.confidence-pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; font-family: ui-monospace, monospace; }
.conf-high { background: var(--green-soft); color: var(--green); }
.conf-medium { background: var(--amber-soft); color: var(--amber); }
.conf-low { background: var(--surface-2); color: var(--text-3); }

/* Sidebar badge */
.nav-item .badge { display: inline-block; min-width: 18px; padding: 0 5px; height: 16px; line-height: 16px; text-align: center; background: var(--accent); color: white; font-size: 10px; font-weight: 600; border-radius: 8px; font-family: ui-monospace, monospace; margin-left: 6px; vertical-align: middle; }

/* Form selects */
form select { display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 14px; margin-top: 4px; background: white; font-family: inherit; color: var(--text-1); }
form select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(97,87,217,0.1); }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; margin: 0; }
.form-row { margin-bottom: 14px; }

/* Empty state */
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state h2 { font-size: 18px; margin-bottom: 8px; }
.empty-state p { color: var(--text-3); margin-bottom: 16px; }

/* Link */
.link { color: var(--accent); text-decoration: none; font-weight: 500; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* Buttons danger */
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-danger:hover { background: var(--red-soft); }

/* Actions cell */
td.actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* ====================================================
   v1.3 — bol connection editor styles
   ==================================================== */

.connection-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--surface);
}

.connection-row[open] {
  border-color: var(--accent);
}

.connection-summary {
  cursor: pointer;
  padding: 12px 16px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.connection-summary::-webkit-details-marker { display: none; }
.connection-summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--text-3);
  font-size: 11px;
}
.connection-row[open] .connection-summary::before {
  transform: rotate(90deg);
}

.conn-info { flex: 1; display: flex; align-items: baseline; gap: 8px; }
.conn-info strong { font-weight: 600; }
.conn-status { display: flex; align-items: center; gap: 10px; }

.connection-body {
  padding: 16px 20px 20px 32px;
  border-top: 1px solid var(--divider);
  background: var(--surface-2);
}

.edit-form label {
  display: block;
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--divider);
}

.test-result {
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 4px;
  margin-left: 4px;
}
.test-result.success { background: var(--green-soft); color: var(--green); }
.test-result.error { background: var(--red-soft); color: var(--red); }
.test-result.testing { background: var(--accent-soft); color: var(--accent); }
.test-result:empty { display: none; }

.alert-success { background: var(--green-soft); color: var(--green); border: 1px solid #d1fae5; padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 16px; }

/* ====================================================
   v1.4 — scope pills + log viewer + test details
   ==================================================== */

.scope-pill {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  font-family: ui-monospace, monospace;
  letter-spacing: 0.03em;
}
.scope-pill.scope-ok { background: var(--green-soft); color: var(--green); }
.scope-pill.scope-bad { background: var(--red-soft); color: var(--red); }

.test-details {
  background: #fafbfc;
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 13px;
}
.test-steps-list .test-step {
  padding: 4px 0;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.step-ok { color: var(--green); font-weight: 700; }
.step-bad { color: var(--red); font-weight: 700; }
.step-err { color: var(--red); }

/* Log viewer */
.log-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.log-filters label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-3);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}
.log-filters select,
.log-filters input {
  margin-top: 4px;
  min-width: 140px;
}

.log-table { font-size: 12px; }
.log-table th { font-size: 10px; }
.log-table .ts { white-space: nowrap; font-family: ui-monospace, monospace; color: var(--text-3); font-size: 11px; }
.log-table .path { font-family: ui-monospace, monospace; color: var(--text-1); max-width: 300px; word-break: break-all; }
.log-table .method { font-weight: 700; font-size: 11px; padding: 2px 6px; border-radius: 3px; font-family: ui-monospace, monospace; }
.log-table .method-get { background: #dbeafe; color: #1e40af; }
.log-table .method-post { background: #d1fae5; color: #065f46; }
.log-table .method-put { background: #fef3c7; color: #92400e; }
.log-table .method-delete { background: #fee2e2; color: #991b1b; }
.log-table .mono { font-family: ui-monospace, monospace; }
.log-table .error-cell { color: var(--red); font-size: 11px; max-width: 280px; word-break: break-word; }
.log-table .log-row.err td { background: rgba(220, 38, 38, 0.03); }

.status-code { padding: 1px 6px; border-radius: 3px; font-family: ui-monospace, monospace; font-size: 11px; font-weight: 600; }
.status-2xx { background: var(--green-soft); color: var(--green); }
.status-3xx { background: #e0e7ff; color: #3730a3; }
.status-4xx { background: #fef3c7; color: #92400e; }
.status-5xx { background: var(--red-soft); color: var(--red); }

.trigger-pill {
  display: inline-block;
  padding: 1px 6px;
  background: var(--surface-2);
  border-radius: 3px;
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--text-3);
}

/* ====================================================
   v1.5 — split credential blocks
   ==================================================== */

.cred-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px 8px;
  margin: 16px 0;
  background: #fbfcfd;
}
.cred-block legend {
  font-size: 13px;
  font-weight: 600;
  padding: 0 8px;
  color: var(--text-2);
}
.cred-block .required {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.cred-block .optional {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--text-3);
  border-radius: 3px;
  letter-spacing: 0.04em;
}

.test-result.inline {
  display: inline-block;
  margin-left: 8px;
  vertical-align: middle;
}
.test-steps-list h4 {
  font-size: 13px;
  margin: 12px 0 6px;
  color: var(--text-2);
}
.test-steps-list h4:first-child { margin-top: 0; }

/* ====================================================
   v1.5.3 — app footer with version
   ==================================================== */

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px 16px 32px;
  margin-top: 32px;
  border-top: 1px solid var(--divider);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.footer-brand { font-weight: 600; }
.footer-version {
  font-family: ui-monospace, monospace;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
}
.footer-sep { opacity: 0.6; }

/* ====================================================
   v1.5.4 — diagnose page
   ==================================================== */

.diag-conn-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.diag-token { margin: 8px 0 16px; }
.diag-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.diag-line.ok { background: var(--green-soft); color: var(--green); }
.diag-line.err { background: var(--red-soft); color: var(--red); }
.diag-icon { font-size: 18px; font-weight: 700; }

.diag-pre {
  background: #fafbfc;
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.diag-pre.err-pre { background: var(--red-soft); color: var(--red); border-color: #fecaca; }

/* ====================================================
   v1.5.5 — support text copy area
   ==================================================== */

.support-textarea {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 14px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: #fafbfc;
  resize: vertical;
  min-height: 200px;
  box-sizing: border-box;
}
.support-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(97, 87, 217, 0.12);
}

/* ====================================================
   v1.6 — AI provider UI
   ==================================================== */

.provider-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 13px;
  color: white;
  margin-right: 8px;
}
.provider-icon.kind-anthropic { background: linear-gradient(135deg, #c96340, #d97757); }
.provider-icon.kind-google    { background: linear-gradient(135deg, #4285f4, #1a73e8); }

.provider-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.provider-badge.kind-anthropic { background: #fef3ec; color: #c96340; }
.provider-badge.kind-google    { background: #e8f0fe; color: #1a73e8; }

/* ====================================================
   v1.8 — dashboard polish
   ==================================================== */

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

/* Connection strip */
.conn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: white;
  border: 1px solid var(--divider);
  font-size: 13px;
}
.conn-pill.ok { border-color: #bbf7d0; }
.conn-pill.err { border-color: #fecaca; background: #fef2f2; }
.conn-name { font-weight: 600; }
.conn-flag {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.conn-flag.adv { background: #dcfce7; color: #166534; }
.conn-flag.ret { background: #dbeafe; color: #1e40af; }
.conn-flag.err { background: #fee2e2; color: #991b1b; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.kpi-tile {
  background: white;
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 4px;
}
.kpi-value.kpi-good { color: var(--green); }
.kpi-value.kpi-warn { color: #d97706; }

/* Chart container */
.chart-container {
  position: relative;
  height: 280px;
  padding: 8px 0;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 24px;
}
.empty-state h3 {
  margin-top: 0;
}

/* Two-column grid */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
@media (max-width: 800px) {
  .dashboard-grid-2 { grid-template-columns: 1fr; }
}

/* Mini stats inside cards */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.mini-stats > div {
  text-align: center;
  padding: 12px 8px;
  background: #f8fafc;
  border-radius: 8px;
}
.ms-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ms-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-top: 2px;
}

/* State pills */
.pill-state-enabled { background: #dcfce7; color: #166534; }
.pill-state-paused { background: #fef3c7; color: #92400e; }
.pill-state-archived { background: #f1f5f9; color: #475569; }
.pill-state-unknown { background: #f1f5f9; color: #94a3b8; }
.pill-small {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 6px;
  background: #f1f5f9;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}

/* Right-align cell */
.data-table td.r, .data-table th.r {
  text-align: right;
}
.data-table .mono {
  font-family: ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* Button sizes */
.btn.small {
  padding: 4px 10px;
  font-size: 12px;
}

/* ====================================================
   v1.9 — filters, delta indicators, period selector
   ==================================================== */

/* Filter bar */
.filter-bar {
  padding: 14px 18px;
  margin-bottom: 16px;
}
.filter-form { width: 100%; }
.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.filter-group label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  font-weight: 600;
}
.filter-group input, .filter-group select {
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid var(--divider);
  border-radius: 6px;
  background: white;
}
.filter-actions {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--divider);
}

/* Clickable rows */
.data-table.clickable tbody tr {
  cursor: pointer;
  transition: background-color 0.1s;
}
.data-table.clickable tbody tr:hover {
  background: #f8fafc;
}

/* Period selector */
.period-bar {
  padding: 12px 18px;
  margin-bottom: 16px;
}
.period-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.period-pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid transparent;
}
.period-pill:hover {
  background: #e2e8f0;
}
.period-pill.active {
  background: #4f46e5;
  color: white;
}

/* Delta indicators */
.delta {
  font-weight: 600;
  font-size: 12px;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  margin-right: 4px;
}
.delta.up        { background: #fef3c7; color: #92400e; }  /* spend up = warning */
.delta.up-good   { background: #dcfce7; color: #166534; }
.delta.down      { background: #e0e7ff; color: #3730a3; }  /* spend down = neutral-good */
.delta.down-bad  { background: #fee2e2; color: #991b1b; }


/* ====================================================
   v1.10 — advice page enhancements
   ==================================================== */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 12px;
}
.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.advice-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.advice-card {
  background: white;
  border: 1px solid var(--divider);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.advice-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.advice-head-left, .advice-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.advice-keyword {
  font-size: 15px;
}

.advice-context {
  margin-bottom: 10px;
}

.advice-change {
  font-size: 16px;
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
}
.advice-change .from {
  color: #64748b;
  text-decoration: line-through;
}
.advice-change .to.up {
  color: var(--green);
  font-weight: 700;
}
.advice-change .to.down {
  color: #dc2626;
  font-weight: 700;
}
.change-pct {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: system-ui, sans-serif;
  font-weight: 600;
}
.change-pct.up { background: #dcfce7; color: #166534; }
.change-pct.down { background: #fee2e2; color: #991b1b; }

.advice-reasoning {
  margin: 8px 0;
  color: #334155;
  line-height: 1.5;
}

.advice-impact {
  margin: 4px 0;
  font-size: 13px;
  color: #475569;
}

.advice-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.advice-form {
  display: inline;
}

/* Action badges */
.action-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.action-bid_increase { background: #dcfce7; color: #166534; }
.action-bid_decrease { background: #fef3c7; color: #92400e; }
.action-pause_keyword { background: #fee2e2; color: #991b1b; }
.action-add_negative { background: #e0e7ff; color: #3730a3; }

/* Confidence pills */
.confidence-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.conf-high { background: #dcfce7; color: #166534; }
.conf-medium { background: #fef3c7; color: #92400e; }
.conf-low { background: #f1f5f9; color: #64748b; }

/* Provider badges */
.provider-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.provider-badge.kind-anthropic { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.provider-badge.kind-google { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Status pills */
.pill-status-pending { background: #fef3c7; color: #92400e; }
.pill-status-approved { background: #e0e7ff; color: #3730a3; }
.pill-status-applied { background: #dcfce7; color: #166534; }
.pill-status-rejected { background: #f1f5f9; color: #64748b; }
.pill-status-error { background: #fee2e2; color: #991b1b; }
.pill-status-skipped { background: #f1f5f9; color: #94a3b8; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.badge-warn { background: #fee2e2; color: #991b1b; }

/* ====================================================
   v1.11 — log tabs + rate limit highlight
   ==================================================== */

.tab-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--divider);
}
.tab {
  display: inline-block;
  padding: 10px 18px;
  font-weight: 600;
  text-decoration: none;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab:hover {
  color: #334155;
}
.tab.active {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}

/* Rate-limit row highlight */
.log-row.rate-limit {
  background: #fef3c7;
}
.log-row.rate-limit:hover {
  background: #fde68a;
}

/* ====================================================
   v1.12 — clickable sort headers + AI fallback
   ==================================================== */

.th-sort {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  user-select: none;
}
.th-sort:hover {
  color: #4f46e5;
}
.th-sort.active {
  color: #4f46e5;
  font-weight: 700;
}

/* Filter input override — vorm gelijk maken */
.filter-row .filter-group input[type="number"] {
  -moz-appearance: textfield;
}
.filter-row .filter-group input[type="number"]::-webkit-outer-spin-button,
.filter-row .filter-group input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ====================================================
   v1.13 — products page: toggles, bulk bar, inline edits
   ==================================================== */

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  border-radius: 999px;
  transition: 0.2s;
}
.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}
.toggle input:checked + .toggle-slider {
  background-color: #4f46e5;
}
.toggle input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* Inline input fields */
.inline-input {
  padding: 4px 6px;
  font-size: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  text-align: right;
  transition: border-color 0.15s, background-color 0.5s;
  font-variant-numeric: tabular-nums;
}
.inline-input:focus {
  outline: none;
  border-color: #4f46e5;
  background: #eef2ff;
}
.inline-input.saved {
  background: #dcfce7;
  border-color: #16a34a;
}

.products-table th.c, .products-table td.c { text-align: center; }

/* Bulk action bar */
.bulk-bar {
  position: sticky;
  top: 10px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin: 16px 0;
  background: #1e293b;
  color: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  flex-wrap: wrap;
}
.bulk-bar input {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #475569;
  background: #334155;
  color: white;
}
.bulk-bar .btn {
  background: #334155;
  color: white;
  border-color: #475569;
}
.bulk-bar .btn:hover {
  background: #475569;
}

/* ====================================================
   v1.14 — portfolio, dayparting, strategies, cost limits
   ==================================================== */

/* Cost limits fieldset (settings AI providers) */
.cost-limits {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  background: #f8fafc;
}
.cost-limits legend {
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cost-limits-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.cost-limits-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #475569;
}

/* Radio tiles (autonomy mode) */
.radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.radio-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}
.radio-tile:hover { border-color: #94a3b8; }
.radio-tile.selected {
  border-color: #4f46e5;
  background: #eef2ff;
}
.radio-tile input { display: none; }
.radio-tile strong { font-size: 14px; }

/* Permission grid (checkbox tiles) */
.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.checkbox-tile {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
}
.checkbox-tile:hover { border-color: #94a3b8; }
.checkbox-tile.selected {
  border-color: #4f46e5;
  background: #eef2ff;
}
.checkbox-tile input {
  margin-top: 2px;
  width: 16px; height: 16px;
}

/* Dayparting grid (7 rows × 24 columns) */
.dayparting-grid {
  display: grid;
  grid-template-columns: 40px repeat(24, 1fr);
  gap: 2px;
  margin: 16px 0;
  user-select: none;
}
.dp-corner, .dp-hour-label, .dp-day-label {
  text-align: center;
  font-size: 10px;
  color: #64748b;
  padding: 2px;
  font-variant-numeric: tabular-nums;
}
.dp-day-label {
  font-weight: 600;
  text-align: right;
  padding-right: 6px;
}
.dp-cell {
  height: 22px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.dp-cell.on  { background: #86efac; }  /* light green */
.dp-cell.off { background: #fca5a5; }  /* light red */
.dp-cell:hover { opacity: 0.7; transform: scale(0.96); }

/* Strategies grid */
.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.strategy-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  transition: all 0.15s;
}
.strategy-card.active {
  border-color: #4f46e5;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}
.strategy-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.strategy-icon {
  font-size: 32px;
}
.strategy-header h3 {
  margin: 0;
  font-size: 16px;
}
.strategy-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
  margin: 12px 0;
}
.strategy-config {
  width: 100%;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  background: #f8fafc;
  margin: 8px 0;
}

/* ====================================================
   v1.15 — period tabs
   ==================================================== */

.period-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 16px 0 20px;
}
.period-tab {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  text-decoration: none;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}
.period-tab:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}
.period-tab.active {
  border-color: #4f46e5;
  background: linear-gradient(135deg, #eef2ff 0%, #ffffff 100%);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}
.period-name {
  font-weight: 600;
  font-size: 14px;
  color: #1e293b;
}
.period-tab.active .period-name {
  color: #4f46e5;
}
.period-summary {
  font-size: 12px;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.period-summary.muted {
  color: #94a3b8;
  font-style: italic;
}

@media (max-width: 768px) {
  .period-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ====================================================
   v1.15.2 — advice detail + blocked status
   ==================================================== */

.kv-table {
  width: 100%;
  border-collapse: collapse;
}
.kv-table th, .kv-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: top;
}
.kv-table th {
  font-weight: 600;
  color: #475569;
  width: 200px;
  font-size: 13px;
}
.kv-table td {
  font-size: 14px;
  word-break: break-word;
}
.kv-table pre {
  margin: 0;
  font-size: 12px;
  background: #f8fafc;
  padding: 8px;
  border-radius: 4px;
  white-space: pre-wrap;
}

.bid-change-display {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border-radius: 10px;
  margin: 16px 0;
}
.bid-old, .bid-new, .bid-delta {
  flex: 1;
  text-align: center;
}
.bid-amount {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
}
.bid-arrow {
  font-size: 32px;
  color: #4f46e5;
}

/* Status pill: blocked */
.pill-status-blocked {
  background: #fef3c7;
  color: #92400e;
}
.pill-status-applied {
  background: #d1fae5;
  color: #065f46;
}
.pill-status-error {
  background: #fee2e2;
  color: #991b1b;
}
.pill-status-pending {
  background: #dbeafe;
  color: #1e40af;
}
.pill-status-rejected {
  background: #e5e7eb;
  color: #4b5563;
}
.pill-status-skipped {
  background: #f3e8ff;
  color: #6b21a8;
}

/* ====================================================
   v1.15.4 — products page links + campaign display
   ==================================================== */

.ean-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ean-link:hover {
  color: #4f46e5;
  border-bottom-color: #4f46e5;
}
.ean-external {
  font-size: 11px;
  color: #94a3b8;
  font-weight: normal;
}
.ean-link:hover .ean-external {
  color: #4f46e5;
}

.title-link {
  color: #1e293b;
  text-decoration: none;
}
.title-link:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.campaign-link {
  color: #4f46e5;
  text-decoration: none;
  font-weight: 500;
}
.campaign-link:hover {
  text-decoration: underline;
}

/* ====================================================
   v1.15.5 — inline title edit
   ==================================================== */

.title-cell {
  position: relative;
}
.title-display {
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  opacity: 0.3;
  padding: 2px 4px;
  transition: opacity 0.15s;
}
.title-cell:hover .title-edit-btn {
  opacity: 1;
}
.title-edit {
  display: flex;
  gap: 4px;
  align-items: center;
}
.title-input {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  min-width: 200px;
}
.title-input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}
.btn-mini {
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid #cbd5e1;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}
.btn-mini:hover {
  background: #f1f5f9;
}
.title-save {
  color: #16a34a;
  border-color: #16a34a;
}
.title-save:hover {
  background: #f0fdf4;
}
.title-cancel {
  color: #dc2626;
  border-color: #dc2626;
}
.title-cancel:hover {
  background: #fef2f2;
}

/* ====================================================
   v1.16.0 — pagination + sort headers + tags + archive
   ==================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.pagination-info {
  font-size: 13px;
  color: #475569;
}
.pagination-pages {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}
.page-btn {
  padding: 6px 10px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  text-decoration: none;
  color: #475569;
  font-size: 13px;
  min-width: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
}
.page-btn:hover:not(.disabled):not(.active) {
  border-color: #4f46e5;
  color: #4f46e5;
}
.page-btn.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  font-weight: 600;
  cursor: default;
}
.page-btn.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}
.page-ellipsis {
  color: #94a3b8;
  padding: 0 4px;
}
.pagination-per-page {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 13px;
  color: #475569;
}
.per-page-btn {
  padding: 4px 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  text-decoration: none;
  color: #475569;
  font-size: 12px;
  cursor: pointer;
}
.per-page-btn:hover:not(.active) {
  border-color: #4f46e5;
}
.per-page-btn.active {
  background: #f1f5f9;
  color: #4f46e5;
  font-weight: 600;
  cursor: default;
}

/* Sort headers */
.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.sort-header:hover {
  color: #4f46e5;
}
.sort-arrow {
  font-size: 10px;
  opacity: 0.6;
}
.sort-header.active .sort-arrow {
  color: #4f46e5;
  opacity: 1;
  font-weight: bold;
}

/* Tags */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: #eef2ff;
  color: #4338ca;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  margin: 2px;
}
.tag-chip-remove {
  cursor: pointer;
  font-weight: bold;
  opacity: 0.6;
  margin-left: 2px;
}
.tag-chip-remove:hover {
  opacity: 1;
  color: #dc2626;
}
.tag-input-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.tag-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
}
.tag-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.tag-suggestion {
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.tag-suggestion:hover, .tag-suggestion.active {
  background: #f1f5f9;
}

/* Archive button */
.archive-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.3;
  padding: 4px 8px;
}
tr:hover .archive-btn {
  opacity: 1;
}
.archive-btn:hover {
  color: #dc2626;
}

/* Connection badge in row */
.conn-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  background: #f1f5f9;
  color: #475569;
  border-radius: 3px;
  white-space: nowrap;
}

/* ====================================================
   v1.16.2 — data freshness banner
   ==================================================== */

.freshness-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: 8px;
  margin: 12px 0;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid;
}
.freshness-banner.fresh {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border-color: #86efac;
  color: #15803d;
}
.freshness-banner.normal {
  background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
  border-color: #fde047;
  color: #854d0e;
}
.freshness-banner.stale {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fca5a5;
  color: #b91c1c;
}
.freshness-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.freshness-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.info-tip {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  text-align: center;
  font-size: 11px;
  line-height: 16px;
  cursor: help;
  color: inherit;
  margin-left: 2px;
}
.btn.btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/* ====================================================
   v1.16.2 — freshness banner + bulk approve bar
   ==================================================== */

.freshness-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
  border: 1px solid #c7d2fe;
  border-radius: 8px;
  margin: 16px 0;
}
.freshness-icon {
  font-size: 24px;
}
.freshness-body {
  flex: 1;
}

.bulk-approve-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px !important;
  background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
  border: 1px solid #fbbf24;
  margin-bottom: 16px;
}
.bulk-approve-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bulk-approve-actions label {
  font-size: 13px;
  color: #475569;
}
.bulk-approve-actions select {
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  margin-left: 4px;
}

/* ====================================================
   v1.17.1 — Strategy cards + modal + toggle switch
   ==================================================== */

.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.strategy-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  border: 2px solid #e2e8f0;
  transition: all 0.2s;
  position: relative;
}
.strategy-card.active {
  border-color: #6366f1;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
}
.strategy-card.inactive {
  opacity: 0.6;
}
.strategy-card.inactive:hover {
  opacity: 0.9;
}

.strategy-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.strategy-icon {
  font-size: 32px;
  line-height: 1;
}
.strategy-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.strategy-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.strategy-toggle {
  flex-shrink: 0;
}

.strategy-desc {
  font-size: 13px;
  color: #64748b;
  margin: 8px 0 12px;
  line-height: 1.4;
  min-height: 36px;
}

.strategy-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px;
  background: #f8fafc;
  border-radius: 6px;
  margin-bottom: 8px;
}
.strategy-stats .stat {
  text-align: center;
}
.strategy-stats .stat-label {
  font-size: 10px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.strategy-stats .stat-value {
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  margin-top: 2px;
}

.strategy-extra {
  font-size: 12px;
  color: #64748b;
  padding: 4px 0;
}

.strategy-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.strategy-actions .btn.small {
  font-size: 11px;
  padding: 4px 8px;
  flex: 1;
}

/* Badges */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-system { background: #ede9fe; color: #5b21b6; }
.badge-custom { background: #dbeafe; color: #1e40af; }
.badge-usage {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}

/* Toggle switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #cbd5e1;
  transition: 0.2s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  transition: 0.2s;
  border-radius: 50%;
}
input:checked + .slider {
  background: #6366f1;
}
input:checked + .slider:before {
  transform: translateX(20px);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #94a3b8;
  padding: 0;
  width: 32px;
  height: 32px;
}
.modal-close:hover { color: #1e293b; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-row {
  margin-bottom: 16px;
}
.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #475569;
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.form-row textarea { resize: vertical; }
.form-row small { font-size: 11px; color: #94a3b8; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn-danger {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}
.btn-danger:hover {
  background: #fecaca !important;
}

/* Inline feedback */
.bid-limits-feedback {
  margin-left: 8px;
  font-size: 12px;
  font-weight: 500;
}


/* ====================================================
   v1.17.3 — Insights result KPI grid + tables
   ==================================================== */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.result-kpi {
  background: #f8fafc;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.result-kpi-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.result-kpi-value {
  font-size: 22px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.2;
}
.result-kpi-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.mini-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
}
.mini-table td:first-child {
  color: #64748b;
  width: 40%;
}


/* ====================================================
   v1.17.4 — Wizard proposal cards
   ==================================================== */
.proposal-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 16px 0;
  transition: all 0.2s;
}
.proposal-card.draft {
  border-left: 4px solid #6366f1;
}
.proposal-card.created {
  border-left: 4px solid #16a34a;
  background: #f0fdf4;
}
.proposal-card.failed {
  border-left: 4px solid #dc2626;
  background: #fef2f2;
}
.proposal-card.rejected {
  opacity: 0.5;
}

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

.proposal-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  background: #f8fafc;
  border-radius: 6px;
}
.param label {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.param-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  padding: 4px 8px;
}
.param-input-group input {
  border: none;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  outline: none;
}
.param-input-group span {
  color: #64748b;
  font-size: 13px;
}
.param select {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 13px;
  background: white;
}

.proposal-estimates {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: #ede9fe;
  border-radius: 6px;
  font-size: 13px;
  color: #5b21b6;
  margin: 8px 0;
}

.proposal-reasoning {
  font-size: 13px;
  color: #475569;
  background: #fefce8;
  padding: 10px 12px;
  border-radius: 6px;
  border-left: 3px solid #facc15;
  margin: 8px 0;
  line-height: 1.5;
}

.proposal-products {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
}
.proposal-products summary {
  cursor: pointer;
  font-weight: 500;
  color: #475569;
  font-size: 13px;
}


/* v1.17.5 — Discovery banner */
.discovery-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fef3c7 0%, #fff7ed 100%);
  border: 1px solid #fbbf24;
  border-radius: 8px;
  margin: 16px 0;
}
.discovery-banner .freshness-icon {
  font-size: 28px;
}
.discovery-banner .freshness-body {
  flex: 1;
}
.discovery-banner .btn.primary {
  white-space: nowrap;
}


/* v1.17.6 — Kill-switch banner */
.killswitch-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: 8px;
  margin: 0 0 16px;
  border-width: 2px;
  border-style: solid;
}
.killswitch-banner.active {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border-color: #16a34a;
}
.killswitch-banner.paused {
  background: linear-gradient(135deg, #fef2f2 0%, #fff7ed 100%);
  border-color: #dc2626;
  animation: pulse-paused 2s ease-in-out infinite;
}
@keyframes pulse-paused {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}
.btn-stop {
  background: #dc2626 !important;
  color: white !important;
  border-color: #dc2626 !important;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 16px;
}
.btn-stop:hover {
  background: #b91c1c !important;
  border-color: #b91c1c !important;
}
