:root {
  --brand: #16325c;
  --brand-2: #1f4e8c;
  --accent: #2563eb;
  --bg: #f3f5f9;
  --card: #ffffff;
  --text: #17202e;
  --muted: #5f6b7d;
  --line: #dfe4ec;
  --line-2: #eef1f6;
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #b45309;
  --warn-bg: #fdf3e2;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  --info-bg: #e8effc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 14px; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff; }
.topbar-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 6px; padding: 0 16px; height: 56px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; color: #fff; margin-right: 14px; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo svg { flex: none; }
.nav a { color: #c9d6ea; padding: 8px 12px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255, 255, 255, .14); }
.nav { display: flex; gap: 2px; }
.usermenu { margin-left: auto; position: relative; }
.usermenu > button { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 999px; padding: 6px 12px 6px 6px; display: flex; align-items: center; gap: 8px; font: inherit; cursor: pointer; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--brand); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; color: var(--text); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); min-width: 200px; padding: 6px; display: none; }
.dropdown.open { display: block; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--bg); text-decoration: none; }
.dropdown .who { padding: 8px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-toggle { display: none; background: none; border: 0; color: #fff; padding: 8px; cursor: pointer; }
.mobile-nav { display: none; }

/* ---------- layout ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 22px 16px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 14px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 9px 14px; border-radius: 8px; font: 500 14px var(--font); cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--bg); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn-primary:hover { background: var(--brand); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ok:hover { background: #116a32; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 5px 10px; min-height: 30px; font-size: 13px; }
.btn-lg { padding: 12px 20px; font-size: 15px; min-height: 46px; }
.btn-block { width: 100%; }
.icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 6px; font-size: 16px; line-height: 1; }
.icon-btn:hover { background: var(--bad-bg); color: var(--bad); }

label.flabel, .flabel { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.req { color: var(--bad); }
.help { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: 15px var(--font); color: var(--text); background: #fff; border: 1px solid #cbd3df; border-radius: 8px; padding: 9px 11px; min-height: 40px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
input:disabled, select:disabled, textarea:disabled { background: #f6f7f9; color: #444; }
.search { position: relative; }
.search input { padding-left: 34px; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }

/* segmented radio / chips */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border: 1px solid #cbd3df; border-radius: 8px; background: #fff; font-size: 14px; user-select: none; min-height: 38px; }
.seg label:hover span { border-color: var(--accent); }
.seg input:checked + span { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.seg input:focus-visible + span { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.seg input:disabled + span { cursor: default; opacity: .75; }
.seg.checks input:checked + span::before { content: "✓"; font-weight: 700; }
.seg.yn input[value=Yes]:checked + span { background: var(--ok); border-color: var(--ok); }
.seg.yn input[value=No]:checked + span { background: var(--bad); border-color: var(--bad); }
.seg.yn input[value="N/A"]:checked + span { background: #64748b; border-color: #64748b; }
.seg.compact span { padding: 5px 10px; min-height: 32px; font-size: 13px; }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.badge.draft { background: var(--warn-bg); color: var(--warn); }
.badge.complete { background: var(--info-bg); color: var(--brand-2); }
.badge.issued { background: var(--ok-bg); color: var(--ok); }
.badge.none { background: var(--line-2); color: var(--muted); }
.sys { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.status-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2ff; color: #3730a3; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #f7f9fd; }
.table-wrap { overflow-x: auto; }

/* ---------- filters ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters .search { flex: 1; min-width: 220px; }
.filters select { width: auto; }

/* ---------- job page ---------- */
.job-head { padding: 18px; display: flex; gap: 18px; flex-wrap: wrap; }
.job-head .meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 22px; flex: 1; }
.kv .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kv .v { margin-top: 2px; white-space: pre-line; }
.pack { margin-bottom: 18px; }
.pack-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pack-head .progress { margin-left: auto; font-size: 13px; color: var(--muted); }
.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.doc-row:last-child { border-bottom: 0; }
.doc-row .num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--muted); font-size: 12px; font-weight: 700; flex: none; }
.doc-row .num.done { background: var(--ok); color: #fff; }
.doc-row .num.part { background: var(--warn-bg); color: var(--warn); }
.doc-row .title { font-weight: 600; }
.doc-row .desc { font-size: 13px; color: var(--muted); }
.doc-row .grow { flex: 1; min-width: 0; }
.doc-row .instances { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.doc-row .instances a { font-size: 13px; display: inline-flex; gap: 8px; align-items: center; }
.activity { list-style: none; margin: 0; padding: 6px 0; }
.activity li { padding: 8px 18px; font-size: 13.5px; border-bottom: 1px solid var(--line-2); }
.activity li:last-child { border-bottom: 0; }
.activity time { display: block; color: var(--muted); font-size: 12px; }

/* ---------- editor ---------- */
.doc-bar { position: sticky; top: 56px; z-index: 10; background: var(--bg); padding: 12px 0; margin: -22px 0 16px; border-bottom: 1px solid var(--line); }
.doc-bar .row { gap: 8px; }
.doc-bar h1 { font-size: 19px; }
.save-state { font-size: 13px; color: var(--muted); min-width: 80px; }
.save-state.saving { color: var(--warn); }
.save-state.error { color: var(--bad); font-weight: 600; }
.editor { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; align-items: start; }
.editor > * { min-width: 0; }
.steps { position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow: auto; padding: 8px; }
.steps-head { padding: 8px 10px 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; display: flex; justify-content: space-between; }
.step { display: flex; align-items: center; gap: 4px; border-radius: 8px; }
.step:hover { background: var(--bg); }
.step.active { background: var(--info-bg); }
.step .inc { width: 30px; display: grid; place-items: center; flex: none; }
.step .inc input { width: 17px; height: 17px; accent-color: var(--brand-2); cursor: pointer; margin: 0; }
.step .inc .lock { font-size: 11px; color: #a0aec0; }
.step button { flex: 1; text-align: left; background: none; border: 0; padding: 9px 8px 9px 2px; font: 14px var(--font); color: var(--text); cursor: pointer; display: flex; align-items: center; gap: 8px; min-width: 0; }
.step.active button { font-weight: 600; color: var(--brand); }
.step.excluded button { color: #9aa5b5; text-decoration: line-through; }
.step .label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #cbd3df; flex: none; }
.dot.filled { background: var(--ok); border-color: var(--ok); }
.dot.missing { background: var(--warn); border-color: var(--warn); }
.pane { padding: 22px 24px; min-height: 400px; }
.pane-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.pane-head .n { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.pane-head h2 { font-size: 20px; margin-top: 2px; }
.pane-head .desc { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.include-toggle { margin-left: auto; display: flex; align-items: center; gap: 9px; background: var(--bg); border: 1px solid var(--line); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.include-toggle input { width: 18px; height: 18px; accent-color: var(--brand-2); margin: 0; }
.excluded-note { background: var(--line-2); border-radius: 8px; padding: 14px; color: var(--muted); margin-bottom: 16px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.field { grid-column: 1 / -1; min-width: 0; }
.field.half { grid-column: span 1; }
.field.info { background: var(--info-bg); padding: 12px 14px; border-radius: 8px; font-size: 14px; color: #1e3a6b; }
.fields.disabled { opacity: .55; pointer-events: none; }
.pane-foot { display: flex; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); }
.pane-foot .next { margin-left: auto; }
.pane-foot .mt { display: none; }
.locked-banner { background: var(--ok-bg); border: 1px solid #b7e2c4; color: #14532d; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.mobile-steps { display: none; }
.carried { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: #e8f3ee; color: #17663a; font-size: 11.5px; font-weight: 600; vertical-align: 1px; }
.carry-banner { background: #eef7f2; border: 1px solid #c5e5d2; color: #14532d; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.carry-banner > div { flex: 1; }
.carry-banner .icon-btn:hover { background: #d7eee1; color: #14532d; }

/* table field */
.tfield { border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; }
.tfield table { width: 100%; border-collapse: collapse; min-width: 560px; }
.tfield th { background: #fafbfd; font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tfield td { padding: 4px; border-bottom: 1px solid var(--line-2); }
.tfield td input, .tfield td select { min-height: 36px; padding: 6px 8px; font-size: 14px; border-color: #e3e8ef; background: #fff; }
.tfield td input:hover, .tfield td select:hover { border-color: #b9c3d1; }
.tfield td input:focus, .tfield td select:focus { background: #fff; }
.tfield td.x { width: 34px; text-align: center; }
.tfield .add-row { padding: 6px; }

/* checklist field */
.clist { border: 1px solid var(--line); border-radius: 8px; }
.clist-head { display: flex; align-items: center; padding: 8px 12px; background: #fafbfd; border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; gap: 8px; font-size: 13px; color: var(--muted); }
.citem { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.citem:last-child { border-bottom: 0; }
.citem .ctext { font-size: 14px; }
.citem .ccomment { grid-column: 1 / -1; display: none; }
.citem.has-comment .ccomment, .citem.show-comment .ccomment { display: block; }
.citem .ccomment input { min-height: 34px; font-size: 13.5px; padding: 6px 9px; }
.citem .cside { display: flex; gap: 6px; align-items: center; }

/* signature */
.sigbox { border: 1px dashed #aab4c3; border-radius: 8px; background: #fff; position: relative; height: 170px; touch-action: none; }
.sigbox canvas { width: 100%; height: 100%; display: block; cursor: crosshair; }
.sigbox .hint { position: absolute; left: 14px; bottom: 10px; color: #aab4c3; font-size: 13px; pointer-events: none; }
.sigbox img { max-height: 150px; max-width: 100%; display: block; margin: 10px; }
.sigline { position: absolute; left: 14px; right: 14px; bottom: 34px; border-bottom: 1px solid #e3e8ef; pointer-events: none; }

/* images */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.imgs .tile { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; position: relative; }
.imgs .tile img { width: 100%; height: 120px; object-fit: cover; display: block; }
.imgs .tile input { border: 0; border-top: 1px solid var(--line); border-radius: 0; font-size: 13px; min-height: 34px; }
.imgs .tile .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(255, 255, 255, .9); }
.imgs .add { border: 2px dashed #cbd3df; border-radius: 8px; display: grid; place-items: center; min-height: 154px; color: var(--muted); cursor: pointer; text-align: center; font-size: 14px; }
.imgs .add:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- modal & toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: grid; place-items: center; padding: 16px; z-index: 100; animation: fade .12s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal.wide { max-width: 760px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.modal-head .icon-btn:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.picker button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; }
.picker button:hover { border-color: var(--accent); background: #f7f9fd; }
.picker button .t { font-weight: 600; }
.picker button .d { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 200; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); font-size: 14px; animation: fade .15s; max-width: calc(100vw - 32px); }
.toast.error { background: var(--bad); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #16325c 0%, #1f4e8c 55%, #f3f5f9 55.1%); }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .18); padding: 30px; }
.auth-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-card .brand .mark { width: 44px; height: 44px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; }
.auth-card .stack > * + * { margin-top: 14px; }
.auth-card .error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 8px; font-size: 14px; }

/* seats & owner dashboard */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-click { cursor: pointer; }
.stat-click:hover { border-color: var(--accent); }
.badge.trial-ended { background: var(--bad-bg); color: var(--bad); }
.trial-banner { background: var(--info-bg); border: 1px solid #c7d7f5; color: #1e3a6b; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.trial-banner.ended { background: var(--bad-bg); border-color: #f2c4c4; color: #7f1d1d; }
.trial-banner > div:first-child { flex: 1; min-width: 220px; }
.trial-banner .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sub-trial { background: var(--info-bg); color: #1e3a6b; text-align: center; padding: 8px 16px; font-size: 14px; }
.stat { padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; color: var(--brand); }
.seatbar { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.seatbar span { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; }
.seatbar.full span { background: var(--warn); }
.seatbar.over span { background: var(--bad); }
.seat-card { margin-bottom: 16px; }
.seat-num { font-size: 22px; font-weight: 700; color: var(--brand); }
.seat-num span { font-size: 14px; font-weight: 500; color: var(--muted); }
.seat-full { background: var(--warn-bg); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; font-weight: 500; }
.stepper { display: flex; gap: 6px; }
.stepper input { text-align: center; font-weight: 600; font-size: 17px; }
.stepper .btn { width: 44px; font-size: 18px; flex: none; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }

/* ---- ThreeSixty FM layout (private design, copied from ThreeSixty's specification) ---- */
.paper.ts-paper { font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 11pt; line-height: 1.25; color: #000; padding: 7mm 19mm 10mm; }
.ts-frame { width: 100%; border-collapse: collapse; }
.ts-frame > thead > tr > td, .ts-frame > tbody > tr > td, .ts-frame > tfoot > tr > td { padding: 0; border: 0; }
.ts-head { display: flex; align-items: center; gap: 16mm; padding: 0 0 6mm; }
.ts-head img { height: 17mm; width: auto; max-width: 60mm; }
.ts-title { flex: 1; font-weight: 700; font-size: 11pt; }
.ts-draft { color: #b91c1c; font-weight: 700; }
.ts-paper table.ts-info, .ts-paper table.ts-kv, .ts-paper table.ts-grid { width: 100%; border-collapse: collapse; margin: 0 0 14px; font-size: 10.5pt; break-inside: avoid; }
.ts-paper table.ts-info { width: 93%; margin-bottom: 22px; }
.ts-paper .ts-info td, .ts-paper .ts-info th, .ts-paper .ts-kv td, .ts-paper .ts-grid td, .ts-paper .ts-grid th { border: 1px solid #000; padding: 1px 6px; vertical-align: top; text-align: left; font-weight: 400; }
.ts-paper tr.ts-y > td, .ts-paper tr.ts-y > th { background: #fdce11; font-weight: 700; }
.ts-paper .ts-info th { text-align: center; }
.ts-paper .ts-info td.ts-c { text-align: center; }
.ts-paper .ts-info td.ts-l { font-weight: 700; width: 50%; }
.ts-paper .ts-info td.ts-addr { height: 5.6em; }
.ts-paper .ts-kv td:first-child { width: 30%; }
.ts-paper .ts-grid .ts-res { width: 70px; text-align: center; }
.ts-sec h2 { font-size: 11pt; font-weight: 700; margin: 16px 0 7px; }
.ts-sec h3 { font-size: 11pt; font-weight: 700; margin: 10px 0 5px; }
.ts-sec p { margin: 0 0 9px; white-space: pre-line; }
.ts-sec .ts-desc { font-size: 10pt; }
.ts-sec ul { margin: 0 0 9px; padding-left: 30px; }
.ts-sec li { margin-bottom: 2px; }
.ts-sigimg { max-height: 42px; max-width: 200px; display: block; }
.ts-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ts-imgs figure { margin: 0; break-inside: avoid; }
.ts-imgs img { width: 100%; max-height: 160px; object-fit: contain; border: 1px solid #ccc; }
.ts-imgs figcaption { font-size: 9pt; }
.ts-footer { text-align: center; font-size: 10pt; white-space: pre-line; margin-top: 12mm; }
.ts-foot-space { height: 0; }
@media print {
  .paper.ts-paper { padding: 0 7mm; }
  /* header repeats via the table head; footer sits at the bottom of every printed page */
  .ts-footer { position: fixed; bottom: 0; left: 0; right: 0; margin: 0; }
  .ts-foot-space { height: 16mm; }
}

/* police.uk crime check */
.crime-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fafbfd; }
.crime-go { display: flex; gap: 8px; flex-wrap: wrap; }
.crime-go input { max-width: 170px; text-transform: uppercase; }
.crime-result { margin-top: 10px; }
.crime-head { display: flex; gap: 12px; align-items: center; }
.crime-rating { font-weight: 800; font-size: 15px; padding: 6px 12px; border-radius: 8px; color: #fff; }
.crime-low { background: var(--ok); }
.crime-medium { background: var(--warn); }
.crime-high { background: var(--bad); }
.crime-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; margin-top: 10px; }
.crime-facts div, .crime-breakdown div { display: flex; flex-direction: column; font-size: 13.5px; }
.crime-facts span { color: var(--muted); font-size: 12px; }
.crime-breakdown { margin-top: 8px; font-size: 13.5px; }
.crime-breakdown summary { cursor: pointer; color: var(--brand-2); }
.crime-breakdown div { flex-direction: row; justify-content: space-between; border-bottom: 1px solid var(--line-2); padding: 3px 0; max-width: 420px; }
.crime-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.crime-note { background: var(--warn-bg); color: #7c3a06; padding: 8px 12px; border-radius: 8px; font-size: 13.5px; }

/* "Other" text box under a choice */
.other-text { margin-top: 8px; }

/* record control: issued snapshots and archiving */
.frozen-note { font-size: 13px; color: #14532d; background: var(--ok-bg); border-radius: 99px; padding: 4px 12px; }
.archived-banner { background: var(--line-2); border: 1px solid var(--line); color: var(--text); padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.record-note { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }
.archived-list summary { padding: 14px 18px; cursor: pointer; font-weight: 600; color: var(--muted); }
.archived-list[open] summary { border-bottom: 1px solid var(--line); }
.archived-list a.doc-row { color: var(--text); }
.archived-list a.doc-row:hover { background: var(--bg); text-decoration: none; }

/* client contacts */
.contact-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.contact-row:last-child { border-bottom: 0; }
.contact-row .grow { flex: 1; min-width: 0; }
.contact-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 2px; }
.contact-pick { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.contact-pick select { min-height: 34px; padding: 5px 8px; font-size: 13.5px; background: var(--info-bg); border-color: #c7d6ef; }
.contact-pick span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* job types */
.type-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; vertical-align: 1px; }
.type-installation { background: #e0ecff; color: #1d4ed8; }
.type-maintenance { background: #fef3c7; color: #92400e; }
.job-type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 640px) { .job-type-pick { grid-template-columns: 1fr; } }

/* modules (billing) */
.mod-chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; margin-right: 4px; color: #fff; }
.mod-security { background: #1f4e8c; }
.mod-fire { background: #b91c1c; }
.mod-offline { background: #e8eef9; color: #1e3a6b; }
.module-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.module-opt { display: flex; gap: 10px; align-items: flex-start; border: 2px solid var(--line); border-radius: 10px; padding: 12px; cursor: pointer; }
.module-opt:has(input:checked) { border-color: var(--brand-2); background: #f5f8fd; }
.module-opt input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand-2); }
.module-opt b { display: block; }
.module-opt small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.price-summary { background: var(--info-bg); border-radius: 8px; padding: 10px 14px; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.price-grid label span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.pack.not-in-plan { opacity: .8; }
.plan-note { background: var(--warn-bg); color: #7c3a06; padding: 8px 18px; font-size: 13px; }
@media (max-width: 640px) { .module-pick, .price-grid { grid-template-columns: 1fr; } }

/* certification */
.cert-badge.cert-bafe { background: #fde8e8; color: #b91c1c; }
.cert-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; vertical-align: 1px; background: var(--line-2); color: var(--muted); }
.cert-badge.cert-ssaib { background: #e0ecff; color: #1d4ed8; }
.cert-badge.cert-nsi-gold { background: #fdf3d7; color: #8a6100; }
.cert-badge.cert-nsi-silver { background: #eceff3; color: #475569; }
.cert-note { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 13.5px; }

/* login details popup (new accounts / password resets) */
.login-details { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.login-details div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.login-details div:last-child { border-bottom: 0; background: var(--info-bg); }
.login-details span { color: var(--muted); font-size: 13.5px; }
.login-details b { word-break: break-all; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 15px; letter-spacing: .03em; }

/* settings: nav, document style, subscription */
.settings-nav { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.settings-nav button { padding: 6px 12px; border-radius: 99px; background: #fff; border: 1px solid var(--line); font: 13.5px var(--font); color: var(--text); cursor: pointer; }
.settings-nav button:hover { border-color: var(--accent); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-2); cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }
.design-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.design-card { text-align: left; border: 2px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 8px 10px; cursor: pointer; font: inherit; color: var(--text); }
.design-card:hover { border-color: #9fb3d1; }
.design-card.on { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(31, 78, 140, .15); }
.design-thumb { height: 170px; overflow: hidden; background: #e4e8ee; border-radius: 6px; padding: 6px; pointer-events: none; }
.thumb-zoom { zoom: .19; }
.thumb-zoom .paper { box-shadow: none; }
.design-name { font-weight: 700; margin-top: 8px; }
.design-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
@media (max-width: 1100px) { .design-picker { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .design-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.style-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; margin-top: 18px; align-items: start; }
.match-box { background: var(--bg); border: 1px dashed #b9c3d1; border-radius: 10px; padding: 14px; }
.match-result { display: flex; gap: 12px; margin-top: 12px; align-items: flex-start; font-size: 14px; }
.match-result img { width: 90px; border: 1px solid var(--line); border-radius: 4px; background: #fff; flex: none; }
.match-error { margin-top: 10px; background: var(--bad-bg); color: var(--bad); padding: 9px 12px; border-radius: 8px; font-size: 13.5px; }
.colour-input { width: 54px; height: 38px; padding: 2px; border: 1px solid #cbd3df; border-radius: 8px; background: #fff; cursor: pointer; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.swatches:empty { display: none; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd3df; cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
.style-preview { background: #e4e8ee; border-radius: 10px; padding: 14px; height: 640px; overflow: auto; position: sticky; top: 76px; }
.preview-zoom { zoom: .52; }
.preview-zoom .paper { box-shadow: 0 2px 12px rgba(0, 0, 0, .15); }
.sub-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-top: 14px; }
.danger-zone { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger-zone > div { flex: 1; min-width: 200px; }
.cancel-banner { background: var(--warn-bg); border: 1px solid #f1d39b; color: #7c3a06; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.cancel-banner > div { flex: 1; min-width: 220px; }
.sub-ending { background: var(--warn-bg); color: #7c3a06; text-align: center; padding: 8px 16px; font-size: 13.5px; border-bottom: 1px solid #f1d39b; }
@media (max-width: 960px) { .style-grid { grid-template-columns: 1fr; } .style-preview { position: static; height: 480px; } }

/* settings */
.logo-preview { max-height: 70px; max-width: 240px; border: 1px solid var(--line); border-radius: 6px; padding: 6px; background: #fff; }

/* ---------- print / preview ---------- */
.preview-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
/* Document output. Colours/fonts come from each company's Document style (Settings):
   --doc-primary (headings, rules), --doc-accent (light shading), --doc-text, plus classes
   font-*, hd-* (section headings), hdr-* (page header) and tbl-* (tables) on .paper. */
.paper { --doc-primary: #16325c; --doc-accent: #eef1f6; --doc-text: #111111; --doc-line: #d3d9e2;
  background: #fff; max-width: 210mm; margin: 0 auto; padding: 16mm 15mm; box-shadow: 0 4px 24px rgba(0, 0, 0, .12);
  color: var(--doc-text); font-size: 10.5pt; line-height: 1.4; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.paper.font-arial { font-family: Arial, Helvetica, sans-serif; }
.paper.font-calibri { font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; }
.paper.font-serif { font-family: Georgia, "Times New Roman", Times, serif; }
.paper.font-verdana { font-family: Verdana, Tahoma, sans-serif; font-size: 9.5pt; }

.p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 12px; border-bottom: 3px solid var(--doc-primary); }
.p-head img { max-height: 60px; max-width: 220px; }
.p-company { text-align: right; font-size: 9pt; color: #333; white-space: pre-line; }
.p-company .name { font-size: 13pt; font-weight: 700; color: var(--doc-primary); white-space: normal; }
.paper.hdr-logo-right .p-head { flex-direction: row-reverse; }
.paper.hdr-logo-right .p-company { text-align: left; }
.paper.hdr-centred .p-head { flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.paper.hdr-centred .p-company { text-align: center; }
.paper.hdr-banner .p-head { background: var(--doc-primary); color: #fff; border: 0; padding: 14px 18px; border-radius: 4px; align-items: center; }
.paper.hdr-banner .p-company, .paper.hdr-banner .p-company .name { color: #fff; }
.paper.hdr-banner .p-head img { background: #fff; padding: 4px; border-radius: 3px; }

.p-title { margin: 16px 0 6px; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.p-title h1 { font-size: 18pt; color: var(--doc-primary); }
.p-title .std { font-size: 9.5pt; color: #555; margin-top: 2px; }
.p-meta { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--doc-line); border-radius: 4px; margin: 10px 0 18px; font-size: 9pt; }
.p-meta div { padding: 6px 9px; border-right: 1px solid var(--doc-line); }
.p-meta div:last-child { border-right: 0; }
.p-meta b { display: block; font-size: 7.5pt; text-transform: uppercase; color: #667; letter-spacing: .04em; }
.p-sec { margin-bottom: 16px; break-inside: avoid-page; }
.p-sec h2 { font-size: 11.5pt; margin-bottom: 8px; }
.paper.hd-bar .p-sec h2 { background: var(--doc-primary); color: #fff; padding: 5px 9px; border-radius: 3px; }
.paper.hd-underline .p-sec h2 { color: var(--doc-primary); border-bottom: 2px solid var(--doc-primary); padding: 0 0 3px; }
.paper.hd-side .p-sec h2 { color: var(--doc-primary); border-left: 5px solid var(--doc-primary); background: var(--doc-accent); padding: 4px 9px; }
.paper.hd-plain .p-sec h2 { color: var(--doc-primary); font-size: 12.5pt; padding: 0; }
.p-sec .desc { font-size: 9pt; color: #555; margin: -2px 0 8px; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--doc-line); border-left: 1px solid var(--doc-line); }
.p-f { padding: 5px 8px; border-right: 1px solid var(--doc-line); border-bottom: 1px solid var(--doc-line); grid-column: 1 / -1; break-inside: avoid; }
.p-f.half { grid-column: span 1; }
.p-f .l { font-size: 8pt; color: #5a6475; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.p-f .v { white-space: pre-line; min-height: 1.3em; }
.p-f .v.blank { color: #aaa; }
.p-f.info { background: var(--doc-accent); font-size: 9.5pt; }
.p-table { width: 100%; border-collapse: collapse; font-size: 9pt; margin-top: 3px; }
.p-table th, .p-table td { border: 1px solid var(--doc-line); padding: 4px 6px; text-align: left; vertical-align: top; }
.p-table th { background: var(--doc-accent); font-size: 8pt; }
.paper.tbl-lines .p-grid, .paper.tbl-lines .p-f { border-left: 0; border-right: 0; }
.paper.tbl-lines .p-table th, .paper.tbl-lines .p-table td { border-left: 0; border-right: 0; }
.paper.tbl-lines .p-table th { background: none; border-bottom: 2px solid var(--doc-primary); color: var(--doc-primary); }
.paper.tbl-shaded .p-grid { border: 0; }
.paper.tbl-shaded .p-f { border: 0; border-bottom: 2px solid #fff; background: var(--doc-accent); }
.paper.tbl-shaded .p-f.half:nth-child(odd) { border-right: 2px solid #fff; }
.paper.tbl-shaded .p-table th { background: var(--doc-primary); color: #fff; border-color: var(--doc-primary); }
.paper.tbl-shaded .p-table td { border-color: #fff; }
.paper.tbl-shaded .p-table tr:nth-child(even) td { background: var(--doc-accent); }
.p-table td.r { white-space: nowrap; font-weight: 600; width: 50px; text-align: center; }
.p-table td.r.Yes { color: #15803d; }
.p-table td.r.No { color: #b91c1c; }
.p-sig { max-height: 60px; max-width: 220px; display: block; }
.p-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.p-imgs figure { margin: 0; break-inside: avoid; }
.p-imgs img { width: 100%; max-height: 160px; object-fit: contain; border: 1px solid #ddd; }
.p-imgs figcaption { font-size: 8pt; color: #555; }
.p-foot { margin-top: 20px; padding-top: 8px; border-top: 1px solid var(--doc-line); font-size: 8pt; color: #666; display: flex; justify-content: space-between; gap: 20px; }
.watermark { color: var(--bad); font-weight: 700; }

/* ---- Document designs: page structure only. Colours, fonts, headings, header and table
   options (hd-*, hdr-*, tbl-*, above) still apply on top of whichever design is chosen. ---- */
.p-f.t-table .v, .p-f.t-checklist .v, .p-f.t-images .v { border: 0; }

/* Modern: spacious, label/answer rows, no boxes */
.paper.design-modern { padding: 18mm 18mm; }
.design-modern .p-head { border-bottom-width: 1px; }
.design-modern .p-title { margin: 28px 0 4px; }
.design-modern .p-title h1 { font-size: 26pt; font-weight: 300; letter-spacing: -.01em; }
.design-modern .p-meta { border: 0; border-top: 1px solid var(--doc-line); border-bottom: 1px solid var(--doc-line); border-radius: 0; margin: 16px 0 28px; }
.design-modern .p-meta div { border: 0; padding: 9px 0; }
.design-modern .p-sec { margin-bottom: 28px; }
.design-modern .p-sec h2 { letter-spacing: .01em; margin-bottom: 8px; }
.design-modern .p-grid { border: 0; }
.design-modern .p-f { display: grid; grid-template-columns: 34% minmax(0, 1fr); gap: 14px; padding: 8px 0; border: 0; border-bottom: 1px solid var(--doc-line); grid-column: 1 / -1; }
.design-modern .p-f .l { text-transform: none; letter-spacing: 0; font-size: 9.5pt; font-weight: 500; color: #6b7280; }
.design-modern .p-f.t-table, .design-modern .p-f.t-checklist, .design-modern .p-f.t-images, .design-modern .p-f.info { display: block; }
.design-modern .p-f.info { padding: 10px 12px; border: 0; border-radius: 6px; }

/* Sidebar: coloured page edge, section titles in a left-hand column */
.paper.design-sidebar { border-left: 12px solid var(--doc-primary); padding-left: 13mm; }
.design-sidebar .p-title { background: var(--doc-accent); padding: 14px 16px; border-radius: 4px; margin-top: 18px; }
.design-sidebar .p-meta { border: 0; margin: 12px 0 18px; }
.design-sidebar .p-meta div { border: 0; border-left: 3px solid var(--doc-primary); margin-right: 8px; }
.design-sidebar .p-sec { display: grid; grid-template-columns: 27% minmax(0, 1fr); gap: 16px; border-top: 1px solid var(--doc-line); padding-top: 12px; }
.design-sidebar .p-sec h2 { font-size: 11pt; line-height: 1.3; align-self: start; }

/* Bold: coloured title band, rounded section cards, pill details */
.design-banner .p-title { background: var(--doc-primary); margin: 0; padding: 18px 20px; border-radius: 0 0 8px 8px; }
.design-banner:not(.hdr-banner) .p-title { border-radius: 8px; margin-top: 14px; }
.paper.hdr-banner.design-banner .p-head { border-radius: 8px 8px 0 0; border-bottom: 1px solid rgba(255, 255, 255, .25); }
.design-banner .p-title h1 { color: #fff; font-size: 22pt; }
.design-banner .p-title .std { color: rgba(255, 255, 255, .85); }
.design-banner .watermark { color: #fff; background: var(--bad); padding: 2px 8px; border-radius: 4px; }
.design-banner .p-meta { border: 0; gap: 8px; margin: 14px 0 20px; }
.design-banner .p-meta div { border: 0; background: var(--doc-accent); border-radius: 99px; padding: 6px 14px; }
.design-banner .p-sec { border: 1px solid var(--doc-line); border-radius: 8px; overflow: hidden; }
.paper.design-banner .p-sec h2 { margin: 0; border-radius: 0; padding: 7px 12px; }
.design-banner .p-body { padding: 10px 12px 12px; }

/* Certificate: formal double frame, centred title, form-style dotted answers */
.paper.design-certificate { border: 5px double var(--doc-primary); padding: 15mm 15mm; }
.design-certificate .p-title { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.design-certificate .p-title h1 { text-transform: uppercase; letter-spacing: .12em; font-size: 16pt; display: flex; align-items: center; gap: 14px; }
.design-certificate .p-title h1::before, .design-certificate .p-title h1::after { content: ""; width: 36px; height: 2px; background: var(--doc-primary); }
.design-certificate .p-sec h2 { text-transform: uppercase; letter-spacing: .08em; font-size: 10pt; text-align: center; }
.design-certificate .p-f { display: flex; gap: 8px; align-items: baseline; }
.design-certificate .p-f .l { flex: 0 0 40%; }
.design-certificate .p-f .v { flex: 1; border-bottom: 1px dotted #8a8a8a; min-height: 1.4em; }
.design-certificate .p-f.t-table, .design-certificate .p-f.t-checklist, .design-certificate .p-f.t-images, .design-certificate .p-f.info, .design-certificate .p-f.t-signature { display: block; }
.design-certificate .p-f.t-signature .v { border-bottom: 1px dotted #8a8a8a; }

@page { size: A4; margin: 12mm 12mm 14mm; @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt system-ui, sans-serif; color: #666; } }
@media print {
  body { background: #fff; }
  .topbar, .preview-bar, .no-print, #toast-root, #modal-root { display: none !important; }
  main { padding: 0; max-width: none; }
  .paper { box-shadow: none; padding: 0; max-width: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .grid-2 { grid-template-columns: 1fr; }
  .editor { grid-template-columns: minmax(0, 1fr); }
  .grid-2 > * { min-width: 0; }
  .steps { display: none; }
  .mobile-steps { display: block; margin-bottom: 12px; }
  .mobile-steps select { font-weight: 600; }
}
@media (max-width: 760px) {
  .nav { display: none; }
  .menu-toggle { display: block; }
  .mobile-nav.open { display: flex; flex-direction: column; background: var(--brand); padding: 6px 16px 12px; }
  .mobile-nav a { color: #dbe5f3; padding: 10px 6px; border-top: 1px solid rgba(255, 255, 255, .08); }
  .usermenu > button .uname { display: none; }
  .usermenu > button { padding: 4px; }
  .fields, .form-grid { grid-template-columns: 1fr; }
  .field.half { grid-column: 1 / -1; }
  .pane { padding: 16px; }
  .citem { grid-template-columns: 1fr; }
  .clist-head .btn { white-space: normal; }
  .pane-head { flex-wrap: wrap; }
  .include-toggle { margin-left: 0; }
  .doc-bar { top: 56px; }
  .doc-bar .actions .btn span.t { display: none; }
  .table.responsive thead { display: none; }
  .table.responsive tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line-2); }
  .table.responsive td { display: block; padding: 2px 0; border: 0; }
  .paper { padding: 8mm 6mm; }
  .p-meta { grid-template-columns: 1fr 1fr; }
  .p-meta div:nth-child(2) { border-right: 0; }
  .p-meta div:nth-child(-n+2) { border-bottom: 1px solid #c9d0db; }
  .p-imgs { grid-template-columns: 1fr 1fr; }
  .steps-mobile-nav { display: flex; }
  /* list tables become cards; each value keeps its column name (filled in by labelTables in app.js) */
  .table.responsive td[data-label]:not([data-label=""]):not(:first-child)::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  /* Back / Next: short labels side by side, so the buttons never run off the screen */
  .pane-foot .nt { display: none; }
  .pane-foot .mt { display: inline; }
  .pane-foot .btn { flex: 1; justify-content: center; }
  .pane-foot .next { margin-left: 0; }
  /* schedule tables: one card per row, every box labelled, no sideways scrolling */
  .tfield { border: 0; overflow: visible; }
  .tfield table { min-width: 0; }
  .tfield thead { display: none; }
  .tfield table, .tfield tbody, .tfield tr, .tfield td { display: block; width: 100%; }
  .tfield tbody { counter-reset: trow; }
  .tfield tr { counter-increment: trow; position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 6px; margin-bottom: 10px; background: #fff; }
  .tfield tr::before { content: "Item " counter(trow); display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
  .tfield td { padding: 4px 0; border: 0; min-width: 0 !important; }
  .tfield td[data-label]:not([data-label=""])::before { content: attr(data-label); display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
  .tfield td.x { position: absolute; top: 4px; right: 6px; width: auto; padding: 0; }
  .tfield .add-row { padding: 0; }
  .tfield .add-row .btn { width: 100%; justify-content: center; }
}
/* touch screens: 16px text stops iPhones zooming into every box; bigger targets for fingers */
@media (pointer: coarse) {
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea,
  .tfield td input, .tfield td select, .citem .ccomment input, .contact-pick select { font-size: 16px; }
  .btn-sm { min-height: 40px; padding: 8px 12px; }
  .seg span, .seg.compact span { min-height: 42px; padding: 8px 14px; }
  input[type=checkbox], input[type=radio], .step .inc input, .include-toggle input { width: 22px; height: 22px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
}

/* offline */
.save-state.offline { color: var(--warn); font-weight: 600; }
.offline-bar { background: var(--warn-bg); color: var(--warn); border: 1px solid #f3d9a4; border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.offline-list .doc-row a { font-weight: 600; }

/* sending documents to clients for signed acceptance */
.client-banner { background: #f2f6fd; border: 1px solid #cddaf2; color: #1e3a6b; padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.client-banner > div:first-child { flex: 1; min-width: 220px; }
.client-banner.accepted { background: var(--ok-bg); border-color: #b7e2c4; color: #14532d; }
.client-sig { max-height: 56px; max-width: 180px; background: #fff; border: 1px solid #b7e2c4; border-radius: 6px; padding: 4px; }
.accepted-note { background: var(--ok-bg); color: #14532d; }
/* the client's page */
.public-page { background: #eef1f6; }
.accept-top { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 1px 6px rgba(15, 23, 42, .06); }
.accept-inner { max-width: 900px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.accept-inner > div:first-child { flex: 1 1 100%; }
.accept-main { max-width: 900px; margin: 0 auto; padding: 18px 16px 60px; }
.accept-card { margin-top: 18px; scroll-margin-top: 90px; }
.accept-card h2 { margin: 0 0 12px; }
@media (min-width: 761px) { .accept-inner > div:first-child { flex: 1; } }
@media print { .public-page { background: #fff; } .accept-main { padding: 0; max-width: none; } }

/* electronic signatures: draw or type */
.sigmode { margin-bottom: 8px; }
.sigtype input { margin-bottom: 8px; }
.sigtype-preview { min-height: 64px; border: 1px dashed #aab4c3; border-radius: 8px; background: #fff; padding: 8px 14px; font-size: 34px; line-height: 1.4; color: #0b1f44; margin-bottom: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sig-consent { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.sig-audit { font-size: 12px; color: var(--muted); margin-top: 4px; }
/* signature record at the end of printed documents */
.sig-record { margin-top: 18px; padding-top: 10px; border-top: 1px solid #c9d0db; font-size: 8.5pt; break-inside: avoid; page-break-inside: avoid; }
.sig-record h3 { font-size: 10pt; margin: 0 0 6px; }
.sig-record table { width: 100%; border-collapse: collapse; }
.sig-record th, .sig-record td { border: 1px solid #c9d0db; padding: 4px 6px; text-align: left; vertical-align: top; word-break: break-word; }
.sig-record th { background: #f3f5f8; font-weight: 600; }
.sig-record p { margin: 6px 0 0; color: #555; }
@media (max-width: 760px) { .sig-record table, .sig-record tbody, .sig-record tr, .sig-record td { display: block; width: 100%; } .sig-record thead { display: none; } .sig-record tr { margin-bottom: 6px; } .sig-record td::before { content: attr(data-label) ": "; font-weight: 600; } }

/* two-factor sign-in */
.mfa-code { font-size: 22px !important; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-qr { display: flex; justify-content: center; margin: 10px 0 6px; }
.mfa-qr img { width: 200px; height: 200px; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.mfa-secret { font-size: 13px; word-break: break-all; background: var(--line-2); padding: 2px 6px; border-radius: 4px; }
.recovery-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; background: var(--line-2); border-radius: 8px; padding: 12px 14px; margin-bottom: 10px; }
.recovery-codes code { font-size: 15px; letter-spacing: .04em; }
