:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-strong: #eef2f7;
  --ink: #142033;
  --muted: #637083;
  --accent: #2563eb;
  --accent-deep: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --teal: #0f766e;
  --teal-soft: rgba(15, 118, 110, 0.1);
  --warn: #b45309;
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.1);
  --success: #047857;
  --success-soft: rgba(4, 120, 87, 0.1);
  --line: #d9e1ec;
  --shadow: 0 12px 34px rgba(20, 32, 51, 0.08);
  --radius: 8px;
  --radius-sm: 8px;
  --max: 1180px;
  --heading-font: "Avenir Next", "Segoe UI", sans-serif;
  --body-font: "Avenir Next", "Segoe UI", sans-serif;
  --mono-font: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

.shell {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
}

.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  position: relative;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 11px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 5px;
}

.brand h1,
.brand strong {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.nav-link,
.button,
button {
  border: 0;
  border-radius: 8px;
  padding: 11px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.nav-link {
  color: var(--muted);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.nav-link:hover,
.button:hover,
button:hover {
  transform: translateY(-1px);
}

.button,
button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(245, 158, 11, 0.18);
}

.button.secondary,
button.secondary {
  background: var(--panel-strong);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.teal,
button.teal {
  background: linear-gradient(135deg, var(--teal) 0%, #0891b2 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.16);
}

.hero,
.section,
.card,
.data-panel,
.table-card,
.report-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

main.shell {
  padding: 28px 0 56px;
}

.hero {
  padding: 34px;
  overflow: hidden;
  position: relative;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.85rem;
  font-family: var(--body-font);
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h2,
.page-title {
  margin: 16px 0 10px;
  font-family: var(--heading-font);
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.hero p,
.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-actions,
.button-row,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.command-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
  margin-top: 24px;
  position: relative;
  z-index: 1;
}

.command-panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #f8fafc;
}

.command-panel.featured {
  border-color: rgba(37, 99, 235, 0.26);
  background: #eff6ff;
}

.command-panel h3 {
  margin: 14px 0 8px;
}

.command-panel p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.stat-card,
.mini-stat {
  padding: 18px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--line);
}

.stat-card .label,
.mini-stat .label {
  color: var(--muted);
  font-size: 0.9rem;
}

.stat-card .value,
.mini-stat .value {
  margin-top: 8px;
  font-size: 2rem;
  font-weight: 700;
}

.section {
  margin-top: 20px;
  padding: 26px;
}

.section h3,
.card h3,
.data-panel h3,
.table-card h3,
.report-panel h3 {
  margin: 0 0 8px;
  font-size: clamp(1.1rem, 1.6vw, 1.28rem);
  line-height: 1.25;
}

.section p,
.card p,
.subtle,
label span,
small,
td,
th,
li {
  color: var(--muted);
  line-height: 1.6;
}

.card,
.data-panel,
.table-card,
.report-panel {
  padding: 22px;
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
  align-items: stretch;
}

.focus-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.browser-launch-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.browser-run-results {
  margin-top: 18px;
}

.setup-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card > :last-child {
  margin-bottom: 0;
}

.card > button:last-child,
.card > .button:last-child {
  margin-top: auto;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  background: #eef2f7;
  color: var(--ink);
}

.badge.warn {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge.ok {
  background: var(--success-soft);
  color: var(--success);
}

.badge.teal {
  background: var(--teal-soft);
  color: var(--teal);
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.toggle-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 14px;
  color: var(--ink);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  font: inherit;
  background: #ffffff;
  color: var(--ink);
}

.toggle-control input {
  width: 42px;
  height: 22px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--teal);
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.74);
}

textarea {
  min-height: 132px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: rgba(37, 99, 235, 0.48);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.feedback {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  display: none;
}

.feedback.visible {
  display: block;
}

.feedback.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: rgba(17, 107, 79, 0.12);
}

.feedback.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: rgba(165, 36, 36, 0.12);
}

.feedback.info {
  background: var(--accent-soft);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.18);
}

.job-status-panel {
  margin: 0 0 18px;
  padding: 18px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.job-status-panel .toolbar {
  justify-content: space-between;
}

.job-status-panel p {
  margin: 10px 0 0;
}

.job-card {
  position: relative;
}

.job-card.is-running {
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(37, 99, 235, 0.12),
    0 0 30px rgba(37, 99, 235, 0.08);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 8px;
  font-family: var(--mono-font);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
}

.status-pill.running {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.26);
  color: var(--accent-deep);
}

.status-pill.completed {
  background: var(--success-soft);
  border-color: rgba(52, 211, 153, 0.22);
  color: var(--success);
}

.status-pill.failed {
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.22);
  color: var(--danger);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 8px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse-dot 1.4s ease-out infinite;
}

@keyframes pulse-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45);
  }

  70% {
    box-shadow: 0 0 0 9px rgba(37, 99, 235, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

.table-wrap {
  overflow-x: auto;
}

.matrix-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(2, 6, 23, 0.22);
}

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

.matrix-table {
  min-width: 980px;
}

.matrix-table th,
.matrix-table td {
  padding: 14px 16px;
}

.matrix-table th {
  color: var(--muted);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f8fafc;
}

.matrix-table tr:last-child td {
  border-bottom: 0;
}

.matrix-table td:first-child {
  color: var(--ink);
  font-weight: 700;
}

.muted-token {
  display: inline-flex;
  padding: 0.18rem 0.45rem;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.1);
  font-size: 0.9rem;
}

th,
td {
  padding: 12px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

ul.clean {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.clean li + li {
  margin-top: 10px;
}

.metric-list {
  display: grid;
  gap: 14px;
}

.metric-row {
  display: grid;
  gap: 8px;
}

.meter {
  height: 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--teal) 0%, var(--accent) 100%);
}

.split {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.portal-footer {
  padding: 0 0 38px;
  color: var(--muted);
}

.portal-footer .shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hide {
  display: none !important;
}

.auth-chip {
  padding: 10px 14px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  border: 1px solid var(--line);
}

.hero-rail {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.accent-panel {
  background: #eff6ff;
  border-radius: var(--radius-sm);
  padding: 18px;
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.muted-panel {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 18px;
  border: 1px solid rgba(245, 158, 11, 0.14);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
}

.code-snippet {
  width: 100%;
  margin-top: auto;
  padding: 14px;
  border-radius: 8px;
  font-family: var(--mono-font);
  font-size: clamp(0.78rem, 1vw, 0.88rem);
  line-height: 1.55;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  overflow-x: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

code {
  max-width: 100%;
  padding: 0.12rem 0.32rem;
  border-radius: 0.35rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--mono-font);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

@media (max-width: 920px) {
  .grid.three,
  .grid.two,
  .stat-grid,
  .split,
  .hero-rail,
  .command-grid,
  .focus-grid,
  .browser-launch-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .site-header .shell {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  main.shell {
    padding-top: 18px;
  }

  .hero,
  .section,
  .card,
  .data-panel,
  .table-card,
  .report-panel {
    padding: 20px;
    border-radius: 8px;
  }

  .hero h2,
  .page-title {
    line-height: 1.02;
  }
}

.service-hero {
  min-height: 320px;
}

.ticket-list {
  display: grid;
  gap: 18px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

.tool-card {
  display: grid;
  gap: 16px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.tool-card h3 {
  margin: 10px 0 8px;
}

.endpoint-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.endpoint-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.ticket-thread {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.ticket-header h3 {
  margin: 10px 0 4px;
}

.conversation-feed {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.conversation-message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.conversation-message.provider {
  background: #eff6ff;
  border-color: rgba(37, 99, 235, 0.22);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: baseline;
  color: var(--muted);
  margin-bottom: 8px;
}

.message-meta strong {
  color: var(--ink);
}

.message-body {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.reply-form {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.xss-note {
  margin-top: 18px;
}
