/* Kontain CRM — light + dark (default: light) */

@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/Nunito-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  /* swap: always apply Nunito once loaded (preload makes this nearly instant) */
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/Nunito-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/*
  Brand accent (product identity): #3f51b5
  --accent = buttons, badges, big UI chips
  --link   = text links only (a bit lighter on dark for readability)
*/
:root {
  --brand: #3f51b5;
}

/* Light (default) — same brand accent; links slightly brighter indigo */
:root,
html[data-theme="light"] {
  /* Soft blueish page (site-like); white cards/tables; cool secondary surfaces */
  --bg: #eef1fb;
  --surface: #ffffff;
  --surface-2: #e8ecf8;
  --text: #1a1d23;
  --muted: #5c6570;
  --border: #cfd5e8;
  --accent: #3f51b5;
  --accent-hover: #303f9f;
  --accent-contrast: #ffffff;
  --link: #4558c9;
  --link-hover: #3f51b5;
  --focus-ring: #9fa8da;
  --badge-bg: #e0e5f8;
  --badge-text: #3f51b5;
  --flash-success-bg: #eaf6ee;
  --flash-success-border: #c5ddd0;
  --flash-success-text: #1b5e3a;
  --flash-error-bg: #fef2f2;
  --flash-error-border: #fca5a5;
  --flash-error-text: #991b1b;
  --flash-info-bg: #e4e8f8;
  --flash-info-border: #9fa8da;
  --flash-info-text: #1a237e;
  --input-bg: #ffffff;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --font-logo: "Nunito", system-ui, sans-serif;
  --status-active-bg: #c8edd4;
  --status-active-text: #0b3d22;
  /* Status badges — stronger contrast on light (billing + lists) */
  --status-draft-bg: #e2e6f0;
  --status-draft-text: #2f3640;
  --status-sent-bg: #d4daf7;
  --status-sent-text: #1a237e;
  --status-paid-bg: #c8edd4;
  --status-paid-text: #0b3d22;
  --status-void-bg: #fcdada;
  --status-void-text: #7f1d1d;
  --status-overdue-bg: #fde8e8;
  --status-overdue-text: #9b1c1c;
  --status-archived-bg: #e8ecf4;
  --status-archived-text: #5c6570;
  --status-blocked-bg: #fef2f2;
  --status-blocked-text: #991b1b;
  /* Secondary buttons: white chip on soft blue page */
  --btn-ghost-bg: #ffffff;
  --btn-ghost-bg-hover: #e4e8f8;
  --btn-ghost-border: #c5cad8;
  --btn-ghost-border-hover: var(--accent);
  --btn-ghost-text: #3f51b5;
  --btn-ghost-text-hover: #303f9f;
  /* Table header = surface-2; row hover slightly lighter */
  --table-hover: #f4f6fd;
  color-scheme: light;
}

/* Dark — only when data-theme="dark" (higher specificity than :root) */
html[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1c212b;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --border: #2a3140;
  --accent: #3f51b5;
  --accent-hover: #5c6bc0;
  --accent-contrast: #ffffff;
  --link: #8b9cf0;
  --link-hover: #a8b5f5;
  --focus-ring: #7986cb;
  --badge-bg: #1a237e;
  --badge-text: #c5cae9;
  --flash-success-bg: #12261a;
  --flash-success-border: #2f6b45;
  --flash-success-text: #8fd9a8;
  --flash-error-bg: #2a1416;
  --flash-error-border: #7a2f35;
  --flash-error-text: #ff9a9f;
  --flash-info-bg: #1a237e;
  --flash-info-border: #3f51b5;
  --flash-info-text: #c5cae9;
  --input-bg: #12151c;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --font-logo: "Nunito", system-ui, sans-serif;
  /* Status labels (dark) */
  --status-active-bg: #143526;
  --status-active-text: #7ddea0;
  --status-draft-bg: #2a2f3a;
  --status-draft-text: #b0b8c4;
  --status-sent-bg: #1a237e;
  --status-sent-text: #c5cae9;
  --status-paid-bg: #143526;
  --status-paid-text: #7ddea0;
  --status-void-bg: #3a1719;
  --status-void-text: #ff9a9f;
  --status-overdue-bg: #3a1719;
  --status-overdue-text: #ff9a9f;
  --status-archived-bg: #2a2f3a;
  --status-archived-text: #9aa3b2;
  --status-blocked-bg: #3a1719;
  --status-blocked-text: #ff9a9f;
  /* Secondary buttons: solid fill so they don’t vanish on dark bg */
  --btn-ghost-bg: #1e2430;
  --btn-ghost-bg-hover: #262d3c;
  --btn-ghost-border: #4a5568;
  --btn-ghost-border-hover: var(--accent-hover);
  --btn-ghost-text: #c5cae9;
  --btn-ghost-text-hover: #e8eaf6;
  /* Table header = surface-2 (#1c212b); row hover slightly lighter */
  --table-hover: #232936;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* Public auth + public invoice — marketing soft mesh, always light */
body.auth-public,
body.public-invoice-page {
  background-color: #eef1fb;
  background-image: url("/site/img/site-bg.svg");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

html:has(body.auth-public),
html:has(body.public-invoice-page),
html[data-auth-public="1"] {
  background: #eef1fb;
}

body.auth-public .theme-toggle,
body.public-invoice-page .theme-toggle,
html[data-auth-public="1"] .theme-toggle {
  display: none !important;
}

/* Mesh pages: light footer surface */
body.auth-public .site-footer,
body.public-invoice-page .site-footer {
  background: var(--surface);
}

a {
  color: var(--link);
  text-decoration: none;
  transition:
    color 0.16s ease,
    background-color 0.16s ease,
    border-color 0.16s ease,
    opacity 0.16s ease,
    box-shadow 0.16s ease;
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* Buttons keep brand accent (not link color) */
a.btn,
a.btn:hover {
  text-decoration: none;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 0.75rem 1.1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
}

/* Wordmark SVG — name only, currentColor + Nunito */
.logo,
.logo-mark,
.footer-logo {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  line-height: 0;
  transition: color 0.16s ease, opacity 0.16s ease;
}

a.logo:hover,
a.logo-mark:hover {
  text-decoration: none;
  color: var(--accent);
}

/* Non-link logos (public page, footer): no hover color change */
.logo-static,
.logo-static:hover,
.logo-mark.logo-static:hover {
  color: var(--text);
  cursor: default;
}

.logo-svg {
  display: block;
  height: 2rem;
  width: auto;
}

.logo-mark .logo-svg {
  height: 2.35rem;
  margin: 0 auto;
}

.footer-logo .logo-svg {
  height: 1.55rem;
}

.auth-card.maintenance-card .logo-mark {
  display: flex;
  justify-content: center;
  margin: 0 0 1.15rem;
}

.auth-card.maintenance-card .logo-mark .logo-svg {
  height: 2.75rem;
}

/* Outlined wordmark — no webfont, no FOUC */
.logo-path {
  fill: currentColor;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  font-size: 0.95rem;
}

.nav-user {
  color: var(--muted);
  font-size: 0.9rem;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.nav-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.nav-toggle-icon {
  display: none;
}

.nav-toggle .nav-toggle-open {
  display: block;
}

.site-header.is-nav-open .nav-toggle .nav-toggle-open {
  display: none;
}

.site-header.is-nav-open .nav-toggle .nav-toggle-close {
  display: block;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  line-height: 0;
  transition:
    color 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* —— Mobile nav (hamburger) —— */
@media (max-width: 719px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-header .nav {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.35rem 0 0.5rem;
    margin: 0;
    border-top: 1px solid var(--border);
  }

  .site-header.is-nav-open .nav {
    display: flex;
  }

  .site-header .nav > a {
    display: block;
    padding: 0.7rem 0.65rem;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
  }

  .site-header .nav > a:hover {
    background: var(--surface-2);
    color: var(--accent);
    text-decoration: none;
  }

  /* CTA keeps accent + white text (nav link color would override .btn) */
  .site-header .nav > a.nav-register,
  .site-header .nav > a.btn {
    text-align: center;
    margin-top: 0.35rem;
    background: var(--accent);
    color: var(--accent-contrast);
  }

  .site-header .nav > a.nav-register:hover,
  .site-header .nav > a.btn:hover {
    background: var(--accent-hover);
    color: var(--accent-contrast);
  }
}

/* Desktop: horizontal nav */
@media (min-width: 720px) {
  .site-header {
    flex-wrap: nowrap;
    padding: 0.85rem 1.25rem;
  }

  .nav-toggle {
    display: none !important;
  }

  .site-header .nav {
    display: flex !important;
    flex: 1 1 auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    width: auto;
    order: 2;
    gap: 0.75rem 1rem;
    padding: 0;
    border: none;
  }

  .header-tools {
    order: 3;
    margin-left: 0;
  }

  .site-header .logo {
    order: 1;
    flex-shrink: 0;
  }

  .site-header .nav > a:not(.btn) {
    color: var(--link);
  }

  .site-header .nav > a:not(.btn):hover {
    color: var(--link-hover);
  }
}

.theme-icon {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
}

/* Dark → sun (switch to light). Light/default → moon (switch to dark). */
html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

:root .theme-icon-moon,
html[data-theme="light"] .theme-icon-moon {
  display: block;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

.auth-card.maintenance-card {
  margin-top: 3rem;
  max-width: 30rem;
  text-align: center;
}

.maintenance-card h1 {
  margin: 0 0 0.75rem;
  font-size: 1.5rem;
}

.maintenance-card .lede {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
}

/* Content width: ~72rem / Bootstrap xl — room for richer tables, still readable */
.main {
  flex: 1;
  width: 100%;
  max-width: 72rem; /* 1152px */
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

.site-footer {
  padding: 1.5rem 1.25rem 1.75rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  /* Light: white bar on blueish page. Dark: elevated surface on page bg (footer only). */
  background: var(--surface);
}

.footer-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  text-align: center;
}

.footer-brand {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
}

.footer-logo {
  font-size: 1rem;
}

.footer-tag {
  font-size: 0.85rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.15rem;
}

.footer-nav a {
  font-weight: 600;
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin: 0;
  padding-top: 0.2rem;
}

.footer-social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.footer-social-icon:hover {
  color: var(--accent);
  background: var(--surface-2);
  text-decoration: none;
}

.footer-social-icon svg {
  display: block;
}

.footer-meta {
  margin: 0;
  font-size: 0.8rem;
}

.footer-version-link {
  font-weight: 600;
  color: inherit;
  text-decoration: none;
}

.footer-version-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.footer-sep {
  margin: 0 0.25rem;
  opacity: 0.7;
}

.footer-legal {
  margin: 0.15rem auto 0;
  max-width: 40rem;
  font-size: 0.75rem;
  line-height: 1.45;
  opacity: 0.95;
}

.legal-page .legal-body {
  max-width: 40rem;
}

.legal-page .legal-body h2 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.legal-page .legal-body p,
.legal-page .legal-body ul {
  color: var(--muted);
  line-height: 1.55;
}

.legal-page .legal-body ul {
  padding-left: 1.25rem;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.lede {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1rem;
}

.btn {
  display: inline-block;
  padding: 0.52rem 1rem;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.16s ease;
}

.btn:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
  text-decoration: none;
}

.btn-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.9rem;
}

/* Secondary CTA — solid surface so Cancel / Add client stay visible (light + dark) */
.btn-ghost {
  background: var(--btn-ghost-bg);
  color: var(--btn-ghost-text);
  border: 1px solid var(--btn-ghost-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.btn-ghost:hover {
  background: var(--btn-ghost-bg-hover);
  color: var(--btn-ghost-text-hover);
  border-color: var(--btn-ghost-border-hover);
  text-decoration: none;
}

a.btn-ghost,
a.btn-ghost:hover {
  color: var(--btn-ghost-text);
}

a.btn-ghost:hover {
  color: var(--btn-ghost-text-hover);
}

.flash {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.flash-success {
  border-color: var(--flash-success-border);
  background: var(--flash-success-bg);
  color: var(--flash-success-text);
}

.flash-error {
  border-color: var(--flash-error-border);
  background: var(--flash-error-bg);
  color: var(--flash-error-text);
}

.flash-info {
  border-color: var(--flash-info-border);
  background: var(--flash-info-bg);
  color: var(--flash-info-text);
}

/* Free trial: top banner (last 3 days / ended only) */
.trial-banner {
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.trial-banner--soon {
  background: var(--flash-info-bg);
  border-color: var(--flash-info-border);
  color: var(--flash-info-text);
}

.trial-banner--ended {
  background: var(--flash-error-bg);
  border-color: var(--flash-error-border);
  color: var(--flash-error-text);
}

.trial-banner-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.trial-banner-link {
  font-weight: 700;
  white-space: nowrap;
  color: inherit;
  text-decoration: underline;
}

.trial-banner-link:hover {
  opacity: 0.9;
}

/* Demo account — slate (distinct from trial) */
:root .demo-dash-notice,
html[data-theme="light"] .demo-dash-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #94a3b8;
  border-left: 4px solid #64748b;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.95rem;
}

html[data-theme="dark"] .demo-dash-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #475569;
  border-left: 4px solid #94a3b8;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.demo-dash-notice p {
  margin: 0;
}

/* Free trial — amber (time-sensitive) */
:root .trial-dash-notice,
html[data-theme="light"] .trial-dash-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #f0c674;
  border-left: 4px solid #d97706;
  background: #fffbeb;
  color: #78350f;
  font-size: 0.95rem;
}

html[data-theme="dark"] .trial-dash-notice {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid #92400e;
  border-left: 4px solid #f59e0b;
  background: #292116;
  color: #fde68a;
  font-size: 0.95rem;
}

.trial-dash-notice p {
  margin: 0;
}

.trial-dash-notice a {
  font-weight: 700;
  color: inherit;
  text-decoration: underline;
}

.auth-card {
  max-width: 400px;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
}

.auth-card h1 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.invoice-client-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.invoice-client-sep {
  font-weight: 400;
  color: var(--muted);
  user-select: none;
}

.invoice-client-row a {
  flex-shrink: 0;
  white-space: nowrap;
  font-weight: 500;
  color: var(--link);
}

.invoice-client-row a:hover {
  color: var(--link-hover);
}

.public-link-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}

.public-link-row a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy-link-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.2rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}

.copy-link-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.copy-link-check {
  display: none;
}

.copy-link-btn.is-copied {
  color: var(--flash-success-text);
}

.copy-link-btn.is-copied .copy-link-icon {
  display: none;
}

.copy-link-btn.is-copied .copy-link-check {
  display: block;
}

.form input,
.form select,
.form textarea {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--input-bg);
  color: var(--text);
  outline: none;
  box-shadow: none;
}

.form input:hover,
.form select:hover,
.form textarea:hover {
  outline: none;
  box-shadow: none;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.form input:focus-visible,
.form select:focus-visible,
.form textarea:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: var(--accent);
}

.form .btn {
  margin-top: 0.25rem;
  text-align: center;
}

.auth-card .form .btn {
  width: 100%;
}

.form-panel {
  max-width: 28rem;
}

.form-panel-wide {
  max-width: 42rem;
}

.form-section-title {
  margin: 1.15rem 0 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.form-panel .form-section-title:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.form-row-2 {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 520px) {
  .form-row-2 {
    grid-template-columns: 1fr 1fr;
  }
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.form-errors {
  margin: 0 0 1rem;
  padding: 0.75rem;
  list-style: none;
  border-radius: var(--radius);
  border: 1px solid var(--flash-error-border);
  background: var(--flash-error-bg);
  color: var(--flash-error-text);
}

.form-errors li {
  margin: 0;
  padding: 0;
  list-style: none;
}

.form-errors li + li {
  margin-top: 0.35rem;
}

.form-foot {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.page h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-header h1 {
  margin-bottom: 0.25rem;
}

.page-header .lede {
  margin-bottom: 0;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.form-section-note {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.client-view-grid {
  display: grid;
  gap: 1.25rem;
  margin: 0 0 1.75rem;
}

.client-card {
  max-width: none;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

@media (min-width: 720px) {
  .client-view-grid {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.client-kv {
  margin: 0;
}

.client-kv dt {
  margin: 0.7rem 0 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.client-kv dt:first-child {
  margin-top: 0;
}

.client-kv dd {
  margin: 0;
}

.client-notes {
  white-space: pre-wrap;
}

.td-actions {
  text-align: right;
  white-space: nowrap;
}

.form textarea {
  resize: vertical;
  min-height: 5rem;
}

/* Tables (clients / invoices later) */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.data th,
table.data td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

table.data th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

table.data tr:last-child td {
  border-bottom: none;
}

table.data tr:hover td {
  background: var(--table-hover);
}

/* Account area */
.account-shell {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 720px) {
  .account-shell {
    grid-template-columns: 11.5rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
  }
}

.account-nav {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.account-nav-title {
  margin: 0 0 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.account-nav a {
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.95rem;
}

.account-nav a:hover {
  background: var(--surface-2);
  color: var(--link-hover);
  text-decoration: none;
}

.account-nav a.is-active {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-weight: 600;
}

.account-main {
  min-width: 0;
}

.account-cards {
  display: grid;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

@media (min-width: 640px) {
  .account-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.account-card {
  display: block;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease,
    box-shadow 0.16s ease,
    color 0.16s ease;
}

.account-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: inherit;
}

.account-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.account-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.account-card-meta {
  margin-top: 0.55rem !important;
  font-size: 0.85rem !important;
  color: var(--link) !important;
}

.panel-muted {
  margin-top: 1rem;
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel-muted p {
  margin: 0 0 0.5rem;
}

.panel-muted p:last-child {
  margin-bottom: 0;
}

.dash-onboard-steps {
  margin: 0.45rem 0 0;
  padding-left: 1.25rem;
  line-height: 1.55;
}

a.nav-user:hover {
  color: var(--link-hover);
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 0.65rem;
  font-weight: 400 !important;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}

.check-row input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* Preferences / Business: same brand accent when checked */
.form input[type="checkbox"] {
  accent-color: var(--accent);
}

.check-row strong {
  display: block;
  font-size: 0.95rem;
}

.check-help {
  display: block;
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.panel-danger {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--flash-error-border);
  background: var(--flash-error-bg);
  color: var(--flash-error-text);
  border-radius: var(--radius);
}

.panel-danger p {
  margin: 0 0 0.4rem;
}

.panel-danger p:last-child {
  margin-bottom: 0;
}

/* Invoice locked (paid / void) — amber notice, both themes */
:root .panel-locked,
html[data-theme="light"] .panel-locked {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid #f0c674;
  background: #fffbeb;
  color: #78350f;
  border-radius: var(--radius);
}

html[data-theme="dark"] .panel-locked {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid #92400e;
  background: #292116;
  color: #fde68a;
  border-radius: var(--radius);
}

.panel-locked p {
  margin: 0 0 0.4rem;
}

.panel-locked p:last-child {
  margin-bottom: 0;
}

:root .panel-locked-detail,
html[data-theme="light"] .panel-locked-detail {
  margin: 0;
  font-size: 0.9rem;
  color: #92400e;
}

html[data-theme="dark"] .panel-locked-detail {
  margin: 0;
  font-size: 0.9rem;
  color: #fcd34d;
}

.btn-danger {
  background: #b91c1c;
  color: #fff;
}

.btn-danger:hover {
  background: #991b1b;
  color: #fff;
}

.account-card-danger {
  border-color: var(--flash-error-border);
}

.account-card-danger h2 {
  color: var(--flash-error-text);
}

.account-nav a[href="/account/delete"] {
  color: var(--status-blocked-text);
}

.account-nav a[href="/account/delete"]:hover {
  color: var(--status-void-text);
  background: var(--status-void-bg);
}

.account-main a:not(.btn):not(.account-card) {
  color: var(--link);
}

.account-main a:not(.btn):not(.account-card):hover {
  color: var(--link-hover);
}

.account-subhead {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.1rem;
}

.totp-setup {
  margin: 1rem 0 1.5rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  max-width: 22rem;
}

.totp-qr {
  display: inline-block;
  padding: 0.75rem;
  background: #fff;
  border-radius: var(--radius);
  line-height: 0;
}

.totp-qr img {
  display: block;
  width: 200px;
  height: 200px;
}

.totp-secret code {
  font-size: 0.9rem;
  word-break: break-all;
  user-select: all;
}

.backup-codes {
  list-style: none;
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 22rem;
}

.backup-codes code {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* Themed confirm dialog (replaces browser confirm) */
.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(0, 0, 0, 0.55);
}

.confirm-backdrop[hidden] {
  display: none !important;
}

.confirm-dialog {
  width: 100%;
  max-width: 22rem;
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.confirm-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.confirm-message {
  margin: 0 0 1.15rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.badge-status-draft {
  background: var(--status-draft-bg);
  color: var(--status-draft-text);
  text-transform: uppercase;
}

.badge-status-sent {
  background: var(--status-sent-bg);
  color: var(--status-sent-text);
  text-transform: uppercase;
}

.badge-status-paid {
  background: var(--status-paid-bg);
  color: var(--status-paid-text);
  text-transform: uppercase;
}

.badge-status-void {
  background: var(--status-void-bg);
  color: var(--status-void-text);
  text-transform: uppercase;
}

.badge-status-overdue,
.invoice-public-status .badge-overdue {
  background: var(--status-void-bg);
  color: var(--status-void-text);
  text-transform: uppercase;
}

/* —— Public invoice (/i/…) client polish —— */
.invoice-public {
  max-width: 42rem;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.invoice-public-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.invoice-public-brand {
  margin: 0;
  text-align: left;
}

.invoice-public-pdf {
  flex-shrink: 0;
}

.invoice-sheet {
  max-width: none;
  margin: 0;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(26, 35, 80, 0.07);
}

.invoice-sheet-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.invoice-public-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.invoice-sheet-head h1 {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.invoice-public-status {
  margin: 0;
}

.invoice-dates {
  text-align: right;
}

.invoice-seller-logo {
  margin: 0 0 0.65rem;
  text-align: right;
}

.invoice-seller-logo img {
  max-width: 8.5rem;
  max-height: 3.5rem;
  width: auto;
  height: auto;
  object-fit: contain;
}

.invoice-dates p {
  margin: 0.2rem 0;
}

/* Same white as sheet — no surface-2 / tinted fills */
.invoice-public-total-block {
  margin: 0 0 1.5rem;
  padding: 0 0 1.35rem;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: center;
}

.invoice-public-total-label {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.invoice-public-total-value {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.15;
}

.invoice-public .invoice-parties {
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--border);
}

.invoice-party {
  margin-bottom: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.invoice-party p {
  margin: 0.15rem 0;
}

.invoice-party-label {
  margin: 0 0 0.45rem;
  padding: 0;
  border: none;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.invoice-party-name {
  font-weight: 600;
  color: var(--text);
}

.invoice-body {
  margin-bottom: 1.25rem;
}

.invoice-body-text {
  margin: 0.35rem 0 0;
  white-space: pre-wrap;
}

.invoice-totals {
  max-width: 18rem;
  margin-left: auto;
  margin-bottom: 0.25rem;
}

.invoice-totals-grand th {
  font-size: 1.05rem;
  padding-top: 0.65rem;
}

.invoice-public-pay {
  margin-top: 1.5rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.invoice-public-pay-btn {
  width: 100%;
  max-width: 22rem;
  padding: 0.85rem 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.invoice-public-pay-hint {
  margin: 0.65rem 0 0;
}

.invoice-public-paid {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  background: var(--status-paid-bg);
  border: 1px solid color-mix(in srgb, var(--status-paid-text) 22%, transparent);
  text-align: center;
}

.invoice-public-paid-title {
  margin: 0 0 0.25rem;
  font-weight: 700;
  color: var(--status-paid-text);
}

.invoice-public-paid .meta {
  margin: 0;
  color: var(--status-paid-text);
  opacity: 0.9;
}

.invoice-public-note {
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  border-radius: 10px;
  background: var(--status-draft-bg);
  text-align: center;
}

.invoice-public-note p {
  margin: 0;
}

.invoice-public-note-overdue {
  background: var(--status-overdue-bg);
  color: var(--status-overdue-text);
}

.invoice-public-overdue-msg {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: var(--status-overdue-text);
}

.invoice-public-due-overdue {
  color: var(--status-overdue-text);
  font-weight: 600;
}

/* Same width + card chrome as .invoice-sheet (not 40rem comments default) */
.invoice-public .comments-panel,
.invoice-public-comments {
  width: 100%;
  max-width: none;
  margin-top: 1.25rem;
  margin-left: 0;
  margin-right: 0;
  padding: 1.75rem 1.5rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(26, 35, 80, 0.07);
  box-sizing: border-box;
}

.invoice-public-comments > h2 {
  font-size: 1.15rem;
}

@media (max-width: 639px) {
  .invoice-sheet,
  .invoice-public .comments-panel,
  .invoice-public-comments {
    padding: 1.35rem 1.1rem 1.25rem;
  }

  .invoice-dates {
    text-align: left;
    width: 100%;
  }

  .invoice-seller-logo {
    text-align: left;
  }

  .invoice-public-total-value {
    font-size: 1.65rem;
  }

  .invoice-public-pay-btn {
    max-width: none;
  }
}

/* Legacy class if any old markup remains */
.invoice-bill-to {
  margin-bottom: 1.25rem;
}

.invoice-bill-to p {
  margin: 0.15rem 0;
}

.form select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  background: var(--input-bg);
  color: var(--text);
}

/* —— Custom dropdown (k-select) —— */
.form select.k-select-native,
.form select.country-select.k-select-native {
  /* Keep in form for submit; hide from layout */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.k-select {
  position: relative;
  width: 100%;
}

.k-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease;
  box-shadow: none;
}

.k-select-trigger:hover {
  border-color: var(--accent);
}

/* No glow / ring — border only (matches form inputs) */
.k-select.is-open .k-select-trigger,
.k-select-trigger:focus,
.k-select-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

.k-select.is-invalid .k-select-trigger {
  border-color: var(--flash-error-border);
  box-shadow: none;
}

.k-select-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-select-label.is-placeholder {
  color: var(--muted);
}

.k-select-chevron {
  flex-shrink: 0;
  display: flex;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.k-select.is-open .k-select-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.k-select-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  max-height: min(18rem, 55vh);
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.k-select-panel[hidden] {
  display: none !important;
}

.k-select-search {
  width: 100%;
  margin: 0 0 0.35rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.k-select-search:focus,
.k-select-search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

.k-select-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.k-select-group {
  margin: 0.35rem 0 0.15rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

.k-select-option {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border-radius: calc(var(--radius) - 2px);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.3;
}

.k-select-option:hover,
.k-select-option:focus {
  background: var(--surface-2);
  outline: none;
}

.k-select-option.is-selected {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  color: var(--text);
  font-weight: 600;
}

.k-select-option.is-selected:hover {
  background: color-mix(in srgb, var(--accent) 30%, var(--surface));
}

html[data-theme="light"] .k-select-panel {
  box-shadow: 0 10px 28px rgba(15, 20, 40, 0.12);
}

/* —— Custom date picker (k-date) —— */
.form input[type="date"].k-date-native,
.form input.date-input.k-date-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.k-date {
  position: relative;
  width: 100%;
}

.k-date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s ease;
  box-shadow: none;
}

.k-date-trigger:hover {
  border-color: var(--accent);
}

.k-date.is-open .k-date-trigger,
.k-date-trigger:focus,
.k-date-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

.k-date-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.k-date-label.is-placeholder {
  color: var(--muted);
}

.k-date-icon {
  flex-shrink: 0;
  display: flex;
  color: var(--muted);
}

.k-date.is-open .k-date-icon {
  color: var(--accent);
}

.k-date-panel {
  position: absolute;
  z-index: 45;
  top: calc(100% + 4px);
  left: 0;
  width: min(100%, 17.5rem);
  padding: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.k-date-panel[hidden] {
  display: none !important;
}

.k-date-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.k-date-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.k-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--input-bg);
  color: var(--text);
  cursor: pointer;
}

.k-date-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.k-date-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
  margin-bottom: 0.25rem;
}

.k-date-wd {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.2rem 0;
}

.k-date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.15rem;
}

.k-date-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 2rem;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.k-date-day.is-empty {
  pointer-events: none;
  visibility: hidden;
}

.k-date-day:hover {
  background: var(--surface-2);
}

.k-date-day.is-today {
  box-shadow: inset 0 0 0 1px var(--accent);
  color: var(--link);
  font-weight: 600;
}

.k-date-day.is-selected {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  box-shadow: none;
}

.k-date-day.is-selected:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.k-date-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.k-date-action {
  margin: 0;
  padding: 0.3rem 0.5rem;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--link);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.k-date-action:hover {
  color: var(--link-hover);
  background: var(--surface-2);
}

html[data-theme="light"] .k-date-panel {
  box-shadow: 0 10px 28px rgba(15, 20, 40, 0.12);
}

.filter-links a.is-active-filter {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

/* List search (clients + invoices) */
.list-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin: 0 0 1rem;
  max-width: 36rem;
}

.list-search-label {
  flex: 1 1 12rem;
  min-width: 0;
  margin: 0;
}

.list-search input[type="search"] {
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  min-height: 2.4rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.25;
}

.list-search input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: none;
}

/* Same height as search field (override btn-small) */
.list-search .btn,
.list-search .btn-small {
  margin: 0;
  box-sizing: border-box;
  min-height: 2.4rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.95rem;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.badge-client-active {
  background: var(--status-active-bg);
  color: var(--status-active-text);
  text-transform: uppercase;
}

.badge-client-archived {
  background: var(--status-archived-bg);
  color: var(--status-archived-text);
  text-transform: uppercase;
}

.badge-client-blocked {
  background: var(--status-blocked-bg);
  color: var(--status-blocked-text);
  text-transform: uppercase;
}

/* Client priority */
.badge-priority-normal {
  background: var(--status-draft-bg);
  color: var(--status-draft-text);
  text-transform: none;
  font-weight: 600;
}

.badge-priority-preferred {
  background: var(--status-paid-bg);
  color: var(--status-paid-text);
  text-transform: none;
  font-weight: 600;
}

.badge-priority-at_risk {
  background: var(--status-void-bg);
  color: var(--status-void-text);
  text-transform: none;
  font-weight: 600;
}

/* Clients list: slightly tighter than default (still taller than invoices due to email line) */
table.data-clients th,
table.data-clients td {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}

.data-clients .td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-clients .table-sub {
  margin-top: 0.08rem;
  font-size: 0.8rem;
  line-height: 1.3;
}

.data-clients .is-money-out {
  color: var(--flash-error-text);
  font-weight: 600;
}

/* Invoices list */
.data-invoices .td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-invoices .is-date-overdue {
  color: var(--flash-error-text);
  font-weight: 600;
}

.data-invoices tr.is-row-overdue {
  background: color-mix(in srgb, var(--flash-error-bg) 55%, transparent);
}

.badge-overdue {
  background: var(--status-void-bg);
  color: var(--status-void-text);
  text-transform: uppercase;
  margin-left: 0.25rem;
  font-size: 0.7rem;
}

/* Clickable dashboard stats */
a.dash-stat {
  text-decoration: none;
  color: inherit;
  transition: border-color 0.16s ease;
}

a.dash-stat:hover {
  text-decoration: none;
  color: inherit;
  box-shadow: none;
}

/* Cash cards: deepen border on hover */
html[data-theme="light"] a.dash-stat--money:hover {
  border-color: #0891b2;
}
html[data-theme="dark"] a.dash-stat--money:hover {
  border-color: #5eead4;
}

html[data-theme="light"] a.dash-stat--overdue:hover {
  border-color: #b91c1c;
}
html[data-theme="dark"] a.dash-stat--overdue:hover {
  border-color: #fca5a5;
}

html[data-theme="light"] a.dash-stat--paid:hover {
  border-color: #15803d;
}
html[data-theme="dark"] a.dash-stat--paid:hover {
  border-color: #86efac;
}

/* Count cards (clients / all invoices / paid-count): accent border on hover */
a.dash-stat--clients:hover,
a.dash-stat--invoices:hover,
a.dash-stat--paid-count:hover {
  border-color: var(--accent);
}

.invoice-parties {
  display: grid;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .invoice-parties {
    grid-template-columns: 1fr 1fr;
  }
}

.comments-block,
.comments-panel {
  margin-top: 2rem;
  max-width: 40rem;
}

.comments-panel {
  padding: 1.25rem 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comments-panel > h2 {
  margin: 0 0 0.35rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.comments-panel > .lede {
  margin-bottom: 1rem;
}

.comment-list {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.comment-item {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comment-meta {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.comment-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Dashboard */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.dash-stats--cash {
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
}

.dash-stats--counts {
  margin-top: 0.75rem;
}

.dash-stat {
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dash-stat-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.3;
  margin-top: 0.1rem;
}

.dash-stat-icon {
  display: flex;
  margin-bottom: 0.2rem;
  color: var(--muted);
}

/*
  Calm default for counts; only highlight money-related stats:
  sent (needs attention) · paid (good) · outstanding (money)
*/
.dash-stat--clients .dash-stat-icon,
.dash-stat--invoices .dash-stat-icon {
  color: var(--accent);
}

/* Sent unpaid — slate fill; same hover as other count cards (accent border) */
a.dash-stat.dash-stat--sent {
  background: #eef1f7;
  border-color: #c5cde0;
}

a.dash-stat.dash-stat--sent .dash-stat-icon,
a.dash-stat.dash-stat--sent .dash-stat-value {
  color: #455a7a;
}

html[data-theme="dark"] a.dash-stat.dash-stat--sent {
  background: #1e2433;
  border-color: #3d4a66;
}

html[data-theme="dark"] a.dash-stat.dash-stat--sent .dash-stat-icon,
html[data-theme="dark"] a.dash-stat.dash-stat--sent .dash-stat-value {
  color: #a8b8d8;
}

/* Same line as clients / all invoices / paid: accent border on hover */
a.dash-stat.dash-stat--sent:hover,
a.dash-stat.dash-stat--sent:focus-visible {
  border-color: var(--accent) !important;
}

html[data-theme="dark"] a.dash-stat.dash-stat--sent:hover,
html[data-theme="dark"] a.dash-stat.dash-stat--sent:focus-visible {
  border-color: var(--accent-hover) !important;
}

/*
  Cash row (first 3): soft tinted fill so cards sit on #eef1fb / dark bg.
  Meaning: Outstanding (teal) · Overdue (red) · Paid (green).
*/
/* Paid — calm green */
:root .dash-stat--paid,
html[data-theme="light"] .dash-stat--paid {
  background: #f3faf5;
  border-color: #86d4a0;
}

:root .dash-stat--paid .dash-stat-icon,
:root .dash-stat--paid .dash-stat-value,
html[data-theme="light"] .dash-stat--paid .dash-stat-icon,
html[data-theme="light"] .dash-stat--paid .dash-stat-value {
  color: #166534;
}

html[data-theme="dark"] .dash-stat--paid {
  background: #15241c;
  border-color: #3d7a52;
}

html[data-theme="dark"] .dash-stat--paid .dash-stat-icon,
html[data-theme="dark"] .dash-stat--paid .dash-stat-value {
  color: #8fd9a8;
}

/* Outstanding — teal (money waiting), not neon */
:root .dash-stat--money,
html[data-theme="light"] .dash-stat--money {
  background: #f0f9fb;
  border-color: #5bc0d4;
}

:root .dash-stat--money .dash-stat-icon,
:root .dash-stat--money .dash-stat-value,
html[data-theme="light"] .dash-stat--money .dash-stat-icon,
html[data-theme="light"] .dash-stat--money .dash-stat-value {
  color: #0e7490;
}

html[data-theme="dark"] .dash-stat--money {
  background: #142428;
  border-color: #3a7a80;
}

html[data-theme="dark"] .dash-stat--money .dash-stat-icon,
html[data-theme="dark"] .dash-stat--money .dash-stat-value {
  color: #5eead4;
}

/* Overdue — soft red (needs action) */
:root .dash-stat--overdue,
html[data-theme="light"] .dash-stat--overdue {
  background: #fff6f6;
  border-color: #e89a9a;
}

:root .dash-stat--overdue .dash-stat-icon,
:root .dash-stat--overdue .dash-stat-value,
html[data-theme="light"] .dash-stat--overdue .dash-stat-icon,
html[data-theme="light"] .dash-stat--overdue .dash-stat-value {
  color: #b91c1c;
}

html[data-theme="dark"] .dash-stat--overdue {
  background: #241618;
  border-color: #8a4048;
}

html[data-theme="dark"] .dash-stat--overdue .dash-stat-icon,
html[data-theme="dark"] .dash-stat--overdue .dash-stat-value {
  color: #ff9a9f;
}

/* Paid (all count) — quieter green tint */
html[data-theme="dark"] .dash-stat--paid-count .dash-stat-icon {
  color: #7ddea0;
}

html[data-theme="light"] .dash-stat--paid-count .dash-stat-icon {
  color: #166534;
}

.dash-stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.dash-stat-money {
  font-size: 1.1rem;
}

.dash-stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.billing-card {
  padding: 1.15rem 1.25rem;
}

.billing-plan-name {
  margin: 0.25rem 0 0.15rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.billing-status-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.billing-status-line .badge {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.billing-plans-intro {
  margin: 0 0 1rem;
  max-width: 36rem;
}

.billing-interval-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.25rem;
  margin: 0 0 1.15rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.billing-interval-btn {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  outline: none;
  box-shadow: none;
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.billing-interval-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.billing-interval-btn:focus,
.billing-interval-btn:focus-visible {
  outline: none;
  box-shadow: none;
}

.billing-interval-btn.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.billing-interval-btn.is-active:hover {
  background: var(--accent-hover);
  color: var(--accent-contrast);
}

.billing-save-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.billing-interval-btn:not(.is-active) .billing-save-pill {
  background: var(--badge-bg);
  color: var(--badge-text);
}

.billing-plans {
  display: grid;
  gap: 1rem;
  margin-top: 0.25rem;
}

@media (min-width: 640px) {
  .billing-plans {
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }
}

.billing-plan-option,
.billing-plan-card {
  padding: 1.2rem 1.25rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: relative;
  transition:
    border-color 0.16s ease,
    background-color 0.16s ease;
}

.billing-plan-card:hover {
  border-color: var(--accent);
}

.billing-plan-card--featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.billing-plan-card--featured:hover {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 1px var(--accent-hover);
}

.billing-plan-card--current {
  border-color: var(--accent);
  background: var(--surface);
}

.billing-plan-card--current:hover {
  border-color: var(--accent);
}

.billing-plan-cta:disabled {
  opacity: 0.7;
  cursor: default;
}

.billing-plan-badge {
  margin: 0 0 0.35rem;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-text);
}

.billing-plan-option-name {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
}

.billing-plan-price {
  margin: 0.15rem 0 0;
  line-height: 1.2;
}

.billing-price-amount {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

.billing-price-period {
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}

.billing-price-year-hint {
  margin: 0;
  font-size: 0.85rem;
}

.billing-plan-blurb {
  margin: 0.35rem 0 0.5rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
}

.billing-feature-list {
  margin: 0.25rem 0 0.85rem;
  padding: 0 0 0 1.15rem;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
  flex: 1;
}

.billing-feature-list li {
  margin: 0.2rem 0;
}

.billing-checkout-form {
  margin-top: auto;
  padding-top: 0.35rem;
}

.billing-plan-cta {
  width: 100%;
  text-align: center;
}

.dash-attention {
  margin-top: 0.5rem;
}

.dash-attention .dash-section-title {
  margin-top: 1.5rem;
  margin-bottom: 1px;
}

.dash-notes {
  margin-top: 0.25rem;
}

.dash-notes .dash-section-title {
  margin-top: 1.35rem;
  margin-bottom: 0;
}

.dash-notes > .meta {
  margin: 0.25rem 0 0.45rem;
}

.dash-notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.dash-notes-item {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.dash-notes-item:last-child {
  border-bottom: none;
}

.dash-notes-link {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 0.75rem;
  padding: 0.45rem 0.75rem;
  text-decoration: none;
  color: inherit;
}

.dash-notes-link:hover {
  background: var(--surface-2, var(--badge-bg));
  text-decoration: none;
}

.dash-notes-who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
}

.dash-notes-who strong {
  font-weight: 600;
}

.dash-notes-preview {
  min-width: 0;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-notes-when {
  white-space: nowrap;
  font-size: 0.82rem;
}

@media (max-width: 640px) {
  /* Stack: name, then date under name (left), then preview */
  .dash-notes-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.55rem 0.75rem;
  }

  .dash-notes-who {
    width: 100%;
    white-space: nowrap;
  }

  .dash-notes-when {
    order: 2;
    font-size: 0.78rem;
  }

  .dash-notes-preview {
    order: 3;
    width: 100%;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .dash-notes-who {
    order: 1;
  }
}

.dash-section-title {
  margin: 1.75rem 0 0.85rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.dash-action {
  position: relative;
  padding-top: 1.15rem;
}

.dash-action-icon {
  display: inline-flex;
  margin-bottom: 0.45rem;
  color: var(--accent);
}

/* At a glance charts (CSS only — no chart library) */
.dash-charts {
  display: grid;
  gap: 1rem;
  margin-top: 0.25rem;
}

@media (min-width: 720px) {
  .dash-charts {
    grid-template-columns: 1.4fr 1fr;
  }
}

.dash-chart-card {
  padding: 1.1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.dash-chart-title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.dash-bars {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.dash-bar-row {
  display: grid;
  grid-template-columns: 3.5rem 1fr 5.5rem;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.8rem;
}

.dash-bar-label {
  color: var(--muted);
  font-weight: 600;
}

.dash-bar-track {
  height: 0.55rem;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.dash-bar-fill {
  height: 100%;
  min-width: 0;
  background: var(--accent);
  border-radius: 999px;
}

.dash-bar-value {
  text-align: right;
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.dash-mix {
  display: flex;
  height: 0.85rem;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.85rem;
  background: var(--surface-2);
}

.dash-mix-seg {
  min-width: 0;
}

.dash-mix-seg--paid {
  background: #2f6b45;
}

.dash-mix-seg--sent {
  background: #5c6bc0;
}

.dash-mix-seg--draft {
  background: #6b7280;
}

.dash-mix-seg--void {
  background: #b91c1c;
}

html[data-theme="light"] .dash-mix-seg--paid {
  background: #22c55e;
}

html[data-theme="light"] .dash-mix-seg--sent {
  background: #3f51b5;
}

html[data-theme="light"] .dash-mix-seg--draft {
  background: #9ca3af;
}

html[data-theme="light"] .dash-mix-seg--void {
  background: #ef4444;
}

.dash-mix-legend {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.dash-mix-legend li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dash-mix-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

/* —— List pagination —— */
.list-pagination-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  margin-top: 0.9rem;
}

.list-pagination-count {
  margin: 0;
}

.list-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
}

.list-pagination-pages {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
  margin: 0;
  padding: 0 0.15rem;
}

.list-pagination .btn.is-disabled,
.list-pagination .btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

/* Styled file input — Kontain button + filename (hides native Browse…) */
.file-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.file-field-label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.file-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.file-field-btn {
  position: relative;
  margin: 0;
  cursor: pointer;
  overflow: hidden;
}

.file-field-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.file-field-name {
  margin: 0;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Account → Business logo */
.business-logo-help {
  margin-bottom: 0.35rem;
}

.business-logo-current {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 0.35rem;
}

.business-logo-img {
  display: block;
  max-width: 7.5rem;
  max-height: 3.75rem;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
  background: #fff;
}

/* Business logo remove — plain label (not a card row) */
.form label.business-logo-remove {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

.form label.business-logo-remove input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* AI helpers (invoice Improve wording / client Summarize notes) */
.ai-desc-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: -0.35rem 0 0.85rem;
}

.ai-desc-row > .meta,
.ai-desc-row > [id$="-status"] {
  margin: 0;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
}

.ai-desc-row > .btn {
  flex-shrink: 0;
  align-self: center;
}

.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-badge {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent-contrast);
  background: var(--accent);
  vertical-align: middle;
}

.btn-ai:disabled .ai-badge {
  opacity: 0.75;
}

/* Locked invoice (paid / void) */
.form-locked input[readonly],
.form-locked textarea[readonly],
.form-locked select:disabled {
  opacity: 0.92;
  cursor: default;
  background: var(--surface-2);
}
