/* portal.css — single stylesheet for the Equistamp contractor portal.
   Consolidates the CSS that used to live inline across index.html, faq.html
   and login.html. The :root tokens + base rules are shared; section-specific
   blocks (tables/pills/filters from the portal, TOC/.qa/.note from the FAQ,
   .hero from login) follow. */

:root {
  --ink:        #1a1a1a;
  --ink-soft:   #555;
  --ink-faint:  #6b6b6b;
  --rule:       #e6e6e6;
  --bg:         #ffffff;
  --bg-soft:    #fafafa;
  --link:       #1d4ed8;
  --good:       #166534;
  --warn:       #92400e;
  --bad:        #991b1b;
  --serif:      "Source Serif 4", Georgia, serif;
  --sans:       "Figtree", -apple-system, BlinkMacSystemFont, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 17px/1.55 var(--sans); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout shell — shared top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 2rem; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.topbar-right { display: flex; align-items: center; gap: 1.5rem; }
.brand { font: 400 1.4rem/1 var(--serif); letter-spacing: .005em; }
.brand a { color: var(--ink); }
.brand a:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 1.25rem; font-size: .95rem; }
.topnav a { color: var(--ink-soft); }
.topnav a.active { color: var(--ink); font-weight: 500; }
.who { display: flex; align-items: center; gap: .75rem; color: var(--ink-soft); font-size: .95rem; }
main { max-width: 1080px; margin: 0 auto; padding: 2.5rem 2rem 6rem; }

/* Headings */
h1.serif { font: 400 2.5rem/1.15 var(--serif); margin: 0 0 1rem; }
h1.app-h1 { font-size: 2rem; margin: 0 0 2rem; outline: none; }
h2.section { font: 400 1.6rem/1.2 var(--serif); margin: 2.5rem 0 1rem; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
h2.section .tools { display: flex; gap: .5rem; font: 400 .9rem/1 var(--sans); }
h2.section .section-total { font: 400 .9rem/1 var(--sans); color: var(--ink-soft); }
h2.section .section-total strong { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.section-rule { height: 1px; background: var(--rule); margin: 0 0 1.25rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .65rem 1.1rem; border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: 500 .95rem/1 var(--sans); border-radius: 2px; cursor: pointer;
  transition: background .15s, color .15s, opacity .15s;
}
.btn:hover { background: #000; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink); }
.btn.secondary { background: transparent; color: var(--ink); }
.btn.secondary:hover { background: var(--bg-soft); }
.btn.secondary:disabled:hover { background: transparent; }
.btn.small { padding: .55rem .85rem; font-size: .85rem; }

/* Cards & data display */
.card {
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 6px;
  padding: 1.5rem 1.75rem;
}
.card.table-card {
  padding: 0; overflow-x: auto; scrollbar-width: thin;
  /* Scroll-shadow technique: faint inner shadows on left/right hint that
     there's content to scroll to, and fade away as you reach each edge. */
  background:
    linear-gradient(to right, var(--bg-soft) 30%, rgba(250,250,250,0)),
    linear-gradient(to right, rgba(250,250,250,0), var(--bg-soft) 70%) 100% 0,
    radial-gradient(farthest-side at 0    50%, rgba(0,0,0,.08), rgba(0,0,0,0)),
    radial-gradient(farthest-side at 100% 50%, rgba(0,0,0,.08), rgba(0,0,0,0)) 100% 0;
  background-repeat: no-repeat;
  background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
  background-attachment: local, local, scroll, scroll;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.1rem 2rem;
}
.field { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.field label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.field span, .field a { color: var(--ink); word-break: break-word; }
.field span.empty { color: var(--ink-faint); font-style: italic; }
.field.num span { font-variant-numeric: tabular-nums; }

/* Documents row */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem 2rem; }
.doc { display: flex; align-items: baseline; gap: .5rem; min-width: 0; }
.doc-label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); min-width: 7em; }
.doc-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-value.missing { color: var(--ink-faint); font-style: italic; }

/* Pill */
.pill {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  font-size: .8rem; line-height: 1.5; background: #eee; color: var(--ink-soft);
}
.pill.good { background: #dcfce7; color: var(--good); }
.pill.info { background: #dbeafe; color: #1e40af; }
.pill.warn { background: #fef3c7; color: var(--warn); }
.pill.bad  { background: #fee2e2; color: var(--bad);  }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: .65rem .9rem; text-align: left; border-bottom: 1px solid var(--rule); }
th { font-weight: 500; color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.date, td.status { white-space: nowrap; }
td.task { word-break: break-word; }
tbody tr:hover { background: var(--bg-soft); }

/* Issues table (/issues): fixed layout so the long Issue title gets a real
   column instead of being crushed to a 1-char ribbon. word-break:break-word
   would let the title's min-content shrink to nothing under auto layout, so
   the title wraps at word boundaries here (overflow-wrap handles the rare
   unbreakable token). min-width keeps columns sane on narrow screens — the
   .table-card's overflow-x then scrolls rather than crushing. */
/* The issues table has 7 columns, so it gets a wider page than the
   profile/payments default (1080px) to avoid cramping. */
main.issues-page { max-width: 1340px; }
.issues-table { table-layout: fixed; min-width: 720px; }
/* Title + repo wrap at any point (long unbroken tokens: "[CLEANUP]…",
   "EquiStamp/Management_Issues"). Client/milestone/type have natural spaces
   so they wrap normally — anywhere-breaking would split "EquiStamp Inc."
   mid-word. */
.issues-table td.task,
.issues-table td.repo { word-break: normal; overflow-wrap: anywhere; }
/* Let a long status label (e.g. "Ready for Action") wrap rather than clip. */
.issues-table td.status { white-space: normal; }
/* Forecast cell carries a hover breakdown (rate / hours / max / min). */
.issues-table td.forecast { cursor: help; }
tr.month-header td {
  background: #ececec;
  padding: 1rem 1rem .85rem;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}
tr.month-header:first-child td { border-top: none; }
.month-name {
  font: 600 1.05rem/1.2 var(--sans); color: var(--ink); margin-right: 1rem; font-variant-numeric: tabular-nums;
}
.month-stats {
  font-size: .85rem; color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
tfoot td { font-weight: 500; background: var(--bg-soft); }

/* Filters bar */
.filters {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem 1rem; align-items: end; margin-bottom: 1rem;
}
.filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
.filter-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: .5rem;
  grid-column: span 2; min-width: 0;
}
.filter-pair label { min-width: 0; }
.filters input, .filters select {
  font: inherit; padding: .5rem .6rem; border: 1px solid var(--rule); border-radius: 4px; background: #fff;
}
.filters .check {
  flex-direction: row; align-items: center; gap: .5rem;
  text-transform: none; letter-spacing: 0; color: var(--ink); font-size: .95rem;
  padding-top: 1.1rem;
}

.summary {
  color: var(--ink-soft); font-size: .95rem; margin: 0 0 .9rem;
}
.summary strong { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.summary .sum-sep { color: var(--ink-faint); margin: 0 .35rem; }
.summary .sum-total-line {
  display: block; font-variant-numeric: tabular-nums; padding-left: 0;
}
.summary .sum-total-line + .sum-total-line { margin-top: .15rem; }
.summary .sum-total-label {
  display: inline-block; min-width: 3.5em; color: var(--ink-faint);
  font-size: .85rem; text-transform: uppercase; letter-spacing: .04em;
}
.empty-row { text-align: center; padding: 2rem; color: var(--ink-faint); font-style: italic; }
.error { background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); padding: .75rem 1rem; border-radius: 4px; margin: 1rem 0; }
.muted { color: var(--ink-faint); font-size: .85rem; margin-top: -.5rem; }
.loading { color: var(--ink-faint); font-style: italic; padding: 2rem 0; text-align: center; }
.loading::before {
  content: ""; display: inline-block; width: 1em; height: 1em;
  border: 2px solid var(--rule); border-top-color: var(--ink-soft);
  border-radius: 50%; vertical-align: -0.18em; margin-right: .6em;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .loading::before { animation: none; border-top-color: var(--rule); }
}
.hidden { display: none !important; }

/* ── Onboarding page ───────────────────────────────────────────────────── */
.onboard-form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.5rem; }
.onboard-form .form-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem 1.5rem;
}
@media (max-width: 720px) { .onboard-form .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .onboard-form .form-grid { grid-template-columns: 1fr; } }
.onboard-form label {
  display: flex; flex-direction: column; gap: .3rem;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint);
}
.onboard-form .opt { text-transform: none; letter-spacing: 0; font-weight: 400; }
.onboard-form input, .onboard-form select, .onboard-form textarea {
  font: inherit; padding: .55rem .65rem; border: 1px solid var(--rule); border-radius: 4px;
  background: #fff; color: var(--ink); text-transform: none; letter-spacing: 0;
}
.onboard-form textarea {
  resize: vertical; min-height: 9rem;
  font: .9rem/1.5 ui-monospace, "SF Mono", Menlo, monospace;
}
.onboard-form .form-actions { display: flex; gap: .75rem; margin-top: .25rem; }
.ob-banner { padding: .8rem 1rem; border-radius: 4px; margin: 1.75rem 0 1rem; font-weight: 500; }
.ob-banner.good { background: #dcfce7; color: var(--good); border: 1px solid #bbf7d0; }
.ob-banner.bad  { background: #fef2f2; color: var(--bad);  border: 1px solid #fecaca; }
.ob-links { color: var(--ink-soft); font-size: .95rem; margin: 0 0 1rem; }
.ob-links code, .step-detail code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; }
.step-name { white-space: nowrap; }
.step-detail { color: var(--ink-soft); word-break: break-word; }
.step-row.failed td { background: #fef2f2; }
.step-row.failed .step-detail { color: var(--bad); }

/* ── FAQ page ──────────────────────────────────────────────────────────── */

/* Page grid: sticky TOC + content */
.wrap {
  max-width: 1080px; margin: 0 auto; padding: 2.5rem 2rem 6rem;
  display: grid; grid-template-columns: 220px 1fr; gap: 3rem; align-items: start;
}
.toc {
  position: sticky; top: 6rem; font-size: .92rem;
  max-height: calc(100vh - 8rem); overflow-y: auto; scrollbar-width: thin;
}
.toc h2 {
  font: 500 .78rem/1 var(--sans); text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-faint); margin: 0 0 .9rem;
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0 0 .55rem; }
.toc a { color: var(--ink-soft); display: block; line-height: 1.35; }
.toc a:hover { color: var(--ink); text-decoration: none; }

/* FAQ hero/lead */
.lead h1 { font: 400 2.6rem/1.15 var(--serif); margin: 0 0 .75rem; }
.lead p { color: var(--ink-soft); margin: 0 0 2rem; max-width: 60ch; }

/* FAQ sections */
section.faq { margin: 0 0 2.75rem; scroll-margin-top: 6rem; }
section.faq > h2 {
  font: 400 1.65rem/1.2 var(--serif); margin: 0 0 .25rem;
  display: flex; align-items: baseline; gap: .6rem;
}
section.faq > h2 .num {
  font: 500 .9rem/1 var(--sans); color: var(--ink-faint);
  font-variant-numeric: tabular-nums; flex: none;
}

/* Q&A */
.qa { margin: 0 0 1.5rem; }
.qa:last-child { margin-bottom: 0; }
.qa .q {
  font: 600 1.08rem/1.4 var(--serif); color: var(--ink); margin: 0 0 .4rem;
}
.qa .a { color: var(--ink-soft); margin: 0; }
.qa .a p { margin: 0 0 .65rem; }
.qa .a p:last-child { margin-bottom: 0; }
.qa .a strong { color: var(--ink); font-weight: 600; }
.qa .a ul, .qa .a ol { margin: .4rem 0 .65rem; padding-left: 1.4rem; }
.qa .a li { margin: 0 0 .3rem; }
.qa .a code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--bg-soft); border: 1px solid var(--rule); border-radius: 4px;
  padding: .08em .35em;
}

/* Callout for the ⚠️ "in progress" notes */
.note {
  display: flex; gap: .6rem; margin: .65rem 0 0;
  background: #fffbeb; border: 1px solid #fde68a; border-left: 3px solid #f59e0b;
  border-radius: 4px; padding: .7rem .9rem; font-size: .92rem; color: var(--warn);
}
.note .ico { flex: none; }
.note em { font-style: italic; }

footer {
  max-width: 1080px; margin: 0 auto; padding: 2rem 2rem 4rem;
  border-top: 1px solid var(--rule); color: var(--ink-faint); font-size: .9rem;
}

@media (max-width: 820px) {
  .wrap { grid-template-columns: 1fr; gap: 1.5rem; }
  .toc { position: static; max-height: none; border-bottom: 1px solid var(--rule); padding-bottom: 1.25rem; }
  .lead h1 { font-size: 2.1rem; }
}

/* ── Login page ────────────────────────────────────────────────────────── */
.hero { max-width: 560px; margin: 6rem auto; padding: 0 2rem; }
.hero p { color: var(--ink-soft); margin: 0 0 1rem; }
.hero .actions { margin-top: 2rem; }
.hero small { display: block; margin-top: 1rem; color: var(--ink-faint); font-size: .85rem; }

/* ── Consent page (OAuth authorization) — /consent ─────────────────────── */
main.consent { max-width: 560px; margin: 4rem auto; padding: 0 2rem; }
/* overflow-wrap: an attacker-controlled long unbroken client_name renders in
   the lead's <strong>; break it so it can't overflow the 560px column. */
main.consent .lead { color: var(--ink-soft); margin: 0 0 1.5rem; overflow-wrap: anywhere; }
/* Left accent echoes the stock yellow "check this" security cue, on-brand. */
main.consent .callback { margin: 0 0 1.25rem; border-left: 3px solid #fcd34d; }
main.consent .callback .label { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
main.consent .callback .url { margin-top: .35rem; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; color: var(--ink); word-break: break-all; }
main.consent details { margin: 0 0 1.5rem; }
main.consent summary { cursor: pointer; color: var(--ink-soft); font-size: .9rem; }
main.consent .kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 1rem 0 0; font-size: .9rem; }
main.consent .kv dt { color: var(--ink-faint); }
main.consent .kv dd { margin: 0; word-break: break-all; }
main.consent form.actions { display: flex; gap: .75rem; margin: 0 0 1.75rem; }
main.consent .why { color: var(--ink-faint); font-size: .85rem; line-height: 1.5; }

/* ── Review page ──────────────────────────────────────────────────────────── */
.review-card { margin-top: 1.5rem; border: 1px solid var(--rule); border-radius: 10px; padding: 1.25rem 1.4rem; background: var(--bg-soft); }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.review-head h2 { margin: 0; font-size: 1.5rem; }
.review-ctx { margin-top: .35rem; }
.review-discord { margin: .75rem 0 1.1rem; padding: .6rem .8rem; border: 1px dashed var(--rule); border-radius: 8px; font-style: italic; }
.q-row { border: 0; margin: 1rem 0 0; padding: 0; }
.q-text { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: .4rem; }
.q-opts { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1.2rem; }
.q-opt { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; }
.q-opt input { accent-color: var(--ink); }
.q-hint { font-size: .78rem; }
.dims-head { margin: 1.2rem 0 .6rem; font-size: 1rem; }
#show-dims-btn { margin-right: auto; }
.dims { display: flex; flex-direction: column; gap: .65rem; }
.dim-row { display: grid; grid-template-columns: 9rem 1fr 2.5rem minmax(0, 14rem); align-items: center; gap: .8rem; }
.dim-name { font-weight: 600; font-size: .9rem; }
.dim-slider { width: 100%; accent-color: var(--ink); }
.dim-val { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-soft); font-size: .9rem; }
.dim-note { padding: .4rem .55rem; border: 1px solid var(--rule); border-radius: 6px; font: inherit; font-size: .85rem; }
.anchors { margin-top: 1rem; font-size: .78rem; }
.review-actions { margin-top: 1.1rem; display: flex; justify-content: flex-end; }
.review-msg { margin-top: 1rem; padding: .6rem .85rem; border-radius: 6px; background: #fef2f2; color: var(--bad); border: 1px solid #fecaca; font-size: .88rem; }
.review-done { text-align: center; padding: 2rem 0; }
.review-done h2 { margin: 0 0 .35rem; }
.review-error { color: var(--bad); padding: 1.5rem 0; }
@media (max-width: 640px) {
  .dim-row { grid-template-columns: 1fr; gap: .25rem; }
  .dim-val { text-align: left; }
}

/* Review page — name/handle + submit busy state */
.review-who h2 { margin: 0; }
.review-handle { display: inline-block; margin-top: .1rem; font-size: .85rem; }
.btn.is-busy::before {
  content: ""; display: inline-block; width: .9em; height: .9em;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; vertical-align: -0.12em; margin-right: .5em;
  animation: spin .8s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .btn.is-busy::before { animation: none; } }
