:root {
  --ink: #071822;
  --ink-soft: #143041;
  --fog: #eef3f5;
  --fog-deep: #d5e0e6;
  --paper: #f7fafb;
  --teal: #0a7f7c;
  --teal-bright: #12a09c;
  --signal: #d4920a;
  --danger: #b33a2b;
  --ok: #1f7a4d;
  --line: rgba(7, 24, 34, 0.12);
  --text: #0d2230;
  --muted: #5a717d;
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: "Figtree", system-ui, sans-serif;
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--body);
  color: var(--text);
  background: var(--fog);
  line-height: 1.45;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* —— Atmosphere —— */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, rgba(18, 160, 156, 0.18), transparent 55%),
    radial-gradient(900px 600px at 88% 8%, rgba(212, 146, 10, 0.12), transparent 50%),
    linear-gradient(165deg, #e4eef2 0%, #f4f8f9 42%, #dce8ed 100%);
}

.mist {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  animation: drift 18s var(--ease) infinite alternate;
}

.mist-a {
  width: 42vw;
  height: 42vw;
  left: -8%;
  top: 18%;
  background: rgba(10, 127, 124, 0.22);
}

.mist-b {
  width: 36vw;
  height: 36vw;
  right: -6%;
  top: 48%;
  background: rgba(20, 48, 65, 0.12);
  animation-delay: -6s;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.chart-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(7, 24, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(7, 24, 34, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 75%);
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(3%, -2%, 0) scale(1.06); }
}

/* —— Layout —— */
.topbar,
.stage,
.foot {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem) 0;
  animation: rise 0.7s var(--ease) both;
}

.topbar .logout {
  margin-left: auto;
}

.brand-mark {
  width: 0.7rem;
  height: 0.7rem;
  background: var(--teal);
  transform: rotate(45deg);
}

.eyebrow {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.stage {
  width: min(1080px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
}

.hero {
  max-width: 38rem;
  animation: rise 0.85s var(--ease) 0.08s both;
}

.brand {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3.4rem, 9vw, 5.6rem);
  letter-spacing: -0.045em;
  line-height: 0.92;
  color: var(--ink);
}

.lede {
  margin: 0 0 2rem;
  font-size: 1.125rem;
  color: var(--ink-soft);
  max-width: 32rem;
}

/* —— Controls (interaction container) —— */
.run-rail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1.25rem;
  background: rgba(247, 250, 251, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  animation: rise 0.9s var(--ease) 0.16s both;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.3rem;
  background: rgba(7, 24, 34, 0.05);
  border-radius: 8px;
}

.mode {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 600 0.9rem/1.2 var(--body);
  padding: 0.7rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.mode:hover {
  color: var(--ink);
}

.mode.is-active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(7, 24, 34, 0.06);
}

.groups-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.25rem;
}

.groups-toolbar,
.create-row,
.add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.field.grow {
  flex: 1;
}

.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font: 500 0.92rem/1.45 var(--body);
  color: var(--text);
  background: var(--paper);
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid rgba(10, 127, 124, 0.35);
  outline-offset: 1px;
}

.groups-toolbar .field {
  flex: 1;
}

.btn-secondary,
.btn-text {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--body);
  font-weight: 700;
  border-radius: 8px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-secondary {
  padding: 0.78rem 1.1rem;
  background: rgba(10, 127, 124, 0.12);
  color: var(--teal);
  white-space: nowrap;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(10, 127, 124, 0.2);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text {
  padding: 0.55rem 0.2rem;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  flex: 1;
}

.url-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 11rem;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.url-list li {
  display: grid;
  grid-template-columns: 1.6rem 1fr;
  gap: 0.55rem;
  padding: 0.55rem 0.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--ink-soft);
}

.url-list .n {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
}

.url-list:empty::after {
  content: "No URLs in this group yet";
  display: block;
  padding: 0.75rem 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn-primary {
  appearance: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 0.85rem;
  padding: 0.95rem 1.35rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--fog);
  font-family: var(--body);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink-soft);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-label {
  font-weight: 700;
  font-size: 1rem;
}

.btn-meta {
  font-size: 0.8rem;
  opacity: 0.7;
  font-weight: 500;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.85rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--teal);
  color: var(--teal);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.btn-ghost:hover {
  background: rgba(10, 127, 124, 0.1);
}

.btn-ghost[hidden],
.groups-panel[hidden],
.add-urls[hidden],
.results[hidden],
#deleteGroupBtn[hidden] {
  display: none !important;
}

/* —— Progress —— */
.progress-panel {
  margin-top: 2.75rem;
  animation: rise 1s var(--ease) 0.24s both;
}

.progress-head,
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-stat,
.results-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.track {
  height: 3px;
  background: rgba(7, 24, 34, 0.1);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.track-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--teal), var(--teal-bright));
  transition: width 0.45s var(--ease);
}

.log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 16rem;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.log li {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  animation: rise 0.35s var(--ease) both;
}

.log .idx {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
}

.log .name {
  font-weight: 600;
  color: var(--ink);
}

.log .badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.log .badge.ok { color: var(--ok); }
.log .badge.fail { color: var(--danger); }
.log .badge.review { color: var(--signal); }

/* —— Results table —— */
.results {
  margin-top: 2.5rem;
  animation: rise 0.6s var(--ease) both;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

.venue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.venue-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  padding: 0.85rem 0.6rem 0.65rem 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.venue-table td {
  padding: 0.85rem 0.6rem 0.85rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.venue-table .v-name {
  font-weight: 600;
  color: var(--ink);
}

.venue-table .v-sub {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.venue-table a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}

.venue-table a:hover {
  text-decoration: underline;
}

.foot {
  padding: 0 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .mode-switch {
    grid-template-columns: 1fr;
  }

  .log li {
    grid-template-columns: 2.5rem 1fr;
  }

  .log .badge {
    grid-column: 2;
  }

  .venue-table th:nth-child(3),
  .venue-table td:nth-child(3),
  .venue-table th:nth-child(4),
  .venue-table td:nth-child(4) {
    display: none;
  }

  .step-block {
    grid-template-columns: 1fr;
  }

  .create-easy {
    flex-direction: column;
  }
}

/* —— Simple 1-2-3 flow —— */
.simple-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
  animation: rise 0.9s var(--ease) 0.14s both;
}

.step-block {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  gap: 0.9rem;
  padding: 1.15rem 1.2rem;
  background: rgba(247, 250, 251, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.step-num {
  margin: 0.15rem 0 0;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--fog);
  font-weight: 800;
  font-family: var(--display);
  font-size: 1.05rem;
}

.step-title {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.step-help {
  margin: -0.35rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.step-body textarea {
  width: 100%;
  resize: vertical;
  min-height: 8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font: 500 0.95rem/1.45 var(--body);
  color: var(--text);
  background: var(--paper);
  margin-bottom: 0.75rem;
}

.step-body textarea:focus {
  outline: 2px solid rgba(10, 127, 124, 0.35);
  outline-offset: 1px;
}

.row-gap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.create-easy {
  margin-top: 0.85rem;
  align-items: stretch;
}

.create-easy input {
  flex: 1;
  min-width: 12rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  font: 600 1rem/1.3 var(--body);
  background: var(--paper);
  color: var(--text);
}

.create-easy input:focus {
  outline: 2px solid rgba(10, 127, 124, 0.35);
  outline-offset: 1px;
}

.url-count {
  margin: 0.85rem 0 0.25rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.new-run-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.new-run-row[hidden] {
  display: none !important;
}

.btn-primary.full {
  width: 100%;
  justify-content: center;
}

.step-block[hidden],
#urlsStep[hidden],
#runStep[hidden],
#deleteGroupBtn[hidden],
.login-error[hidden] {
  display: none !important;
}

/* —— Login —— */
.login-body {
  min-height: 100vh;
}

.login-stage {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 18vh 0 4rem;
  animation: rise 0.8s var(--ease) both;
}

.login-brand {
  margin-bottom: 0.2rem;
  font-size: clamp(2.8rem, 8vw, 3.6rem);
}

.login-sub {
  margin: 0 0 1.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--teal);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-box {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.25rem;
  background: rgba(247, 250, 251, 0.88);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}
