/* FactorMan public website: landing page + free invoice builder (RTL, Persian). */

@font-face {
    font-family: 'Vazirmatn';
    src: url('../fonts/Vazirmatn/Vazirmatn%5Bwght%5D.woff2') format('woff2-variations'), url('../fonts/Vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

/* Fonts shipped with the project (wwwroot/fonts). "FM" prefix keeps them apart from the panel's font names. */
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-Regular.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-Medium.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-SemiBold.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-Bold.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-ExtraBold.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'FM Estedad'; src: url('../fonts/Estedad/Estedad-Black.woff2') format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'FM IRANSans'; src: url('../fonts/IRANSansWebFaNum/IRANSansWebFaNum_Light.woff2') format('woff2'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'FM IRANSans'; src: url('../fonts/IRANSansWeb/IRANSansWeb.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'FM IRANSans'; src: url('../fonts/IRANSansWebFaNum/IRANSansWebFaNum_Bold.woff2') format('woff2'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'FM YekanBakh'; src: url('../fonts/YekanBakh/fonnts.com-YekanBakh-Regular.ttf') format('truetype'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'FM YekanBakh'; src: url('../fonts/YekanBakh/fonnts.com-YekanBakh-Bold.ttf') format('truetype'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'FM Dana'; src: url('../fonts/DanaFaNum/DanaFaNum-Regular.woff') format('woff'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'FM Dana'; src: url('../fonts/DanaFaNum/DanaFaNum-Bold.woff') format('woff'); font-weight: 600 900; font-display: swap; }

:root {
    --font-body: 'Vazirmatn', Tahoma, sans-serif;
    --font-display: 'FM Estedad', 'Vazirmatn', Tahoma, sans-serif;
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-soft: #eef2ff;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f6f7fb;
    --card: #ffffff;
    --ok: #059669;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .05);
    --shadow-lg: 0 30px 60px -20px rgba(30, 27, 75, .30);
    --header-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
    margin: 0;
    font-family: var(--font-body);
    font-feature-settings: "ss01";
    color: var(--ink);
    background: var(--bg);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); }
h1, h2, h3, h4 { line-height: 1.4; margin: 0; }
.hero h1, .section-head h2, .cta-box h2, .site-brand-text, .plan-price strong, .how-num { font-family: var(--font-display); }

/* Invoice fonts (picked in the settings panel) */
.paper[data-font="vazir"] { font-family: 'Vazirmatn', Tahoma, sans-serif; }
.paper[data-font="estedad"] { font-family: 'FM Estedad', 'Vazirmatn', Tahoma, sans-serif; }
.paper[data-font="iransans"] { font-family: 'FM IRANSans', 'Vazirmatn', Tahoma, sans-serif; }
.paper[data-font="yekan"] { font-family: 'FM YekanBakh', 'Vazirmatn', Tahoma, sans-serif; }
.paper[data-font="dana"] { font-family: 'FM Dana', 'Vazirmatn', Tahoma, sans-serif; }
.font-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.font-list button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 4px; cursor: pointer; font-size: .9rem; color: var(--ink-2); transition: border-color .15s, color .15s; }
.font-list button:hover { border-color: #c7d2fe; }
.font-list button.is-active { border-color: var(--brand); color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }

/* Sample invoices: quick-switch bar above the invoice */
.sample-strip { display: flex; align-items: center; gap: 10px; margin: -4px 0 16px; padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
.sample-strip-label { flex: none; font-weight: 700; font-size: .88rem; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; }
.sample-strip-label .bi { color: var(--brand); }
.sample-strip { overflow: hidden; }
.sample-strip-list {
    flex: 1; min-width: 0; overflow: hidden; padding: 4px 0;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 40px, #000 calc(100% - 40px), transparent);
}
.sample-track { display: flex; gap: 8px; width: max-content; animation: sample-marquee 45s linear infinite; }
.sample-strip-list:hover .sample-track, .sample-strip-list:focus-within .sample-track { animation-play-state: paused; }
/* RTL: the track starts at the right edge and moves right, so the duplicate set enters from the left. */
@keyframes sample-marquee { from { transform: translateX(0); } to { transform: translateX(calc(50% + 4px)); } }
.sample-chip { padding-inline-start: 8px; position: relative; overflow: hidden; transition: all .2s, transform .2s; }
.sample-chip:hover { transform: translateY(-2px); box-shadow: 0 6px 14px -8px rgba(79, 70, 229, .6); }
.sample-chip.is-popping { animation: chip-pop .6s cubic-bezier(.34, 1.56, .64, 1); }
.sample-chip.is-popping::after {
    content: ""; position: absolute; inset: 50% auto auto 50%; width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255, 255, 255, .7); transform: translate(-50%, -50%) scale(0); animation: chip-ripple .6s ease-out;
}
@keyframes chip-pop { 0% { transform: scale(1); } 30% { transform: scale(.88); } 65% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes chip-ripple { to { transform: translate(-50%, -50%) scale(22); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .sample-track { animation: none; }
    .sample-strip-list { overflow-x: auto; -webkit-mask-image: none; mask-image: none; }
    .sample-chip.is-popping, .sample-chip.is-popping::after { animation: none; }
}.sample-chip {
    flex: none; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 999px; cursor: pointer;
    border: 1.5px solid var(--line); background: #f8fafc; color: var(--ink-2); font-size: .86rem; font-weight: 600; white-space: nowrap; transition: all .15s;
}
.sample-chip .bi { color: var(--brand); font-size: 1rem; }
.sample-chip-logo { width: 24px; height: 24px; border-radius: 7px; margin-inline-start: -6px; }
.sample-chip em { font-style: normal; font-size: .7rem; font-weight: 700; color: #fff; background: #0d9488; border-radius: 999px; padding: 0 7px; }
.sample-chip:hover { border-color: #c7d2fe; background: var(--brand-soft); color: var(--brand); }
.sample-chip.is-active { border-color: var(--brand); background: var(--brand); color: #fff; }
.sample-chip.is-active .bi { color: #fff; }
@media (max-width: 720px) { .sample-strip { flex-direction: column; align-items: stretch; } }

/* Premium locks (templates and colors for free users) */
.premium-mark { display: none; }
.is-premium-preview .premium-mark { display: inline; color: #a855f7; font-size: .75rem; }
.swatches button.is-premium-preview { position: relative; }
.swatches button.is-premium-preview::after { content: ""; position: absolute; top: -3px; left: -3px; width: 9px; height: 9px; border-radius: 50%; background: #a855f7; border: 2px solid #fff; }
.preview-badge {
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 900px; margin: 0 auto 10px; padding: 8px 14px;
    border-radius: 12px; background: #faf5ff; border: 1px solid #e9d5ff; color: #6b21a8; font-size: .86rem; font-weight: 600;
}
.preview-badge a { margin-inline-start: auto; font-weight: 700; color: #7c3aed; }
.swatch-mono { background: linear-gradient(135deg, #111827 50%, #fff 50%) !important; }
.premium-note { margin-top: 10px; font-size: .78rem; color: var(--muted); background: #faf5ff; border: 1px solid #f3e8ff; border-radius: 10px; padding: 6px 10px; }
.premium-note .bi { color: #a855f7; }button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.print-only { display: none; }

.site-container { width: min(1240px, 100% - 32px); margin-inline: auto; }
.site-container-narrow { width: min(820px, 100% - 32px); }

/* ---------- Buttons ---------- */
.site-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap;
    transition: background .18s, color .18s, border-color .18s, box-shadow .18s, transform .12s;
}
.site-btn:active { transform: translateY(1px); }
.site-btn .bi { font-size: 1.05em; }
.site-btn-primary { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .65); }
.site-btn-primary:hover { box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .8); color: #fff; }
.site-btn-ghost { color: var(--ink-2); background: transparent; }
.site-btn-ghost:hover { background: #eef0f6; }
.site-btn-soft { color: var(--ink-2); background: #fff; border-color: var(--line); box-shadow: var(--shadow-sm); }
.site-btn-soft:hover { border-color: #c7cbe0; color: var(--brand); }
.site-btn-outline { color: var(--brand); background: #fff; border-color: #c7d2fe; }
.site-btn-outline:hover { background: var(--brand-soft); }
.site-btn-light { color: var(--brand); background: #fff; }
.site-btn-light:hover { background: #f5f3ff; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50; height: var(--header-h);
    background: rgba(246, 247, 251, .82); backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid transparent; transition: border-color .2s, background .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); background: rgba(255, 255, 255, .9); }
.site-header-inner { height: 100%; display: flex; align-items: center; gap: 28px; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.site-brand-mark {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-size: 1.15rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); box-shadow: 0 6px 16px -6px rgba(79, 70, 229, .7);
}
.site-brand-text { font-size: 1.3rem; font-weight: 800; letter-spacing: -.3px; }
.site-brand-text b { color: var(--brand); font-weight: 800; }
.site-nav { display: flex; gap: 4px; }
.site-nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.site-nav a:hover { background: #eceef6; color: var(--ink); }
.site-header-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.site-nav-toggle { display: none; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 1.4rem; cursor: pointer; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 56px 0 34px; text-align: center; }
.hero::before {
    content: ""; position: absolute; inset: -40% -10% auto; height: 520px; z-index: -1;
    background:
        radial-gradient(closest-side at 30% 50%, rgba(124, 58, 237, .16), transparent),
        radial-gradient(closest-side at 70% 40%, rgba(79, 70, 229, .18), transparent),
        radial-gradient(closest-side at 50% 80%, rgba(14, 165, 233, .10), transparent);
}
.hero-inner { max-width: 880px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
    background: #fff; border: 1px solid #e0e7ff; color: var(--brand); font-weight: 600; font-size: .85rem; box-shadow: var(--shadow-sm);
}
.hero-badge .bi { color: #f59e0b; }
.hero h1 { margin: 18px 0 12px; font-size: clamp(1.8rem, 4.2vw, 3rem); font-weight: 900; letter-spacing: -.5px; }
.hero-accent { background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, #db2777); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0 auto; max-width: 680px; color: var(--muted); font-size: 1.08rem; }
.hero-points { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; margin-top: 22px; color: var(--ink-2); font-size: .92rem; font-weight: 500; }
.hero-points .bi { color: var(--ok); margin-inline-end: 4px; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.hero-actions .site-btn { height: 48px; padding: 0 22px; font-size: .98rem; }

/* ---------- Builder ---------- */
.builder { padding: 8px 0 56px; }
.builder-toolbar {
    position: sticky; top: calc(var(--header-h) + 8px); z-index: 30;
    display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px;
    background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
    border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.toolbar-spacer { flex: 1; }
.autosave-indicator { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: .82rem; padding: 0 6px; transition: color .2s; }
.autosave-indicator.is-saving { color: var(--brand); }
.autosave-indicator .bi { font-size: 1rem; }

.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 12px; background: #f1f3f9; border: 1px solid #e6e9f2; }
.segmented button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: .88rem; color: var(--muted); transition: all .15s; }
.segmented button:hover { color: var(--ink); }
.segmented button.is-active { background: #fff; color: var(--brand); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.segmented-sm button { padding: 5px 14px; flex: 1; }
.segmented-sm { display: flex; }

.builder-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }

/* Settings side */
.builder-side { position: sticky; top: calc(var(--header-h) + 92px); display: grid; gap: 14px; }
.side-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
.side-card h3 { font-size: .98rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.side-card h3 .bi { color: var(--brand); }
.side-label { font-size: .8rem; color: var(--muted); font-weight: 600; margin: 12px 0 6px; }
.side-label:first-of-type { margin-top: 0; }
.template-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.template-opt { border: 1.5px solid var(--line); border-radius: 12px; background: #fff; padding: 6px; cursor: pointer; display: grid; gap: 4px; font-size: .82rem; font-weight: 600; color: var(--ink-2); transition: border-color .15s, box-shadow .15s; }
.template-opt:hover { border-color: #c7d2fe; }
.template-opt.is-active { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); color: var(--brand); }
.template-opt .bi-gem { color: #a855f7; font-size: .75rem; }
.tpl-thumb { display: block; height: 54px; border-radius: 7px; border: 1px solid #e5e7eb; background: #fff; position: relative; overflow: hidden; }
.tpl-thumb::before, .tpl-thumb::after { content: ""; position: absolute; inset-inline: 8px; border-radius: 3px; }
.tpl-classic::before { top: 8px; height: 8px; background: #cbd5e1; inset-inline: 30%; }
.tpl-classic::after { top: 22px; bottom: 8px; border: 1px solid #94a3b8; background: repeating-linear-gradient(#fff 0 6px, #e2e8f0 6px 7px); }
.tpl-modern::before { inset: 0 0 auto; height: 18px; border-radius: 0; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.tpl-modern::after { top: 26px; bottom: 8px; background: repeating-linear-gradient(#f1f5f9 0 6px, #fff 6px 12px); }
.tpl-formal::before { inset: 4px; border: 2px double #64748b; border-radius: 4px; }
.tpl-formal::after { top: 14px; height: 6px; background: #64748b; inset-inline: 35%; }
.tpl-elegant::before { top: 10px; height: 3px; background: #d97706; inset-inline: 20%; }
.tpl-elegant::after { top: 22px; bottom: 8px; background: repeating-linear-gradient(#fff 0 6px, #fde68a 6px 7px); }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #fff; background: var(--sw); cursor: pointer; box-shadow: 0 0 0 1px var(--line); transition: transform .15s, box-shadow .15s; }
.swatches button:hover { transform: scale(1.08); }
.swatches button.is-active { box-shadow: 0 0 0 2px var(--sw); }
.switch-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: .9rem; cursor: pointer; }
.switch-row input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: #cbd5e1; position: relative; cursor: pointer; flex: none; transition: background .18s; margin: 0; }
.switch-row input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: right .18s; }
.switch-row input:checked { background: var(--brand); }
.switch-row input:checked::after { right: 19px; }
.switch-row input:disabled { opacity: .5; cursor: not-allowed; }
.switch-row .bi-gem { color: #a855f7; font-size: .8rem; }
.side-card-promo { color: #fff; border: 0; background: linear-gradient(150deg, #312e81, var(--brand) 55%, var(--brand-2)); position: relative; overflow: hidden; }
.side-card-promo h3 { color: #fff; }
.side-card-promo p { font-size: .86rem; opacity: .9; margin: 0 0 12px; }
.promo-icon { position: absolute; left: -10px; bottom: -18px; font-size: 5.5rem; opacity: .12; }

/* ---------- Invoice paper ---------- */
.paper-wrap { min-width: 0; }
.paper {
    --accent: #4f46e5; --accent-soft: #eef2ff; --accent-ink: #312e81;
    position: relative; background: #fff; color: #111827; border-radius: 6px; box-shadow: var(--shadow-lg);
    padding: 34px 36px 26px; max-width: 900px; margin-inline: auto; font-size: 13.5px; line-height: 1.75;
}
.paper[data-size="a5"] { max-width: 640px; font-size: 12.5px; padding: 24px 24px 20px; }
.paper[data-accent="teal"] { --accent: #0d9488; --accent-soft: #e6fffa; --accent-ink: #134e4a; }
.paper[data-accent="rose"] { --accent: #e11d48; --accent-soft: #fff1f2; --accent-ink: #881337; }
.paper[data-accent="amber"] { --accent: #d97706; --accent-soft: #fffbeb; --accent-ink: #78350f; }
.paper[data-accent="slate"] { --accent: #334155; --accent-soft: #f1f5f9; --accent-ink: #0f172a; }
.paper[data-accent="mono"] { --accent: #111827; --accent-soft: #f3f4f6; --accent-ink: #111827; }

/* Editable fields that look like text on paper */
.fx {
    width: 100%; min-width: 0; border: 0; border-radius: 6px; background: transparent; padding: 2px 6px; margin: 0;
    outline: none; transition: background .15s, box-shadow .15s; color: inherit; font: inherit;
}
.fx::placeholder { color: #b6bfcc; }
.fx:hover { background: #f8fafc; box-shadow: inset 0 0 0 1px #e2e8f0; }
.fx:focus { background: #fff; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
textarea.fx { resize: none; display: block; overflow: hidden; }
.fx-center { text-align: center; }
.fx-num, .fx-money { font-variant-numeric: tabular-nums; }
.fx-money { text-align: left; direction: ltr; }
.fx-pct { width: 2.4em; text-align: center; padding: 0 2px; }
.vat-rate { display: inline-flex; align-items: center; background: #f1f5f9; border-radius: 6px; padding-inline-end: 4px; margin-inline-start: 4px; font-weight: 600; }

.inv-head { display: grid; grid-template-columns: 180px 1fr 190px; gap: 16px; align-items: center; padding-bottom: 16px; border-bottom: 2px solid var(--accent); }
.inv-logo { position: relative; height: 88px; border-radius: 10px; display: grid; place-items: center; }
.inv-logo img { max-width: 100%; max-height: 88px; object-fit: contain; }
/* A logo sits at the start of its column at its own size (no stretched frame). */
.inv-logo:has(img:not([hidden])) { justify-self: start; place-items: center; }
.inv-upload {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%;
    border: 1.5px dashed #cbd5e1; border-radius: 10px; background: #fafbfd; color: #94a3b8; cursor: pointer; font-size: .78rem; transition: all .15s;
}
.inv-upload .bi { font-size: 1.4rem; }
.inv-upload:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.inv-remove { position: absolute; top: -8px; left: -8px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: #ef4444; color: #fff; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.inv-title { text-align: center; }
.inv-title h2 { font-size: 1.75em; font-weight: 900; color: var(--accent-ink); letter-spacing: -.3px; }
.inv-seller-headline { font-weight: 600; color: #475569; font-size: 1.05em; }
.inv-meta { margin: 0; display: grid; gap: 2px; }
.inv-meta div { display: flex; align-items: center; gap: 6px; }
.inv-meta dt { font-weight: 700; color: #475569; white-space: nowrap; min-width: 58px; }
.inv-meta dd { margin: 0; flex: 1; }

.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.party { border: 1px solid #e5e7eb; border-radius: 10px; padding: 10px 12px; }
.party h3 { font-size: 1em; font-weight: 800; color: var(--accent-ink); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.party h3 .bi { color: var(--accent); }
.party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.party-grid label { display: flex; align-items: center; gap: 4px; }
.party-grid label > span { color: #64748b; white-space: nowrap; font-size: .92em; }
.party-grid .span-2 { grid-column: span 2; }

.items-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.items-table th { background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; font-size: .92em; padding: 8px 6px; border: 1px solid #e2e8f0; text-align: center; }
.items-table td { border: 1px solid #e5e7eb; padding: 3px; vertical-align: middle; }
.items-table .c-row { width: 44px; text-align: center; color: #64748b; }
.items-table .c-code { width: 84px; }
.items-table .c-qty { width: 70px; }
.items-table .c-unit { width: 78px; }
.items-table .c-price { width: 124px; }
.items-table .c-disc { width: 104px; }
.items-table .c-total { width: 130px; }
.items-table .c-act { width: 64px; border: 0; background: transparent; }
.items-table td.c-total { text-align: left; direction: ltr; font-weight: 700; padding-inline: 8px; font-variant-numeric: tabular-nums; }
.items-table td.c-qty .fx { text-align: center; }
.items-table td.c-act { border: 0; white-space: nowrap; }
.items-table tbody tr:hover td.c-act .row-btn { opacity: 1; }
.row-btn { width: 26px; height: 26px; border-radius: 7px; border: 0; background: transparent; color: #94a3b8; cursor: pointer; opacity: .35; transition: all .15s; }
.row-btn:hover { background: #f1f5f9; color: var(--ink); }
.row-btn.danger:hover { background: #fee2e2; color: #dc2626; }
.items-table select.fx { appearance: none; text-align: center; cursor: pointer; }
.paper.hide-code .c-code, .paper.hide-unit .c-unit, .paper.hide-rowdisc .c-disc { display: none; }
.add-row {
    margin-top: 8px; width: 100%; padding: 9px; border-radius: 10px; border: 1.5px dashed #cbd5e1; background: #fafbfd;
    color: #64748b; font-weight: 600; cursor: pointer; transition: all .15s;
}
.add-row:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.add-row kbd { font-family: inherit; font-size: .72rem; border: 1px solid #cbd5e1; border-radius: 5px; padding: 0 5px; margin-inline-start: 6px; background: #fff; }

.inv-bottom { display: grid; grid-template-columns: 1fr 330px; gap: 18px; margin-top: 16px; align-items: start; }
.paper[data-size="a5"] .inv-bottom { grid-template-columns: 1fr 270px; }
.words-box { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.words-box span { color: #64748b; display: block; font-size: .9em; }
.words-box strong { color: var(--accent-ink); font-weight: 800; }
.note-field { display: block; margin-bottom: 6px; }
.note-field > span { font-weight: 700; color: #475569; font-size: .92em; }
.totals-table { width: 100%; border-collapse: collapse; }
.totals-table th, .totals-table td { border: 1px solid #e5e7eb; padding: 6px 10px; }
.totals-table th { text-align: right; font-weight: 700; color: #475569; background: #fafbfc; white-space: nowrap; }
.totals-table td { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; font-weight: 600; }
.totals-table td small { display: block; color: #94a3b8; font-weight: 500; font-size: .82em; }
.totals-table .grand th, .totals-table .grand td { background: var(--accent); color: #fff; border-color: var(--accent); font-size: 1.1em; font-weight: 800; }
.totals-table .grand .cur-label { font-size: .75em; opacity: .85; display: inline; color: #fff; }
.mini-switch { display: inline-flex; border: 1px solid #e2e8f0; border-radius: 7px; overflow: hidden; margin-inline-start: 4px; vertical-align: middle; }
.mini-switch button { border: 0; background: #fff; padding: 0 7px; font-size: .78em; cursor: pointer; color: #64748b; line-height: 1.8; }
.mini-switch button.is-active { background: var(--accent); color: #fff; }
.paper.hide-vat .row-vat, .paper.hide-shipping .row-shipping { display: none; }

.inv-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; padding-top: 12px; border-top: 1px dashed #d1d5db; }
.sign { text-align: center; }
.sign > span { font-weight: 700; color: #475569; }
.stamp-box { position: relative; height: 96px; margin: 6px auto 0; max-width: 220px; display: grid; place-items: center; }
.stamp-box img { max-height: 96px; max-width: 100%; object-fit: contain; }
.inv-watermark { text-align: center; color: #6b7280; }
.inv-watermark b { color: #374151; }
.inv-watermark .wm-url { direction: ltr; unicode-bidi: isolate; font-weight: 700; letter-spacing: .3px; }
.inv-watermark-top { display: flex; justify-content: space-between; align-items: center; margin: -14px 0 14px; padding: 6px 12px; font-size: 1em; font-weight: 600; border: 1px dashed #d1d5db; border-radius: 8px; background: #fafafa; }
.inv-watermark-bottom { margin-top: 18px; padding-top: 10px; border-top: 1px dashed #d1d5db; font-size: 1.05em; font-weight: 600; display: grid; gap: 2px; }
.inv-watermark-bottom small { font-size: .85em; font-weight: 500; color: #9ca3af; }
.paper.no-watermark .inv-watermark { display: none; }
.paper[data-template="modern"] .inv-watermark-top { margin: 0 -36px; border-radius: 0; border-width: 0 0 1px; }

/* Template: formal (double frame, centered title) */
.paper[data-template="formal"] { border: 3px double var(--accent); }
.paper[data-template="formal"] .inv-head { border-bottom: 3px double var(--accent); }
.paper[data-template="formal"] .inv-title h2 { letter-spacing: 1px; }
.paper[data-template="formal"] .items-table th { background: var(--accent); color: #fff; border-color: var(--accent); }
.paper[data-template="formal"] .party { border-radius: 0; border-color: var(--accent); }
.paper[data-template="formal"] .totals-table .grand th, .paper[data-template="formal"] .totals-table .grand td { background: #fff; color: var(--accent-ink); border: 2px solid var(--accent); }

/* Template: elegant (thin accent rules, soft rows) */
.paper[data-template="elegant"] .inv-head { border-bottom: 1px solid var(--accent); box-shadow: 0 3px 0 -1px var(--accent-soft); }
.paper[data-template="elegant"] .inv-title h2 { font-weight: 300; font-size: 2em; color: var(--accent); }
.paper[data-template="elegant"] .party { border: 0; border-inline-start: 3px solid var(--accent); border-radius: 0; background: var(--accent-soft); }
.paper[data-template="elegant"] .items-table th { background: transparent; border-width: 0 0 2px; border-color: var(--accent); color: var(--accent-ink); }
.paper[data-template="elegant"] .items-table td { border-width: 0 0 1px; border-color: #eef0f4; }
.paper[data-template="elegant"] .totals-table th, .paper[data-template="elegant"] .totals-table td { border-width: 0 0 1px; background: transparent; }
.paper[data-template="elegant"] .totals-table .grand th, .paper[data-template="elegant"] .totals-table .grand td { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }

/* Template: modern */
.paper[data-template="modern"] { padding-top: 0; overflow: hidden; }
.paper[data-template="modern"] .inv-head {
    margin: 0 -36px; padding: 26px 36px 22px; border: 0; color: #fff;
    background: linear-gradient(135deg, var(--accent-ink), var(--accent));
}
.paper[data-size="a5"][data-template="modern"] .inv-head { margin: 0 -24px; padding: 20px 24px 18px; }
.paper[data-template="modern"] .inv-title h2 { color: #fff; }
.paper[data-template="modern"] .inv-seller-headline, .paper[data-template="modern"] .inv-meta dt { color: rgba(255, 255, 255, .85); }
.paper[data-template="modern"] .inv-head .fx::placeholder { color: rgba(255, 255, 255, .55); }
.paper[data-template="modern"] .inv-head .fx:hover { background: rgba(255, 255, 255, .1); box-shadow: none; }
.paper[data-template="modern"] .inv-head .fx:focus { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); }
.paper[data-template="modern"] .inv-upload { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .45); color: rgba(255, 255, 255, .85); }
.paper[data-template="modern"] .inv-logo:has(img:not([hidden])) { background: #fff; padding: 8px 12px; height: auto; border-radius: 16px; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .45); }
.paper[data-template="modern"] .inv-logo:has(img:not([hidden])) img { max-height: 76px; }
.paper[data-template="modern"] .party { border: 0; background: #f8fafc; }
.paper[data-template="modern"] .items-table th { background: var(--accent); color: #fff; border-color: var(--accent); }
.paper[data-template="modern"] .items-table td { border-width: 0 0 1px; }
.paper[data-template="modern"] .items-table tbody tr:nth-child(even) td:not(.c-act) { background: #f8fafc; }
.paper[data-template="modern"] .totals-table th, .paper[data-template="modern"] .totals-table td { border-width: 0 0 1px; }
.paper[data-template="modern"] .totals-table .grand th { border-radius: 0 10px 10px 0; }
.paper[data-template="modern"] .totals-table .grand td { border-radius: 10px 0 0 10px; }

/* ---------- Sections ---------- */
.site-section { padding: 72px 0; }
.section-head { text-align: center; max-width: 680px; margin: 0 auto 40px; }
.eyebrow { display: inline-block; color: var(--brand); font-weight: 700; font-size: .85rem; background: var(--brand-soft); padding: 3px 12px; border-radius: 999px; margin-bottom: 10px; }
.section-head h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); font-weight: 900; letter-spacing: -.3px; }
.section-head p { color: var(--muted); margin: 10px 0 0; }

.how { background: #fff; border-block: 1px solid var(--line); }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.how-step { padding: 26px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); }
.how-num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 800; font-size: 1.2rem; margin-bottom: 14px; }
.how-step h3 { font-size: 1.1rem; font-weight: 800; margin-bottom: 6px; }
.how-step p { margin: 0; color: var(--muted); }

.feature-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature > .bi { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--brand-soft); color: var(--brand); font-size: 1.35rem; margin-bottom: 14px; }
.feature.is-premium > .bi { background: #faf5ff; color: #9333ea; }
.feature h3 { font-size: 1.02rem; font-weight: 800; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }
.pill { position: absolute; top: 18px; left: 18px; display: inline-flex; gap: 4px; align-items: center; font-size: .74rem; font-weight: 700; color: #9333ea; background: #faf5ff; border: 1px solid #f3e8ff; border-radius: 999px; padding: 1px 9px; }

.pricing { background: linear-gradient(180deg, var(--bg), #eef0fb); }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; max-width: 1040px; margin-inline: auto; }
.plan { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-sm); }
.plan h3 { font-size: 1.15rem; font-weight: 800; }
.plan-price { margin: 12px 0 18px; display: flex; align-items: baseline; gap: 8px; }
.plan-price strong { font-size: 2rem; font-weight: 900; letter-spacing: -.5px; }
.plan-price span { color: var(--muted); font-size: .88rem; }
.plan ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; flex: 1; }
.plan li { display: flex; gap: 8px; color: var(--ink-2); font-size: .94rem; }
.plan li .bi { color: var(--ok); font-size: 1.1rem; }
.plan.is-featured { border: 0; color: #fff; background: linear-gradient(160deg, #1e1b4b, #312e81 40%, var(--brand)); box-shadow: var(--shadow-lg); transform: scale(1.03); }
.plan.is-featured li, .plan.is-featured .plan-price span { color: rgba(255, 255, 255, .85); }
.plan.is-featured li .bi { color: #a5b4fc; }
.plan.is-featured .site-btn-primary { background: #fff; color: var(--brand); box-shadow: none; }
.plan-tag { position: absolute; top: 18px; left: 18px; background: rgba(255, 255, 255, .16); color: #fff; font-size: .75rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; }

.faq details { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 0 20px; margin-bottom: 10px; }
.faq summary { cursor: pointer; padding: 16px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "\F282"; font-family: 'bootstrap-icons'; color: var(--muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(180deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }

.cta { padding-top: 0; }
.cta-box { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 36px 40px; border-radius: 24px; color: #fff; background: linear-gradient(135deg, #312e81, var(--brand) 50%, var(--brand-2)); box-shadow: var(--shadow-lg); }
.cta-box h2 { font-size: 1.6rem; font-weight: 900; }
.cta-box p { margin: 6px 0 0; opacity: .88; }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #94a3b8; padding: 48px 0 20px; }
.site-footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
.site-footer .site-brand-text { color: #fff; }
.site-footer .site-brand-text b { color: #a5b4fc; }
.site-footer p { font-size: .92rem; max-width: 420px; }
.site-footer h4 { color: #e2e8f0; font-size: .98rem; margin-bottom: 12px; }
.site-footer-grid a:not(.site-brand) { display: block; color: #94a3b8; text-decoration: none; padding: 3px 0; font-size: .92rem; }
.site-footer-grid a:not(.site-brand):hover { color: #fff; }
.site-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; border-top: 1px solid #1e293b; margin-top: 32px; padding-top: 18px; font-size: .84rem; }

/* ---------- Modal & toast ---------- */
.site-modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.site-modal[hidden] { display: none; }
.site-modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); animation: fadeIn .2s; }
.site-modal-card { position: relative; width: min(440px, 100%); background: #fff; border-radius: 20px; padding: 30px 28px 24px; text-align: center; box-shadow: var(--shadow-lg); animation: popIn .22s ease-out; }
.site-modal-x { position: absolute; top: 12px; left: 12px; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.site-modal-x:hover { background: #f1f5f9; }
.site-modal-icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; font-size: 1.7rem; color: #9333ea; background: #faf5ff; }
.site-modal-icon.is-warn { color: #d97706; background: #fffbeb; }
.site-modal-card h3 { font-size: 1.2rem; font-weight: 800; }
.site-modal-card p { color: var(--muted); margin: 8px 0 20px; }
.site-modal-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.site-toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); z-index: 120; background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 12px; font-size: .9rem; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: all .25s; }
.site-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .builder-layout { grid-template-columns: 1fr; }
    .builder-side { position: static; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .site-nav { display: none; position: absolute; top: var(--header-h); inset-inline: 0; flex-direction: column; background: #fff; padding: 10px 16px; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
    .site-nav.is-open { display: flex; }
    .site-nav-toggle { display: inline-grid; place-items: center; }
    .site-header-actions .site-btn-ghost { display: none; }
    .pricing-grid, .how-grid { grid-template-columns: 1fr; }
    .plan.is-featured { transform: none; }
    .cta-box { flex-direction: column; text-align: center; padding: 28px 22px; }
    .site-footer-grid { grid-template-columns: 1fr; }
    .builder-toolbar .site-btn span { display: none; }
    .builder-toolbar .site-btn { width: 42px; padding: 0; }
    .builder-toolbar #btnPrint { width: auto; padding: 0 16px; }
    .builder-toolbar #btnPrint span { display: inline; }
    .autosave-indicator { display: none; }
}
@media (max-width: 720px) {
    .hero { padding-top: 34px; }
    .site-header-actions .site-btn-primary { padding: 0 12px; font-size: .85rem; }
    .paper, .paper[data-size="a5"] { padding: 18px 14px; font-size: 13px; border-radius: 12px; }
    .paper[data-template="modern"] .inv-head, .paper[data-size="a5"][data-template="modern"] .inv-head { margin: 0 -14px; padding: 18px 14px; }
    .inv-head { grid-template-columns: 130px 1fr; }
    .inv-logo { height: 70px; }
    .inv-meta { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
    .inv-parties, .inv-bottom, .paper[data-size="a5"] .inv-bottom { grid-template-columns: 1fr; }
    .party-grid { grid-template-columns: 1fr; }
    .party-grid .span-2 { grid-column: auto; }
    /* Item rows become cards */
    .items-table, .items-table tbody { display: block; }
    .items-table thead { display: none; }
    .items-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; padding: 10px; border: 1px solid #e5e7eb; border-radius: 12px; margin-bottom: 8px; position: relative; }
    .items-table td { display: flex; align-items: center; gap: 6px; border: 0 !important; padding: 0; width: auto !important; background: transparent !important; }
    .items-table td::before { content: attr(data-label); color: #94a3b8; font-size: .85em; white-space: nowrap; }
    .items-table td.c-row { position: absolute; top: 8px; left: 70px; }
    .items-table td.c-row::before { content: "#"; }
    .items-table td.c-name { grid-column: 1 / -1; padding-left: 90px; order: -1; }
    .items-table td.c-total { justify-content: space-between; }
    .items-table td.c-act { position: absolute; top: 6px; left: 6px; }
    .row-btn { opacity: 1; }
    .paper.hide-code td.c-code, .paper.hide-unit td.c-unit, .paper.hide-rowdisc td.c-disc { display: none; }
}

/* ---------- Membership pages (sign-up, confirm email, password) ---------- */
.auth-page { min-height: calc(100vh - var(--header-h) - 220px); display: grid; place-items: center; padding: 48px 16px 72px; background: radial-gradient(closest-side at 30% 20%, rgba(124, 58, 237, .10), transparent), radial-gradient(closest-side at 75% 30%, rgba(79, 70, 229, .12), transparent); }
.auth-card { width: min(460px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-card-wide { width: min(920px, 100%); display: grid; grid-template-columns: 330px 1fr; }
.auth-card-message { padding: 40px 32px; text-align: center; width: min(520px, 100%); }
.auth-aside { color: #fff; padding: 36px 30px; background: linear-gradient(160deg, #1e1b4b, #312e81 45%, var(--brand) 85%, var(--brand-2)); }
.auth-aside .hero-badge { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .2); color: #fff; }
.auth-aside h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 900; margin: 18px 0 16px; }
.auth-aside ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-aside li { display: flex; gap: 8px; opacity: .92; }
.auth-aside li .bi { color: #a5b4fc; }
.auth-main { padding: 34px 32px; }
.auth-main h1, .auth-card-message h1 { font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin: 0 0 18px; font-size: .94rem; }
.auth-form { display: grid; gap: 14px; margin-top: 10px; }
.auth-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.auth-field em { font-style: normal; color: var(--muted); font-weight: 400; }
.auth-field input { height: 46px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font-weight: 400; background: #fbfcfe; transition: border-color .15s, box-shadow .15s; }
.auth-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); background: #fff; }
.auth-field-error, .field-validation-error { color: #dc2626; font-size: .8rem; font-weight: 500; }
.auth-check { display: flex; gap: 8px; align-items: center; font-size: .9rem; cursor: pointer; }
.auth-check input { width: 18px; height: 18px; accent-color: var(--brand); }
.auth-submit { height: 48px; width: 100%; font-size: 1rem; margin-top: 4px; }
.auth-error:not(:empty), .auth-error ul { color: #b91c1c; }
.auth-error:not(.validation-summary-valid) { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.auth-error ul { margin: 0; padding-inline-start: 18px; }
.auth-error.validation-summary-valid { display: none; }
.auth-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; border-radius: 12px; padding: 10px 14px; font-size: .9rem; margin-bottom: 8px; }
.auth-links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 18px; font-size: .88rem; color: var(--muted); }
.auth-links a { text-decoration: none; font-weight: 600; }
.auth-icon { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 22px; display: grid; place-items: center; font-size: 2rem; color: var(--brand); background: var(--brand-soft); }
.auth-icon.is-ok { color: #059669; background: #ecfdf5; }
.auth-icon.is-warn { color: #d97706; background: #fffbeb; }
.auth-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.auth-card-login { width: min(430px, 100%); }
.auth-login-brand { display: flex; justify-content: center; margin-bottom: 14px; }
.auth-login-brand .site-brand-mark { width: 56px; height: 56px; border-radius: 16px; font-size: 1.6rem; }
.auth-card-login h1 { text-align: center; }
.auth-card-login .auth-sub { text-align: center; }
.auth-field-row { display: flex; justify-content: space-between; align-items: center; }
.auth-field-row a { font-weight: 500; font-size: .82rem; text-decoration: none; }
.auth-password { position: relative; display: block; }
.auth-password input { width: 100%; padding-left: 44px; }
.auth-eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.auth-eye:hover { background: #f1f5f9; color: var(--ink); }
.auth-inline-link { font-size: .88rem; font-weight: 600; text-decoration: none; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; color: var(--muted); font-size: .85rem; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 760px) {
    .auth-card-wide { grid-template-columns: 1fr; }
    .auth-aside { padding: 24px; }
    .auth-row { grid-template-columns: 1fr; }
    .auth-main { padding: 26px 20px; }
}

.account-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; padding: 12px 16px; border-radius: 16px; color: #312e81; background: linear-gradient(135deg, #eef2ff, #faf5ff); border: 1px solid #e0e7ff; font-size: .92rem; }
.account-banner > .bi { color: #7c3aed; font-size: 1.3rem; }
.account-banner .site-btn { margin-inline-start: auto; }

.footer-phone { color: #c7d2fe; text-decoration: none; font-weight: 600; }
.footer-phone:hover { color: #fff; }

/* ---------- Contact page ---------- */
.contact-page { place-items: start center; }
.contact-wrap { width: min(1080px, 100%); display: grid; grid-template-columns: 1fr 520px; gap: 32px; align-items: start; }
.contact-info h1 { font-family: var(--font-display); font-size: 2.1rem; font-weight: 900; margin: 16px 0 8px; }
.contact-info > p { color: var(--muted); margin: 0 0 22px; }
.contact-cards { display: grid; gap: 12px; }
.contact-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s; }
a.contact-card:hover { border-color: #c7d2fe; transform: translateY(-2px); }
.contact-card > .bi { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; color: var(--brand); background: var(--brand-soft); flex: none; }
.contact-card .bi-whatsapp { color: #16a34a; background: #dcfce7; }
.contact-card-onprem { background: linear-gradient(135deg, #eef2ff, #faf5ff); border-color: #e0e7ff; }
.contact-card-onprem .bi { color: #7c3aed; background: #fff; }
.contact-card span { display: grid; }
.contact-card small { color: var(--muted); font-size: .8rem; }
.contact-card b { font-size: 1.02rem; }
.contact-form-card { width: 100%; }
.contact-form-card h2 { font-family: var(--font-display); font-weight: 900; font-size: 1.4rem; margin-bottom: 6px; }
.contact-select, .contact-textarea { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 400; background: #fbfcfe; }
.contact-select { height: 46px; }
.contact-textarea { resize: vertical; min-height: 120px; }
.contact-select:focus, .contact-textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); background: #fff; }
.contact-hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.captcha-row { display: flex; align-items: center; gap: 8px; }
.captcha-row img { border-radius: 10px; border: 1px solid var(--line); flex: none; }
.captcha-row input { flex: 1; min-width: 0; height: 46px; border: 1.5px solid var(--line); border-radius: 12px; padding: 0 14px; font-size: 1.1rem; letter-spacing: 3px; text-align: center; background: #fbfcfe; }
.captcha-row input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12); }
.captcha-refresh { width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink-2); flex: none; }
.captcha-refresh:hover { color: var(--brand); border-color: #c7d2fe; }
.captcha-refresh.is-spinning .bi { display: inline-block; animation: captcha-spin .7s linear infinite; }
@keyframes captcha-spin { to { transform: rotate(360deg); } }
@media (max-width: 960px) { .contact-wrap { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .captcha-row { flex-wrap: wrap; } .captcha-row input { flex-basis: 100%; } }
/* ---------- On-premise edition ---------- */
.onprem { padding-top: 0; }
.onprem-box { display: grid; grid-template-columns: 1fr 260px; gap: 28px; align-items: center; padding: 34px 38px; border-radius: 24px; background: #0f172a; color: #e2e8f0; position: relative; overflow: hidden; box-shadow: var(--shadow-lg); }
.onprem-box::before { content: ""; position: absolute; inset: -40% auto auto -10%; width: 420px; height: 420px; background: radial-gradient(closest-side, rgba(124, 58, 237, .35), transparent); }
.onprem-text { position: relative; }
.onprem-text .eyebrow { background: rgba(165, 180, 252, .15); color: #c7d2fe; }
.onprem-text h2 { font-family: var(--font-display); font-size: 1.7rem; font-weight: 900; color: #fff; margin: 8px 0 10px; }
.onprem-text p { color: #cbd5e1; margin: 0 0 14px; }
.onprem-text ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.onprem-text li { display: flex; gap: 8px; font-size: .92rem; }
.onprem-text li .bi { color: #a5b4fc; }
.onprem-actions { position: relative; display: grid; justify-items: center; gap: 12px; text-align: center; }
.onprem-icon { font-size: 4rem; color: #a5b4fc; line-height: 1; }
.onprem-actions .site-btn { width: 100%; }
.onprem-phone { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: inline-flex; gap: 8px; align-items: center; }
.onprem-phone:hover { color: #c7d2fe; }
@media (max-width: 860px) { .onprem-box { grid-template-columns: 1fr; padding: 26px 22px; } .onprem-text ul { grid-template-columns: 1fr; } }
/* ---------- Panel invoice editor (customer layout, full width) ---------- */
.customer-full .builder { padding-top: 18px; }
.editor-paid { display: inline-flex; gap: 4px; align-items: center; font-size: .82rem; font-weight: 700; color: #047857; background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 999px; padding: 3px 10px; }
/* ---------- Print: only the invoice paper ---------- */
@media print {
    html, body { background: #fff !important; }
    body * { visibility: hidden; }
    .site-header, .site-footer, .hero, .builder-toolbar, .sample-strip, .builder-side, .site-section, .site-modal, .site-toast { display: none !important; }
    .builder { padding: 0; }
    .builder .site-container { width: 100%; }
    .builder-layout { display: block; }
    .paper, .paper * { visibility: visible; }
    .paper { box-shadow: none; border-radius: 0; max-width: none !important; margin: 0; padding: 0 !important; font-size: 12px; }
    .paper[data-size="a5"] { font-size: 10.5px; }
    .paper[data-template="modern"] .inv-head { margin: 0 0 4px !important; padding: 16px 18px !important; border-radius: 10px; }
    .paper * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .no-print, .paper .no-print { display: none !important; }
    .print-only { display: inline; }
    .fx { box-shadow: none !important; background: transparent !important; padding-inline: 0; }
    .fx::placeholder { color: transparent; }
    .items-table tr.is-empty, .totals-table tr.is-zero, .inv-meta div.is-empty, .note-field.is-empty, .inv-logo.is-empty, .party-grid label.is-empty { display: none !important; }
    .stamp-box .inv-upload { display: none; }
    .inv-watermark-top { display: none !important; }
    /* Free invoices print black-and-white only (also when the browser does not fire beforeprint). */
    .builder[data-premium="false"] .paper { --accent: #111827; --accent-soft: #f3f4f6; --accent-ink: #111827; }
    .builder[data-premium="false"] .paper img { filter: grayscale(1); }
    .vat-rate { background: transparent; padding: 0; }
    .items-table tr { break-inside: avoid; }
    .items-table thead { display: table-header-group; }
    .inv-bottom { break-inside: avoid; }
    .inv-signs { break-inside: avoid; }
    .items-table .c-act { display: none; }
    .inv-head { grid-template-columns: auto 1fr 190px; }
    .inv-logo.is-empty + .inv-title { grid-column: 1 / 3; }
}
