/* The firm pages, and the base the staff pages build on. Colour, type and
   spacing come ONLY from /brand/tokens.css and /brand/fonts.css variables,
   laid out the way leverance.ai is: a header with the full lockup, a deep
   prussian heading band, content on ivory in white panels with hairline
   borders, and a deep prussian footer with the reversed lockup. */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: var(--step-4);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--step-2);
  margin-top: 2rem;
}

h3 {
  font-size: var(--step-1);
  margin-top: 2rem;
}

a {
  color: var(--accent);
}

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

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--ivory);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

/* ---------- header, heading band and footer ---------- */

/* Content and chrome share one column edge, as on leverance.ai. */
:root {
  --gutter: max(1rem, calc((100% - var(--container)) / 2 + 1.5rem));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  min-height: var(--header-h);
  padding: 0.6rem var(--gutter);
  background: var(--ivory);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: inline-flex;
  align-items: center;
}

.lockup {
  display: block;
  height: 2.25rem;
  width: auto;
}

.topbar-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule-strong);
}

.topbar-label:empty {
  display: none;
}

.topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  margin-left: auto;
  font-size: 0.92rem;
}

.topnav a {
  color: var(--text-soft);
  text-decoration: none;
}

.topnav a:hover {
  color: var(--accent);
}

.who {
  color: var(--text-faint);
  font-size: 0.85rem;
}

.topnav .link-button {
  font-size: 0.85rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}

.topnav .link-button:hover {
  background: var(--accent);
  color: var(--on-accent);
}

.inline-confirm {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--rule);
}

.inline-confirm[hidden] {
  display: none;
}

.inline-confirm p {
  margin: 0;
  flex-basis: 100%;
}

.page-head {
  background: var(--bg-deep);
  color: var(--text-on-deep);
  padding: var(--space-xl) var(--gutter) var(--space-l);
}

.page-head[hidden] {
  display: none;
}

.page-head-inner {
  max-width: 52rem;
}

.page-head h1 {
  color: var(--text-on-deep);
  margin: 0 0 0.6rem;
}

.page-head .eyebrow {
  color: var(--text-on-deep-soft);
  margin-bottom: 0.9rem;
}

.page-head .eyebrow a {
  color: var(--text-on-deep-soft);
}

.page-head .lede,
.page-head .firm-meta {
  color: var(--text-on-deep-soft);
  max-width: var(--measure);
  margin: 0;
}

.page-head .lede {
  font-size: var(--step-1);
  line-height: 1.5;
}

/* The reversed lockup carries its own --prussian ground (a byte copy of the
   site's file), so the footer is that colour and the lockup sits flush. */
.foot {
  background: var(--bg-deep-raised);
  color: var(--text-on-deep-soft);
  padding: var(--space-l) var(--gutter);
  font-size: 0.85rem;
  margin-top: var(--space-2xl);
}

.foot-inner {
  display: grid;
  gap: 1rem;
  max-width: calc(var(--container) - 3rem);
}

.foot-lockup {
  display: block;
  height: 2.5rem;
  width: auto;
  margin-left: -0.35rem;
}

.foot p {
  margin: 0;
  max-width: 45rem;
}

.foot a {
  color: var(--text-on-deep);
  margin-right: 1.5rem;
  text-decoration: none;
}

.foot a:hover {
  text-decoration: underline;
}

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

.page {
  flex: 1;
  width: 100%;
  padding: var(--space-l) var(--gutter) 0;
}

/* The page uses the site's container width; reading and form content
   keeps a comfortable measure inside it. */
.page > * {
  max-width: calc(var(--container) - 3rem);
}

.page > .step,
.page > .invite,
.page > .code-form,
.page > .user-list,
.page > .member-list,
.page > .notice,
.page > .note,
.page > .lede,
.page > h2 {
  max-width: 52rem;
}

.page:focus {
  outline: none;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 0.5rem;
}

.lede {
  font-size: 1.05rem;
  color: var(--text-soft);
  margin: 0 0 1.5rem;
}

.note {
  color: var(--text-soft);
  font-size: 0.95rem;
}

.notice {
  background: var(--wash);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.notice:empty {
  display: none;
}

.loading {
  color: var(--text-soft);
}

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

.btn {
  display: inline-block;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

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

.btn-secondary {
  background: var(--white);
  color: var(--accent);
}

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

.btn-danger {
  background: var(--white);
  color: var(--flag);
  border-color: var(--flag);
}

.btn-danger:not([disabled]):hover {
  background: var(--flag);
  color: var(--white);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}

.link-button {
  font: inherit;
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.step-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  margin-top: 2.25rem;
}

.step-nav .save-later {
  margin: 0;
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
}

.step-nav .save-later .btn {
  border-color: transparent;
  background: none;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 400;
}

.step-nav .save-later-msg {
  flex-basis: 100%;
}

.step-nav .save-later-msg:empty {
  display: none;
}

.save-later {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-top: 1.5rem;
}

.save-later-msg {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* ---------- fields ---------- */

/* ---------- an area's step: the steps beside, the questions in a panel ---------- */

.area-layout {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

.page > .area-layout {
  max-width: calc(var(--container) - 3rem);
}

@media (min-width: 64rem) {
  .area-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 2rem;
  }

  .step-aside {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
  }
}

.step-aside {
  font-size: 0.9rem;
}

.step-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border-left: 1px solid var(--rule-strong);
}

.step-list a {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  align-items: baseline;
  padding: 0.45rem 0 0.45rem 0.9rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-soft);
  text-decoration: none;
  line-height: 1.35;
}

.step-list a:hover {
  color: var(--accent);
}

.step-list .current a {
  border-left-color: var(--accent);
  color: var(--ink);
  font-weight: 500;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.step-aside-back {
  font-size: 0.85rem;
}

@media (max-width: 63.99rem) {
  /* On narrow screens the eyebrow already says "step N of M". */
  .step-aside {
    display: none;
  }
}

/* A step's questions sit in one white panel. */
.step {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-l) var(--space-l) var(--space-m);
  max-width: 50rem;
}

.step > :first-child {
  margin-top: 0;
}

.step-intro {
  margin: 0 0 0.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--rule);
  white-space: pre-line;
}

.field {
  margin: 1.75rem 0 0;
}

.field:first-child {
  margin-top: 0.5rem;
}

.field-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  line-height: 1.45;
}

textarea,
input[type="text"],
input[type="email"],
input[type="password"] {
  display: block;
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--white);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  transition: border-color var(--dur-fast) var(--ease);
}

input[type="text"],
input[type="email"],
input[type="password"] {
  max-width: 32rem;
}

textarea:hover,
input:hover {
  border-color: var(--rule-input);
}

textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: 1.55;
}

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

.save-status {
  display: block;
  min-height: 1.4em;
  margin-top: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-soft);
}

.save-status[data-kind="retrying"],
.save-status[data-kind="failed"] {
  color: var(--flag);
}

/* ---------- area picker ---------- */

.area-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

@media (min-width: 48rem) {
  .area-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 68rem) {
  .area-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.area-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 1rem;
  height: 100%;
  padding: 1.25rem 1.35rem 1.35rem;
  color: var(--text);
  text-decoration: none;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur) var(--ease);
}

.area-row:hover {
  border-color: var(--rule-strong);
  border-top-color: var(--accent-hover);
  box-shadow: 0 6px 18px -12px rgba(14, 40, 67, 0.35);
}

.area-row:hover .area-title {
  color: var(--accent);
}

.area-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  line-height: 1.25;
  grid-column: 1;
}

.area-meta {
  grid-column: 1;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.area-go {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 500;
}

.area-go::after {
  content: " \2192";
}

.area-bar {
  grid-column: 1 / -1;
  display: block;
  height: 4px;
  margin-top: 0.5rem;
  background: var(--vellum);
  border-radius: 2px;
  overflow: hidden;
}

.area-bar-fill {
  display: block;
  height: 100%;
  background: var(--accent);
}

/* ---------- repeat entries ---------- */

.entry {
  margin: 1.75rem 0 0;
  padding: 1rem 1.25rem 1.25rem;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--ivory);
  min-width: 0;
}

.entry legend {
  font-family: var(--font-display);
  font-size: 1.1rem;
  padding: 0;
}

/* ---------- KPI grid ---------- */

.kpi-grid {
  margin: 1.5rem 0 0.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}

.kpi-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  padding: 0.6rem 0.25rem;
  border-bottom: 1px solid var(--rule);
}

.kpi-row.current {
  background: var(--wash);
  box-shadow: inset 3px 0 0 var(--accent);
}

.kpi-row > a {
  flex-basis: 100%;
  font-weight: 500;
}

.kpi-head {
  display: none;
}

.kpi-cell {
  color: var(--text-soft);
}

.kpi-cell.done {
  color: var(--text);
}

.kpi-cell-label::after {
  content: ": ";
}

@media (min-width: 48rem) {
  .kpi-row {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr);
    flex-wrap: nowrap;
  }

  .kpi-head {
    display: grid;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-soft);
  }

  .kpi-cell-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

/* ---------- team ---------- */

.member-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0 1.25rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.member-list > :last-child {
  border-bottom: 0;
}

.member {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.9rem 0.25rem;
  border-bottom: 1px solid var(--rule);
}

.member-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.member-meta {
  font-size: 0.85rem;
  color: var(--text-soft);
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.confirm-q {
  flex-basis: 100%;
}

.invite {
  margin-top: 2rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-m) var(--space-l) var(--space-l);
}

.invite > h2:first-child {
  margin-top: 0;
}

/* ---------- local sign-in ---------- */

.user-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0 1.25rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.user-list li:last-child .user-choice {
  border-bottom: 0;
}

.user-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--rule);
  padding: 0.9rem 0.25rem;
  cursor: pointer;
  color: var(--text);
}

.user-choice:hover .user-name {
  color: var(--accent);
}

.user-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
}

.user-meta {
  font-size: 0.85rem;
  color: var(--text-soft);
}

/* ---------- conflict and expired session ---------- */

.conflict {
  margin-top: 0.75rem;
  padding: 0.75rem 0 0.25rem 1rem;
  border-left: 2px solid var(--flag);
}

.conflict[hidden] {
  display: none;
}

.conflict p {
  margin: 0 0 0.75rem;
}

.other-version {
  background: var(--vellum);
  color: var(--text-soft);
}

.banner {
  padding: 1rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid var(--flag);
  background: var(--white);
}

.banner[hidden] {
  display: none;
}

.banner p {
  max-width: 45rem;
  margin: 0 auto 0.5rem;
}

/* ---------- sign-in ---------- */

.signin-card {
  max-width: 30rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-m) var(--space-l) var(--space-l);
}

.page > .signin-card {
  max-width: 30rem;
}

.signin-card form {
  display: grid;
  gap: 0.6rem;
}

.signin-card form[hidden] {
  display: none;
}

.signin-card .btn-primary {
  justify-self: start;
  margin-top: 0.4rem;
}

.signin-card .link-button {
  justify-self: start;
  font-size: 0.9rem;
}

.signin-card .user-list {
  padding: 0;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
}

.signin-sent {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--wash);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.action-msg {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.action-msg:empty {
  display: none;
}

.action-msg[data-kind="error"] {
  color: var(--flag);
  border-left: 2px solid var(--flag);
  padding-left: 0.6rem;
}

.code-form {
  display: grid;
  gap: 0.4rem;
  max-width: 32rem;
  margin-top: 1rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: var(--space-m) var(--space-l) var(--space-l);
}

.code-form button {
  justify-self: start;
  margin-top: 0.4rem;
}

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

@media (max-width: 40rem) {
  .lockup {
    height: 1.8rem;
  }

  .topbar-label {
    padding-left: 0.75rem;
  }

  .step,
  .invite,
  /* ---------- sign-in ---------- */

.signin-card {
  max-width: 30rem;
  background: var(--white);
  border: 1px solid var(--rule);
  border-top: 2px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-m) var(--space-l) var(--space-l);
}

.page > .signin-card {
  max-width: 30rem;
}

.signin-card form {
  display: grid;
  gap: 0.6rem;
}

.signin-card form[hidden] {
  display: none;
}

.signin-card .btn-primary {
  justify-self: start;
  margin-top: 0.4rem;
}

.signin-card .link-button {
  justify-self: start;
  font-size: 0.9rem;
}

.signin-card .user-list {
  padding: 0;
  border: 0;
  border-top: 1px solid var(--rule);
  border-radius: 0;
}

.signin-sent {
  margin: 0 0 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--wash);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.action-msg {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

.action-msg:empty {
  display: none;
}

.action-msg[data-kind="error"] {
  color: var(--flag);
  border-left: 2px solid var(--flag);
  padding-left: 0.6rem;
}

.code-form {
    padding: 1rem;
  }
}
