:root {
    --bg: #f8f9fb;
    --surface: #ffffff;
    --surface-soft: #f5f7fa;
    --ink: #1a202c;
    --muted: #718096;
    --line: #e2e8f0;
    --brand: #0f766e;
    --brand-light: #14b8a6;
    --brand-dark: #115e59;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --danger-soft: #fee2e2;
    --warning: #f97316;
    --info: #3b82f6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow: 0 10px 25px rgba(0, 0, 0, .08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .12);
}

/* Keep the selected application theme above all legacy visual layers. */
html[data-theme="dark"] {
    --bs-body-bg: #0b1120;
    --bs-body-color: #edf2f7;
    --bs-border-color: #334155;
    --bs-secondary-color: #a9b6c8;
    --bg: #0b1120;
    --surface: #151d2d;
    --surface-soft: #1d2738;
    --ink: #edf2f7;
    --muted: #a9b6c8;
    --line: #334155;
    --brand: #2dd4bf;
    --brand-light: #5eead4;
    --brand-dark: #99f6e4;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell { background: #0b1120; color: var(--ink); }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar.show { background: linear-gradient(180deg, #111827, #0f172a); color: var(--ink); }
html[data-theme="dark"] .workspace { background: rgba(11, 17, 32, .78); }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .mini-panel,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .document-paper,
html[data-theme="dark"] .line-row,
html[data-theme="dark"] .setup-card,
html[data-theme="dark"] .empty-catalog-callout,
html[data-theme="dark"] .catalog-product-preview { border-color: var(--line); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .top-search input,
html[data-theme="dark"] .account-menu-toggle,
html[data-theme="dark"] .row-menu-toggle,
html[data-theme="dark"] .line-cell input,
html[data-theme="dark"] .line-cell select,
html[data-theme="dark"] .line-cell textarea { border-color: var(--line); background: #111827; color: var(--ink); }
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .dropdown-item { color: var(--ink); border-color: var(--line); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--brand); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--brand-dark); }

h1, h2, h3, h4, h5, h6, p { margin-top: 0; }
h1 { font-size: clamp(28px, 5vw, 48px); font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; }
h2 { font-size: 24px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 20px; font-weight: 600; }
h4 { font-size: 16px; font-weight: 600; }
p { margin-bottom: 12px; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    font-size: 15px;
    font-family: inherit;
    transition: all .2s ease;
}

.line-cell input, .line-cell select, .line-cell textarea {
    width: 100%;
    margin-bottom: 0;
}

input::placeholder, textarea::placeholder {
    color: var(--muted);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    background: #fafcfb;
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .1);
}

input:disabled, textarea:disabled {
    background: var(--surface-soft);
    cursor: not-allowed;
    opacity: 0.65;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

label.required::after {
    content: " *";
    color: var(--danger);
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group select,
.form-group textarea {
    margin-bottom: 0;
}

.document-field input,
.document-field select,
.document-field textarea {
    margin-bottom: 0;
}

.help-text {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    display: block;
}

button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15, 118, 110, .15);
    transition: all .2s ease;
}

button:hover, .btn:hover { 
    background: var(--brand-dark);
    box-shadow: 0 4px 12px rgba(15, 118, 110, .25);
    transform: translateY(-1px);
}

button:active, .btn:active {
    transform: translateY(0);
}

button:disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.ghost { 
    background: transparent;
    color: var(--brand);
    box-shadow: none;
    border: 1px solid var(--line);
}

.btn.ghost:hover { 
    background: var(--surface-soft);
    border-color: var(--brand);
}

.btn.secondary {
    background: var(--muted);
    box-shadow: 0 2px 8px rgba(113, 128, 150, .15);
}

.btn.secondary:hover {
    background: #596775;
}

.btn-small {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
}

.btn-large {
    min-height: 48px;
    padding: 14px 24px;
    font-size: 16px;
}

.flash {
    position: fixed;
    right: 20px;
    top: 16px;
    z-index: 10;
    border-radius: 8px;
    background: #13231f;
    color: #fff;
    padding: 12px 16px;
    box-shadow: var(--shadow);
}

.flash-success { background: var(--success); }
.flash-error { background: var(--danger); }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 950; }
.bi { line-height: 1; }
.brand-mark .bi { font-size: 18px; }

.public {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(244, 246, 241, .80), rgba(244, 246, 241, .80)),
        url("https://images.unsplash.com/photo-1554224155-8d04cb21cd6c?auto=format&fit=crop&w=1900&q=82") center/cover fixed;
}

.public.narrow { max-width: 1120px; margin: auto; padding: 0; }
.public-nav { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 5vw; }
.public-nav strong, .public-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 18px; font-weight: 930; }
.public-nav span { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.public-nav a:not(.btn) { color: #394641; font-weight: 760; }

.hero {
    min-height: calc(100vh - 132px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 460px);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    padding: 5vw;
}

.hero-copy { max-width: 760px; }
.hero-copy h1 { margin-bottom: 18px; font-size: clamp(58px, 10vw, 116px); line-height: .92; }
.hero-copy p:not(.eyebrow) { max-width: 680px; color: #34423d; font-size: clamp(18px, 2vw, 24px); line-height: 1.55; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.hero-panel {
    border: 1px solid rgba(255, 255, 255, .70);
    border-radius: 8px;
    background: rgba(255, 255, 255, .82);
    padding: 22px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.hero-panel-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.hero-panel-head span { color: var(--muted); font-weight: 800; }
.hero-panel-head strong { font-size: 30px; }
.mini-bars, .chart { height: 180px; display: flex; align-items: end; gap: 12px; }
.mini-bars span, .chart span { flex: 1; min-width: 22px; border-radius: 8px 8px 0 0; background: linear-gradient(180deg, var(--brand), var(--accent)); }
.invoice-preview { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; }
.invoice-preview p { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 8px; color: var(--muted); }
.invoice-preview p:last-child { margin-bottom: 0; color: var(--ink); font-weight: 850; }
.invoice-preview span { color: var(--brand); font-weight: 850; }
.invoice-preview.muted span { color: var(--danger); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    padding: 0 5vw 48px;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 22px;
    margin-top: 18px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.panel:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.panel-title .bi {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--brand);
    font-size: 18px;
}

.guide-steps,
.guide-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.guide-steps li,
.guide-list li {
    position: relative;
    padding-left: 24px;
}

.guide-steps li::before,
.guide-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    top: 4px;
    color: var(--brand);
}

.feature-grid article, .panel, .stats-grid article, .auth-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 12px 34px rgba(31, 42, 38, .07);
}

.feature-grid article { padding: 24px; }
.feature-kicker { color: var(--accent); font-weight: 950; }
.feature-grid p { color: var(--muted); line-height: 1.55; }

.section-band,
.split-section,
.workflow-section,
.cta-section,
.page-hero,
.legal-content,
.public-footer {
    margin: 0 5vw 48px;
}

.section-band,
.workflow-section,
.page-hero,
.legal-content,
.cta-section {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, .86);
    box-shadow: 0 12px 34px rgba(31, 42, 38, .07);
}

.section-band,
.workflow-section,
.page-hero,
.legal-content {
    padding: clamp(24px, 4vw, 44px);
}

.section-heading {
    max-width: 760px;
    margin-bottom: 26px;
}

.section-heading h2,
.split-section h2,
.workflow-section h2,
.cta-section h2,
.page-hero h1 {
    font-size: clamp(28px, 4vw, 52px);
    line-height: 1.05;
    margin-bottom: 14px;
}

.section-heading p:not(.eyebrow),
.split-section p,
.cta-section p,
.page-hero p {
    color: var(--muted);
    line-height: 1.65;
    font-size: 17px;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.capability-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.capability-grid article {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 20px;
}

.capability-grid h2 {
    margin: 8px 0 12px;
}

.capability-grid ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 1.45;
}

/* .capability-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
} */

.service-grid article {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 18px;
}

.service-grid strong {
    display: block;
    margin-bottom: 8px;
    font-size: 17px;
}

.service-grid p,
.workflow-list span {
    color: var(--muted);
    line-height: 1.55;
}

.split-section {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
    align-items: center;
    gap: 24px;
    padding: clamp(26px, 5vw, 54px);
    border-radius: 8px;
    background: #13231f;
    color: #fff;
}

.split-section .eyebrow,
.split-section p {
    color: #c9d9d2;
}

.about-metrics {
    display: grid;
    gap: 12px;
}

.about-metrics article {
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 8px;
    background: rgba(255, 255, 255, .07);
    padding: 18px;
}

.about-metrics strong {
    display: block;
    font-size: 34px;
    color: #fff;
}

.about-metrics span {
    color: #c9d9d2;
}

.workflow-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.workflow-list li {
    position: relative;
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: #fff;
    padding: 18px;
}

.workflow-list li::before {
    content: counter(list-item, decimal-leading-zero);
    display: inline-flex;
    margin-bottom: 22px;
    color: var(--accent);
    font-weight: 950;
}

.workflow-list strong,
.workflow-list span {
    display: block;
}

.workflow-list strong {
    margin-bottom: 8px;
}

.cta-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(26px, 5vw, 46px);
    background: linear-gradient(135deg, #fff, #f2f7ef);
}

.cta-section h2 {
    max-width: 720px;
}

.cta-section p {
    max-width: 680px;
    margin-bottom: 0;
}

.page-hero {
    margin-top: 26px;
    padding-top: clamp(34px, 6vw, 74px);
    padding-bottom: clamp(34px, 6vw, 74px);
}

.page-hero p {
    max-width: 760px;
}

.document-template-selected {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
    font-size: 13px;
}

.document-template-selected strong {
    color: var(--ink);
    font-weight: 700;
}

.template-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
}

.template-card {
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    min-height: 270px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: inherit;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.template-card:hover,
.template-card.is-selected {
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: 0 20px 40px rgba(15, 118, 110, .08);
}

.template-mockup {
    display: grid;
    grid-template-rows: 34px 36px 1fr 34px;
    gap: 8px;
    min-height: 160px;
    padding: 12px;
    border: 1px solid #e4e9e4;
    border-radius: 6px;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .65);
}

.mockup-header,
.mockup-meta,
.mockup-footer {
    display: grid;
    grid-template-columns: 1fr 74px;
    gap: 10px;
    align-items: center;
}

.mockup-header span,
.mockup-header strong,
.mockup-meta span,
.mockup-lines span,
.mockup-footer span,
.mockup-footer strong {
    display: block;
    min-width: 0;
    border-radius: 3px;
    background: #dbe5df;
}

.mockup-header span {
    width: 64%;
    height: 16px;
}

.mockup-header strong {
    justify-self: end;
    width: 52px;
    height: 24px;
}

.mockup-meta span {
    height: 26px;
    background: #eef3ef;
}

.mockup-lines {
    display: grid;
    gap: 6px;
}

.mockup-lines span {
    height: 12px;
}

.mockup-lines span:nth-child(2) {
    width: 86%;
}

.mockup-lines span:nth-child(3) {
    width: 72%;
}

.mockup-footer {
    grid-template-columns: 1fr 90px;
}

.mockup-footer span {
    width: 60%;
    height: 18px;
    background: #eef3ef;
}

.mockup-footer strong {
    justify-self: end;
    width: 86px;
    height: 24px;
}

.template-mockup-classic .mockup-header {
    border-bottom: 2px solid #17201d;
}

.template-mockup-classic .mockup-header strong,
.template-mockup-classic .mockup-footer strong {
    background: #17201d;
}

.template-mockup-premium-dark {
    background: #101827;
    border-color: #1f2937;
}

.template-mockup-premium-dark .mockup-header span,
.template-mockup-premium-dark .mockup-lines span {
    background: #d6b56d;
}

.template-mockup-premium-dark .mockup-header strong,
.template-mockup-premium-dark .mockup-footer strong {
    background: #f8fafc;
}

.template-mockup-premium-dark .mockup-meta span,
.template-mockup-premium-dark .mockup-footer span {
    background: #263244;
}

.template-mockup-minimal {
    background: #fbfbfa;
}

.template-mockup-minimal .mockup-header strong,
.template-mockup-minimal .mockup-footer strong {
    background: #aab4ad;
}

.template-mockup-corporate-blue .mockup-header,
.template-mockup-corporate-blue .mockup-footer {
    padding: 5px;
    background: #1d4ed8;
    border-radius: 4px;
}

.template-mockup-corporate-blue .mockup-header span,
.template-mockup-corporate-blue .mockup-header strong,
.template-mockup-corporate-blue .mockup-footer span,
.template-mockup-corporate-blue .mockup-footer strong {
    background: #dbeafe;
}

.template-mockup-modern-green .mockup-header span,
.template-mockup-modern-green .mockup-footer strong {
    background: #0f766e;
}

.template-mockup-modern-green .mockup-header strong,
.template-mockup-modern-green .mockup-lines span {
    background: #99f6e4;
}

.template-mockup-stripe-clean {
    border-left: 5px solid #635bff;
}

.template-mockup-stripe-clean .mockup-header strong,
.template-mockup-stripe-clean .mockup-footer strong {
    background: #635bff;
}

.template-mockup-simple-white {
    background: #fff;
    box-shadow: inset 0 0 0 1px #f1f5f9;
}

.template-mockup-simple-white .mockup-header span,
.template-mockup-simple-white .mockup-lines span,
.template-mockup-simple-white .mockup-footer strong {
    background: #cbd5e1;
}

.template-mockup-split-header .mockup-header {
    grid-template-columns: 1fr 1fr;
    padding: 0;
}

.template-mockup-split-header .mockup-header span,
.template-mockup-split-header .mockup-header strong {
    width: 100%;
    height: 34px;
    border-radius: 4px;
}

.template-mockup-split-header .mockup-header span {
    background: #0f172a;
}

.template-mockup-split-header .mockup-header strong {
    background: #14b8a6;
}

.template-mockup-grid-soft {
    background-image:
        linear-gradient(#eef3ef 1px, transparent 1px),
        linear-gradient(90deg, #eef3ef 1px, transparent 1px);
    background-size: 18px 18px;
}

.template-mockup-grid-soft .mockup-meta span,
.template-mockup-grid-soft .mockup-lines span {
    background: rgba(15, 118, 110, .22);
}

.template-mockup-contrast-bold .mockup-header,
.template-mockup-contrast-bold .mockup-footer strong {
    background: #111827;
}

.template-mockup-contrast-bold .mockup-header {
    padding: 5px;
    border-radius: 4px;
}

.template-mockup-contrast-bold .mockup-header span,
.template-mockup-contrast-bold .mockup-header strong {
    background: #fff;
}

.template-card-copy {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.template-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}

.template-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.template-card-selected {
    display: none;
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(16, 185, 129, .12);
    color: var(--success);
    font-weight: 700;
}

.template-card.is-selected .template-card-selected {
    display: inline-flex;
}

.zero-total-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 10px 12px;
    border: 1px solid #fed7aa;
    border-radius: 6px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.35;
}

.unified-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
    align-items: center;
    gap: clamp(22px, 4vw, 54px);
    margin-top: 0;
}

.unified-hero h1 {
    max-width: 840px;
}

.page-hero-card {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 22px;
}

.page-hero-card strong {
    display: block;
    margin: 8px 0 10px;
    font-size: 28px;
    line-height: 1.1;
}

.page-hero-card p {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 0;
}

.page-grid {
    padding-left: 0;
    padding-right: 0;
    margin-left: 0;
    margin-right: 0;
}

.legal-content {
    display: grid;
    gap: 18px;
}

.legal-content .section-heading {
    margin-bottom: 8px;
}

.legal-content article {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 18px;
}

.legal-content article:last-child {
    padding-bottom: 18px;
}

.legal-content p {
    color: var(--muted);
    line-height: 1.65;
}

.public-footer {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(140px, .6fr));
    gap: 24px;
    /* border-top: 1px solid var(--line); */
    padding: 34px 0;
    color: var(--muted);
}

.public-footer p {
    max-width: 440px;
    margin: 14px 0 0;
    line-height: 1.6;
}

.public-footer nav {
    display: grid;
    align-content: start;
    gap: 10px;
}

.public-footer strong {
    color: var(--ink);
}

.public-footer a {
    color: var(--muted);
    font-weight: 720;
}

.public-footer a:hover {
    color: var(--brand);
}

.public-footer small {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.auth-card {
    width: min(480px, calc(100vw - 32px));
    margin: 8vh auto;
    padding: 30px;
}

.app-shell { display: grid; grid-template-columns: 276px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px;
    background: #13231f;
    color: #fff;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 19px; font-weight: 930; margin-bottom: 28px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    border-radius: 8px;
    color: #d8e7e0;
    padding: 9px 11px;
    font-weight: 760;
}
.sidebar nav a i {
    display: inline-grid;
    place-items: center;
    width: 22px;
    color: #b8cbc3;
    font-size: 16px;
}
.sidebar nav a span { color: #82958e; font-size: 11px; font-weight: 900; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar nav a:hover i { color: #fff; }
.sidebar-card { margin-top: auto; border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; background: rgba(255, 255, 255, .06); padding: 14px; }
.sidebar-card strong, .sidebar-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-toggle { display: none; }

.workspace { min-width: 0; padding: 28px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}
.topbar h1 { margin: 2px 0 0; }
.account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-weight: 800; }
.top-search input {
    width: min(260px, 22vw);
    min-height: 40px;
    background: #fff;
}
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }

.client-index-actions {
    align-items: stretch;
}

.client-index-actions form,
.client-import-form {
    margin: 0;
}

.client-search-form {
    flex: 1 1 240px;
    max-width: 360px;
}

.client-index-actions input,
.client-index-actions .btn,
.client-index-actions button {
    min-height: 38px;
    margin-bottom: 0;
}

.client-import-form {
    gap: 8px;
}

.client-import-input {
    max-width: 240px;
    padding: .35rem .55rem;
    background: #fff;
}

.wizard-line-entry {
    margin-bottom: 18px;
}

.wizard-line-entry-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: end;
}

.wizard-line-entry-actions {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.wizard-lines-section {
    margin-top: 18px;
}

.wizard-bottom-actions {
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 18px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
.stats-grid article { padding: 20px; }
.stat-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #edf5f1;
    color: var(--brand);
    font-size: 18px;
    margin-bottom: 14px;
}
.stat-alert .stat-icon {
    background: var(--danger-soft);
    color: var(--danger);
}
.stats-grid article span, .stats-grid article small { display: block; color: var(--muted); font-weight: 820; }
.stats-grid article strong { display: block; margin: 8px 0 6px; font-size: clamp(24px, 3vw, 34px); letter-spacing: 0; }
.stat-alert { border-color: #fac9bf !important; background: #fff8f6 !important; }

.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { padding: 20px; min-width: 0; }
.panel-wide { grid-column: 1 / -1; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-title h2 { margin: 0; }
.panel-title a { font-weight: 850; }

.table-wrap { 
    /* overflow-x: auto;  */
    overflow-y: visible; 
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 12px; border-bottom: 1px solid #edf1ec; vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 900; text-transform: uppercase; }
tbody tr:hover { background: var(--surface-soft); }
tbody tr:has(.row-menu .dropdown-menu.show) { position: relative; z-index: 25; }

.badge { display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; background: #eaf4ef; color: var(--brand-dark); padding: 4px 9px; font-size: 12px; font-weight: 900; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); text-align: center; padding: 24px; }
.list-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; border-bottom: 1px solid #edf1ec; padding: 12px 0; margin: 0; }
.list-line strong { white-space: nowrap; }

.tabs {
    display: inline-flex;
    gap: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px;
    background: var(--surface-soft);
}

.tabs a {
    border-radius: 6px;
    padding: 8px 12px;
    color: var(--muted);
    font-weight: 850;
}

/* Responsive Cards */
@media (max-width: 1024px) {
    .table-wrap {
        display: none;
    }

    .responsive-cards {
        display: grid;
        gap: 16px;
        grid-template-columns: 1fr;
    }

    .card-item {
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: 12px;
        box-shadow: var(--shadow-sm);
        overflow: hidden;
        transition: all .2s ease;
    }

    .card-item:hover {
        box-shadow: var(--shadow);
        transform: translateY(-2px);
    }

    .card-body {
        padding: 16px;
    }

    .card-field {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        gap: 12px;
    }

    .card-field:last-child {
        margin-bottom: 0;
    }

    .field-label {
        font-size: 12px;
        font-weight: 900;
        text-transform: uppercase;
        color: var(--muted);
        white-space: nowrap;
        flex-shrink: 0;
    }

    .field-value {
        font-weight: 600;
        text-align: right;
        word-break: break-word;
        flex: 1;
    }

    .card-footer {
        padding: 12px 16px;
        background: var(--surface-soft);
        border-top: 1px solid var(--line);
        display: flex;
        justify-content: flex-end;
    }

    .card-footer .row-menu {
        margin: 0;
    }

    .card-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        /* width: 100%; */
    }

    .card-actions .btn {
        flex: none;
        min-width: 0;
        justify-content: center;
        min-height: 29px;
        padding: 5px 12px;
        font-size: 11px;
    }

    .card-actions form {
        flex: none;
        min-width: 0;
    }

    .card-actions form .btn {
        width: auto;
    }
}

@media (min-width: 1025px) {
    .responsive-cards {
        display: none;
    }
}

.tabs a.active {
    background: var(--surface);
    color: var(--brand-dark);
    box-shadow: var(--shadow-sm);
}

.planning-list {
    display: grid;
    gap: 12px;
}

.planning-calendar-panel {
    overflow: hidden;
}

.planning-calendar-head {
    align-items: flex-start;
}

.planning-status-strip {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.planning-status-strip span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.planning-status-strip i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
}

.calendar-scroll {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 74px repeat(var(--day-count), minmax(158px, 1fr));
    grid-template-rows: 68px auto;
    min-width: min(100%, calc(74px + (var(--day-count) * 158px)));
}

.calendar-scroll.is-month .calendar-grid {
    grid-template-columns: 74px repeat(var(--day-count), minmax(162px, 162px));
}

.calendar-corner,
.calendar-day-head {
    position: sticky;
    top: 0;
    z-index: 8;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.calendar-corner {
    left: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.calendar-day-head {
    display: grid;
    align-content: center;
    gap: 1px;
    border-left: 1px solid var(--line);
    padding: 8px 10px;
}

.calendar-day-head span,
.calendar-day-head small {
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.calendar-day-head strong {
    color: var(--ink);
    font-size: 22px;
    line-height: 1;
}

.calendar-day-head.is-today {
    background: #ecfdf5;
    box-shadow: inset 0 -3px 0 var(--brand);
}

.calendar-day-head.is-today strong {
    color: var(--brand-dark);
}

.calendar-hours {
    position: sticky;
    left: 0;
    z-index: 7;
    grid-column: 1;
    grid-row: 2;
    background: #fff;
}

.calendar-hour {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    height: 72px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    padding-top: 8px;
    font-size: 11px;
    font-weight: 850;
}

.calendar-day-column {
    position: relative;
    display: grid;
    grid-template-rows: repeat(var(--hour-count), 72px);
    grid-row: 2;
    min-height: calc(var(--hour-count) * 72px);
    border-left: 1px solid var(--line);
    background: #fff;
}

.calendar-day-column.is-today {
    background: linear-gradient(180deg, rgba(15, 118, 110, .08), rgba(15, 118, 110, .02));
}

.calendar-slot {
    border-bottom: 1px solid #eef2f7;
    background:
        linear-gradient(180deg, transparent 49%, rgba(226, 232, 240, .45) 50%, transparent 51%);
}

.calendar-event {
    position: absolute;
    top: var(--event-top);
    left: 7px;
    right: 7px;
    min-height: 42px;
    height: max(42px, var(--event-height));
    border: 1px solid #dbe4ef;
    border: 1px solid color-mix(in srgb, var(--event-color) 55%, #ffffff);
    border-left: 5px solid var(--event-color);
    border-radius: 8px;
    background: #ffffff;
    background: color-mix(in srgb, var(--event-color) 13%, #ffffff);
    box-shadow: 0 12px 24px rgba(15, 23, 42, .12);
    overflow: hidden;
}

.calendar-event.status-cancelled {
    opacity: .62;
}

.calendar-event-main {
    display: grid;
    gap: 1px;
    height: 100%;
    width: 100%;
    min-height: 0;
    border: 0;
    background: transparent;
    color: #0f172a;
    padding: 7px 34px 7px 9px;
    text-align: left;
    box-shadow: none;
}

.calendar-event-main:hover {
    background: transparent;
    color: #0f172a;
    transform: none;
}

.calendar-event-main strong,
.calendar-event-main span,
.calendar-event-main small,
.calendar-event-main em {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event-main strong {
    font-size: 12px;
    font-weight: 900;
}

.calendar-event-main span {
    color: #334155;
    font-size: 11px;
    font-weight: 850;
}

.calendar-event-main small,
.calendar-event-main em {
    color: #64748b;
    font-size: 10.5px;
    font-style: normal;
    font-weight: 750;
}

.calendar-event-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: grid;
    gap: 3px;
}

.calendar-event-actions form {
    margin: 0;
}

.calendar-event-actions button {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    min-height: 0;
    border-radius: 6px;
    background: rgba(255, 255, 255, .78);
    color: #334155;
    padding: 0;
    box-shadow: none;
    font-size: 12px;
}

.calendar-event-actions button:hover {
    background: #fff;
    color: var(--brand-dark);
    transform: none;
}

.planning-modal .modal-content {
    border: 0;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.planning-modal .modal-header,
.planning-modal .modal-footer {
    border-color: var(--line);
}

.planning-modal .modal-footer {
    gap: 8px;
}

.planning-modal .modal-footer form {
    margin: 0;
}

.planning-modal-form {
    margin: 0;
}

.planning-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.planning-modal-grid label,
.planning-modal-grid .form-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
}

.planning-modal-grid input,
.planning-modal-grid select,
.planning-modal-grid textarea {
    width: 100%;
}

.planning-modal-span {
    grid-column: 1 / -1;
}

.event-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.event-detail-grid div,
.event-detail-block {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.event-detail-grid span,
.event-detail-block span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.event-detail-grid strong {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-top: 3px;
    color: var(--ink);
    font-size: 13px;
}

.event-detail-block {
    margin-top: 12px;
}

.event-detail-block p {
    margin: 6px 0 0;
    color: var(--ink);
}

.event-color-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 999px;
}

.planning-dropzones {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.planning-dropzones button {
    min-height: 40px;
    border: 1px dashed var(--line);
    background: var(--surface-soft);
    color: var(--muted);
    box-shadow: none;
}

.planning-dropzones button.is-over {
    border-color: var(--brand);
    background: #eaf4ef;
    color: var(--brand-dark);
}

.planning-event {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    gap: 16px;
    align-items: start;
    border: 1px solid var(--line);
    border-left: 6px solid var(--event-color);
    border-radius: 8px;
    background: var(--surface);
    padding: 14px;
}

.planning-event[draggable="true"] {
    cursor: grab;
}

.planning-event.is-dragging {
    opacity: .55;
}

.planning-event h3 {
    margin-bottom: 4px;
}

.planning-event-time strong,
.planning-event-time span {
    display: block;
}

.planning-event-time span {
    color: var(--muted);
    font-weight: 750;
}

.planning-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.planning-actions form {
    display: flex;
    flex: 1;
    align-items: center;
    margin: 0;
    gap: 10px;
    flex-wrap: wrap;
}

.team-invite-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 180px repeat(3, minmax(130px, 1fr)) auto;
    gap: 12px;
    align-items: end;
}

.team-invite-form label {
    margin: 0;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(110px, 1fr)) auto;
    gap: 8px;
    align-items: end;
    min-width: 520px;
}

.permission-grid label {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.permission-grid select {
    min-height: 34px;
    margin: 2px 0 0;
    padding: 6px 8px;
    font-size: 12px;
}

.btn-small.danger {
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: none;
}

.btn-small.ghost {
    background: transparent;
    color: var(--brand);
    border: 1px solid var(--line);
    box-shadow: none;
}
.form-panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(31, 42, 38, .06);
}

.form-panel form > div { margin-bottom: 16px; }

.smart-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    align-items: start;
}

.smart-form > div {
    margin-bottom: 0 !important;
    background: rgba(15, 118, 110, .03);
    border: 1px solid rgba(15, 118, 110, .08);
    border-radius: 14px;
    padding: 18px;
}

.smart-form > div:has(label) {
    padding: 18px 18px 12px;
}

.smart-form > div:has(textarea),
.smart-form > div:has(input[type="file"]),
.smart-form > div:has([type="hidden"]),
.smart-form > .actions,
.smart-form > fieldset {
    grid-column: 1 / -1;
    background: transparent;
    border: 0;
    padding: 0;
}

.smart-form textarea {
    min-height: 110px;
}

.smart-form .actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(226, 232, 240, .8);
}
.rowline { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf1ec; padding: 12px 0; }
.inline-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-actions a { display: inline-flex; align-items: center; gap: 5px; font-weight: 850; }
.inline-actions form { margin: 0; }
.inline-actions button, td button { min-height: 32px; padding: 6px 9px; font-size: 12px; box-shadow: none; }

.table-actions {
    width: 1%;
    min-width: 64px;
    text-align: right;
    vertical-align: top;
    overflow: visible;
}

.row-menu {
    position: relative;
    display: inline-block;
    text-align: left;
    z-index: 4;
}

.row-menu.show,
.row-menu:has(.dropdown-menu.show) { z-index: 30; }

.row-menu-toggle {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    padding: 0;
    box-shadow: none;
}

.row-menu-toggle::after { display: none; }
.row-menu-toggle:hover { border-color: var(--brand); color: var(--brand-dark); }

.row-menu-list {
    z-index: 40;
    min-width: 180px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px;
    box-shadow: var(--shadow);
}

.dropdown-menu.row-menu-list { display: none; }
.dropdown-menu.row-menu-list.show { display: grid; }

.row-menu-list a,
.row-menu-list button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: none;
    text-align: left;
}

.row-menu-list a:hover,
.row-menu-list button:hover {
    background: var(--surface-soft);
    color: var(--brand-dark);
    transform: none;
    box-shadow: none;
}

.row-menu-list form { margin: 0; }

.account-menu {
    position: relative;
}

.account-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: #334155;
    padding: 5px 10px 5px 6px;
    cursor: pointer;
    box-shadow: none;
}

.account-menu-toggle::after { margin-left: 2px; }
.account-menu-toggle:hover { border-color: var(--brand); color: white; }

.account-avatar {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 900;
}

.account-name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-menu-list {
    z-index: 20;
    min-width: 210px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 6px;
    box-shadow: var(--shadow);
}

.dropdown-menu.account-menu-list { display: none; }
.dropdown-menu.account-menu-list.show { display: grid; }

.account-menu-list a {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    border-radius: 6px;
    color: #334155;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 800;
}

.account-menu-list a:hover {
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.wizard-shell {
    display: grid;
    gap: 18px;
    max-width: 1200px;
}

.wizard-body {
    display: grid;
    gap: 18px;
}

.wizard-sidebar {
    display: grid;
    gap: 16px;
}

.wizard-sidebar .mini-panel {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 22px;
    box-shadow: 0 12px 30px rgba(31, 42, 38, .05);
}

.wizard-sidebar h3,
.settings-aside h3 {
    margin-bottom: 12px;
    font-size: 16px;
}

.wizard-sidebar ol,
.wizard-sidebar ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.wizard-sidebar li {
    margin-bottom: 10px;
}

.wizard-sidebar .sidebar-note {
    margin-top: 18px;
    padding: 14px;
    background: var(--surface-soft);
    border-radius: 10px;
    color: var(--muted);
}

.wizard-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: clamp(22px, 4vw, 34px);
    box-shadow: 0 12px 34px rgba(31, 42, 38, .07);
}

.wizard-card h2 {
    margin-bottom: 22px;
    font-size: clamp(24px, 4vw, 36px);
}

.settings-shell {
    display: grid;
    gap: 22px;
    max-width: 1120px;
    width: 100%;
}

.settings-panel {
    display: grid;
    gap: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 26px;
    box-shadow: 0 18px 46px rgba(31, 42, 38, .06);
}

.settings-panel .panel-head {
    display: grid;
    gap: 10px;
}

.settings-panel .panel-head h2 {
    margin: 0;
}

.settings-aside {
    display: grid;
    gap: 18px;
    min-width: 280px;
}

.info-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
    padding: 22px;
}

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.info-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.settings-shell .actions {
    justify-content: flex-start;
}

.wizard-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.wizard-steps span {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    padding: 10px 12px;
    font-weight: 820;
}

.wizard-steps strong {
    display: inline-grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #edf5f1;
    color: var(--brand-dark);
}

.wizard-steps .active {
    border-color: rgba(29, 111, 95, .35);
    background: #edf5f1;
    color: var(--brand-dark);
}

.wizard-steps .done strong {
    background: var(--brand);
    color: #fff;
}

.wizard-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: clamp(22px, 4vw, 34px);
    box-shadow: 0 12px 34px rgba(31, 42, 38, .07);
}

.wizard-card h2 {
    margin-bottom: 22px;
    font-size: clamp(24px, 4vw, 36px);
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.summary-grid article {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 16px;
}

.summary-grid span,
.summary-grid small {
    display: block;
    color: var(--muted);
    font-weight: 760;
}

.summary-grid strong {
    display: block;
    margin: 8px 0 5px;
    overflow-wrap: anywhere;
}

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

.wizard-lines-list {
    display: grid;
    gap: 8px;
}

.wizard-lines-list a {
    display: block;
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.wizard-lines-list a.active {
    border-color: rgba(29, 111, 95, .35);
    background: #edf5f1;
}

.wizard-lines-list strong,
.wizard-lines-list span {
    display: block;
}

.wizard-lines-list span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 13px;
}

.wizard-line-form {
    min-width: 0;
}

.remove-line-form {
    margin-top: 12px;
}

.document-editor {
    display: grid;
    gap: 18px;
}

.document-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}

.document-toolbar h2 {
    margin: 2px 0 0;
    font-size: clamp(24px, 3vw, 34px);
}

.document-toolbar-actions,
.line-editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.document-paper {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(31, 42, 38, .10);
    padding: clamp(20px, 3vw, 34px);
}

.editor-mode-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.editor-mode-strip span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border: 1px solid #dce8e2;
    border-radius: 999px;
    background: #f5faf7;
    color: var(--brand-dark);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 900;
}

.document-editor.is-flipped .document-paper {
    background: #fbfcfa;
    box-shadow: inset 0 0 0 1px #e6eee9, 0 10px 28px rgba(31, 42, 38, .06);
}

.document-editor.is-flipped .document-meta-card,
.document-editor.is-flipped .totals-card {
    background: #f2f7f4;
    color: var(--ink);
}

.document-editor.is-flipped .totals-card span {
    color: var(--muted);
}

.document-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid #e9eee8;
    padding-bottom: 22px;
    margin-bottom: 22px;
}

.document-brand-block {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.document-brand-block strong,
.document-brand-block small {
    display: block;
}

.document-brand-block small {
    color: var(--muted);
    margin-top: 4px;
}

.document-meta-card {
    min-width: 220px;
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 16px;
    text-align: right;
}

.document-meta-card span,
.document-meta-card small {
    display: block;
    color: var(--muted);
    font-weight: 820;
}

.document-meta-card strong {
    display: block;
    margin: 6px 0;
    font-size: 22px;
}

.document-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.document-field label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.compact-btn {
    padding: 6px 10px;
    min-height: 0;
    font-size: 12px;
}

.form-error {
    display: block;
    margin-top: 5px;
    color: #b42318;
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
}

.line-editor {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: #f8faf7;
    overflow: hidden;
}

.line-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border-bottom: 1px solid #e8eee7;
    background: #fff;
    padding: 18px;
}

.line-editor-head h3 {
    margin: 2px 0 0;
    font-size: 20px;
}

.price-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

label.price-mode  {
    margin-bottom: 0;
}

.price-mode select {
    /* min-height: 40px; */
    min-width: 86px;
    background: #fff;
    margin-bottom: 0;
}

.line-table {
    overflow-x: auto;
}

.line-table-header,
.line-row {
    display: grid;
    grid-template-columns: minmax(190px, 1.25fr) minmax(180px, 1.05fr) 88px 98px 120px 112px 96px 120px 38px;
    gap: 8px;
    align-items: stretch;
    min-width: 1120px;
}

.line-table-header {
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    padding: 12px 14px;
    text-transform: uppercase;
}

.line-list {
    display: grid;
    gap: 8px;
    padding: 0 14px 14px;
}

.line-row {
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 8px 22px rgba(31, 42, 38, .06);
}

.line-cell input,
.line-cell textarea,
.line-cell select {
    min-height: 42px;
    border-color: #edf1ec;
    background: #fffdf0;
    font-size: 13px;
}

.line-cell textarea {
    resize: vertical;
}

.designation-cell {
    display: grid;
    gap: 6px;
}

.line-total {
    display: grid;
    place-items: center end;
    min-height: 42px;
    border-radius: 8px;
    background: #eef3f0;
    color: var(--ink);
    padding: 0 10px;
    font-weight: 900;
}

.line-remove {
    min-height: 42px;
    width: 34px;
    border-radius: 8px;
    background: #fff1ee;
    color: var(--danger);
    box-shadow: none;
    font-size: 22px;
    line-height: 1;
}

.line-remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.document-bottom {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
    margin-top: 22px;
}

.document-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.wide-field {
    grid-column: 1 / -1;
}

.totals-card {
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: #13231f;
    color: #fff;
    padding: 18px;
}

.totals-card p {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 11px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.totals-card span {
    color: #c9d9d2;
}

.totals-card .grand-total {
    border-bottom: 0;
    margin-top: 8px;
    font-size: 20px;
}

.document-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.email-composer {
    display: grid;
    gap: 18px;
    max-width: 820px;
}

.stack-form {
    display: grid;
    gap: 14px;
}

.stack-form label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

.search-panel {
    display: grid;
    gap: 12px;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.result-list {
    display: grid;
    gap: 8px;
}

.result-row {
    display: grid;
    gap: 4px;
    border: 1px solid #e8eee7;
    border-radius: 8px;
    background: var(--surface-soft);
    padding: 12px;
}

.result-row span,
.muted {
    color: var(--muted);
}

.export-hero h2 {
    margin-bottom: 8px;
    font-size: clamp(26px, 4vw, 42px);
}

.export-hero p {
    color: var(--muted);
    margin-bottom: 0;
}

.export-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.export-card {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    justify-content: space-between;
}

.export-card p {
    color: var(--muted);
    line-height: 1.55;
}

@media (min-width: 980px) {
    .wizard-body {
        grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
        align-items: start;
    }

    .settings-shell {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
        align-items: start;
    }
}

@media (max-width: 980px) {
    .hero { grid-template-columns: 1fr; padding-top: 26px; }
    .unified-hero { grid-template-columns: 1fr; }
    .hero-panel { max-width: 560px; }
    .feature-grid, .stats-grid, .service-grid, .capability-grid, .workflow-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .split-section, .public-footer { grid-template-columns: 1fr; }
    .cta-section { align-items: flex-start; flex-direction: column; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; display: none; }
    .sidebar.show { 
        display: flex; 
        position: fixed;
        height: 100vh;
        width: 80vw;
        z-index: 99999;
    }
    .sidebar-toggle { display: block !important; }
    .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sidebar-card { margin-top: 18px; }
    .panel-grid { grid-template-columns: 1fr; }
    .wizard-steps, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .wizard-lines-layout { grid-template-columns: 1fr; }
    .document-head, .line-editor-head { align-items: flex-start; flex-direction: column; }
    .document-grid, .document-bottom, .document-options { grid-template-columns: 1fr; }
    .document-meta-card { width: 100%; text-align: left; }
    .line-table {
        overflow-x: visible;
    }
    .line-table-header {
        display: none;
    }
    .line-row {
        grid-template-columns: 1fr !important;
        min-width: 0 !important;
        gap: 12px;
    }
    .line-row .line-cell,
    .line-row .line-total,
    .line-row .line-remove {
        min-width: 0 !important;
        width: 100%;
    }
    .line-row .line-cell {
        padding: 0;
    }
    .line-row .line-cell input,
    .line-row .line-cell textarea,
    .line-row .line-cell select {
        width: 100%;
    }
    .line-row .line-cell::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 8px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 900;
        text-transform: uppercase;
        letter-spacing: .02em;
    }
    .line-row .designation-cell::before {
        content: 'Désignation';
    }
    .line-row .line-cell:nth-child(2)::before {
        content: 'Description';
    }
    .line-row .line-cell:nth-child(3)::before {
        content: 'Quantité';
    }
    .line-row .line-cell:nth-child(4)::before {
        content: 'Unité';
    }
    .line-row .line-cell:nth-child(5)::before {
        content: 'Prix HT';
    }
    .line-row .line-cell:nth-child(6)::before {
        content: 'Remise';
    }
    .line-row .line-cell:nth-child(7)::before {
        content: 'TVA';
    }
    .line-row .line-total {
        display: grid;
        place-items: start;
        padding: 10px 0;
        font-weight: 900;
    }
    .line-row .line-remove {
        justify-content: flex-end;
    }
    .line-editor-actions,
    .price-mode,
    .product-picker {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .line-editor-actions {
        gap: 12px;
    }
    .document-bottom {
        grid-template-columns: 1fr !important;
    }
    .document-options {
        grid-template-columns: 1fr !important;
    }
    .export-grid, .search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .public-nav { align-items: flex-start; flex-direction: column; padding: 18px; }
    .hero { min-height: auto; padding: 24px 18px 34px; }
    .hero-copy h1 { font-size: 58px; }
    .feature-grid, .stats-grid, .service-grid, .capability-grid, .workflow-list { grid-template-columns: 1fr; padding-left: 18px; padding-right: 18px; }
    .section-band, .split-section, .workflow-section, .cta-section, .page-hero, .legal-content, .public-footer { margin-left: 18px; margin-right: 18px; }
    .service-grid, .workflow-list { padding-left: 0; padding-right: 0; }
    .workspace { padding: 18px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .account { width: 100%; justify-content: space-between; flex-wrap: wrap; }
    .top-search, .top-search input { width: 100%; }
    .account-menu { 
        /* width: 100%;  */
        margin-left: 0; 
    }
    .account-menu-toggle { width: 100%; justify-content: space-between; }
    .account-menu-list { left: 0; right: 0; }
    .sidebar nav { grid-template-columns: 1fr; }
    .list-line { grid-template-columns: 1fr; }
    .wizard-steps, .summary-grid { grid-template-columns: 1fr; }
    .document-toolbar { grid-template-columns: 1fr; }
    .document-actions { justify-content: stretch; flex-direction: column; }
    .document-toolbar-actions, .line-editor-actions, .price-mode { align-items: stretch; flex-direction: column; width: 100%; }
    .search-form { grid-template-columns: 1fr; }
    .document-actions .btn, .document-toolbar .btn, .line-editor-actions .btn { width: 100%; }
    .export-grid, .search-results { grid-template-columns: 1fr; }
    .planning-modal-grid,
    .event-detail-grid { grid-template-columns: 1fr; }
}

/* Theme picker and application dark mode */
.theme-picker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
}

.theme-switch {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    padding: 6px 10px;
    box-shadow: none;
}

.theme-switch:hover {
    border-color: var(--brand);
    background: var(--surface-soft);
    color: var(--ink);
    transform: none;
}

.theme-switch-track {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    border-radius: 999px;
    background: #cbd5e1;
    transition: background .2s ease;
}

.theme-switch-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
    transition: transform .2s ease;
}

.theme-switch-label {
    min-width: 52px;
    color: inherit;
    font-size: 12px;
    font-weight: 800;
}

.theme-switch-moon { color: #64748b; }
.theme-switch-sun { color: #f59e0b; }

html[data-theme="dark"] .theme-switch-track { background: #0f766e; }
html[data-theme="dark"] .theme-switch-thumb { transform: translateX(16px); }
html[data-theme="dark"] .theme-switch {
    border-color: #475569;
    background: #1e293b;
    color: #f8fafc;
}
html[data-theme="dark"] .theme-switch-moon { color: #c4b5fd; }
html[data-theme="dark"] .theme-switch-sun { color: #94a3b8; }

.theme-picker-mobile { display: none; }

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #151d2d;
    --surface-soft: #1d2738;
    --ink: #edf2f7;
    --muted: #a9b6c8;
    --line: #334155;
    --brand: #2dd4bf;
    --brand-light: #5eead4;
    --brand-dark: #99f6e4;
    --danger-soft: #451a1a;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .35);
    --shadow: 0 12px 28px rgba(0, 0, 0, .38);
    --shadow-lg: 0 24px 64px rgba(0, 0, 0, .48);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell {
    background: #0b1120;
    color: var(--ink);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar.show {
    border-color: var(--line);
    background: linear-gradient(180deg, #111827, #0f172a);
    color: var(--ink);
}

html[data-theme="dark"] .sidebar nav a { color: #cbd5e1; }
html[data-theme="dark"] .sidebar nav a:hover { background: rgba(45, 212, 191, .13); color: #f8fafc; }
html[data-theme="dark"] .sidebar-card,
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .mini-panel,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .document-paper,
html[data-theme="dark"] .line-row {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}

html[data-theme="dark"] .workspace { background: rgba(11, 17, 32, .7); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .top-search input,
html[data-theme="dark"] .account-menu-toggle,
html[data-theme="dark"] .row-menu-toggle,
html[data-theme="dark"] .line-cell input,
html[data-theme="dark"] .line-cell select,
html[data-theme="dark"] .line-cell textarea {
    border-color: var(--line);
    background: #111827;
    color: var(--ink);
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus { background: #172033; }
html[data-theme="dark"] .dropdown-item { color: var(--ink); }
html[data-theme="dark"] .dropdown-item:hover { background: var(--surface-soft); color: var(--brand-light); }
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td { color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] tbody tr:hover { background: var(--surface-soft); }
html[data-theme="dark"] .badge { background: #153b38; color: #99f6e4; }
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .editor-mode-strip span { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
html[data-theme="dark"] .tabs a.active { background: #263247; color: var(--brand-light); }
html[data-theme="dark"] .line-total { background: #263247; color: var(--ink); }

/* Accessible contrast for controls, text and content surfaces in dark mode. */
html[data-theme="dark"] .workspace .btn,
html[data-theme="dark"] .workspace button.btn {
    border-color: #0f766e;
    background: #0f766e;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}

html[data-theme="dark"] .workspace .btn:hover,
html[data-theme="dark"] .workspace button.btn:hover {
    border-color: #5eead4;
    background: #2dd4bf;
    color: #062e2b;
}

html[data-theme="dark"] .workspace .btn.ghost,
html[data-theme="dark"] .workspace .btn-outline-secondary,
html[data-theme="dark"] .workspace .btn-secondary {
    border-color: #64748b;
    background: #263247;
    color: #f8fafc;
}

html[data-theme="dark"] .workspace .btn.ghost:hover,
html[data-theme="dark"] .workspace .btn-outline-secondary:hover,
html[data-theme="dark"] .workspace .btn-secondary:hover {
    border-color: #5eead4;
    background: #334155;
    color: #ffffff;
}

html[data-theme="dark"] .workspace .btn.danger,
html[data-theme="dark"] .workspace .btn-small.danger {
    border-color: #f87171;
    background: #7f1d1d;
    color: #ffffff;
}

html[data-theme="dark"] .workspace :is(h1, h2, h3, h4, h5, h6, label, strong) { color: #f8fafc; }
html[data-theme="dark"] .workspace :is(.form-help, .help-text, .text-muted, .empty, .eyebrow, small) { color: #c3cedd !important; }
html[data-theme="dark"] .workspace a:not(.btn):not(.dropdown-item) { color: #282828; }
html[data-theme="dark"] .workspace a:not(.btn):not(.dropdown-item):hover { color: #ccfbf1; }

html[data-theme="dark"] .workspace :is(
    article,
    .card-item,
    .list-line,
    .form-panel,
    .settings-panel,
    .planning-card,
    .planning-dropzones,
    .invoice-preview,
    .summary-card,
    .wizard-added-line,
    .document-meta-card
) {
    border-color: #334155;
    background: #151d2d;
    color: #edf2f7;
}

html[data-theme="dark"] .workspace .stat-alert {
    border-color: #9f3a38 !important;
    background: #3f1d22 !important;
}

html[data-theme="dark"] .workspace .badge.danger {
    background: #5f2025;
    color: #fecaca;
}

html[data-theme="dark"] .workspace table {
    --bs-table-color: #edf2f7;
    --bs-table-bg: transparent;
    --bs-table-border-color: #334155;
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: #1d2738;
}

html[data-theme="dark"] .workspace input::placeholder,
html[data-theme="dark"] .workspace textarea::placeholder { color: #94a3b8; opacity: 1; }
html[data-theme="dark"] .workspace input:disabled,
html[data-theme="dark"] .workspace textarea:disabled,
html[data-theme="dark"] .workspace select:disabled { background: #1e293b; color: #cbd5e1; opacity: 1; }

html[data-theme="dark"] .workspace .line-editor {
    border-color: #334155;
    background: #111827;
}

html[data-theme="dark"] .workspace .line-editor-head {
    border-bottom-color: #334155;
    background: #151d2d;
}

html[data-theme="dark"] .workspace .line-editor-head .eyebrow,
html[data-theme="dark"] .workspace .line-editor-head .form-help,
html[data-theme="dark"] .workspace .line-editor-head p {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .workspace .line-editor-head h3 {
    color: #f8fafc;
}

html[data-theme="dark"] .workspace .line-table {
    background: #111827;
}

html[data-theme="dark"] .workspace .line-table-header {
    border-top: 1px solid #263247;
    background: #111827;
    color: #cbd5e1;
}

html[data-theme="dark"] .workspace .empty-catalog-callout {
    border-color: #475569;
    background: #1e293b;
}

html[data-theme="dark"] .workspace .empty-catalog-callout strong { color: #f8fafc; }
html[data-theme="dark"] .workspace .empty-catalog-callout span { color: #cbd5e1; }
html[data-theme="dark"] .workspace .price-mode { color: #d7e0ec; }
html[data-theme="dark"] .form-help,
html[data-theme="dark"] small { color: var(--muted); }

@media (max-width: 980px) {
    .theme-picker-navbar { display: none; }
    .theme-picker-mobile {
        display: flex;
        justify-content: space-between;
        margin-top: 14px;
        padding: 12px;
        border: 1px solid rgba(128, 145, 160, .24);
        border-radius: 8px;
    }
}

/* Bootstrap professional theme */
:root {
    --bs-body-bg: #f6f8fb;
    --bs-body-color: #1f2937;
    --bs-font-sans-serif: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #1f2937;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #2563eb;
    --danger: #dc2626;
    --danger-soft: #fee2e2;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

body {
    background: var(--bs-body-bg);
    color: var(--bs-body-color);
    font-size: 13px;
    line-height: 1.45;
}

h1 { font-size: clamp(22px, 2.5vw, 30px); font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin-bottom: .75rem; }

input,
select,
textarea,
.form-control,
.form-select {
    min-height: 36px;
    border-color: var(--line);
    border-radius: .375rem;
    padding: .45rem .65rem;
    font-size: 13px;
}

textarea {
    min-height: 80px;
}

label,
.document-field label,
.stack-form label {
    margin-bottom: .4rem;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    text-transform: uppercase;
}

button,
.btn {
    min-height: 36px;
    border-radius: .375rem;
    padding: .45rem .75rem;
    background: var(--brand);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}

button:hover,
.btn:hover {
    background: var(--brand-dark);
    color: #fff;
}

.btn.ghost {
    border: 1px solid var(--line);
    background: #fff;
    color: #334155;
}

.btn.ghost:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
}

.form-panel .actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.form-panel .actions .btn {
    min-width: 140px;
}

.eyebrow {
    margin-bottom: .25rem;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: .5rem;
    background: var(--brand);
}

.app-shell {
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    border-right: 1px solid #1e293b;
    background: #0f172a;
    padding: 18px 14px;
}

.brand {
    margin-bottom: 18px;
    padding: 0 8px;
    font-size: 16px;
}

.sidebar nav {
    gap: 2px;
}

.sidebar nav a {
    min-height: 36px;
    border-radius: .375rem;
    color: #cbd5e1;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 650;
}

.sidebar nav a i {
    width: 18px;
    color: #94a3b8;
    font-size: 14px;
}

.sidebar nav a span {
    width: 20px;
    color: #64748b;
    font-size: 10px;
}

.sidebar nav a:hover {
    background: #1e293b;
}

.sidebar-card {
    border-color: #334155;
    border-radius: .5rem;
    background: #111827;
    padding: 12px;
}

.workspace {
    padding: 22px;
}

.topbar {
    min-height: 58px;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: #fff;
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.topbar h1 {
    margin: 0;
}

.account {
    gap: 10px;
    color: #475569;
    font-size: 12px;
    font-weight: 650;
}

.account-menu-toggle {
    min-height: 34px;
    border-radius: .5rem;
}

.top-search input {
    width: 220px;
    min-height: 34px;
    border-radius: 999px;
    padding-left: 14px;
}

.actions {
    gap: 8px;
    margin-bottom: 14px;
}

.panel,
.feature-grid article,
.stats-grid article,
.auth-card,
.wizard-card,
.summary-grid article,
.line-editor,
.document-paper,
.page-hero,
.section-band,
.workflow-section,
.legal-content,
.cta-section,
.result-row,
.export-card {
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: #fff;
    box-shadow: var(--shadow);
}

.panel {
    padding: 16px;
    margin-bottom: 18px;
}

.panel-grid,
.stats-grid,
.export-grid,
.search-results {
    gap: 14px;
}

.stats-grid article {
    padding: 16px;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: .5rem;
    font-size: 15px;
    margin-bottom: 10px;
}

.stats-grid article strong {
    margin: 6px 0 4px;
    font-size: clamp(20px, 2vw, 26px);
    font-weight: 750;
}

.stats-grid article span,
.stats-grid article small {
    font-size: 12px;
}

table {
    font-size: 12.5px;
}

th,
td {
    padding: 10px 11px;
    border-color: var(--line);
}

th {
    color: #64748b;
    font-size: 10.5px;
    letter-spacing: .04em;
}

tbody tr:hover {
    background: #f8fafc;
}

.badge {
    min-height: 22px;
    border-radius: 999px;
    background: #ecfdf5;
    color: #047857;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 750;
}

.badge.danger {
    background: #fef2f2;
    color: var(--danger);
}

.inline-actions {
    gap: 8px;
}

.inline-actions a,
.inline-actions button,
td button {
    min-height: 28px;
    padding: 4px 8px;
    border-radius: .375rem;
    font-size: 11.5px;
}

.inline-actions a {
    color: #0f766e;
}

.document-toolbar {
    gap: 12px;
}

.document-toolbar h2 {
    font-size: 22px;
}

.document-paper {
    padding: 22px;
}

.editor-mode-strip span {
    min-height: 24px;
    border-radius: 999px;
    background: #f8fafc;
    color: #475569;
    padding: 3px 9px;
    font-size: 11px;
}

.document-head {
    padding-bottom: 16px;
    margin-bottom: 18px;
}

.document-meta-card {
    border-radius: .625rem;
    background: #f8fafc;
    padding: 14px;
}

.document-meta-card strong {
    font-size: 18px;
}

.document-grid {
    gap: 12px;
    margin-bottom: 18px;
}

.line-editor-head {
    padding: 14px;
}

.line-editor-head h3 {
    font-size: 16px;
}

.line-table-header,
.line-row {
    grid-template-columns: minmax(180px, 1.25fr) minmax(170px, 1fr) 78px 90px 110px 100px 86px 112px 34px;
    min-width: 1040px;
}

.line-table-header {
    padding: 10px 12px;
    font-size: 10px;
}

.line-list {
    gap: 6px;
    padding: 0 12px 12px;
}

.line-row {
    border-left-color: var(--brand);
    border-radius: .5rem;
    padding: 8px;
    box-shadow: none;
}

.line-cell input,
.line-cell textarea,
.line-cell select {
    min-height: 34px;
    background: #fff;
    font-size: 12px;
}

.line-total,
.line-remove {
    min-height: 34px;
    border-radius: .375rem;
}

.line-total {
    font-size: 12px;
}

.document-bottom {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 14px;
    margin-top: 18px;
}

.totals-card {
    border-radius: .75rem;
    background: #0f172a;
    padding: 14px;
    font-size: 12px;
}

.totals-card p {
    padding: 8px 0;
}

.totals-card .grand-total {
    font-size: 16px;
}

.wizard-steps span,
.wizard-lines-list a,
.result-row,
.page-hero-card,
.capability-grid article,
.service-grid article,
.workflow-list li,
.legal-content article {
    border-radius: .625rem;
    box-shadow: none;
}

.wizard-steps span {
    min-height: 48px;
    padding: 9px 10px;
    font-size: 12px;
}

.wizard-card h2,
.export-hero h2,
.section-heading h2,
.split-section h2,
.workflow-section h2,
.cta-section h2,
.page-hero h1 {
    font-size: clamp(22px, 3vw, 34px);
}

.public {
    background:
        linear-gradient(180deg, rgba(246, 248, 251, .85), rgba(246, 248, 251, .85)),
        url("https://images.unsplash.com/photo-1554224155-8d04cb21cd6c?auto=format&fit=crop&w=1900&q=82") center/cover fixed;
}

.public-nav {
    min-height: 66px;
    padding: 0 4vw;
}

.public-nav a:not(.btn) {
    color: #475569;
    font-size: 13px;
}

.hero {
    min-height: calc(100vh - 110px);
    gap: clamp(24px, 4vw, 48px);
    padding: 4vw;
}

.hero-copy h1 {
    font-size: clamp(42px, 7vw, 74px);
    line-height: .98;
}

.hero-copy p:not(.eyebrow),
.section-heading p:not(.eyebrow),
.split-section p,
.cta-section p,
.page-hero p {
    font-size: 14px;
    line-height: 1.6;
}

.hero-panel,
.invoice-preview,
.feature-grid article,
.section-band,
.workflow-section,
.page-hero,
.legal-content,
.cta-section {
    border-radius: .75rem;
}



.hero-panel-head strong {
    font-size: 24px;
}

.mini-bars,
.chart {
    height: 130px;
}

.feature-grid,
.service-grid,
.capability-grid,
.workflow-list {
    gap: 14px;
}

.feature-grid article,
.service-grid article,
.capability-grid article {
    padding: 16px;
}

.feature-grid p,
.service-grid p,
.capability-grid ul,
.workflow-list span,
.legal-content p,
.export-card p {
    font-size: 13px;
}

.public-footer {
    margin-bottom: 22px;
    padding: 24px 0;
    font-size: 13px;
}

.invoice-filters {
    margin-bottom: 14px;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(170px, 1.2fr) 150px 160px 140px 140px auto;
    gap: 10px;
    align-items: end;
}

.filter-grid label {
    margin: 0;
}

.filter-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.push-toggle.is-active {
    border-color: rgba(15, 118, 110, .35);
    background: #ecfdf5;
    color: #047857;
}

.billing-summary {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 14px;
}

.usage-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0 6px;
}

.usage-grid article {
    border: 1px solid var(--line);
    border-radius: .625rem;
    background: #f8fafc;
    padding: 12px;
}

.usage-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.usage-grid strong {
    display: block;
    margin-top: 4px;
    font-size: 18px;
}

.billing-alert {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    margin-bottom: 14px;
}

.billing-alert > i {
    color: var(--danger);
    font-size: 20px;
}

.trial-callout,
.trial-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.trial-callout h2 {
    margin: 0 0 6px;
}

.trial-banner {
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid #b8dccb;
    border-radius: 8px;
    background: #f1fbf6;
}

.trial-banner.is-urgent {
    border-color: #fac9bf;
    background: #fff8f6;
}

.trial-banner div {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.trial-banner span {
    color: var(--muted);
    font-weight: 800;
}

.trial-conversion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
    border-color: #b8dccb;
    background: #f1fbf6;
}

.trial-conversion h2 {
    margin: 0 0 6px;
}

.trial-conversion-urgent {
    border-color: #fac9bf;
    background: #fff8f6;
}

.trial-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.trial-metrics span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 4px 10px;
    color: var(--muted);
    font-weight: 750;
}

.trial-metrics strong {
    color: var(--ink);
}

.stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.chart-labelled {
    align-items: end;
    padding-bottom: 24px;
}

.chart-labelled span {
    position: relative;
}

.chart-labelled em {
    position: absolute;
    right: 0;
    bottom: -22px;
    left: 0;
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
}

.onboarding-panel {
    margin-bottom: 18px;
}

.onboarding-panel .panel-title form {
    margin: 0;
}

.onboarding-checklist {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.onboarding-checklist a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    padding: 10px 12px;
    color: var(--ink);
    font-weight: 760;
}

.onboarding-checklist a.is-done {
    border-color: #b8dccb;
    background: #f1fbf6;
    color: var(--brand-dark);
}

.onboarding-checklist i {
    color: var(--brand);
}

.public-document {
    min-height: 100vh;
    padding: clamp(18px, 4vw, 48px);
    background: var(--bg);
}

.public-document-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    max-width: 980px;
    margin: 0 auto 18px;
}

.public-document-head h1 {
    margin: 0 0 6px;
}

.public-document-card {
    max-width: 980px;
    margin: 0 auto;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.pricing-card {
    display: flex;
    min-height: 360px;
    flex-direction: column;
    justify-content: space-between;
}

.pricing-card.is-current {
    border-color: rgba(15, 118, 110, .35);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .08);
}

.pricing-card .price {
    display: block;
    margin: 10px 0;
    font-size: 24px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pricing-card ul {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.pricing-card li {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.public-pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.public-pricing-card {
    display: flex;
    min-height: 430px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 28px;
    border: 1px solid rgba(17, 24, 39, .12);
    border-radius: 8px;
    background: #fff;
}

.public-pricing-card.is-featured {
    border-color: rgba(15, 118, 110, .35);
    box-shadow: 0 16px 42px rgba(15, 118, 110, .12);
}

.public-pricing-card h2 {
    margin: 0;
    font-size: 34px;
}

.public-pricing-card p {
    margin: 0;
    color: #46544f;
}

.public-pricing-card ul {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.public-pricing-card li {
    display: flex;
    gap: 8px;
}

.public-pricing-card li::before {
    content: "✓";
    color: #0f766e;
    font-weight: 900;
}

.pricing-highlight strong {
    font-size: 32px;
}

.sidebar-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: #0f766e;
    font-weight: 850;
}

.inline-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.inline-form select {
    min-width: 110px;
}

.faq-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.faq-list article {
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: #fff;
    padding: 16px;
}

.faq-list h3 {
    margin-bottom: 8px;
}

/* Enhanced Flash/Alert Messages */
.flash {
    position: fixed;
    right: 20px;
    top: 20px;
    z-index: 1000;
    min-width: 300px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.3s ease;
}

.flash::before {
    content: "ℹ";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.flash-success {
    background: var(--success);
}

.flash-success::before {
    content: "✓";
}

.flash-error {
    background: var(--danger);
}

.flash-error::before {
    content: "✕";
}

.flash-warning {
    background: var(--warning);
}

.flash-warning::before {
    content: "⚠";
}

.flash-info {
    background: var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.flash.hide {
    animation: slideOutRight 0.3s ease forwards;
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

/* Form Validation */
.form-error {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 6px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-error:empty {
    display: none;
    margin: 0;
    padding: 0;
}

.form-error:not(:empty)::before {
    content: "⚠";
    font-weight: bold;
}

input.error,
textarea.error {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.02);
}

/* Authentication Forms */
.auth-card {
    width: min(500px, calc(100vw - 32px));
    margin: 6vh auto 2vh;
    padding: 40px 32px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin-bottom: 8px;
    font-size: 32px;
}

.auth-card .auth-subtitle {
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.6;
}

.auth-form {
    display: grid;
    gap: 18px;
    margin-bottom: 24px;
}

.auth-form .form-group {
    margin-bottom: 0;
}

.auth-form label {
    margin-bottom: 8px;
}

.auth-form input {
    min-height: 44px;
}

.auth-actions {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-actions button {
    width: 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.auth-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
    border-top: 1px solid var(--line);
    padding-top: 20px;
}

.auth-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.auth-footer a {
    font-weight: 600;
    color: var(--brand);
}

.auth-footer a:hover {
    color: var(--brand-dark);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    /* border-top: 1px solid var(--line); */
}

.auth-provider-list {
    margin-bottom: 24px;
    padding: 22px 24px;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.05);
    /* border: 1px solid rgba(15, 118, 110, 0.15); */
}

.auth-provider-list .provider-title {
    margin: 0 0 10px;
    font-weight: 700;
    color: var(--brand-dark);
}

.provider-buttons {
    display: grid;
    gap: 12px;
}

.btn-provider {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-provider:hover {
    transform: translateY(-1px);
    background: #f9fafb;
    border-color: var(--line);
}

.two-factor-card {
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
}

.two-factor-header {
    margin-bottom: 24px;
}

.two-factor-header h2 {
    margin-bottom: 8px;
    font-size: 22px;
}

.two-factor-header p {
    margin: 0;
    color: var(--muted);
}

.form-group label {
    font-size: 14px;
    margin-bottom: 8px;
}

.form-group input {
    min-height: 48px;
    border-radius: 12px;
}

.auth-links .btn {
    width: 100%;
}

.auth-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}

.btn-ghost:hover {
    background: var(--surface-soft);
    border-color: var(--brand);
}

.auth-links a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--brand);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-links a:hover {
    background: var(--surface);
    border-color: var(--brand);
}

.auth-social {
    display: grid;
    gap: 12px;
    margin: 20px 0 24px;
}

.auth-social .btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.auth-social .btn-social:hover {
    background: var(--surface-soft);
    border-color: var(--muted);
    transform: translateY(-1px);
}

.auth-social .btn-social:active {
    transform: translateY(0);
}

.auth-social .social-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.auth-social .btn-google {
    border-color: #ddd;
}

.auth-social .btn-google:hover {
    background: #f9f9f9;
    border-color: #4285F4;
}

.auth-social .btn-apple {
    border-color: #ddd;
}

.auth-social .btn-apple:hover {
    background: #f9f9f9;
    border-color: var(--ink);
}

.auth-social .btn-linkedin {
    border-color: #ddd;
}

.auth-social .btn-linkedin:hover {
    background: #f9f9f9;
    border-color: #0077B5;
}

.row-menu-list a,
.row-menu-list button,
td .row-menu-list button {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #334155;
    padding: 7px 9px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: none;
    text-align: left;
}

.row-menu-list a:hover,
.row-menu-list button:hover,
td .row-menu-list button:hover {
    background: var(--surface-soft);
    color: var(--brand-dark);
    transform: none;
    box-shadow: none;
}

@media (max-width: 980px) {
    .account-menu { margin-left: auto; }
}

/* Info Box */
.info-box {
    padding: 16px 20px;
    border-radius: 8px;
    background: #e3f2fd;
    border-left: 4px solid var(--info);
    color: #1565c0;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.info-box strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.success-box {
    padding: 16px 20px;
    border-radius: 8px;
    background: #f0fdf4;
    border-left: 4px solid var(--success);
    color: #166534;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.error-box {
    padding: 16px 20px;
    border-radius: 8px;
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    color: #991b1b;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.error-box p { margin: 0 0 6px; }
.error-box p:last-child { margin-bottom: 0; }

.invitation-card { max-width: 560px; }

.invitation-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 18px 0 20px;
}

.invitation-steps span {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--muted);
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 850;
    text-align: center;
}

.invitation-steps .is-active {
    border-color: var(--brand);
    background: #ecfdf5;
    color: var(--brand-dark);
}

.invitation-steps .is-done {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--line);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .pricing-grid, .public-pricing-grid { grid-template-columns: 1fr; }
    .onboarding-checklist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .billing-summary { align-items: flex-start; flex-direction: column; }
    .trial-callout,
    .trial-banner,
    .trial-conversion { align-items: flex-start; flex-direction: column; }
    .usage-grid { grid-template-columns: 1fr; width: 100%; }
    .faq-list { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; }
    .workspace { padding: 16px; }
    .filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .smart-form {
        grid-template-columns: 1fr;
    }
    .smart-form > div {
        width: 100%;
    }
    .planning-event {
        grid-template-columns: 1fr;
    }
    .planning-dropzones {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .planning-actions {
        justify-content: flex-start;
    }
    .team-invite-form {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body { font-size: 12.5px; }
    .hero-copy h1 { font-size: 38px; }
    .topbar { padding: 12px; }
    .document-paper { padding: 14px; }
    .filter-grid {
        grid-template-columns: 1fr;
    }
    .onboarding-checklist {
        grid-template-columns: 1fr;
    }
    .filter-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .smart-form {
        grid-template-columns: 1fr;
    }
    .smart-form .actions {
        flex-direction: column;
    }
}

/* Final UI consistency pass */
.form-panel,
.panel form,
.smart-form,
.stack-form {
    --field-height: 38px;
}

.form-panel input,
.form-panel select,
.form-panel textarea,
.panel form input,
.panel form select,
.panel form textarea,
.smart-form input,
.smart-form select,
.smart-form textarea,
.stack-form input,
.stack-form select,
.stack-form textarea {
    min-height: var(--field-height);
    margin-bottom: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
}

.form-panel textarea,
.panel form textarea,
.smart-form textarea,
.stack-form textarea {
    min-height: 96px;
    resize: vertical;
}

.form-panel input:focus,
.form-panel select:focus,
.form-panel textarea:focus,
.panel form input:focus,
.panel form select:focus,
.panel form textarea:focus,
.smart-form input:focus,
.smart-form select:focus,
.smart-form textarea:focus,
.stack-form input:focus,
.stack-form select:focus,
.stack-form textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    max-width: 100%;
    min-height: 22px;
    white-space: nowrap;
    border: 1px solid transparent;
    border-radius: 999px;
    line-height: 1;
}

.badge.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

.badge.warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #c2410c;
}

.badge.info {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1d4ed8;
}

.pdp-status-delivered,
.pdp-status-sent {
    background: #f0fdf4;
    color: #166534;
}

.pdp-status-pending {
    background: #eff6ff;
    color: #1d4ed8;
}

.pdp-status-rejected,
.pdp-status-failed,
.pdp-status-cancelled {
    background: #fef2f2;
    color: #b91c1c;
}

.alert {
    margin: 14px 0;
    padding: 12px 14px;
    border: 1px solid #dbe3ef;
    border-radius: 8px;
    background: #f8fafc;
    color: #1f2937;
    line-height: 1.45;
}

.alert.warning {
    border-color: #fed7aa;
    background: #fff7ed;
    color: #9a3412;
}

.alert.error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.flash {
    max-width: min(440px, calc(100vw - 32px));
    min-width: min(300px, calc(100vw - 32px));
    border: 1px solid rgba(255, 255, 255, .18);
    line-height: 1.35;
}

.flash > * {
    min-width: 0;
}

.flash-warning,
.flash-info {
    color: #fff;
}

@media (max-width: 980px) {
    .wizard-line-entry-bar {
        grid-template-columns: 1fr;
    }

    .wizard-line-entry-actions,
    .wizard-line-entry-actions .btn,
    .wizard-bottom-actions,
    .wizard-bottom-actions .btn {
        width: 100%;
    }

    .actions,
    .inline-actions,
    .card-actions,
    .planning-export-buttons {
        gap: 8px;
    }

    .actions .btn,
    .actions button,
    .filter-actions .btn,
    .filter-actions button {
        flex: 1 1 180px;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 720px;
    }
}

@media (max-width: 640px) {
    .workspace {
        padding: 12px;
    }

    .panel {
        padding: 14px;
    }

    .topbar {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column;
    }

    .account {
        width: 100%;
        gap: 8px;
    }

    .actions,
    .card-actions,
    .filter-actions,
    .planning-export-buttons {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .actions .btn,
    .actions button,
    .card-actions .btn,
    .card-actions button,
    .filter-actions .btn,
    .filter-actions button,
    .planning-export-buttons .btn {
        /* width: 100%; */
        flex: 0 0 auto;
    }

    .flash {
        top: 12px;
        right: 12px;
        left: 12px;
        min-width: 0;
        max-width: none;
    }

    .document-meta,
    .document-totals {
        grid-template-columns: 1fr;
    }
}

#profile_form div{
    margin-bottom: 18px;
}

.smart-form .actions {
    /* justify-content: flex-end; */
    border: none;
}
.panel .invoice-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}
.panel .invoice-filters input,
.panel .invoice-filters select {
    width: 100%;
}

.filter-grid{
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}


@media (max-width: 640px) {
    .actions, .card-actions {
        width: 100%;
        display: flex;
        flex-direction: row;
    }
}

.form-group label {
    font-size: 11px;
}

#payment_form input, 
#payment_form select,
#payment_form textarea {
    width: 100%;
    max-width: 600px;
}

.smart-form .actions {
    justify-content: flex-start;
}

div:has(> input[type="checkbox"]) {
    display: flex;
    align-items: start;
    gap: 8px;
}

div:has(> input[type="checkbox"]) input {
    height: unset;
    width: unset;
}

div:has(> input[type="checkbox"]) label{
    margin-bottom: 0;
}

div:has(> input),
div:has(> select),
div:has(> textarea) {
    margin-bottom: 18px;
}

/* Warm modern Facivo refresh */
:root {
    --bs-font-sans-serif: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    --bg: #f7f4ee;
    --surface: #ffffff;
    --surface-soft: #fffaf1;
    --ink: #1f2933;
    --muted: #697586;
    --line: #eadfce;
    --brand: #1d766f;
    --brand-light: #2fb7a8;
    --brand-dark: #13534e;
    --accent: #d9822b;
    --success: #19a974;
    --info: #5472d3;
    --shadow-sm: 0 8px 24px rgba(50, 41, 29, .06);
    --shadow: 0 18px 55px rgba(50, 41, 29, .10);
    --shadow-lg: 0 28px 90px rgba(31, 41, 51, .16);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(47, 183, 168, .14), transparent 34rem),
        radial-gradient(circle at 88% 8%, rgba(217, 130, 43, .12), transparent 28rem),
        linear-gradient(180deg, #fbf7ef 0%, #f6f4ee 42%, #f8faf7 100%);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
}

h1,
.hero-copy h1,
.page-hero h1 {
    color: #17201d;
}

.hero-copy h1,
.page-hero h1 {
    font-family: "Playfair Display", Georgia, serif;
    font-weight: 800;
}

a {
    color: var(--brand);
}

a:hover {
    color: var(--brand-dark);
}

input,
select,
textarea,
.form-control,
.form-select {
    border-color: #e4d8c5;
    border-radius: 10px;
    background: rgba(255, 255, 255, .92);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
    border-color: rgba(29, 118, 111, .65);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(47, 183, 168, .13);
}

button,
.btn {
    border-radius: 999px;
    background: linear-gradient(135deg, var(--brand), #279488);
    box-shadow: 0 12px 28px rgba(29, 118, 111, .22);
    letter-spacing: 0;
}

button:hover,
.btn:hover {
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
    box-shadow: 0 16px 34px rgba(29, 118, 111, .27);
}

.btn.ghost,
.btn-outline-secondary {
    border-color: rgba(29, 118, 111, .18);
    background: rgba(255, 255, 255, .78);
    color: var(--brand-dark);
    box-shadow: 0 10px 24px rgba(50, 41, 29, .06);
}

.btn.ghost:hover,
.btn-outline-secondary:hover {
    border-color: rgba(29, 118, 111, .38);
    background: #fffaf1;
    color: var(--brand-dark);
}

.eyebrow {
    color: #a06124;
    letter-spacing: .14em;
}

.public {
    background:
        linear-gradient(115deg, rgba(255, 250, 241, .94), rgba(241, 249, 245, .78)),
        url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=2200&q=82") center/cover fixed;
}

.public-navbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 250, 241, .82);
    border-bottom: 1px solid rgba(234, 223, 206, .7);
    backdrop-filter: blur(18px);
}

.public-navbar .container {
    min-height: 76px;
}

.public-brand img,
.brand img {
    object-fit: contain;
    filter: drop-shadow(0 8px 14px rgba(31, 41, 51, .09));
}

.public-navbar .nav-link {
    color: #48584f;
    font-weight: 750;
}

.public-navbar .nav-link:hover {
    color: var(--brand-dark);
}

.hero {
    min-height: calc(100vh - 96px);
    grid-template-columns: minmax(0, 1fr) minmax(330px, 500px);
}

.hero-copy {
    position: relative;
    max-width: 780px;
}

.hero-copy h1 {
    margin-bottom: 20px;
    font-size: clamp(68px, 12vw, 132px);
    line-height: .86;
}

.hero-copy h1::after {
    content: "";
    display: block;
    width: min(240px, 46vw);
    height: 10px;
    margin-top: 18px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-light), #f2b15f);
}

.hero-copy p:not(.eyebrow) {
    max-width: 680px;
    color: #34423d;
    font-size: clamp(17px, 1.8vw, 21px);
}

.hero-trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.hero-trust-row span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid rgba(29, 118, 111, .16);
    border-radius: 999px;
    background: rgba(255, 255, 255, .72);
    color: #405047;
    padding: 8px 13px;
    font-weight: 760;
    box-shadow: var(--shadow-sm);
}

.hero-trust-row i {
    color: var(--brand);
}

.hero-panel {
    overflow: hidden;
    border-color: rgba(255, 255, 255, .82);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 28px 80px rgba(50, 41, 29, .18);
}

.hero-product-shot > img {
    width: calc(100% + 44px);
    height: 188px;
    margin: -22px -22px 20px;
    object-fit: cover;
    display: block;
}

.mini-bars span,
.chart span {
    background: linear-gradient(180deg, #2fb7a8, #f0a14a);
}

.invoice-preview {
    border-color: #eadfce;
    background: rgba(255, 255, 255, .88);
}

.section-band,
.workflow-section,
.page-hero,
.legal-content,
.cta-section,
.panel,
.stats-grid article,
.auth-card,
.wizard-card,
.form-panel,
.settings-panel,
.document-paper,
.public-pricing-card,
.faq-list article {
    border-color: rgba(234, 223, 206, .9);
    background: rgba(255, 255, 255, .86);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.feature-grid article,
.service-grid article,
.capability-grid article,
.workflow-list li,
.summary-grid article,
.info-card,
.wizard-steps span,
.onboarding-checklist a {
    border-color: rgba(234, 223, 206, .9);
    background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 250, 241, .82));
}

.feature-grid article,
.service-grid article,
.capability-grid article,
.panel,
.stats-grid article,
.auth-card {
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.feature-grid article:hover,
.service-grid article:hover,
.capability-grid article:hover,
.panel:hover,
.stats-grid article:hover {
    border-color: rgba(47, 183, 168, .28);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.feature-kicker,
.workflow-list li::before {
    color: var(--accent);
}

.split-section {
    border: 1px solid rgba(255, 255, 255, .16);
    background:
        linear-gradient(135deg, rgba(19, 83, 78, .94), rgba(31, 41, 51, .94)),
        url("https://images.unsplash.com/photo-1551836022-d5d88e9218df?auto=format&fit=crop&w=1400&q=80") center/cover;
    box-shadow: var(--shadow);
}

.cta-section {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(255, 245, 230, .86)),
        url("https://images.unsplash.com/photo-1556761175-b413da4baf72?auto=format&fit=crop&w=1600&q=78") center/cover;
}

.app-shell {
    background:
        linear-gradient(180deg, rgba(255, 250, 241, .82), rgba(247, 250, 247, .92)),
        url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=2200&q=78") center/cover fixed;
}

.sidebar {
    border-right: 1px solid rgba(234, 223, 206, .72);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .91), rgba(250, 244, 234, .88)),
        url("https://images.unsplash.com/photo-1524758631624-e2822e304c36?auto=format&fit=crop&w=900&q=74") center/cover;
    color: var(--ink);
    box-shadow: 18px 0 60px rgba(50, 41, 29, .08);
    backdrop-filter: blur(18px);
}

.brand {
    color: var(--brand-dark);
}

.brand span {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 24px;
    font-weight: 800;
}

.sidebar nav a {
    color: #43544d;
}

.sidebar nav a i {
    color: var(--brand);
}

.sidebar nav a:hover {
    background: rgba(29, 118, 111, .10);
    color: var(--brand-dark);
}

.sidebar nav a:hover i {
    color: var(--brand-dark);
}

.sidebar-card {
    border-color: rgba(29, 118, 111, .17);
    background: rgba(255, 255, 255, .78);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.sidebar-upgrade {
    color: #a06124;
}

.workspace {
    background: rgba(255, 255, 255, .18);
}

.topbar {
    border-color: rgba(234, 223, 206, .85);
    background: rgba(255, 255, 255, .80);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(18px);
}

.topbar h1 {
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 850;
}

.top-search input {
    background: rgba(255, 250, 241, .86);
}

.account-menu-toggle,
.row-menu-toggle {
    border-color: rgba(234, 223, 206, .96);
    background: rgba(255, 255, 255, .78);
}

.account-menu-toggle:hover,
.row-menu-toggle:hover {
    border-color: rgba(29, 118, 111, .35);
    background: #fffaf1;
    color: var(--brand-dark);
}

.account-avatar,
.brand-mark,
.stat-icon {
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
}

.stat-icon {
    color: #fff;
}

.stat-alert {
    background: #fff8f3 !important;
}

.stat-alert .stat-icon {
    background: linear-gradient(135deg, #e15b4f, #f2a154);
    color: #fff;
}

th {
    color: #7c6f60;
}

tbody tr:hover {
    background: #fffaf1;
}

.badge {
    background: #e9f7f2;
    color: var(--brand-dark);
}

.badge.danger,
.btn-small.danger {
    background: #fff1ec;
    color: #c2410c;
}

.tabs {
    border-color: rgba(234, 223, 206, .95);
    background: rgba(255, 250, 241, .8);
}

.tabs a.active {
    background: #fff;
    color: var(--brand-dark);
}

.onboarding-panel {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(238, 250, 246, .82)),
        url("https://images.unsplash.com/photo-1552664730-d307ca884978?auto=format&fit=crop&w=1400&q=78") center/cover;
}

.onboarding-checklist a.is-done,
.wizard-steps .active,
.wizard-lines-list a.active,
.invitation-steps .is-active {
    border-color: rgba(29, 118, 111, .30);
    background: #eaf8f4;
    color: var(--brand-dark);
}

.trial-banner,
.trial-conversion {
    border-color: rgba(29, 118, 111, .22);
    background: linear-gradient(135deg, #eaf8f4, #fffaf1);
}

.auth-card {
    position: relative;
    overflow: hidden;
    width: min(540px, calc(100vw - 32px));
    margin-top: 7vh;
    border-radius: 18px;
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 126px;
    background:
        linear-gradient(135deg, rgba(29, 118, 111, .80), rgba(217, 130, 43, .42)),
        url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1100&q=78") center/cover;
    pointer-events: none;
}

.auth-card > * {
    position: relative;
    z-index: 1;
}

.auth-card h1 {
    margin-top: 92px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(34px, 5vw, 48px);
}

.auth-card .auth-subtitle {
    color: #526258;
}

.auth-links a,
.info-box,
.success-box,
.error-box {
    border-radius: 12px;
}

.info-box {
    border-left: 0;
    background: #eef7ff;
    color: #244b75;
}

.document-paper {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 252, 247, .94)),
        repeating-linear-gradient(0deg, rgba(234, 223, 206, .22), rgba(234, 223, 206, .22) 1px, transparent 1px, transparent 28px);
}

.totals-card {
    background: linear-gradient(135deg, #173b37, #1f2933);
}

.public-footer {
    border-top: 1px solid rgba(234, 223, 206, .9);
}

.bg-white:has(.public-footer) {
    background: rgba(255, 250, 241, .86) !important;
}

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-panel {
        max-width: 640px;
    }

    .sidebar.show {
        background:
            linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(250, 244, 234, .95)),
            url("https://images.unsplash.com/photo-1524758631624-e2822e304c36?auto=format&fit=crop&w=900&q=74") center/cover;
    }
}

@media (max-width: 640px) {
    .public-navbar .container {
        min-height: 64px;
    }

    .hero-copy h1 {
        font-size: clamp(56px, 18vw, 78px);
    }

    .hero-product-shot > img {
        height: 150px;
    }

    .auth-card h1 {
        margin-top: 82px;
    }
}

/* Facivo public polish v2 */
.public {
    overflow: hidden;
    background:
        radial-gradient(circle at 8% 4%, rgba(20, 184, 166, .16), transparent 24rem),
        radial-gradient(circle at 86% 10%, rgba(245, 158, 11, .13), transparent 26rem),
        linear-gradient(135deg, #f8fbfa 0%, #f7f4ee 52%, #eef8f6 100%);
}

.public::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(15, 118, 110, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 118, 110, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, .45), transparent 75%);
    pointer-events: none;
}

.public-navbar {
    background: rgba(248, 251, 250, .78);
}

.public-navbar .container {
    max-width: 1200px;
}

.public-navbar .btn {
    min-height: 38px;
    padding: 8px 16px;
}

.hero.container {
    max-width: 1200px;
}

.hero {
    min-height: calc(100vh - 92px);
    grid-template-columns: minmax(0, .92fr) minmax(420px, 520px);
    gap: clamp(48px, 7vw, 96px);
    padding-top: clamp(54px, 8vh, 96px);
    padding-bottom: clamp(44px, 7vh, 84px);
}

.hero-copy {
    align-self: center;
}

.hero-copy h1 {
    margin-bottom: 18px;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: clamp(64px, 9vw, 118px);
    font-weight: 900;
    line-height: .88;
    letter-spacing: 0;
}

.hero-copy h1::after {
    width: 168px;
    height: 7px;
    margin-top: 18px;
    background: linear-gradient(90deg, #0f766e, #14b8a6, #f59e0b);
}

.hero-copy .eyebrow {
    margin-bottom: 14px;
    color: #0f766e;
}

.hero-copy p:not(.eyebrow) {
    max-width: 620px;
    color: #3e4c46;
    font-size: clamp(16px, 1.55vw, 19px);
    line-height: 1.72;
}

.hero-actions {
    margin-top: 30px;
}

.hero-actions .btn {
    min-height: 46px;
    padding: 12px 20px !important;
    font-size: 14px;
}

.hero-trust-row {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.hero-trust-row span {
    min-height: 34px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .78);
    padding: 7px 12px;
    color: #43544d;
    font-size: 13px;
    box-shadow: 0 8px 24px rgba(31, 41, 51, .06);
}

.hero-product {
    position: relative;
    align-self: center;
    min-height: 620px;
}

.hero-product::before {
    content: "";
    position: absolute;
    inset: 60px 20px auto auto;
    width: 72%;
    height: 78%;
    border-radius: 36px;
    background: linear-gradient(135deg, rgba(15, 118, 110, .18), rgba(245, 158, 11, .13));
    transform: rotate(4deg);
}

.hero-product-media {
    position: absolute;
    top: 16px;
    right: 0;
    left: 70px;
    height: 370px;
    overflow: hidden;
    border: 10px solid rgba(255, 255, 255, .86);
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 28px 90px rgba(31, 41, 51, .20);
}

.hero-product-media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.hero-dashboard-card {
    position: absolute;
    right: 62px;
    bottom: 10px;
    width: min(420px, calc(100vw - 56px));
    border: 1px solid rgba(234, 223, 206, .94);
    border-radius: 24px;
    background: rgba(255, 255, 255, .92);
    padding: 22px;
    box-shadow: 0 28px 90px rgba(31, 41, 51, .18);
    backdrop-filter: blur(18px);
}

.hero-dashboard-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.hero-dashboard-top span {
    color: #6b7a72;
    font-weight: 800;
}

.hero-dashboard-top strong {
    color: #17201d;
    font-size: 28px;
    line-height: 1;
}

.hero-dashboard-chart {
    display: flex;
    align-items: end;
    gap: 12px;
    height: 154px;
    margin-bottom: 20px;
}

.hero-dashboard-chart span {
    flex: 1;
    min-width: 34px;
    border-radius: 14px 14px 5px 5px;
    background: linear-gradient(180deg, #14b8a6, #0f766e);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}

.hero-document-list {
    display: grid;
    gap: 10px;
}

.hero-document-list p {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-height: 46px;
    margin: 0;
    border: 1px solid #edf0e8;
    border-radius: 14px;
    background: #fbfbf8;
    padding: 10px 12px;
}

.hero-document-list i {
    color: #0f766e;
}

.hero-document-list p:nth-child(2) i {
    color: #d9822b;
}

.hero-document-list strong {
    min-width: 0;
    overflow: hidden;
    color: #1f2933;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-document-list span {
    color: #64746c;
    font-size: 12px;
    font-weight: 850;
}

@media (max-width: 980px) {
    .hero {
        grid-template-columns: 1fr;
    }

    .hero-product {
        min-height: 560px;
    }

    .hero-product-media {
        left: 0;
    }

    .hero-dashboard-card {
        right: 24px;
    }
}

@media (max-width: 640px) {
    .hero {
        gap: 32px;
        padding-top: 34px;
    }

    .hero-copy h1 {
        font-size: clamp(52px, 19vw, 74px);
    }

    .hero-trust-row {
        align-items: stretch;
        flex-direction: column;
    }

    .hero-product {
        min-height: 500px;
    }

    .hero-product-media {
        height: 280px;
        border-width: 7px;
        border-radius: 22px;
    }

    .hero-dashboard-card {
        right: 0;
        bottom: 0;
        padding: 16px;
        border-radius: 20px;
    }

    .hero-dashboard-chart {
        height: 118px;
    }
}

/* Facivo public polish v3: original clean SaaS direction */
:root {
    --brand-blue: #155dfc;
    --brand-blue-dark: #0f3fb3;
    --brand-cyan: #12b7c8;
    --brand-ink: #071a3d;
    --brand-soft: #f3f7ff;
}

.public {
    background: #ffffff;
}

.public::before {
    display: none;
}

.public-navbar {
    border-bottom: 1px solid #e7edf7;
    background: rgba(255, 255, 255, .88);
    box-shadow: 0 8px 24px rgba(7, 26, 61, .04);
}

.public-navbar .container {
    max-width: 1180px;
    min-height: 68px;
}

.public-navbar .nav-link {
    color: #445168;
    font-size: 13px;
    font-weight: 700;
}

.public-navbar .nav-link:hover {
    color: var(--brand-blue);
}

.public-navbar .btn,
.hero-actions .btn,
.cta-section .btn {
    background: var(--brand-blue);
    border-radius: 999px;
    box-shadow: 0 10px 24px rgba(21, 93, 252, .18);
}

.public-navbar .btn:hover,
.hero-actions .btn:hover,
.cta-section .btn:hover {
    background: var(--brand-blue-dark);
}

.public-navbar .btn.ghost,
.hero-actions .btn.ghost {
    border: 1px solid #dbe6f7;
    background: #fff;
    color: var(--brand-ink);
    box-shadow: none;
}

.hero.container,
.feature-grid,
.section-band,
.split-section,
.workflow-section,
.cta-section,
.page-hero,
.legal-content,
.public-footer {
    max-width: 1180px;
}

.hero {
    min-height: 720px;
    grid-template-columns: minmax(360px, .76fr) minmax(520px, 1.24fr);
    gap: clamp(34px, 5vw, 80px);
    padding: 72px 20px 56px;
}

.hero-copy h1 {
    max-width: 520px;
    color: var(--brand-ink);
    font-size: clamp(46px, 5.7vw, 78px);
    font-weight: 900;
    line-height: .98;
}

.hero-copy h1::after {
    display: none;
}

.hero-copy .eyebrow {
    color: var(--brand-blue);
}

.hero-copy p:not(.eyebrow) {
    max-width: 520px;
    color: #344260;
    font-size: 16px;
    line-height: 1.7;
}

.hero-actions {
    gap: 12px;
    margin-top: 26px;
}

.hero-actions .btn {
    min-height: 42px;
    padding: 10px 18px !important;
    font-size: 13px;
}

.hero-trust-row {
    gap: 10px;
    margin-top: 18px;
}

.hero-trust-row span {
    border: 0;
    background: transparent;
    box-shadow: none;
    color: #485877;
    padding: 0;
    font-size: 12px;
}

.hero-trust-row i {
    color: var(--brand-blue);
}

.facivo-mockup {
    position: relative;
    min-height: 560px;
}

.facivo-mockup::before,
.facivo-mockup::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(4px);
}

.facivo-mockup::before {
    top: 24px;
    right: 26px;
    width: 420px;
    height: 420px;
    background: rgba(18, 183, 200, .11);
}

.facivo-mockup::after {
    right: 140px;
    bottom: 20px;
    width: 280px;
    height: 280px;
    background: rgba(21, 93, 252, .10);
}

.mockup-desktop {
    position: absolute;
    top: 32px;
    right: 0;
    left: 68px;
    z-index: 2;
    overflow: hidden;
    border: 1px solid #dce6f5;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 34px 80px rgba(7, 26, 61, .18);
}

.mockup-browser {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    border-bottom: 1px solid #edf2fa;
    background: #fbfdff;
    padding: 0 13px;
}

.mockup-browser span {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #d7dfec;
}

.mockup-browser span:first-child {
    background: #ff6b6b;
}

.mockup-browser span:nth-child(2) {
    background: #f5b942;
}

.mockup-browser span:nth-child(3) {
    background: #27c08a;
}

.mockup-browser strong {
    margin-left: auto;
    color: #71809a;
    font-size: 11px;
}

.mockup-app {
    display: grid;
    grid-template-columns: 138px minmax(0, 1fr);
    min-height: 390px;
}

.mockup-side {
    display: grid;
    align-content: start;
    gap: 12px;
    background: #081936;
    padding: 22px 18px;
}

.mockup-side strong {
    color: #fff;
    font-weight: 900;
}

.mockup-side span {
    height: 28px;
    border-radius: 9px;
    background: rgba(255, 255, 255, .10);
}

.mockup-side span:nth-child(2) {
    background: var(--brand-blue);
}

.mockup-main {
    display: grid;
    gap: 18px;
    align-content: start;
    background: linear-gradient(180deg, #fbfdff, #f2f6fd);
    padding: 22px;
}

.mockup-head {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: start;
}

.mockup-head span,
.mockup-kpis span {
    display: block;
    color: #667795;
    font-size: 12px;
    font-weight: 800;
}

.mockup-head strong {
    display: block;
    margin-top: 5px;
    color: var(--brand-ink);
    font-size: 32px;
    line-height: 1;
}

.mockup-head em,
.mockup-table i {
    border-radius: 999px;
    background: #dcfce7;
    color: #15803d;
    padding: 5px 10px;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}

.mockup-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.mockup-kpis span {
    border: 1px solid #e5edf8;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
}

.mockup-kpis strong {
    display: block;
    color: var(--brand-blue);
    font-size: 22px;
}

.mockup-table {
    display: grid;
    overflow: hidden;
    border: 1px solid #e5edf8;
    border-radius: 14px;
    background: #fff;
}

.mockup-table p {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) 90px 76px;
    gap: 10px;
    align-items: center;
    margin: 0;
    border-bottom: 1px solid #edf2fa;
    padding: 13px 14px;
    color: #26344f;
    font-size: 12px;
}

.mockup-table p:last-child {
    border-bottom: 0;
}

.mockup-table span {
    color: #71809a;
    font-weight: 800;
}

.mockup-table strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mockup-table em {
    font-style: normal;
    font-weight: 900;
}

.mockup-table p:nth-child(2) i {
    background: #fff7ed;
    color: #c2410c;
}

.mockup-table p:nth-child(3) i {
    background: #eef4ff;
    color: var(--brand-blue);
}

.mockup-phone {
    position: absolute;
    top: 122px;
    left: 0;
    z-index: 3;
    width: 172px;
    border: 9px solid #071a3d;
    border-radius: 28px;
    background: #fff;
    padding: 22px 13px 16px;
    box-shadow: 0 28px 60px rgba(7, 26, 61, .20);
}

.mockup-phone::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 54px;
    height: 5px;
    border-radius: 999px;
    background: #1d2b47;
    transform: translateX(-50%);
}

.mockup-phone span {
    display: block;
    margin-bottom: 14px;
    color: #667795;
    font-size: 11px;
    font-weight: 900;
    text-align: center;
}

.mockup-phone button {
    justify-content: flex-start;
    width: 100%;
    min-height: 34px;
    margin-bottom: 9px;
    border-radius: 10px;
    background: #edf4ff;
    color: var(--brand-blue);
    padding: 8px 10px;
    box-shadow: none;
    font-size: 12px;
}

.mockup-phone button:first-of-type {
    background: var(--brand-blue);
    color: #fff;
}

.mockup-badges {
    position: absolute;
    right: 70px;
    bottom: 34px;
    z-index: 4;
    display: flex;
    gap: 10px;
}

.mockup-badges span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    border: 1px solid #dce6f5;
    border-radius: 12px;
    background: #fff;
    color: var(--brand-ink);
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 18px 36px rgba(7, 26, 61, .12);
}

.mockup-badges i {
    color: var(--brand-blue);
}

.feature-grid {
    gap: 16px;
    padding: 22px 20px 64px;
}

.feature-grid article {
    border: 1px solid #dce6f5;
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #f7faff);
    box-shadow: none;
}

.feature-grid article:hover {
    border-color: rgba(21, 93, 252, .30);
    box-shadow: 0 18px 42px rgba(7, 26, 61, .08);
}

.feature-kicker {
    color: var(--brand-blue);
}

.section-band,
.workflow-section,
.page-hero,
.legal-content,
.cta-section {
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.section-band {
    padding-top: 72px;
    padding-bottom: 42px;
}

.section-heading {
    margin-inline: auto;
    text-align: center;
}

.section-heading h2 {
    color: var(--brand-ink);
    font-size: clamp(30px, 4vw, 48px);
    font-weight: 900;
}

.service-grid article,
.capability-grid article,
.faq-list article {
    border: 1px solid #dce6f5;
    border-radius: 14px;
    background: #fff;
    box-shadow: none;
}

.service-grid article:nth-child(2),
.capability-grid article:nth-child(2) {
    background: linear-gradient(135deg, #f7fbff, #eef5ff);
}

.split-section {
    border: 0;
    border-radius: 18px;
    background: #081936;
}

.cta-section {
    border-radius: 18px;
    background: linear-gradient(135deg, #eef5ff, #f8fbff);
}

@media (max-width: 980px) {
    .hero {
        min-height: auto;
        grid-template-columns: 1fr;
    }

    .facivo-mockup {
        min-height: 570px;
    }

    .mockup-desktop {
        left: 62px;
    }
}

@media (max-width: 640px) {
    .hero {
        padding-top: 34px;
    }

    .facivo-mockup {
        min-height: 620px;
    }

    .mockup-desktop {
        right: -180px;
        left: 38px;
    }

    .mockup-app {
        grid-template-columns: 92px minmax(0, 1fr);
    }

    .mockup-main {
        padding: 16px;
    }

    .mockup-kpis {
        grid-template-columns: 1fr;
    }

    .mockup-table p {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .mockup-table em,
    .mockup-table i {
        display: none;
    }

    .mockup-phone {
        top: 248px;
        width: 160px;
    }

    .mockup-badges {
        right: auto;
        bottom: 12px;
        left: 0;
        flex-direction: column;
    }
}

/* Mobile hero refinement */
@media (max-width: 640px) {
    .public-navbar {
        position: sticky;
    }

    .public-navbar .container {
        padding-right: 18px;
        padding-left: 18px;
    }

    .navbar-toggler {
        border: 0;
        border-radius: 10px;
        background: var(--brand-blue);
        padding: 10px 12px;
        box-shadow: 0 12px 28px rgba(21, 93, 252, .18);
    }

    .navbar-toggler:focus {
        box-shadow: 0 0 0 4px rgba(21, 93, 252, .14);
    }

    .navbar-toggler-icon {
        filter: brightness(0) invert(1);
    }

    .hero {
        padding-bottom: 26px;
    }

    .hero-copy {
        max-width: 100%;
    }

    .hero-copy p:not(.eyebrow) {
        max-width: 100%;
    }

    .hero-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
        min-width: 0;
        padding-right: 12px !important;
        padding-left: 12px !important;
        white-space: nowrap;
    }

    .facivo-mockup {
        min-height: 0;
        padding-top: 34px;
        padding-bottom: 0;
    }

    .facivo-mockup::before {
        top: 20px;
        right: auto;
        left: -28px;
        width: 260px;
        height: 260px;
    }

    .facivo-mockup::after {
        display: none;
    }

    .mockup-desktop {
        position: relative;
        inset: auto;
        width: 100%;
        border-radius: 18px;
        box-shadow: 0 22px 54px rgba(7, 26, 61, .16);
    }

    .mockup-app {
        grid-template-columns: 86px minmax(0, 1fr);
        min-height: 310px;
    }

    .mockup-side {
        gap: 10px;
        padding: 18px 12px;
    }

    .mockup-side strong {
        font-size: 12px;
    }

    .mockup-side span {
        height: 24px;
        border-radius: 8px;
    }

    .mockup-main {
        gap: 12px;
        padding: 16px 14px;
    }

    .mockup-head {
        display: block;
    }

    .mockup-head strong {
        font-size: 25px;
    }

    .mockup-head em {
        display: inline-flex;
        margin-top: 10px;
    }

    .mockup-kpis {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
    }

    .mockup-kpis span {
        min-width: 0;
        padding: 10px 8px;
        font-size: 10px;
    }

    .mockup-kpis strong {
        font-size: 18px;
    }

    .mockup-table {
        display: none;
    }

    .mockup-phone {
        position: absolute;
        top: auto;
        right: 16px;
        bottom: 54px;
        left: auto;
        width: 142px;
        border-width: 7px;
        border-radius: 24px;
        padding: 20px 10px 12px;
    }

    .mockup-phone button {
        min-height: 31px;
        margin-bottom: 7px;
        padding: 7px 9px;
        font-size: 11px;
    }

    .mockup-badges {
        position: relative;
        right: auto;
        bottom: auto;
        left: auto;
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 12px;
    }

    .mockup-badges span {
        min-height: 38px;
        justify-content: center;
        border-radius: 999px;
        padding: 8px 12px;
        box-shadow: 0 12px 28px rgba(7, 26, 61, .08);
    }
}

/* Public page centering pass */
.public > .hero,
.public > .feature-grid,
.public > .section-band,
.public > .split-section,
.public > .workflow-section,
.public > .cta-section,
.public > .page-hero,
.public > .legal-content,
.public .public-footer {
    width: min(1180px, calc(100% - 40px));
    margin-right: auto;
    margin-left: auto;
}

.public > .feature-grid {
    padding-right: 0;
    padding-left: 0;
}

.public > .section-band,
.public > .workflow-section,
.public > .page-hero,
.public > .legal-content {
    padding-right: 0;
    padding-left: 0;
}

.public .service-grid,
.public .capability-grid,
.public .workflow-list,
.public .faq-list {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
}

.public .section-heading {
    max-width: 900px;
    margin-right: auto;
    margin-left: auto;
}

.public .section-heading p:not(.eyebrow) {
    max-width: 820px;
    margin-right: auto;
    margin-left: auto;
}

.public > .split-section,
.public > .cta-section {
    padding-right: clamp(24px, 5vw, 54px);
    padding-left: clamp(24px, 5vw, 54px);
}

@media (max-width: 640px) {
    .public > .hero,
    .public > .feature-grid,
    .public > .section-band,
    .public > .split-section,
    .public > .workflow-section,
    .public > .cta-section,
    .public > .page-hero,
    .public > .legal-content,
    .public .public-footer {
        width: min(100% - 32px, 1180px);
    }
}

/* Subtle French red accents */
:root {
    --brand-red: #e23b4a;
    --brand-red-dark: #bd1f32;
    --brand-red-soft: #fff1f3;
}

.hero-copy h1::after {
    display: block;
    width: 112px;
    height: 5px;
    margin-top: 18px;
    border-radius: 999px;
    background: var(--brand-red);
    box-shadow: 0 10px 24px rgba(226, 59, 74, .16);
}

.hero-trust-row span:nth-child(3) i,
.mockup-badges span:nth-child(2) i {
    color: var(--brand-red);
}

.mockup-browser span:first-child {
    background: var(--brand-red);
}

.mockup-table p:nth-child(2) {
    box-shadow: inset 3px 0 0 var(--brand-red);
}

.mockup-table p:nth-child(2) i {
    background: var(--brand-red-soft);
    color: var(--brand-red-dark);
}

.feature-grid article:nth-child(3),
.service-grid article:nth-child(3),
.capability-grid article:nth-child(3) {
    border-color: rgba(226, 59, 74, .22);
}

.feature-grid article:nth-child(3) {
    background: linear-gradient(180deg, #fff, var(--brand-red-soft));
}

.feature-grid article:nth-child(3) .feature-kicker,
.service-grid article:nth-child(3) strong,
.capability-grid article:nth-child(3) .feature-kicker {
    color: var(--brand-red);
}

.feature-grid article:nth-child(2) .feature-kicker,
.service-grid article:nth-child(5) strong,
.capability-grid article:nth-child(2) .feature-kicker {
    color: var(--brand-red);
}

.section-heading h2 strong,
.section-heading h2 em {
    color: var(--brand-red);
    font-style: normal;
}

.navbar-toggler {
    background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
}

.mockup-phone {
    box-shadow:
        -10px 18px 44px rgba(21, 93, 252, .18),
        10px 18px 44px rgba(226, 59, 74, .10);
}

/* Guided document creation */
.document-onboarding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.setup-card,
.empty-catalog-callout,
.catalog-product-preview {
    border: 1px solid #dbe6f7;
    border-radius: 16px;
    background: linear-gradient(135deg, #ffffff, #f7fbff);
    box-shadow: 0 16px 36px rgba(7, 26, 61, .07);
}

.setup-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 18px;
}

.setup-card > span {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #eef4ff;
    color: #155dfc;
    font-size: 19px;
}

.setup-card.is-required {
    border-color: rgba(226, 59, 74, .24);
}

.setup-card.is-required > span {
    background: #fff1f3;
    color: #e23b4a;
}

.setup-card h3,
.setup-card p {
    margin-bottom: 4px;
}

.setup-card p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.empty-catalog-callout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 14px;
    padding: 16px;
}

.empty-catalog-callout > i {
    color: #e23b4a;
    font-size: 24px;
}

.empty-catalog-callout strong,
.empty-catalog-callout span {
    display: block;
}

.empty-catalog-callout span {
    color: var(--muted);
}

.catalog-line-name,
.catalog-line-description,
.catalog-line-description + *,
[data-catalog-line-unit],
[data-catalog-line-vat] {
    display: block;
}

.catalog-line-name {
    color: var(--brand-ink, #071a3d);
    font-weight: 850;
}

.catalog-line-description,
[data-catalog-line-unit],
[data-catalog-line-vat] {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.catalog-wizard-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr);
    gap: 16px;
}

.catalog-wizard-form .document-field:nth-of-type(2),
.catalog-wizard-form .document-field:nth-of-type(3) {
    grid-column: span 1;
}

.catalog-product-preview {
    display: grid;
    align-content: center;
    gap: 6px;
    padding: 16px;
}

.catalog-product-preview strong,
.catalog-product-preview span,
.catalog-product-preview em {
    display: block;
}

.catalog-product-preview span {
    color: var(--muted);
}

.catalog-product-preview em {
    color: #155dfc;
    font-style: normal;
    font-weight: 850;
}

.line-row .designation-cell {
    display: grid;
    gap: 6px;
}

.line-row .designation-cell select {
    background: #ffffff;
    border-color: rgba(21, 93, 252, .24);
    font-weight: 800;
}

.line-row .designation-cell .catalog-line-name {
    font-size: 12px;
}

.line-row .designation-cell .catalog-line-name:empty {
    display: none;
}

.wizard-invoice-builder {
    display: grid;
    gap: 18px;
}

.wizard-lines-table {
    display: grid;
    gap: 8px;
}

.wizard-lines-table-head,
.wizard-added-line {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 110px 120px 110px 44px;
    gap: 10px;
    align-items: center;
}

.wizard-lines-table-head {
    color: var(--muted);
    font-size: 11px;
    font-weight: 950;
    padding: 0 12px;
    text-transform: uppercase;
}

.wizard-added-line {
    border: 1px solid #dbe6f7;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
    box-shadow: 0 10px 26px rgba(7, 26, 61, .06);
}

.wizard-added-line.active {
    border-color: rgba(21, 93, 252, .42);
    box-shadow: 0 12px 30px rgba(21, 93, 252, .10);
}

.wizard-added-line a,
.wizard-added-line small {
    display: block;
}

.wizard-added-line small {
    color: var(--muted);
    margin-top: 3px;
}

.wizard-added-line span {
    color: var(--ink);
    font-weight: 800;
}

.wizard-added-line form {
    margin: 0;
}

.invoice-like-line {
    border: 1px solid #dbe6f7;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffffff, #f8fbff);
    padding: 16px;
}

.invoice-like-line .catalog-wizard-form {
    grid-template-columns: minmax(260px, 1.1fr) 110px 130px;
    align-items: end;
}

.compact-preview {
    margin-top: 12px;
    box-shadow: none;
}

@media (max-width: 760px) {
    .setup-card,
    .empty-catalog-callout {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .empty-catalog-callout {
        flex-direction: column;
        align-items: flex-start;
    }

    .catalog-wizard-form {
        grid-template-columns: 1fr;
    }

    .wizard-lines-table-head {
        display: none;
    }

    .wizard-added-line {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .invoice-like-line .catalog-wizard-form {
        grid-template-columns: 1fr;
    }
}

/* Final application theme overrides (must remain last). */
html[data-theme="dark"] .workspace .line-editor {
    border-color: #334155;
    background: #111827;
}

html[data-theme="dark"] .workspace .line-editor-head {
    border-bottom-color: #334155;
    background: #151d2d;
}

html[data-theme="dark"] .workspace .line-editor-head :is(.eyebrow, .form-help, p) { color: #cbd5e1 !important; }
html[data-theme="dark"] .workspace .line-editor-head h3 { color: #f8fafc; }
html[data-theme="dark"] .workspace .line-table { background: #111827; }
html[data-theme="dark"] .workspace .line-table-header {
    border-top: 1px solid #263247;
    background: #111827;
    color: #cbd5e1;
}
html[data-theme="dark"] .workspace .empty-catalog-callout {
    border-color: #475569;
    background: #1e293b;
}
html[data-theme="dark"] .workspace .empty-catalog-callout strong { color: #f8fafc; }
html[data-theme="dark"] .workspace .empty-catalog-callout span,
html[data-theme="dark"] .workspace .price-mode { color: #cbd5e1; }
html[data-theme="dark"] {
    color-scheme: dark;
    --bs-body-bg: #0b1120;
    --bs-body-color: #edf2f7;
    --bs-border-color: #334155;
    --bg: #0b1120;
    --surface: #151d2d;
    --surface-soft: #1d2738;
    --ink: #edf2f7;
    --muted: #a9b6c8;
    --line: #334155;
    --brand: #2dd4bf;
    --brand-light: #5eead4;
    --brand-dark: #99f6e4;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell { background: #0b1120; color: var(--ink); }
html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar.show { border-color: var(--line); background: linear-gradient(180deg, #111827, #0f172a); color: var(--ink); }
html[data-theme="dark"] .sidebar nav a { color: #cbd5e1; }
html[data-theme="dark"] .sidebar nav a:hover { background: rgba(45, 212, 191, .13); color: #f8fafc; }
html[data-theme="dark"] .workspace { background: rgba(11, 17, 32, .78); }
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .sidebar-card,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .stat,
html[data-theme="dark"] .mini-panel,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .document-paper,
html[data-theme="dark"] .line-row,
html[data-theme="dark"] .setup-card,
html[data-theme="dark"] .empty-catalog-callout,
html[data-theme="dark"] .catalog-product-preview,
html[data-theme="dark"] .invoice-like-line { border-color: var(--line); background: var(--surface); color: var(--ink); }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .top-search input,
html[data-theme="dark"] .account-menu-toggle,
html[data-theme="dark"] .row-menu-toggle,
html[data-theme="dark"] .line-cell input,
html[data-theme="dark"] .line-cell select,
html[data-theme="dark"] .line-cell textarea { border-color: var(--line); background: #111827; color: var(--ink); }
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus { background: #172033; }
html[data-theme="dark"] table,
html[data-theme="dark"] th,
html[data-theme="dark"] td,
html[data-theme="dark"] .dropdown-item { color: var(--ink); border-color: var(--line); }
html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] tbody tr:hover { background: var(--surface-soft); color: var(--brand-light); }
html[data-theme="dark"] .badge { background: #153b38; color: #99f6e4; }
html[data-theme="dark"] .tabs,
html[data-theme="dark"] .editor-mode-strip span { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
html[data-theme="dark"] .line-total { background: #263247; color: var(--ink); }



/* =========================================================
   THEME DARK — VERSION CORRIGÉE
   À placer tout à la fin du fichier CSS
   ========================================================= */

html[data-theme="dark"] {
    color-scheme: dark;

    --bs-body-bg: #0b1120;
    --bs-body-color: #f1f5f9;
    --bs-border-color: #3b4a60;

    --bg: #0b1120;
    --surface: #151d2d;
    --surface-soft: #1d2738;

    --ink: #f1f5f9;
    --muted: #b8c4d4;

    --line: #3b4a60;

    --brand: #2dd4bf;
    --brand-light: #5eead4;
    --brand-dark: #99f6e4;

    --accent: #60a5fa;

    --danger: #f87171;
    --danger-soft: #451a1a;
}


/* =========================================================
   GLOBAL
   ========================================================= */

html[data-theme="dark"] body,
html[data-theme="dark"] .app-shell {
    background: var(--bg) !important;
    color: var(--ink) !important;
}

html[data-theme="dark"] .workspace {
    background: var(--bg) !important;
    color: var(--ink) !important;
}


/* =========================================================
   TEXTES
   ========================================================= */

html[data-theme="dark"] .workspace h1,
html[data-theme="dark"] .workspace h2,
html[data-theme="dark"] .workspace h3,
html[data-theme="dark"] .workspace h4,
html[data-theme="dark"] .workspace h5,
html[data-theme="dark"] .workspace h6 {
    color: #f8fafc !important;
}

html[data-theme="dark"] .workspace label,
html[data-theme="dark"] .workspace strong {
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .workspace p {
    color: #cbd5e1;
}

html[data-theme="dark"] .workspace small,
html[data-theme="dark"] .workspace .text-muted,
html[data-theme="dark"] .workspace .form-help,
html[data-theme="dark"] .workspace .help-text,
html[data-theme="dark"] .workspace .eyebrow {
    color: #b8c4d4 !important;
}


/* =========================================================
   LIENS
   Correction du problème #282828 sur fond sombre
   ========================================================= */

html[data-theme="dark"] .workspace a:not(.btn):not(.dropdown-item) {
    color: #2b2b2b !important;
}

html[data-theme="dark"] .workspace a:not(.btn):not(.dropdown-item):hover {
    color: #99f6e4 !important;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .sidebar.show {
    background: linear-gradient(
        180deg,
        #111827 0%,
        #0f172a 100%
    ) !important;

    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .sidebar nav a {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .sidebar nav a:hover,
html[data-theme="dark"] .sidebar nav a.active {
    background: rgba(45, 212, 191, .12) !important;
    color: #5eead4 !important;
}


/* =========================================================
   TOPBAR
   ========================================================= */

html[data-theme="dark"] .topbar {
    background: #151d2d !important;
    border-color: #3b4a60 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .account-menu-toggle {
    background: #1d2738 !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}


/* =========================================================
   PANELS / CARDS
   ========================================================= */

html[data-theme="dark"] .workspace .panel,
html[data-theme="dark"] .workspace .card,
html[data-theme="dark"] .workspace .stat,
html[data-theme="dark"] .workspace .mini-panel,
html[data-theme="dark"] .workspace .card-item,
html[data-theme="dark"] .workspace .list-line,
html[data-theme="dark"] .workspace .form-panel,
html[data-theme="dark"] .workspace .settings-panel,
html[data-theme="dark"] .workspace .planning-card,
html[data-theme="dark"] .workspace .planning-dropzones,
html[data-theme="dark"] .workspace .invoice-preview,
html[data-theme="dark"] .workspace .summary-card,
html[data-theme="dark"] .workspace .document-paper,
html[data-theme="dark"] .workspace .document-meta-card,
html[data-theme="dark"] .workspace .setup-card {
    background: #151d2d !important;
    border-color: #3b4a60 !important;
    color: #f1f5f9 !important;
}


/* =========================================================
   WIZARD
   Client / Lignes / Options / Validation
   ========================================================= */

html[data-theme="dark"] .workspace .wizard-steps {
    gap: 10px;
}

html[data-theme="dark"] .workspace .wizard-steps span {
    min-height: 54px;

    background: #182234 !important;
    border: 1px solid #3b4a60 !important;

    color: #cbd5e1 !important;
}

html[data-theme="dark"] .workspace .wizard-steps strong {
    background: #263247 !important;
    color: #e2e8f0 !important;
}


/* Étape active */

html[data-theme="dark"] .workspace .wizard-steps .active {
    background: #123f3a !important;
    border-color: #2dd4bf !important;
    color: #99f6e4 !important;
}

html[data-theme="dark"] .workspace .wizard-steps .active strong {
    background: #2dd4bf !important;
    color: #062e2b !important;
}


/* Étapes terminées */

html[data-theme="dark"] .workspace .wizard-steps .done {
    background: #182234 !important;
    border-color: #3b4a60 !important;
    color: #dbeafe !important;
}

html[data-theme="dark"] .workspace .wizard-steps .done strong {
    background: #0f766e !important;
    color: #ffffff !important;
}


/* =========================================================
   WIZARD CARD
   ========================================================= */

html[data-theme="dark"] .workspace .wizard-card {
    background: #151d2d !important;
    border: 1px solid #3b4a60 !important;
    color: #f1f5f9 !important;

    box-shadow: 0 12px 34px rgba(0, 0, 0, .35) !important;
}

html[data-theme="dark"] .workspace .wizard-card h2 {
    color: #f8fafc !important;
}


/* =========================================================
   FORMULAIRE
   ========================================================= */

html[data-theme="dark"] .workspace .form-panel {
    background: #151d2d !important;
    border-color: #3b4a60 !important;
    color: #f1f5f9 !important;
}


/* =========================================================
   BLOCS DU SMART FORM
   ========================================================= */

html[data-theme="dark"] .workspace .smart-form > div {
    background: #182234 !important;
    border-color: #334155 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .workspace .smart-form > div:has(textarea),
html[data-theme="dark"] .workspace .smart-form > div:has(input[type="file"]),
html[data-theme="dark"] .workspace .smart-form > div:has([type="hidden"]),
html[data-theme="dark"] .workspace .smart-form > .actions,
html[data-theme="dark"] .workspace .smart-form > fieldset {
    background: transparent !important;
    border-color: transparent !important;
}


/* =========================================================
   CHAMPS
   ========================================================= */

html[data-theme="dark"] .workspace input,
html[data-theme="dark"] .workspace select,
html[data-theme="dark"] .workspace textarea,
html[data-theme="dark"] .workspace .form-control,
html[data-theme="dark"] .workspace .form-select {
    background: #111827 !important;
    border: 1px solid #475569 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] .workspace input::placeholder,
html[data-theme="dark"] .workspace textarea::placeholder {
    color: #94a3b8 !important;
    opacity: 1 !important;
}


/* Focus */

html[data-theme="dark"] .workspace input:focus,
html[data-theme="dark"] .workspace select:focus,
html[data-theme="dark"] .workspace textarea:focus,
html[data-theme="dark"] .workspace .form-control:focus,
html[data-theme="dark"] .workspace .form-select:focus {
    background: #172033 !important;
    border-color: #2dd4bf !important;
    color: #f8fafc !important;

    box-shadow:
        0 0 0 3px rgba(45, 212, 191, .18) !important;
}


/* Champs désactivés */

html[data-theme="dark"] .workspace input:disabled,
html[data-theme="dark"] .workspace select:disabled,
html[data-theme="dark"] .workspace textarea:disabled,
html[data-theme="dark"] .workspace .form-control:disabled,
html[data-theme="dark"] .workspace .form-select:disabled {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #94a3b8 !important;
    opacity: 1 !important;
}


/* =========================================================
   LABELS
   ========================================================= */

html[data-theme="dark"] .workspace label,
html[data-theme="dark"] .workspace .document-field label,
html[data-theme="dark"] .workspace .stack-form label {
    color: #e2e8f0 !important;
}


/* =========================================================
   BOUTONS
   ========================================================= */

html[data-theme="dark"] .workspace .btn,
html[data-theme="dark"] .workspace button {
    background: #0f766e !important;
    border-color: #0f766e !important;
    color: #ffffff !important;
}

html[data-theme="dark"] .workspace .btn:hover,
html[data-theme="dark"] .workspace button:hover {
    background: #2dd4bf !important;
    border-color: #2dd4bf !important;
    color: #062e2b !important;
}


/* Boutons secondaires */

html[data-theme="dark"] .workspace .btn.ghost,
html[data-theme="dark"] .workspace .btn-secondary,
html[data-theme="dark"] .workspace .btn-outline-secondary {
    background: #263247 !important;
    border-color: #64748b !important;
    color: #f8fafc !important;
}

html[data-theme="dark"] .workspace .btn.ghost:hover,
html[data-theme="dark"] .workspace .btn-secondary:hover,
html[data-theme="dark"] .workspace .btn-outline-secondary:hover {
    background: #334155 !important;
    border-color: #5eead4 !important;
    color: #ffffff !important;
}


/* =========================================================
   TABLEAUX
   ========================================================= */

html[data-theme="dark"] .workspace table {
    background: transparent !important;
    color: #edf2f7 !important;

    --bs-table-bg: transparent;
    --bs-table-color: #edf2f7;
    --bs-table-border-color: #334155;
    --bs-table-hover-color: #ffffff;
    --bs-table-hover-bg: #1d2738;
}

html[data-theme="dark"] .workspace th {
    background: #111827 !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .workspace td {
    background: transparent !important;
    color: #edf2f7 !important;
    border-color: #334155 !important;
}

html[data-theme="dark"] .workspace tbody tr:hover {
    background: #1d2738 !important;
}


/* =========================================================
   LINE EDITOR
   ========================================================= */

html[data-theme="dark"] .workspace .line-editor {
    background: #111827 !important;
    border-color: #334155 !important;
    color: #edf2f7 !important;
}

html[data-theme="dark"] .workspace .line-editor-head {
    background: #151d2d !important;
    border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .workspace .line-editor-head h3 {
    color: #f8fafc !important;
}

html[data-theme="dark"] .workspace .line-editor-head p,
html[data-theme="dark"] .workspace .line-editor-head .eyebrow,
html[data-theme="dark"] .workspace .line-editor-head .form-help {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .workspace .line-table {
    background: #111827 !important;
}

html[data-theme="dark"] .workspace .line-table-header {
    background: #111827 !important;
    color: #cbd5e1 !important;
    border-color: #334155 !important;
}


/* =========================================================
   DROPDOWN
   ========================================================= */

html[data-theme="dark"] .workspace .dropdown-menu {
    background: #151d2d !important;
    border-color: #3b4a60 !important;
}

html[data-theme="dark"] .workspace .dropdown-item {
    color: #edf2f7 !important;
}

html[data-theme="dark"] .workspace .dropdown-item:hover {
    background: #1d2738 !important;
    color: #5eead4 !important;
}


/* =========================================================
   BADGES
   ========================================================= */

html[data-theme="dark"] .workspace .badge {
    background: #153b38 !important;
    color: #99f6e4 !important;
    border-color: #285e59 !important;
}

html[data-theme="dark"] .workspace .badge.danger {
    background: #5f2025 !important;
    color: #fecaca !important;
    border-color: #9f3a38 !important;
}


/* =========================================================
   ALERTES
   ========================================================= */

html[data-theme="dark"] .workspace .stat-alert {
    background: #3f1d22 !important;
    border-color: #9f3a38 !important;
    color: #fecaca !important;
}


/* =========================================================
   TABS
   ========================================================= */

html[data-theme="dark"] .workspace .tabs,
html[data-theme="dark"] .workspace .editor-mode-strip span {
    background: #1d2738 !important;
    border-color: #3b4a60 !important;
    color: #e2e8f0 !important;
}

html[data-theme="dark"] .workspace .tabs a {
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .workspace .tabs a.active {
    background: #263247 !important;
    color: #5eead4 !important;
}


/* =========================================================
   EMPTY / INFORMATION CARDS
   ========================================================= */

html[data-theme="dark"] .workspace .empty-catalog-callout {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #cbd5e1 !important;
}

html[data-theme="dark"] .workspace .empty-catalog-callout strong {
    color: #f8fafc !important;
}

html[data-theme="dark"] .workspace .empty-catalog-callout span {
    color: #cbd5e1 !important;
}


/* =========================================================
   DOCUMENTS / PREVIEWS
   ========================================================= */

html[data-theme="dark"] .workspace .document-paper,
html[data-theme="dark"] .workspace .invoice-preview {
    background: #151d2d !important;
    border-color: #3b4a60 !important;
    color: #edf2f7 !important;
}


/* =========================================================
   FOCUS ACCESSIBLE
   ========================================================= */

html[data-theme="dark"] .workspace :focus-visible {
    outline: 2px solid #5eead4 !important;
    outline-offset: 2px;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 980px) {

    html[data-theme="dark"] .workspace .wizard-steps span {
        min-height: 48px;
        padding: 9px 10px;
    }

}