/* HENUSSE client portal. Tokens and rules: docs/design/portal/graphic-direction.md.
   Surfaces are told apart by tone and space; the only edges are the 2px edge of a
   form field and the 3px focus ring. tests/portal/test_portal_visual_tells.py checks it. */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("/static/fonts/HankenGrotesk-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/Fraunces-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #faf7f2;
  --surface: #fffdfa;
  --sunk: #f2ede4;
  --ink: #1d1a16;
  --ink-muted: #6f675c;
  --field-edge: #8a8174;
  --brand-red: #c31b1b;
  --error: #9a1313;
  --error-tint: #f8e5e2;
  --neutral-tint: #f2ede4;
  --primary-hover: #36312a;
  --primary-pressed: #0f0d0b;
  --secondary-hover: #e9e2d6;
  --bleu: #3f5f86;
  --mousse: #3f6b3f;
  --violet: #5a4f86;
  --prune: #7a3f6b;
  --sarcelle: #1f6b6b;
  --brique: #a2462a;
  --text: "Hanken Grotesk", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --float: 0 8px 24px rgba(29, 26, 22, .12), 0 1px 3px rgba(29, 26, 22, .10);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 15px;
  line-height: 22px;
  font-weight: 400;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 3px;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -64px;
  padding: 8px 12px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
}

.skip:focus {
  top: 8px;
}

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

/* --- app bar ---------------------------------------------------------------------- */

.appbar {
  background: var(--paper);
}

.appbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.wordmark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  line-height: 24px;
  color: var(--brand-red);
  text-decoration: none;
  letter-spacing: 0;
}

.space-name {
  font-weight: 600;
  font-size: 15px;
}

.nav {
  display: flex;
  gap: 20px;
  margin-left: 16px;
}

.nav a {
  color: var(--ink-muted);
  font-weight: 500;
  text-decoration: none;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.member-menu {
  margin-left: auto;
  position: relative;
}

.member-menu summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  justify-content: center;
  border-radius: 6px;
}

.member-menu summary::-webkit-details-marker {
  display: none;
}

.menu-panel {
  position: absolute;
  right: 0;
  top: 48px;
  z-index: 10;
  min-width: 240px;
  padding: 8px;
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--float);
  display: flex;
  flex-direction: column;
}

.menu-panel a,
.menu-panel button {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--sunk);
}

.menu-name {
  padding: 8px 12px 12px;
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 18px;
}

.disc {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 12px;
  line-height: 12px;
  font-weight: 600;
  flex: none;
}

.disc.small {
  width: 24px;
  height: 24px;
}

.disc.bleu { background: var(--bleu); }
.disc.mousse { background: var(--mousse); }
.disc.violet { background: var(--violet); }
.disc.prune { background: var(--prune); }
.disc.sarcelle { background: var(--sarcelle); }
.disc.brique { background: var(--brique); }
.disc.theo,
.disc.atelier_released { background: var(--ink); }
.disc.system { background: var(--neutral-tint); color: var(--ink-muted); }

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

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 48px 32px 96px;
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(0, 400px);
  gap: 48px 64px;
  align-items: start;
}

.columns.narrow {
  grid-template-columns: minmax(0, 600px) minmax(0, 400px);
}

.stack > * + * {
  margin-top: 32px;
}

.title {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: 560;
  font-size: 32px;
  line-height: 40px;
}

.lead {
  font-size: 17px;
  line-height: 26px;
  margin-top: 12px;
  max-width: 34em;
}

.push {
  margin-top: 32px;
}

.push-small {
  margin-top: 16px;
}

.flow > * + * {
  margin-top: 16px;
}

.flow > input[type="hidden"] + * {
  margin-top: 0;
}

.lead + .meta {
  margin-top: 8px;
}

.muted {
  color: var(--ink-muted);
}

.meta {
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  color: var(--ink-muted);
}

.section-title {
  font-weight: 600;
  font-size: 21px;
  line-height: 28px;
}

.section-title + * {
  margin-top: 12px;
}

.greeting {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-bottom: 40px;
}

.panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 32px;
}

.panel.tight {
  padding: 24px;
}

.well {
  background: var(--sunk);
  border-radius: 6px;
  padding: 16px 20px;
}

.plain-list {
  list-style: none;
  padding: 0;
}

.plain-list li + li {
  margin-top: 16px;
}

.empty {
  font-size: 17px;
  line-height: 26px;
}

/* --- forms ------------------------------------------------------------------------ */

.field label,
.label {
  display: block;
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
}

.help {
  display: block;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
  margin-top: 2px;
}

input[type="email"],
input[type="text"] {
  display: block;
  width: 100%;
  height: 44px;
  margin-top: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--sunk);
  border: 2px solid var(--field-edge);
  border-radius: 6px;
}

input[type="email"]:focus,
input[type="text"]:focus {
  border-color: var(--ink);
}

input[aria-invalid="true"] {
  border-color: var(--error);
}

input.code {
  max-width: 220px;
  font-size: 21px;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 0 12px;
  align-items: start;
}

.check input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin: 0;
  background: var(--sunk);
  border: 2px solid var(--field-edge);
  border-radius: 6px;
  cursor: pointer;
}

.check input:checked {
  background: var(--ink) url("/static/check.svg") center / 16px 16px no-repeat;
  border-color: var(--ink);
}

.check .help {
  grid-column: 2;
}

.error-text {
  color: var(--error);
  font-weight: 500;
  margin-top: 8px;
}

.status-line {
  background: var(--neutral-tint);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 24px;
}

.status-line.error {
  background: var(--error-tint);
  color: var(--error);
}

/* --- buttons ---------------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}

.button.primary {
  background: var(--ink);
  color: var(--paper);
}

.button.primary:hover {
  background: var(--primary-hover);
}

.button.primary:active {
  background: var(--primary-pressed);
}

.button.secondary {
  background: var(--sunk);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--secondary-hover);
}

.button.quiet {
  background: none;
  color: var(--ink);
  padding: 0 4px;
}

.button.quiet:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* --- journal rows and devices ------------------------------------------------------ */

.day {
  font-weight: 600;
  font-size: 15px;
  line-height: 22px;
  margin-top: 24px;
}

.day:first-of-type {
  margin-top: 0;
}

.row {
  display: grid;
  grid-template-columns: 56px 24px 1fr;
  gap: 12px;
  align-items: start;
  margin-top: 12px;
}

.row .meta {
  padding-top: 2px;
}

.label-neutral {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--neutral-tint);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 600;
}

.device + .device {
  margin-top: 12px;
}

.device {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
}

.device-name {
  font-weight: 600;
  font-size: 17px;
  line-height: 26px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

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

@media (max-width: 759px) {
  .appbar-inner {
    height: 48px;
    padding: 0 16px;
    gap: 12px;
  }

  .nav {
    display: none;
  }

  .page {
    padding: 32px 16px 64px;
  }

  .columns,
  .columns.narrow {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .title {
    font-size: 26px;
    line-height: 32px;
  }

  .panel {
    padding: 24px 20px;
  }

  .button {
    width: 100%;
  }

  .button.quiet {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0ms !important;
  }
}

/* Workflow surfaces retain the portal's reading measure and quiet tones. */
textarea, select {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: var(--sunk);
  border: 2px solid var(--field-edge);
  border-radius: 6px;
}
textarea { resize: vertical; min-height: 88px; }
.review-layout { display: grid; grid-template-columns: minmax(0, 760px) minmax(0, 340px); gap: 40px; }
.reading { font-size: 17px; line-height: 28px; }
.review-unit + .review-unit { margin-top: 24px; }
.annotation { margin-top: 8px; font-size: 13px; line-height: 20px; }
blockquote { margin: 0; font-size: 15px; line-height: 24px; color: var(--ink-muted); }
.post-text { white-space: pre-wrap; }
.metrics { display: flex; flex-wrap: wrap; gap: 48px; }
.metrics strong { display: block; font-size: 32px; line-height: 44px; font-weight: 600; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th { background: var(--sunk); font-weight: 600; }
th, td { padding: 12px; text-align: left; vertical-align: top; }
td small { display: block; }
.workflow-nav { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 12px 32px; max-width: 1240px; margin: 0 auto; }
.workflow-nav a { min-height: 32px; }
@media (max-width: 760px) {
  .review-layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .workflow-nav { padding: 8px 20px; gap: 4px 16px; }
  .reading .panel { padding: 20px; }
  .nav { display: none; }
}

.post-image { max-width: 100%; height: auto; border-radius: 6px; }


[hidden] { display: none !important; }
.selection-action { position: fixed; z-index: 10; width: auto; min-height: 40px;
  box-shadow: 0 8px 24px rgba(29, 26, 22, .12), 0 1px 3px rgba(29, 26, 22, .10); }
.comment-form { padding: 16px; background: var(--sunk); border-radius: 6px; }
.unit-text[tabindex] { cursor: text; }
.numbers-dashboard { max-width: 1050px; }
.metrics > div { flex: 1 1 220px; }
.metrics .meta { max-width: 32ch; }
.question-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 40px; align-items: center; }
.question-table { table-layout: fixed; }
.question-table th, .question-table td { padding: 12px 8px; font-size: 15px; line-height: 22px; overflow-wrap: anywhere; }
.question-table thead th { vertical-align: bottom; }
.question-table th:first-child { width: 29%; text-align: left; }
.question-table th, .question-table td { text-align: right; }
.question-table small { display: block; font-weight: 400; }
.question-table tbody th { background: transparent; font-weight: 400; }
.question-table tbody tr:nth-child(even) { background: var(--sunk); }
.citation-trend { margin: 0; min-width: 0; }
.citation-trend svg { width: 100%; display: block; overflow: visible; }
.citation-trend polyline { fill: none; stroke: var(--ink-muted); stroke-width: 3; stroke-linejoin: round; }
.citation-trend circle { fill: var(--ink-muted); }
.citation-trend text { fill: var(--ink); font: 14px 'Hanken Grotesk', sans-serif; }
.trend-dates { display: flex; justify-content: space-between; gap: 16px; }
.report-analysis { max-width: 70ch; white-space: pre-line; }
.reading-sources summary, .report-history summary { cursor: pointer; min-height: 44px; }
@media (max-width: 760px) {
  .question-grid { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .metrics { gap: 24px; }
  .metrics > div { flex-basis: 140px; }
  .citation-trend { max-width: 420px; }
}

/* Next action first: a six-step status line, the decision, copy-ready posts, guided forms. */
.stages { display: flex; flex-wrap: wrap; gap: 4px 6px; padding: 0; list-style: none; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink-muted); }
.stages li { padding: 3px 8px; border-radius: 6px; }
.stages li.done { color: var(--ink); }
.stages li[aria-current="step"] { background: var(--ink); color: var(--paper); font-weight: 600; }
.article-head > * + * { margin-top: 12px; }
.deadline { font-weight: 600; font-size: 17px; line-height: 26px; }
.request-changes > summary { list-style: none; width: auto; }
.request-changes > summary::-webkit-details-marker { display: none; }
.other-language > summary, details.well > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.hint-title { font-size: 15px; line-height: 22px; font-weight: 600; }
.post-card { background: var(--paper); border-radius: 10px; padding: 20px; font-size: 15px; line-height: 22px; }
.post-card + .post-card { margin-top: 16px; }
.post-author { display: flex; align-items: center; gap: 8px; }
.post-card .post-image { width: 100%; }
.copy-status { font-size: 13px; line-height: 18px; font-weight: 600; }
.copy-status:empty { display: none; }
.pre-line { white-space: pre-line; }
.file-picker { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 8px; }
.file-picker input:focus-visible + label { outline: 3px solid var(--ink); outline-offset: 2px; }
.workflow-nav a[aria-current="page"] { text-decoration-thickness: 3px; font-weight: 600; }
@media (max-width: 759px) {
  .file-picker .button { width: auto; }
  .page .decision { padding: 20px; }
}

/* The client's next step and its date, on every item and in a month of dated steps. */
.next-step { font-size: 15px; line-height: 22px; }
.next-step strong { font-weight: 600; }
.next-step.us strong { color: var(--ink-muted); }
.next-due { display: flex; flex-direction: column; gap: 2px; margin-bottom: 32px; padding: 16px 20px; border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; }
.next-due strong { font-family: var(--display); font-size: 20px; line-height: 28px; font-weight: 500; }
a.next-due:hover strong { text-decoration: underline; }
.month-head { display: flex; align-items: center; justify-content: space-between; }
.month-head a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-size: 22px; text-decoration: none; color: var(--ink); }
.month-head h3 { font-size: 17px; line-height: 24px; font-weight: 600; }
table.month { width: 100%; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 13px; }
table.month th { font-weight: 500; color: var(--ink-muted); padding: 4px 2px; }
table.month td { vertical-align: top; height: 44px; padding: 2px 4px; background: var(--paper); border-radius: 4px; }
table.month td.outside { background: transparent; }
table.month td.outside .day-number { color: var(--field-edge); }
table.month td[aria-current="date"] .day-number { background: var(--ink); color: var(--paper); border-radius: 50%; }
.day-number { display: inline-flex; justify-content: center; width: 24px; line-height: 24px; }
a.dot { display: inline-block; width: 10px; height: 10px; margin: 1px; border-radius: 50%; background: var(--field-edge); vertical-align: middle; }
a.dot.you { background: var(--ink); }
a.dot.next { width: 16px; height: 16px; background: var(--ink); }
.agenda-list li + li { margin-top: 4px; }
.agenda-list a { display: block; padding: 8px 10px; color: var(--ink); text-decoration: none; font-size: 15px; line-height: 22px; border-radius: 6px; }
.agenda-list a:hover .agenda-title { text-decoration: underline; }
.agenda-list .who { font-weight: 600; }
.agenda-list .us .who { color: var(--ink-muted); }
.agenda-list .next a { background: var(--sunk); font-weight: 600; }
.agenda-title { display: block; color: var(--ink-muted); font-size: 13px; line-height: 18px; font-weight: 400; }

/* A '?' explains on hover with a mouse, on tap on a phone and on keyboard focus; an unavailable action says why. */
.why { position: relative; display: inline-block; vertical-align: middle; }
.why-toggle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--sunk); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.why-toggle::after { content: ""; position: absolute; inset: -8px; }
.well .why-toggle { background: var(--surface); }
.why-text { display: none; position: absolute; z-index: 20; top: calc(100% + 8px); left: calc(50% + var(--shift, 0px)); transform: translateX(-50%); width: max-content; max-width: min(340px, calc(100vw - 32px)); padding: 12px 16px; background: var(--ink); color: var(--paper); border-radius: 6px; font-size: 15px; line-height: 22px; font-weight: 400; text-align: left; white-space: normal; }
.why.open .why-text, .why-toggle:focus-visible + .why-text { display: block; }
.why.open .why-toggle, .why-toggle:focus-visible { background: var(--ink); color: var(--paper); }
@media (hover: hover) {
  .why:hover .why-text { display: block; }
}
.unavailable { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.unavailable .button[disabled] { cursor: not-allowed; background: var(--sunk); color: var(--ink-muted); }
.unavailable .reason { font-size: 15px; line-height: 22px; color: var(--ink); }
