:root {
  color-scheme: light;
  --navy: #102e55;
  --navy-deep: #0e2443;
  --ink: #132941;
  --muted: #526477;
  --line: #d9e1e9;
  --paper: #f4f6f9;
  --white: #fff;
  --orange: #f77e53;
  --purple: #6f287c;
  --good: #215743;
  --good-bg: #e6f5ed;
  --wait: #75451c;
  --wait-bg: #fff1df;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.5;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button, select, summary, input[type="file"], input[type="checkbox"] { cursor: pointer; }
a { color: var(--navy); text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--purple); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
small { font-size: .84rem; color: var(--muted); }
p, dd { overflow-wrap: anywhere; }
h1, h2 { color: var(--navy-deep); letter-spacing: -.027em; line-height: 1.12; }
h1 { font-size: clamp(1.95rem, 4vw, 2.8rem); font-weight: 750; }
h2 { font-size: 1.12rem; font-weight: 720; }
.skip { position: fixed; z-index: 2; top: .75rem; left: .75rem; padding: .7rem 1rem; background: var(--white); }
.skip:not(:focus) { clip-path: inset(50%); }

.mast { border-top: 4px solid var(--orange); background: var(--navy-deep); color: var(--white); }
.mast-inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 73px;
  max-width: 1600px;
  margin-inline: auto;
  padding: .75rem clamp(1rem, 3vw, 2.5rem);
}
.mast :focus-visible { outline-color: var(--orange); }
.brand { display: inline-flex; align-items: center; gap: .85rem; min-height: 44px; color: inherit; text-decoration: none; }
.brand strong { font-size: 1.35rem; letter-spacing: -.04em; white-space: nowrap; }
.brand span { border-left: 1px solid #64758c; padding-left: .85rem; color: #dce7f2; font-size: .9rem; }
.demo { margin-left: auto; color: #ffd8ca; font-size: .8rem; white-space: nowrap; }
.account { display: flex; align-items: center; gap: .9rem; }
.account > span { text-align: right; line-height: 1.3; font-size: .9rem; }
.account small { display: block; color: #c4d4e6; }
.signout {
  border: 1px solid #78889b;
  border-radius: 6px;
  color: inherit;
  background: transparent;
  min-height: 44px;
  padding: .35rem .7rem;
  white-space: nowrap;
}
.signout:hover { background: #253f60; }

.workspace {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  max-width: 1600px;
  min-height: calc(100dvh - 77px);
  margin-inline: auto;
}
.sidebar { background: #eaf0f6; border-right: 1px solid var(--line); padding: 2rem .9rem; }
.sidebar nav { display: grid; gap: .35rem; }
.sidebar a {
  display: flex;
  align-items: center;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .55rem .85rem;
  font-size: .92rem;
  font-weight: 660;
  text-decoration: none;
}
.sidebar a:hover { background: #e0e9f2; }
.sidebar a[aria-current="page"] { background: var(--white); box-shadow: inset 3px 0 var(--orange); border-color: var(--line); }
.workspace main { min-width: 0; padding: clamp(1.35rem, 4vw, 3rem); }
.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .85rem 1.25rem; margin-bottom: 1.6rem; }
.page-head > div:first-child { min-width: 0; }
.page-head p { margin-top: .55rem; color: var(--muted); }

.public-workspace { max-width: 1120px; margin-inline: auto; padding: clamp(1.25rem, 6vw, 4rem) clamp(1rem, 3vw, 2rem); }
.public-grid { display: grid; grid-template-columns: minmax(0, 1.27fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.public-primary, .public-side { padding: clamp(1.15rem, 3.5vw, 2.35rem); border-radius: var(--radius); }
.public-primary { border: 1px solid var(--line); background: var(--white); }
.public-side { background: var(--navy); color: #e1eaf5; }
.public-side h2 { color: var(--white); font-size: 1.34rem; margin-bottom: .75rem; }
.public-side p { max-width: 36ch; }
#request-reference { overflow-wrap: anywhere; }
.public-primary > .page-head { margin-bottom: 1.5rem; }
.public-primary > .notice { margin-bottom: 1.2rem; }
.public-side :focus-visible { outline-color: var(--orange); }
.auth-tabs { display: flex; gap: .3rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.auth-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem .65rem;
  border-bottom: 3px solid transparent;
  font-weight: 650;
  text-decoration: none;
}
.auth-tabs a[aria-current="page"] { border-color: var(--orange); }
.auth-tabs a:hover { background: var(--paper); }
.demo-accounts { list-style: none; margin: 1rem 0 0; padding: 0; }
.demo-accounts li { border-top: 1px solid #4b6384; }
.demo-accounts button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .65rem;
  text-align: left;
  padding: .45rem .3rem;
  width: 100%;
  min-height: 45px;
  background: transparent;
  border: 0;
  color: var(--white);
}
.demo-accounts button:hover { background: #28476c; }
.demo-accounts button small { display: inline; color: #ceddef; margin-left: .45rem; }
.access-steps { margin-bottom: 0; padding-left: 1.25rem; }
.access-steps li + li { margin-top: .6rem; }
#demo-code {
  display: block;
  width: fit-content;
  margin-top: 1.2rem;
  border-radius: 6px;
  padding: .45rem .75rem;
  font-size: 1.55rem;
  letter-spacing: .14em;
  background: #e1eaf5;
  color: var(--navy-deep);
}

.fields { display: grid; gap: 1rem; }
.fields > .button { justify-self: start; }
.field { display: grid; min-width: 0; gap: .35rem; font-weight: 650; }
.field > small { font-weight: 400; }
.field input, .field select, .field textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #98a7b7;
  border-radius: 6px;
  background: var(--white);
  padding: .5rem .6rem;
  font-weight: 450;
}
.field input::placeholder { color: var(--muted); }
.field input[type="file"] { padding: .4rem; }
.field textarea { resize: vertical; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.checkbox { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--navy); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: .52rem .85rem;
  background: var(--orange);
  color: var(--navy-deep);
  font-weight: 730;
  text-decoration: none;
  text-align: center;
  overflow-wrap: anywhere;
  transition: background-color 160ms, border-color 160ms;
}
.button:hover { background: #ff966f; }
.button.secondary { background: var(--white); border-color: #a5b2c1; }
.button.secondary:hover { background: #edf2f7; border-color: var(--navy); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.text-button, .receipt-link, .back { display: inline-flex; align-items: center; min-height: 44px; }
.text-button { border: 0; padding: 0; background: transparent; color: var(--navy); text-decoration: underline; }
.back { margin-bottom: .55rem; font-size: .92rem; font-weight: 650; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel { margin-top: 1.2rem; }
.panel-head { display: flex; gap: .7rem; justify-content: space-between; align-items: center; min-height: 62px; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); }
.panel-body, .empty { padding: 1.15rem 1.2rem; }
.empty, .muted { color: var(--muted); }
.form-panel { max-width: 790px; padding: clamp(1rem, 3vw, 1.6rem); }
.rows { padding: 0; margin: 0; list-style: none; }
.rows li + li { border-top: 1px solid var(--line); }
.rows small, .facts small, .approval-list small { display: block; margin-top: .18rem; overflow-wrap: anywhere; }
.rows strong { color: var(--navy-deep); overflow-wrap: anywhere; }
.simple-row, .access-row, .job-row, .queue-row, .bill-row {
  display: grid;
  gap: .75rem 1rem;
  align-items: center;
  padding: 1rem 1.2rem;
}
.simple-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
.access-row { grid-template-columns: minmax(0, 1fr) minmax(0, .55fr) minmax(265px, auto); }
.assign { display: flex; flex-wrap: wrap; align-items: end; justify-content: end; gap: .6rem; }
.assign .field { flex: 1 1 125px; }
.job-row { grid-template-columns: minmax(93px, .27fr) minmax(0, 1fr) auto; }
.queue-row { grid-template-columns: minmax(0, 1fr) minmax(0, .62fr) max-content auto; min-height: 71px; text-decoration: none; }
.queue-row:hover { background: #edf2f7; }
.rows li:last-child > .queue-row { border-radius: 0 0 var(--radius) var(--radius); }
.badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: .18rem .52rem;
  border-radius: 5px;
  background: #e8eef5;
  color: var(--navy);
  font-size: .79rem;
  font-weight: 730;
  line-height: 1.4;
}
.badge.good { color: var(--good); background: var(--good-bg); }
.badge.waiting { color: var(--wait); background: var(--wait-bg); }

.team-chat { max-width: 880px; }
.chat-header { flex-wrap: wrap; }
.chat-header h2 { margin-bottom: .25rem; }
.chat-alerts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 .85rem;
  min-height: 50px;
  padding: .15rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}
.chat-alerts .text-button { font-size: .88rem; font-weight: 660; text-align: left; }
.chat-alerts [hidden] { display: none; }
.team-chat button:disabled { opacity: .55; cursor: wait; }
.chat-history {
  min-height: 230px;
  max-height: min(46dvh, 430px);
  overflow: auto;
  padding: 1.15rem 1.2rem 1.35rem;
}
.chat-history:focus-visible { outline: 3px solid var(--purple); outline-offset: -3px; }
.chat-messages { display: grid; gap: 1rem; margin: 0; padding: 0; list-style: none; }
.chat-message { display: flex; gap: .65rem; align-items: start; }
.chat-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 2.05rem;
  height: 2.05rem;
  border-radius: 50%;
  background: var(--paper);
  color: var(--navy);
  font-size: .72rem;
  font-weight: 730;
}
.chat-message-detail { min-width: 0; }
.chat-message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .6rem; }
.chat-message-meta strong { font-size: .88rem; overflow-wrap: anywhere; }
.chat-message-meta time { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.chat-message p {
  width: fit-content;
  max-width: 70ch;
  margin-top: .22rem;
  padding: .5rem .75rem;
  border-radius: 0 10px 10px 10px;
  background: var(--paper);
  white-space: pre-wrap;
}
.chat-message.outgoing p { background: #e8eef5; }
.chat-composer { padding: .85rem 1.2rem 1.15rem; border-top: 1px solid var(--line); }
.chat-compose-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem .8rem; margin-top: .65rem; }
.chat-feedback { color: var(--muted); font-size: .88rem; }

.inbox { max-width: 1120px; }
.inbox-layout { display: grid; grid-template-columns: minmax(200px, 28%) minmax(0, 1fr); }
.inbox-list {
  background: #f8fafc;
  border-right: 1px solid var(--line);
  border-bottom-left-radius: calc(var(--radius) - 1px);
  min-width: 0;
}
.inbox-list h2 { padding: 1rem 1.2rem .7rem; font-size: .9rem; }
.inbox-list ul { list-style: none; margin: 0; padding: 0 .65rem .8rem; }
.inbox-list a {
  display: grid;
  gap: .22rem;
  padding: .72rem .55rem;
  border: 1px solid transparent;
  border-radius: 7px;
  text-decoration: none;
}
.inbox-list a:hover { background: var(--paper); }
.inbox-list a[aria-current] { background: #eaf0f6; border-color: #c6d4e2; }
.inbox-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-thread-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .55rem 1rem;
  padding: .85rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.inbox-thread-head h2 { margin-bottom: .2rem; }
.inbox .chat-history { min-height: min(33dvh, 310px); }
.inbox .chat-composer textarea::placeholder { color: var(--muted); }
.inbox button:disabled, .inbox textarea:disabled { opacity: .65; cursor: not-allowed; }
.inbox-policy { display: block; margin-top: .32rem; }
.inbox-feedback:not(:empty) { border-top: 1px solid var(--line); padding: .65rem 1.2rem; }
.simple-row:target { background: #eaf0f6; }

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 1.25rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.metrics > * { display: grid; gap: .1rem; padding: 1rem 1.2rem; text-decoration: none; }
.metrics > * + * { border-left: 1px solid var(--line); }
.metrics > a:hover { background: #edf2f7; }
.metrics span { font-size: .9rem; font-weight: 680; }
.metrics strong { color: var(--navy-deep); font-size: 1.85rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.columns .panel { margin: 0; }
.reference { background: #eef3f8; border-radius: 7px; padding: .7rem .8rem; }
.reference p { margin-top: .2rem; }
.facts { margin: .65rem 0 1rem; }
.facts div { display: flex; justify-content: space-between; gap: .65rem; padding: .42rem 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 620; text-align: right; }
.approval-list { list-style: none; display: grid; gap: .95rem; margin: 0 0 1.15rem; padding: 0; }
.approval-list li { display: flex; align-items: center; gap: .65rem; }
.step {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: var(--paper);
  font-weight: 760;
}
.complete .step { color: var(--good); background: var(--good-bg); border-color: #a9d1bd; }
.numeric { font-variant-numeric: tabular-nums; }
.bill-row { grid-template-columns: minmax(0, 1.25fr) minmax(0, .62fr) minmax(0, .42fr) minmax(0, .6fr); align-items: start; }
.bill-row > div { display: grid; gap: .12rem; justify-items: start; }
.bill-row p { color: var(--muted); font-size: .85rem; }
.row-title { font-weight: 740; }
.receipt-link, .text-button { font-size: .86rem; }
.bill-reminders { grid-column: 1 / -1; color: var(--muted); font-size: .87rem; }
.bill-reminders summary { min-height: 44px; padding-block: .6rem; width: fit-content; }
.notice { padding: .75rem .9rem; background: #ecf2f8; border-left: 3px solid var(--navy); }
.notice strong { overflow-wrap: anywhere; }
.notice p { margin-top: .25rem; }
main > .notice { margin-bottom: 1.15rem; }
.notice.success { border-color: #2b7055; background: var(--good-bg); }
.notice.error { border-color: #983529; background: #fff0ec; color: #711f19; }

@media (max-width: 1030px) {
  .workspace { grid-template-columns: 185px minmax(0, 1fr); }
  .access-row { grid-template-columns: minmax(0, 1fr) minmax(0, auto); }
  .access-row form { grid-column: 1 / -1; }
  .assign { justify-content: start; }
  .assign .field { flex: 0 1 165px; }
}

@media (max-width: 760px) {
  .inbox-layout { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { border-right: 0; border-bottom: 1px solid var(--line); border-bottom-left-radius: 0; }
  .inbox-list ul { max-height: 13rem; overflow: auto; }
  .inbox .chat-history { max-height: min(60dvh, 480px); }
  .workspace { grid-template-columns: minmax(0, 1fr); align-content: start; }
  .sidebar { padding: .6rem .8rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .2rem .4rem; }
  .sidebar a { padding: .4rem .55rem; font-size: .84rem; }
  .columns { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 590px) {
  .mast-inner { gap: .45rem .9rem; flex-wrap: wrap; }
  .mast .account { width: 100%; justify-content: space-between; border-top: 1px solid #3c5572; padding-top: .35rem; }
  .account > span { text-align: left; }
  .public-grid, .field-grid { grid-template-columns: minmax(0, 1fr); }
  .job-row { grid-template-columns: minmax(0, 1fr) auto; }
  .job-row .job-date { grid-column: 1 / -1; display: flex; gap: .65rem; align-items: baseline; }
  .queue-row { grid-template-columns: minmax(0, 1fr) auto; }
  .queue-row > div:first-child { grid-column: 1 / -1; }
  .queue-row > span:last-child { display: none; }
  .bill-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bill-row > div:first-child { grid-column: 1 / -1; }
  .metrics > * { padding: .68rem .55rem; }
  .metrics span, .metrics small { font-size: .77rem; }
  .metrics span { min-height: 3em; }
  .metrics strong { font-size: 1.45rem; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
