/* Scraper console additions: Run button, Settings, Run overlay, boot screen.
   Lives on top of the design's globals.css + app.css; uses only its tokens. */

.appbar__actions{
  display:flex; align-items:center; gap:8px;
  margin-left: 14px;
}
.appbar__offline{
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--warn);
  background: var(--warn-tint);
  padding: 3px 8px;
  border-radius: var(--r-pill);
}
.ibtn{
  width: 36px; height: 36px;
  display:inline-flex; align-items:center; justify-content:center;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.ibtn:hover{ background: var(--surface-2); color: var(--text); }
.runbtn{
  display:inline-flex; align-items:center; gap:8px;
  height: 36px; padding: 0 16px;
  background: var(--accent); color: #fff;
  border: 0; border-radius: var(--r-md);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  box-shadow: var(--sh-sm);
  transition: background .12s, transform .04s;
}
.runbtn:hover{ background: var(--accent-hover); }
.runbtn:active{ transform: translateY(1px); }
.runbtn svg{ position: relative; top: 0; }

/* boot screen (loading state before listings.json arrives) */
.boot{
  height: 100vh;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap: 18px; color: var(--text-2); font-family: var(--font-body);
}
.boot__ring{
  width: 28px; height: 28px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.boot__msg{ font-size: 14px; }

/* narrow modal (Run / Settings) */
.modal--narrow{ max-width: 720px; }
.run-body, .settings{ padding: 22px 26px 26px; }

/* run status row */
.run-status{
  display:flex; align-items:center; gap: 12px;
  margin-bottom: 14px;
  font-size: 14px; color: var(--text);
}
.run-status b{ font-weight: 700; }
.run-radar{
  position: relative; width: 14px; height: 14px;
  display:inline-flex; align-items:center; justify-content:center;
}
.run-radar::before, .run-radar::after{
  content:""; position:absolute; inset: 0;
  border-radius:50%; background: var(--accent);
  opacity: .35;
  animation: radarPing 1.4s ease-out infinite;
}
.run-radar::after{ animation-delay: .7s; }
.run-radar span{
  position: relative;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}

.run-log{
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.5;
  color: var(--text-2);
  max-height: 280px; min-height: 180px;
  overflow: auto;
  white-space: pre-wrap; word-break: break-word;
}
.run-err{
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--danger-tint);
  color: var(--danger-ink);
  border-radius: var(--r-sm);
  font-size: 13px;
}

/* settings */
.settings__section{
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.settings__section:last-of-type{ border-bottom: 0; }
.settings__section h3{
  margin: 0 0 12px;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-3);
}
.settings__row{
  display:grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.settings__row label{
  font-size: 13.5px; color: var(--text-2);
}
.settings__row input,
.settings__row select{
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
}
.settings__row input:focus,
.settings__row select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--sh-focus);
}
.settings__saved{
  display:flex; align-items:center; gap:8px;
  margin: 12px 0 0;
  padding: 10px 12px;
  background: var(--success-tint);
  color: var(--success-ink);
  border-radius: var(--r-sm);
  font-size: 13px;
}
.settings__saved code{
  background: rgba(0,0,0,.06);
  padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
}
.settings__hint{
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
  text-transform: none; letter-spacing: 0;
  margin-left: 6px;
}
.settings__hint--warn{ color: var(--warn); }
.settings__derived{
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 9px 12px;
  background: var(--accent-tint);
  color: var(--accent-ink);
  border-radius: var(--r-sm);
  font-size: 12px;
}
.settings__derived code{
  background: rgba(0,0,0,.06);
  padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.settings__ft{
  display: flex; align-items: center; gap: 12px;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.settings__statuspill{
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600;
  padding: 5px 10px; border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.settings__statuspill.is-dirty{ background: var(--warn-tint); color: var(--warn); border-color: var(--warn-tint); }
.settings__statuspill.is-saving{ background: var(--accent-tint); color: var(--accent-ink); border-color: var(--accent-tint-2); }
.settings__statuspill.is-ok{ background: var(--success-tint); color: var(--success-ink); border-color: var(--success-tint); }
.settings__statuspill.is-err{ background: var(--danger-tint); color: var(--danger-ink); border-color: var(--danger-tint); }
.settings__statuspill.is-idle{ }
.settings__statuspill::before{
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .85;
}
.settings__statuspill.is-saving::before{ animation: pulseDot 1.1s ease-in-out infinite; }
.settings-shell{ background: var(--surface); border-radius: var(--r-lg); }

/* Make modals respect the left nav and never cause a horizontal scroll.
   The design's .modal uses width:100% + max-width:1080px + 40px backdrop
   padding, which sums to > viewport when the nav rail is also present. */
.shell .modal-backdrop{ padding: 28px; }
.shell .modal{
  max-width: min(1080px, calc(100vw - 232px - 56px));
  width: 100%;
}
@media (max-width: 880px){
  .shell .modal{ max-width: calc(100vw - 32px); }
}

/* ---- empty state (no dataset on disk) -------------------------------- */
.nodata{
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 80px 24px 60px;
  text-align: center;
  color: var(--text-2);
}
.nodata__title{
  font-family: var(--font-display);
  font-size: 22px; font-weight: 600;
  color: var(--text);
  letter-spacing: -.01em;
}
.nodata__sub{
  max-width: 540px; font-size: 14px; line-height: 1.55;
  color: var(--text-2);
}
.nodata__sub code{
  background: var(--surface-sunken); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 5px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px;
}
.nodata__cta{
  display: flex; gap: 10px; margin-top: 4px;
}
.nodata__alt{
  margin-top: 28px;
  font-size: 12.5px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.nodata__list{
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 720px;
}
.nodata__chip{
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-pill);
  padding: 7px 14px;
  color: var(--text); font-size: 13px;
  cursor: pointer; transition: background .1s, border-color .1s;
  text-transform: capitalize;
}
.nodata__chip:hover{ background: var(--surface); border-color: var(--accent); }
.nodata__chip-count{
  font-size: 11px; font-weight: 700;
  color: var(--accent-ink); background: var(--accent-tint);
  padding: 1px 7px; border-radius: var(--r-pill);
}

.rail--disabled .rail__count{ font-size: 12.5px; line-height: 1.5; }
.appbar__row2.is-disabled{ opacity: .55; }
.appbar__row2.is-disabled input,
.appbar__row2.is-disabled select{ cursor: not-allowed; }

/* mini-map dot */
.geo-dot{
  position: relative;
  width: 18px; height: 18px;
}
.geo-dot span{
  position:absolute; left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

/* ---- left-nav shell -------------------------------------------------- */
.shell{
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  background: var(--bg);
}
.nav{
  display: flex; flex-direction: column;
  padding: 18px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  gap: 6px;
  overflow: auto;
}
.nav__brand{
  display: flex; align-items: center; gap: 12px;
  padding: 4px 6px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.nav__items{ display: flex; flex-direction: column; gap: 4px; }
.nav__item{
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 13px;
  border: 0; background: transparent;
  border-radius: var(--r-sm);
  font: inherit; text-align: left;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.nav__item:hover{ background: var(--surface-sunken); color: var(--text); }
.nav__item.on{
  background: var(--accent-tint);
  color: var(--accent-ink);
  font-weight: 600;
}
.nav__item .ico{ display: inline-flex; color: var(--text-3); }
.nav__item.on .ico{ color: var(--accent); }
.nav__item .badge{
  margin-left: auto;
  font-size: 11px; font-weight: 700;
  color: var(--text-3);
  background: var(--surface-sunken);
  padding: 1px 8px; border-radius: 999px;
}
.nav__item.on .badge{ color: var(--accent); background: var(--surface); }
.nav__spacer{ flex: 1; }
.nav__status{
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.nav__dot{
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3);
}
.nav__dot--running{ background: var(--accent); animation: pulseDot 1.2s ease-in-out infinite; }
.nav__dot--ok{ background: var(--success); }
.nav__dot--err{ background: var(--danger); }
.nav__dot--idle{ background: var(--text-3); }
.nav__theme{
  display: flex; gap: 8px;
  margin-top: 8px;
}
.nav__theme .ibtn{ flex: 1; }

.screen{ overflow: auto; min-width: 0; }
.screen__head{
  padding: 22px 28px 8px;
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 18px; flex-wrap: wrap;
}
.screen__title{
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; letter-spacing: -.02em;
  color: var(--text);
}
.screen__sub{ font-size: 13.5px; color: var(--text-2); margin-top: 4px; }

/* ---- Home screen specifics ------------------------------------------- */
.home{ padding: 0 28px 40px; }
.home__hero{
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  margin-top: 16px;
}
@media (max-width: 980px){ .home__hero{ grid-template-columns: 1fr; } }
.home__card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  box-shadow: var(--sh-sm);
}
.home__card h3{
  margin: 0 0 4px; font-size: 12px; font-weight: 700;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .08em;
}
.home__stats{
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-top: 14px;
}
.home__stat{
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
}
.home__stat .k{ font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.home__stat .v{ font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.home__stat .sub{ font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.home__row{ display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.home__criteria{
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px; margin-top: 12px; font-size: 13px;
}
.home__criteria .k{ color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.home__criteria .v{ font-weight: 600; margin-top: 2px; }
.home__dslist{
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 12px;
}
.home__dsitem{
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font: inherit; text-align: left;
  cursor: pointer; color: var(--text);
  transition: background .1s, border-color .1s;
}
.home__dsitem:hover{ background: var(--surface); border-color: var(--accent); }
.home__dsitem.on{ background: var(--accent-tint); border-color: var(--accent); color: var(--accent-ink); }
.home__dsitem .lbl{ font-weight: 700; text-transform: capitalize; }
.home__dsitem .sub{ font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.home__dsitem.on .sub{ color: var(--accent-ink); opacity: .8; }
.home__dsitem .cnt{
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: var(--surface-sunken); color: var(--text-2);
  padding: 2px 9px; border-radius: 999px;
}
.home__dsitem.on .cnt{ background: var(--surface); color: var(--accent); }

/* In nav-shell mode, hide the old top appbar (Listings screen gets a slimmer one) */
.shell .appbar{ padding-top: 10px; }

/* ---- splash / boot --------------------------------------------------- */
.splash{
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: grid; place-items: center;
}
.splash__stack{ display: flex; flex-direction: column; align-items: center; gap: 24px; }
.splash__mark{
  position: relative; width: 72px; height: 72px;
  display: grid; place-items: center;
}
.splash__ping{
  position: absolute; inset: 0;
  border-radius: 20px;
  border: 2px solid var(--accent);
  animation: radarPing 1.8s ease-out infinite;
}
.splash__core{
  position: relative;
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--accent);
  display: grid; place-items: center;
  box-shadow: var(--sh-md);
}
.splash__core::before, .splash__core::after{
  content: ""; position: absolute; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
}
.splash__core::before{ width: 38px; height: 38px; }
.splash__core::after{ width: 20px; height: 20px; border-color: rgba(255,255,255,.85); }
.splash__core > span{
  width: 8px; height: 8px; border-radius: 50%; background: #fff;
  position: relative; z-index: 1;
}
.splash__name{ font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -.02em; text-align: center; }
.splash__sub{ font-size: 13.5px; color: var(--text-3); margin-top: 4px; text-align: center; }
.splash__bar{
  width: 180px; height: 4px; border-radius: 999px;
  background: var(--surface-sunken); overflow: hidden;
}
.splash__bar > span{
  display: block; height: 100%; background: var(--accent); border-radius: 999px;
  transform-origin: left; animation: bootfill 1.6s ease-out forwards;
}

/* ---- brand mark in header / nav -------------------------------------- */
.brandmark{
  position: relative;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--accent);
  display: inline-grid; place-items: center;
  flex: none; box-shadow: var(--sh-sm);
}
.brandmark::before, .brandmark::after{
  content: ""; position: absolute; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5);
}
.brandmark::before{ width: 22px; height: 22px; }
.brandmark::after{ width: 12px; height: 12px; border-color: rgba(255,255,255,.8); }
.brandmark > span{
  position: relative; z-index: 1;
  width: 5px; height: 5px; border-radius: 50%; background: #fff;
}

.brand__stack{ display: flex; flex-direction: column; line-height: 1.1; }
.brand__sub{
  font-size: 11px; color: var(--text-3);
  font-weight: 600; letter-spacing: .02em;
  margin-top: 2px;
}

/* --- dataset picker (header dropdown) ---------------------------------- */
.dspicker{ position: relative; }
.dspicker__btn{
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.dspicker__btn:hover{ background: var(--surface); border-color: var(--accent); }
.dspicker__btn.open{ background: var(--surface); border-color: var(--accent); box-shadow: var(--sh-focus); }
.dspicker__k{
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.dspicker__lbl{
  font-weight: 700; font-size: 13.5px; color: var(--text);
  text-transform: capitalize;
}
.dspicker__sub{ font-size: 12px; color: var(--text-2); }
.dspicker__count{
  font-size: 12px; font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent-tint);
  padding: 2px 8px; border-radius: var(--r-pill);
}
.dspicker__chev{ color: var(--text-3); margin-left: 2px; transition: transform .15s; }
.dspicker__btn.open .dspicker__chev{ transform: rotate(180deg); }
.dspicker--empty{
  display: inline-flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 12px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  color: var(--text-3); font-size: 13px;
}
.dspicker__none{ font-style: italic; }

.dspicker__menu{
  position: absolute; top: calc(100% + 6px); left: 0;
  min-width: 360px; max-width: 480px; z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  padding: 6px;
  display: flex; flex-direction: column;
}
.dspicker__item{
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px;
  background: transparent; border: 0; border-radius: var(--r-sm);
  text-align: left; cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.dspicker__item:hover{ background: var(--surface-sunken); }
.dspicker__item.on{ background: var(--accent-tint); color: var(--accent-ink); }
.dspicker__item-main{ flex: 1; min-width: 0; }
.dspicker__item-lbl{
  font-weight: 700; font-size: 14px;
  text-transform: capitalize;
}
.dspicker__item-sub{
  font-size: 12px; color: var(--text-3);
  margin-top: 2px;
}
.dspicker__item.on .dspicker__item-sub{ color: var(--accent-ink); opacity: .8; }
.dspicker__item-when{
  font-size: 11px; color: var(--text-3);
  white-space: nowrap;
  padding-top: 2px;
}
.dspicker__hint{
  margin: 4px 6px 2px;
  padding: 9px 8px;
  border-top: 1px solid var(--border);
  font-size: 11.5px; color: var(--text-3); line-height: 1.45;
}

/* --- header tighten ---------------------------------------------------- */
.brand__name{ display: inline; }
@media (max-width: 1180px){
  .brand__name{ display: none; }   /* keep just the D mark to free space */
  .dspicker__sub{ display: none; }
}

/* filter rail clarification */
.rail__note{
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.5;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

/* responsive: keep Run visible, drop chips on smaller screens (handled by design) */
@media (max-width: 1280px){
  .appbar__actions{ margin-left: auto; }
}

/* dark-mode polish for new pieces */
:root[data-theme="dark"] .ibtn{ background: var(--surface); }
:root[data-theme="dark"] .settings__saved code{ background: rgba(255,255,255,.08); }
