:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ee;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --green: #059669;
  --green-soft: #d1fae5;
  --cyan: #0891b2;
  --cyan-soft: #cffafe;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --slate: #334155;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
  font-family: "IBM Plex Sans", "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 0%, rgba(37, 99, 235, 0.13), transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(8, 145, 178, 0.14), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef4fb 54%, #f6f8fb 100%);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  cursor: pointer;
  padding: 10px 14px;
  font-weight: 750;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

button:hover {
  filter: brightness(0.97);
}

button.secondary,
button.ghost {
  background: #eef4fb;
  color: var(--slate);
  box-shadow: none;
}

button.ghost {
  background: transparent;
}

button.danger {
  background: var(--red);
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.16);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--slate);
  font-size: 13px;
  font-weight: 700;
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 460px);
  gap: 32px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px;
}

.auth-hero {
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 34px;
  padding: 44px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 64, 175, 0.88));
  color: white;
  box-shadow: var(--shadow);
}

.auth-hero h1 {
  font-size: clamp(42px, 8vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.07em;
  margin: 14px 0 20px;
}

.auth-hero p {
  max-width: 580px;
  color: #dbeafe;
  font-size: 18px;
}

.auth-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.auth-points span,
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef4fb;
  color: var(--slate);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.auth-points span {
  background: rgba(255, 255, 255, 0.14);
  color: white;
}

.auth-card,
.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  background: rgba(15, 23, 42, 0.96);
  color: white;
}

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

.brand-mark > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  font-weight: 900;
}

.brand-mark small,
.sidebar-foot,
.muted {
  color: var(--muted);
}

.sidebar .muted,
.brand-mark small,
.sidebar-foot {
  color: #94a3b8;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.nav-link {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: #cbd5e1;
  box-shadow: none;
  text-align: left;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 13px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 18px #22c55e;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 28px;
}

.topbar,
.panel-head,
.audit-header,
.summary-hero,
.result-toolbar,
.project-card-main,
.project-actions,
.hero-panel,
.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin-bottom: 5px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.04em;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.top-actions,
.row,
.inline-form,
.hero-actions,
.tabs,
.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
}

.stack {
  display: grid;
  gap: 14px;
}

.metric-grid,
.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 22px;
  background: white;
  box-shadow: var(--shadow);
}

.metric-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 42px;
  line-height: 1;
  letter-spacing: -0.05em;
}

.metric-card small {
  color: var(--muted);
}

.metric-card.blue { border-color: #bfdbfe; }
.metric-card.green { border-color: #bbf7d0; }
.metric-card.cyan { border-color: #a5f3fc; }
.metric-card.red { border-color: #fecaca; }

.dashboard-grid,
.command-grid,
.project-layout,
.gtm-layout,
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.project-layout {
  grid-template-columns: 360px minmax(0, 1fr);
}

.command-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
}

.command-panel {
  min-height: 320px;
}

.explorer-panel,
.wide {
  grid-column: 1 / -1;
}

.wizard-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.card-list,
.url-list,
.severity-list,
.action-queue-list,
.health-list {
  display: grid;
  gap: 12px;
}

.project-card,
.action-card,
.health-card,
.url-row,
.info-rows div,
.severity-list div,
.signal-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  padding: 14px;
}

.project-card {
  display: grid;
  gap: 14px;
}

.action-card,
.health-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  box-shadow: none;
}

.action-card h3,
.health-card h3 {
  margin: 8px 0 4px;
  font-size: 16px;
}

.action-card p {
  margin: 6px 0;
}

.action-card small,
.health-card small {
  color: var(--muted);
  font-weight: 800;
}

.health-card {
  grid-template-columns: auto minmax(0, 1fr);
}

.health-card .score-ring {
  width: 70px;
  height: 70px;
}

.health-card .score-ring::after {
  inset: 7px;
}

.health-card .score-ring span {
  font-size: 18px;
}

.health-card .score-ring small {
  display: none;
}

.score-ring {
  --score: 50;
  width: 94px;
  height: 94px;
  border-radius: 999px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  position: relative;
  background: conic-gradient(var(--blue) calc(var(--score) * 1%), #e2e8f0 0);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: inherit;
  background: white;
}

.score-ring span,
.score-ring small {
  position: relative;
  z-index: 1;
}

.score-ring span {
  font-size: 24px;
  font-weight: 900;
}

.score-ring small {
  display: block;
  margin-top: 24px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.module-grid label,
.select-all {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  padding: 10px;
}

.module-grid input,
.select-all input,
.url-row input {
  width: auto;
}

.explore-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.explore-summary span,
.info-strip {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--slate);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.url-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td small {
  display: block;
  margin-top: 4px;
}

.badge.critical,
.badge.failed,
.badge.weak,
.badge.not_detected,
.badge.removed {
  background: var(--red-soft);
  color: var(--red);
}

.badge.high,
.badge.running,
.badge.partial,
.badge.basic,
.badge.new {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.medium,
.badge.queued {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.low,
.badge.advanced,
.badge.completed,
.badge.strong,
.badge.none,
.badge.unchanged {
  background: var(--green-soft);
  color: var(--green);
}

.progress {
  width: min(420px, 100%);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.progress.mini {
  width: 120px;
  height: 8px;
}

.tabs {
  padding: 4px;
  border-radius: 14px;
  background: #edf2f7;
}

.tab {
  background: transparent;
  color: var(--slate);
  box-shadow: none;
}

.tab.active {
  background: white;
  color: var(--blue);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.filters {
  margin-left: auto;
}

.filters select,
.filters input {
  width: auto;
  min-width: 130px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  align-items: center;
}

.donut {
  width: 190px;
  height: 190px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    conic-gradient(
      var(--red) 0 calc(var(--critical) * 1%),
      #f97316 calc(var(--critical) * 1%) calc((var(--critical) + var(--high)) * 1%),
      #f59e0b calc((var(--critical) + var(--high)) * 1%) calc((var(--critical) + var(--high) + var(--medium)) * 1%),
      #60a5fa calc((var(--critical) + var(--high) + var(--medium)) * 1%) calc((var(--critical) + var(--high) + var(--medium) + var(--low)) * 1%),
      #10b981 0
    );
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: inherit;
  background: white;
}

.donut span {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  font-size: 34px;
  font-weight: 900;
}

.donut small {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.legend {
  display: grid;
  gap: 10px;
}

.legend.inline {
  display: flex;
  margin-top: 14px;
}

.legend div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.sev-critical,
.issue-dot { background: var(--red); }
.sev-high { background: #f97316; }
.sev-medium { background: #f59e0b; }
.sev-low { background: #60a5fa; }
.sev-none,
.audit-dot { background: var(--green); }

.trend-bars {
  display: grid;
  grid-template-columns: repeat(30, minmax(6px, 1fr));
  gap: 5px;
  align-items: end;
  min-height: 150px;
}

.trend-day {
  display: flex;
  align-items: end;
  gap: 2px;
}

.trend-day span {
  width: 50%;
  border-radius: 999px 999px 0 0;
}

.trend-day .audit {
  background: var(--blue);
}

.trend-day .issue {
  background: var(--red);
}

.info-rows {
  display: grid;
  gap: 8px;
}

.info-rows div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  box-shadow: none;
}

.info-rows span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pre,
.markdown {
  overflow: auto;
  border-radius: 16px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px;
}

.markdown {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.markdown h1,
.markdown h2 {
  letter-spacing: -0.03em;
}

.markdown li,
.markdown p {
  line-height: 1.65;
}

.gtm-layout {
  grid-template-columns: 380px minmax(0, 1fr);
}

.signal-card {
  display: grid;
  gap: 4px;
}

.signal-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.signal-card strong {
  font-size: 20px;
}

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

.summary-hero {
  align-items: center;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.82)),
    radial-gradient(circle at 90% 20%, rgba(14, 165, 233, 0.3), transparent 30%);
  color: white;
}

.summary-hero h2 {
  max-width: 760px;
  margin-bottom: 0;
  letter-spacing: -0.04em;
}

.summary-hero .muted,
.summary-hero .eyebrow {
  color: #bfdbfe;
}

.summary-hero .score-ring::after {
  background: rgba(15, 23, 42, 0.92);
}

.summary-hero .score-ring small,
.summary-hero .score-ring span {
  color: white;
}

.notice {
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: var(--blue-soft);
  color: #1e40af;
  padding: 12px 14px;
  font-weight: 750;
}

.notice.bad,
.error-box,
.error {
  border-color: #fecaca;
  background: var(--red-soft);
  color: var(--red);
}

.hidden {
  display: none;
}

.empty,
.loading {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.loading span {
  width: 28px;
  height: 28px;
  border: 3px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.good {
  color: var(--green);
}

.danger-text {
  color: var(--red);
}

.mono {
  font-family: "IBM Plex Mono", "Cascadia Mono", monospace;
}

.break {
  overflow-wrap: anywhere;
}

.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.action-list {
  line-height: 1.8;
}

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

@media (max-width: 1040px) {
  .app-shell,
  .auth-page,
  .project-layout,
  .gtm-layout,
  .dashboard-grid,
  .command-grid,
  .detail-grid,
  .wizard-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .app-shell {
    display: block;
  }

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

  .donut-wrap {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .workspace,
  .auth-page {
    padding: 18px;
  }

  .auth-hero {
    padding: 28px;
  }

  .topbar,
  .panel-head,
  .audit-header,
  .summary-hero,
  .result-toolbar,
  .project-card-main,
  .project-actions,
  .hero-panel,
  .page-title,
  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-grid,
  .score-grid,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .filters select,
  .filters input {
    width: 100%;
  }
}
