:root {
  --navy: #12233A;
  --text: #26333F;
  --muted: #5B6878;
  --line: #E2E7ED;
  --field: #B4BEC9;
  --wash: #F5F7F9;
  --green: #0F9648;
  --red: #9C1F18;
}
*, *::before, *::after { box-sizing: border-box; }
/* scrollbars in the site's colors: thin and soft blue-grey, darker on hover */
* { scrollbar-width: thin; scrollbar-color: #C3CDD9 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C3CDD9; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #8C99A8; }
::-webkit-scrollbar-corner { background: transparent; }

/* crossfade between pages, with the bar held still */
@view-transition { navigation: auto; }
.bar { view-transition-name: bar; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
body { margin: 0; background: var(--wash); color: var(--text); font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", sans-serif; font-size: 0.95rem; line-height: 1.5; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
h1, h2, h3 { color: var(--navy); font-weight: 600; line-height: 1.2; }
ul, ol { list-style: none; }
a { color: var(--navy); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.logo { height: 22px; display: block; }
.muted { color: var(--muted); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

.btn { font: inherit; font-weight: 500; cursor: pointer; padding: 9px 18px; background: var(--navy); color: #fff; border: 1px solid var(--navy); }
.btn:hover { background: #1D3553; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn.plain { background: #fff; color: var(--navy); border-color: var(--field); }
.btn.plain:hover { background: var(--wash); }
.link, .del { font: inherit; font-size: 0.88rem; font-weight: 500; background: none; border: 0; padding: 5px 8px; cursor: pointer; }
.link { color: var(--navy); }
.link:hover { background: var(--wash); }
.del { color: var(--red); }
.del:hover { background: #FBE7E5; }
input, select, textarea { width: 100%; padding: 9px 11px; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--field); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline-offset: 0; border-color: var(--navy); }
textarea { resize: vertical; }
label { display: block; font-weight: 500; color: var(--navy); font-size: 0.92rem; }
label input, label select { margin-top: 6px; }
.err { color: var(--red); font-weight: 500; }
.err:empty { display: none; }

.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.box { width: min(100%, 400px); background: #fff; border: 1px solid var(--line); padding: 32px; display: grid; gap: 16px; box-shadow: 0 1px 2px rgba(18, 35, 58, .04), 0 8px 24px rgba(18, 35, 58, .06); }
.box h1 { font-size: 1.25rem; margin-top: 20px; }
.box h1 + p { margin-top: 6px; color: var(--muted); }

.bar { background: var(--navy); color: #C9D3DE; }
/* portal pages: the bar stays put and only the page under it scrolls, so no scrollbar runs past the bar */
.frame { height: 100dvh; display: flex; flex-direction: column; }
.frame > .bar { flex: none; }
.page { flex: 1; min-height: 0; overflow-y: auto; }
.bar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.bar h1 { color: #fff; font-size: 1rem; font-weight: 500; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .2); margin-right: auto; }
.bar button { font: inherit; color: #fff; background: none; border: 1px solid rgba(255, 255, 255, .3); padding: 5px 12px; cursor: pointer; }
.bar button:hover { background: rgba(255, 255, 255, .08); }
#who a { color: inherit; text-decoration: none; }
#who a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }

.bar nav { display: flex; gap: 4px; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .2); margin-right: auto; }
.bar nav a { color: #C9D3DE; text-decoration: none; font-weight: 500; padding: 6px 10px; }
.bar nav a:hover { color: #fff; }
.bar nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .1); }
.views { display: flex; padding: 3px; background: rgba(255, 255, 255, .08); }
.views a { color: #C9D3DE; text-decoration: none; font-size: 0.86rem; font-weight: 500; padding: 4px 11px; }
.views a:hover { color: #fff; }
.views a[aria-current="page"] { background: #fff; color: var(--navy); }
/* phones: the tabs get their own row under the bar that swipes sideways, and the name stays as the way to the account page */
@media (max-width: 900px) {
  .bar .wrap { flex-wrap: wrap; gap: 6px 8px; min-height: 0; padding-top: 10px; padding-bottom: 8px; }
  .bar .logo { height: 18px; }
  .bar .wrap > a:first-child { margin-right: auto; }
  .bar nav { order: 5; flex-basis: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-left: 0; border-left: 0; margin: 0 -6px; }
  .bar nav a { white-space: nowrap; padding: 6px 8px; font-size: 0.9rem; }
  .bar button { padding: 4px 9px; font-size: 0.86rem; white-space: nowrap; }
  #who { max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
  .views a { padding: 3px 7px; font-size: 0.8rem; }
}

.panel { background: #fff; border: 1px solid var(--line); }

.overall { padding: 20px 24px; color: #fff; background: #1E8E50; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.overall[data-state="maint"] { background: #1B5FAD; }
.overall[data-state="warn"] { background: #8A5F00; }
.overall[data-state="bad"] { background: #B3261E; }
.overall h2 { color: #fff; font-size: clamp(1.25rem, 3vw, 1.55rem); }
.overall p { font-size: 0.9rem; opacity: .92; }

.pill { display: inline-block; padding: 2px 9px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; background: #ECEFF3; color: #4A5664; }
.pill.new { background: #E3EDFA; color: #1B4F8C; }
.pill.contacted, .pill.quoted { background: #FFF1D6; color: #7A4A00; }
.pill.won { background: #E1F3E8; color: #0B6B33; }
.pill.alert, .pill.bad { background: #FBE7E5; color: var(--red); }
.pill.ok { background: #E1F3E8; color: #0B6B33; }
.pill.warn { background: #FFF1D6; color: #7A4A00; }
.pill.maint { background: #E3EDFA; color: #1B4F8C; }

.thread { display: flex; flex-direction: column; gap: 14px; }
.thread > li { display: flex; flex-direction: column; align-items: flex-start; max-width: 85%; }
.thread > li.out { align-self: flex-end; align-items: flex-end; }
.thread .who { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.thread .who strong { color: var(--navy); font-weight: 600; }
.msg { background: var(--wash); border: 1px solid var(--line); border-top-left-radius: 4px; padding: 10px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.out .msg { background: #EAF0F8; border-color: #D3DEEC; border-top-right-radius: 4px; }
.thread > li.note { align-self: stretch; max-width: none; }
.note .msg { background: #FFF8E3; border-color: #EEDDA6; width: 100%; }
.thread > li.ev { align-self: center; max-width: none; font-size: 0.84rem; color: var(--muted); }

.typing .msg { display: flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 7px; height: 7px; background: #8A97A6; animation: bounce 1.2s infinite; border-radius: 50%; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .typing i { animation: none; } }

.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.out .files { justify-content: flex-end; }
.thumb img { display: block; max-width: 240px; max-height: 180px; border: 1px solid var(--line); }
.file { display: flex; flex-direction: column; padding: 8px 12px; border: 1px solid var(--line); background: #fff; text-decoration: none; max-width: 260px; }
.file span { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file small, .picked small { color: var(--muted); }

.thread > li.consent-item { align-self: stretch; max-width: none; }
.consent { border: 1px solid #C9D6E8; background: #F5F8FC; padding: 16px 18px; }
.consent-top { display: flex; flex-wrap: wrap; gap: 6px; }
.consent h4 { margin: 10px 0 0; font-size: 1.05rem; color: var(--navy); }
.consent-text { margin-top: 6px; white-space: pre-wrap; }
.consent dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin-top: 12px; font-size: 0.92rem; }
.consent dt { color: var(--muted); }
.consent dd { color: var(--navy); font-weight: 500; }
.consent .signed { margin-top: 12px; padding-top: 10px; border-top: 1px solid #DCE4EF; font-size: 0.92rem; color: var(--muted); }
.consent .signed strong { color: var(--navy); }
.attest { margin-top: 12px; padding-top: 10px; border-top: 1px solid #DCE4EF; font-size: 0.9rem; }
.attest summary { cursor: pointer; color: var(--navy); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.attest dl { margin-top: 10px; }
.attest dd { overflow-wrap: anywhere; }
.attest .code { font-family: Consolas, Menlo, monospace; letter-spacing: .03em; }
.sign { margin-top: 14px; padding-top: 14px; border-top: 1px solid #DCE4EF; display: grid; gap: 12px; }
.sign .agree { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--text); }
.sign .agree input { width: auto; margin: 3px 0 0; flex: none; }
.sign .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.compose.drop { outline: 2px dashed var(--navy); outline-offset: -6px; }
.picked { display: flex; flex-wrap: wrap; gap: 6px; }
.picked:not(:empty) { margin-bottom: 8px; }
.picked li { display: flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; background: var(--wash); border: 1px solid var(--line); font-size: 0.86rem; }
.picked button { font: inherit; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 50%; }
.picked button:hover { background: var(--line); color: var(--navy); }
.attach { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; color: var(--muted); font-weight: 500; cursor: pointer; }
.attach:hover { background: var(--wash); color: var(--navy); }
.attach:focus-within { outline: 3px solid var(--green); }

[hidden] { display: none; }
