/* Sacred Vows guardian portal
   Brand: plum #280849 and rose #F086C7, taken from the logo. */
:root {
  --plum: #280849;
  --plum-2: #4a1458;
  --plum-3: #6b3a86;
  --rose: #f086c7;
  --rose-soft: #fbe6f2;
  --page: #f5f2f8;
  --surface: #ffffff;
  --ink: #2a2133;
  --muted: #6e6479;
  --line: #e6deee;
  --line-strong: #d3c6df;
  --ok: #1f7a55;  --ok-bg: #e3f3eb;
  --wait: #8a5a00; --wait-bg: #fbf0d9;
  --no: #9b3343;  --no-bg: #f8e4e7;
  --radius: 10px;
  --font: "Lexend", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-weight: 300; font-size: 1rem; line-height: 1.6; color: var(--ink); background: var(--page); }
h1, h2, h3 { font-weight: 500; color: var(--plum); line-height: 1.25; margin: 0; }
a { color: var(--plum-2); text-underline-offset: 3px; }
a:hover { color: var(--plum); }
strong { font-weight: 500; }
code { font-size: .875em; background: var(--page); padding: .1em .35em; border-radius: 4px; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--rose); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: #fff; padding: .5rem 1rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* ---------- Buttons, forms, alerts ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 500; font-size: .95rem; padding: .7rem 1.25rem; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background-color .15s, border-color .15s; }
.btn-primary { background: var(--plum); color: #fff; }
.btn-primary:hover { background: var(--plum-2); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--plum); border-color: var(--line-strong); }
.btn-secondary:hover { border-color: var(--plum-3); color: var(--plum); }
.btn-light { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.btn-small { padding: .4rem .9rem; font-size: .85rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--plum-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-button:disabled { color: var(--muted); text-decoration: none; cursor: default; }
.form { display: grid; gap: 1.1rem; margin: 1.5rem 0 1rem; }
.field { display: grid; gap: .4rem; }
.field label { font-weight: 500; font-size: .9rem; color: var(--plum); }
.field input, select { font: inherit; font-weight: 400; color: var(--ink); padding: .75rem .9rem; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; width: 100%; }
.field input:focus, select:focus { border-color: var(--plum-3); outline: 3px solid var(--rose-soft); outline-offset: 0; }
.code-input { font-size: 1.6rem !important; letter-spacing: .5em; text-align: center; font-weight: 500 !important; }
.alert { padding: .8rem 1rem; border-radius: 8px; font-size: .925rem; margin: 1rem 0 0; }
.alert-error { background: var(--no-bg); color: var(--no); }
.alert-info { background: var(--rose-soft); color: var(--plum-2); }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert + .form { margin-top: 1.25rem; }
.panel.narrow { max-width: 34rem; }
.panel.narrow .form { margin: 0; }
.panel.narrow .alert { margin: 0 0 1.25rem; }
.field-hint { margin: -.15rem 0 0; font-size: .82rem; color: var(--muted); }
.field-error { margin: 0; font-size: .85rem; color: var(--no); }
.field.has-error input { border-color: var(--no); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 4.5rem; }
.password-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; font: inherit; font-size: .82rem; font-weight: 500; color: var(--plum-2); padding: .35rem .55rem; border-radius: 6px; cursor: pointer; }
.password-toggle:hover { background: var(--page); }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.forgot-link { font-size: .875rem; }
.auth-help-tight { margin-top: 1.25rem; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .25rem; }

/* ---------- Auth pages ---------- */
.auth-grid { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-brand { background: var(--plum); color: #fff; position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 3rem; }
.auth-mark { position: absolute; width: 130%; max-width: none; right: -45%; top: -18%; opacity: .14; animation: turn 120s linear infinite; }
.auth-brand-text { position: relative; max-width: 26rem; }
.auth-brand-title { font-size: clamp(2rem, 3.5vw, 2.9rem); font-weight: 500; line-height: 1.1; margin: 0 0 1rem; }
.auth-brand-copy { font-size: 1.05rem; color: rgba(255,255,255,.82); margin: 0; }
.auth-panel { padding: 3rem clamp(1.5rem, 6vw, 6rem); display: flex; flex-direction: column; justify-content: center; max-width: 36rem; width: 100%; }
.auth-logo { width: 170px; height: auto; margin-bottom: 2.5rem; }
.auth-title { font-size: 1.9rem; margin-bottom: .5rem; }
.auth-lead { color: var(--muted); margin: 0; }
.auth-alt { margin: .5rem 0 0; font-size: .95rem; }
.auth-help { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.resend { margin-top: .25rem; font-size: .95rem; }
.message-page { max-width: 32rem; }
.message-page h1 { font-size: 1.6rem; margin-bottom: .5rem; }
.message-page p { color: var(--muted); }
@keyframes turn { to { transform: rotate(360deg); } }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1.75rem 1.25rem; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand img { width: 150px; height: auto; display: block; }
.portal-name { margin: .35rem 0 2rem; font-size: .85rem; color: var(--muted); }
.nav { display: grid; gap: .2rem; }
.nav a { display: block; padding: .6rem .85rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 400; position: relative; }
.nav a:hover { background: var(--page); color: var(--plum); }
.nav a.is-active { background: var(--page); color: var(--plum); font-weight: 500; }
.nav a.is-active::before { content: ""; position: absolute; left: -1.25rem; top: .5rem; bottom: .5rem; width: 4px; border-radius: 0 4px 4px 0; background: var(--rose); }
.account { margin-top: auto; padding-top: 1.25rem; border-top: 1px solid var(--line); font-size: .875rem; }
.account p { margin: 0; overflow-wrap: anywhere; }
.account-name { font-weight: 500; color: var(--plum); }
.account-email { color: var(--muted); margin-bottom: .6rem !important; }
.account-actions { display: flex; gap: .4rem 1rem; flex-wrap: wrap; align-items: center; }
.account-actions a { color: var(--plum-2); text-underline-offset: 3px; }
.account-actions a.is-active { font-weight: 500; color: var(--plum); }
.main-wrap { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 2rem clamp(1rem, 3vw, 2.5rem) 3rem; flex: 1; width: 100%; max-width: 1180px; }
.footer { padding: 1.25rem clamp(1rem, 3vw, 2.5rem); font-size: .8rem; color: var(--muted); display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; border-top: 1px solid var(--line); }
.footer p { margin: 0; }

/* ---------- "Viewing" band: the signature element ---------- */
.viewing { background: var(--plum); color: #fff; padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 0; position: relative; overflow: hidden; }
.viewing::after { content: ""; position: absolute; right: -60px; top: -70px; width: 300px; height: 300px; background: url("../img/mark-light.png") center / contain no-repeat; opacity: .12; pointer-events: none; }
.viewing-inner { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; position: relative; z-index: 1; max-width: 1180px; }
.viewing-text { flex: 1; min-width: 14rem; }
.viewing-label { margin: 0; font-size: .85rem; color: rgba(255,255,255,.7); }
.viewing-name { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 500; line-height: 1.15; }
.viewing-meta { margin: .2rem 0 0; color: rgba(255,255,255,.8); font-size: .95rem; }
.switcher { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.switcher label { font-size: .85rem; color: rgba(255,255,255,.75); }
.switcher select { width: auto; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.35); padding: .5rem .8rem; }
.switcher option { color: var(--ink); }
.readonly-note { position: relative; z-index: 1; margin: 1.5rem calc(-1 * clamp(1rem, 3vw, 2.5rem)) 0; padding: .65rem clamp(1rem, 3vw, 2.5rem); background: rgba(0,0,0,.18); font-size: .85rem; color: rgba(255,255,255,.85); }

/* ---------- Avatars ---------- */
.avatar { --s: 44px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; position: relative; display: inline-grid; place-items: center; background: var(--rose-soft); color: var(--plum-2); font-weight: 500; font-size: calc(var(--s) * .36); overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { --s: 36px; }
.avatar-lg { --s: 72px; box-shadow: 0 0 0 3px var(--rose); }
.avatar-xl { --s: 104px; }
.viewing .avatar { background: var(--plum-2); color: #fff; }

/* ---------- Overview figures ---------- */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1.75rem; }
.figure { padding: 1.25rem 1.4rem; text-decoration: none; color: inherit; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.figure:first-child { border-left: 0; }
.figure:hover .figure-label { color: var(--plum); text-decoration: underline; }
.figure-num { font-size: 2.2rem; font-weight: 500; color: var(--plum); line-height: 1.1; }
.figure-label { font-size: .9rem; color: var(--muted); }
.figure-note { font-size: .8rem; color: var(--wait); margin-top: .35rem; }

/* ---------- Panels ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.75rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.panel-quiet { background: transparent; border-style: dashed; }
.panel-title { font-size: 1.1rem; margin-bottom: 1rem; }
.intro { margin: 0 0 1.25rem; white-space: normal; max-width: 60ch; }
.facts { margin: 0; display: grid; gap: 0; }
.facts div { display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; padding: .55rem 0; border-top: 1px solid var(--line); }
.facts div:first-child { border-top: 0; }
.facts dt { color: var(--muted); font-size: .9rem; }
.facts dd { margin: 0; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .9rem; align-items: start; padding: .85rem 0; border-top: 1px solid var(--line); }
.timeline-item:first-child { border-top: 0; padding-top: 0; }
.timeline-plain { grid-template-columns: minmax(0, 1fr) auto; }
.timeline-body { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; }
.timeline-text { color: var(--ink); text-decoration: none; margin: 0; }
a.timeline-text:hover { color: var(--plum); text-decoration: underline; }
.timeline-quote { margin: 0; color: var(--muted); font-size: .9rem; border-left: 2px solid var(--rose); padding-left: .6rem; }
.timeline-time { font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* ---------- Status pills ---------- */
.status { display: inline-block; font-size: .78rem; font-weight: 500; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap; }
.status-accepted { background: var(--ok-bg); color: var(--ok); }
.status-pending { background: var(--wait-bg); color: var(--wait); }
.status-declined { background: var(--no-bg); color: var(--no); }
.verified { display: inline-block; margin-left: .5rem; font-size: .72rem; font-weight: 500; color: var(--ok); background: var(--ok-bg); padding: .05rem .5rem; border-radius: 999px; vertical-align: middle; }

/* ---------- Page heads, tabs, lists ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { font-size: 1.75rem; }
.page-lead { margin: 0; color: var(--muted); flex-basis: 100%; max-width: 60ch; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; }
.tabs a { padding: .45rem 1rem; border-radius: 999px; text-decoration: none; color: var(--muted); font-weight: 400; }
.tabs a.is-active { background: var(--plum); color: #fff; }
.count { font-size: .8rem; opacity: .75; margin-left: .2rem; }
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 1rem; align-items: center; padding: .9rem 1.25rem; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-date, .list-sub { font-size: .85rem; color: var(--muted); white-space: nowrap; min-width: 5.5rem; text-align: right; }
.person { display: flex; align-items: center; gap: .9rem; text-decoration: none; color: inherit; min-width: 0; }
.person-text { display: flex; flex-direction: column; min-width: 0; }
.person-name { font-weight: 500; color: var(--plum); }
.person:hover .person-name { text-decoration: underline; }
.person-meta { font-size: .875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }
.empty { text-align: left; padding: 2rem 1.5rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); }
.empty-title { color: var(--plum); font-weight: 500; margin: 0 0 .25rem; }
.empty p:last-child { margin-bottom: 0; }
.crumb { margin: 0 0 1rem; font-size: .9rem; }
.crumb a::before { content: "‹ "; }

/* ---------- Conversations ---------- */
.threads { list-style: none; margin: 0; padding: 0; }
.threads-full { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.threads-full li + li { border-top: 1px solid var(--line); }
.thread { display: flex; gap: .85rem; align-items: center; padding: .9rem 1.25rem; text-decoration: none; color: inherit; }
.thread:hover { background: var(--page); }
.thread.is-active { background: var(--rose-soft); }
.thread-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.thread-top { display: flex; justify-content: space-between; gap: .75rem; }
.thread-name { font-weight: 500; color: var(--plum); }
.thread-top time { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.thread-last { font-size: .875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { color: var(--plum-3); }
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: calc(100vh - 290px); min-height: 520px; }
.chat-side { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-side-title { font-size: 1rem; padding: 1rem 1.25rem .5rem; }
.chat-side .thread { padding: .75rem 1.25rem; }
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 1rem 1.5rem; border-bottom: 1px solid var(--line); }
.chat-who { display: flex; gap: .85rem; align-items: center; }
.chat-title { font-size: 1.15rem; }
.chat-profile { font-size: .85rem; }
.back { display: none; font-size: .875rem; margin-bottom: .6rem; }
.back::before { content: "‹ "; }
.messages { flex: 1; overflow-y: auto; padding: 1.25rem 1.5rem; background: var(--page); display: flex; flex-direction: column; gap: .2rem; }
.day { text-align: center; margin: 1rem 0 .5rem; font-size: .78rem; color: var(--muted); }
.day span { background: var(--surface); padding: .2rem .8rem; border-radius: 999px; border: 1px solid var(--line); }
.msg { max-width: min(72%, 34rem); display: flex; flex-direction: column; margin-top: .5rem; }
.msg-mine { align-self: flex-end; align-items: flex-end; }
.msg-theirs { align-self: flex-start; align-items: flex-start; }
.msg-author { margin: 0 .5rem .15rem; font-size: .75rem; color: var(--muted); }
.msg-bubble { padding: .6rem .95rem; border-radius: 16px; overflow-wrap: anywhere; }
.msg-bubble p { margin: 0; }
.msg-mine .msg-bubble { background: var(--plum); color: #fff; border-bottom-right-radius: 4px; }
.msg-theirs .msg-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg-attachment { font-style: italic; opacity: .85; font-size: .875rem; }
.msg-time { font-size: .72rem; color: var(--muted); margin: .15rem .5rem 0; }
.load-earlier { text-align: center; margin: 0 0 .5rem; font-size: .85rem; }
.chat-foot { margin: 0; padding: .75rem 1.5rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); background: var(--surface); }

/* ---------- Member profile ---------- */
.profile { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 1.75rem; flex-wrap: wrap; }
.profile-name { font-size: 1.9rem; }
.profile p { margin: .2rem 0 .75rem; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .chat-side { display: none; }
  .back { display: inline-block; }
  .messages { max-height: 65vh; }
}
@media (max-width: 760px) {
  .figures { grid-template-columns: minmax(0, 1fr); }
  .figure { border-left: 0; border-top: 1px solid var(--line); }
  .figure:first-child { border-top: 0; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .nav { min-width: 0; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .9rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand img { width: 110px; }
  .portal-name { display: none; }
  .nav { order: 3; flex-basis: 100%; display: flex; overflow-x: auto; gap: .25rem; }
  .nav a { white-space: nowrap; padding: .45rem .8rem; }
  .nav a.is-active::before { display: none; }
  .account { margin: 0 0 0 auto; padding: 0; border: 0; text-align: right; }
  .account-name, .account-email { display: none; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-brand { min-height: 9rem; padding: 1.5rem; }
  .auth-brand-copy { display: none; }
  .auth-brand-title { font-size: 1.6rem; margin: 0; }
  .auth-mark { width: 70%; right: -15%; top: -60%; }
  .auth-panel { padding: 2rem 1.25rem; }
  .auth-logo { display: none; }
  .list-row { grid-template-columns: minmax(0, 1fr) auto; }
  .list-row .list-date, .list-row .list-sub:first-of-type { grid-column: 2; }
  .list-row > :nth-child(3) { grid-column: 1 / -1; justify-self: start; text-align: left; }
  .facts div { grid-template-columns: 7.5rem 1fr; }
  .msg { max-width: 88%; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
