:root {
    --ink: #1b2430;
    --muted: #5b6675;
    --line: #dfe3e8;
    --bg: #f3f5f8;
    --card: #ffffff;
    --brand: #1f3b63;
    --brand-2: #2c5282;
    --ok: #17804a;
    --ok-bg: #e7f6ee;
    --warn: #9a5b00;
    --warn-bg: #fff4e0;
    --bad: #b42318;
    --bad-bg: #fdecea;
    --radius: 12px;
    color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
.hidden { display: none !important; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wide { max-width: 1180px; }

/* header */
.top { background: var(--brand); color: #fff; padding: 18px 0 16px; }
.top .org { font-weight: 700; font-size: 19px; letter-spacing: .2px; }
.top .doc { opacity: .85; font-size: 14px; margin-top: 2px; }
.top .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
h2 { font-size: 18px; margin: 0 0 14px; }
h3 { font-size: 15px; margin: 0 0 10px; }
.sub { color: var(--muted); font-size: 14px; margin: -8px 0 16px; }

/* steps */
.steps { display: flex; gap: 6px; margin: 16px 0 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.steps span { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; }
.steps span.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* form fields */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
label.f { display: block; font-size: 14px; font-weight: 600; }
label.f > span.hint { font-weight: 400; color: var(--muted); }
input[type=text], input[type=tel], input[type=password], input[type=search], textarea, select {
    width: 100%;
    margin-top: 6px;
    padding: 11px 12px;
    font: inherit;
    color: inherit;
    background: #fff;
    border: 1px solid #c9d0d8;
    border-radius: 8px;
}
textarea { min-height: 78px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #9db8dd; outline-offset: 0; border-color: var(--brand-2); }
input:disabled, textarea:disabled { background: #f1f3f6; color: #444; }
.err { color: var(--bad); font-size: 13px; font-weight: 500; margin-top: 4px; min-height: 0; }
.invalid input, .invalid textarea { border-color: var(--bad); }
.mobile { display: flex; align-items: stretch; margin-top: 6px; }
.mobile .cc { display: flex; align-items: center; padding: 0 10px; border: 1px solid #c9d0d8; border-right: 0; border-radius: 8px 0 0 8px; background: #f1f3f6; color: var(--muted); }
.mobile input { margin-top: 0; border-radius: 0 8px 8px 0; }
.seg { display: inline-flex; margin-top: 6px; border: 1px solid #c9d0d8; border-radius: 8px; overflow: hidden; }
.seg label { padding: 10px 16px; cursor: pointer; font-weight: 600; border-right: 1px solid #c9d0d8; user-select: none; }
.seg label:last-child { border-right: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--brand); color: #fff; }
.relrow { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; }

/* the undertaking text */
.doctext { font-family: Georgia, "Times New Roman", serif; font-size: 16px; line-height: 1.6; }
.doctext .ttl { text-align: center; font-weight: 700; text-decoration: underline; font-size: 18px; margin: 0; }
.doctext .subttl { text-align: center; font-weight: 700; text-decoration: underline; font-size: 12.5px; margin: 6px 0 20px; }
.doctext p { text-align: justify; margin: 0 0 12px; }
.doctext .fill { font-weight: 700; border-bottom: 1px solid currentColor; }
.doctext .blank { color: #a0a8b3; font-weight: 400; border-bottom: 1px solid #a0a8b3; }
.doctext h4 { margin: 18px 0 6px; font-size: 16px; }
.doctext h4 u { text-underline-offset: 3px; }
.doctext .it { display: grid; grid-template-columns: 34px 1fr; margin-bottom: 8px; }
.doctext .it p { margin: 0; }
.doctext .lead { margin: 6px 0 4px; }
.doctext .li { display: grid; grid-template-columns: 22px 1fr; margin: 0 0 4px 14px; }
.doctext .key { background: #fff8e6; border-left: 3px solid #e0a100; padding: 2px 8px; }
.sub.after { margin: 16px 0 0; }
.scrollhint { font-size: 13px; color: var(--muted); margin: -6px 0 12px; }

/* consent + otp */
.check { display: grid; grid-template-columns: 26px 1fr; gap: 6px; align-items: start; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); }
button {
    font: inherit;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid #c9d0d8;
    background: #fff;
    color: var(--ink);
    padding: 10px 16px;
    cursor: pointer;
}
button:hover { background: #f5f7fa; }
button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.primary:hover { background: var(--brand-2); }
button:disabled { opacity: .55; cursor: not-allowed; }
button.link { border: 0; background: none; color: var(--brand-2); padding: 6px 4px; text-decoration: underline; }
button.small { padding: 6px 10px; font-size: 13px; }
button.danger { color: var(--bad); }
.big { width: 100%; padding: 14px; font-size: 17px; margin-top: 16px; }
.otprow { display: flex; gap: 10px; margin-top: 10px; }
.otprow input { margin: 0; font-size: 22px; letter-spacing: 6px; text-align: center; max-width: 200px; }
.otprow button { white-space: nowrap; }
.msg { margin: 12px 0 0; font-size: 14px; }
.msg.bad { color: var(--bad); }
.msg.ok { color: var(--ok); }
.note { background: #eef3fa; border-radius: 8px; padding: 10px 12px; font-size: 14px; margin-top: 14px; }
.links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* done */
.done { text-align: center; padding: 32px 20px; }
.done .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg); color: var(--ok); font-size: 36px; line-height: 64px; margin: 0 auto 12px; }
.done dl { display: inline-grid; grid-template-columns: auto auto; gap: 4px 14px; text-align: left; margin: 14px auto; }
.done dt { color: var(--muted); }
.done dd { margin: 0; font-weight: 600; }
a.btn { display: inline-block; text-decoration: none; background: var(--brand); color: #fff; padding: 12px 20px; border-radius: 8px; font-weight: 600; margin-top: 8px; }
.foot { color: var(--muted); font-size: 12.5px; padding: 8px 16px 32px; text-align: center; }

/* ---- admin ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.on { background: var(--ok-bg); color: var(--ok); }
.pill.off { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.top .pill.on { background: #d8f3e3; }
.tabs { display: flex; gap: 8px; margin: 16px 0 0; flex-wrap: wrap; }
.tabs button { border-radius: 99px; }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs .n { font-weight: 500; opacity: .8; margin-left: 4px; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; }
.stat { flex: 1 1 120px; background: var(--bg); border-radius: 10px; padding: 10px 14px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linkbox input { flex: 1 1 260px; margin: 0; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.addgrid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 0.8fr 1fr auto; gap: 10px; align-items: end; }
.addgrid label.f { font-size: 13px; }
@media (max-width: 900px) { .addgrid { grid-template-columns: 1fr 1fr; } .addgrid button { grid-column: 1 / -1; } }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td .sm { color: var(--muted); font-size: 12.5px; }
td.actions { white-space: nowrap; }
td.actions button { margin: 0 4px 4px 0; }
.status { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status.signed { background: var(--ok-bg); color: var(--ok); }
.status.opened { background: var(--warn-bg); color: var(--warn); }
.status.new { background: #eef0f3; color: var(--muted); }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.toolbar input[type=search] { max-width: 280px; margin: 0; }
.gw { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 18px; font-size: 14px; }
.gw dt { color: var(--muted); font-size: 12.5px; }
.gw dd { margin: 0; font-weight: 600; }
.paircode { font-size: 34px; letter-spacing: 8px; font-weight: 700; font-family: ui-monospace, Menlo, monospace; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1b2430; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; z-index: 10; max-width: calc(100% - 32px); }
.login { max-width: 380px; margin: 64px auto; }
h3.gap { margin-top: 18px; }
.links input.testin { max-width: 220px; margin: 0; }
.links .msg { margin: 0; align-self: center; }
.top .row > .row { gap: 10px; }
details.help summary { cursor: pointer; color: var(--brand-2); font-weight: 600; }
details.help ol { padding-left: 20px; margin: 8px 0 0; font-size: 14px; }
a.btn.big.center { display: block; text-align: center; font-size: 18px; padding: 16px; }
.steps-list { padding-left: 20px; margin: 0; }
.steps-list li { margin-bottom: 10px; }
