/* The Seller Portal's stylesheet, served at /portal.css.

   The palette is not this file's to choose. `www/index.html` is rankgrant.com
   and its `:root` is where RankGrant's ink, its canvas, its blue, its soft
   shadow and its display face were decided; the Dashboard copies that block
   and so, now, does this one. A Seller who read the site and then signed in
   should not feel they changed companies on the way.
   `tests/test_a_rankgrant_surface_wears_the_sites_palette.py` is what keeps
   the copies following the original.

   Four tokens below are the Portal's own, because the site has no use for
   them: a live tint, a danger tint, an ink for text on the accent, and the
   code slip — the API sample and a freshly minted key sit on near-black,
   because those are the things a Seller comes here to copy. */

@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/font/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/font/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --ink: #16181d;
  --muted: #5f6672;
  --line: #e4e6eb;
  --paper: #ffffff;
  --canvas: #f6f7f9;
  --accent: #1f6feb;
  --accent-tint: #eef4ff;
  --shadow: 0 1px 2px rgba(22, 24, 29, .04), 0 12px 28px -18px rgba(22, 24, 29, .28);
  --display: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --accent-ink: #ffffff;
  --live: #17804f;
  --live-tint: #e3f4ea;
  --danger: #b42318;
  --danger-tint: #fdecea;
  --slip: #16181d;
  --slip-ink: #eceef2;
  --slip-muted: #9aa2b1;
  --face: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --code: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceef2;
    --muted: #9aa2b1;
    --line: #2b2f38;
    --paper: #171a20;
    --canvas: #0f1116;
    --accent: #6ea8ff;
    --accent-tint: #182234;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 16px 32px -20px rgba(0, 0, 0, .8);
    /* The site's dark accent is a pale blue, so white on it is unreadable;
       a button in dark mode takes the canvas as its ink instead. */
    --accent-ink: #0f1116;
    --live: #5fd39a;
    --live-tint: #13302a;
    --danger: #ff8a80;
    --danger-tint: #3a1d20;
    --slip: #0a0c10;
    --slip-ink: #eceef2;
    --slip-muted: #7d8aa3;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.6 var(--face);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.2em; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--display);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
h1 { font-size: 2rem; font-weight: 600; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

p { margin: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Frame: a sidebar on wide screens, a top bar on narrow ones ---- */

/* The rail's paper is painted on the frame, not the rail, so it runs the whole
   height of a long page while the sticky rail itself stays one screen tall. */
.frame {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(
    to right,
    var(--paper) 0 15rem,
    var(--line) 15rem calc(15rem + 1px),
    transparent calc(15rem + 1px)
  );
}

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100vh;
  padding: 1.75rem 1.25rem;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55em;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.wordmark .mark {
  position: relative;
  flex: none;
  width: 1.35em;
  height: 1.35em;
  border-radius: 0.4375em;
  background: var(--accent);
}
.wordmark .mark::after {
  content: "";
  position: absolute;
  inset: 0.4em 0.35em auto 0.35em;
  height: 0.125em;
  border-radius: 0.125em;
  background: var(--paper);
  box-shadow: 0 0.25em 0 var(--paper);
}
.wordmark small {
  display: block;
  color: var(--muted);
  font-size: 0.7em;
  font-weight: 500;
  letter-spacing: 0;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}
.nav a:hover { color: var(--ink); background: var(--canvas); }
.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-tint);
}

.rail-foot {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.rail-foot .seller {
  margin-bottom: 0.6rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.content {
  width: 100%;
  max-width: 62rem;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
}

.page-head { margin-bottom: 2rem; }
.page-head p {
  max-width: 38rem;
  margin-top: 0.5rem;
  color: var(--muted);
}

.panel {
  margin-bottom: 1.5rem;
  padding: 1.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel > h2 + p,
.panel > header p {
  margin-top: 0.35rem;
  color: var(--muted);
}
.panel header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

@media (max-width: 52rem) {
  .frame { grid-template-columns: 1fr; background: none; }
  .rail {
    position: static;
    background: var(--paper);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    height: auto;
    padding: 0.9rem 1.25rem;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav { flex-direction: row; }
  .rail-foot {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding-top: 0;
    border-top: 0;
  }
  .rail-foot .seller { margin: 0; }
  .content { padding-top: 1.75rem; }
}

/* ---- Controls ---- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 0.95rem/1 var(--face);
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.quiet {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}
button.quiet:hover { background: var(--canvas); filter: none; }
button.danger {
  min-height: 2rem;
  padding: 0.35rem 0.75rem;
  border-color: var(--line);
  background: transparent;
  color: var(--danger);
  font-size: 0.85rem;
}
button.danger:hover { background: var(--danger-tint); filter: none; }

.field { display: grid; gap: 0.35rem; }
.field label { font-size: 0.9rem; font-weight: 600; }
.field .hint { color: var(--muted); font-size: 0.85rem; }

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 1rem var(--face);
}
input:focus-visible { border-color: var(--accent); outline-offset: 0; }

.stack { display: grid; gap: 1rem; }
.panel > p + .stack,
.panel > .notice + .stack { margin-top: 1.25rem; }
.panel > p + .notice { margin-top: 1rem; }
.stack.narrow { max-width: 24rem; }

.notice {
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
}
.notice.error { background: var(--danger-tint); color: var(--danger); }
.notice.success { background: var(--live-tint); color: var(--live); }
.notice.info { background: var(--accent-tint); color: var(--ink); }

/* ---- Sign-in ---- */

.sign-in-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1.5rem;
  background-image: radial-gradient(
    60rem 26rem at 50% -8rem,
    var(--accent-tint),
    transparent 70%
  );
}
.sign-in {
  width: 100%;
  max-width: 24rem;
}
.sign-in .wordmark { margin-bottom: 1.5rem; font-size: 1.4rem; }
.sign-in .panel { padding: 1.75rem; }
.sign-in h1 { margin-bottom: 1.25rem; font-size: 1.5rem; }
.sign-in button { width: 100%; margin-top: 0.5rem; }
.sign-in .after {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- Overview ---- */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.figure {
  padding: 1.1rem 1.25rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.figure dt { color: var(--muted); font-size: 0.9rem; }
.figure dd {
  margin: 0.2rem 0 0;
  font-family: var(--display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--canvas);
}
.segmented a,
.segmented strong {
  padding: 0.3rem 0.8rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
}
.segmented a { color: var(--muted); }
.segmented a:hover { color: var(--ink); }
.segmented strong {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(22, 24, 29, .10);
}

.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.5rem;
}
.weekly-chart-panel h3 { font-size: 0.95rem; }
.weekly-chart-summary {
  margin: 0.2rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
}
.weekly-chart {
  display: block;
  width: 100%;
  height: 9rem;
  border-bottom: 1px solid var(--line);
}
.weekly-bar { fill: var(--accent); }
.weekly-chart-detail { margin-top: 0.6rem; font-size: 0.875rem; }
.weekly-chart-detail summary { color: var(--muted); cursor: pointer; }
.weekly-chart-detail table { margin-top: 0.5rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
thead th {
  color: var(--muted);
  font-size: 0.825rem;
  font-weight: 600;
}
tbody th { font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
td.number, th.number,
.counts tbody td:last-child { text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 -0.75rem; }

.empty {
  padding: 2rem 1rem;
  color: var(--muted);
  text-align: center;
}

/* ---- API page ---- */

.endpoint {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  font-family: var(--code);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}
.method {
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  background: var(--accent-tint);
  color: var(--accent);
  font-weight: 600;
}

.slip {
  position: relative;
  margin: 0.75rem 0 0;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  background: var(--slip);
  color: var(--slip-ink);
  font: 0.85rem/1.6 var(--code);
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
}
.slip-caption {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.6rem 1.5rem;
  margin: 0;
}
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts code,
.prose code {
  padding: 0.05rem 0.35rem;
  border-radius: 5px;
  background: var(--canvas);
  font: 0.875em var(--code);
}
.prose p + p,
.prose p + ul,
.prose ul + p { margin-top: 0.75rem; }
.prose ul { margin: 0; padding-left: 1.2rem; }
.prose li + li { margin-top: 0.35rem; }

td.status {
  width: 4.5rem;
  font: 600 0.9rem var(--code);
}

/* ---- Account ---- */

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pill.live { background: var(--live-tint); color: var(--live); }
.pill.revoked { background: var(--canvas); color: var(--muted); }

.minted {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  background: var(--slip);
  color: var(--slip-ink);
}
.minted h2 { color: var(--slip-ink); }
.minted p { margin-top: 0.35rem; color: var(--slip-muted); }
.minted code {
  display: block;
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--slip-muted);
  border-radius: 8px;
  font: 600 1rem/1.4 var(--code);
  overflow-wrap: anywhere;
  user-select: all;
}

.row-form { display: inline; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
