/* Public account and document layouts. Shared theme elements live in customcomponent.css. */
.kb-public { min-height: 100vh; min-height: 100svh; }
.kb-public .kb-brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.kb-public .kb-brand img { display: block; width: 158px; max-width: 100%; height: auto; }
.kb-public .kb-brand-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--kb-accent); box-shadow: 0 0 0 4px #e4ede7; }

/* Subscription selection shares its plan cards with the in-app billing page. */
.kb-subscribe .kb-subscribe-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 40px; }
.kb-subscribe .kb-billing-options { display: flex; gap: 4px; width: fit-content; max-width: 100%; margin: 0 auto 28px; padding: 5px; border: 1px solid var(--kb-border); border-radius: 12px; background: var(--kb-surface); }
.kb-subscribe .kb-billing-option { min-width: 110px; padding: 10px 20px; border: 0; border-radius: 8px; color: var(--kb-muted); background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; }
.kb-subscribe .kb-billing-option:hover { color: var(--kb-ink); background: var(--kb-soft); }
.kb-subscribe .kb-billing-option.is-selected { color: #fff; background: var(--billing-primary, #4f46e5); }

/* The account shell and reusable cover. */
.kb-account { display: grid; place-items: center; padding: clamp(20px, 4vw, 64px); background: radial-gradient(ellipse at 90% 10%, #e8edf1, transparent 55%), var(--kb-canvas); }
.kb-account-layout { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); width: 100%; max-width: 1190px; min-height: 720px; padding: 12px; border: 1px solid #e0e5e8; border-radius: 28px; background: #f8faf9; box-shadow: var(--kb-shadow); }
.kb-account-card { display: flex; flex-direction: column; min-width: 0; padding: 40px clamp(26px, 3.5vw, 52px) 24px; border: 1px solid #e8ecee; border-radius: 19px; background: #fff; }
.kb-account-card > .kb-brand { align-self: center; margin-bottom: 32px; }
.kb-page-heading { margin-bottom: 26px; text-align: center; }
.kb-page-heading h1 { margin-top: 9px; color: var(--kb-ink); font-size: clamp(25px, 2.4vw, 31px); font-weight: 700; line-height: 1.25; letter-spacing: -.045em; }
.kb-page-heading p { max-width: 350px; margin: 12px auto 0; color: var(--kb-muted); font-size: 13px; line-height: 1.75; }
.kb-account-content { width: 100%; margin: auto 0; }
.kb-account-footer { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-top: 30px; padding-top: 20px; border-top: 1px solid #edf0f2; color: var(--kb-muted); font-size: 10px; text-align: center; }
.kb-public .kb-secure-mark { display: inline-flex; align-items: center; gap: 7px; color: var(--kb-muted); font-size: 11px; }
.kb-public .kb-secure-mark i { color: var(--kb-accent); font-size: 10px; }
.kb-cover { display: flex; flex-direction: column; justify-content: space-between; min-width: 0; overflow: hidden; padding: 46px 36px 28px; border-radius: 18px; background: radial-gradient(ellipse at 92% 62%, #dff3e6 0%, transparent 58%), radial-gradient(ellipse at 5% 85%, #e2edf9 0%, transparent 55%), #f6f8f6; }
.kb-cover-copy { position: relative; z-index: 1; padding: 8px 12px 0; }
.kb-cover-copy h2 { margin: 24px 0 18px; color: var(--kb-ink); font-size: clamp(31px, 3.4vw, 45px); font-weight: 600; line-height: 1.16; letter-spacing: -.055em; }
.kb-cover-copy h2 > span { color: var(--kb-accent); }
.kb-cover-copy p { max-width: 370px; color: var(--kb-muted); font-size: 13px; line-height: 1.85; }
.kb-cover-footer { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px; color: var(--kb-muted); font-size: 10px; }
.kb-cover-footer > span:first-child { display: flex; align-items: center; gap: 8px; }
.kb-cover-footer i { color: #87998d; }
.kb-cover-pagination { display: flex; gap: 5px; }
.kb-cover-pagination :is(b, i) { width: 5px; height: 5px; border-radius: 5px; background: #cad3d4; }
.kb-cover-pagination b { width: 20px; background: var(--kb-accent); }

/* Lightweight artwork is rendered as HTML/SVG and remains sharp at every size. */
.kb-cover-art { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 350px; flex-shrink: 0; margin: 22px 0 24px; }
.kb-art-orbit { position: absolute; left: 50%; top: 50%; width: 380px; height: 380px; border: 1px solid rgb(126 150 142 / 13%); border-radius: 50%; transform: translate(-50%, -50%); }
.kb-art-orbit--two { width: 480px; height: 480px; }
.kb-art-spark { position: absolute; color: #94a89b; font-size: 23px; font-weight: 400; }
.kb-art-spark--one { top: 3px; right: 35px; }
.kb-art-spark--two { bottom: 16px; left: 4px; color: #94a8bb; }
.kb-dashboard-card, .kb-security-card, .kb-signature-card { position: relative; z-index: 1; width: 88%; overflow: hidden; border: 1px solid rgb(255 255 255 / 95%); border-radius: 14px; background: #fff; box-shadow: 12px 24px 46px -18px rgb(36 57 69 / 22%), 0 0 0 1px rgb(30 55 63 / 4%); transform: perspective(1000px) rotateY(-7deg) rotateZ(-4deg); }
.kb-art-window { display: flex; align-items: center; gap: 4px; height: 33px; padding: 0 12px; border-bottom: 1px solid #eef1f2; background: #fcfdfd; }
.kb-art-window > span { width: 5px; height: 5px; border-radius: 50%; background: #d9e1e5; }
.kb-art-window > span:first-child { background: #9ab7a6; }
.kb-art-window b { margin-left: auto; color: #84939f; font-size: 6px; font-weight: 600; letter-spacing: .13em; }
.kb-art-dashboard-body { display: flex; }
.kb-art-sidebar { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 48px; flex-shrink: 0; padding: 13px 0; color: #8b99a5; background: #f6f8f9; font-size: 11px; }
.kb-art-logo { margin-bottom: 4px; color: var(--kb-ink); font-size: 22px; font-weight: 700; letter-spacing: -3px; }
.kb-art-logo span { color: #68977a; }
.kb-art-sidebar > i:first-of-type { color: var(--kb-accent); }
.kb-art-overview { flex: 1; min-width: 0; padding: 19px 19px 16px; }
.kb-art-overview-title { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 20px; font-size: 12px; font-weight: 700; }
.kb-art-overview-title > span { padding: 3px 6px; border: 1px solid #e7ecef; border-radius: 4px; color: #8995a2; font-size: 6px; font-weight: 400; }
.kb-art-label { display: block; color: #8a96a3; font-size: 7px; letter-spacing: .12em; }
.kb-art-balance { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 22px; font-weight: 600; letter-spacing: -.04em; }
.kb-art-balance > span { padding: 3px 7px; border-radius: 5px; color: var(--kb-accent); background: #edf4ef; font-size: 8px; letter-spacing: 0; }
.kb-art-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 7px; height: 100px; margin-top: 12px; padding: 8px 6px 0; border-bottom: 1px solid #e6ecf0; background: repeating-linear-gradient(to top, transparent 0, transparent 29px, #f1f4f5 29px, #f1f4f5 30px); }
.kb-art-chart span { flex: 1; max-width: 14px; height: 38%; border-radius: 3px 3px 0 0; background: #79ba96; }
.kb-art-chart span:nth-child(2n) { background: #c8d6de; }
.kb-art-chart span:nth-child(3n) { height: 52%; }
.kb-art-chart span:nth-child(4n) { height: 44%; }
.kb-art-chart span:nth-child(5n) { height: 62%; }
.kb-art-chart span:nth-child(7) { height: 68%; }
.kb-art-chart span:nth-child(8) { height: 56%; }
.kb-art-chart span:nth-child(9) { height: 78%; }
.kb-art-chart span:nth-child(11) { height: 93%; background: var(--kb-accent); }
.kb-art-chart span:nth-child(12) { height: 75%; }
.kb-art-chart-labels { display: flex; justify-content: space-around; margin-top: 7px; color: #93a0ac; font-size: 6px; }
.kb-art-summary { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding-top: 14px; border-top: 1px solid #edf1f2; }
.kb-art-ring { width: 32px; height: 32px; flex-shrink: 0; border: 7px solid #d9e5df; border-top-color: #678d77; border-right-color: #678d77; border-radius: 50%; }
.kb-art-summary strong, .kb-art-float strong { display: block; font-size: 10px; font-weight: 600; }
.kb-art-summary small, .kb-art-float small { display: block; margin-top: 3px; color: #81909d; font-size: 8px; }
.kb-art-float { position: absolute; z-index: 2; display: flex; align-items: center; gap: 11px; padding: 13px 16px; border: 1px solid #edf1f1; border-radius: 12px; background: rgb(255 255 255 / 97%); box-shadow: 0 12px 30px -10px rgb(35 57 67 / 18%); }
.kb-art-float--top { top: 28px; right: -10px; transform: rotate(3deg); }
.kb-art-float--bottom { bottom: -1px; left: 6px; transform: rotate(-2deg); }
.kb-art-icon { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; color: #60856c; background: #eef4ee; font-size: 13px; }
.kb-art-icon--navy { color: #56728c; background: #edf2f7; }
.kb-security-card, .kb-signature-card { width: 74%; text-align: center; transform: perspective(1000px) rotateY(-6deg) rotateZ(-5deg); }
.kb-art-shield { width: 142px; margin: 16px auto 5px; color: #537c70; }
.kb-art-shield svg { display: block; width: 100%; }
.kb-security-card > strong { display: block; font-size: 11px; font-weight: 600; }
.kb-art-password { display: flex; align-items: center; gap: 8px; width: 70%; margin: 16px auto 28px; padding: 13px; border: 1px solid #e4e9ec; border-radius: 7px; }
.kb-art-password > span { width: 5px; height: 5px; border-radius: 50%; background: #80909f; }
.kb-art-password > i { margin-left: auto; color: var(--kb-accent); font-size: 10px; }
.kb-art-document { padding: 24px 30px 28px; text-align: left; }
.kb-art-document > strong { display: block; margin-top: 15px; font-size: 27px; font-weight: 600; line-height: 1.2; letter-spacing: -.04em; }
.kb-art-lines { display: flex; flex-direction: column; gap: 7px; margin: 22px 0 12px; }
.kb-art-lines span { height: 4px; border-radius: 4px; background: #e8edf0; }
.kb-art-lines span:nth-child(2) { width: 90%; }
.kb-art-lines span:nth-child(3) { width: 68%; }
.kb-art-signature { color: #577765; font: italic 42px/1.4 Georgia, serif; border-bottom: 1px solid #d9e2df; }
.kb-art-signature-caption { margin-top: 9px; color: #8b98a3; font-size: 7px; }

/* Shared document workspace for signing, designing, and viewing invoices. */
.kb-document-page { padding: 0 clamp(14px, 3vw, 44px) 28px; }
.kb-public .kb-document-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 1440px; min-height: 86px; margin: 0 auto; }
.kb-public .kb-document-topbar .kb-brand img { width: 139px; }
.kb-public .kb-topbar-caption { color: var(--kb-muted); font-size: 11px; }
.kb-public .kb-document-card { width: 100%; max-width: 1440px; margin: 0 auto; overflow: hidden; border: 1px solid var(--kb-border); border-radius: 16px; background: #fff; box-shadow: var(--kb-shadow); }
.kb-public .kb-document-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--kb-border); background: #fff; }
.kb-public .kb-document-title { min-width: 0; }
.kb-public .kb-document-title h1, .kb-public .invoice-title { margin-top: 5px; color: var(--kb-ink); font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -.035em; overflow-wrap: anywhere; }
.kb-public .kb-document-title p { margin-top: 5px; color: var(--kb-muted); font-size: 12px; }
.kb-public .kb-document-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.kb-public .kb-document-view { min-width: 0; min-height: 0; flex: 1; overflow: hidden; background: #e9edf0; }
.kb-signing { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 480px; }
.kb-signing .kb-document-topbar { flex-shrink: 0; }
.kb-signing .kb-document-card { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.kb-designer { display: flex; flex-direction: column; height: 88vh; min-height: 540px; border: 1px solid var(--kb-border); border-radius: 14px; overflow: hidden; }
.kb-designer .kb-document-toolbar { padding: 14px 20px; }
.kb-designer .kb-document-title h1 { font-size: 18px; }
.kb-public .kb-designer-body { display: flex; min-height: 0; flex: 1; }
.kb-public .kb-designer-sidebar { width: clamp(210px, 24%, 280px); flex-shrink: 0; overflow: auto; padding: 20px 14px; border-right: 1px solid var(--kb-border); background: #f8fafb; }
.kb-public .kb-designer-sidebar h2 { margin: 0 0 14px; font-size: 13px; font-weight: 600; }
.kb-public .kb-designer-sidebar .kb-button { min-height: 38px; padding: 8px; font-size: 10px; }
.kb-public .kb-designer-body > .kb-document-view { height: 100%; }
.kb-public .kb-field-palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 15px; }
.kb-public .kb-signee { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.kb-public .kb-signee-dot { width: 12px; height: 12px; flex-shrink: 0; border-radius: 50%; }
.kb-public .kb-signee-copy { display: flex; flex-direction: column; line-height: 1.5; }
.kb-public .kb-signee-copy strong { font-size: 12px; font-weight: 500; }
.kb-public .kb-signee-copy small { color: var(--kb-muted); font-size: 10px; }

.kb-public .invoice-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px; border-bottom: 1px solid var(--kb-border); }
.kb-public .invoice-heading { display: flex; align-items: center; gap: 18px; min-width: 0; }
.kb-public .document-icon { display: grid; place-items: center; width: 50px; height: 56px; flex-shrink: 0; border: 1px solid #e0e7ed; border-radius: 12px; color: #526f89; background: #f0f4f8; font-size: 24px; }
.kb-public .invoice-subtitle { margin-top: 7px; color: var(--kb-muted); font-size: 12px; }
.kb-public .invoice-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 13px; }
.kb-public .status-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 25px; padding: 3px 9px; border-radius: 6px; font-size: 10px; font-weight: 600; white-space: nowrap; }
.kb-public .status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.kb-public .status-paid { color: #36664c; background: #ebf4ed; }
.kb-public .status-due { color: #946124; background: #faf2e4; }
.kb-public .status-overdue { color: #a64337; background: #fbece8; }
.kb-public .status-credit { color: #526b8b; background: #ecf1f8; }
.kb-public .status-unavailable { color: #66717d; background: #edf0f3; }
.kb-public .amount-summary { color: var(--kb-muted); font-size: 12px; }
.kb-public .amount-summary strong { color: var(--kb-ink); font-weight: 600; }
.kb-public .invoice-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; max-width: 45%; }
.kb-public .payment-note { padding: 15px 26px; border-bottom: 1px solid var(--kb-border); color: var(--kb-muted); background: #f8fafb; font-size: 12px; }
.kb-public .report-shell { height: calc(100vh - 300px); min-height: 560px; padding: 12px; background: #e9edf0; }
.kb-public .report-height { height: 100%; }
.kb-public .report-shell .dxbrv-wrapper { overflow: hidden; border-radius: 8px; box-shadow: none; }
.kb-public .invalid-document { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 480px; padding: 48px 24px; text-align: center; }
.kb-public .invalid-document h1 { color: var(--kb-ink); font-size: 25px; font-weight: 600; letter-spacing: -.035em; }
.kb-public .invalid-document p { max-width: 450px; margin-top: 12px; color: var(--kb-muted); font-size: 13px; }
.kb-public .kb-document-footer { display: flex; justify-content: center; padding-top: 18px; color: var(--kb-muted); font-size: 10px; }

/* Invoice pages have no brand bar; reserve space around the card directly. */
.kb-public.kb-invoice-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    min-height: 640px;
    padding: 24px clamp(16px, 3vw, 44px);
}
.kb-public.kb-invoice-page .kb-document-card { display: flex; flex-direction: column; flex: 0 1 auto; width: 100%; height: 90%; min-height: 0; margin: auto; }
.kb-invoice-page .invoice-header { flex-shrink: 0; gap: 20px; padding: 20px 24px; }
.kb-invoice-page .invoice-heading { gap: 14px; }
.kb-invoice-page .invoice-title { margin-top: 0; }
.kb-invoice-page .invoice-meta { margin-top: 10px; }
.kb-invoice-page .invoice-actions:empty { display: none; }
.kb-invoice-page .payment-note { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; flex-shrink: 0; padding: 12px 24px; }
.kb-invoice-page .payment-note .status-pill { margin-right: 0 !important; }
.kb-invoice-page .report-shell { flex: 1; min-width: 0; min-height: 320px; height: auto; padding: 16px; overflow: hidden; }
.kb-invoice-page .report-height { min-height: 0; }

@media (min-width: 1600px) { .kb-account-layout { min-height: 790px; } .kb-cover-art { margin-top: 44px; margin-bottom: 44px; } }
@media (max-width: 1050px) {
    .kb-account { padding: 24px; }
    .kb-account-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .kb-account-card { padding: 32px 24px 22px; }
    .kb-cover { padding: 36px 20px 24px; }
    .kb-cover-copy h2 { font-size: 34px; }
    .kb-art-float { padding: 11px; }
    .kb-art-float--top { right: 0; }
    .kb-art-overview { padding: 16px 13px; }
    .kb-art-balance { font-size: 19px; }
}
@media (max-width: 800px) {
    .kb-account { padding: 24px 16px; }
    .kb-account-layout { display: block; max-width: 500px; min-height: 0; padding: 0; border: 0; border-radius: 20px; background: transparent; box-shadow: none; }
    .kb-account-card { padding: 34px 28px 24px; box-shadow: var(--kb-shadow); }
    .kb-account-card > .kb-brand { margin-bottom: 26px; }
    .kb-cover { display: none; }
    .kb-account-content { margin: 0; }
    .kb-document-page { padding: 0 12px 16px; }
    .kb-public .kb-document-topbar { min-height: 68px; }
    .kb-public .kb-document-topbar .kb-brand img { width: 122px; }
    .kb-public .kb-topbar-caption { display: none; }
    .kb-public .kb-document-toolbar { align-items: stretch; flex-direction: column; gap: 16px; padding: 18px; }
    .kb-public .kb-document-actions { justify-content: flex-start; }
    .kb-public .kb-document-actions > .kb-button { flex: 1; }
    .kb-public .invoice-header { align-items: stretch; flex-direction: column; padding: 20px; }
    .kb-public .invoice-actions { justify-content: flex-start; max-width: 100%; }
    .kb-public .invoice-actions > * { flex: 1 1 auto; }
    .kb-public .invoice-title { font-size: 20px; }
    .kb-public .document-icon { width: 42px; height: 48px; }
    .kb-public .payment-note { padding: 15px 20px; }
    .kb-public .report-shell { height: 72vh; min-height: 460px; padding: 6px; }
    .kb-public.kb-invoice-page { padding: 12px; }
    .kb-invoice-page .invoice-header { gap: 14px; padding: 16px; }
    .kb-invoice-page .invoice-heading { align-items: flex-start; gap: 12px; }
    .kb-invoice-page .invoice-meta { gap: 8px 12px; }
    .kb-invoice-page .payment-note { padding: 12px 16px; }
    .kb-invoice-page .report-shell { height: auto; min-height: 320px; padding: 8px; }
    .kb-designer .kb-document-toolbar { flex-direction: row; align-items: center; }
    .kb-public .kb-designer-sidebar { width: 190px; padding: 14px 10px; }
}
@media (max-width: 480px) {
    .kb-account { padding: 16px 12px; }
    .kb-account-card { padding: 30px 22px 22px; border-radius: 16px; }
    .kb-public .kb-field-row { grid-template-columns: 1fr; gap: 17px; }
    .kb-public .kb-document-topbar > .kb-secure-mark { font-size: 9px; }
    .kb-public .kb-document-title h1 { font-size: 19px; }
    .kb-public .kb-document-actions { gap: 6px; }
    .kb-public .kb-document-actions > .kb-button { min-width: 0; padding: 9px; font-size: 10px; }
    .kb-public .kb-designer-body { flex-direction: column; }
    .kb-public .kb-designer-sidebar { width: 100%; max-height: 220px; flex-shrink: 0; border-right: 0; border-bottom: 1px solid var(--kb-border); }
    .kb-public .kb-field-palette { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
