:root {
    color-scheme: light;
    font-family: "Geist", "Segoe UI", sans-serif;
    color: #222c3d;
    background: #f7f5f0;
    --ink: #18243a;
    --muted: #566071;
    --line: #e6e0d8;
    --copper: #dea47c;
}

* { box-sizing: border-box; }
body { margin: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid #995c3c; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 4; top: 12px; left: 12px; padding: 12px; background: white; }

.sidebar { display: flex; flex-direction: column; gap: 46px; background: #fff; border-right: 1px solid var(--line); padding: 30px 20px 24px; position: sticky; top: 0; height: 100dvh; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 750; font-size: 24px; letter-spacing: -.06em; margin-left: 8px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ink); }
.brand-mark i { display: block; width: 16px; height: 20px; background: var(--copper); clip-path: polygon(0 0, 69% 0, 100% 26%, 100% 43%, 34% 43%, 34% 54%, 82% 54%, 82% 72%, 34% 72%, 34% 100%, 0 100%); }
nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; text-align: left; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 600; }
.nav-item span:first-child { font-size: 20px; line-height: 1; }
.nav-item:hover, .nav-item.active { background: #f5e9df; color: var(--ink); }
a.nav-item { text-decoration: none; }
.sidebar-footer { margin-top: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; padding: 12px 8px 0; border-top: 1px solid var(--line); }
.demo-dot { height: 8px; width: 8px; border-radius: 50%; background: #a06040; }

.topbar { height: 76px; padding: 0 clamp(20px, 4vw, 60px); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.topbar p { font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.mobile-demo { display: none; }
.content { max-width: 1400px; margin: auto; padding: 32px clamp(20px, 4vw, 60px) 56px; display: grid; gap: 22px; }
.hero { display: flex; align-items: center; justify-content: space-between; position: relative; isolation: isolate; overflow: hidden; min-height: 300px; padding: clamp(26px, 4vw, 52px); background: radial-gradient(ellipse at 87% 30%, #344563, var(--ink) 65%); color: #fff; border-radius: 21px; }
.hero-copy { position: relative; z-index: 1; }
.hero h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: clamp(46px, 5.3vw, 78px); line-height: .95; letter-spacing: -.065em; margin: 0 0 16px; white-space: pre-line; }
.hero p { color: #e1e6ef; max-width: 350px; line-height: 1.55; margin: 0 0 22px; }
.primary, .secondary { padding: 11px 16px; border-radius: 9px; font-weight: 700; border: 1px solid transparent; white-space: nowrap; }
.primary { background: var(--copper); color: var(--ink); }
.primary:hover { background: #e9b794; }
.hero .primary:focus-visible { outline-color: var(--copper); }
.secondary { background: #fff; border-color: var(--line); }
.secondary:hover { background: #faf4ee; }
.hero-art { position: absolute; right: 10%; top: 50%; width: 190px; height: 216px; transform: translateY(-50%); }
.hero-art::before { content: ""; position: absolute; inset: -45px; border: 1px solid #dea47c45; border-radius: 50%; box-shadow: 0 0 0 25px #dea47c20, 0 0 0 51px #dea47c10; }
.paper { position: absolute; inset: 10px 21px; border-radius: 12px; }
.paper.back { background: #b78061; transform: rotate(-19deg) translateX(-11px); }
.paper.front { padding: 23px 18px; background: #f7f5f0; color: var(--ink); transform: rotate(13deg) translateX(9px); box-shadow: 0 12px 30px #0c142660; }
.paper.front i, .paper.front b { display: block; height: 4px; border-radius: 4px; background: #b9b1aa; margin-bottom: 12px; }
.paper.front i { height: 9px; width: 45%; background: #344563; margin-bottom: 24px; }
.paper.front b:nth-of-type(2) { width: 75%; }
.paper.front b:nth-of-type(3) { width: 87%; }
.paper.front em { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--copper); margin: 18px 0 0 auto; font-style: normal; font-weight: 700; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.metrics article, .archive { background: #fff; border: 1px solid var(--line); border-radius: 15px; }
.metrics article { padding: 17px 19px; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #f7e9df; color: #79462c; font-weight: 700; }
.metrics p { margin: 12px 0 5px; color: var(--muted); font-size: 14px; }
.metrics strong { font-size: clamp(18px, 2.5vw, 28px); letter-spacing: -.035em; overflow-wrap: anywhere; }
.archive { overflow: hidden; }
.archive-header, .filters { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 20px; flex-wrap: wrap; }
#subscription-reminder { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: #faf4ee; }
#subscription-reminder a { text-decoration: none; }
h2, .archive h1 { margin: 0; font-size: 20px; letter-spacing: -.035em; }
.filters { padding-top: 0; justify-content: flex-start; }
.invoice-filters { align-items: end; }
.invoice-filters label { display: grid; gap: 5px; min-width: 0; color: var(--muted); font-size: 13px; }
.invoice-filters select { max-width: 260px; }
.archive-pagination { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; padding: 14px 20px; }
.archive-pagination button:disabled { opacity: .5; cursor: default; }
input, select { padding: 9px 11px; border: 1px solid #b0a79c; border-radius: 8px; color: inherit; background: #fff; min-width: 0; }
.search { display: flex; align-items: center; gap: 8px; border: 1px solid #b0a79c; border-radius: 8px; padding-left: 10px; width: min(100%, 290px); }
.search input { border: 0; width: 100%; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; font-size: 14px; }
th, td { padding: 13px 20px; }
th { background: #f7f5f0; color: var(--muted); font-weight: 650; }
th:last-child, td:last-child { text-align: right; }
td { border-top: 1px solid var(--line); }
tfoot th, tfoot td { border-top: 1px solid var(--line); background: #f7f5f0; font-weight: 750; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions .secondary { padding: 5px 8px; font-size: 12px; }
.revenue-charts { display: grid; gap: 20px; padding: 0 20px 20px; }
.revenue-chart { border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.revenue-chart h3 { margin: 0 0 12px; }
.revenue-row { display: grid; grid-template-columns: 4ch minmax(20px, 1fr) minmax(8ch, auto); gap: 10px; align-items: center; margin: 8px 0; }
.revenue-row strong { text-align: right; }
.revenue-track { display: block; background: #f3eee9; border-radius: 5px; overflow: hidden; }
.revenue-bar { display: block; min-height: 14px; background: #a66a4b; }
.trend-scroll { overflow-x: auto; }
.trend-plot { position: relative; min-width: 620px; height: 300px; }
.trend-plot canvas { display: block; width: 100%; height: 100%; }
.trend-point { position: absolute; padding: 0; width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; transform: translate(-50%, -50%); }
.trend-point:focus-visible { outline: 2px solid #804b31; }
.trend-tooltip { position: absolute; z-index: 1; max-width: 220px; padding: 7px 10px; border-radius: 7px; color: white; background: #172033; font-size: 13px; pointer-events: none; }
.payment-summary, .payment-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); gap: 14px; padding: 0 20px 16px; }
.payment-summary > div { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.payment-summary strong { font-size: 18px; }
.drive-preview { margin: 14px 20px; }
.drive-preview iframe { display: block; width: 100%; height: min(65vh, 680px); border: 1px solid var(--line); margin-top: 8px; }
#payments-archive caption { text-align: left; padding: 12px 20px; font-weight: 750; }
.document-link { background: transparent; border: 0; padding: 0; color: #804b31; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.badge { display: inline-block; padding: 4px 9px; border-radius: 99px; background: #eeedf1; font-weight: 650; font-size: 12px; }
.badge.paid { background: #e5f1e6; color: #2c623f; }
.badge.pending { background: #fff1d7; color: #72521a; }
.empty { padding: 0 20px; color: var(--muted); }

dialog { width: min(500px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 24px; border: 1px solid var(--line); border-radius: 17px; color: inherit; }
dialog::backdrop { background: #141d30b0; }
.dialog-heading, .dialog-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-heading { margin-bottom: 18px; }
.dialog-footer { margin-top: 20px; }
.dialog-footer strong { display: block; margin-top: 3px; }
.close { border: 0; border-radius: 8px; background: #f7e9df; font-size: 24px; width: 36px; height: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label { display: grid; gap: 6px; }
.wide { grid-column: 1 / -1; }
dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 24px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.client-documents { list-style: none; padding: 0; margin: 0; }
.client-documents li { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding: 10px 0; }
#settings { width: min(660px, calc(100% - 24px)); }
.company-footer { flex-wrap: wrap; }
.company-footer p { flex: 1 1 220px; margin: 0; color: var(--muted); font-size: 14px; }
.settings-trigger { padding: 8px 10px; }
.logout-trigger { display: inline-flex; align-items: center; gap: 6px; }
.settings-nav { display: flex; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 18px; }
.number-format { min-width: 0; border: 1px solid var(--line); border-radius: 9px; margin: 0; padding: 14px; }
.number-format legend { padding-inline: 5px; font-weight: 650; }
.logo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.logo-controls img { object-fit: contain; }
.logo-upload { display: inline-block; cursor: pointer; }
.logo-upload:focus-within { outline: 2px solid currentColor; outline-offset: 2px; }
.form-grid .preference-check { display: flex; align-items: center; align-self: end; min-height: 39px; gap: 8px; }
.preference-check input { accent-color: var(--ink); }
#number-preview { display: block; padding: 9px 11px; border-radius: 8px; background: #f5e9df; font-variant-numeric: tabular-nums; }
.app-notice:not(:empty) { position: fixed; z-index: 4; bottom: 16px; right: 16px; max-width: calc(100% - 32px); margin: 0; padding: 12px 16px; border-radius: 9px; background: var(--ink); color: white; }
.sidebar-footer { justify-content: space-between; }
.sidebar-footer a { text-underline-offset: 3px; }
.account-page { display: grid; grid-template-columns: 1fr; place-items: center; padding: 20px; }
.account-card { width: min(100%, 460px); padding: 26px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.account-card .brand { margin-left: 0; }
.account-card h1 { font-size: 26px; }
.account-card a.secondary { display: inline-block; text-decoration: none; white-space: normal; }
.account-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 20px; }
.auth-page { min-height: 100dvh; padding: 0; grid-template-columns: 1fr 1fr; background: #f7f5f0; }
.auth-visual { align-self: stretch; width: 100%; min-height: 100%; display: flex; flex-direction: column; gap: clamp(32px, 12vh, 110px); padding: clamp(24px, 5vw, 80px); color: #fff; background: linear-gradient(180deg, #111a2a 12%, #111a2af0 40%, #111a2a45 100%), #172033 url('filigrana-hero.webp') right bottom / cover no-repeat; }
.auth-visual .brand { margin: 0; color: #fff; align-self: flex-start; }
.auth-headline { margin: 0; font-family: "Instrument Serif", Georgia, serif; font-size: clamp(38px, 5vw, 72px); line-height: 1.05; }
.auth-headline span { color: #efb598; }
.auth-page .account-card { width: min(calc(100% - 40px), 480px); border: 0; background: transparent; padding: 32px 0; }
.auth-page .account-card > .brand { display: none; }
.auth-page .account-card h1 { font-size: clamp(28px, 4vw, 44px); }
.auth-page .account-form input { min-height: 46px; }
.auth-page .account-form > .primary { min-height: 48px; }
@media (max-width: 700px) {
    .auth-page { grid-template-columns: 1fr; place-items: start center; }
    .auth-visual { gap: 18px; min-height: 0; }
    .auth-visual p:last-child { margin-bottom: 0; }
}
.password-field { position: relative; margin-top: 5px; }
.password-field input { width: 100%; padding-inline-end: 44px; }
.password-field input::-ms-reveal { display: none; }
.password-toggle { position: absolute; inset-block: 0; inset-inline-end: 0; width: 44px; display: grid; place-items: center; color: inherit; border: 0; background: transparent; }
.password-toggle[aria-pressed="false"] .password-toggle-slash { display: none; }
.password-checklist { margin: 0; padding-inline-start: 20px; color: var(--muted); font-size: 14px; }
.password-rule-met { color: #27633d; list-style-type: "✓  "; }
.password-field input[aria-invalid="true"] { border-color: #a23836; }
#password-status { margin: 0; font-size: 14px; }
#password-status:empty { display: none; }
.subscription-card { width: min(100%, 780px); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 235px), 1fr)); gap: 14px; }
.plan-card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; color: #172033; }
.plan-card form { margin-top: auto; }
.plan-card fieldset { display: grid; gap: 12px; justify-items: start; border: 0; padding: 0; margin: 0; min-width: 0; }
.plan-card fieldset:disabled { opacity: .55; pointer-events: none; }
.plan-card-selected { border-color: #a66a4b; box-shadow: inset 0 0 0 1px #a66a4b; background: #fffaf6; }
[data-plan-picker] .plan-card:not(.plan-card-selected) { cursor: pointer; }
.plan-select { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; }
.landing-page { display: block; background: #f7f5f0; }
.site-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 20px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.site-footer a { color: #804b31; text-underline-offset: 3px; }
.auth-page .site-footer { margin-top: 24px; }
#main > .site-footer { margin-inline: clamp(20px, 4vw, 60px); }
.landing-nav, .landing-main { width: min(1120px, calc(100% - 40px)); margin: auto; }
.landing-nav { display: flex; justify-content: space-between; align-items: center; padding: 20px 0; }
.landing-nav .brand { color: #172033; margin: 0; }
.landing-page a.primary, .landing-page a.secondary { display: inline-block; text-decoration: none; }
.landing-hero { display: flex; align-items: center; min-height: 460px; margin: 20px 0; padding: clamp(24px, 5vw, 68px); border-radius: 22px; color: white; background: linear-gradient(90deg, #111a2a 0%, #111a2abf 38%, transparent 70%), #172033 url('filigrana-hero.webp') center right / cover no-repeat; }
.landing-hero > div { max-width: 490px; }
.landing-hero h1 { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-size: clamp(36px, 6vw, 65px); line-height: 1.05; margin: 0; }
.landing-note { font-size: 14px; }
.landing-feature { padding: 16px 0 24px; }
.landing-feature ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 12px; padding: 0; list-style: none; }
.landing-feature li { padding: 14px 16px; border-left: 2px solid #a66a4b; background: white; }
@media (max-width: 640px) {
    .landing-hero { align-items: end; min-height: 510px; background-image: linear-gradient(0deg, #111a2a 4%, #111a2a 40%, #111a2a18 80%), url('filigrana-hero.webp'); background-position: right top; }
}
.account-form, .account-form label { display: grid; gap: 8px; }
.account-form { gap: 15px; margin-top: 15px; }
.google-sign-in {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid #747775;
    border-radius: 4px;
    background: #fff;
    color: #1f1f1f;
    font: 500 14px/20px "Google Sans", Arial, sans-serif;
    text-decoration: none;
}
.google-sign-in img { flex: none; }
.google-sign-in:hover { background: #f8faff; }
.account-errors { color: #932e34; }
#editor { width: min(790px, calc(100% - 24px)); }
.invoice-client { display: flex; align-items: flex-end; gap: 10px; }
.invoice-client label { flex: 1; min-width: 0; }
.invoice-line { display: grid; grid-template-columns: minmax(150px, 2fr) repeat(3, minmax(64px, 1fr)) auto; align-items: end; gap: 8px; margin-bottom: 12px; }
.invoice-line label { min-width: 0; }
textarea { font: inherit; padding: 9px 11px; border: 1px solid #b0a79c; border-radius: 8px; resize: vertical; }
.form-status { margin: 8px 0; color: var(--muted); font-size: 14px; }
.form-status:empty { display: none; }
.invoice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.dialog-footer a { text-decoration: none; }
button:disabled { opacity: .55; cursor: default; }

@media (max-width: 1050px) {
    body { grid-template-columns: 178px minmax(0, 1fr); }
    .sidebar { padding-inline: 13px; }
    .hero-art { right: 6%; transform: translateY(-50%) scale(.82); }
}
@media (max-width: 760px) {
    body { display: block; }
    .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar nav { display: flex; gap: 2px; }
    .brand { margin-left: 0; font-size: 21px; }
    .nav-item { padding: 8px; font-size: 13px; }
    .nav-item span:first-child { display: none; }
    .sidebar-footer { border: 0; padding: 4px; gap: 10px; }
    .mobile-demo { display: inline; color: var(--muted); font-size: 11px; text-align: right; }
    .topbar { height: 57px; }
    .content { padding-top: 18px; gap: 14px; }
    .hero-art { right: 2%; }
}
@media (max-width: 550px) {
    .topbar { height: auto; min-height: 57px; gap: 8px; flex-wrap: wrap; padding-block: 8px; }
    .top-actions { flex-wrap: wrap; gap: 6px; }
    #settings .form-grid { grid-template-columns: 1fr; }
    .invoice-line { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; }
    .invoice-line label:first-child { grid-column: 1 / -1; }
    .invoice-client { align-items: stretch; flex-direction: column; }
    .hero-art { display: none; }
    .hero { min-height: 260px; }
    .metrics { gap: 6px; }
    .metrics article { padding: 10px 7px; }
    .metrics p { font-size: 12px; }
    .metrics strong { font-size: 15px; }
    th, td { padding-inline: 12px; }
}
