/* Borderless Filings: order flow and client portal. Loaded after site.css on /order/ and /portal/ pages only. */

/* Token fallbacks. In a cascade layer, so any value site.css defines wins. */
@layer bf-defaults {
  :root {
    --bg: #f6f5f1; --surface: #ffffff; --surface-2: #f0f3f6; --ink: #0f1c2e; --muted: #566476; --line: #dfe4ea;
    --primary: #0b2545; --primary-2: #13315c; --accent: #0e8a74; --accent-ink: #ffffff; --accent-soft: #e3f3ef;
    --warn: #9a4d05; --warn-soft: #fff4e5; --danger: #b42318; --danger-soft: #fdecea; --ok: #067647; --ok-soft: #e8f6ee; --info-soft: #e8eef8;
    --radius: 12px; --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(15, 28, 46, .06), 0 4px 16px rgba(15, 28, 46, .06);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  }
}

/* ---------- Base ---------- */
.bf-app { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
.bf-app main { flex: 1 0 auto; }
.bf-app .wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.bf-app h1 { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 800; }
.bf-app h2, .bf-app h3, .bf-app h4 { letter-spacing: -.01em; margin: 0 0 8px; line-height: 1.3; }
.bf-app .h-md { font-size: 1.2rem; font-weight: 750; }
.bf-app .h-sm { font-size: 1.05rem; font-weight: 750; }
.bf-app .h-xs { font-size: .8rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bf-app a { color: var(--primary-2); text-underline-offset: 3px; }
.bf-app a:hover { color: var(--primary); }
.bf-app p { margin: 0 0 12px; }
.bf-app hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.bf-app .muted { color: var(--muted); }
.bf-app .small { font-size: .875rem; }
.bf-app .center { text-align: center; }
.bf-app .num, .bf-app .price-rows dd, .bf-app .paybox-amount strong { font-variant-numeric: tabular-nums; }
.bf-app .sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bf-app .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.bf-app [hidden] { display: none !important; }
.bf-app :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bf-app .skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.bf-app .skip:focus { left: 8px; }
.bf-app .ico { flex-shrink: 0; vertical-align: -3px; }
.bf-app .eyebrow { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin: 0 0 4px; }
.bf-app .lead { font-size: 1.08rem; color: var(--muted); max-width: 70ch; }
.bf-app code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }
.bf-app .stack > * + * { margin-top: 16px; }
.bf-app .stack-sm > * + * { margin-top: 12px; }

/* ---------- Buttons ---------- */
.bf-app .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--primary); color: #fff; font: inherit; font-weight: 700; font-size: .98rem; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background .15s, box-shadow .15s, border-color .15s; transform: none; }
.bf-app .btn:hover { color: #fff; background: var(--primary-2); box-shadow: var(--shadow); transform: none; }
.bf-app .btn-primary { background: var(--accent); color: var(--accent-ink); }
.bf-app .btn-primary:hover { background: #0b7461; color: var(--accent-ink); }
.bf-app .btn-dark { background: var(--primary); color: #fff; }
.bf-app .btn-ghost { background: var(--surface); color: var(--primary); border-color: var(--line); }
.bf-app .btn-ghost:hover { background: var(--surface-2); color: var(--primary); border-color: #c9d1db; box-shadow: none; }
.bf-app .btn-danger { color: var(--danger); }
.bf-app .btn-danger:hover { color: var(--danger); background: var(--danger-soft); border-color: #f3c3bd; }
.bf-app .btn-sm { min-height: 36px; padding: 6px 14px; font-size: .88rem; }
.bf-app .btn-lg { min-height: 54px; font-size: 1.05rem; }
.bf-app .btn-block { display: flex; width: 100%; }
.bf-app .btn:disabled, .bf-app .btn.is-busy { opacity: .7; cursor: progress; }
.bf-app .linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Cards, alerts, pills ---------- */
.bf-app .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.bf-app .card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.bf-app .card-head h2 { margin: 0; }
.bf-app .card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bf-app .card-actions form { margin: 0; }
.bf-app .empty { text-align: center; padding: 40px 20px; }
.bf-app .empty-sm { padding: 8px 0; }
.bf-app .alert { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 16px; border: 1px solid transparent; background: var(--info-soft); color: var(--ink); }
.bf-app .alert-ok { background: var(--ok-soft); border-color: #bfe3cc; }
.bf-app .alert-err { background: var(--danger-soft); border-color: #f3c3bd; }
.bf-app .alert-info { background: var(--info-soft); border-color: #cbd8ec; }
.bf-app .alert-warn { background: var(--warn-soft); border-color: #f5d9b0; }
.bf-app .alert ul { margin: 6px 0 0; padding-left: 20px; }
.bf-app .alert a { color: inherit; font-weight: 600; }
.bf-app .err-summary:focus { outline: 3px solid var(--danger); outline-offset: 2px; }
.bf-app .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--muted); line-height: 1.5; }
.bf-app .pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bf-app .pill-awaiting_quote, .bf-app .pill-payment_review, .bf-app .pill-submitted { background: var(--info-soft); color: var(--primary-2); }
.bf-app .pill-awaiting_payment, .bf-app .pill-waiting_on_client { background: var(--warn-soft); color: var(--warn); }
.bf-app .pill-in_progress { background: var(--accent-soft); color: #0a6b5a; }
.bf-app .pill-completed { background: var(--ok-soft); color: var(--ok); }
.bf-app .pill-cancelled, .bf-app .pill-refunded { background: var(--surface-2); color: var(--muted); }
.bf-app .badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--danger); color: #fff; font-size: .72rem; font-weight: 800; }
.bf-app .tag { font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }

/* ---------- Forms ---------- */
.bf-app .field { display: block; border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
.bf-app fieldset.field { margin-bottom: 0; }
.bf-app .field + .field, .bf-app .intake-fields > * + * { margin-top: 16px; }
.bf-app .lbl { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
.bf-app .req, .bf-app .opt { font-style: normal; font-weight: 500; font-size: .76rem; color: var(--muted); margin-left: 4px; }
.bf-app .req { color: var(--danger); }
.bf-app .help { display: block; font-size: .85rem; color: var(--muted); margin: -2px 0 6px; }
.bf-app .field-err { display: block; color: var(--danger); font-size: .87rem; font-weight: 600; margin-top: 6px; }
.bf-app input[type="text"], .bf-app input[type="email"], .bf-app input[type="password"], .bf-app input[type="tel"], .bf-app input[type="date"], .bf-app input[type="number"],
.bf-app input:not([type]), .bf-app select, .bf-app textarea {
  display: block; width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--ink); background: #fff;
  border: 1px solid #c5ced9; border-radius: var(--radius-sm); box-shadow: inset 0 1px 1px rgba(15, 28, 46, .04); appearance: none; }
.bf-app select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23566476' stroke-width='1.8'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.bf-app textarea { min-height: 96px; resize: vertical; }
.bf-app input:focus, .bf-app select:focus, .bf-app textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(14, 138, 116, .18); }
.bf-app input:disabled { background: var(--surface-2); color: var(--muted); }
.bf-app .has-err input, .bf-app .has-err select, .bf-app .has-err textarea { border-color: var(--danger); }
.bf-app input[type="file"] { display: block; width: 100%; font: inherit; font-size: .92rem; padding: 12px; border: 1px dashed #b7c2cf; border-radius: var(--radius-sm); background: var(--surface-2); }
.bf-app input[type="file"]::file-selector-button { font: inherit; font-weight: 700; margin-right: 12px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--primary); cursor: pointer; }
.bf-app .file-list { display: block; margin-top: 6px; color: var(--muted); }
.bf-app .file-list.is-err { color: var(--danger); font-weight: 600; }
.bf-app fieldset.field legend { padding: 0; }
.bf-app .choices { display: grid; gap: 8px; }
.bf-app .choices-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.bf-app .choice { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.45; }
.bf-app .choices .choice { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.bf-app .choices .choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.bf-app .choice input { width: 18px; height: 18px; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--accent); }
.bf-app .choice.has-err { color: var(--danger); }
.bf-app .pw-wrap { position: relative; display: block; }
.bf-app .pw-wrap input { padding-right: 72px; }
.bf-app .pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: var(--surface-2); border: 0; border-radius: 6px; padding: 6px 10px; font: inherit; font-size: .82rem; font-weight: 700; color: var(--primary); cursor: pointer; }
.bf-app .grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.bf-app .grid-2 > .field + .field { margin-top: 0; }
.bf-app .inline-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.bf-app .form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (min-width: 640px) { .bf-app .grid-2 { grid-template-columns: 1fr 1fr; } }

/* People blocks (intake) */
.bf-app .person { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; background: var(--surface-2); margin-top: 12px; }
.bf-app .person .field + .field { margin-top: 12px; }
.bf-app .person-n { display: block; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.bf-app [data-add-person] { margin-top: 12px; }

/* ---------- Order (checkout) layout ---------- */
.co-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.co-header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.pt-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.bf-app .pt-logo:hover { color: var(--ink); }
.pt-logo-mark { display: inline-flex; }
.pt-logo-text { font-size: 1.12rem; letter-spacing: -.02em; }
.pt-logo-text b { color: var(--accent); }
.co-secure { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--ok); background: var(--ok-soft); padding: 4px 10px; border-radius: 999px; }
.co-help { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: .88rem; }
.co-help a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-weight: 600; }
.co-help-lbl { color: var(--muted); }
.co-footer, .pt-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 48px; font-size: .85rem; color: var(--muted); }
.co-footer-inner, .pt-footer-inner { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; align-items: center; padding-top: 16px; padding-bottom: 16px; }
.co-footer p, .pt-footer p { margin: 0; }
.co-footer nav, .pt-footer nav { display: flex; gap: 16px; }
.co-footer a, .pt-footer a { color: var(--muted); }
@media (max-width: 639px) {
  .co-help-lbl, .co-help a span { display: none; }
  .co-help a { width: 40px; height: 40px; justify-content: center; border: 1px solid var(--line); border-radius: 50%; }
  .co-secure { order: 3; }
}

.co-wrap { padding-top: 24px; padding-bottom: 24px; }
.co-head { margin-bottom: 20px; }
.co-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
.co-main > * + * { margin-top: 20px; }
.co-side > * + * { margin-top: 16px; }
.co-step h2 { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; margin-bottom: 16px; }
.step-n { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: .9rem; font-weight: 800; flex-shrink: 0; }
.co-note { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; }
.co-after { margin: 12px 0 0; }
.consents { margin-bottom: 20px; }
.ordering-as { margin: 0; padding: 12px 16px; background: var(--surface-2); border-radius: var(--radius-sm); }
.auth-switch { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--surface-2); border-radius: var(--radius-sm); padding: 4px; }
.auth-switch .seg { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 8px; border-radius: 6px; cursor: pointer; font-weight: 650; font-size: .92rem; text-align: center; line-height: 1.3; }
.auth-switch .seg:has(input:checked) { background: #fff; box-shadow: var(--shadow); color: var(--primary); }
.auth-switch input { accent-color: var(--accent); }
.wa-choice { align-self: end; padding-bottom: 12px; font-size: .92rem; }
.price-card { border-top: 4px solid var(--accent); }
.price-rows { margin: 0; }
.price-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.price-row dt { color: var(--ink); }
.price-row dd { margin: 0; font-weight: 700; text-align: right; }
.price-state { align-items: center; }
.price-state dd { flex: 1; max-width: 220px; }
.price-state select { min-height: 40px; padding-top: 6px; padding-bottom: 6px; }
.price-total { border-bottom: 0; padding-top: 14px; }
.price-total dt { font-weight: 800; font-size: 1.05rem; }
.price-total dd { font-size: 1.45rem; font-weight: 800; color: var(--primary); }
.quote-tag { font-size: .88rem; color: var(--primary-2); background: var(--info-soft); padding: 3px 8px; border-radius: 6px; }
.price-note, .price-hint { font-size: .86rem; color: var(--muted); margin: 8px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.price-hint { font-weight: 700; color: var(--ink); display: block; }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; font-size: .94rem; }
.check-list .ico { color: var(--accent); margin-top: 3px; }
.co-timing { display: flex; gap: 8px; align-items: flex-start; font-size: .9rem; margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); }
.co-timing strong { color: var(--ink); }
.trust-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: .86rem; color: var(--muted); }
.trust-list li { display: flex; gap: 8px; align-items: flex-start; }
.trust-list .ico { color: var(--ok); margin-top: 2px; }
@media (min-width: 960px) {
  .co-grid { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: "main side"; align-items: start; gap: 28px; }
  .co-main { grid-area: main; }
  .co-side { grid-area: side; position: sticky; top: 16px; }
}

/* ---------- Portal layout ---------- */
.pt-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.pt-header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.pt-who { margin-left: auto; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.pt-signout { margin: 0; }
.pt-back { margin-left: auto; }
.pt-nav { border-top: 1px solid var(--line); background: var(--surface); }
.pt-nav-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pt-nav-inner::-webkit-scrollbar { display: none; }
.pt-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 12px 12px; white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 650; font-size: .93rem; border-bottom: 3px solid transparent; }
.pt-nav a:hover { color: var(--primary); }
.pt-nav a.active { color: var(--primary); border-bottom-color: var(--accent); }
@media (max-width: 639px) {
  .pt-who { display: none; }
  .pt-signout { margin-left: auto; }
  .pt-nav a { padding: 11px 10px; font-size: .9rem; }
}
.pt-main { padding-bottom: 16px; }
.pt-main > .wrap:first-child { padding-top: 16px; }
.pt-main > .wrap:first-child:empty { padding-top: 0; }
.pt-page { padding-top: 24px; padding-bottom: 24px; }
.pt-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.pt-title h1 { margin: 0; }
.pt-page > .muted { max-width: 75ch; }
.back-link { margin: 0 0 8px; }
.status-desc { color: var(--muted); margin: -4px 0 16px; }
.order-title { align-items: center; }

/* Auth pages */
.bf-bare .pt-main { display: flex; align-items: flex-start; }
.bf-bare .pt-main > .wrap:first-child { display: none; }
.bf-bare .pt-main > .wrap:first-child:not(:empty) { display: block; }
.auth-wrap { padding-top: 32px; padding-bottom: 32px; max-width: 480px !important; }
.auth-card { padding: 28px 24px; }
.auth-links { margin: 16px 0 0; color: var(--muted); }

/* Dashboard */
.banner-verify { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.banner-verify form { margin: 0; }
.action-card { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between; border-left: 4px solid var(--warn); }
.action-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; flex: 1 1 320px; }
.action-main p { flex-basis: 100%; margin: 0; }
.dash-grid { display: grid; gap: 16px; margin-top: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 860px) { .dash-grid { grid-template-columns: 1fr 1fr; } }
.order-list, .due-list, .msg-preview, .quick-links, .thread-list, .inv-list, .doc-list, .cal-list { list-style: none; margin: 0; padding: 0; }
.order-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.order-list li:first-child { border-top: 0; }
.order-list a { display: flex; flex-direction: column; text-decoration: none; min-width: 0; flex: 1 1 220px; }
.price-total dd .muted { font-size: .95rem; font-weight: 600; }
.ol-name { font-weight: 650; color: var(--ink); }
.due-list li { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.due-list li:first-child { border-top: 0; }
.due-date { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 48px; height: 52px; border-radius: var(--radius-sm); background: var(--surface-2); flex-shrink: 0; line-height: 1.1; }
.due-m { font-size: .7rem; font-weight: 800; text-transform: uppercase; color: var(--accent); letter-spacing: .05em; }
.due-d { font-size: 1.2rem; font-weight: 800; }
.due-body { display: flex; flex-direction: column; min-width: 0; }
.due-title { font-weight: 600; font-size: .95rem; }
.due-left { font-size: .8rem; font-weight: 700; color: var(--muted); }
.due-left.soon { color: var(--warn); }
.due-left.late { color: var(--danger); }
.msg-preview li + li { border-top: 1px solid var(--line); }
.msg-preview a { display: flex; flex-direction: column; padding: 8px 0; text-decoration: none; color: var(--ink); }
.msg-snip { font-size: .93rem; }
.quick-links { display: grid; gap: 4px; }
.quick-links a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; }
.quick-links a:hover { background: var(--surface-2); }
.quick-links .ico { color: var(--accent); }

/* Order detail */
.order-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 960px) { .order-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 24px; } }
.welcome-box { border-left: 4px solid var(--accent); margin-bottom: 16px; }
.welcome-box h2 { display: flex; align-items: center; gap: 8px; color: var(--ok); }
.steps { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 8px; }
.box-info { border-left: 4px solid var(--primary-2); }
.box-info h2 { display: flex; gap: 8px; align-items: center; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; padding: 0 0 16px 28px; }
.tl-item::before { content: ""; position: absolute; left: 7px; top: 14px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid #b7c2cf; }
.tl-current .tl-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tl-body { display: flex; flex-direction: column; }
.tl-body p { margin: 4px 0 0; }
.thread { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); }
.msg-me { justify-self: end; background: var(--accent-soft); border-bottom-right-radius: 4px; }
.msg-them { justify-self: start; border-bottom-left-radius: 4px; border: 1px solid var(--line); background: #fff; }
.msg-meta { color: var(--muted); margin-bottom: 4px; }
.msg-body { overflow-wrap: anywhere; }
.reply-form { border-top: 1px solid var(--line); padding-top: 16px; }
.reply-form .help { margin: 6px 0 12px; }
.doc-list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.doc-list li:first-child { border-top: 0; }
.doc-ico { color: var(--primary-2); display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; background: var(--info-soft); border-radius: var(--radius-sm); flex-shrink: 0; }
.doc-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.doc-name { font-weight: 650; overflow-wrap: anywhere; }
.upload-form { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.upload-form > * + * { margin-top: 14px; }
.upload-form .help { display: flex; gap: 6px; align-items: flex-start; }
.inv-list li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 6px 0; flex-wrap: wrap; }
.inv-st { font-size: .72rem; font-weight: 800; letter-spacing: .05em; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.inv-st.inv-paid { background: var(--ok-soft); color: var(--ok); }
.inv-st.inv-unpaid { background: var(--warn-soft); color: var(--warn); }
.intake-summary { margin: 0; display: grid; grid-template-columns: 1fr; gap: 2px 16px; }
.intake-summary dt { font-size: .82rem; color: var(--muted); font-weight: 600; margin-top: 10px; }
.intake-summary dd { margin: 0; overflow-wrap: anywhere; }
.intake-summary ul { margin: 0; padding-left: 18px; }
@media (min-width: 640px) { .intake-summary { grid-template-columns: minmax(160px, 38%) 1fr; } .intake-summary dt, .intake-summary dd { margin-top: 0; padding: 8px 0; border-top: 1px solid var(--line); } }
.kv { margin: 0; display: grid; gap: 4px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* Pay box */
.paybox { border: 2px solid var(--accent); }
.paybox-head { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.paybox-head p { margin: 0; }
.paybox-amount { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.paybox-amount strong { font-size: 1.8rem; color: var(--primary); }
.pay-opt { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.pay-opt:first-of-type { border-top: 0; margin-top: 0; }
.paybox .alert + .pay-opt { border-top: 0; margin-top: 0; }
.paypal-slot { min-height: 50px; max-width: 420px; }
.test-mode { margin-top: 12px; padding: 12px; border: 1px dashed var(--warn); border-radius: var(--radius-sm); background: var(--warn-soft); max-width: 420px; }
.test-mode p { margin-bottom: 8px; }
.pay-details { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-top: 8px; background: #fff; }
.pay-details summary { padding: 12px 14px; font-weight: 700; cursor: pointer; }
.pay-details[open] summary { border-bottom: 1px solid var(--line); }
.pay-details-body { padding: 12px 14px; }
.pay-details .pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; background: var(--surface-2); border-radius: 6px; padding: 10px 12px; margin-bottom: 10px; overflow-wrap: anywhere; }
.claim-form { margin-top: 16px; padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2); }
.claim-form input[type="file"] { background: #fff; }

/* Tables */
.table-card { padding: 0; overflow: hidden; }
.bf-app .table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.bf-app .table th, .bf-app .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.bf-app .table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); font-weight: 700; }
.bf-app .table tbody tr:last-child td { border-bottom: 0; }
.bf-app .table .num { text-align: right; white-space: nowrap; }
.td-act { text-align: right; white-space: nowrap; }
.td-act .btn + .btn { margin-left: 6px; }
@media (max-width: 719px) {
  .table-card .table thead { display: none; }
  .table-card .table tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table-card .table tbody tr:last-child { border-bottom: 0; }
  .table-card .table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .table-card .table td::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; }
  .table-card .table td.td-act { justify-content: flex-end; padding-top: 8px; }
  .table-card .table td.td-act::before { content: none; }
}

/* Companies, calendar, account */
.co-cards { display: grid; gap: 16px; grid-template-columns: 1fr; margin-bottom: 20px; }
@media (min-width: 760px) { .co-cards { grid-template-columns: 1fr 1fr; } }
.company-card .kv { margin-bottom: 12px; }
.company-form { max-width: 820px; }
.tax-ids .grid-2 { margin-top: 8px; }
.cal-month h2 { margin-bottom: 4px; }
.cal-item { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.cal-item:first-child { border-top: 0; }
.cal-item.is-late .due-date { background: var(--danger-soft); }
.cal-item.is-soon .due-date { background: var(--warn-soft); }
.cal-body { flex: 1; min-width: 0; }
.cal-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; align-items: baseline; }
.cal-body p { margin: 6px 0 0; }
.cal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.cal-actions form { margin: 0; }
.closed-list summary { cursor: pointer; font-weight: 700; }
.closed-list .cal-item { padding: 10px 0; }
.closed-list .cal-body form { margin: 4px 0 0; }
.acct-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .acct-grid { grid-template-columns: 1fr 1fr; align-items: start; } }

/* Invoice */
.invoice-tools { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.invoice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.invoice { max-width: 860px; margin: 0 auto; padding: 32px; }
.inv-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.inv-logo { margin-bottom: 10px; }
.inv-meta { min-width: 240px; }
.inv-meta h1 { font-size: 1.8rem; margin: 0 0 8px; }
.inv-stamp { display: inline-block; font-weight: 800; letter-spacing: .12em; font-size: .9rem; padding: 4px 12px; border: 2px solid currentColor; border-radius: 6px; margin-bottom: 12px; }
.inv-stamp.paid { color: var(--ok); }
.inv-stamp.unpaid { color: var(--warn); }
.inv-stamp.other { color: var(--muted); }
.inv-to { margin-bottom: 20px; }
.inv-items { margin-bottom: 20px; }
.inv-items tfoot th { text-align: right; font-weight: 600; }
.inv-total th, .inv-total td { font-size: 1.1rem; font-weight: 800; }
.inv-pays { margin-bottom: 20px; }
.inv-foot { border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 639px) { .invoice { padding: 20px 16px; } .inv-meta { min-width: 0; width: 100%; } .bf-app .invoice .table th, .bf-app .invoice .table td { padding: 10px 8px; } }

@media print {
  .bf-app { background: #fff; font-size: 12pt; }
  .pt-header, .pt-nav, .pt-footer, .co-header, .co-footer, .no-print, .skip, .alert { display: none !important; }
  .pt-main > .wrap:first-child { display: none; }
  .bf-app .card { box-shadow: none; border: 0; padding: 0; }
  .invoice { max-width: none; }
  .bf-app a { color: inherit; text-decoration: none; }
  .bf-app .table thead th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .inv-stamp { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Grid children must be allowed to shrink below their content width (file inputs, long references) */
.order-grid > *, .co-grid > *, .dash-grid > *, .acct-grid > *, .co-cards > *, .grid-2 > * { min-width: 0; }
.bf-app input[type="file"] { max-width: 100%; min-width: 0; }
