/* faktura.io app: the marketing site's design (site/src/styles/site.css),
   calmer. A skewed gradient band carries the header and the page title;
   everything else sits on elevated sheets. Light and dark themes follow
   the system, overridden by html[data-theme] (theme.js, remembered).
   Partner cells override --accent, --accent-fg and --hero-* via /brand.css. */

@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/hanken-grotesk-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/hanken-grotesk-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #f6f8fb; --fg: #253150; --muted: #68728c; --card: #fff; --line: #e3e8f0; --field: #f6f8fb;
  --accent: #1e9e6a; --accent-fg: #fff; --green: #1e9e6a; --link: #2a49c9; --error: #c9372c; --warn: #b7791f;
  --hero-a: #2a3fb8; --hero-b: #2f6fd8; --hero-c: #16a3a0; --stripe-1: rgba(255, 255, 255, .12); --stripe-3: #ffcf3d;
  --shadow: 0 50px 100px -20px rgba(37, 49, 80, .22), 0 30px 60px -30px rgba(0, 0, 0, .25);
  --shadow-sm: 0 13px 27px -5px rgba(37, 49, 80, .14), 0 8px 16px -8px rgba(0, 0, 0, .18);
  --btn-shadow: 0 4px 6px rgba(37, 49, 80, .11), 0 1px 3px rgba(0, 0, 0, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1426; --fg: #e7ecf6; --muted: #9aa5c0; --card: #152038; --line: #24304b; --field: #0f1a30;
    --accent: #4cd39d; --accent-fg: #062519; --green: #4cd39d; --link: #8fb0ff; --error: #f97066; --warn: #e3a948;
    --hero-a: #16226b; --hero-b: #1b3f8f; --hero-c: #0b6b6e; --stripe-1: rgba(255, 255, 255, .06); --stripe-3: #e0b52c;
    --shadow: 0 50px 100px -20px rgba(0, 0, 0, .6), 0 30px 60px -30px rgba(0, 0, 0, .7);
    --shadow-sm: 0 13px 27px -5px rgba(0, 0, 0, .45), 0 8px 16px -8px rgba(0, 0, 0, .55);
    --btn-shadow: 0 4px 6px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1426; --fg: #e7ecf6; --muted: #9aa5c0; --card: #152038; --line: #24304b; --field: #0f1a30;
  --accent: #4cd39d; --accent-fg: #062519; --green: #4cd39d; --link: #8fb0ff; --error: #f97066; --warn: #e3a948;
  --hero-a: #16226b; --hero-b: #1b3f8f; --hero-c: #0b6b6e; --stripe-1: rgba(255, 255, 255, .06); --stripe-3: #e0b52c;
  --shadow: 0 50px 100px -20px rgba(0, 0, 0, .6), 0 30px 60px -30px rgba(0, 0, 0, .7);
  --shadow-sm: 0 13px 27px -5px rgba(0, 0, 0, .45), 0 8px 16px -8px rgba(0, 0, 0, .55);
  --btn-shadow: 0 4px 6px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--fg); overflow-x: hidden; position: relative; isolation: isolate;
  font: 400 16px/1.55 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--link); text-underline-offset: .18em; }
p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.small { font-size: .86rem; }
:focus-visible { outline: 3px solid var(--stripe-3); outline-offset: 2px; border-radius: 4px; }

/* ---- the skewed gradient band behind header and title ---- */
body::before {
  content: ""; position: absolute; z-index: -2; left: 0; right: 0; top: -200px; height: 520px;
  background: linear-gradient(150deg, var(--hero-a) 15%, var(--hero-b) 55%, var(--hero-c) 94%);
  transform: skewY(-6deg); transform-origin: 0 0;
}
body::after {
  /* two translucent stripes and the yellow accent on the band's edge */
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; top: -200px; height: 520px; pointer-events: none;
  background:
    linear-gradient(var(--stripe-1), var(--stripe-1)) 0 330px / 28% 90px no-repeat,
    linear-gradient(var(--stripe-1), var(--stripe-1)) 100% 240px / 18% 90px no-repeat,
    linear-gradient(var(--stripe-3), var(--stripe-3)) 0 100% / 6% 8px no-repeat;
  transform: skewY(-6deg); transform-origin: 0 0;
}
body.app::before, body.app::after { height: 420px; }

/* ---- buttons: small, uppercase, letter-spaced ---- */
button, a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; margin-top: 16px; padding: 0 16px;
  font: 650 .8rem/1.2 inherit; font-family: inherit; text-transform: uppercase; letter-spacing: .06em; text-decoration: none;
  cursor: pointer; border: 0; border-radius: 5px; background: var(--accent); color: var(--accent-fg); box-shadow: var(--btn-shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
button:hover, a.button:hover { transform: translateY(-1px); box-shadow: 0 7px 14px rgba(37, 49, 80, .12), 0 3px 6px rgba(0, 0, 0, .08); }
button:active, a.button:active { transform: translateY(1px); }
button.secondary, a.button.secondary { background: var(--card); color: var(--link); }
button.danger { background: var(--error); color: #fff; }
button[disabled] { opacity: .45; cursor: not-allowed; transform: none; }
button.link {
  width: auto; min-height: 0; margin: 0; padding: 0; background: none; box-shadow: none; color: inherit; text-decoration: underline;
  text-transform: none; letter-spacing: 0; font-weight: 400; font-size: inherit;
}
button.link:hover { transform: none; box-shadow: none; }

/* theme toggle (moon in light, sun in dark) */
button.theme {
  width: 34px; min-height: 34px; height: 34px; margin: 0; padding: 0; border-radius: 50%; box-shadow: none; flex: none;
  border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); color: #fff;
}
button.theme:hover { background: rgba(255, 255, 255, .2); transform: none; box-shadow: none; }
button.theme svg { width: 16px; height: 16px; }
button.theme .sun { display: none; }
:root[data-theme="dark"] button.theme .sun { display: block; }
:root[data-theme="dark"] button.theme .moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) button.theme .sun { display: block; }
  :root:not([data-theme="light"]) button.theme .moon { display: none; }
}

/* ---- sign-in and other single-card pages ---- */
body:not(.app):not(.pay) { display: grid; place-items: center; padding: 72px 16px 32px; }
.card { width: 100%; max-width: 440px; background: var(--card); border-radius: 8px; padding: 36px; box-shadow: var(--shadow); position: relative; }
.card .card-tools { position: absolute; top: -50px; right: 0; display: flex; gap: 10px; align-items: center; }
.card .card-tools .theme { position: static; }
.brand { margin: 0 0 22px; font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; color: var(--fg); }
.brand-logo { max-height: 40px; max-width: 200px; margin-bottom: 20px; }
h1 { margin: 0 0 8px; font-size: 1.6rem; line-height: 1.2; font-weight: 550; letter-spacing: -.015em; }
label { display: block; font-weight: 600; margin: 16px 0 6px; }
.card input[type=email] {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; color: inherit; background: var(--field);
  border: 1px solid var(--line); border-radius: 5px;
}
.card button, .card a.button { width: 100%; }
.card button.theme { width: 34px; margin: 0; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand::before, .topbar .logo::before {
  content: ""; width: 24px; height: 24px; border-radius: 6px; flex: none;
  background: var(--hero-a) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M10 8h12v3h-8.5v4H21v3h-7.5v6H10z' fill='%23fff'/%3E%3C/svg%3E") center / 100% no-repeat;
}
.alt-login { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.alt-login .button, .alt-login button { margin-top: 0; }

/* ---- signed-in app ---- */
.topbar { display: flex; align-items: center; gap: 22px; padding: 16px 24px; max-width: 1280px; margin: 0 auto; flex-wrap: wrap; color: #fff; }
.topbar .logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: #fff; letter-spacing: -.01em; }
.topbar .logo::before { box-shadow: 0 0 0 1px rgba(255, 255, 255, .5); }
.topbar nav { display: flex; gap: 2px; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; padding: 6px 11px; border-radius: 5px; color: rgba(255, 255, 255, .82); font-weight: 550; }
.topbar nav a:hover { color: #fff; background: rgba(255, 255, 255, .12); }
.topbar nav a.active { color: #fff; background: rgba(255, 255, 255, .2); }
.topbar .who { margin-left: auto; display: flex; gap: 14px; align-items: center; color: rgba(255, 255, 255, .85); font-size: .9rem; }
.topbar .who form, .topbar .who button { margin: 0; }
.page { max-width: 1280px; margin: 0 auto; padding: 18px 24px 24px; }
.pagefoot { max-width: 1280px; margin: 0 auto; padding: 8px 24px 32px; color: var(--muted); font-size: .8rem; }
/* the title sits on the band */
.page > h1, .page > .pagehead h1, .page > .narrow > h1 { color: #fff; font-size: 1.75rem; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 6px 0 22px; }
.page > p.muted:first-of-type, .page > .narrow > p.muted:first-of-type { color: rgba(255, 255, 255, .85); }
.page h2 { font-size: 1.1rem; margin: 0 0 12px; font-weight: 600; }
.page h3 { font-size: .95rem; margin: 16px 0 8px; font-weight: 600; }
.panel > h2:first-child, .panel > h3:first-child { color: var(--green); text-transform: uppercase; letter-spacing: .06em; font-size: .86rem; margin-top: 0; }
.pagehead { display: flex; align-items: center; gap: 12px 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagehead h1 { margin: 0 auto 0 0 !important; }
.pagehead form button, .pagehead button { margin: 0; }
.pagehead form { margin: 0; }
.pagehead > div:last-child, .pagehead > form:last-of-type { display: flex; gap: 10px; }
.pagehead .total { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #fff; text-align: right; }
.pagehead .total small { display: block; color: rgba(255, 255, 255, .8); font-weight: 500; font-size: .85rem; }
.panel { background: var(--card); border-radius: 8px; padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.panel.narrow, .narrow { max-width: 760px; }
.empty { color: var(--muted); padding: 24px; background: var(--card); border-radius: 8px; box-shadow: var(--shadow-sm); }
.alert { padding: 11px 15px; border-radius: 6px; margin-bottom: 16px; background: var(--card); box-shadow: var(--shadow-sm); border-left: 4px solid var(--green); }
.alert.error { border-left-color: var(--error); color: var(--error); }
.alert.ok { border-left-color: var(--green); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: 2fr 2fr 1fr 1.4fr; gap: 0 14px; }
@media (max-width: 720px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }
.page label { display: block; margin: 10px 0 0; font-weight: 400; }
.page label > span { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.page label small { display: block; color: var(--muted); font-size: .75rem; margin-top: 3px; }
.page input:not([type=checkbox]):not([type=color]):not([type=file]):not([type=radio]), .page select, .page textarea {
  width: 100%; min-height: 38px; padding: 7px 10px; font: inherit; font-size: .95rem; color: inherit; background: var(--field);
  border: 1px solid var(--line); border-radius: 5px;
}
.page input:focus, .page select:focus, .page textarea:focus { outline: 2px solid var(--link); outline-offset: -1px; }
.page input[type=color] { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 5px; background: var(--field); }
.page input[type=checkbox] { accent-color: var(--green); width: 16px; height: 16px; }
.page textarea { resize: vertical; }
.page label.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.page label.check span { display: inline; margin: 0; color: var(--fg); font-size: .95rem; font-weight: 400; }
.page button { width: auto; margin-top: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.row form { margin: 0; }
form.inline { display: flex; gap: 8px; align-items: center; }
form.inline input { width: auto !important; }
form.inline button { margin-top: 0; }
table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
table.list th, table.list td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); }
table.list th { font-size: .74rem; color: var(--muted); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
table.list tbody tr:hover { background: color-mix(in srgb, var(--link) 5%, transparent); }
table.list tr:last-child td { border-bottom: 0; }
table.list a { font-weight: 600; text-decoration: none; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; font-size: .7rem; font-weight: 650; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em;
  background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); vertical-align: middle; }
.pagehead h1 .badge { background: rgba(255, 255, 255, .18); color: #fff; }
.badge.s-paid { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.badge.s-overdue { background: color-mix(in srgb, var(--error) 15%, transparent); color: var(--error); }
.badge.s-issued, .badge.s-sent, .badge.s-viewed { background: color-mix(in srgb, var(--link) 13%, transparent); color: var(--link); }
.badge.s-example { background: transparent; color: var(--error); outline: 1px dashed var(--error); }
.pagehead h1 .badge.s-example { color: #fff; outline-color: #fff; }

/* invoice editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.editor .preview { position: sticky; top: 16px; height: 900px; overflow: hidden; border-radius: 8px; background: #e6e9ef; box-shadow: var(--shadow); padding-top: 0; }
:root[data-theme="dark"] .editor .preview { background: #0a1120; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .editor .preview { background: #0a1120; } }
/* The preview is a real A4 page (~820 px wide); scale it to the column. */
.editor .preview iframe { width: 840px; height: 1200px; border: 0; transform: scale(.7); transform-origin: 0 0; }
@media (min-width: 1360px) { .editor .preview { height: 980px; } .editor .preview iframe { transform: scale(.76); } }
@media (max-width: 1100px) { .editor .preview { position: static; height: auto; overflow-x: auto; } .editor .preview iframe { transform: none; } }
.segmented { display: flex; gap: 2px; padding: 4px; margin: 0; background: var(--card); border-bottom: 1px solid var(--line); }
.segmented a, .segmented button { border: 0; background: none; cursor: pointer; font-family: inherit; padding: 6px 12px; border-radius: 4px; font-size: .74rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-decoration: none; }
.segmented a:hover, .segmented button:hover { color: var(--fg); }
.segmented a[aria-current], .segmented button[aria-current] { background: var(--accent); color: var(--accent-fg); }
.lines-edit { width: 100%; border-collapse: collapse; }
.lines-edit th { font-size: .72rem; color: var(--muted); text-align: left; padding: 0 4px 4px; text-transform: uppercase; letter-spacing: .05em; }
.lines-edit td { padding: 3px 4px; vertical-align: top; }
.lines-edit td:nth-child(1) { width: 36%; }
.lines-edit td:nth-child(2), .lines-edit td:nth-child(3) { width: 8%; }
.lines-edit td:nth-child(4) { width: 18%; }
.lines-edit input, .lines-edit select { padding-left: 6px !important; padding-right: 4px !important; }
.problems { border-left: 4px solid var(--error); }
.problems > h3:first-child { color: var(--error); }
.warnings { border-left: 4px solid var(--warn); }
.warnings > h3:first-child { color: var(--warn); }
.problems ul, .warnings ul { margin: 0; padding-left: 18px; }
.problems li, .warnings li { margin: 4px 0; font-size: .9rem; }
.example-note { border-left: 4px solid var(--error); color: var(--error); }
ul.menu { list-style: none; padding: 0; margin: 0; }
ul.menu li { padding: 8px 0; border-bottom: 1px solid var(--line); }
ul.menu li:last-child { border-bottom: 0; }
ul.menu a { text-decoration: none; font-weight: 550; }
.logo-preview { max-height: 64px; max-width: 240px; object-fit: contain; background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 4px; }

/* read-only support view (operator impersonation) */
.impersonation { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 8px 16px; background: #8a4b00; color: #fff; font-weight: 600; position: relative; z-index: 2; }
.impersonation button { margin: 0; background: #fff; color: #8a4b00; }

/* public invoice page */
body.pay .page.narrow { max-width: 640px; margin: 0 auto; }
body.pay .page > .narrow > *:not(h1):not(.payhead) { position: relative; }
.payhead { margin: 34px 0 22px; color: #fff; }
.payhead .muted { color: rgba(255, 255, 255, .85); }
.seller-logo { max-height: 56px; max-width: 220px; background: #fff; padding: 6px 8px; border-radius: 6px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
dd.amount { font-size: 1.5rem; font-weight: 700; color: var(--green); }
img.qr { width: 200px; height: 200px; image-rendering: pixelated; background: #fff; padding: 8px; border-radius: 6px; }

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; gap: 10px 16px; }
  .topbar .who { margin-left: 0; width: 100%; }
  .page { padding: 12px 16px 24px; }
  .card { padding: 26px 22px; }
}
p.message { white-space: pre-wrap; padding: 16px 18px; border-radius: 6px; background: var(--field); border: 1px solid var(--line); }
.row .button, .row form button { margin-top: 0; }
/* language switch (header and sign-in card, on the gradient) */
form.lang-switch { display: inline-flex; margin: 0; padding: 3px; gap: 2px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .1); }
form.lang-switch button, .card form.lang-switch button {
  width: auto; min-height: 0; margin: 0; padding: 4px 9px; border-radius: 4px; box-shadow: none; background: transparent; color: rgba(255, 255, 255, .85);
  font-size: .7rem; letter-spacing: .06em;
}
form.lang-switch button:hover { background: rgba(255, 255, 255, .15); transform: none; box-shadow: none; color: #fff; }
form.lang-switch button[aria-pressed] { background: #fff; color: #253150; opacity: 1; cursor: default; }
.pagefoot { display: flex; flex-wrap: wrap; gap: 6px 24px; justify-content: space-between; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 18px; }
.pagefoot a, .cardfoot a { color: inherit; }
.cardfoot { grid-row: 2; margin-top: 18px; text-align: center; color: var(--muted); font-size: .85rem; }
body:not(.app):not(.pay) { grid-template-rows: auto auto; align-content: center; }
fieldset.prepaid { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px 6px; margin: 16px 0 0; }
fieldset.prepaid legend { font-size: .8rem; font-weight: 650; color: var(--green); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px; }
.grid-note { grid-column: 1 / -1; margin: -4px 0 4px; }
