/**
 * Navigation, the guided setup flow, and the plain-English lists.
 *
 * Separate from app.css on purpose: app.css was at 613 lines and this is a
 * distinct concern — how the dashboard is navigated and how the main task is
 * walked through. Tokens all come from app.css :root.
 */

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 11px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: color 120ms ease, border-color 120ms ease;
}
.tab:hover { color: var(--ink-2); }
.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 4px 4px 0 0;
}
.tab.is-on { color: var(--ink); border-bottom-color: var(--accent); }

.tab-count {
  font-size: 11px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 0 6px;
  min-width: 20px;
  text-align: center;
}
.tab-count:empty { display: none; }
.tab.is-on .tab-count {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-color: transparent;
}

/* ---------- filter chips ---------- */

.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.chip:hover { background: var(--ground); border-color: #cfd6dd; color: var(--ink); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip.is-on {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-color: transparent;
  font-weight: 650;
}
.chip-n { font-variant-numeric: tabular-nums; font-size: 11px; color: var(--ink-3); }
.chip.is-on .chip-n { color: var(--accent-ink); }

/* ---------- the one big thing you can do ---------- */

.wiz { padding: 18px; }

.wiz-start {
  appearance: none;
  font: inherit;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px dashed #c3ced8;
  border-radius: 10px;
  transition: border-color 140ms ease, background 140ms ease;
}
.wiz-start:hover { border-color: var(--accent); background: var(--accent-wash); }
.wiz-start:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wiz-plus {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 23px;
  line-height: 36px;
  text-align: center;
  font-weight: 400;
}
.wiz-start-text { display: grid; gap: 2px; }
.wiz-start-text strong { font-size: 15px; font-weight: 650; }
.wiz-start-text small { font-size: 12.5px; color: var(--ink-3); }

/* ---------- the guided flow ---------- */

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

.wiz-form { display: block; }

.wiz-progress {
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.wiz-step { display: none; }
.wiz-step.is-on { display: block; }

.wiz-q {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.wiz-help { margin: 0 0 14px; font-size: 13px; color: var(--ink-2); max-width: 46ch; }

.wiz-input {
  width: 100%;
  max-width: 460px;
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.wiz-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.wiz-input::placeholder { color: #a8b2bd; }

.wiz-sub {
  display: block;
  margin: 16px 0 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.wiz-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.wiz-chips button {
  appearance: none;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 12px;
  cursor: pointer;
}
.wiz-chips button:hover {
  color: var(--accent-ink);
  background: var(--accent-wash);
  border-color: transparent;
}

/* two big answers, rather than a checkbox to decode */
.wiz-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  max-width: 500px;
}
.wiz-choice {
  position: relative;
  appearance: none;
  font: inherit;
  display: grid;
  gap: 3px;
  padding: 14px 15px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color 120ms ease, background 120ms ease;
}
.wiz-choice:hover { border-color: #c3ced8; }
.wiz-choice.is-on { border-color: var(--accent); background: var(--accent-wash); }
.wiz-choice strong { font-size: 14px; font-weight: 650; }
.wiz-choice small { font-size: 12px; color: var(--ink-3); }
.wiz-choice.is-on small { color: var(--accent-ink); }
.wiz-choice input { position: absolute; opacity: 0; pointer-events: none; }

.wiz-choice .pick-thumb {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  background: var(--ground) center/cover no-repeat;
  border: 1px solid var(--line-2);
}

.gate-fields { margin-top: 16px; max-width: 460px; }

.wiz-summary {
  margin: 18px 0 0;
  padding: 13px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
  background: var(--ground);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  max-width: 500px;
}

.wiz-error {
  margin: 12px 0 0;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--bad);
  background: var(--bad-wash);
  border-radius: 6px;
  max-width: 500px;
}

.wiz-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}
/* `.linkish` is only styled inside .gate-card, so Cancel arrived here looking
   like a second primary button. It is the quietest thing in the row. */
.wiz-nav #wiz-cancel {
  margin-left: auto;
  appearance: none;
  padding: 6px 4px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink-3);
  background: none;
  border: 0;
  text-decoration: underline;
  cursor: pointer;
}
.wiz-nav #wiz-cancel:hover { color: var(--ink-2); }

/* ---------- the message, shown rather than described ---------- */

.wiz-preview { position: sticky; top: 16px; }
.wiz-preview-h {
  margin: 0 0 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.wiz-phone {
  padding: 16px 14px;
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.wiz-cmt { display: flex; gap: 8px; align-items: flex-start; }
.wiz-cmt p { margin: 0; font-size: 12.5px; line-height: 1.4; }
.wiz-cmt strong { font-weight: 650; }
#pv-keyword { font-weight: 700; color: var(--accent-ink); }
.wiz-av {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d7dee6, #bcc7d2);
}
.wiz-arrow { margin: 9px 0 9px 30px; color: var(--ink-3); font-size: 15px; }
.wiz-bubble {
  margin-left: 12px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.45;
  color: #fff;
  background: var(--accent);
  border-radius: 14px 14px 14px 3px;
  overflow-wrap: anywhere;
}
.wiz-link { display: block; margin-top: 5px; font-size: 12px; opacity: 0.92; text-decoration: underline; }
.wiz-sent { margin: 8px 0 0 14px; font-size: 11px; color: var(--ink-3); }

/* ---------- rules, written as sentences ---------- */

.rule-list { display: grid; }

.rule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 15px 18px;
  border-top: 1px solid var(--line-2);
}
.rule.is-off { background: #fcfcfd; }
.rule.is-off .rule-main { opacity: 0.55; }

.rule-main { display: grid; gap: 3px; min-width: 0; }
.rule-when { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.rule-when strong {
  font-weight: 700;
  color: var(--ink);
  background: var(--accent-wash);
  border-radius: 4px;
  padding: 1px 6px;
}
.rule-reply { margin: 0; font-size: 13.5px; }
.rule-link {
  margin: 0;
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rule-gate { margin: 3px 0 0; font-size: 12px; color: var(--ok); }
.rule-where {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ---------- a post referenced inside a list ---------- */

.post-ref {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 260px;
  color: inherit;
  text-decoration: none;
}
a.post-ref:hover .post-ref-cap { color: var(--accent-ink); text-decoration: underline; }
.post-ref-thumb {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--ground) center/cover no-repeat;
  border: 1px solid var(--line-2);
}
.post-ref-cap { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- activity as a feed ---------- */

.feed { display: grid; }

.ev {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
}
.ev p { margin: 0; }
.ev-dot {
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--line);
}
.ev-sent .ev-dot { background: var(--ok); }
.ev-failed .ev-dot,
.ev-unconfigured .ev-dot,
.ev-over_quota .ev-dot { background: var(--bad); }

.ev-main { font-size: 13.5px; }
.ev-meta { font-size: 12px; color: var(--ink-3); margin-top: 1px !important; }
.ev-why {
  margin-top: 5px !important;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--bad);
  background: var(--bad-wash);
  border-radius: 5px;
  overflow-wrap: anywhere;
}

/* ---------- picker dialog ---------- */

.picker {
  width: min(880px, calc(100vw - 32px));
  max-height: min(78vh, 760px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(16, 21, 28, 0.22);
  overflow: hidden;
}
.picker::backdrop { background: rgba(16, 21, 28, 0.42); }
.picker[open] { display: flex; flex-direction: column; }

.picker-head,
.picker-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  flex: none;
}
.picker-head { border-bottom: 1px solid var(--line-2); }
.picker-foot { border-top: 1px solid var(--line-2); background: var(--ground); }
.picker-head h2 { font-size: 15px; }
.picker-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; }

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  .wiz-shell { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .wiz-preview { position: static; order: -1; }
  .wiz-phone { max-width: 320px; }
}

@media (max-width: 720px) {
  .tab { padding: 11px 12px; font-size: 12.5px; }
  .wiz { padding: 14px; }
  .wiz-q { font-size: 18px; }
  .rule { grid-template-columns: auto minmax(0, 1fr); padding: 14px; }
  .rule .link-btn { grid-column: 2; justify-self: start; margin-top: 4px; }
  .ev { padding: 12px 14px; }
  .post-ref { max-width: none; }
  .picker { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; }
}

/* ---------- account settings ---------- */

.acct { margin: 0; display: grid; gap: 12px; }

.acct-row {
  display: flex;
  gap: 16px;
  align-items: baseline;
  flex-wrap: wrap;
}
.acct-row dt {
  flex: 0 0 130px;
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.acct-row dd {
  flex: 1 1 200px;
  margin: 0;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .acct-row { gap: 2px; }
  .acct-row dt { flex-basis: 100%; }
}

/* Three trigger choices need to breathe more than two do. */
.wiz-choices-3 { grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); max-width: 620px; }

/* ---------- people ---------- */

.person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
}
.person:first-child { border-top: 0; }
.person p { margin: 0; }
.person-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--line);
}
.person-dot.is-sent { background: var(--ok); }
.person-name { font-size: 13.5px; font-weight: 650; }
.person-meta { font-size: 12px; color: var(--ink-3); }
.person-when { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* ---------- insights ---------- */

.insights { padding: 16px 18px 6px; display: grid; gap: 14px; }
.insights:empty { display: none; }

.ins-figures { display: flex; flex-wrap: wrap; gap: 26px; }
.ins-fig b {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.ins-fig span { font-size: 11.5px; color: var(--ink-3); }

.ins-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 56px;
}
.ins-chart .bar {
  flex: 1 1 0;
  min-width: 4px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}
.ins-chart .bar.is-zero { background: var(--line); }

.ins-axis {
  display: flex;
  justify-content: space-between;
  margin: -8px 0 0;
  font-size: 10.5px;
  color: var(--ink-3);
}

.ins-words { display: flex; flex-wrap: wrap; gap: 7px; margin: 0; padding: 0; list-style: none; }
.ins-words li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
}
.ins-words span { color: var(--ink-3); font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
  .insights { padding: 14px 14px 4px; }
  .ins-figures { gap: 18px; }
  .person { padding: 12px 14px; }
}

/* ---------- connected Instagram accounts ---------- */

.ig-list { display: grid; gap: 10px; }
.ig-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
}
.ig-row p { margin: 0; }
.ig-name { font-size: 13.5px; font-weight: 650; }
.ig-meta { font-size: 12px; color: var(--ink-3); }
.ig-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1px 7px;
  margin-left: 4px;
}

/* The owner's link to /admin. Only the founder ever sees this. */
.owner-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  background: var(--pop-yellow);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  box-shadow: var(--stamp-sm);
}
.owner-link:hover { background: var(--pop-mint); }

/* A connection Instagram never confirmed. It has no username and a token that
   expires in an hour, so showing it as "@unknown · 0 days" reads like an
   outage rather than a setup step that needs repeating. */
.ig-broken {
  color: var(--bad);
  font-weight: 650;
}
