:root {
  color-scheme: dark;

  /* Brand — Context Goblin */
  --goblin-green: #a6ff3d;
  --deep-violet: #8b6bff;
  --treasure-gold: #ffb648;
  --gate-coral: #ff5c72;

  --accent: var(--goblin-green);
  --accent-dark: #7fd92a;
  --on-accent: #0a0c0e;
  --violet: var(--deep-violet);
  --brand-primary: var(--goblin-green);
  --brand-primary-rgb: 166 255 61;
  --violet-rgb: 139 107 255;
  --coral-rgb: 255 92 114;
  --gold-rgb: 255 182 72;

  /* Surfaces & neutrals — dark-mode-first */
  --canvas: #0a0c0e;
  --surface: #12151a;
  --surface-raised: #1b1f26;
  --surface-soft: #1b1f26;
  --line: #2b313a;
  --ink: #edf1f5;
  --muted: #8e98a3;
  --navy: #0a0c0e;

  /* Status */
  --success: var(--goblin-green);
  --danger: var(--gate-coral);
  --warning: var(--treasure-gold);

  /* Type */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-ui: Manrope, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --sidebar-width: 260px;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 95% 5%, rgb(var(--brand-primary-rgb) / 0.05), transparent 28rem),
    var(--canvas);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 16px;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 8%, rgb(var(--brand-primary-rgb) / 0.10), transparent 12rem),
    linear-gradient(180deg, #12151a, #0a0c0e 72%);
  border-right: 1px solid var(--line);
  transition: width 180ms ease;
}

.brand {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 12px;
  padding: 0 7px;
}

.brand-mark {
  width: 40px;
  min-width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  white-space: nowrap;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.brand-copy strong span {
  color: var(--accent);
}

.brand-copy small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.icon-button {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.icon-button svg {
  width: 18px;
  transition: transform 180ms ease;
}

.navigation {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  margin-top: 48px;
}

.nav-label {
  margin: 0 12px 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  gap: 13px;
  padding: 0 13px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-weight: 600;
  text-align: left;
  transition: 150ms ease;
}

/* Admin-only nav items (MCP Servers, Settings) are hidden for regular users.
   Their pages are reachable only via the admin routes (#admin-settings,
   #admin-mcp), which reveal these links for the session. See app.js. */
.nav-item[data-admin] {
  display: none;
}

.sidebar.admin-visible .nav-item[data-admin] {
  display: flex;
}

.nav-item svg {
  width: 20px;
  min-width: 20px;
}

.nav-item:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
}

.nav-item.active {
  color: var(--ink);
  border-color: var(--line);
  background: linear-gradient(90deg, rgb(var(--brand-primary-rgb) / 0.16), rgb(var(--brand-primary-rgb) / 0.04));
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(var(--brand-primary-rgb) / 0.16);
}

.sidebar.collapsed {
  width: 78px;
}

.sidebar.collapsed .brand-copy,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-footer span:last-child {
  display: none;
}

.sidebar.collapsed .brand {
  padding: 0 5px;
  flex-wrap: wrap;
  justify-content: center;
}

.sidebar.collapsed .collapse-button {
  position: absolute;
  top: 80px;
}

.sidebar.collapsed .collapse-button svg {
  transform: rotate(180deg);
}

.sidebar.collapsed .navigation {
  margin-top: 72px;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.sidebar.collapsed + .main-content {
  margin-left: 78px;
}

.main-content {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left 180ms ease;
}

.page {
  display: none;
  width: min(1120px, calc(100% - 80px));
  margin: 0 auto;
  padding: 64px 0 96px;
  animation: page-in 220ms ease;
}

.page.active {
  display: block;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-header {
  position: relative;
  display: flex;
  min-height: 190px;
  align-items: center;
  overflow: hidden;
  margin-bottom: 34px;
  padding: 42px 48px;
  color: var(--ink);
  border-radius: 14px;
  background:
    radial-gradient(circle at 88% 25%, rgb(var(--brand-primary-rgb) / 0.12), transparent 22rem),
    linear-gradient(115deg, #1b1f26, #0a0c0e 76%),
    var(--navy);
  border: 1px solid var(--line);
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
}

.page-header::before {
  position: absolute;
  width: 340px;
  height: 340px;
  right: -90px;
  bottom: -190px;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255, 255, 255, 0.035), 0 0 0 88px rgba(255, 255, 255, 0.025);
}

.page-header.compact {
  min-height: auto;
  color: var(--ink);
  border: 0;
  background: transparent;
  box-shadow: none;
  margin-bottom: 38px;
  padding: 12px 0;
}

.page-header.compact::before {
  display: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-header:not(.compact) .eyebrow {
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 750;
}

h1 {
  max-width: 720px;
  margin-bottom: 13px;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  letter-spacing: -0.025em;
}

.page-description {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.page-header:not(.compact) .page-description {
  color: var(--muted);
}

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

.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 13px;
}

.callout-warning {
  border: 1px solid var(--warning);
  background: rgba(217, 154, 43, 0.12);
  color: var(--ink);
}

.callout-warning a {
  flex: 0 0 auto;
  color: var(--warning);
  font-weight: 700;
  text-decoration: none;
}

.review-launcher {
  padding: 28px;
}

.review-launcher form {
  width: 100%;
}

label {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

label span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.review-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: end;
  gap: 20px;
  margin-bottom: 12px;
}

.review-url-field {
  min-width: 0;
}

.effort-field label {
  display: flex;
  justify-content: space-between;
}

.effort-field label strong {
  color: var(--accent);
  font-size: 12px;
  text-transform: capitalize;
}

#review-thinking {
  width: 100%;
  height: 50px;
  padding: 0;
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}

#review-thinking::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: var(--line);
}

#review-thinking::-webkit-slider-thumb {
  width: 17px;
  height: 17px;
  margin-top: -6px;
  appearance: none;
  border: 3px solid var(--canvas);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 5px rgb(var(--brand-primary-rgb) / 0.35);
}

#review-thinking::-moz-range-track {
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--line);
}

#review-thinking::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid var(--canvas);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 5px rgb(var(--brand-primary-rgb) / 0.35);
}

.input-shell {
  position: relative;
}

.input-shell svg {
  position: absolute;
  top: 50%;
  left: 17px;
  width: 20px;
  color: var(--muted);
  transform: translateY(-50%);
}

input,
textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface-raised);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input {
  height: 50px;
  padding: 0 15px;
}

.input-shell input {
  padding-left: 49px;
}

textarea {
  resize: vertical;
  padding: 13px 15px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(var(--brand-primary-rgb) / 0.12);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(var(--brand-primary-rgb) / 0.3);
  outline-offset: 2px;
}

.primary-button {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  color: var(--on-accent);
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 10px 24px rgb(var(--brand-primary-rgb) / 0.24);
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

#start-review {
  margin-top: 12px;
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgb(var(--brand-primary-rgb) / 0.31);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.primary-button svg {
  width: 18px;
}

.full-width {
  width: 100%;
}

.review-progress,
.result-section {
  margin-top: 42px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-heading .eyebrow {
  margin-bottom: 5px;
}

.section-heading.simple {
  align-items: center;
}

.run-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  color: var(--accent);
  border: 1px solid rgb(var(--brand-primary-rgb) / 0.18);
  border-radius: 99px;
  background: rgb(var(--brand-primary-rgb) / 0.07);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.run-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgb(var(--brand-primary-rgb) / 0.12);
  animation: pulse 1.2s infinite;
}

.run-status.complete {
  color: var(--success);
  border-color: rgb(var(--brand-primary-rgb) / 0.28);
  background: rgb(var(--brand-primary-rgb) / 0.10);
}

.run-status.complete i {
  animation: none;
}

.run-status.failed {
  color: var(--danger);
  border-color: rgb(var(--coral-rgb) / 0.28);
  background: rgb(var(--coral-rgb) / 0.10);
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

.flow-card {
  overflow-x: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.review-flow {
  display: flex;
  min-width: 1010px;
  align-items: center;
}

.flow-node,
.agent-stage {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  transition: 160ms ease;
}

.flow-node {
  display: flex;
  width: 116px;
  min-height: 106px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 14px 10px;
  text-align: center;
}

.flow-node strong,
.agent-stage strong {
  margin-top: 9px;
  font-size: 13px;
}

.flow-node small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.flow-marker {
  position: relative;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.flow-connector {
  min-width: 20px;
  height: 2px;
  flex: 1 1 28px;
  background: var(--line);
  transition: background 160ms ease;
}

.flow-connector.complete {
  background: var(--success);
}

.flow-node.active,
.agent-stage.active {
  border-color: rgb(var(--brand-primary-rgb) / 0.45);
  background: var(--surface-soft);
  box-shadow: 0 8px 24px rgb(var(--brand-primary-rgb) / 0.1);
}

.active > .flow-marker,
.agent-stage.active .agent-stage-title > .flow-marker {
  border-color: var(--accent);
  box-shadow: 0 0 0 5px rgb(var(--brand-primary-rgb) / 0.1);
}

.active > .flow-marker::after,
.agent-stage.active .agent-stage-title > .flow-marker::after {
  width: 7px;
  height: 7px;
  content: "";
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s infinite;
}

.complete > .flow-marker,
.agent-stage.complete .agent-stage-title > .flow-marker {
  color: var(--on-accent);
  border-color: var(--success);
  background: var(--success);
}

.complete > .flow-marker::after,
.agent-stage.complete .agent-stage-title > .flow-marker::after {
  content: "✓";
  font-size: 13px;
  font-weight: 700;
}

.failed > .flow-marker,
.agent-stage.failed .agent-stage-title > .flow-marker {
  border-color: var(--danger);
  background: rgb(var(--coral-rgb) / 0.14);
}

.agent-stage {
  width: 186px;
  padding: 13px;
}

.agent-stage-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 11px;
}

.agent-stage-title strong {
  margin: 0;
}

.agent-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.agent-node {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  font-size: 9px;
  font-weight: 700;
}

.agent-node span {
  display: grid;
  width: 16px;
  min-width: 16px;
  height: 16px;
  place-items: center;
  color: var(--muted);
  border-radius: 5px;
  background: var(--canvas);
  font-size: 8px;
}

.agent-node.active {
  color: var(--accent);
  border-color: rgb(var(--brand-primary-rgb) / 0.35);
  background: var(--surface-soft);
}

.agent-node.active span {
  color: var(--on-accent);
  background: var(--accent);
}

.agent-node.complete {
  color: var(--success);
  border-color: rgb(var(--brand-primary-rgb) / 0.30);
}

.agent-node.complete span {
  color: var(--on-accent);
  background: var(--success);
}

.agent-node.failed {
  color: var(--danger);
  border-color: rgb(var(--coral-rgb) / 0.35);
}

.markdown-body {
  padding: 34px 40px;
  line-height: 1.72;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  margin-top: 1.6em;
  margin-bottom: 0.65em;
}

.markdown-body h1:first-child,
.markdown-body h2:first-child,
.markdown-body h3:first-child {
  margin-top: 0;
}

.markdown-body h1 { font-size: 28px; }
.markdown-body h2 { font-size: 22px; }
.markdown-body h3 { font-size: 18px; }
.markdown-body p, .markdown-body li { color: var(--ink); }
.markdown-body a { color: var(--violet); }
.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-raised);
  font-family: var(--font-mono);
  font-size: 0.88em;
}
.markdown-body pre {
  overflow: auto;
  padding: 18px;
  color: var(--ink);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--canvas);
}
.markdown-body pre code { padding: 0; background: transparent; }
.markdown-body blockquote {
  margin-left: 0;
  padding-left: 18px;
  color: var(--muted);
  border-left: 3px solid var(--accent);
}
.markdown-body table { width: 100%; border-collapse: collapse; }
.markdown-body th, .markdown-body td { padding: 10px; border: 1px solid var(--line); text-align: left; }

.review-error {
  margin-bottom: 24px;
  padding: 14px 16px;
  color: var(--danger);
  border: 1px solid rgb(var(--coral-rgb) / 0.30);
  border-radius: 9px;
  background: rgb(var(--coral-rgb) / 0.10);
}

.review-error p {
  margin: 5px 0 0;
  color: inherit;
  white-space: pre-wrap;
}

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

.run-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.run-card.open {
  border-color: rgb(var(--brand-primary-rgb) / 0.35);
  box-shadow: var(--shadow);
}

.run-summary {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 2fr) auto auto 22px;
  align-items: center;
  gap: 18px;
  padding: 19px 22px;
  color: inherit;
  border: 0;
  background: transparent;
  text-align: left;
}

.run-summary:hover {
  background: var(--surface-raised);
}

.review-id {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.run-repo {
  overflow: hidden;
  color: var(--ink);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-date {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.pill,
.pr-badge,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

.pr-badge {
  padding: 5px 9px;
  color: var(--treasure-gold);
  background: rgb(var(--gold-rgb) / 0.14);
  white-space: nowrap;
}

.run-chevron {
  width: 18px;
  color: var(--muted);
  transition: transform 150ms ease;
}

.run-card.open .run-chevron {
  transform: rotate(180deg);
}

.run-details {
  display: none;
  border-top: 1px solid var(--line);
}

.run-card.open .run-details {
  display: block;
}

.run-details .markdown-body {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.empty-state {
  display: flex;
  min-height: 360px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 50px;
  text-align: center;
}

.empty-mascot {
  width: 132px;
  height: 132px;
  margin-bottom: 20px;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.5));
}
.empty-state h2 { margin-bottom: 10px; }
.empty-state p { max-width: 440px; color: var(--muted); }
.pill { padding: 6px 11px; color: var(--accent); background: var(--surface-soft); }

.mcp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1.2fr);
  gap: 28px;
  align-items: start;
}

.count-badge {
  min-width: 26px;
  height: 26px;
  color: var(--accent);
  background: var(--surface-soft);
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.server-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.server-icon {
  display: grid;
  width: 38px;
  min-width: 38px;
  height: 38px;
  place-items: center;
  color: var(--accent);
  border-radius: 10px;
  background: var(--surface-soft);
}

.server-icon svg { width: 18px; }
.server-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.server-icon img + svg { display: none; }
.server-icon img.hidden + svg { display: block; }
.server-info { min-width: 0; flex: 1; }
.server-info strong { display: block; margin-bottom: 3px; }
.server-info span { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.server-info .direct-tools-summary { display: block; margin-top: 4px; color: var(--accent); font-size: 11px; }

.server-actions { display: flex; align-items: center; gap: 3px; }

.edit-button,
.remove-button {
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.edit-button { color: var(--accent); }
.edit-button:hover { background: var(--surface-soft); }

.remove-button {
  color: var(--muted);
}

.remove-button:hover { color: var(--danger); background: rgb(var(--coral-rgb) / 0.12); }

.add-server-card {
  padding: 28px;
}

.add-server-card form > label:not(:first-child) { margin-top: 17px; }
.add-server-card .primary-button { margin-top: 20px; }
.form-message { min-height: 18px; margin: 10px 0 0; color: var(--danger); font-size: 12px; }

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 19px;
}

.field-label-row label {
  margin: 0;
}

.field-label-row span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.header-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 9px;
}

.header-row {
  display: grid;
  grid-template-columns: 1fr 1fr 30px;
  gap: 8px;
}

.header-row input {
  min-width: 0;
  height: 42px;
  font-size: 12px;
}

.header-row button {
  padding: 0;
  color: var(--muted);
  border: 0;
  border-radius: 7px;
  background: transparent;
  font-size: 20px;
}

.header-row button:hover {
  color: var(--danger);
  background: rgb(var(--coral-rgb) / 0.12);
}

.add-header-button {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  color: var(--accent);
  border: 1px dashed rgb(var(--brand-primary-rgb) / 0.3);
  border-radius: 8px;
  background: rgb(var(--brand-primary-rgb) / 0.04);
  font-size: 12px;
  font-weight: 700;
}

.add-header-button:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.direct-tools-panel h3 { margin: 12px 0 6px; }

.tools-intro-step {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid rgb(var(--brand-primary-rgb) / 0.16);
  border-radius: 9px;
  background: var(--surface-soft);
}

.tools-intro-step .settings-help {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
}

.panel-back-button,
.direct-tools-actions button {
  padding: 0;
  color: var(--accent);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.direct-tools-actions {
  display: flex;
  gap: 14px;
  margin: 18px 0 10px;
}

.direct-tools-list {
  display: flex;
  max-height: 430px;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.direct-tool-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.direct-tool-option:has(input:checked) {
  border-color: rgb(var(--brand-primary-rgb) / 0.35);
  background: var(--surface-soft);
}

.direct-tool-option input { margin-top: 3px; accent-color: var(--accent); }
.direct-tool-option strong { display: block; overflow-wrap: anywhere; font-size: 12px; }
.direct-tool-option small {
  display: -webkit-box;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.direct-tool-option small.expanded {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

.tool-description-toggle {
  margin-top: 6px;
  padding: 0;
  color: var(--accent);
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.tool-description-toggle:hover {
  color: var(--accent-dark);
}

.settings-card {
  max-width: 720px;
  padding: 32px;
}

.settings-card + .settings-card {
  margin-top: 36px;
}

.integration-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.integration-heading h2,
.integration-heading p {
  margin: 0;
}

.integration-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.integration-mark {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  color: var(--ink);
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  place-items: center;
}

.integration-mark svg {
  width: 23px;
}

.model-mark {
  color: var(--on-accent);
  border-color: transparent;
  background: var(--accent);
}

.github-installations {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.github-installation,
.github-installation-empty {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
}

.github-installation {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
}

.github-installation span {
  display: flex;
  min-width: 0;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 3px;
}

.github-installation small,
.github-installation-empty {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.github-installation-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.github-manage-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.github-disconnect-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.github-disconnect-link:hover {
  color: var(--danger);
}

.automation-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 22px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.automation-setting span {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: inherit;
  font-size: inherit;
  letter-spacing: normal;
  text-transform: none;
}

.automation-setting small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.automation-setting input {
  width: 42px;
  min-width: 42px;
  height: 23px;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  box-shadow: none;
  transition: background 140ms ease;
}

.automation-setting input::after {
  display: block;
  width: 17px;
  height: 17px;
  margin: 3px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  content: "";
  transition: transform 140ms ease;
}

.automation-setting input:checked {
  background: var(--accent);
}

.automation-setting input:checked::after {
  transform: translateX(19px);
}

.automation-setting input:disabled {
  cursor: default;
  opacity: 0.55;
}

.active-model-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 28px;
  padding: 18px 20px;
  border: 1px solid rgb(var(--brand-primary-rgb) / 0.18);
  border-radius: 12px;
  background: var(--surface-soft);
}

.active-model-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.active-model-label i,
.auth-badge i,
.selected-auth-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgb(var(--brand-primary-rgb) / 0.16);
}

.active-model-summary strong {
  font-size: 17px;
}

.active-model-summary small {
  color: var(--muted);
}

.settings-field {
  margin-bottom: 22px;
}

.provider-picker {
  position: relative;
}

.provider-trigger,
.settings-card select {
  width: 100%;
  height: 50px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface-raised);
}

.provider-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
}

.provider-trigger:focus,
.settings-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(var(--brand-primary-rgb) / 0.1);
}

.provider-trigger > svg {
  width: 18px;
  color: var(--muted);
  transition: transform 150ms ease;
}

.provider-trigger[aria-expanded="true"] > svg {
  transform: rotate(180deg);
}

.provider-choice,
.provider-option {
  display: flex;
  align-items: center;
  gap: 11px;
}

.provider-icon {
  position: relative;
  display: grid;
  width: 26px;
  min-width: 26px;
  height: 26px;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--canvas);
  font-size: 11px;
  font-weight: 700;
}

.provider-icon img {
  position: absolute;
  width: 18px;
  height: 18px;
  object-fit: contain;
  background: #fff;
}

.provider-options {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  left: 0;
  z-index: 20;
  overflow: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-raised);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55);
}

.provider-option {
  width: 100%;
  padding: 10px;
  color: var(--ink);
  border: 0;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.provider-option:hover,
.provider-option[aria-selected="true"] {
  background: var(--surface-soft);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
}

.auth-badge i {
  display: block;
}

.selected-auth-dot {
  display: inline-block;
  margin-left: 2px;
}

.settings-key-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.secondary-button {
  padding: 0 16px;
  color: var(--accent);
  border: 1px solid rgb(var(--brand-primary-rgb) / 0.25);
  border-radius: 10px;
  background: var(--surface-soft);
  font-weight: 700;
}

.secondary-button:disabled {
  cursor: default;
  opacity: 0.55;
}

.settings-card select {
  padding: 0 14px;
}

.settings-card select:disabled,
.settings-card input:disabled {
  color: var(--muted);
  background: var(--canvas);
}

.settings-help {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.provider-session {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -5px 0 22px;
  padding: 11px 12px 11px 14px;
  border: 1px solid rgb(var(--brand-primary-rgb) / 0.25);
  border-radius: 10px;
  background: rgb(var(--brand-primary-rgb) / 0.08);
}

.provider-session-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.provider-session-status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(var(--brand-primary-rgb) / 0.16);
}

.logout-provider {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}

.logout-provider svg {
  width: 15px;
}

.logout-provider:hover {
  color: var(--danger);
  border-color: rgb(var(--coral-rgb) / 0.35);
  background: rgb(var(--coral-rgb) / 0.10);
}

.settings-card .form-message {
  margin-top: 12px;
}

.loading-state,
.list-empty {
  padding: 32px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 108px;
  bottom: 32px;
  z-index: 50;
  max-width: 360px;
  padding: 13px 17px;
  color: var(--ink);
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.feedback-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.feedback-toggle {
  width: 72px;
  height: 72px;
  border: none;
  border-radius: 50%;
  font-size: 32px;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
  box-shadow: 0 12px 30px rgb(var(--brand-primary-rgb) / 0.4);
  transition: transform 140ms ease;
}

.feedback-toggle:hover {
  transform: translateY(-2px);
}

.feedback-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 420px;
  max-width: calc(100vw - 48px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feedback-label {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.feedback-text {
  resize: vertical;
  min-height: 140px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--canvas);
}

.feedback-text:focus {
  outline: none;
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .mcp-grid { grid-template-columns: 1fr; }
  .run-summary { grid-template-columns: 1fr auto; gap: 8px 14px; }
  .run-repo { grid-column: 1; }
  .run-date { grid-column: 1; }
  .run-chevron { grid-column: 2; grid-row: 1 / 4; }
  .pr-badge { grid-column: 2; grid-row: 2; }
}

@media (max-width: 700px) {
  :root { --sidebar-width: 78px; }
  .github-installation { align-items: flex-start; flex-direction: column; }
  .sidebar { width: 78px; }
  .brand-copy, .nav-item span, .nav-label, .sidebar-footer span:last-child, .collapse-button { display: none; }
  .brand { justify-content: center; }
  .navigation { margin-top: 60px; }
  .nav-item { justify-content: center; padding: 0; }
  .main-content { margin-left: 78px; }
  .page { width: min(100% - 32px, 1120px); padding-top: 28px; }
  .page-header { padding: 30px 26px; }
  .review-input-row { grid-template-columns: 1fr; gap: 10px; }
  .settings-key-row { grid-template-columns: 1fr; }
  .secondary-button { min-height: 44px; }
  .primary-button { width: 100%; }
  .markdown-body { padding: 25px 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

::placeholder {
  color: var(--muted);
  opacity: 1;
}

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

* {
  scrollbar-color: var(--line) transparent;
}
