:root {
    --hb-green: #036f54;
    --hb-green-dark: #025a44;
    --hb-green-light: #ccfbf1;
    --hb-gold: #b45309;
    --hb-bg: #f6f7f9;
    --hb-border: #e2e5ea;
    --hb-text: #1f2937;
    --hb-muted: #6b7280;
    --hb-sidebar: #06352a;
    --bs-primary: #036f54;
    --bs-primary-rgb: 3, 111, 84;
    --bs-link-color: #036f54;
    --bs-link-color-rgb: 3, 111, 84;
    --bs-link-hover-color: #115e59;
}

html, body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
    color: var(--hb-text);
}

h1 { font-size: 1.35rem; font-weight: 600; margin: 0; }
h1:focus { outline: none; }
h2 { font-size: 1.1rem; font-weight: 600; }

.btn-primary { --bs-btn-bg: var(--hb-green); --bs-btn-border-color: var(--hb-green); --bs-btn-hover-bg: var(--hb-green-dark); --bs-btn-hover-border-color: var(--hb-green-dark); --bs-btn-active-bg: var(--hb-green-dark); --bs-btn-disabled-bg: var(--hb-green); --bs-btn-disabled-border-color: var(--hb-green); }
.btn-outline-primary { --bs-btn-color: var(--hb-green); --bs-btn-border-color: var(--hb-green); --bs-btn-hover-bg: var(--hb-green); --bs-btn-hover-border-color: var(--hb-green); --bs-btn-active-bg: var(--hb-green-dark); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: #5eead4; box-shadow: 0 0 0 .2rem rgba(15, 118, 110, .2); }
.form-check-input:checked { background-color: var(--hb-green); border-color: var(--hb-green); }

/* ---------- Shell ---------- */
.hb-shell { display: flex; min-height: 100vh; }
.hb-sidebar { width: 240px; flex: 0 0 240px; background: var(--hb-sidebar); color: #d1fae5; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding-bottom: 2rem; }
.hb-brand { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; font-weight: 700; font-size: 1.25rem; color: #fff; text-decoration: none; }
.hb-brand-top { color: var(--hb-green); padding: 0; }
.hb-logo { color: #fbbf24; font-size: 1.3rem; }
.hb-nav { display: flex; flex-direction: column; padding: 0 .5rem; }
.hb-nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #5eead4; padding: 1rem .75rem .25rem; }
.hb-nav-link { color: #d1fae5; text-decoration: none; padding: .4rem .75rem; border-radius: .375rem; font-size: .93rem; }
.hb-nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.hb-nav-link.active { background: var(--hb-green); color: #fff; }
.hb-nav-toggle { display: none; }
.hb-burger { display: none; cursor: pointer; font-size: 1.4rem; margin: 0; }

.hb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hb-topbar { display: flex; align-items: center; gap: 1rem; padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid var(--hb-border); position: sticky; top: 0; z-index: 10; }
.hb-topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: .75rem; }
.hb-company-name { font-weight: 600; }
.hb-company-select { max-width: 280px; font-weight: 600; }
.hb-content { padding: 1.5rem; max-width: 1400px; width: 100%; }

.hb-user-menu, .hb-lang { position: relative; }
.hb-user-menu > summary, .hb-lang > summary { cursor: pointer; list-style: none; padding: .3rem .6rem; border-radius: .375rem; font-size: .9rem; }
.hb-user-menu > summary::-webkit-details-marker, .hb-lang > summary::-webkit-details-marker { display: none; }
.hb-user-menu > summary:hover, .hb-lang > summary:hover { background: var(--hb-bg); }
.hb-user-menu-items, .hb-lang-items { position: absolute; inset-inline-end: 0; top: 2.2rem; background: #fff; border: 1px solid var(--hb-border); border-radius: .5rem; box-shadow: 0 8px 24px rgba(0,0,0,.08); min-width: 200px; padding: .4rem; display: flex; flex-direction: column; z-index: 50; }
.hb-user-menu-items a, .hb-lang-items a, .hb-user-menu-items button { padding: .4rem .6rem; text-decoration: none; color: var(--hb-text); border-radius: .3rem; text-align: start; }
.hb-user-menu-items a:hover, .hb-lang-items a:hover { background: var(--hb-bg); }
.hb-lang-items a.active { font-weight: 700; color: var(--hb-green); }

/* ---------- Page parts ---------- */
.hb-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.hb-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.hb-card { background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: 1.25rem; margin-bottom: 1.25rem; }
.hb-card h2 { margin-bottom: 1rem; }
.hb-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.hb-kpi { background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: 1rem 1.25rem; }
.hb-kpi .label { color: var(--hb-muted); font-size: .85rem; }
.hb-kpi .value { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.hb-kpi .value.negative { color: #b91c1c; }
.hb-empty { text-align: center; padding: 3rem 1rem; color: var(--hb-muted); }
.hb-empty h1 { color: var(--hb-text); margin-bottom: .5rem; }
.hb-loading { padding: 2rem; color: var(--hb-muted); }

.hb-table { width: 100%; background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; overflow: hidden; border-collapse: separate; border-spacing: 0; }
.hb-table th { background: #f9fafb; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); font-weight: 600; padding: .6rem .75rem; border-bottom: 1px solid var(--hb-border); text-align: start; white-space: nowrap; }
.hb-table td { padding: .55rem .75rem; border-bottom: 1px solid #f0f1f3; vertical-align: middle; }
.hb-table tr:last-child td { border-bottom: none; }
.hb-table tbody tr:hover { background: #f9fafb; }
.hb-table tfoot td { font-weight: 700; background: #f9fafb; border-top: 2px solid var(--hb-border); }
.hb-table .num, .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hb-table-wrap { overflow-x: auto; }
.hb-lines td { padding: .3rem .4rem; }
.hb-lines .form-control, .hb-lines .form-select { font-size: .9rem; }
.hb-totals { margin-inline-start: auto; max-width: 340px; }
.hb-totals .row-total { display: flex; justify-content: space-between; padding: .25rem 0; font-variant-numeric: tabular-nums; }
.hb-totals .grand { font-size: 1.2rem; font-weight: 700; border-top: 2px solid var(--hb-border); padding-top: .5rem; margin-top: .25rem; }
.hb-toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.hb-toolbar .form-label { font-size: .8rem; margin-bottom: .15rem; color: var(--hb-muted); }

/* ---------- Reports ---------- */
.hb-report { background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: 2rem; max-width: 900px; }
.hb-report-title { text-align: center; margin-bottom: 1.5rem; }
.hb-report-title .company { font-size: 1.1rem; font-weight: 600; }
.hb-report-title .name { font-size: 1.4rem; font-weight: 700; }
.hb-report table { width: 100%; }
.hb-report td { padding: .3rem .5rem; }
.hb-report .section td { font-weight: 700; padding-top: 1rem; }
.hb-report .subtotal td { font-weight: 600; border-top: 1px solid var(--hb-border); }
.hb-report .total td { font-weight: 700; border-top: 2px solid var(--hb-text); border-bottom: 3px double var(--hb-text); }
.hb-report .indent { padding-inline-start: 1.5rem; }
.hb-seg-table th { font-size: .8rem; color: var(--hb-muted); font-weight: 600; padding: .3rem .5rem; border-bottom: 1px solid var(--hb-border); white-space: nowrap; }
.hb-seg-table td.num { white-space: nowrap; }
.hb-seg-table th:first-child, .hb-seg-table td:first-child { position: sticky; inset-inline-start: 0; background: #fff; min-width: 12rem; }
.hb-report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.hb-report-grid a { display: block; background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: 1rem 1.25rem; text-decoration: none; color: var(--hb-text); }
.hb-report-grid a:hover { border-color: var(--hb-green); box-shadow: 0 2px 10px rgba(15,118,110,.1); }
.hb-report-grid .t { font-weight: 600; color: var(--hb-green); }
.hb-report-grid .d { font-size: .85rem; color: var(--hb-muted); }

/* ---------- Landing ---------- */
.hb-hero { text-align: center; padding: 1.75rem 1rem 1rem; }
.hb-hero h1 { font-size: 1.75rem; font-weight: 650; max-width: 800px; margin: 0 auto .6rem; }
.hb-hero p { font-size: 1.15rem; color: var(--hb-muted); max-width: 680px; margin: 0 auto 2rem; }
.hb-features { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; max-width: 1100px; margin: 1.25rem auto; }
.hb-feature { background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: .9rem 1rem; }
.hb-feature h3 { font-size: 1.05rem; font-weight: 650; color: var(--hb-green); }

/* ---------- Charts ---------- */
.hb-bars { display: flex; align-items: flex-end; gap: .75rem; height: 180px; padding-top: .5rem; overflow-x: auto; }
.hb-bar-group { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.hb-bar-pair { display: flex; align-items: flex-end; gap: 3px; height: 150px; }
.hb-bar { width: 16px; border-radius: 3px 3px 0 0; }
.hb-bar.income { background: var(--hb-green); }
.hb-bar.expense { background: #f59e0b; }
.hb-bar-label { font-size: .7rem; color: var(--hb-muted); margin-top: .25rem; white-space: nowrap; }
.hb-legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--hb-muted); }
.hb-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: .35rem; }
.hb-legend .income::before { background: var(--hb-green); }
.hb-legend .expense::before { background: #f59e0b; }

/* ---------- Validation and Blazor ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }
.darker-border-checkbox.form-check-input { border-color: #929292; }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); box-sizing: border-box; display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; inset-inline-end: 0.75rem; top: 0.5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }
.blazor-error-boundary::after { content: "An error has occurred." }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder { color: var(--bs-secondary-color); text-align: end; }
.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder { text-align: start; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
    .hb-sidebar { position: fixed; inset-inline-start: 0; z-index: 100; transform: translateX(-100%); transition: transform .2s; }
    [dir=rtl] .hb-sidebar { transform: translateX(100%); }
    .hb-nav-toggle:checked ~ .hb-sidebar { transform: none; }
    .hb-burger { display: block; }
    .hb-content { padding: 1rem; }
    .hb-company-select { max-width: 160px; }
}

/* ---------- Printing (invoices and reports) ---------- */
@media print {
    .hb-sidebar, .hb-topbar, .hb-actions, .hb-toolbar, .no-print, #blazor-error-ui { display: none !important; }
    .hb-content { padding: 0; max-width: none; }
    body, .hb-report, .hb-card { background: #fff; border: none; }
}

/* ---------- History page ---------- */
.hb-history-hero { text-align: center; padding: 1.5rem 1rem 1rem; max-width: 820px; margin: 0 auto; }
.hb-history-kicker { color: var(--hb-muted); font-weight: 500; letter-spacing: .02em; font-size: .85rem; margin-bottom: .35rem; }
.hb-history-hero h1 { font-size: 1.7rem; font-weight: 650; margin-bottom: .6rem; }
.hb-history-hero p { font-size: 1.1rem; color: var(--hb-muted); line-height: 1.7; }
.hb-timeline { position: relative; max-width: 860px; margin: 1rem auto 2rem; padding-inline-start: 2.5rem; }
.hb-timeline::before { content: ""; position: absolute; inset-inline-start: 1.05rem; top: .5rem; bottom: .5rem; width: 3px; background: linear-gradient(var(--hb-gold), var(--hb-green)); border-radius: 2px; }
.hb-tl-item { position: relative; margin-bottom: 1.25rem; }
.hb-tl-dot { position: absolute; inset-inline-start: -2.5rem; top: .9rem; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: #fff; border: 3px solid var(--hb-green); display: flex; align-items: center; justify-content: center; font-size: 1rem; line-height: 1; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.hb-tl-card { background: #fff; border: 1px solid var(--hb-border); border-radius: .9rem; padding: 1.1rem 1.35rem; box-shadow: 0 1px 2px rgba(0,0,0,.03); transition: box-shadow .2s, transform .2s; }
.hb-tl-card:hover { box-shadow: 0 8px 24px rgba(15,118,110,.12); transform: translateY(-2px); }
.hb-tl-when { color: var(--hb-green); font-weight: 700; font-size: .85rem; letter-spacing: .02em; }
.hb-tl-card h2 { font-size: 1.2rem; margin: .2rem 0 .4rem; }
.hb-tl-card p { margin: 0 0 .4rem; line-height: 1.65; }
.hb-tl-where { color: var(--hb-muted); font-size: .82rem; }
.hb-quote { max-width: 760px; margin: 2rem auto; }
.hb-quote blockquote { margin: 0; padding: 1.75rem 2rem; border-radius: 1rem; background: linear-gradient(135deg, var(--hb-sidebar), var(--hb-green)); color: #fff; text-align: center; }
.hb-quote blockquote p { font-size: 1.3rem; line-height: 1.6; font-style: italic; margin-bottom: .75rem; }
.hb-quote footer { color: #a7f3d0; font-size: .85rem; }
.hb-dedication { max-width: 760px; margin: 1.5rem auto 1rem; text-align: center; background: #fffbeb; border: 1px solid #fde68a; border-radius: 1rem; padding: 1.25rem 1.25rem 1.4rem; }
.hb-dedication-mark { font-size: 2rem; color: var(--hb-gold); }
.hb-dedication h2 { font-size: 1.3rem; font-weight: 650; margin: .25rem 0 .6rem; }
.hb-dedication p { font-size: 1.05rem; line-height: 1.75; }
.hb-dedication-sign { font-weight: 700; color: var(--hb-green); font-size: 1.15rem !important; margin-top: 1rem; }
.hb-history-note { max-width: 760px; margin: 0 auto 2rem; text-align: center; color: var(--hb-muted); font-size: .8rem; }
.hb-footer { margin-top: auto; padding: .8rem 1rem; border-top: 1px solid var(--hb-border); background: #fff; color: var(--hb-muted); font-size: .85rem; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.hb-footer a { color: var(--hb-muted); text-decoration: none; }
.hb-footer a:hover { color: var(--hb-green); }
@media (max-width: 600px) { .hb-history-hero h1 { font-size: 1.45rem; } .hb-quote blockquote p { font-size: 1.1rem; } }

.hb-history-strip { display: flex; justify-content: center; gap: .6rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hb-history-strip .hb-art { width: 64px; height: 64px; }
.hb-tl-dot { font-size: 0; }
.hb-tl-dot::after { content: ""; width: .8rem; height: .8rem; border-radius: 50%; background: var(--hb-gold); }
.hb-tl-card { display: grid; grid-template-columns: 120px 1fr; gap: 1.25rem; align-items: start; }
.hb-tl-art .hb-art { width: 120px; height: 120px; display: block; }
.hb-tl-where { color: var(--hb-muted); font-weight: 500; }
.hb-fun { background: #fef9c3; border: 1px dashed #facc15; border-radius: .75rem; padding: .6rem .85rem; font-size: .95rem; line-height: 1.55; }
@media (max-width: 600px) { .hb-tl-card { grid-template-columns: 1fr; } .hb-tl-art .hb-art { width: 96px; height: 96px; margin: 0 auto; } }

.hb-free-badge { display: inline-block; background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46 !important; border-radius: 999px; padding: .55rem 1.1rem; font-size: 1rem !important; font-weight: 600; max-width: 720px; }

/* ---------- Pricing ---------- */
.hb-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; max-width: 1100px; margin: 0 auto 2rem; }
.hb-plan { position: relative; background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: 1.5rem 1.25rem; }
.hb-plan h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.hb-plan-free { border: 2px solid var(--hb-green); background: #f0fdfa; }
.hb-plan-popular { box-shadow: 0 10px 30px rgba(15,118,110,.15); }
.hb-plan-tag { position: absolute; top: -.75rem; inset-inline-end: 1rem; background: var(--hb-gold); color: #fff; font-size: .75rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; }
.hb-plan-price .amount { font-size: 1.8rem; font-weight: 700; }
.hb-plan-price .per { color: var(--hb-muted); }
.hb-plan-who { color: var(--hb-muted); font-size: .9rem; margin-bottom: .75rem; min-height: 2.6em; }
.hb-plan ul { padding-inline-start: 1.1rem; margin-bottom: .75rem; }
.hb-plan li { margin-bottom: .3rem; }
.hb-compare { max-width: 820px; margin: 0 auto 2rem; }
.hb-compare h2 { text-align: center; margin-bottom: 1rem; }


/* ---------- Brand ---------- */
:root { --hb-halal: #047857; --hb-book: #d97706; }
.hb-brandmark { display: inline-flex; align-items: center; gap: .5rem; text-decoration: none; }
.hb-brandmark img { border-radius: 22%; flex: none; }
.hb-word { font-weight: 800; letter-spacing: -.01em; font-size: 1.3rem; line-height: 1; }
.hb-word .halal { color: var(--hb-halal); }
.hb-word .book { color: var(--hb-book); }
.hb-brandmark.on-dark .hb-word .halal { color: #34d399; }
.hb-brandmark.on-dark .hb-word .book { color: #fbbf24; }
.hb-footer .hb-word { font-size: .95rem; }
.hb-brand { padding: .9rem 1.1rem; }

/* Soft ledger watermark behind every page (mirrored side for right-to-left). */
body { background: #fafafa url("img/bg-ledger.svg") no-repeat fixed right -6vw bottom -4vh / min(62vw, 760px) auto; }
[dir=rtl] body { background-position: left -6vw bottom -4vh; }
@media (max-width: 700px) { body { background-size: 92vw auto; background-position: center bottom -6vh; } }
@media print { body { background: #fff; } }

/* Home hero with the HalalBook picture. */
.hb-hero-split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1.25rem; align-items: center; text-align: start; max-width: 1150px; margin: 0 auto; }
.hb-hero-split h1 { margin-inline: 0; }
.hb-hero-split p { margin-inline: 0; }
.hb-hero-img { width: 100%; height: auto; border-radius: 1.25rem; box-shadow: 0 20px 50px rgba(3,111,84,.25); }
@media (max-width: 900px) { .hb-hero-split { grid-template-columns: 1fr; text-align: center; } .hb-hero-img { max-width: 420px; margin: 0 auto; } }


/* ---------- Learn and save ---------- */
.hb-lessons { max-width: 860px; margin: 0 auto; }
.hb-lesson { display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: 1.25rem; margin-bottom: 1rem; }
.hb-lesson-num { width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--hb-green); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.hb-lesson h2 { font-size: 1.25rem; margin-bottom: .5rem; }
.hb-lesson p { line-height: 1.65; }
.hb-quiz { margin-top: .9rem; background: #f0fdf4; border-radius: .75rem; padding: .8rem 1rem; }
.hb-goal { padding: .75rem 0; border-bottom: 1px dashed var(--hb-border); }
@media (max-width: 600px) { .hb-lesson { grid-template-columns: 1fr; } }
/* Kids' book landing page (/kids) */
.hb-kids-hero { max-width: 980px; margin: 2rem auto 1.5rem; padding: 0 1rem; display: grid; grid-template-columns: minmax(0, 300px) 1fr; gap: 2rem; align-items: center; }
.hb-kids-cover img { width: 100%; height: auto; border-radius: 14px; box-shadow: 0 14px 34px rgba(15,118,110,.22); transform: rotate(-2deg); transition: transform .2s; }
.hb-kids-cover img:hover { transform: rotate(0) scale(1.02); }
.hb-kids-kicker { display: inline-block; background: #ede9fe; color: #6d28d9; font-weight: 700; border-radius: 999px; padding: .2rem .8rem; font-size: .85rem; margin-bottom: .6rem; }
.hb-kids-intro h1 { font-size: 1.7rem; font-weight: 650; color: var(--hb-green); margin-bottom: .5rem; }
.hb-kids-intro p { font-size: 1.1rem; line-height: 1.7; }
.hb-kids-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 .5rem; }
.hb-kids-small { color: var(--hb-muted); font-size: .85rem !important; }
.hb-kids-chapters { max-width: 980px; margin: 1rem auto; padding: 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .9rem; }
.hb-kids-chapter { display: flex; gap: .9rem; align-items: flex-start; background: #fff; border: 1px solid var(--hb-border); border-top: 5px solid var(--kc); border-radius: .9rem; padding: 1rem 1.1rem; }
.hb-kids-emoji { flex: 0 0 2.6rem; height: 2.6rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: color-mix(in srgb, var(--kc) 18%, #fff); }
.hb-kids-chapter h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 .25rem; }
.hb-kids-chapter p { margin: 0; color: var(--hb-muted); font-size: .92rem; }
.hb-kids-parents { max-width: 760px; margin: 2rem auto; padding: 1.75rem 2rem; background: #f0fdfa; border: 1px solid #99f6e4; border-radius: 1rem; }
.hb-kids-parents h2 { font-size: 1.4rem; font-weight: 700; color: var(--hb-green); }
.hb-kids-parents p { line-height: 1.7; }
@media (max-width: 700px) { .hb-kids-hero { grid-template-columns: 1fr; text-align: center; } .hb-kids-cover { max-width: 220px; margin: 0 auto; } .hb-kids-actions { justify-content: center; } .hb-kids-intro h1 { font-size: 1.45rem; } .hb-kids-parents { padding: 1.25rem 1rem; } }

/* ---------- Compact phones: smaller titles, tighter gaps, header on one line ---------- */
@media (max-width: 600px) {
    .hb-topbar { padding: .35rem .6rem; gap: .4rem; }
    .hb-topbar-end { gap: .3rem; }
    .hb-topbar .btn { white-space: nowrap; padding: .2rem .5rem; font-size: .8rem; }
    .hb-brand-top .hb-word { font-size: 1rem; }
    .hb-brand-top img { width: 24px; height: 24px; }
    .hb-lang-name, .hb-top-learn { display: none; }
    .hb-lang > summary { padding: .2rem .35rem; }
    .hb-hero .btn-lg { font-size: 1rem; padding: .45rem 1rem; }
    .hb-free-badge { font-size: .85rem !important; padding: .45rem .8rem; margin: .5rem 0; }
    .hb-content { padding: .6rem .75rem; }
    .hb-hero, .hb-history-hero { padding: .75rem .25rem .25rem; }
    .hb-hero h1, .hb-history-hero h1 { font-size: 1.35rem; line-height: 1.25; margin-bottom: .4rem; }
    .hb-hero p, .hb-history-hero p { font-size: .95rem; margin-bottom: .6rem; }
    .hb-hero-split { gap: .75rem; }
    .hb-hero-img { max-width: 240px; }
    .hb-features { margin: .75rem auto; gap: .6rem; }
    .hb-dedication { margin: 1rem auto .75rem; padding: 1rem; }
    .hb-plans, .hb-compare { margin-bottom: 1rem; }
    h1 { font-size: 1.2rem; }
    h2 { font-size: 1.05rem; }
}
@media (max-width: 420px) { .hb-brand-top .hb-word { display: none; } }

/* ---------- Get the app (/install) ---------- */
.hb-install-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; max-width: 1000px; margin: .5rem auto 1rem; }
.hb-install-card { background: #fff; border: 1px solid var(--hb-border); border-radius: .9rem; padding: .9rem 1rem; }
.hb-install-card h2 { font-size: 1.05rem; color: var(--hb-green); margin-bottom: .4rem; }
.hb-install-card ol { margin: 0; padding-inline-start: 1.2rem; line-height: 1.55; }
.hb-install-card.hb-highlight { border-color: var(--hb-green); box-shadow: 0 0 0 2px rgba(3,111,84,.15); }
.hb-installed-note { color: var(--hb-green); font-weight: 600; }
.hb-version { flex-basis: 100%; text-align: center; font-size: .78rem; }

/* ---------- Smart assistant ---------- */
.hb-insights { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.hb-insight { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .75rem; border-radius: .6rem; border: 1px solid var(--hb-border); background: #fff; }
.hb-insight.alert-level { background: #fef2f2; border-color: #fecaca; }
.hb-insight.warning-level { background: #fffbeb; border-color: #fde68a; }
.hb-insight.info-level { background: #f0f9ff; border-color: #bae6fd; }
.hb-forecast { display: flex; align-items: flex-end; gap: 4px; height: 180px; padding-top: .5rem; }
.hb-forecast-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.hb-forecast-bar { width: 100%; background: var(--hb-green); border-radius: 4px 4px 0 0; min-height: 2px; }
.hb-forecast-bar.neg { background: #dc2626; }
.hb-forecast-label { font-size: .65rem; color: var(--hb-muted); margin-top: .25rem; white-space: nowrap; overflow: hidden; }
.hb-answer { white-space: pre-wrap; line-height: 1.6; }

/* ---------- Check my books ---------- */
.hb-check-summary { padding: .7rem 1rem; }
.hb-check-summary.ok { background: #f0fdf4; border-color: #bbf7d0; }
.hb-check-summary.todo { background: #fffbeb; border-color: #fde68a; }
.hb-checks { list-style: none; margin: 0; padding: 0; }
.hb-check { padding: .5rem 0; border-bottom: 1px solid var(--hb-border); }
.hb-check:last-child { border-bottom: 0; }

/* ---------- AI showcase (/ai) and the home page AI band ---------- */
.hb-ai { --ai-ink: #0b2b22; --ai-purple: #6d3fd1; --ai-mint: #34d399; --ai-gold: #fbbf24; max-width: 1150px; margin: 0 auto; }
.hb-ai-hero, .hb-ai-band, .hb-ai-cta {
    position: relative; overflow: hidden; color: #ecfdf5; border-radius: 1.25rem;
    background: radial-gradient(120% 140% at 0% 0%, #0d5c46 0%, #06352a 45%, #1d1450 100%);
}
.hb-ai-hero::after, .hb-ai-band::after, .hb-ai-cta::after {
    content: ""; position: absolute; inset-inline-end: -10%; top: -40%; width: 60%; aspect-ratio: 1; pointer-events: none;
    background: radial-gradient(circle, rgba(139,92,246,.35), transparent 65%);
}
.hb-ai-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 1.5rem; align-items: center; padding: 2rem 2rem; margin: .5rem 0 1.25rem; }
.hb-ai-hero > *, .hb-ai-band > *, .hb-ai-cta > * { position: relative; z-index: 1; }
.hb-ai-hero h1, .hb-ai-head h2, .hb-ai-cta h2 { text-wrap: balance; }
.hb-ai-hero h1 { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: .6rem 0 .5rem; color: #fff; letter-spacing: -.01em; }
.hb-ai-hero p { font-size: 1.05rem; color: #c7e9dc; margin: 0 0 1rem; max-width: 560px; }
.hb-ai-pill { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; font-weight: 600; padding: .2rem .65rem; border-radius: 99px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); color: #fff; }
.hb-ai-pill .spark, .hb-ai-compare .head .new { color: var(--ai-gold); }
.hb-ai-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.hb-ai-btn { background: linear-gradient(135deg, #10b981, #059669); color: #fff; border: 0; font-weight: 600; padding: .5rem 1.1rem; border-radius: .6rem; box-shadow: 0 6px 18px rgba(16,185,129,.35); }
.hb-ai-btn:hover { color: #fff; filter: brightness(1.08); }
.hb-ai-btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.06); font-weight: 600; padding: .5rem 1.1rem; border-radius: .6rem; }
.hb-ai-btn-ghost:hover { color: #fff; background: rgba(255,255,255,.14); }

/* A small, CSS-only chat that shows "Ask your books" at work. */
.hb-ai-chat { background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.16); border-radius: 1rem; padding: .8rem; display: flex; flex-direction: column; gap: .45rem; backdrop-filter: blur(6px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.hb-ai-chat-head { font-size: .8rem; color: #a7f3d0; display: flex; align-items: center; gap: .4rem; padding-bottom: .35rem; border-bottom: 1px solid rgba(255,255,255,.1); }
.hb-ai-chat-head .dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ai-mint); box-shadow: 0 0 0 3px rgba(52,211,153,.25); }
.hb-ai-chat .bubble { max-width: 88%; padding: .45rem .7rem; border-radius: .8rem; font-size: .9rem; line-height: 1.35; animation: hb-ai-in .5s both; }
.hb-ai-chat .bubble.me { align-self: flex-end; background: #10b981; color: #fff; border-end-end-radius: .2rem; }
.hb-ai-chat .bubble.ai { align-self: flex-start; background: #fff; color: var(--ai-ink); border-end-start-radius: .2rem; }
.hb-ai-chat .bubble:nth-child(3) { animation-delay: .3s; } .hb-ai-chat .bubble:nth-child(4) { animation-delay: .6s; } .hb-ai-chat .bubble:nth-child(5) { animation-delay: .9s; }
.hb-ai-chat .typing { display: flex; gap: .25rem; padding: .6rem .8rem; }
.hb-ai-chat .typing span { width: .4rem; height: .4rem; border-radius: 50%; background: #94a3b8; animation: hb-ai-dot 1.2s infinite; }
.hb-ai-chat .typing span:nth-child(2) { animation-delay: .2s; } .hb-ai-chat .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes hb-ai-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes hb-ai-dot { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hb-ai-chat .bubble, .hb-ai-chat .typing span { animation: none; } }

.hb-ai-section { margin: 0 0 1.5rem; }
.hb-ai-head { margin-bottom: .6rem; }
.hb-ai-head h2, .hb-ai-trust h2 { font-size: 1.3rem; font-weight: 700; color: var(--ai-ink); margin: 0 0 .2rem; }
.hb-ai-head p { color: var(--hb-muted); margin: 0; }

.hb-ai-helpers { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.hb-ai-helper { position: relative; display: flex; flex-direction: column; gap: .3rem; background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: 1rem; text-decoration: none; color: var(--hb-text); transition: transform .15s, box-shadow .15s, border-color .15s; }
.hb-ai-helper::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; border-radius: 1rem 1rem 0 0; background: var(--accent); }
.hb-ai-helper:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 10px 28px rgba(15,23,42,.08); color: var(--hb-text); }
.hb-ai-helper .icon, .hb-ai-role .icon { width: 2.4rem; height: 2.4rem; display: grid; place-items: center; font-size: 1.25rem; border-radius: .75rem; background: color-mix(in srgb, var(--accent) 12%, #fff); }
.hb-ai-helper .tag { position: absolute; inset-inline-end: .8rem; top: .9rem; font-size: .7rem; font-weight: 700; padding: .1rem .5rem; border-radius: 99px; background: #ecfdf5; color: #047857; }
.hb-ai-helper .tag.ai { background: #f3efff; color: var(--ai-purple); }
.hb-ai-helper h3 { font-size: 1.02rem; font-weight: 700; margin: .25rem 0 0; color: var(--ai-ink); }
.hb-ai-helper p { font-size: .9rem; color: var(--hb-muted); margin: 0; flex: 1; }
.hb-ai-helper .more { font-size: .85rem; font-weight: 600; color: var(--accent); }
[dir=rtl] .hb-ai .arrow { display: inline-block; transform: scaleX(-1); }

.hb-ai-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; counter-reset: none; }
.hb-ai-steps li { display: grid; grid-template-columns: auto 1fr; column-gap: .65rem; align-items: start; background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: .8rem 1rem; }
.hb-ai-steps .n { grid-row: span 2; width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #10b981, #6d3fd1); }
.hb-ai-steps b { color: var(--ai-ink); }
.hb-ai-steps li > span:last-child { font-size: .88rem; color: var(--hb-muted); }

.hb-ai-compare { background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; overflow: hidden; }
.hb-ai-compare .row { display: grid; grid-template-columns: .8fr 1fr 1.2fr; margin: 0; }
.hb-ai-compare .row > span { padding: .6rem .9rem; border-top: 1px solid var(--hb-border); }
.hb-ai-compare .head > span { border-top: 0; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--hb-muted); background: #f9fafb; }
.hb-ai-compare .head .new { background: #06352a; }
.hb-ai-compare .task { font-weight: 600; color: var(--ai-ink); }
.hb-ai-compare .old { color: var(--hb-muted); }
.hb-ai-compare .old::before { content: "✕ "; color: #dc2626; font-weight: 700; }
.hb-ai-compare .new { background: #f0fdf7; color: #065f46; font-weight: 500; }
.hb-ai-compare .new::before { content: "✓ "; color: #059669; font-weight: 700; }
.hb-ai-compare .head .old::before, .hb-ai-compare .head .new::before { content: none; }

.hb-ai-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.hb-ai-role { background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: 1rem; border-top: 3px solid var(--accent); }
.hb-ai-role h3 { font-size: 1.05rem; font-weight: 700; color: var(--ai-ink); margin: .5rem 0 .35rem; }
.hb-ai-role ul, .hb-ai-trust ul { margin: 0; padding-inline-start: 1.1rem; }
.hb-ai-role li, .hb-ai-trust li { font-size: .92rem; margin-bottom: .25rem; }
.hb-ai-role li::marker { color: var(--accent); }

.hb-ai-trust { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1rem; background: linear-gradient(135deg, #f5f3ff, #ecfdf5); border: 1px solid #e4dcfb; border-radius: 1rem; padding: 1.1rem 1.25rem; }
.hb-ai-trust li::marker { color: #059669; }
.hb-ai-trust .note { font-size: .85rem; color: var(--hb-muted); margin: .5rem 0 0; }
.hb-ai-faq details { background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: .55rem .8rem; margin-bottom: .5rem; }
.hb-ai-faq summary { font-weight: 600; cursor: pointer; color: var(--ai-ink); }
.hb-ai-faq p { margin: .35rem 0 0; font-size: .92rem; color: var(--hb-muted); }

.hb-ai-downloads { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.hb-ai-downloads a { display: flex; align-items: center; gap: .75rem; background: #fff; border: 1px solid var(--hb-border); border-radius: 1rem; padding: .8rem 1rem; text-decoration: none; color: var(--hb-text); transition: border-color .15s, box-shadow .15s; }
.hb-ai-downloads a:hover { border-color: var(--hb-green); box-shadow: 0 6px 20px rgba(3,111,84,.1); color: var(--hb-text); }
.hb-ai-downloads .icon { flex: 0 0 2.6rem; height: 2.6rem; border-radius: .6rem; display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #fff; }
.hb-ai-downloads .icon.pdf { background: #dc2626; } .hb-ai-downloads .icon.ppt { background: #c2410c; } .hb-ai-downloads .icon.man { background: #ecfdf5; font-size: 1.2rem; }
.hb-ai-downloads b { display: block; color: var(--ai-ink); }
.hb-ai-downloads small { color: var(--hb-muted); }

.hb-ai-cta { text-align: center; padding: 1.6rem 1rem; margin-bottom: 1.5rem; }
.hb-ai-cta h2 { color: #fff; font-size: 1.4rem; font-weight: 700; margin: 0 0 .3rem; }
.hb-ai-cta p { color: #c7e9dc; margin: 0 0 .9rem; }
.hb-ai-cta .btn { margin: .2rem; }

/* Home page band that leads to /ai. */
.hb-ai-band { max-width: 1100px; margin: 1.25rem auto; padding: 1.25rem 1.5rem; display: grid; grid-template-columns: 1fr 1.3fr; gap: 1.25rem; align-items: center; }
.hb-ai-band h2 { color: #fff; font-size: 1.35rem; font-weight: 700; margin: .45rem 0 .35rem; }
.hb-ai-band p { color: #c7e9dc; margin: 0 0 .75rem; }
.hb-ai-band-list { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.hb-ai-band-list a { display: flex; gap: .55rem; align-items: flex-start; padding: .6rem .7rem; border-radius: .8rem; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); color: #ecfdf5; text-decoration: none; font-size: .88rem; transition: background .15s; }
.hb-ai-band-list a:hover { background: rgba(255,255,255,.14); color: #fff; }
.hb-ai-band-list b { display: block; color: #fff; font-size: .95rem; }
.hb-ai-band-list .i { font-size: 1.2rem; line-height: 1.2; }
.hb-ai-band .arrow { display: inline-block; } [dir=rtl] .hb-ai-band .arrow { transform: scaleX(-1); }

@media (max-width: 900px) {
    .hb-ai-hero, .hb-ai-band, .hb-ai-trust { grid-template-columns: 1fr; }
    .hb-ai-helpers { grid-template-columns: 1fr 1fr; }
    .hb-ai-roles, .hb-ai-downloads { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .hb-ai-hero { padding: 1.1rem 1rem; gap: 1rem; border-radius: 1rem; }
    .hb-ai-hero h1 { font-size: 1.45rem; }
    .hb-ai-hero p { font-size: .95rem; }
    .hb-ai-helpers, .hb-ai-steps, .hb-ai-band-list { grid-template-columns: 1fr; }
    .hb-ai-band { padding: 1rem; margin: .75rem auto; }
    .hb-ai-section { margin-bottom: 1.1rem; }
    /* The comparison becomes one card per task on phones. */
    .hb-ai-compare .head { display: none; }
    .hb-ai-compare .row { grid-template-columns: 1fr; border-top: 1px solid var(--hb-border); padding: .5rem 0; }
    .hb-ai-compare .row:nth-child(2) { border-top: 0; }
    .hb-ai-compare .row > span { border-top: 0; padding: .15rem .9rem; }
    .hb-ai-compare .new { background: none; }
}

/* The customer's view of a shared invoice. */
.hb-shared-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 860px; background: #fff; border: 1px solid var(--hb-border); border-radius: .75rem; padding: .7rem 1rem; margin-bottom: .75rem; }
.hb-send { max-width: 860px; }
.hb-send .hb-share-link { font-family: ui-monospace, monospace; font-size: .85rem; }
.hb-attach h2 { font-size: 1rem; }
.hb-attach-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.hb-attach-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-top: 1px solid var(--hb-border, #e5e7eb); }
.hb-attach-list li:first-child { border-top: 0; }
.hb-attach-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-statement-due { text-align: end; background: #f0fdf7; border: 1px solid #a7f3d0; border-radius: .75rem; padding: .5rem .9rem; }
.hb-aging { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.hb-aging > div { border: 1px solid var(--hb-border); border-radius: .6rem; padding: .35rem .6rem; display: flex; flex-direction: column; }
.hb-aging span { font-size: .75rem; color: var(--hb-muted); }
@media (max-width: 600px) { .hb-aging { grid-template-columns: 1fr 1fr; } }

/* Multiple currencies: a small code badge next to amounts in another currency. */
.hb-currency { display: inline-block; padding: 0 .4em; border-radius: .35rem; font-size: .75em; font-weight: 600; letter-spacing: .04em;
    background: var(--bs-primary-bg-subtle, #e7f0ff); color: var(--bs-primary-text-emphasis, #0b3a75); vertical-align: middle; }
.hb-code-input { width: 6.5rem; text-transform: uppercase; }
.hb-rate-input { min-width: 7rem; }

/* Payment links: how a customer can pay, on the invoice and its link. */
.hb-howtopay { border-top: 1px dashed var(--bs-border-color, #dee2e6); padding-top: .75rem; }
.hb-howtopay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
.hb-payopt { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .6rem; padding: .5rem .75rem; background: var(--bs-body-bg, #fff); }
.hb-payopt-name { font-weight: 600; }
.hb-payopt-details { white-space: pre-line; font-family: var(--bs-font-monospace, monospace); font-size: .9em; }
.hb-paid-form { border: 1px solid var(--bs-border-color, #dee2e6); border-radius: .75rem; padding: 1rem; background: var(--bs-tertiary-bg, #f8f9fa); }
@media print { .hb-payopt { break-inside: avoid; } }

/* ---------- More AI helpers (v1.20.0) ---------- */
.hb-ai-explain { margin: .5rem 0 .75rem; }
.hb-ai-card { border-color: #ddd6fe; background: #faf8ff; padding: .7rem .9rem; margin-bottom: 0; }
.hb-ai-card ul { padding-inline-start: 1.2rem; }
.hb-ai-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hb-ai-tools .form-select { width: auto; }
.hb-ai-new { font-size: .95rem; font-weight: 600; margin-top: -.25rem; }
