:root {
  --bg: #0b0f14;
  --sidebar: #0f151d;
  --surface: #131a23;
  --surface-2: #18212c;
  --surface-3: #1e2937;
  --border: #273244;
  --border-soft: rgba(124, 148, 177, 0.14);
  --text: #f2f5f9;
  --text-2: #9ba8b8;
  --text-3: #687789;
  --primary: #4f8cff;
  --primary-strong: #3878ed;
  --primary-soft: rgba(79, 140, 255, 0.14);
  --focus: #60a5fa;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.13);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger: #f06464;
  --danger-soft: rgba(240, 100, 100, 0.13);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.12);
  --purple: #a78bfa;
  --purple-soft: rgba(167, 139, 250, 0.13);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  --sidebar-width: 244px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --ease: 160ms ease;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 82% -20%, rgba(79, 140, 255, 0.08), transparent 34%),
    var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
select,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #0e141c;
  color: var(--text);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 112px;
  padding: 12px;
  line-height: 1.55;
  resize: vertical;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #3a4960;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #101822;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #526174;
}

select {
  cursor: pointer;
}

code {
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-2);
  color: #c9d7eb;
  font-size: 13.5px;
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 7px;
  border: 1px solid rgba(79, 140, 255, 0.35);
  border-radius: 9px;
  background: linear-gradient(145deg, rgba(79, 140, 255, 0.2), rgba(79, 140, 255, 0.06));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
}

.brand-mark span {
  width: 3px;
  border-radius: 4px 4px 1px 1px;
  background: var(--primary);
}

.brand-mark span:nth-child(1) { height: 7px; opacity: 0.65; }
.brand-mark span:nth-child(2) { height: 13px; }
.brand-mark span:nth-child(3) { height: 10px; opacity: 0.82; }

.brand-mark--large {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
  gap: 4px;
  padding: 10px;
  border-radius: 13px;
}

.brand-mark--large span { width: 4px; }
.brand-mark--large span:nth-child(1) { height: 10px; }
.brand-mark--large span:nth-child(2) { height: 19px; }
.brand-mark--large span:nth-child(3) { height: 14px; }

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: #78a5ff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease), transform var(--ease);
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button--primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #07111f;
  box-shadow: 0 8px 22px rgba(79, 140, 255, 0.18);
}

.button--primary:hover:not(:disabled) {
  border-color: #6fa2ff;
  background: #6a9fff;
}

.button--secondary {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}

.button--secondary:hover:not(:disabled) {
  border-color: #3b4a61;
  background: var(--surface-3);
  color: var(--text);
}

.button--ghost {
  color: var(--text-2);
}

.button--ghost:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}

.button--danger {
  border-color: rgba(240, 100, 100, 0.28);
  background: var(--danger-soft);
  color: #ff9c9c;
}

.button--large {
  min-height: 48px;
  padding: 0 20px;
}

.button--compact {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13.5px;
}

.icon-button {
  display: inline-flex;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease), transform var(--ease);
}

.icon-button:hover {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.icon-button:active {
  transform: translateY(1px);
}

.icon-button--inside {
  position: absolute;
  top: 2px;
  right: 3px;
  width: 36px;
  height: 36px;
  border: 0;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--bg);
}

.boot-screen strong {
  display: block;
  font-size: 18px;
}

.boot-screen p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 14.5px;
}

.boot-screen .brand-mark {
  animation: boot-pulse 1.4s ease-in-out infinite;
}

@keyframes boot-pulse {
  50% { transform: translateY(-3px); box-shadow: 0 12px 34px rgba(79, 140, 255, 0.25); }
}

/* Authentication */

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.12fr) minmax(420px, 0.88fr);
}

.login-visual {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  overflow: hidden;
  padding: 44px clamp(40px, 6vw, 96px);
  border-right: 1px solid var(--border-soft);
  background:
    radial-gradient(circle at 20% 25%, rgba(79, 140, 255, 0.15), transparent 34%),
    linear-gradient(145deg, #0d141e, #0b0f14 66%);
}

.login-visual::before,
.login-visual::after {
  position: absolute;
  width: 340px;
  height: 340px;
  border: 1px solid rgba(79, 140, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.login-visual::before { top: -130px; right: -90px; }
.login-visual::after { bottom: -210px; left: -90px; width: 480px; height: 480px; }

.login-brand,
.login-mobile-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 18px;
  font-weight: 750;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 700px;
  margin: auto 0 42px;
}

.login-copy h1 {
  max-width: 650px;
  margin: 0;
  font-size: clamp(38px, 4.8vw, 66px);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.login-copy p {
  max-width: 590px;
  margin: 24px 0 0;
  color: var(--text-2);
  font-size: 18px;
  line-height: 1.65;
}

.login-preview {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(19, 26, 35, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-2);
  font-size: 13.5px;
}

.preview-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: var(--border-soft);
}

.preview-kpis > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 13px;
  background: #101720;
}

.preview-kpis small { grid-column: 1 / -1; color: var(--text-3); }
.preview-kpis strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.preview-kpis em { align-self: center; color: var(--success); font-size: 13px; font-style: normal; }

.preview-chart {
  display: flex;
  height: 75px;
  align-items: flex-end;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}

.preview-chart span {
  width: 100%;
  height: var(--h);
  min-height: 6px;
  border-radius: 3px 3px 1px 1px;
  background: linear-gradient(to top, rgba(79, 140, 255, 0.35), var(--primary));
}

.login-panel {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 36px;
}

.login-card {
  display: flex;
  width: min(410px, 100%);
  flex-direction: column;
  gap: 20px;
}

.login-card h2 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.025em;
}

.login-card p {
  margin: 7px 0 0;
  color: var(--text-2);
}

.login-mobile-brand {
  display: none;
  margin-bottom: 26px;
}

.login-note {
  text-align: center;
  font-size: 13.5px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 46px;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
}

.field > span:first-child {
  color: #c3cdd9;
  font-size: 13.5px;
  font-weight: 650;
}

.form-error {
  padding: 10px 12px;
  border: 1px solid rgba(240, 100, 100, 0.25);
  border-radius: 8px;
  background: var(--danger-soft);
  color: #ffa1a1;
  font-size: 13.5px;
}

/* App shell */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: rgba(15, 21, 29, 0.98);
  transition: width var(--ease), transform var(--ease);
}

.sidebar-head {
  display: flex;
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 13px 0 15px;
  border-bottom: 1px solid var(--border-soft);
}

.app-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.brand-name {
  overflow: hidden;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  overflow-y: auto;
  padding: 14px 10px 12px;
}

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-section--bottom {
  margin-top: auto;
  padding-top: 18px;
}

.nav-label {
  padding: 8px 10px 6px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}

.nav-item:hover:not(.is-disabled),
.nav-item.is-active {
  background: var(--primary-soft);
  color: #dfeaff;
}

.nav-item.is-active {
  border-color: rgba(79, 140, 255, 0.15);
}

.nav-item.is-disabled {
  cursor: default;
  opacity: 0.42;
}

.nav-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

.nav-text {
  overflow: hidden;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  min-width: 20px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--primary);
  color: #07111f;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  transition: margin-left var(--ease);
}

.app-shell.sidebar-collapsed {
  --sidebar-width: 66px;
}

.sidebar-collapsed .sidebar-head {
  justify-content: center;
  padding: 0;
}

.sidebar-collapsed .brand-name,
.sidebar-collapsed .sidebar-collapse,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .nav-badge {
  display: none;
}

.sidebar-collapsed .sidebar-nav {
  padding-inline: 10px;
}

.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 35;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(11, 15, 20, 0.88);
  backdrop-filter: blur(16px);
}

.mobile-menu-button {
  display: none;
}

.project-switcher {
  position: relative;
  display: flex;
  min-width: 240px;
  max-width: 370px;
  align-items: center;
}

.project-switcher select {
  height: 42px;
  padding-left: 40px;
  border-color: var(--border-soft);
  background: var(--surface);
  font-weight: 620;
}

.switcher-icon {
  position: absolute;
  z-index: 1;
  left: 12px;
  color: var(--primary);
  pointer-events: none;
}

.topbar-spacer {
  flex: 1;
}

.global-run-state {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: var(--surface);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: var(--text-3);
}

.global-run-state.is-running .pulse-dot {
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(79, 140, 255, 0.1);
  animation: run-pulse 1.6s ease-out infinite;
}

@keyframes run-pulse {
  70% { box-shadow: 0 0 0 8px rgba(79, 140, 255, 0); }
}

.global-run-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.global-run-copy strong,
.global-run-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-run-copy strong { font-size: 13px; }
.global-run-copy small { color: var(--text-3); font-size: 12px; }

.user-menu {
  position: relative;
}

.user-button {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.user-button:hover {
  border-color: var(--border);
  background: var(--surface);
}

.avatar {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(79, 140, 255, 0.32);
  border-radius: 9px;
  background: var(--primary-soft);
  color: #b8d0ff;
  font-size: 13.5px;
  font-weight: 750;
}

.popover {
  position: absolute;
  z-index: 90;
  min-width: 220px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.user-popover {
  top: calc(100% + 8px);
  right: 0;
}

.user-popover > div {
  display: flex;
  flex-direction: column;
  padding: 8px 9px 11px;
  border-bottom: 1px solid var(--border-soft);
}

.user-popover small {
  margin-top: 2px;
  color: var(--text-3);
}

.user-popover button {
  width: 100%;
  margin-top: 5px;
  padding: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #ff9c9c;
  text-align: left;
  cursor: pointer;
}

.user-popover button:hover { background: var(--danger-soft); }

.main-content {
  min-width: 0;
  max-width: 100%;
  min-height: calc(100vh - var(--topbar-height));
  padding: 22px;
}

/* Page structures */

.page {
  width: 100%;
  animation: page-in 180ms ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head > div:first-child {
  min-width: 0;
  flex: 1 1 280px;
}

.page-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 7px 0 0;
  color: var(--text-2);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.context-bar {
  position: sticky;
  top: calc(var(--topbar-height) + 8px);
  z-index: 25;
  display: flex;
  min-height: 56px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: -6px 0 18px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(19, 26, 35, 0.92);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(14px);
}

.context-select,
.context-chip {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #101720;
  color: var(--text-2);
  white-space: nowrap;
}

.context-select select {
  width: auto;
  min-width: 90px;
  min-height: 36px;
  padding: 0 26px 0 0;
  border: 0;
  background: transparent;
}

.context-spacer { flex: 1; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}

.toolbar-search {
  position: relative;
  min-width: 260px;
  max-width: 420px;
  flex: 1;
}

.toolbar-search input {
  padding-left: 38px;
  background: var(--surface);
}

.toolbar-search::before {
  position: absolute;
  z-index: 1;
  top: 11px;
  left: 13px;
  color: var(--text-3);
  content: "⌕";
  font-size: 19px;
}

.toolbar-filter {
  width: auto;
  min-width: 140px;
  background: var(--surface);
}

.surface {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.018);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--border-soft);
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-size: 15px;
}

.section-head p {
  margin: 3px 0 0;
  color: var(--text-3);
  font-size: 13px;
}

.section-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-state,
.empty-state,
.error-state {
  display: flex;
  min-height: 280px;
  align-items: center;
  justify-content: center;
  padding: 36px;
  text-align: center;
}

.state-card {
  max-width: 460px;
}

.state-icon {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--primary);
  font-size: 23px;
}

.error-state .state-icon {
  border-color: rgba(240, 100, 100, 0.25);
  background: var(--danger-soft);
  color: var(--danger);
}

.state-card h2,
.state-card h3 {
  margin: 0;
  font-size: 19px;
}

.state-card p {
  margin: 8px auto 17px;
  color: var(--text-2);
}

.skeleton-list {
  width: min(760px, 100%);
}

.skeleton-line {
  height: 12px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-2);
}

.skeleton-line::after {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  content: "";
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  from { transform: translateX(-120%); }
  to { transform: translateX(340%); }
}

/* Projects */

/* Wide tables scroll inside their own container; the page body never does. */
.projects-table-wrap,
.rank-table-wrap,
.runs-table-wrap {
  max-width: 100%;
  overflow: auto;
  scrollbar-color: #34445a transparent;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.data-table th,
.data-table td {
  height: 46px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-2);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 42px;
  background: #101720;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background var(--ease); }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }

.project-cell {
  display: flex;
  min-width: 220px;
  align-items: center;
  gap: 10px;
}

.site-avatar {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: #b7c9e6;
  font-size: 14.5px;
  font-weight: 750;
  text-transform: uppercase;
}

.project-cell-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.project-cell-copy strong,
.project-cell-copy small {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-cell-copy strong { color: var(--text); font-size: 14.5px; }
.project-cell-copy small { margin-top: 2px; color: var(--text-3); }

.project-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.table-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #c9d8ef;
  cursor: pointer;
}

.table-link:hover { color: var(--primary); }

.metric-main {
  color: var(--text);
  font-weight: 650;
}

.metric-muted { color: var(--text-3); }
.delta-up { color: var(--success); }
.delta-down { color: var(--danger); }
.delta-flat { color: var(--text-3); }

.movement-inline {
  display: flex;
  min-width: 150px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.movement-inline span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.movement-inline .up { color: var(--success); }
.movement-inline .flat { color: var(--text-3); }
.movement-inline .down { color: var(--danger); }

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 680;
  white-space: nowrap;
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill--success { border-color: rgba(34, 197, 94, 0.23); background: var(--success-soft); color: #6ddb95; }
.status-pill--running { border-color: rgba(79, 140, 255, 0.25); background: var(--primary-soft); color: #8db5ff; }
.status-pill--queued { border-color: rgba(245, 158, 11, 0.22); background: var(--warning-soft); color: #f5bb52; }
.status-pill--failed { border-color: rgba(240, 100, 100, 0.24); background: var(--danger-soft); color: #ff9191; }
.status-pill--partial { border-color: rgba(167, 139, 250, 0.24); background: var(--purple-soft); color: #c1aefb; }

/* Dashboard */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.kpi-card {
  min-width: 0;
  padding: 15px;
}

.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-3);
  font-size: 13px;
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 9px;
}

.kpi-value strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}

.kpi-value small { font-size: 12px; font-weight: 650; }

.sparkline {
  display: flex;
  height: 25px;
  align-items: flex-end;
  gap: 2px;
  margin-top: 12px;
}

.sparkline span {
  width: 100%;
  height: var(--h);
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: rgba(79, 140, 255, 0.56);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(320px, 0.8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.trend-card {
  min-height: 332px;
}

.trend-chart {
  position: relative;
  height: 248px;
  padding: 22px 18px 26px 42px;
}

.chart-grid {
  position: absolute;
  inset: 22px 18px 26px 42px;
  display: grid;
  grid-template-rows: repeat(4, 1fr);
}

.chart-grid span {
  border-top: 1px dashed rgba(124, 148, 177, 0.14);
}

.chart-bars {
  position: absolute;
  inset: 22px 18px 26px 42px;
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 1vw, 12px);
}

.chart-bar {
  position: relative;
  width: 100%;
  height: var(--h);
  min-height: 5px;
  border-radius: 4px 4px 1px 1px;
  background: linear-gradient(to top, rgba(79, 140, 255, 0.2), rgba(79, 140, 255, 0.85));
  transition: filter var(--ease), transform var(--ease);
}

.chart-bar:hover {
  filter: brightness(1.2);
  transform: translateY(-2px);
}

.chart-bar::after {
  position: absolute;
  right: 50%;
  bottom: calc(100% + 6px);
  z-index: 2;
  display: none;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
  content: attr(data-value);
  font-size: 12px;
  transform: translateX(50%);
  white-space: nowrap;
}

.chart-bar:hover::after { display: block; }

.chart-labels {
  position: absolute;
  right: 18px;
  bottom: 8px;
  left: 42px;
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 11px;
}

.movement-card {
  min-height: 332px;
}

.movement-body {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 24px 18px;
}

.donut {
  position: relative;
  display: grid;
  width: 136px;
  height: 136px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 var(--up), #657386 var(--up) var(--flat), var(--danger) var(--flat) 100%);
}

.donut::before {
  position: absolute;
  inset: 20px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.donut strong,
.donut small {
  position: relative;
  z-index: 1;
  grid-area: 1 / 1;
}

.donut strong { margin-top: -10px; font-size: 24px; }
.donut small { margin-top: 24px; color: var(--text-3); font-size: 12px; }

.movement-legend {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.movement-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.movement-legend-item:last-child { border-bottom: 0; }
.movement-legend-item i { width: 8px; height: 8px; border-radius: 50%; }
.movement-legend-item span { color: var(--text-2); font-size: 13px; }
.movement-legend-item strong { font-size: 14.5px; font-variant-numeric: tabular-nums; }

.top-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 16px;
}

.top-bucket {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 9px;
  padding: 9px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #101720;
}

.top-bucket small { grid-column: 1 / -1; color: var(--text-3); font-size: 11px; text-transform: uppercase; }
.top-bucket strong { font-size: 16px; }
.top-bucket em { align-self: center; color: var(--success); font-size: 12px; font-style: normal; }

.recent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 12px;
}

.issue-list {
  display: flex;
  flex-direction: column;
}

.issue-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 15px;
  border-bottom: 1px solid var(--border-soft);
}

.issue-row:last-child { border-bottom: 0; }

.issue-icon {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
}

.issue-row strong,
.issue-row small { display: block; }
.issue-row strong { font-size: 13.5px; }
.issue-row small { margin-top: 2px; color: var(--text-3); font-size: 12px; }

/* Rankings matrix */

.matrix-surface {
  min-height: 350px;
}

/* Block-level so the pill row reserves its own height instead of overflowing
   the surrounding line box and colliding with the heading below. */
.matrix-tabs {
  display: flex;
  width: fit-content;
  margin-bottom: 16px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: #0f151d;
}

.matrix-tab {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}

.matrix-tab.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.rank-table {
  min-width: 970px;
}

.rank-table th,
.rank-table td {
  height: 48px;
  padding: 5px 9px;
  border-right: 1px solid var(--border-soft);
  text-align: center;
}

.rank-table th:last-child,
.rank-table td:last-child { border-right: 0; }

.rank-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 6;
  background: var(--surface);
  text-align: left;
}

.rank-table th.sticky-col {
  z-index: 8;
  background: #101720;
}

.rank-keyword-cell {
  min-width: 270px;
  max-width: 340px;
}

.rank-keyword {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rank-keyword-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.rank-keyword-copy strong,
.rank-keyword-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-keyword-copy strong { color: var(--text); font-size: 13.5px; }
.rank-keyword-copy small { margin-top: 2px; color: var(--text-3); font-size: 11px; }

.target-state {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 12px;
}

.target-state--mismatch { background: var(--danger-soft); color: var(--danger); }

.rank-cell-button {
  display: inline-flex;
  min-width: 52px;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.rank-cell-button:hover {
  border-color: rgba(255, 255, 255, 0.12);
  filter: brightness(1.15);
}

.rank-number {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 650;
}

.rank-delta {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 750;
}

.rank-top3 { background: rgba(59, 130, 246, 0.19); }
.rank-top10 { background: rgba(20, 184, 166, 0.17); }
.rank-top30 { background: rgba(34, 197, 94, 0.13); }
.rank-top50 { background: rgba(132, 204, 22, 0.1); }
.rank-top100 { background: rgba(100, 116, 139, 0.13); }
.rank-out { background: rgba(245, 158, 11, 0.12); }
.rank-error { background: rgba(240, 100, 100, 0.12); }

.date-head {
  min-width: 88px;
}

.date-head strong,
.date-head small { display: block; }
.date-head strong { color: #aeb9c8; font-size: 12px; }
.date-head small { margin-top: 2px; color: var(--text-3); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }

.rank-url {
  display: inline-block;
  max-width: 190px;
  overflow: hidden;
  color: #87acdf;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-3);
  font-size: 13px;
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

/* Runs */

.progress-track {
  position: relative;
  width: 150px;
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: #0c1219;
}

.progress-track span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #79a8ff);
  transition: width 300ms ease;
}

.progress-copy {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-copy small {
  min-width: 34px;
  color: var(--text-2);
  font-size: 12px;
}

.run-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.run-card {
  padding: 15px;
}

.run-card span { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.run-card strong { display: block; margin-top: 7px; font-size: 22px; font-variant-numeric: tabular-nums; }
.run-card small { display: block; margin-top: 4px; color: var(--text-3); }

.run-detail-row {
  cursor: pointer;
}

/* Modals and drawer */

.modal-backdrop,
.drawer-backdrop,
.mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2, 7, 12, 0.7);
  backdrop-filter: blur(3px);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid #344156;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  animation: modal-in 170ms ease-out;
}

.modal-card--wide { width: min(850px, 100%); }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
}

.modal-header,
.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h2,
.drawer-header h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.02em;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  background: #101720;
}

.modal-hint {
  margin: 0;
  color: var(--text-2);
}

.form-grid {
  display: grid;
  gap: 13px;
}

.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding-top: 2px;
  border-top: 1px solid transparent;
}

.section-title span { font-size: 14.5px; font-weight: 700; }
.section-title small { color: var(--text-3); font-size: 12px; }

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: #101720;
  cursor: pointer;
}

.check-field input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.check-field span { display: flex; flex-direction: column; }
.check-field strong { font-size: 13.5px; }
.check-field small { margin-top: 3px; color: var(--text-3); font-size: 12px; }

.input-summary {
  display: flex;
  justify-content: space-between;
  color: var(--text-3);
  font-size: 12px;
}

.run-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.run-summary-item {
  padding: 11px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: #101720;
}

.run-summary-item small,
.run-summary-item strong { display: block; }
.run-summary-item small { color: var(--text-3); font-size: 11px; text-transform: uppercase; }
.run-summary-item strong { margin-top: 4px; overflow: hidden; font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }

.notice {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.notice > span {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.notice p { margin: 1px 0 0; color: var(--text-2); font-size: 13px; }
.notice--info { border-color: rgba(56, 189, 248, 0.2); background: var(--info-soft); }
.notice--info > span { background: rgba(56, 189, 248, 0.18); color: var(--info); }

.details-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 130;
  width: min(460px, 100vw);
  overflow-y: auto;
  border-left: 1px solid #344156;
  background: var(--surface);
  box-shadow: -18px 0 58px rgba(0, 0, 0, 0.35);
  animation: drawer-in 190ms ease-out;
}

@keyframes drawer-in {
  from { transform: translateX(100%); }
}

.drawer-backdrop { z-index: 120; }

.drawer-content {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 18px;
}

.drawer-rank {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  background: #101720;
}

.drawer-rank small,
.drawer-rank strong { display: block; }
.drawer-rank small { color: var(--text-3); font-size: 12px; }
.drawer-rank strong { margin-top: 3px; font-size: 36px; line-height: 1; }

.detail-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #101720;
}

.detail-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.detail-row:last-child { border-bottom: 0; }
.detail-row dt { color: var(--text-3); font-size: 12px; }
.detail-row dd { min-width: 0; margin: 0; overflow-wrap: anywhere; color: var(--text-2); font-size: 13px; }

.serp-snippet {
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: #f7f9fc;
  color: #3c4043;
}

.serp-snippet strong { display: block; color: #1a0dab; font-size: 16px; font-weight: 500; }
.serp-snippet a { display: block; margin: 4px 0; color: #188038; font-size: 13px; }
.serp-snippet p { margin: 0; color: #4d5156; font-size: 13px; line-height: 1.45; }

.screenshot-frame {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #0d131b;
}

.screenshot-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.screenshot-empty {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  color: var(--text-3);
  text-align: center;
}

/* Toasts */

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  width: min(380px, calc(100vw - 36px));
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.toast-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.toast--success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast--error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast-copy strong { display: block; font-size: 13.5px; }
.toast-copy p { margin: 3px 0 0; color: var(--text-2); font-size: 12px; }
.toast-close { padding: 0; border: 0; background: transparent; color: var(--text-3); cursor: pointer; }

/* Responsive */

@media (max-width: 1500px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
}

@media (max-width: 1180px) {
  .app-shell:not(.sidebar-collapsed) {
    --sidebar-width: 66px;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-head { justify-content: center; padding: 0; }
  .app-shell:not(.sidebar-collapsed) .brand-name,
  .app-shell:not(.sidebar-collapsed) .sidebar-collapse,
  .app-shell:not(.sidebar-collapsed) .nav-label,
  .app-shell:not(.sidebar-collapsed) .nav-text,
  .app-shell:not(.sidebar-collapsed) .nav-badge { display: none; }
  .app-shell:not(.sidebar-collapsed) .nav-item { justify-content: center; padding: 0; }

  .dashboard-grid,
  .recent-grid { grid-template-columns: 1fr; }
  .movement-card { min-height: auto; }
  .global-run-copy small { display: none; }
}

@media (max-width: 960px) {
  .login-view { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-mobile-brand { display: flex; }
  .login-panel { padding: 24px; }

  .sidebar,
  .app-shell.sidebar-collapsed .sidebar {
    width: 244px;
    transform: translateX(-100%);
  }

  .app-shell.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.mobile-nav-open .brand-name,
  .app-shell.mobile-nav-open .nav-label,
  .app-shell.mobile-nav-open .nav-text,
  .app-shell.mobile-nav-open .nav-badge {
    display: initial;
  }

  .app-shell.mobile-nav-open .sidebar-head {
    justify-content: space-between;
    padding: 0 13px 0 15px;
  }

  .app-shell.mobile-nav-open .sidebar-collapse { display: inline-flex; }
  .app-shell.mobile-nav-open .nav-item { justify-content: flex-start; padding: 0 10px; }
  .workspace { margin-left: 0; }
  .mobile-menu-button { display: inline-flex; }
  .mobile-backdrop { z-index: 45; }
  .sidebar { z-index: 50; }
  .project-switcher { min-width: 190px; }
  .global-run-state { display: none; }
  .user-name { display: none; }
  .main-content { padding: 18px 14px; }
  .context-bar { top: calc(var(--topbar-height) + 6px); overflow-x: auto; }
  .context-spacer { min-width: 4px; }
  .run-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  :root { --topbar-height: 58px; }
  .topbar { padding: 0 10px; }
  .project-switcher { min-width: 0; flex: 1; }
  .user-menu { display: none; }
  .main-content { padding: 14px 10px 84px; }
  .page-head { align-items: stretch; flex-direction: column; gap: 13px; margin-bottom: 15px; }
  .page-head h1 { font-size: 22px; }
  .page-actions { justify-content: stretch; }
  .page-actions .button { flex: 1; }
  .toolbar { align-items: stretch; flex-wrap: wrap; }
  .toolbar-search { max-width: none; flex-basis: 100%; }
  .toolbar-filter { min-width: calc(50% - 5px); flex: 1; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-card { padding: 13px; }
  .kpi-value strong { font-size: 22px; }
  .dashboard-grid { display: flex; flex-direction: column; }
  .trend-card { min-height: 290px; }
  .trend-chart { height: 210px; }
  .movement-body { grid-template-columns: 120px minmax(0, 1fr); gap: 10px; }
  .donut { width: 112px; height: 112px; }
  .donut::before { inset: 17px; }
  .top-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid--2,
  .form-grid--3 { grid-template-columns: 1fr; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card,
  .modal-card--wide { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-footer { position: sticky; bottom: 0; padding: 12px 16px; }
  .run-summary { grid-template-columns: 1fr; }
  .projects-table-wrap { overflow: visible; }
  .projects-table { display: block; }
  .projects-table thead { display: none; }
  .projects-table tbody { display: grid; gap: 10px; }
  .projects-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: 11px;
    background: var(--surface);
  }
  .projects-table td {
    display: block;
    height: auto;
    min-height: 46px;
    padding: 10px 12px;
    border-right: 1px solid var(--border-soft);
    white-space: normal;
  }
  .projects-table td:first-child { display: none; }
  .projects-table td:nth-child(2) { grid-column: 1 / -1; border-right: 0; }
  .projects-table td:last-child { grid-column: 1 / -1; border: 0; }
  .project-cell-copy strong,
  .project-cell-copy small { max-width: calc(100vw - 105px); }
  .project-actions { justify-content: flex-start; }
  .run-cards { grid-template-columns: 1fr 1fr; }
  .data-table th,
  .data-table td { padding-inline: 9px; }
}

@media (max-width: 460px) {
  .login-panel { align-items: flex-start; padding: 28px 18px; }
  .login-card h2 { font-size: 26px; }
  .kpi-grid { display: flex; margin-right: -10px; overflow-x: auto; scroll-snap-type: x mandatory; }
  .kpi-card { min-width: 175px; scroll-snap-align: start; }
  .movement-body { grid-template-columns: 1fr; justify-items: center; }
  .movement-legend { width: 100%; }
  .run-cards { grid-template-columns: 1fr; }
  .details-drawer { width: 100vw; }
  .detail-row { grid-template-columns: 98px minmax(0, 1fr); }
  .modal-footer .button { flex: 1; }
  .top-grid { grid-template-columns: 1fr; }
  .preview-kpis { grid-template-columns: 1fr; }
}

@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;
  }
}

/* Geo autocomplete, settings and sortable headers */

.field-label {
  color: #c3cdd9;
  font-size: 13.5px;
  font-weight: 650;
}

.field-hint {
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.5;
}

.field-hint code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
}

.autocomplete-field {
  position: relative;
}

.autocomplete-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  max-height: 264px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.autocomplete-option {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.autocomplete-option:hover,
.autocomplete-option:focus-visible {
  background: var(--primary-soft);
}

.autocomplete-option strong {
  font-size: 14.5px;
  font-weight: 600;
}

.autocomplete-option small {
  color: var(--text-3);
  font-size: 13px;
}

.settings-card {
  display: flex;
  max-width: 720px;
  flex-direction: column;
  gap: 20px;
  padding: 24px;
}

.settings-field input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.settings-result {
  max-width: 720px;
  margin-top: 18px;
  padding: 20px 24px;
}

.settings-result h2 {
  margin-bottom: 12px;
  font-size: 17px;
}

.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  white-space: nowrap;
}

.sort-header:hover {
  color: var(--text);
}

.sort-header.is-active {
  color: var(--primary);
}
