:root {
  --ink: #111318;
  --muted: #667085;
  --paper: #f4f6fa;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #d8dee9;
  --line-soft: #e9edf4;
  --blue: #2857d9;
  --green: #078553;
  --red: #c62f3f;
  --amber: #bf740f;
  --lime: #cdf84b;
  --shadow: 0 18px 50px rgb(23 35 61 / 10%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(17 19 24 / 3%) 1px, transparent 1px),
    linear-gradient(0deg, rgb(17 19 24 / 3%) 1px, transparent 1px),
    radial-gradient(circle at 85% 8%, rgb(205 248 75 / 25%), transparent 22rem),
    var(--paper);
  background-size: 28px 28px, 28px 28px, auto, auto;
  font-family: "Segoe UI", Tahoma, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a.exit {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover,
a.exit:hover {
  transform: translateY(-1px);
  border-color: #b7c1d3;
  box-shadow: 0 8px 0 rgb(17 19 24 / 8%);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

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

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.15;
}

h3 {
  margin-bottom: 0.55rem;
  font: 900 1rem/1.2 "Segoe UI", Tahoma, sans-serif;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(40 87 217 / 14%);
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 20% 20%, rgb(205 248 75 / 32%), transparent 23rem),
    linear-gradient(135deg, #111318, #23262d);
}

.gate-card {
  width: min(100%, 34rem);
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 8px;
  padding: 1.35rem;
  color: #fff;
  background: rgb(17 19 24 / 94%);
  box-shadow: 0 25px 80px rgb(0 0 0 / 36%);
}

.gate-mark {
  width: 4.6rem;
  height: 4.6rem;
  display: grid;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 34%);
  border-radius: 8px;
  color: var(--lime);
  font: 900 1.5rem/1 Georgia, serif;
}

.gate-kicker {
  margin: 1rem 0 0.15rem;
  color: var(--lime);
  font-weight: 900;
  text-transform: uppercase;
}

.gate h1 {
  margin-bottom: 0.65rem;
  font-size: 2.5rem;
}

.gate-copy,
.gate-note {
  color: #d8dee9;
  line-height: 1.5;
}

.gate-form {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.gate-form span {
  color: #d8dee9;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.gate-form button {
  background: var(--lime);
  color: #111318;
  font-weight: 900;
}

.app-shell {
  width: min(100%, 96rem);
  margin: 0 auto;
  padding: 0.85rem;
}

.app-top {
  display: grid;
  gap: 0.85rem;
  align-items: end;
  margin: 0.25rem 0 0.85rem;
}

.brand span,
.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.primary {
  border-color: #1e45b5;
  background: var(--blue);
  color: #fff;
  font-weight: 900;
}

.ghost {
  background: var(--panel-soft);
}

.ghost.strong {
  border-color: #a6cb2e;
  background: var(--lime);
  color: var(--ink);
  font-weight: 900;
}

.command-panel,
.panel,
.metric,
.table-shell,
.table-mini {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.command-panel {
  position: sticky;
  top: 0;
  z-index: 8;
  overflow: hidden;
}

.query-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.query-bar input {
  min-height: 52px;
  font-size: 1.05rem;
  font-weight: 700;
}

.query-bar .primary {
  background: var(--lime);
  border-color: #a6cb2e;
  color: var(--ink);
}

.mode-row,
.result-tabs,
.mobile-jumps {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.65rem 0.75rem;
  background: #fff;
}

.mode,
.result-tab {
  white-space: nowrap;
  font-weight: 900;
}

.mode.active,
.result-tab.active {
  border-color: #111318;
  background: #111318;
  color: #fff;
}

.quick-filters {
  display: grid;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.quick-left,
.device-slice {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  align-items: center;
}

.quick-pill,
.geo-trigger,
.device-toggle {
  min-height: 42px;
  border-radius: 999px;
  background: #eef2f7;
  box-shadow: none;
}

.quick-pill {
  padding-inline: 1.05rem;
  font-weight: 900;
}

.quick-pill.active {
  border-color: #111318;
  background: #fff;
  box-shadow: inset 0 0 0 1px #c1c8d5;
}

.geo-picker {
  position: relative;
}

.geo-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding-inline: 0.95rem;
  font-weight: 900;
}

.ui-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.geo-trigger i {
  color: var(--muted);
  font-style: normal;
}

.geo-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.45rem);
  width: min(92vw, 28rem);
  z-index: 30;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: rgb(255 255 255 / 98%);
  box-shadow: 0 24px 70px rgb(23 35 61 / 20%);
}

.geo-menu-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.65rem;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 900;
}

.geo-menu-search {
  margin-bottom: 0.65rem;
}

.geo-menu-list {
  display: grid;
  gap: 0.4rem;
  max-height: min(52vh, 28rem);
  overflow: auto;
  padding-right: 0.15rem;
}

.geo-option {
  display: grid;
  justify-items: start;
  gap: 0.15rem;
  min-height: 54px;
  padding: 0.6rem 0.75rem;
  text-align: left;
  background: #fff;
  box-shadow: none;
}

.geo-option.active {
  border-color: var(--blue);
  background: #eef4ff;
}

.geo-option span,
.geo-empty {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
}

.device-slice {
  justify-content: flex-start;
}

.device-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  width: auto;
  min-width: 0;
  padding: 0.35rem 0.7rem;
  border: 1px solid transparent;
  color: var(--ink);
  cursor: pointer;
}

.device-toggle input {
  width: 1rem;
  min-height: 1rem;
  accent-color: #555;
}

.device-toggle span {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  text-transform: none;
}

.result-tab[data-tab="ai"] {
  border-color: #8fb7ff;
  background:
    linear-gradient(135deg, #eef4ff, #f8fbff 42%, #efffe0);
  color: #133a8a;
}

.result-tab[data-tab="ai"].active {
  border-color: #1d4ed8;
  background:
    linear-gradient(135deg, #2857d9, #0a8f65 58%, #cdf84b);
  color: #fff;
  box-shadow: 0 12px 24px rgb(40 87 217 / 18%);
}

.settings {
  border-top: 1px solid var(--line-soft);
  background: #fff;
}

.settings summary,
.bulk-box summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  font-weight: 900;
  cursor: pointer;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  padding: 0.75rem;
}

.wide {
  grid-column: 1 / -1;
}

.ai-settings-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  padding: 0.8rem;
  border: 1px solid #bfd4ff;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7fbff 0%, #ffffff 56%, #eef8d6 100%);
}

.ai-settings-card > div {
  display: grid;
  gap: 0.2rem;
}

.ai-settings-card b {
  font-size: 1rem;
}

.ai-settings-card small {
  color: var(--muted);
  line-height: 1.35;
}

label {
  display: grid;
  gap: 0.3rem;
}

label span,
.muted {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  padding: 0 0.75rem 0.75rem;
}

.check-grid label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  font-weight: 700;
}

.check-grid input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: var(--blue);
}

.bulk-box {
  margin: 0 0.75rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef4ff;
}

.bulk-box textarea,
.file-row {
  margin: 0.75rem;
  width: calc(100% - 1.5rem);
}

.file-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.run-progress {
  height: 0.32rem;
  background: #e8edf6;
  overflow: hidden;
}

.run-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--lime), var(--blue), var(--green));
}

.is-running .run-progress i {
  width: 100%;
  animation: progress 1.1s ease-in-out infinite;
}

.mobile-jumps {
  position: sticky;
  top: 12.2rem;
  z-index: 7;
  padding: 0.6rem 0;
  background: transparent;
  box-shadow: none;
}

.mobile-jumps a {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.work-area {
  min-width: 0;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.metric {
  min-height: 74px;
  position: relative;
  overflow: hidden;
  padding: 0.75rem;
}

.metric::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 0.25rem;
  background: var(--line);
  animation: growLine 520ms ease both;
}

.metric.good::after {
  background: var(--green);
}

.metric.blue::after {
  background: var(--blue);
}

.metric.raw::after {
  background: var(--amber);
}

.metric b {
  display: block;
  font: 900 1.45rem/1 Consolas, monospace;
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.panel {
  overflow: hidden;
}

.panel > h2,
.panel-head {
  padding: 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.dataset-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: #fff;
  color: var(--muted);
  font-weight: 900;
}

.result-tabs {
  border-bottom: 1px solid var(--line);
}

.result-body {
  padding: 0.85rem;
}

.result-action-strip {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.tool-button {
  min-height: 58px;
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  grid-template-areas:
    "icon title"
    "icon meta";
  gap: 0 0.55rem;
  align-items: center;
  justify-items: start;
  padding: 0.6rem 0.75rem;
  text-align: left;
  background: #fff;
  box-shadow: none;
}

.tool-button.primary-tool {
  border-color: #8fcf24;
  background: linear-gradient(135deg, var(--lime), #f6ffe4);
}

.tool-button.ai-tool,
.tool-button.smart-tool,
.export-actions .ai-export {
  border-color: #7aa8ff;
  background: linear-gradient(135deg, #e8f0ff 0%, #ffffff 52%, #efffca 100%);
}

.tool-button.ai-tool .tool-icon,
.tool-button.smart-tool .tool-icon {
  background: linear-gradient(135deg, #2457db, #111318);
}

.tool-icon {
  grid-area: icon;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #111318;
  color: #fff;
  font-weight: 900;
}

.tool-button b {
  grid-area: title;
}

.tool-button em {
  grid-area: meta;
  color: var(--muted);
  font-size: 0.8rem;
  font-style: normal;
}

.lead,
.empty-state,
.muted-box {
  border: 1px solid #cbd7ec;
  border-radius: 8px;
  padding: 0.8rem;
  background: #f2f6ff;
  color: var(--ink);
  line-height: 1.45;
}

.lead {
  margin-bottom: 0.75rem;
}

.empty-state h3 {
  margin-bottom: 0.25rem;
}

.empty-state p,
.muted-box {
  color: var(--muted);
}

.mini-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.mini-metrics button {
  display: grid;
  justify-items: start;
  min-height: 72px;
  background: #fff;
  font-weight: 900;
}

.mini-metrics b {
  font: 900 1.35rem/1 Consolas, monospace;
}

.mini-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
}

.table-shell,
.table-mini {
  overflow: auto;
  box-shadow: none;
}

.table-shell {
  max-height: 34rem;
}

table {
  width: 100%;
  min-width: 48rem;
  border-collapse: collapse;
  background: #fff;
  color: var(--ink);
  font-size: 0.88rem;
}

.table-mini table {
  min-width: 28rem;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  font-weight: 900;
}

tr:nth-child(even) td {
  background: #fbfcff;
}

.cell-link,
.card-title,
.bar,
.chart-row {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}

.cell-link:hover,
.card-title:hover,
.bar:hover,
.chart-row:hover {
  color: var(--blue);
  text-decoration: underline;
  transform: none;
  box-shadow: none;
}

.pill {
  min-height: 30px;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-weight: 900;
}

.pill.good {
  border-color: #b7e5d2;
  background: #e9f8f1;
  color: var(--green);
}

.pill.bad {
  border-color: #f0bdc4;
  background: #fff0f2;
  color: var(--red);
}

.pill.warn {
  border-color: #f2d59d;
  background: #fff7e8;
  color: var(--amber);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.data-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fff;
}

.card-title {
  width: 100%;
  display: grid;
  gap: 0.25rem;
}

.card-title strong {
  font-size: 1.05rem;
}

.card-title b {
  font: 900 1.65rem/1 Consolas, monospace;
}

.card-title span {
  color: var(--muted);
}

.data-card details {
  margin-top: 0.65rem;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.55rem;
}

.data-card summary {
  width: fit-content;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  background: #f2f6ff;
  font-weight: 900;
  cursor: pointer;
}

.data-card ol {
  max-height: 18rem;
  overflow: auto;
  margin: 0.65rem 0 0;
  padding-left: 1.25rem;
}

.data-card li {
  margin: 0.35rem 0;
}

.data-card li button {
  min-height: auto;
  border: 0;
  padding: 0.05rem;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.data-card li b {
  color: var(--muted);
}

.chart {
  display: grid;
  gap: 0.5rem;
}

.chart-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr 4.5rem;
  gap: 0.55rem;
  align-items: center;
  width: 100%;
}

.chart-row i {
  height: 0.75rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--lime), var(--blue));
  animation: growBar 620ms ease both;
}

.chart-row b {
  font-family: Consolas, monospace;
  text-align: right;
}

.ai-panel {
  display: grid;
  gap: 0.8rem;
}

.ai-control-deck {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.model-picker,
.ai-function-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 96%), rgb(248 250 252 / 96%));
  box-shadow: 0 18px 50px rgb(25 35 55 / 8%);
  overflow: hidden;
}

.model-current {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.65rem;
  align-items: center;
  background:
    linear-gradient(135deg, #111318, #23304a 68%, #2857d9);
  color: #fff;
}

.model-current::-webkit-details-marker {
  display: none;
}

.model-current span,
.ai-function-head span,
.ai-module-head span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.model-current span {
  color: rgb(255 255 255 / 72%);
}

.model-current b {
  display: block;
  margin: 0.2rem 0;
  font-size: 1.25rem;
}

.model-current em {
  grid-column: 1 / 2;
  color: rgb(255 255 255 / 74%);
  font-size: 0.84rem;
  font-style: normal;
}

.model-current i {
  grid-column: 2 / 3;
  grid-row: 1 / 4;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) center 35% / 1rem 0.12rem no-repeat,
    linear-gradient(#fff, #fff) center 50% / 1rem 0.12rem no-repeat,
    linear-gradient(#fff, #fff) center 65% / 1rem 0.12rem no-repeat,
    rgb(255 255 255 / 12%);
}

.model-menu {
  border-top: 1px solid var(--line-soft);
}

.model-tabs {
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  background: #fff;
}

.model-tabs button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: none;
}

.model-tabs button.active {
  border-color: #111318;
  background: #111318;
  color: #fff;
}

.model-search {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line-soft);
}

.model-search input {
  min-height: 40px;
}

.model-list {
  max-height: 18rem;
  display: grid;
  gap: 0.45rem;
  overflow: auto;
  padding: 0.75rem;
}

.model-option {
  min-height: 58px;
  display: grid;
  justify-items: start;
  gap: 0.16rem;
  padding: 0.65rem;
  text-align: left;
  background: #fff;
  box-shadow: none;
}

.model-option.active {
  border-color: #1d4ed8;
  background: #f1f6ff;
  box-shadow: inset 0 0 0 2px rgb(40 87 217 / 12%);
}

.model-option b {
  font-size: 0.95rem;
}

.model-option em {
  max-width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  overflow-wrap: anywhere;
}

.ai-function-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.85rem;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(135deg, #f8fbff, #fff 55%, #f4ffe3);
}

.ai-function-head b {
  color: #0f5138;
}

.ai-module-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  padding: 0.75rem;
}

.ai-module-card {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.ai-module-card.audit {
  border-top: 3px solid var(--red);
}

.ai-module-card.semantic {
  border-top: 3px solid var(--blue);
}

.ai-module-card.launch {
  border-top: 3px solid var(--green);
}

.ai-module-card.site {
  border-top: 3px solid var(--amber);
}

.ai-module-card.geo {
  border-top: 3px solid #7c3aed;
}

.ai-module-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line-soft);
  background: #fbfcff;
}

.ai-module-head b {
  min-width: 1.9rem;
  min-height: 1.9rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--blue);
  font: 900 0.85rem/1 Consolas, monospace;
}

.ai-task-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  padding: 0.65rem;
}

.ai-task {
  min-height: 84px;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 0.25rem;
  border-color: #cbd7ec;
  background:
    linear-gradient(135deg, #fff, #f8fbff);
  text-align: left;
}

.ai-task:hover {
  border-color: #1d4ed8;
  background:
    linear-gradient(135deg, #f3f7ff, #ffffff 48%, #f2ffe2);
}

.ai-task b {
  font-size: 1rem;
}

.ai-task span {
  color: var(--muted);
  line-height: 1.35;
}

.ai-task.loading {
  border-color: var(--blue);
  background:
    linear-gradient(90deg, rgb(40 87 217 / 10%), rgb(7 133 83 / 12%));
}

.ai-hero,
.ai-board-wrap,
.ai-result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgb(255 255 255 / 94%);
  box-shadow: 0 18px 50px rgb(25 35 55 / 8%);
}

.ai-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  overflow: hidden;
}

.ai-hero span,
.ai-board-toolbar span,
.ai-card-head span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ai-hero h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.08rem;
}

.ai-hero p {
  max-width: 56rem;
  margin: 0;
  color: #4b5565;
  line-height: 1.45;
}

.ai-hero button {
  min-width: 10.5rem;
  font-weight: 900;
  background: var(--panel-soft);
}

.ai-jobs {
  display: grid;
  gap: 0.55rem;
}

.ai-job {
  border: 1px solid var(--line);
  border-left: 0.35rem solid var(--amber);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fffdf8;
}

.ai-job.done {
  border-left-color: var(--green);
  background: #eefaf4;
}

.ai-job.error {
  border-left-color: var(--red);
  background: #fff0f2;
}

.ai-job div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai-job span {
  color: var(--muted);
}

.ai-job i {
  display: block;
  height: 0.38rem;
  margin-top: 0.6rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 200ms ease;
}

.ai-result {
  display: grid;
  gap: 0.75rem;
}

.ai-board-wrap {
  padding: 0.8rem;
}

.ai-board-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.ai-board-toolbar b {
  display: block;
  margin-top: 0.1rem;
}

.format-switch.compact {
  width: auto;
  grid-template-columns: repeat(3, minmax(5rem, 1fr));
}

.ai-board {
  display: grid;
  gap: 0.8rem;
  align-items: start;
}

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

.ai-board.rows {
  grid-template-columns: 1fr;
}

.ai-board.compact {
  grid-template-columns: repeat(4, minmax(12rem, 1fr));
}

.ai-result-card {
  min-width: 0;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.ai-result-card:hover {
  transform: translateY(-2px);
  border-color: #bdc7d7;
  box-shadow: 0 22px 60px rgb(25 35 55 / 12%);
}

.ai-result-card.size-full {
  grid-column: 1 / -1;
}

.ai-result-card.size-wide {
  grid-column: span 2;
}

.ai-board.rows .ai-result-card,
.ai-board.compact .ai-result-card {
  grid-column: auto;
}

.ai-board.compact .ai-result-card.size-full,
.ai-board.compact .ai-result-card.size-wide {
  grid-column: span 2;
}

.ai-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: start;
  padding: 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, #fff, #f8fafc);
}

.ai-card-head h3 {
  margin: 0.22rem 0 0;
  max-height: 4.8rem;
  overflow: hidden;
  font-size: 1.02rem;
  line-height: 1.25;
}

.ai-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: 12rem;
}

.ai-card-actions button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 1rem;
  font-weight: 800;
  background: #fff;
}

.ai-result-card.collapsed .ai-card-head {
  border-bottom: 0;
}

.ai-result-content {
  display: grid;
  gap: 0.8rem;
  padding: 0.9rem;
}

.ai-board.compact .ai-result-content {
  display: none;
}

.format-switch {
  width: min(100%, 24rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem;
  padding: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.format-switch button {
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-weight: 900;
}

.format-switch button.active {
  background: var(--blue);
  color: #fff;
}

.ai-verdict,
.ai-section-grid article,
.ai-tables .mini-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem;
  background: #fff;
}

.ai-verdict {
  border-left: 0.38rem solid var(--blue);
}

.ai-verdict span {
  color: var(--blue);
  font-weight: 900;
  text-transform: uppercase;
}

.ai-two,
.ai-section-grid,
.ai-tables {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.ai-two p {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 0.65rem;
  background: var(--panel-soft);
  line-height: 1.45;
}

.ai-two p.tone-green {
  border-left: 0.35rem solid var(--green);
}

.ai-two p.tone-red {
  border-left: 0.35rem solid var(--red);
}

.ai-two p.tone-amber {
  border-left: 0.35rem solid var(--amber);
}

.ai-two p.tone-blue {
  border-left: 0.35rem solid var(--blue);
}

.ai-two p.tone-gray {
  border-left: 0.35rem solid #94a3b8;
}

.ai-two b,
.ai-section-grid b {
  display: block;
  margin-bottom: 0.25rem;
}

.ai-two strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.25rem;
}

.ai-two span {
  display: block;
}

.ai-section-grid ul {
  margin: 0;
  padding-left: 1.15rem;
}

.ai-section-grid li {
  margin: 0.35rem 0;
}

.ai-section-grid li span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
}

.json-view {
  max-height: 30rem;
  overflow: auto;
  margin: 0;
  border-radius: 8px;
  padding: 0.9rem;
  background: #101828;
  color: #ecfdf3;
  font: 0.86rem/1.45 Consolas, monospace;
  white-space: pre-wrap;
}

.export-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.export-actions button {
  min-height: 56px;
  font-weight: 900;
}

.export-actions button:nth-child(2) {
  background: #eefaf4;
}

.export-actions button:nth-child(3) {
  background: #fff7e8;
}

.export-actions button:nth-child(4) {
  background: var(--lime);
}

.export-actions button[data-export="cluster-xlsx"] {
  border-color: #8fcf24;
  background: linear-gradient(135deg, var(--lime), #f6ffe4);
}

.export-actions button[data-export="cluster-csv"] {
  background: #eefaf4;
}

.archive-hint {
  margin-top: 0.8rem;
}

.archive-panel {
  display: grid;
  gap: 0.85rem;
}

.archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.archive-head span {
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.archive-head h3 {
  margin: 0.15rem 0 0;
  font-size: 1.35rem;
}

.archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.archive-actions button {
  min-height: 34px;
  padding: 0.35rem 0.65rem;
}

.archive-actions .danger,
button.danger {
  border-color: #f0b4b4;
  color: #a41128;
  background: #fff5f5;
}

.archive-panel small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-weight: 700;
}

.excel-audit-box {
  display: grid;
  gap: 0.75rem;
  border: 1px solid #cbd7ec;
  border-radius: 10px;
  padding: 0.85rem;
  background: linear-gradient(180deg, #f8fbff, #fff);
}

.excel-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.excel-upload-grid label {
  display: grid;
  gap: 0.3rem;
}

.excel-audit-result {
  display: grid;
  gap: 0.75rem;
}

.side {
  display: grid;
  gap: 0.85rem;
  align-content: start;
}

.side .panel > div,
.queue,
.status,
.bars {
  padding: 0.85rem;
}

.status {
  color: var(--green);
  font-weight: 900;
  white-space: pre-wrap;
}

.status.bad {
  color: var(--red);
}

.queue {
  display: grid;
  gap: 0.65rem;
}

.queue-card {
  display: grid;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  background: #fff;
}

.queue-card.live {
  border-color: var(--blue);
  background: #f2f6ff;
}

.queue-card span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.queue-card em {
  color: var(--muted);
  font-style: normal;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.bar {
  width: 100%;
  display: grid;
  grid-template-columns: 5.5rem 1fr 4rem;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.bar i {
  height: 0.65rem;
  border-radius: 999px;
  background: var(--green);
  animation: growBar 620ms ease both;
}

.bar b {
  font-family: Consolas, monospace;
  text-align: right;
}

.drawer-layer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  justify-items: end;
  background: rgb(17 24 39 / 34%);
  backdrop-filter: blur(4px);
}

.drawer-layer[hidden] {
  display: none;
}

.drawer {
  width: min(100%, 38rem);
  height: 100%;
  overflow: auto;
  border-left: 1px solid var(--line);
  padding: 1rem;
  background: #fff;
  box-shadow: -20px 0 70px rgb(23 35 61 / 20%);
}

.drawer-close {
  float: right;
  min-height: 38px;
  background: var(--panel-soft);
}

.drawer-eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.drawer h2 {
  clear: both;
  margin: 0.5rem 0;
}

.drawer-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.setup-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(18 24 38 / 42%);
  backdrop-filter: blur(12px);
}

.setup-layer[hidden] {
  display: none;
}

.setup-card {
  width: min(58rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  background: #f8fafc;
  box-shadow: 0 30px 90px rgb(15 23 42 / 24%);
}

.setup-head,
.setup-section,
.setup-footer {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.setup-head span,
.setup-section span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.setup-head h2,
.setup-section h3 {
  margin: 0.15rem 0 0.35rem;
}

.setup-head p,
.setup-section p,
.setup-price-note,
.setup-footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.setup-section {
  display: grid;
  gap: 0.8rem;
}

.setup-models {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.setup-model {
  min-height: 9.5rem;
  align-content: start;
  justify-items: start;
  text-align: left;
  padding: 0.8rem;
  border-radius: 14px;
  background: #fff;
}

.setup-model.active {
  border-color: var(--blue);
  background: linear-gradient(135deg, #eaf1ff, #ffffff);
  box-shadow: 0 12px 28px rgb(36 87 219 / 14%);
}

.setup-model b,
.setup-model em,
.setup-model small {
  display: block;
}

.setup-model em {
  margin: 0.3rem 0;
  color: var(--blue);
  font-style: normal;
  font-weight: 900;
}

.setup-model small {
  color: var(--muted);
  line-height: 1.35;
}

.setup-footer {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
}

.setup-footer div {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.tour {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(17 19 24 / 45%);
  backdrop-filter: blur(5px);
}

.tour[hidden] {
  display: none;
}

.tour-card {
  width: min(100%, 32rem);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 25px 80px rgb(0 0 0 / 28%);
}

.tour-card span {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  background: var(--panel-soft);
  font-weight: 900;
}

.tour-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .app-top {
    grid-template-columns: 1fr auto;
  }

  .query-bar {
    grid-template-columns: minmax(0, 1fr) 11rem;
  }

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

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

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

  .check-grid,
  .file-row,
  .mini-metrics,
  .export-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

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

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

@media (min-width: 1024px) {
  .mobile-jumps {
    display: none;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 20rem;
    align-items: start;
  }

  .side {
    position: sticky;
    top: 8.5rem;
  }

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

  .result-action-strip {
    grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr));
  }

  .ai-control-deck {
    grid-template-columns: 22rem minmax(0, 1fr);
    align-items: start;
  }

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

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

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

@media (max-width: 900px) {
  .setup-grid,
  .setup-models {
    grid-template-columns: 1fr;
  }

  .setup-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-footer div {
    display: grid;
    grid-template-columns: 1fr;
  }

  .ai-board.grid,
  .ai-board.compact {
    grid-template-columns: 1fr;
  }

  .ai-result-card.size-wide,
  .ai-result-card.size-full,
  .ai-board.compact .ai-result-card.size-wide,
  .ai-board.compact .ai-result-card.size-full {
    grid-column: auto;
  }

  .ai-card-head,
  .ai-hero,
  .ai-board-toolbar {
    grid-template-columns: 1fr;
  }

  .ai-board-toolbar,
  .ai-card-actions {
    align-items: stretch;
    justify-content: stretch;
  }

  .ai-card-actions button,
  .format-switch.compact button {
    flex: 1 1 6rem;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding: 0.55rem;
  }

  h1 {
    font-size: 1.7rem;
  }

  .command-panel {
    position: static;
  }

  .mobile-jumps {
    top: 0;
    position: sticky;
  }

  .result-body {
    padding: 0.65rem;
  }

  .geo-picker {
    width: 100%;
  }

  .geo-trigger {
    width: 100%;
    justify-content: center;
  }

  .geo-menu {
    position: fixed;
    left: 0.55rem;
    right: 0.55rem;
    top: 7rem;
    width: auto;
  }

  .chart-row {
    grid-template-columns: 5.4rem 1fr 3.8rem;
    font-size: 0.88rem;
  }

  .bar {
    grid-template-columns: 4.8rem 1fr 3.5rem;
  }

  .ai-hero,
  .ai-board-wrap,
  .ai-result-content,
  .ai-card-head {
    padding: 0.65rem;
  }

  .ai-card-actions {
    display: flex;
  }

  .format-switch.compact {
    grid-template-columns: 1fr;
  }

  .drawer {
    width: 100%;
  }
}

@keyframes progress {
  0% {
    transform: translateX(-100%);
  }
  55% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

@keyframes growBar {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
    transform-origin: left;
  }
}

@keyframes growLine {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
  }
}

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