/* Hesabja — design system (royal blue + cool gray). No external dependencies. */
/* Vazirmatn by Saber Rastikerdar — SIL Open Font License 1.1 (assets/fonts/OFL.txt) */
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-ExtraBold.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/Vazirmatn-Black.woff2") format("woff2"); font-weight: 900; font-style: normal; font-display: swap; }
:root {
  --brand: #1E4FD8;
  --brand-600: #1A3FB0;
  --brand-50: #EAF0FD;
  --brand-100: #D5E1FB;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #5D6779;
  --muted-2: #98A2B3;
  --line: #E4E7EC;
  --line-2: #F2F4F7;
  --bg: #F1F3F6;
  --card: #FFFFFF;
  --side: #0F172A;
  --side-2: #1E293B;
  --side-text: #C5CEDB;
  --ok: #067647; --ok-bg: #ECFDF3;
  --warn: #B54708; --warn-bg: #FFFAEB;
  --bad: #B42318; --bad-bg: #FEF3F2;
  --info: #026AA2; --info-bg: #E0F2FE;
  --vio: #5925DC; --vio-bg: #F4F3FF;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --font: "Vazirmatn", "Vazir", "IRANSansX", "IRANSans", Tahoma, "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.8; color: var(--ink); background: var(--bg); }
img, svg { max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
h1, h2, h3, h4 { margin: 0; line-height: 1.5; color: var(--ink); }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(30,79,216,.35); outline-offset: 2px; }
[dir="ltr"] { direction: ltr; }
.ltr { direction: ltr; unicode-bidi: embed; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.bold { font-weight: 700; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.text-ok { color: var(--ok); } .text-bad { color: var(--bad); } .text-warn { color: var(--warn); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); color: #fff; }
.btn-light { background: #fff; border-color: #D0D5DD; color: var(--ink-2); }
.btn-light:hover { background: #F9FAFB; color: var(--ink); }
.btn-dark { background: var(--side); color: #fff; }
.btn-dark:hover { background: var(--side-2); color: #fff; }
.btn-danger { background: #fff; border-color: #FDA29B; color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); color: var(--bad); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-soft { background: var(--brand-50); color: var(--brand-600); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 16px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font-weight: 600; cursor: pointer; }
.inline-form { display: inline; }

/* ---------- Cards & layout blocks ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.card-tight { padding: 16px; }
.card-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.col-main { flex: 2 1 520px; min-width: 0; }
.col-side { flex: 1 1 300px; min-width: 0; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat .value { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .note { font-size: 12px; font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv > :first-child { color: var(--muted); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { margin-bottom: 6px; color: var(--ink); }

/* ---------- Status badges (colour + icon + label) ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.6; }
.st-gray { background: #F2F4F7; color: #475467; }
.st-sky { background: var(--info-bg); color: var(--info); }
.st-violet { background: var(--vio-bg); color: var(--vio); }
.st-amber { background: var(--warn-bg); color: var(--warn); }
.st-green { background: var(--ok-bg); color: var(--ok); }
.st-red { background: var(--bad-bg); color: var(--bad); }
.st-slate { background: #EAECF0; color: #344054; }
.st-blue { background: var(--brand-50); color: var(--brand-600); }
.pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-size: 12px; font-weight: 600; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.alert-success { background: var(--ok-bg); border-color: #ABEFC6; color: #05603A; }
.alert-error { background: var(--bad-bg); border-color: #FECDCA; color: #912018; }
.alert-info { background: var(--brand-50); border-color: #B2CCFF; color: var(--brand-600); }
.alert-warn { background: var(--warn-bg); border-color: #FEDF89; color: #93370D; }
.alert ul { margin: 0; padding-inline-start: 18px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid #D0D5DD; border-radius: var(--radius-sm); background: #fff; font-size: 15px; transition: border-color .15s, box-shadow .15s; }
.textarea { padding: 10px 12px; min-height: 110px; resize: vertical; line-height: 1.9; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(30,79,216,.15); }
.input[readonly] { background: #F9FAFB; }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: #FDA29B; }
.help { font-size: 12px; color: var(--muted); }
.error { font-size: 12px; color: var(--bad); font-weight: 600; }
.row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; line-height: 1.8; }
.check input { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--brand); flex: 0 0 auto; }
.input-group { display: flex; align-items: stretch; border: 1px solid #D0D5DD; border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.input-group .input { border: 0; border-radius: 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; background: var(--line-2); color: var(--muted); font-size: 13px; white-space: nowrap; }
.color-input { width: 64px; height: 44px; padding: 4px; border: 1px solid #D0D5DD; border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 15px; font-weight: 800; margin-bottom: 12px; padding: 0; }

.seg { display: inline-flex; gap: 4px; background: #E4E7EC; padding: 4px; border-radius: 12px; flex-wrap: wrap; }
.seg a, .seg label { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg a.on, .seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.12); }
.seg label { padding: 0; }
.seg label span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 9px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #D0D5DD; background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.chip.on { background: var(--side); border-color: var(--side); color: #fff; }

/* Captcha */
.captcha { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.captcha img { height: 48px; width: 150px; border-radius: 10px; border: 1px solid var(--line); background: #F1F4FA; }
.captcha .input { flex: 1; min-width: 120px; letter-spacing: .25em; text-transform: uppercase; direction: ltr; text-align: center; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.table th { text-align: start; font-size: 12px; font-weight: 700; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #FAFBFD; }
.table .num { white-space: nowrap; font-weight: 700; }

/* ---------- App shell (panel & admin) ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 256px; flex: 0 0 256px; background: var(--side); color: var(--side-text); padding: 20px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar.admin { background: #0B1220; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: #fff; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--brand); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.brand-name { font-size: 19px; font-weight: 900; color: #fff; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #8C99AD; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; color: #7D8AA0; padding: 0 12px 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--side-text); font-size: 14px; font-weight: 500; }
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.on { background: var(--side-2); color: #fff; font-weight: 700; }
.nav svg { width: 19px; height: 19px; flex: 0 0 auto; }
.nav .count { margin-inline-start: auto; background: #F04438; color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 0 7px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.plan-box { background: #1A2436; border: 1px solid #2A3850; border-radius: 14px; padding: 12px 14px; font-size: 12px; color: #9AA7BA; }
.plan-box strong { color: #fff; font-size: 13px; display: block; }
.credit { padding: 12px 8px 0; border-top: 1px solid var(--side-2); font-size: 11px; color: #7D8AA0; line-height: 1.9; }
.credit a { color: var(--side-text); font-weight: 700; }
.main { flex: 1; min-width: 0; padding: 26px 30px 48px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.topbar .title { display: flex; flex-direction: column; gap: 2px; }
.topbar .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.menu-btn { display: none; }
.backdrop { display: none; }
.impersonating { background: #FFFAEB; border-bottom: 1px solid #FEDF89; color: #93370D; padding: 8px 16px; font-size: 13px; display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }

@media (max-width: 960px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; transform: translateX(100%); transition: transform .2s; height: 100%; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  html[dir="ltr"] .sidebar { transform: translateX(-100%); }
  .app.menu-open .sidebar { transform: none; }
  .app.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 40; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 90px; }
  h1 { font-size: 20px; }
}

/* Mobile bottom navigation (panel) */
.bottom-nav { display: none; }
@media (max-width: 960px) {
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(8px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); font-weight: 600; padding: 4px 0; }
  .bottom-nav a.on { color: var(--brand); }
  .bottom-nav svg { width: 22px; height: 22px; }
}

/* Chart (pure CSS bars) */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 220px; border-bottom: 1px solid var(--line); padding: 0 4px; }
.chart .col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.chart .bar { width: 40%; max-width: 20px; border-radius: 6px 6px 2px 2px; background: var(--brand); min-height: 2px; }
.chart .bar.alt { background: #98A2B3; }
.chart-labels { display: flex; gap: 8px; padding: 0 4px; }
.chart-labels span { flex: 1 1 0; text-align: center; font-size: 12px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: middle; }
.progress { height: 8px; border-radius: 8px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 8px; background: var(--brand); }

/* Banner & ads */
.banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; background: var(--brand-50); border: 1px solid #B2CCFF; border-radius: 14px; padding: 12px 16px; color: var(--brand-600); font-size: 14px; }
.banner .tag { font-size: 11px; font-weight: 800; background: var(--brand); color: #fff; border-radius: 999px; padding: 2px 10px; }
.ad { position: relative; display: flex; gap: 14px; align-items: center; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: 12px; overflow: hidden; color: var(--ink); }
.ad:hover { color: var(--ink); border-color: #B2CCFF; }
.ad img { border-radius: 10px; max-height: 120px; width: auto; }
.ad.banner-only { padding: 0; }
.ad.banner-only img { width: 100%; max-height: none; border-radius: 0; display: block; }
.ad .ad-tag { position: absolute; top: 6px; inset-inline-end: 8px; font-size: 10px; color: var(--muted); background: rgba(255,255,255,.85); border-radius: 6px; padding: 0 6px; }

/* Pagination */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 16px; }
.pagination a, .pagination span { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pagination .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .off { color: var(--muted-2); }

/* Invoice item editor */
.items-table input { min-width: 0; }
.items-table td { padding: 6px 6px; }
.items-table .col-title { min-width: 220px; }
.items-table .col-qty { width: 90px; }
.items-table .col-unit { width: 100px; }
.items-table .col-price { width: 150px; }
.items-table .col-total { width: 150px; font-weight: 700; white-space: nowrap; }
.totals { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin-inline-start: auto; font-size: 14px; }
.totals .grand { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 800; font-size: 16px; }

/* Documents (invoice / contract preview) */
.doc { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(16,24,40,.1), 0 16px 40px rgba(16,24,40,.07); overflow: hidden; }
.doc-top { height: 8px; background: var(--doc-color, var(--brand)); }
.doc-body { padding: 32px 34px; display: flex; flex-direction: column; gap: 24px; }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; align-items: flex-start; }
.doc-logo { width: 56px; height: 56px; border-radius: 14px; background: var(--doc-color, var(--brand)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 800; overflow: hidden; flex: 0 0 auto; }
.doc-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.doc-title { font-size: 22px; font-weight: 900; color: var(--doc-color, var(--brand)); }
.doc-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; background: #F9FAFB; border-radius: 12px; padding: 14px 16px; }
.doc-meta span { display: block; font-size: 11px; color: var(--muted); }
.doc-meta strong { font-size: 14px; }
.doc-parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.doc-parties .who { font-size: 11px; font-weight: 800; color: var(--doc-color, var(--brand)); }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc-table th { background: color-mix(in srgb, var(--doc-color, var(--brand)) 10%, #fff); color: var(--doc-color, var(--brand)); font-size: 12px; padding: 10px 12px; text-align: start; }
.doc-table td { padding: 12px; border-bottom: 1px solid var(--line-2); }
.doc-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 18px; }
.doc .grand { background: var(--doc-color, var(--brand)); }
.doc-strip { padding: 10px 34px; background: #F9FAFB; font-size: 11px; color: #667085; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sign-img { max-height: 70px; max-width: 160px; }
.qr-box { width: 120px; height: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; background: #fff; flex: 0 0 auto; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.contract-text { white-space: pre-wrap; font-size: 15px; line-height: 2.1; color: var(--ink-2); }
@media (max-width: 640px) { .doc-body { padding: 22px 18px; } .doc-strip { padding: 10px 18px; } }

/* Signature pad */
.sig-wrap { position: relative; border: 1.5px dashed #98A2B3; border-radius: 14px; background: #FCFCFD; }
.sig-wrap canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.sig-wrap .hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #98A2B3; font-size: 14px; pointer-events: none; }
.sig-wrap.signed .hint { display: none; }

/* Timeline (changelog, audit trail) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding-inline-start: 28px; padding-bottom: 28px; }
.timeline > li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 22px; bottom: 0; width: 2px; background: var(--line); }
.timeline > li::after { content: ""; position: absolute; inset-inline-start: 0; top: 8px; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--dot, #98A2B3); background: #fff; }
.timeline > li:last-child::before { display: none; }
.tag { display: inline-block; min-width: 70px; text-align: center; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 2px 8px; }

/* ---------- Public site ---------- */
.site { background: #fff; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.site-header { border-bottom: 1px solid #EEF1F5; background: rgba(255,255,255,.96); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(6px); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.site-nav { display: flex; gap: 24px; font-size: 14px; font-weight: 600; }
.site-nav a { color: var(--ink-2); }
.site-nav a:hover, .site-nav a.on { color: var(--brand); }
.site-logo { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 21px; font-weight: 900; }
.site-logo:hover { color: var(--ink); }
@media (max-width: 820px) { .site-nav { display: none; } }
.hero { background: #F5F7FB; border-bottom: 1px solid #EEF1F5; }
.hero .container { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; padding-top: 64px; padding-bottom: 72px; }
.hero h1 { font-size: clamp(30px, 4.4vw, 50px); line-height: 1.35; font-weight: 900; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero .lead { font-size: 18px; color: #475467; line-height: 2; max-width: 560px; }
.kicker { display: inline-block; font-size: 13px; font-weight: 700; color: var(--brand); background: var(--brand-50); border-radius: 999px; padding: 6px 14px; }
.section { padding: 72px 0; }
.section-alt { background: #F5F7FB; }
.section-dark { background: var(--side); color: #fff; }
.section-dark h2 { color: #fff; }
.section-title { font-size: clamp(24px, 3vw, 34px); font-weight: 900; margin-bottom: 10px; }
.section-lead { font-size: 16px; color: #475467; line-height: 2; max-width: 700px; }
.feature { border: 1px solid var(--line); border-radius: 18px; padding: 24px; background: #fff; display: flex; flex-direction: column; gap: 10px; }
.feature .ico { width: 46px; height: 46px; border-radius: 13px; background: var(--brand-50); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.feature .ico svg { width: 24px; height: 24px; }
.feature p { color: #475467; font-size: 14px; line-height: 2; }
.plan { border: 1px solid var(--line); border-radius: 20px; padding: 26px; background: #fff; display: flex; flex-direction: column; gap: 14px; }
.plan.featured { background: var(--brand); border-color: var(--brand); color: #fff; }
.plan.featured h3, .plan.featured .price { color: #fff; }
.plan.featured .muted { color: #DCE6FD; }
.plan .price { font-size: 32px; font-weight: 900; }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; flex: 1; }
.plan li::before { content: "✓"; font-weight: 900; margin-inline-end: 8px; color: var(--brand); }
.plan.featured li::before { color: #fff; }
.compare th, .compare td { text-align: center; }
.compare th:first-child, .compare td:first-child { text-align: start; }
.compare .grp td { background: #F5F7FB; color: var(--brand); font-weight: 800; font-size: 13px; text-align: start; }
.compare .yes { color: var(--brand); font-weight: 900; }
.compare .no { color: var(--muted-2); }
.faq details { border: 1px solid var(--line); border-radius: 14px; padding: 0 18px; background: #fff; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; list-style: none; padding: 16px 0; font-weight: 700; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: "+"; color: var(--brand); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { padding-bottom: 16px; color: #475467; line-height: 2.1; font-size: 14px; }
.cta { background: var(--brand); border-radius: 24px; padding: 44px 32px; color: #fff; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.cta h2 { color: #fff; font-size: clamp(22px, 2.8vw, 30px); font-weight: 900; }
.site-footer { border-top: 1px solid #EEF1F5; background: #F5F7FB; font-size: 13px; color: var(--muted); }
.site-footer .cols-f { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; padding: 36px 0; }
.site-footer h4 { font-size: 14px; color: var(--ink); margin-bottom: 8px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.site-footer a { color: var(--muted); }
.site-footer .bottom { border-top: 1px solid var(--line); padding: 14px 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; font-size: 12px; }
.mock { background: #fff; border-radius: 18px; box-shadow: 0 2px 4px rgba(16,24,40,.05), 0 24px 48px rgba(16,24,40,.1); padding: 22px; display: flex; flex-direction: column; gap: 16px; }

/* Public profile */
.profile-hero { background: linear-gradient(180deg, var(--p-color, var(--brand)) 0 140px, #F5F7FB 140px); padding-top: 60px; }
.profile-card { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 28px; display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.profile-avatar { width: 112px; height: 112px; border-radius: 28px; background: var(--p-color, var(--brand)); color: #fff; font-size: 44px; font-weight: 900; display: flex; align-items: center; justify-content: center; overflow: hidden; flex: 0 0 auto; border: 4px solid #fff; box-shadow: 0 4px 16px rgba(16,24,40,.12); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.socials a { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; background: #fff; }

/* Auth & installer */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; background: #fff; }
.auth-side { flex: 1 1 420px; background: var(--brand); color: #fff; padding: 48px; display: flex; flex-direction: column; gap: 24px; }
.auth-side h2 { color: #fff; font-size: clamp(24px, 3vw, 34px); font-weight: 900; line-height: 1.5; }
.auth-side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; }
.auth-side li::before { content: "✓"; margin-inline-end: 10px; font-weight: 900; }
.auth-side .credit-line { margin-top: auto; font-size: 12px; color: #C7D6F8; }
.auth-side .credit-line a { color: #fff; font-weight: 800; }
.auth-main { flex: 1 1 460px; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 760px) { .auth-side { padding: 28px 20px; flex-basis: 100%; } .auth-side ul { display: none; } }
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 6px; border-radius: 6px; background: var(--line); }
.steps span.on { background: var(--brand); }
.req { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }

/* Print: documents only */
@media print {
  body { background: #fff; }
  .no-print, .sidebar, .site-header, .site-footer, .bottom-nav, .topbar .actions, .ad, .banner { display: none !important; }
  .main { padding: 0; }
  .doc { box-shadow: none; }
}

/* ---------- Blog ---------- */
.post-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s; }
.post-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.post-card h3 a { color: var(--ink); }
.post-cover { display: block; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--brand-50), #fff); overflow: hidden; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-cover-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 56px; font-weight: 900; color: var(--brand); opacity: .35; }
.post-hero { width: 100%; height: auto; border-radius: 18px; margin-bottom: 20px; }
.prose { font-size: 17px; line-height: 2.15; color: #1D2939; }
.prose h2 { font-size: 23px; margin: 36px 0 12px; line-height: 1.7; scroll-margin-top: 80px; }
.prose h3 { font-size: 19px; margin: 26px 0 10px; scroll-margin-top: 80px; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-inline-start: 24px; margin: 0 0 18px; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.prose blockquote { margin: 20px 0; padding: 14px 18px; border-inline-start: 4px solid var(--brand); background: var(--brand-50); border-radius: 10px; color: var(--ink-2); }
.prose blockquote p:last-child { margin: 0; }
.prose code { background: #F2F4F7; padding: 2px 6px; border-radius: 6px; font-size: 14px; direction: ltr; unicode-bidi: embed; }
.prose strong { color: var(--ink); }
.toc ol { margin: 10px 0 0; padding-inline-start: 22px; line-height: 2.1; }
.toc li.sub { margin-inline-start: 16px; font-size: 14px; }
.toc a { color: var(--ink-2); }
.cta-box { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding: 22px; border-radius: 18px; background: linear-gradient(135deg, var(--brand), #3B6CF0); color: #fff; }
.cta-box .btn-primary { background: #fff; color: var(--brand); }
.serp { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; background: #fff; font-family: Arial, var(--font); }
.serp-url { font-size: 12px; color: #4D5156; }
.serp-title { font-size: 17px; color: #1A0DAB; line-height: 1.5; }
.serp-desc { font-size: 13px; color: #4D5156; line-height: 1.7; }
.char-count { font-size: 12px; color: var(--muted); }
.char-count.over { color: var(--bad); font-weight: 700; }

/* ---------- Help center & tour ---------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.help-topic { border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.help-topic > summary { cursor: pointer; padding: 14px 16px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 8px; }
.help-topic > summary::-webkit-details-marker { display: none; }
.help-topic > summary::after { content: "+"; color: var(--muted); font-weight: 400; }
.help-topic[open] > summary::after { content: "−"; }
.help-topic .help-body { padding: 0 16px 16px; font-size: 14px; line-height: 2.1; color: var(--ink-2); }
.help-topic .help-body ol, .help-topic .help-body ul { padding-inline-start: 20px; margin: 6px 0; }
.help-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-weight: 800; font-size: 14px; background: #fff; }
.help-btn:hover { color: var(--brand); border-color: var(--brand); }
.tour-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .55); z-index: 900; }
.tour-highlight { position: relative; z-index: 901 !important; box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--brand) !important; border-radius: 12px; background: #fff; }
.sidebar .tour-highlight { background: var(--side-2); }
.tour-pop { position: fixed; z-index: 902; width: min(360px, calc(100vw - 32px)); background: #fff; border-radius: 16px; box-shadow: 0 20px 50px rgba(16,24,40,.3); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tour-pop h3 { font-size: 17px; margin: 0; }
.tour-pop p { margin: 0; font-size: 14px; line-height: 2; color: var(--ink-2); }
.tour-pop .tour-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-pop .tour-dots { font-size: 12px; color: var(--muted); }
.tour-pop.center { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); }
.tour-raise { z-index: 901 !important; }
.topbar.tour-raise { position: relative; background: var(--bg); border-radius: 12px; }
.plans-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plans-grid .plan ul { font-size: 13.5px; }
.person-card { display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s, transform .15s; color: inherit; }
.person-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.person-card .doc-logo img { width: 100%; height: 100%; object-fit: contain; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: start; }
.prose th { background: var(--line-2); }
.prose img { max-width: 100%; height: auto; border-radius: 12px; }

/* ---------- Account switcher ---------- */
.acct-switch { background: var(--side-2); border-radius: 12px; color: #fff; }
.acct-switch > summary { list-style: none; cursor: pointer; padding: 10px 12px; line-height: 1.6; }
.acct-switch > summary::-webkit-details-marker { display: none; }
.acct-list { display: flex; flex-direction: column; padding: 0 6px 8px; }
.acct-list button { width: 100%; text-align: start; background: transparent; border: 0; color: var(--side-text); padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.acct-list button:hover, .acct-list button.on { background: rgba(255,255,255,.08); color: #fff; }

/* Invoice designs (business.invoice_template) */
.doc.tpl-modern .doc-top { display: none; }
.doc.tpl-modern .doc-head { background: var(--doc-color, var(--brand)); color: #fff; margin: -32px -34px 0; padding: 26px 34px; }
.doc.tpl-modern .doc-head .muted, .doc.tpl-modern .doc-title { color: #fff; }
.doc.tpl-modern .doc-logo { background: rgba(255,255,255,.18); }
.doc.tpl-modern .doc-meta { background: #fff; border: 1px solid var(--line); }
.doc.tpl-minimal .doc-top, .doc.tpl-minimal .doc-strip { display: none; }
.doc.tpl-minimal .doc-title, .doc.tpl-minimal .doc-parties .who { color: #101828; }
.doc.tpl-minimal .doc-logo { background: #101828; border-radius: 6px; }
.doc.tpl-minimal .doc-meta { background: none; border-top: 1px solid #101828; border-bottom: 1px solid #101828; border-radius: 0; }
.doc.tpl-minimal .doc-table th { background: none; color: #101828; border-bottom: 1.5px solid #101828; }
.doc.tpl-minimal .grand { background: none; color: #101828; border-top: 2px solid #101828; border-radius: 0; }
.doc.tpl-bold .doc-top { height: 16px; }
.doc.tpl-bold .doc-title { font-size: 34px; letter-spacing: -.5px; }
.doc.tpl-bold .doc-table th { background: var(--doc-color, var(--brand)); color: #fff; }
.doc.tpl-bold .doc-meta { background: color-mix(in srgb, var(--doc-color, var(--brand)) 8%, #fff); }
.doc.tpl-elegant .doc-top { display: none; }
.doc.tpl-elegant .doc-body { border: 3px double var(--doc-color, var(--brand)); margin: 14px; border-radius: 4px; }
.doc.tpl-elegant .doc-head { flex-direction: column; align-items: center; text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.doc.tpl-elegant .doc-head > div { align-items: center !important; }
.doc.tpl-elegant .doc-table th { background: none; border-bottom: 1px solid var(--doc-color, var(--brand)); }
.tpl-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.tpl-pick label { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tpl-pick input { position: absolute; opacity: 0; }
.tpl-pick label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, #fff); }
.tpl-pick label.is-locked { opacity: .55; cursor: not-allowed; }
.verified-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #027A48; background: #ECFDF3; border-radius: 999px; padding: 2px 9px; }
.fx-note { font-size: 12px; color: var(--muted); }
.job-card { color: inherit; transition: box-shadow .15s, transform .15s; }
.job-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
