:root {
  --bg: #f2f6f9;
  --panel: #ffffff;
  --ink: #1c2a37;
  --muted: #607181;
  --line: #d5e1ea;
  --accent: #0d7ea5;
  --ok: #1f8b5f;
  --warn: #9a6b00;
  --err: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, #d9eff9 0%, transparent 35%),
    radial-gradient(circle at 90% 0%, #e9f8f0 0%, transparent 40%),
    var(--bg);
}

.app-body {
  min-height: 100vh;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.app-shell {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 268px;
  overflow-y: auto;
  padding: 1.2rem 1rem 1.5rem;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 10px 0 32px rgba(6, 30, 48, 0.05);
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.2rem 0.25rem 1rem;
  color: var(--ink);
  text-decoration: none;
}

.app-brand:hover {
  text-decoration: none;
}

.app-brand-copy {
  display: grid;
  gap: 0.18rem;
}

.app-brand-copy strong {
  font-size: 1.1rem;
  line-height: 1;
}

.app-brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: lowercase;
}

.app-main {
  margin-left: 268px;
  min-width: 0;
  padding: 1.25rem 1.25rem 2rem;
}

.app-topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.25rem;
  margin: 0 auto 1rem;
  max-width: 1380px;
}

.app-topbar-copy {
  min-width: 0;
}

.app-topbar-copy h1 {
  margin: 0.7rem 0 0;
  font-size: clamp(2rem, 2vw + 1rem, 3.25rem);
  letter-spacing: -0.04em;
}

.app-topbar-copy p {
  margin: 0.45rem 0 0;
  max-width: 760px;
  color: var(--muted);
  line-height: 1.5;
}

.app-topbar-copy code {
  padding: 0.1rem 0.35rem;
  border-radius: 8px;
  background: #edf5fb;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
}

.app-topbar-meta {
  flex: 0 0 auto;
}

.app-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.72rem;
  border-radius: 999px;
  background: rgba(13, 126, 165, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page-stack {
  max-width: 1380px;
  margin: 0 auto;
}

.route-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.route-card-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.route-card {
  display: grid;
  gap: 0.55rem;
  min-height: 180px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 250, 253, 0.96));
  box-shadow: 0 10px 30px rgba(6, 30, 48, 0.04);
  color: var(--ink);
  text-decoration: none;
}

.route-card:hover {
  border-color: #b7d7e6;
  box-shadow: 0 18px 42px rgba(6, 30, 48, 0.08);
  text-decoration: none;
}

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

.route-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.route-card code {
  padding: 0.08rem 0.32rem;
  border-radius: 8px;
  background: #edf5fb;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88em;
}

.route-card span {
  align-self: end;
  color: var(--accent);
  font-weight: 600;
}

.sidebar-section {
  margin-top: 1rem;
}

.sidebar-section-label {
  display: block;
  margin: 0 0 0.5rem;
  padding: 0 0.35rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-menu {
  display: grid;
  gap: 0.38rem;
}

.sidebar-menu .sidebar-link {
  justify-content: flex-start;
  align-items: center;
  min-height: 42px;
  padding: 0.72rem 0.85rem;
  border-radius: 14px;
}

.sidebar-menu .sidebar-link.is-active {
  border-color: #b9d7e5;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 244, 250, 0.9));
  box-shadow: 0 12px 28px rgba(6, 30, 48, 0.06);
}

.sidebar-menu .sidebar-link span {
  color: var(--muted);
  font-size: 0.76rem;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.dashboard-sidebar {
  position: sticky;
  top: 1rem;
  display: grid;
  gap: 0.9rem;
}

.dashboard-main {
  min-width: 0;
}

.sidebar-brand-card,
.sidebar-card,
.summary-card,
.explorer-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(6, 30, 48, 0.04);
}

.sidebar-brand-card {
  padding: 1rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  color: #3a77ff;
  flex: 0 0 auto;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-mark svg path {
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-brand-copy {
  display: grid;
  gap: 0.2rem;
}

.sidebar-brand-copy strong {
  font-size: 1.05rem;
}

.sidebar-brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-card {
  padding: 1rem;
}

.sidebar-card h2 {
  margin: 0 0 0.8rem;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-nav {
  display: grid;
  gap: 0.45rem;
}

.sidebar-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  text-decoration: none;
}

.sidebar-link span {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-link:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.app-header-copy {
  min-width: 0;
}

.app-header .eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: rgba(13, 126, 165, 0.12);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0.75rem 0 0;
  font-size: clamp(2rem, 2.2vw + 1rem, 3.1rem);
  letter-spacing: -0.03em;
}

.app-header p {
  margin: 0.45rem 0 0;
  max-width: 720px;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2vw + 1rem, 2.8rem);
  letter-spacing: -0.02em;
}

.hero p {
  margin-top: 0.35rem;
  color: var(--muted);
}

.snapshot-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.38rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
}

.summary-grid {
  margin-top: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.summary-card {
  padding: 1rem;
}

.summary-card h2 {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 500;
}

.metric {
  margin: 0.35rem 0 0;
  font-size: 1.6rem;
  font-weight: 700;
}

.summary-copy {
  margin: 0.35rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.explorer-panel {
  margin-top: 1.1rem;
  padding: 1rem;
}

.explorer-panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.explorer-panel-head h2 {
  margin: 0;
  font-size: 1rem;
}

.explorer-panel-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.toolbar {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
}

.toolbar form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explorer-form {
  width: 100%;
  display: grid;
  gap: 0.75rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 0.8rem;
  align-items: end;
}

.filter-grid label {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  min-width: 0;
}

.inline-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.inline-field label,
.column-picker legend {
  display: block;
  margin-bottom: 0.28rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inline-field {
  min-width: 0;
}

.inline-field-compact select {
  min-width: 112px;
}

.inline-field-search {
  flex: 1 1 220px;
}

.inline-field-medium {
  flex: 1 1 180px;
}

.inline-field-search input {
  width: 100%;
  min-width: 220px;
}

.inline-field-medium input {
  width: 100%;
  min-width: 180px;
}

.column-picker {
  position: relative;
}

.column-picker summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.56rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  box-shadow: 0 10px 30px rgba(6, 30, 48, 0.04);
}

.column-picker summary::-webkit-details-marker {
  display: none;
}

.column-picker summary::before {
  content: "+";
  color: var(--accent);
  font-weight: 700;
}

.column-picker[open] summary::before {
  content: "-";
}

.column-picker-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  z-index: 20;
  width: min(92vw, 720px);
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 20px 50px rgba(6, 30, 48, 0.12);
}

.inline-expander {
  flex: 0 0 auto;
}

.inline-expander[open] {
  flex: 1 0 100%;
}

.inline-expander[open] .column-picker-menu {
  position: static;
  top: auto;
  left: auto;
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.9rem 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.advanced-picker-menu {
  width: min(92vw, 760px);
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem 0.8rem;
}

.advanced-grid .inline-field-search,
.advanced-grid .inline-field-medium {
  flex: initial;
}

.advanced-grid .inline-field-search input,
.advanced-grid .inline-field-medium input,
.advanced-grid .inline-field-compact select,
.advanced-grid .inline-field-compact input {
  width: 100%;
  min-width: 0;
}

.columns-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.columns-grid-tight {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.checkbox-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 42px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}

.checkbox-chip input {
  min-width: 0;
  margin: 0;
}

.explorer-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.toolbar-actions {
  display: flex;
  justify-content: flex-end;
}

select,
input,
button {
  font-family: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0.5rem 0.75rem;
}

input {
  min-width: 110px;
}

button {
  cursor: pointer;
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}

.ghost-button:hover {
  text-decoration: none;
  border-color: var(--accent);
}

button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.auth-shell {
  width: min(100%, 760px);
  display: grid;
  gap: 1rem;
}

.auth-brand {
  justify-self: center;
}

.auth-panel {
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 50px rgba(6, 30, 48, 0.08);
}

.auth-copy h1 {
  margin: 0.7rem 0 0;
  font-size: clamp(2rem, 2vw + 1rem, 3rem);
  letter-spacing: -0.04em;
}

.auth-copy p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-stack {
  display: grid;
  gap: 1rem;
  margin-top: 1.2rem;
}

.auth-form {
  display: grid;
  gap: 0.6rem;
}

.auth-form label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-form input {
  width: 100%;
  min-width: 0;
  padding: 0.85rem 0.95rem;
}

.auth-form button,
.plan-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.auth-google {
  min-height: 46px;
  justify-content: center;
}

.auth-note,
.auth-switch {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-note[data-state="error"] {
  color: var(--err);
}

.auth-note[data-state="success"] {
  color: var(--ok);
}

.auth-note[data-state="loading"] {
  color: var(--accent);
}

.auth-switch a {
  font-weight: 600;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}

.plan-card {
  display: grid;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.plan-card-featured {
  border-color: #9ecde2;
  background: linear-gradient(180deg, rgba(240, 249, 253, 0.96), rgba(255, 255, 255, 0.98));
}

.plan-card-selected {
  border-color: var(--accent);
  box-shadow: 0 14px 34px rgba(13, 126, 165, 0.12);
}

.plan-card h2 {
  margin: 0;
  font-size: 1rem;
}

.plan-price {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.plan-price span {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.plan-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 960px) {
  .app-sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }

  .app-main {
    margin-left: 0;
    padding: 1rem 1rem 2rem;
  }

  .app-topbar {
    flex-direction: column;
    align-items: start;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar {
    position: static;
  }

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

.results-count {
  margin: 0;
  color: var(--muted);
}

.column-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45rem;
  height: 1.45rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e9f5fb;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
}

.table-wrap {
  margin-top: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: auto;
}

.table-wrap h2 {
  margin: 0;
  padding: 0.8rem 1rem;
  font-size: 1rem;
}

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

th,
td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

th {
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
  background: var(--panel);
}

a {
  color: #0a5d90;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.cell-subtle {
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.status {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-ok {
  color: var(--ok);
  background: #ecfdf3;
}

.status-not_found,
.status-too_large,
.status-blocked {
  color: var(--warn);
  background: #fff7e0;
}

.status-http_error,
.status-failed {
  color: var(--err);
  background: #fff1f0;
}

.pager {
  margin-top: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.5rem;
}

@media (max-width: 860px) {
  .inline-toolbar {
    align-items: stretch;
  }

  .inline-field,
  .inline-field-search,
  .inline-field-search input {
    width: 100%;
    min-width: 0;
  }

  .inline-field-compact select {
    width: 100%;
  }

  .inline-picker {
    margin-left: 0;
  }

  th,
  td {
    font-size: 0.88rem;
    padding: 0.62rem 0.55rem;
  }
}
