:root {
  --books-ink: #13233a;
  --books-accent: #1f6feb;
  --books-accent-soft: #e8f0fe;
  --books-sidebar: #13233a;
  --books-sidebar-text: #c9d4e3;
  --books-bg: #f5f7fb;
  --bs-primary: #1f6feb;
  --bs-primary-rgb: 31, 111, 235;
  --bs-link-color: #1f6feb;
  --bs-link-color-rgb: 31, 111, 235;
  --bs-body-bg: #f5f7fb;
}
body { background: var(--books-bg); color: var(--books-ink); }
.btn-primary { --bs-btn-bg: #1f6feb; --bs-btn-border-color: #1f6feb; --bs-btn-hover-bg: #195bc4; --bs-btn-hover-border-color: #195bc4; --bs-btn-active-bg: #164fa9; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--books-sidebar); color: var(--books-sidebar-text); padding: 1.25rem .9rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.5rem; background: #fff; border-bottom: 1px solid #e3e8ef; position: sticky; top: 0; z-index: 10; }
.topbar-title { flex: 1; min-width: 0; }
.content { padding: 1.5rem; max-width: 1280px; width: 100%; }

.brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; font-size: 1.1rem; text-decoration: none; margin-bottom: 1.1rem; }
.brand:hover { color: #fff; }
.brand-dark, .brand-dark:hover { color: var(--books-ink); }
.brand-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .5rem; background: var(--books-accent); color: #fff; font-size: .85rem; font-weight: 800; letter-spacing: -.02em; }

.biz-switch { margin-bottom: 1rem; }
.sidebar .nav-link { color: var(--books-sidebar-text); border-radius: .45rem; padding: .45rem .65rem; display: flex; align-items: center; gap: .6rem; font-size: .93rem; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--books-accent); color: #fff; }
.nav-icon { width: 1.1rem; text-align: center; opacity: .85; }
.nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #7f8ea5; margin: 1.1rem .65rem .35rem; }

@media (max-width: 991.98px) {
  .sidebar { position: fixed; left: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .content { padding: 1rem; }
}

/* Page furniture */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 700; margin: 0; }
.card { border-color: #e3e8ef; border-radius: .75rem; }
.card-header { background: #fff; border-bottom-color: #e3e8ef; font-weight: 600; }
.stat-card .label { font-size: .8rem; color: #6b7a90; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.table { --bs-table-bg: transparent; }
.table > :not(caption) > * > * { padding: .55rem .75rem; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: #6b7a90; font-weight: 600; border-bottom-width: 1px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-card { background: #fff; border: 1px solid #e3e8ef; border-radius: .75rem; overflow-x: auto; }
.table-card .table { margin: 0; }
tr.total-row td { font-weight: 700; border-top: 2px solid #c9d1dc; }
tr.child-row td:first-child { padding-left: 2rem; }
.text-muted-2 { color: #8795a8; }
.badge-status-draft { background: #fff4d6; color: #7a5a00; }
.badge-status-posted { background: #dff5e6; color: #146c2e; }
.badge-status-reversed { background: #eceff3; color: #5b6676; }
.badge-uncat { background: #fde8e8; color: #9b1c1c; }

/* Journal line editor */
.lines-table td { vertical-align: middle; }
.lines-table input.form-control, .lines-table select { min-width: 0; }
.lines-table .col-acct { min-width: 220px; }
.lines-table .col-amt { width: 140px; }
.balance-ok { color: #146c2e; }
.balance-bad { color: #b42318; }

/* Guest pages */
body.guest { background: linear-gradient(160deg, #eef3fb 0%, #f7f9fc 60%); }
.guest-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; }
.guest-card { width: 100%; max-width: 420px; }
.divider { display: flex; align-items: center; gap: .75rem; color: #8795a8; font-size: .85rem; margin: 1.1rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid #e3e8ef; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: .6rem; background: #fff; border: 1px solid #c9d1dc; color: #1f2937; font-weight: 500; }
.btn-google:hover { background: #f5f7fb; border-color: #aeb8c6; }

/* Help center */
.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 2rem; }
@media (max-width: 991.98px) { .help-layout { grid-template-columns: 1fr; } .help-toc { order: 2; } }
.help-toc { font-size: .9rem; }
.help-toc .group { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: #7f8ea5; margin: 1rem 0 .3rem; }
.help-toc a { display: block; padding: .25rem .5rem; border-radius: .35rem; color: var(--books-ink); text-decoration: none; }
.help-toc a:hover { background: var(--books-accent-soft); }
.help-toc a.active { background: var(--books-accent); color: #fff; }
.help-article { max-width: 820px; }
.help-article h2 { font-size: 1.15rem; font-weight: 700; margin: 2rem 0 .75rem; }
.help-article h3 { font-size: 1rem; font-weight: 700; margin: 1.25rem 0 .5rem; }
.help-article p, .help-article li { line-height: 1.6; }
.help-lead { font-size: 1.05rem; color: #3b4a5f; }
.help-steps { list-style: none; counter-reset: step; padding: 0; margin: 0 0 1rem; }
.help-steps > li { counter-increment: step; position: relative; padding: .9rem 1rem .9rem 3.4rem; background: #fff; border: 1px solid #e3e8ef; border-radius: .6rem; margin-bottom: .6rem; }
.help-steps > li::before { content: counter(step); position: absolute; left: 1rem; top: .85rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--books-accent); color: #fff; font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.help-step-title { font-weight: 700; margin-bottom: .15rem; }
.help-step-body { color: #3b4a5f; }
.help-callout { border-left: 4px solid var(--books-accent); background: var(--books-accent-soft); padding: .7rem 1rem; border-radius: .35rem; margin: 1rem 0; }
.help-note { border-left-color: #6b7a90; background: #f1f4f9; }
.help-warn { border-left-color: #d97706; background: #fff7e6; }
.help-faq details { background: #fff; border: 1px solid #e3e8ef; border-radius: .5rem; padding: .6rem 1rem; margin-bottom: .5rem; }
.help-faq summary { font-weight: 600; cursor: pointer; }
.help-faq details > div { margin-top: .5rem; color: #3b4a5f; }
.help-card { display: block; height: 100%; padding: 1rem; background: #fff; border: 1px solid #e3e8ef; border-radius: .6rem; color: var(--books-ink); text-decoration: none; }
.help-card:hover { border-color: var(--books-accent); box-shadow: 0 2px 10px rgba(31,111,235,.08); }
.help-card .t { font-weight: 700; margin-bottom: .2rem; }
.help-card .s { font-size: .88rem; color: #5b6676; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: .75rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid #eef1f5; }
.checklist li:last-child { border-bottom: 0; }
.checklist .mark { flex: 0 0 1.4rem; height: 1.4rem; border-radius: 50%; border: 2px solid #c9d1dc; display: grid; place-items: center; font-size: .8rem; font-weight: 700; }
.checklist .done .mark { background: #146c2e; border-color: #146c2e; color: #fff; }
.checklist .done .label { color: #6b7a90; text-decoration: line-through; }
.checklist .why { font-size: .85rem; color: #6b7a90; }
