/* Endeavor portal (admin console, scheduling, e-signature). Builds on the tokens in styles.css. */
body.portal { background: var(--gray-50); min-height: 100vh; }
.portal-top {
  position: sticky; top: 0; z-index: 50; background: var(--white); border-bottom: 1px solid var(--line);
}
.portal-top__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; padding-inline: var(--gutter); }
.portal-top__logo { height: 2rem; width: auto; display: block; }
.portal-top__right { display: flex; align-items: center; gap: .75rem; font-size: .9rem; color: var(--muted); }
.portal-main { max-width: 72rem; margin: 0 auto; padding: clamp(1.5rem, 1rem + 2vw, 3rem) var(--gutter) 4rem; }
.portal-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(1.25rem, 1rem + 1vw, 2rem); }
.portal-card + .portal-card { margin-top: var(--space-4); }
.portal-h1 { font-size: var(--step-3); margin-bottom: .5rem; }
.portal-h2 { font-size: var(--step-2); margin-bottom: .75rem; font-family: var(--font-serif); }
.portal-muted { color: var(--muted); font-size: .92rem; }
.portal-btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn--ghost { background: var(--white); color: var(--navy-900); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--navy-900); }
.btn--danger { background: #fff; color: var(--error); border-color: #e7b4ae; }
.btn--danger:hover { background: #fdf3f2; }
.btn--xs { min-height: 2.25rem; padding: .35rem .75rem; font-size: .85rem; }
.portal-alert { padding: .85rem 1rem; border-radius: var(--radius); font-size: .93rem; margin: .75rem 0; }
.portal-alert--error { background: #fdf3f2; border: 1.5px solid var(--error); color: var(--error); }
.portal-alert--ok { background: #eef7f1; border: 1.5px solid var(--success); color: var(--success); }
.portal-alert--info { background: #eef3fb; border: 1.5px solid #9db7e0; color: #1d3f73; }
.portal-alert:empty { display: none; }
.portal-form { display: grid; gap: var(--space-3); }
.portal-form .field label { font-size: .9rem; }
.portal-grid2 { display: grid; gap: var(--space-3); grid-template-columns: minmax(0,1fr); }
@media (min-width: 640px) { .portal-grid2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* ---------- Admin console layout ---------- */
.console { display: grid; grid-template-columns: minmax(0,1fr); min-height: calc(100vh - 4rem); }
.console__nav { background: var(--navy-950); color: var(--on-dark); padding: 1rem .75rem; }
.console__nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .25rem; flex-wrap: wrap; }
.console__nav a {
  display: flex; align-items: center; gap: .6rem; min-height: 2.75rem; padding: .5rem .85rem; border-radius: var(--radius);
  color: var(--on-dark); text-decoration: none; font-weight: 500; font-size: .93rem; white-space: nowrap;
}
.console__nav a:hover { background: rgb(255 255 255 / .08); }
.console__nav a[aria-current="page"] { background: rgb(200 164 93 / .18); color: var(--white); box-shadow: inset 3px 0 0 var(--gold); }
.console__nav .icon { color: var(--gold); width: 1.15rem; height: 1.15rem; }
.console__nav-title { display: none; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--on-dark-muted); padding: .5rem .85rem; }
.console__content { padding: clamp(1.25rem, 1rem + 1.5vw, 2.25rem) var(--gutter) 4rem; min-width: 0; }
@media (min-width: 960px) {
  .console { grid-template-columns: 15rem minmax(0,1fr); }
  .console__nav { padding: 1.5rem 1rem; }
  .console__nav ul { flex-direction: column; overflow: visible; }
  .console__nav-title { display: block; }
}
.console__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: var(--space-4); }
.console__head h1 { font-size: var(--step-3); }

/* dashboard: main column + links panel on the right */
.dash { display: grid; gap: var(--space-4); grid-template-columns: minmax(0,1fr); }
@media (min-width: 1100px) { .dash { grid-template-columns: minmax(0,1fr) 18rem; align-items: start; } }
.kpis { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (min-width: 760px) { .kpis { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 1rem 1.1rem; }
.kpi__label { font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.kpi__value { font-family: var(--font-serif); font-size: 2rem; font-weight: 600; color: var(--navy-900); line-height: 1.2; }
.links-panel { position: sticky; top: 5rem; }
.links-panel ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.links-panel a, .links-panel button {
  display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 2.75rem; padding: .5rem .75rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--ink);
  text-decoration: none; font: inherit; font-size: .92rem; font-weight: 500; cursor: pointer; text-align: left;
}
.links-panel a:hover, .links-panel button:hover { border-color: var(--navy-900); }
.links-panel .icon { color: var(--gold-ink); }

/* lists & tables */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--gray-100); align-items: center; flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list__main { min-width: 0; }
.list__main strong { display: block; color: var(--ink); }
.list__main span { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--white); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 46rem; }
table.data th, table.data td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
table.data th { font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--gray-50); font-weight: 600; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: #fafbfd; }
table.data td .sub { display: block; color: var(--muted); font-size: .82rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: var(--space-3); }
.toolbar input, .toolbar select { min-height: 2.75rem; padding: .5rem .75rem; border: 1.5px solid #8a95a8; border-radius: var(--radius); font-size: .95rem; background: var(--white); }
.toolbar input[type="search"] { flex: 1 1 14rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge--new, .badge--sent { color: #1d4e89; background: #eaf1fb; }
.badge--contacted, .badge--viewed { color: #7a5a12; background: #fbf3e2; }
.badge--qualified, .badge--proposal { color: #5b3f8c; background: #f1ecfa; }
.badge--client, .badge--signed, .badge--confirmed, .badge--completed { color: #1e6b3a; background: #e9f6ee; }
.badge--lost, .badge--voided, .badge--cancelled, .badge--expired, .badge--no_show { color: #8a2a20; background: #fbecea; }

/* drawer / modal */
.overlay { position: fixed; inset: 0; background: rgb(7 22 43 / .45); z-index: 300; display: flex; justify-content: flex-end; }
.overlay[hidden] { display: none; }
.drawer { width: min(36rem, 100%); height: 100%; background: var(--white); overflow-y: auto; padding: 1.5rem; box-shadow: -10px 0 40px rgb(0 0 0 / .2); }
.overlay--center { justify-content: center; align-items: center; padding: 1rem; }
.modal { width: min(40rem, 100%); max-height: 90vh; overflow-y: auto; background: var(--white); border-radius: var(--radius-lg); padding: 1.5rem; }
.drawer__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.close-x { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 1.3rem; line-height: 1; color: var(--ink); flex: none; }
dl.kv { display: grid; grid-template-columns: 8.5rem minmax(0,1fr); gap: .45rem .75rem; font-size: .92rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.timeline { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.timeline li { padding: .45rem 0 .45rem 1rem; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -.35rem; top: .85rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--gold); }
.empty { color: var(--muted); padding: 1rem 0; font-size: .93rem; }

/* availability editor */
.week { display: grid; gap: .5rem; }
.week__day { display: grid; grid-template-columns: 6.5rem minmax(0,1fr); gap: .75rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--gray-100); }
.week__day > strong { padding-top: .55rem; }
.week__slots { display: flex; flex-direction: column; gap: .4rem; }
.week__slot { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.week__slot input[type="time"] { min-height: 2.5rem; padding: .3rem .5rem; border: 1.5px solid #8a95a8; border-radius: var(--radius); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: var(--space-4); flex-wrap: wrap; }
.tabs button { min-height: 2.75rem; padding: .5rem 1rem; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2.5px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--navy-900); border-bottom-color: var(--gold); }

/* auth */
.auth { max-width: 26rem; margin: clamp(2rem, 1rem + 6vw, 5rem) auto; }
.auth__qr { display: flex; justify-content: center; padding: 1rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.auth__qr img { width: 12rem; height: 12rem; }
.code-input { font-size: 1.5rem !important; letter-spacing: .4em; text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; overflow-wrap: anywhere; }

/* ---------- Public scheduling ---------- */
.sched { display: grid; gap: var(--space-4); grid-template-columns: minmax(0,1fr); }
@media (min-width: 900px) { .sched { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); } }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.cal__head button { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--line); background: var(--white); cursor: pointer; font-size: 1.1rem; color: var(--navy-900); }
.cal__head button:disabled { opacity: .35; cursor: not-allowed; }
.cal__grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: .3rem; text-align: center; }
.cal__dow { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; padding: .3rem 0; }
.cal__day { aspect-ratio: 1; min-height: 2.6rem; border-radius: 50%; border: 0; background: none; font: inherit; font-size: .95rem; color: #9aa3b2; cursor: default; }
.cal__day--open { color: var(--navy-900); font-weight: 700; background: #eaf1fb; cursor: pointer; }
.cal__day--open:hover { background: #d7e5f8; }
.cal__day[aria-pressed="true"] { background: var(--navy-900); color: var(--white); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: .5rem; }
.slots button { min-height: 2.9rem; border: 1.5px solid var(--navy-800); border-radius: var(--radius); background: var(--white); color: var(--navy-900); font: inherit; font-weight: 600; cursor: pointer; }
.slots button:hover, .slots button[aria-pressed="true"] { background: var(--navy-900); color: var(--white); }
.chosen { padding: .85rem 1rem; background: #eaf1fb; border-radius: var(--radius); margin-bottom: var(--space-3); font-weight: 600; color: var(--navy-900); }
.radio-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-row label { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; padding: .4rem .9rem; border: 1.5px solid var(--line); border-radius: var(--radius); cursor: pointer; font-weight: 500; }
.radio-row input { accent-color: var(--navy-900); width: 1.1rem; height: 1.1rem; }
.lang-mini { display: flex; gap: .35rem; }
.lang-mini a { display: inline-flex; align-items: center; min-height: 2.5rem; padding: 0 .65rem; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .85rem; }
.lang-mini a[aria-current="true"] { background: var(--navy-900); color: var(--white); border-color: var(--navy-900); }

/* ---------- Signing ---------- */
.doc-frame { width: 100%; height: min(70vh, 48rem); border: 1px solid var(--line); border-radius: var(--radius); background: #eef0f4; }
.disclosure { max-height: 14rem; overflow-y: auto; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--gray-50); font-size: .88rem; }
.disclosure h3 { font-size: .95rem; margin: .6rem 0 .3rem; }
.disclosure p, .disclosure li { margin: 0 0 .5rem; }
.sigpad { position: relative; border: 2px dashed #8a95a8; border-radius: var(--radius); background: var(--white); touch-action: none; }
.sigpad canvas { display: block; width: 100%; height: 11rem; cursor: crosshair; }
.sigpad__line { position: absolute; left: 1.5rem; right: 1.5rem; bottom: 2.5rem; border-bottom: 1px solid #c9ced8; pointer-events: none; }
.sigpad__hint { position: absolute; left: 1.5rem; bottom: .75rem; font-size: .78rem; color: var(--muted); pointer-events: none; }
.check-row { display: flex; gap: .75rem; align-items: flex-start; }
.check-row input { width: 1.35rem; height: 1.35rem; margin-top: .15rem; flex: none; accent-color: var(--navy-900); }
.check-row label { font-size: .93rem; color: var(--ink); }
.sched > .portal-card + .portal-card, .dash .portal-card + .portal-card.links-panel { margin-top: 0; }

/* ---------- PDF pages (shared) ---------- */
.pdfpage { position: relative; width: 100%; background: #fff; box-shadow: 0 2px 14px rgb(11 31 58 / .14); border-radius: 2px; margin: 0 auto 1.25rem; user-select: none; }
.pdfpage canvas { display: block; width: 100%; height: 100%; }
.pdfpage__layer { position: absolute; inset: 0; }
.pdfpage__num { position: absolute; right: .5rem; bottom: -1.15rem; font-size: .72rem; color: var(--muted); }

/* ---------- Signature editor (admin) ---------- */
.esx { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1200px) { .esx { grid-template-columns: 12.5rem minmax(0, 1fr) 18rem; } }
.esx__tools { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .9rem; }
@media (min-width: 1200px) { .esx__tools { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; } }
@media (max-width: 1199.98px) { .esx__tools { position: sticky; top: 0; z-index: 5; box-shadow: 0 6px 18px rgb(11 31 58 / .08); } .esx__hint { display: none; } }
.esx__h { font-family: var(--font-sans, inherit); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: .6rem 0 .45rem; }
.esx__h:first-child { margin-top: 0; }
.esx__toolgrid { display: grid; gap: .35rem; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1199.98px) { .esx__toolgrid { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); } }
.esx__tool { display: flex; align-items: center; gap: .55rem; width: 100%; min-height: 2.5rem; padding: .35rem .6rem; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--white); font: inherit; font-size: .86rem; font-weight: 600; color: var(--navy-900); text-align: left; cursor: grab; touch-action: none; }
.esx__tool:hover { border-color: var(--navy-800); }
.esx__tool[aria-pressed="true"] { background: var(--navy-900); color: var(--white); border-color: var(--navy-900); }
.esx__tool:disabled { opacity: .45; cursor: not-allowed; }
.esx__ico { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 6px; font-size: .8rem; flex: none; background: #eef2f8; color: var(--navy-900); }
.esx__tool--sig .esx__ico { background: #fff3c9; }
.esx__tool--auto .esx__ico { background: #e3effd; }
.esx__tool--input .esx__ico { background: #e7f6ec; }
.esx__tool--erase .esx__ico { background: #fde8e6; }
.esx__tool--text .esx__ico { background: #efe9fb; }
.esx__tool[aria-pressed="true"] .esx__ico { background: rgb(255 255 255 / .18); color: var(--white); }
.esx__hint { font-size: .8rem; color: var(--muted); margin: .8rem 0 0; line-height: 1.45; }
.esx__stage { min-width: 0; background: #e9edf3; border-radius: var(--radius-lg); padding: clamp(.75rem, 2vw, 1.5rem); min-height: 60vh; }
.esx__drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; text-align: center; min-height: 50vh; border: 2px dashed #8a95a8; border-radius: var(--radius-lg); background: var(--white); cursor: pointer; padding: 2rem 1rem; color: var(--navy-900); }
.esx__drop.is-over, .esx__drop:hover { border-color: var(--navy-900); background: #f4f7fc; }
.esx__drop:focus-within { outline: 3px solid var(--focus, #2563eb); outline-offset: 3px; }
.esx__drop-ico { font-size: 2.4rem; }
.esx__filebar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; font-weight: 600; color: var(--navy-900); font-size: .9rem; }
.esx__pages { max-width: 860px; margin: 0 auto; }
.esx__pages.is-placing .pdfpage__layer { cursor: copy; }
.esx__pages.is-erasing .pdfpage__layer { cursor: crosshair; }
.esx__side .portal-card + .portal-card { margin-top: 1rem; }
@media (min-width: 1200px) { .esx__side { position: sticky; top: 1rem; } }
.esx__sum { list-style: none; margin: 0 0 .75rem; padding: 0; font-size: .88rem; }
.esx__sum li { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.esx-item { position: absolute; box-sizing: border-box; border: 1.5px solid; border-radius: 3px; display: flex; align-items: center; overflow: hidden; cursor: move; touch-action: none; font-size: clamp(.55rem, 1.1vw, .75rem); font-weight: 700; }
.esx-item:focus-visible { outline: 3px solid var(--focus, #2563eb); outline-offset: 1px; }
.esx-item__lbl { padding: 0 .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.esx-item--sig { background: rgb(255 214 74 / .55); border-color: #b58a00; color: #5c4600; }
.esx-item--auto { background: rgb(120 170 240 / .35); border-color: #2f6fc4; color: #173e73; }
.esx-item--input { background: rgb(110 200 140 / .35); border-color: #2c8a4e; color: #1a5130; }
.esx-item--erase { background: #fff; border: 1.5px dashed #c0392b; cursor: move; }
.esx-item--erase.is-drawing { background: rgb(255 255 255 / .85); }
.esx-item--text { background: rgb(255 255 255 / .01); border: 1.5px dashed #7a5bc7; align-items: flex-start; cursor: move; }
.esx-item__text { display: block; width: 100%; min-height: 100%; padding: 0 2px; color: #000; font-family: Helvetica, Arial, sans-serif; font-weight: 400; line-height: 1.2; white-space: pre-wrap; outline: none; cursor: text; user-select: text; }
.esx-item.is-selected { box-shadow: 0 0 0 2px var(--navy-900), 0 4px 14px rgb(11 31 58 / .25); z-index: 2; }
.esx-item__rs { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: var(--navy-900); border-top-left-radius: 4px; cursor: nwse-resize; opacity: 0; }
.esx-item.is-selected .esx-item__rs, .esx-item:hover .esx-item__rs { opacity: 1; }
.esx-ghost { position: fixed; z-index: 1000; transform: translate(-50%, -50%); pointer-events: none; padding: .4rem .7rem; border: 1.5px solid; border-radius: 4px; font-size: .78rem; font-weight: 700; box-shadow: 0 8px 22px rgb(0 0 0 / .2); }
.esx-done { max-width: 44rem; }

/* ---------- In-console PDF viewer ---------- */
.modal--wide { width: min(64rem, 100%); max-height: 94vh; padding: 0; display: flex; flex-direction: column; }
.viewer { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.viewer__bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: var(--white); position: sticky; top: 0; z-index: 2; }
.viewer__pages { padding: 1.25rem; background: #e9edf3; overflow-y: auto; }
.viewer__pages .pdfpage { max-width: 900px; }

/* ---------- Signer page fields ---------- */
.sdoc { background: #e9edf3; border-radius: var(--radius-lg); padding: clamp(.5rem, 2vw, 1.25rem); }
.sfield { position: absolute; box-sizing: border-box; border: 2px solid; border-radius: 3px; display: flex; align-items: center; justify-content: center; padding: 0; font: inherit; font-size: clamp(.55rem, 1.6vw, .8rem); font-weight: 700; line-height: 1.1; cursor: pointer; overflow: hidden; }
.sfield--sig { background: rgb(255 214 74 / .6); border-color: #b58a00; color: #4d3a00; }
.sfield--sig.is-done { background: rgb(255 255 255 / .2); border-color: #2c8a4e; border-style: dashed; }
.sfield--sig img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sfield--auto { background: rgb(227 239 253 / .7); border-color: #9cbbe4; color: #0b1f3a; font-weight: 600; justify-content: flex-start; padding: 0 .2rem; cursor: default; }
.sfield--text { background: rgb(231 246 236 / .9); border-color: #2c8a4e; padding: 0 .2rem; font-weight: 500; color: #0b1f3a; cursor: text; text-align: left; }
.sfield--text:focus { outline: 3px solid var(--focus, #2563eb); }
.sfield--check { background: rgb(231 246 236 / .9); border-color: #2c8a4e; }
.sfield--check input { width: 100%; height: 100%; margin: 0; accent-color: var(--navy-900); cursor: pointer; }
.sfield.is-missing { animation: sfpulse 1.2s ease-in-out 2; }
@keyframes sfpulse { 50% { box-shadow: 0 0 0 4px rgb(192 57 43 / .45); } }
@media (prefers-reduced-motion: reduce) { .sfield.is-missing { animation: none; box-shadow: 0 0 0 3px rgb(192 57 43 / .5); } }
.sguide { position: sticky; top: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; justify-content: space-between; padding: .65rem .9rem; margin-bottom: 1rem; background: var(--navy-900); color: var(--white); border-radius: var(--radius); }
.sguide strong { font-size: .92rem; }
.sguide .btn { min-height: 2.4rem; }
.btn--gold-solid { background: var(--gold, #c8a45d); color: var(--navy-950, #07162b); border: 0; font-weight: 700; }
.adopt .tabs { margin-bottom: .75rem; }
.adopt .sigpad canvas { height: 9.5rem; }
.adopt--initials .sigpad canvas { height: 7rem; }
.adopt { border: 0; padding: 1.5rem; box-shadow: 0 20px 60px rgb(0 0 0 / .3); } .adopt::backdrop { background: rgb(7 22 43 / .55); }
.esx [hidden] { display: none !important; }
@media (max-width: 1199.98px) {
  .esx__tools { display: flex; gap: .4rem; overflow-x: auto; padding: .5rem; scrollbar-width: thin; }
  .esx__h { display: none; }
  .esx__toolgrid { display: flex; gap: .4rem; flex: none; }
  .esx__tool { width: auto; white-space: nowrap; flex: none; font-size: .8rem; min-height: 2.6rem; }
}
.esx-item__text:empty::before { content: attr(data-ph); color: #8a7bb0; }
.portal [hidden] { display: none !important; }
@media (max-width: 1199.98px) { .esx { display: flex; flex-direction: column; align-items: stretch; } }

/* =====================================================================
   App shell: fixed top bar + fixed sidebar; only the content area scrolls.
   Used by the admin console and the client portal.
   ===================================================================== */
body.app-shell { height: 100vh; height: 100dvh; overflow: hidden; background: #f5f7fa; }
body.app-shell .portal-top { position: fixed; inset: 0 0 auto 0; height: 4rem; box-shadow: 0 1px 0 var(--line); border-bottom: 0; }
body.app-shell .portal-top__inner { height: 4rem; min-height: 0; }
.nav-toggle { display: none; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); color: var(--navy-900); cursor: pointer; }
.nav-toggle svg { width: 1.3rem; height: 1.3rem; }
.portal-top__left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
body.app-shell .console { position: fixed; top: 4rem; left: 0; right: 0; bottom: 0; min-height: 0; display: grid; grid-template-columns: 16rem minmax(0, 1fr); }
body.app-shell .console__nav { overflow-y: auto; padding: 1.25rem .85rem; display: flex; flex-direction: column; gap: .25rem; border-right: 1px solid rgb(255 255 255 / .04); }
body.app-shell .console__nav ul { flex-direction: column; flex-wrap: nowrap; gap: .15rem; }
body.app-shell .console__nav-title { display: block; }
body.app-shell .console__nav a { min-height: 2.6rem; font-size: .92rem; border-radius: 8px; }
body.app-shell .console__nav a[aria-current="page"] { background: rgb(255 255 255 / .09); box-shadow: inset 3px 0 0 var(--gold); }
.console__nav-foot { margin-top: auto; padding: 1rem .85rem .25rem; font-size: .75rem; color: var(--on-dark-muted); border-top: 1px solid rgb(255 255 255 / .08); }
body.app-shell .console__content { overflow-y: auto; overscroll-behavior: contain; padding: clamp(1.25rem, 1rem + 1.5vw, 2.5rem) clamp(1rem, 2.5vw, 2.75rem) 4rem; scroll-padding-top: 1rem; }
body.app-shell .console__content > * { max-width: 88rem; margin-inline: auto; }
body.app-shell .links-panel { top: 0; }
.nav-backdrop { display: none; }
@media (max-width: 959.98px) {
  .nav-toggle { display: inline-flex; }
  body.app-shell .console { grid-template-columns: minmax(0, 1fr); }
  body.app-shell .console__nav { position: fixed; top: 4rem; bottom: 0; left: 0; width: min(17rem, 82vw); z-index: 60; transform: translateX(-102%); transition: transform .22s ease, visibility .22s; visibility: hidden; }
  body.app-shell .console.nav-open .console__nav { box-shadow: 10px 0 30px rgb(0 0 0 / .25); visibility: visible; }
  body.app-shell .console.nav-open .console__nav { transform: none; }
  body.app-shell .console.nav-open .nav-backdrop { display: block; position: fixed; inset: 4rem 0 0 0; background: rgb(7 22 43 / .4); z-index: 55; }
  body.app-shell .portal-top__right #topbar-email { display: none; }
}
@media (prefers-reduced-motion: reduce) { body.app-shell .console__nav { transition: none; } }

/* Cleaner surfaces */
body.app-shell .portal-card { border-color: #e6e9ef; border-radius: 14px; box-shadow: 0 1px 2px rgb(16 24 40 / .04); }
body.app-shell .kpi { border-color: #e6e9ef; border-radius: 14px; box-shadow: 0 1px 2px rgb(16 24 40 / .04); }
body.app-shell .table-wrap { border-color: #e6e9ef; border-radius: 14px; }
body.app-shell .console__head { margin-bottom: 1.5rem; }
body.app-shell .console__head h1 { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); letter-spacing: -.01em; }
body.app-shell .portal-h2 { font-size: 1.2rem; }

/* Tabs bar used in detail pages */
.subtabs { display: flex; gap: .25rem; border-bottom: 1px solid #e3e7ee; margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: thin; }
.subtabs a { padding: .7rem .95rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.subtabs a[aria-current="page"] { color: var(--navy-900); border-bottom-color: var(--gold); }
.crumbs { font-size: .85rem; margin-bottom: .35rem; }
.crumbs a { color: var(--muted); }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.co-card { display: block; text-decoration: none; color: inherit; background: var(--white); border: 1px solid #e6e9ef; border-radius: 14px; padding: 1.2rem 1.25rem; transition: border-color .15s, box-shadow .15s; }
a.co-card:hover { border-color: var(--navy-800); box-shadow: 0 6px 18px rgb(11 31 58 / .08); }
.co-card h3 { font-size: 1.05rem; margin: 0 0 .25rem; color: var(--navy-900); }
.co-card .meta { font-size: .85rem; color: var(--muted); }
.co-card .row { display: flex; justify-content: space-between; gap: .5rem; margin-top: .75rem; font-size: .85rem; }
.pill { display: inline-flex; align-items: center; padding: .1rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 600; background: #eef2f7; color: #334155; white-space: nowrap; }
.pill--formation { background: #eaf1fb; color: #1d4e89; }
.pill--tax_return { background: #fbf3e2; color: #7a5a12; }
.pill--report { background: #e9f6ee; color: #1e6b3a; }
.pill--uploaded { background: #f1ecfa; color: #5b3f8c; }
.pill--overdue { background: #fbecea; color: #8a2a20; }
.pill--soon { background: #fbf3e2; color: #7a5a12; }
.pill--done { background: #e9f6ee; color: #1e6b3a; }
.doclist { list-style: none; margin: 0; padding: 0; }
.doclist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .85rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid #eef1f5; }
.doclist li:last-child { border-bottom: 0; }
.doclist .ficon { width: 2.4rem; height: 2.4rem; border-radius: 10px; display: grid; place-items: center; background: #eef2f7; color: var(--navy-900); font-size: .7rem; font-weight: 800; }
.doclist .dname { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.doclist .dmeta { font-size: .82rem; color: var(--muted); }
.deadline { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) auto; gap: .9rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid #eef1f5; }
.deadline:last-child { border-bottom: 0; }
.deadline__date { text-align: center; border-radius: 10px; background: #f3f5f9; padding: .35rem 0; line-height: 1.1; }
.deadline__date b { display: block; font-size: 1.25rem; color: var(--navy-900); }
.deadline__date span { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); margin-bottom: .35rem; font-size: 1.05rem; }
.upload-zone { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.5rem; border: 2px dashed #b8c1cf; border-radius: 14px; background: #fafbfd; text-align: center; cursor: pointer; }
.upload-zone:hover, .upload-zone.is-over { border-color: var(--navy-900); background: #f3f6fb; }
.upload-zone:focus-within { outline: 3px solid var(--focus, #2563eb); outline-offset: 2px; }
.qbo-badge { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; color: #2ca01c; }
.qbo-badge::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #2ca01c; }
.choice { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.choice a { display: flex; flex-direction: column; gap: .4rem; padding: 1.5rem; border: 1.5px solid #e3e7ee; border-radius: 16px; background: var(--white); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.choice a:hover, .choice a:focus-visible { border-color: var(--navy-900); box-shadow: 0 8px 24px rgb(11 31 58 / .1); }
.choice .choice__ico { width: 3rem; height: 3rem; border-radius: 12px; display: grid; place-items: center; background: var(--navy-900); color: var(--gold); margin-bottom: .4rem; }
.choice .choice__ico svg { width: 1.5rem; height: 1.5rem; }
.choice strong { font-size: 1.15rem; color: var(--navy-900); }
.choice span { color: var(--muted); font-size: .92rem; }
.portal-btn-row select, .subtabs + * select.inline { min-height: 2.25rem; border: 1px solid #c9ced8; border-radius: 8px; padding: 0 .5rem; background: #fff; font: inherit; font-size: .88rem; }
.mfa-steps { margin: .75rem 0 1rem; padding-left: 1.3rem; display: grid; gap: .55rem; font-size: .93rem; color: var(--ink); }
.mfa-steps li::marker { font-weight: 700; color: var(--navy-900); }

/* ---------- Signature editor: fixed side panels, only the document scrolls (desktop) ---------- */
.esx-pagebar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; max-width: 860px; margin: 0 auto .45rem; font-size: .8rem; font-weight: 600; color: #475569; }
.esx-pagebar__btns { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.esx-pagebar button { min-height: 2rem; min-width: 2rem; padding: 0 .55rem; border: 1px solid #cfd6e1; border-radius: 7px; background: #fff; color: var(--navy-900); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; }
.esx-pagebar button:hover:not(:disabled) { border-color: var(--navy-900); }
.esx-pagebar button:disabled { opacity: .4; cursor: not-allowed; }
.esx-pagebar button.is-danger { color: var(--error); border-color: #e7b4ae; }
@media (min-width: 1100px) {
  body.app-shell .console__content.is-editor { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 1rem; }
  body.app-shell .console__content.is-editor > * { max-width: none; width: 100%; }
  body.app-shell .console__content.is-editor > .console__head { flex: none; margin-bottom: 1rem; }
  .is-editor .esx { display: grid; flex: 1; min-height: 0; grid-template-columns: 12.5rem minmax(0, 1fr) 18rem; align-items: stretch; }
  .is-editor .esx__tools { position: static; height: 100%; max-height: none; overflow-y: auto; box-shadow: none; display: block; padding: .9rem; }
  .is-editor .esx__tools .esx__h { display: block; }
  .is-editor .esx__toolgrid { display: grid; grid-template-columns: minmax(0, 1fr); }
  .is-editor .esx__tool { width: 100%; white-space: normal; font-size: .86rem; }
  .is-editor .esx__hint { display: block; }
  .is-editor .esx__stage { height: 100%; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .is-editor .esx__side { position: static; height: 100%; overflow-y: auto; padding-right: 2px; }
  .is-editor .esx__drop { min-height: calc(100% - .5rem); }
}
@media (min-width: 1100px) and (max-width: 1299.98px) { .is-editor .esx { grid-template-columns: 11rem minmax(0, 1fr) 16rem; } }
.pdfpage { container-type: inline-size; }
.pdfpage__envid { position: absolute; color: #5a5a66; font-family: Helvetica, Arial, sans-serif; line-height: 1; white-space: nowrap; pointer-events: none; user-select: none; }
