/* App screens: the onboarding flow, the customer dashboard and the admin.
   Same tokens as styles.css — load that first. */

.app-shell {
  min-height: 100svh;
  display: flex; flex-direction: column;
  background: var(--hero-tint);
  color: var(--hero-ink);
}
.app-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--pad);
  background: #fff;
  border-bottom: 1px solid var(--hero-line);
}
.app-top .mark-img { height: 30px; width: auto; }
.app-top-links { display: flex; align-items: center; gap: 18px; font-family: var(--mono); font-size: 12px; }
.app-top-links a { text-decoration: none; opacity: 0.7; }
.app-top-links a:hover { opacity: 1; }

.app-main {
  flex: 1 1 auto; width: 100%;
  max-width: 1180px; margin: 0 auto;
  padding: clamp(26px, 4vw, 56px) var(--pad) clamp(40px, 6vw, 80px);
}

.app-steps {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11.5px;
  margin: 0 0 clamp(18px, 2.4vw, 26px);
  opacity: 0.55; flex-wrap: wrap;
}
.app-steps .crumb { display: inline-flex; align-items: center; gap: 7px; }
.app-steps .crumb.past { color: var(--hero-ink); opacity: 0.85; font-weight: 500; }
.app-steps .crumb.now { color: var(--hero-ink); opacity: 1; font-weight: 600; }
.app-steps .crumb.now::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--hero-bg); }
.app-steps .sep { opacity: 0.35; }

.app-h1 {
  font-size: clamp(28px, 3.6vw, 46px);
  line-height: 1.02; letter-spacing: -0.04em; font-weight: 800;
  margin: 0; text-transform: lowercase;
}
.app-sub { margin: 12px 0 0; font-size: clamp(14px, 1.2vw, 16px); color: var(--hero-ink-soft); opacity: 0.8; max-width: 62ch; }

.panel {
  background: #fff;
  border: 1px solid oklch(18.5% 0.092 275 / 0.08);
  border-radius: 16px;
  padding: clamp(18px, 2.4vw, 28px);
  box-shadow: 0 24px 60px -46px oklch(18.5% 0.092 275 / 0.6);
}
.panel-tight { padding: clamp(14px, 1.6vw, 18px); }

/* the url bar */
.app-bar {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 10px;
  background: #fff;
  border: 1.5px solid oklch(18.5% 0.092 275 / 0.16);
  border-radius: 12px;
  padding: 6px 6px 6px clamp(14px, 1.6vw, 18px);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.app-bar:focus-within {
  border-color: var(--hero-bg);
  box-shadow: 0 0 0 4px oklch(62% 0.206 278 / 0.18);
}
.app-bar-field { display: flex; align-items: center; gap: 10px; min-width: 0; }
.app-bar-lead { font-family: var(--mono); font-size: 13px; opacity: 0.5; white-space: nowrap; display: inline-flex; gap: 5px; }
.app-bar-lead .prompt { opacity: 0.7; }
.app-bar input {
  flex: 1 1 auto; min-width: 0; border: 0; background: none;
  font-family: var(--sans); font-size: clamp(15px, 1.5vw, 18px); font-weight: 500;
  color: var(--hero-ink); padding: 15px 0;
}
.app-bar input:focus { outline: none; }
.app-bar input::placeholder { color: oklch(18.5% 0.092 275 / 0.34); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 9px; cursor: pointer;
  padding: 13px 18px;
  font-family: var(--sans); font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  transition: transform 160ms var(--ease-out), background 160ms var(--ease-out), opacity 160ms var(--ease-out);
  text-decoration: none;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--hero-bg); color: var(--hero-ink); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.03); }
.btn-dark { background: var(--hero-ink); color: var(--hero-tint); }
.btn-dark:hover { transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--hero-ink); border: 1px solid oklch(18.5% 0.092 275 / 0.16); }
.btn-ghost:hover { border-color: oklch(18.5% 0.092 275 / 0.4); }
.btn-sm { padding: 9px 13px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; }

/* crawl progress */
.crawl { display: grid; gap: 12px; }
.crawl-line { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12.5px; }
.crawl-line .spin {
  width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid oklch(18.5% 0.092 275 / 0.2);
  border-top-color: var(--hero-bg);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.crawl-log { font-family: var(--mono); font-size: 11.5px; opacity: 0.55; margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }

/* step two: pick pages */
.pick { display: grid; grid-template-columns: minmax(0, 1fr) 322px; gap: clamp(16px, 2.2vw, 28px); align-items: start; margin-top: clamp(20px, 2.6vw, 30px); }

.pick-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 14px; }
.pick-count { font-family: var(--mono); font-size: 12px; opacity: 0.65; }
.pick-count b { font-weight: 700; opacity: 1; }

.url-list { max-height: 540px; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding-right: 4px; }
.url-list::-webkit-scrollbar { width: 8px; }
.url-list::-webkit-scrollbar-thumb { background: oklch(18.5% 0.092 275 / 0.18); border-radius: 999px; }

.url-row {
  min-width: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  background: oklch(96.5% 0.012 285);
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 140ms var(--ease-out), border-color 140ms var(--ease-out);
}
.url-row:hover { background: oklch(94.5% 0.02 285); }
.url-row.is-off { background: #fff; border-color: oklch(18.5% 0.092 275 / 0.12); opacity: 0.75; }
.url-row input[type="checkbox"] {
  width: 17px; height: 17px; flex: 0 0 auto;
  accent-color: var(--hero-bg); cursor: pointer;
}
.url-text {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--mono); font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.url-row.is-off .url-text { text-decoration: line-through; opacity: 0.55; }
.url-x {
  flex: 0 0 auto; border: 0; background: none; padding: 4px;
  color: oklch(55% 0.18 25); opacity: 0.85; line-height: 0;
  border-radius: 6px;
}
.url-x:hover { background: oklch(55% 0.18 25 / 0.1); opacity: 1; }
.url-x svg { width: 15px; height: 15px; }

.add-row { display: none; gap: 8px; margin-top: 10px; }
.add-row.on { display: flex; }
.add-row input {
  flex: 1 1 auto; min-width: 0;
  border: 1px solid oklch(18.5% 0.092 275 / 0.18);
  border-radius: 9px; padding: 11px 12px;
  font-family: var(--mono); font-size: 12.5px;
}
.add-row input:focus { outline: none; border-color: var(--hero-bg); box-shadow: 0 0 0 3px oklch(62% 0.206 278 / 0.16); }

.empty { font-size: 14px; color: var(--hero-ink-soft); opacity: 0.75; margin: 0; }

/* the sidebar */
.side { position: sticky; top: 20px; display: grid; gap: 14px; }
.side-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.5; margin: 0; }
.side-count { font-size: 54px; font-weight: 900; font-style: italic; letter-spacing: -0.05em; line-height: 0.9; margin: 2px 0 0; }

.price-box {
  background: oklch(95% 0.03 285);
  border-radius: 12px;
  padding: 14px 15px;
  display: grid; gap: 4px;
}
.price-box .pb-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.55; margin: 0; }
.price-box .pb-price { font-size: 30px; font-weight: 900; letter-spacing: -0.045em; line-height: 1; margin: 2px 0 0; }
.price-box .pb-price span { font-size: 0.5em; font-weight: 600; letter-spacing: 0; opacity: 0.55; margin-left: 2px; }
.price-box .pb-note { margin: 4px 0 0; font-size: 11.5px; line-height: 1.45; opacity: 0.65; }

.plan-table { display: grid; gap: 7px; font-family: var(--mono); font-size: 11.5px; margin: 2px 0 0; }
.plan-line { display: flex; justify-content: space-between; gap: 10px; opacity: 0.45; }
.plan-line.on { opacity: 1; font-weight: 700; }
.plan-line.on::before { content: ""; }
.plan-line span:first-child::before { content: "▸ "; opacity: 0.6; }
.plan-line:not(.on) span:first-child::before { content: ""; }

/* fields */
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-wide { grid-column: 1 / -1; }
.field > span { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; opacity: 0.6; }
.field > span em { font-style: normal; opacity: 0.6; }
.field input, .field textarea {
  width: 100%;
  border: 1px solid oklch(18.5% 0.092 275 / 0.16);
  border-radius: 9px;
  padding: 12px 13px;
  font-family: var(--sans); font-size: 15px; color: var(--hero-ink);
  background: #fff;
}
.field textarea { font-family: var(--mono); font-size: 12.5px; line-height: 1.5; resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--hero-bg);
  box-shadow: 0 0 0 3px oklch(62% 0.206 278 / 0.16);
}
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: oklch(55% 0.18 25); box-shadow: 0 0 0 3px oklch(55% 0.18 25 / 0.12);
}

.form-error {
  margin: 12px 0 0; padding: 11px 14px;
  border-radius: 9px; font-size: 13.5px; font-weight: 500;
  background: oklch(95% 0.03 25); color: oklch(38% 0.14 25);
}
.form-error[hidden] { display: none; }

/* order summary in step three */
.summary { display: grid; gap: 10px; }
.summary-row { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 14px; padding-bottom: 10px; border-bottom: 1px solid oklch(18.5% 0.092 275 / 0.1); }
.summary-row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.summary-row dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.55; margin: 0; }
.summary-row dd { margin: 0; font-weight: 600; text-align: right; }
.summary-host { font-family: var(--mono); font-size: 12.5px; }

/* the confirmation + dashboard cards */
.bot-card {
  background: #fff;
  border: 1px solid oklch(18.5% 0.092 275 / 0.08);
  border-radius: 16px;
  padding: clamp(16px, 2vw, 22px);
  display: grid; gap: 14px;
  box-shadow: 0 24px 60px -48px oklch(18.5% 0.092 275 / 0.6);
}
.bot-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.bot-host { font-family: var(--mono); font-size: clamp(14px, 1.4vw, 17px); font-weight: 700; margin: 0; }
.bot-meta { font-family: var(--mono); font-size: 11.5px; opacity: 0.6; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.bot-meta i { font-style: normal; opacity: 0.5; }

.pill {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  background: oklch(95% 0.03 285); color: var(--hero-ink);
  border: 1px solid oklch(62% 0.206 278 / 0.25);
  white-space: nowrap;
}
.pill.pill-ready { background: oklch(94% 0.06 155); border-color: oklch(72% 0.14 155 / 0.4); color: oklch(32% 0.09 155); }

.bot-body { font-size: 14.5px; line-height: 1.55; color: var(--hero-ink-soft); margin: 0; max-width: 70ch; }

.code-block { position: relative; }
.code-block pre {
  margin: 0; padding: 16px 86px 16px 18px;
  background: var(--hero-ink); color: oklch(93% 0.02 285);
  border-radius: 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.65;
  overflow-x: auto; white-space: pre-wrap; word-break: break-all;
}
.code-block .copy {
  position: absolute; top: 10px; right: 10px;
  background: oklch(96% 0.02 285 / 0.14);
  border: 1px solid oklch(96% 0.02 285 / 0.28);
  color: oklch(96% 0.02 285);
  border-radius: 7px; padding: 6px 10px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
}
.code-block .copy:hover { background: oklch(96% 0.02 285 / 0.24); }

.preview-frame {
  border: 1px dashed oklch(18.5% 0.092 275 / 0.25);
  border-radius: 12px;
  padding: 12px;
  display: grid; gap: 8px;
  background: oklch(97.5% 0.01 285);
}
.preview-frame .pf-note { font-family: var(--mono); font-size: 11px; opacity: 0.55; margin: 0; }
.preview-frame iframe { width: 100%; height: 460px; border: 0; border-radius: 9px; background: #fff; }

.status-line { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.status-line .dotpulse {
  width: 8px; height: 8px; border-radius: 50%; background: var(--hero-bg);
  box-shadow: 0 0 0 0 oklch(62% 0.206 278 / 0.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 oklch(62% 0.206 278 / 0.45); }
  70% { box-shadow: 0 0 0 10px oklch(62% 0.206 278 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(62% 0.206 278 / 0); }
}

.ref-line { font-family: var(--mono); font-size: 11.5px; opacity: 0.5; margin: 0; }

/* admin */
.admin-row { display: grid; gap: 12px; }
.admin-row textarea { width: 100%; min-height: 90px; font-family: var(--mono); font-size: 12px; border-radius: 9px; border: 1px solid oklch(18.5% 0.092 275 / 0.16); padding: 12px; }
.admin-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.saved-note { font-family: var(--mono); font-size: 11.5px; color: oklch(38% 0.12 155); }

@media (max-width: 940px) {
  .pick { grid-template-columns: 1fr; }
  .side { position: static; }
  .url-list { max-height: 420px; }
}
@media (max-width: 620px) {
  .fields-2 { grid-template-columns: 1fr; }
  .app-bar { grid-template-columns: 1fr; }
  .app-bar input { padding: 10px 0; }
  .app-top .mark-img { height: 26px; }
  .app-top-links a:not(.keep) { display: none; }
  .side-count { font-size: 46px; }
}

/* ── mobile safety: nothing may push the page wider than the phone ── */
.app-shell, .app-main, .panel, .bot-card, .steps-card, .pick, .url-list, .detail { min-width: 0; max-width: 100%; }
.app-shell { overflow-x: clip; }
.bot-host, .req-host, .summary-row dd, .bot-meta, .req-meta { overflow-wrap: anywhere; }
img, svg, iframe, pre, textarea { max-width: 100%; }
