/* Portal styling.

   An operations tool, so density and legibility over decoration: one accent,
   tabular figures wherever numbers line up, and state carried by shape as well
   as colour so a pill still reads in a screenshot or to someone who cannot
   separate the hues. Tokens are defined once and redefined for dark, which the
   people using this at 6am will have on. */

:root {
  /* Light only, deliberately. This is an operations tool that gets read next
     to the Shopify admin and a spreadsheet, both of which are white, and a
     panel that flips to dark because of an OS setting made the numbers harder
     to compare across windows. One look, chosen rather than inherited. */
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --line: #e3e7ed;
  --line-strong: #cdd4de;
  --ink: #131a24;
  --ink-soft: #5d6774;
  --ink-faint: #8b94a3;
  --accent: #14213d;
  --accent-ink: #ffffff;
  --ok-bg: #e8f5ee;  --ok-ink: #15683f;
  --warn-bg: #fdf3e3; --warn-ink: #8a5a10;
  --danger: #b42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(19, 26, 36, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font: 12.5px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-soft); }

/* --- frame ------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar__brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; flex: none;
}
.topbar__brand img { height: 31px; width: auto; display: block; }
.topbar__brand span {
  color: var(--ink-faint); font-size: 13px; font-weight: 500;
  border-left: 1px solid var(--line); padding-left: 9px;
}
/* Eleven links and a name have to fit next to the logo. They wrapped to a
   second row and pushed Sign out into two lines; scrolling the nav sideways
   keeps the bar one row high at any width. */
.topbar__nav {
  display: flex; gap: 2px; margin-right: auto; min-width: 0;
  overflow-x: auto; scrollbar-width: none;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav a {
  padding: 6px 9px; border-radius: 7px; font-size: 13.5px; font-weight: 500;
  color: var(--ink-soft); text-decoration: none; white-space: nowrap;
}
.topbar__nav a:hover { background: var(--bg); color: var(--ink); }
.topbar__nav a[aria-current] { background: var(--bg); color: var(--ink); font-weight: 600; }
.topbar__user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-soft); flex: none; }
.topbar__user button {
  padding: 5px 10px; white-space: nowrap; font: inherit; color: var(--ink-soft);
  background: transparent; border: 1px solid var(--line); border-radius: 7px; cursor: pointer;
}
.topbar__user button:hover { border-color: var(--line-strong); color: var(--ink); }

.shell { max-width: 1080px; margin: 0 auto; padding: 28px 22px 72px; }
.shell--bare { display: grid; place-items: center; min-height: 100vh; padding: 22px; }
h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.02em; }
h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -.01em; }
.muted { color: var(--ink-soft); margin: 0 0 18px; }
.muted.block { display: block; font-size: 13px; margin: 0; }
.warn { color: var(--warn-ink); font-weight: 600; }
.strong { font-weight: 600; text-decoration: none; }
.strong:hover { text-decoration: underline; }
.crumbs { margin: 0 0 10px; font-size: 13px; color: var(--ink-faint); }
.crumbs a { color: var(--ink-soft); }
.count { color: var(--ink-faint); font-weight: 500; }
.right { text-align: right; }
.num, .stat__n { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* --- blocks ----------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin: 18px 0;
}
.card--auth { width: min(400px, 100%); padding: 28px; }
.auth__logo { display: block; height: 46px; width: auto; margin: 0 0 16px; }
.card--auth h1 { font-size: 21px; }
.split { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.row { display: flex; align-items: flex-end; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.inline { display: inline; }
.stack { display: grid; gap: 14px; margin-top: 14px; }
.grid { display: grid; gap: 12px; }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 8px; }
.grid--fields { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat__n { display: block; font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.stat__l { display: block; font-size: 13px; color: var(--ink-soft); }

/* --- table ------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-faint);
  padding: 0 10px 8px; border-bottom: 1px solid var(--line);
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
.table tr:last-child td { border-bottom: 0; }

/* --- pills ------------------------------------------------------------ */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; text-decoration: none;
}
.pill--ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill--warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill--muted { background: var(--bg); color: var(--ink-faint); border: 1px solid var(--line); }

/* --- forms ------------------------------------------------------------ */
label { display: block; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search] {
  width: 100%; margin-top: 5px; padding: 9px 11px;
  font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
}
input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field__label { font-weight: 600; display: block; }
.field__label code { margin-left: 6px; }
.field__note { display: block; margin-top: 4px; font-size: 12.5px; color: var(--ink-faint); }
.field--inline { width: auto; }
.field--inline input { width: auto; }
.fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0; }
.fieldset legend { padding: 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.field--narrow { width: auto; min-width: 190px; flex: 1 1 190px; }

/* An escape hatch that is needed once a year should not sit open above the
   fields that are needed every time. */
.disclose { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; }
.disclose > summary {
  cursor: pointer; padding: 10px 0; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); list-style-position: inside;
}
.disclose > summary:hover { color: var(--ink); }
.disclose[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.disclose > .row { padding-bottom: 14px; }

.switch { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.switch--block {
  display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start;
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
}
.switch--block input { grid-row: span 2; margin-top: 3px; }
.switch__label { font-weight: 600; }
.switch__note { font-size: 12.5px; color: var(--ink-faint); grid-column: 2; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.08); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { color: var(--ink); border-color: var(--ink-faint); }
.btn--danger-ghost { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
/* .stack is a grid, so a button in one stretches the full width of the card
   unless it is told not to. A sign-in card is the one place where a full-width
   submit is right, so it keeps the stretch. */
.stack > .btn, .stack > button { justify-self: start; }
.card--auth .stack > .btn, .card--auth .stack > button { justify-self: stretch; justify-content: center; }

/* --- setup checklist --------------------------------------------------- */
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.steps__i {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 12px;
  padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg);
}
.steps__i.is-done { background: var(--ok-bg); border-color: transparent; }
.steps__mark {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font-size: 13px; font-weight: 700; line-height: 1;
  background: var(--surface); color: var(--ink-faint); border: 1px solid var(--line-strong);
}
.steps__i.is-done .steps__mark { background: var(--ok-ink); color: var(--surface); border-color: transparent; }
.steps__body { display: grid; gap: 2px; min-width: 0; }
.steps__t { font-weight: 600; font-size: 14px; }
.steps__d { font-size: 13px; color: var(--ink-soft); }
.steps__i.is-done .steps__d { color: var(--ok-ink); }

/* --- lists ------------------------------------------------------------ */
.checklist { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.checklist li { background: var(--surface); }
.checklist label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.checklist label:hover { background: var(--bg); }
.checklist__label { flex: 1; }
.checklist__count { font-variant-numeric: tabular-nums; color: var(--ink-faint); font-size: 13px; }
.linklist { margin: 8px 0 0; padding-left: 18px; }
.linklist li { margin: 4px 0; }

.feed { list-style: none; margin: 10px 0 0; padding: 0; }
.feed li { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed__what { font-weight: 600; }
.feed__who { color: var(--ink-soft); }
.feed__when { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 0 0 16px; }
.flash--ok { background: var(--ok-bg); color: var(--ok-ink); }
.flash--error { background: #fdecea; color: var(--danger); }
.flash--info { background: var(--bg); color: var(--ink-soft); border: 1px solid var(--line); }

/* Below this the nav genuinely does not fit, so it scrolls. Fading the right
   edge is what tells the reader that, rather than leaving a half-cut word that
   reads as a rendering fault. */
@media (max-width: 1279px) {
  .topbar__nav {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent);
  }
}

@media (max-width: 700px) {
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .topbar__nav { mask-image: none; -webkit-mask-image: none; flex-wrap: wrap; overflow: visible; }
  .shell { padding: 18px 14px 56px; }
  .table thead { display: none; }
  .table td { display: block; border: 0; padding: 3px 0; }
  .table tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .table td.right { text-align: left; }
}

.pill--bad { background: #fdecea; color: var(--danger); }
.log {
  margin: 10px 0 0;
  padding: 12px 14px;
  max-height: 460px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

select {
  margin-top: 5px;
  padding: 8px 10px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
}
input[type=number] { margin-top: 0; padding: 7px 9px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; text-align: right; width: 5.5em; font-variant-numeric: tabular-nums; }
.sources { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.sources li { padding: 2px 0; color: var(--ink-soft); }
.sources li.is-chosen { color: var(--ink); font-weight: 600; }
.table tfoot td { padding: 10px; border-top: 2px solid var(--line-strong); }

textarea {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  resize: vertical;
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field__note.is-over { color: var(--warn-ink); font-weight: 600; }

/* A search result, so the fields above are judged as what they become. */
.serp {
  display: grid;
  gap: 2px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 600px;
}
.serp__url { font-size: 12.5px; color: var(--ink-soft); overflow-wrap: anywhere; }
.serp__title { font-size: 18px; line-height: 1.3; color: #1a0dab; }
.serp__desc { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }

.checklist li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 220px); align-items: center; gap: 10px; padding-right: 12px; }
.checklist__map { margin-top: 0; padding: 6px 9px; font-size: 13px; }
@media (max-width: 700px) {
  .checklist li { grid-template-columns: 1fr; gap: 0; padding-bottom: 10px; }
  .checklist__map { margin: 0 0 0 34px; width: calc(100% - 46px); }
  /* On a phone the action belongs under the wording, not squeezed beside it. */
  .steps__i { grid-template-columns: 22px 1fr; row-gap: 10px; }
  .steps__i > .btn { grid-column: 2; justify-self: start; }
}
