/* Dashboard shell — aligned with Next.js AppLayout */
:root {
  /* Success / accent pink — parity with Next.js globals.css */
  --erechnung-success: #ec4899;
  --erechnung-success-hover: #db2777;
  --erechnung-success-bg: #fdf2f8;
  --erechnung-success-border: #fbcfe8;
  --erechnung-success-fg: #831843;
  --erechnung-success-light: #fce7f3;
}

html {
  overflow-x: hidden;
  max-width: 100%;
}

.erechnung-app,
.erechnung-public-body,
.erechnung-auth-body,
.erechnung-legal-page {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.erechnung-public-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #f9fafb;
  color: #0f172a;
  box-sizing: border-box;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

.erechnung-public-body > * {
  min-width: 0;
  max-width: 100%;
}

.erechnung-app {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to bottom, #f8fafc, #f1f5f9);
  color: #0f172a;
  box-sizing: border-box;
}

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

.erechnung-dash-shell {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  min-width: 0;
  width: 100%;
  overflow-x: clip;
}

/* Sticky header + nav as one block (avoids nav offset drift on mobile wrap). */
.erechnung-dash-top {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  flex-shrink: 0;
  overflow: visible;
}

.erechnung-dash-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: radial-gradient(circle at top, #132d72 0%, #0f1f4d 38%, #0b132e 100%);
  color: #fff;
}

.erechnung-dash-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;
}

.erechnung-dash-brand {
  flex-shrink: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.erechnung-brand-logo--mobile {
  display: none;
}

@media (max-width: 767px) {
  .erechnung-brand-logo--desktop {
    display: none;
  }

  .erechnung-brand-logo--mobile {
    display: block;
  }
}

.erechnung-dash-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
}

.erechnung-dash-header-actions-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.erechnung-dash-header-actions-scroll::-webkit-scrollbar {
  display: none;
}

.erechnung-dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  min-width: 7.5rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.erechnung-dash-logout-form {
  display: inline;
  margin: 0;
}

.erechnung-dash-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.erechnung-dash-btn--admin {
  border-color: rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
}

.erechnung-dash-btn--admin:hover {
  background: rgba(251, 191, 36, 0.22);
}

.erechnung-dash-user {
  display: none;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  max-width: min(200px, 32vw);
  height: 2.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  flex-shrink: 1;
  overflow: hidden;
}

@media (min-width: 640px) {
  .erechnung-dash-user {
    display: inline-flex;
  }
}

.erechnung-dash-user-meta {
  min-width: 0;
  font-size: 0.75rem;
}

.erechnung-dash-user-icon {
  flex-shrink: 0;
  color: #e2e8f0;
}

.erechnung-dash-user-meta strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erechnung-dash-user-meta span {
  display: block;
  font-size: 0.75rem;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erechnung-dash-nav {
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  width: 100%;
}

.erechnung-dash-nav-outer {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.625rem 1rem;
}

@media (min-width: 640px) {
  .erechnung-dash-nav-outer {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.erechnung-dash-nav-inner {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scroll-padding-inline: 0.5rem;
}

.erechnung-dash-nav-inner::-webkit-scrollbar {
  height: 4px;
}

/* Public / landing header (Next PublicHeader parity) */
.erechnung-public-header {
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: radial-gradient(circle at top, #132d72 0%, #0f1f4d 38%, #0b132e 100%);
  color: #fff;
}

.erechnung-public-header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: nowrap;
}

@media (min-width: 640px) {
  .erechnung-public-header-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.erechnung-public-header-brand {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  text-decoration: none;
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.erechnung-public-header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  justify-content: flex-end;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
}

.erechnung-public-header-nav-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.erechnung-public-header-nav-scroll::-webkit-scrollbar {
  display: none;
}

.erechnung-public-header-form {
  display: inline;
  margin: 0;
  flex-shrink: 0;
}

.erechnung-public-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1.25;
}

.erechnung-public-header-btn-ghost {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
}

.erechnung-public-header-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

.erechnung-public-header-btn-primary {
  background: #7c3aed;
  color: #fff;
  font-weight: 600;
}

.erechnung-public-header-btn-primary:hover {
  background: #6d28d9;
}

/* Language switcher (dashboard + public headers) */
.erechnung-lang {
  position: relative;
  flex-shrink: 0;
  z-index: 120;
}

.erechnung-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 0.75rem;
  border-radius: 0.75rem;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.erechnung-lang-trigger-dark {
  color: #fff;
  background: transparent;
}

.erechnung-lang-trigger-dark:hover {
  background: rgba(255, 255, 255, 0.1);
}

.erechnung-lang-trigger-light {
  color: #475569;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.erechnung-lang-trigger-light:hover {
  background: #f8fafc;
}

.erechnung-lang-label {
  display: none;
}

@media (min-width: 640px) {
  .erechnung-lang-label {
    display: inline;
  }
}

.erechnung-lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 10rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  z-index: 10000;
  pointer-events: auto;
}

.erechnung-lang.open .erechnung-lang-menu {
  display: block;
}

.erechnung-lang.open .erechnung-lang-menu.is-fixed {
  position: fixed;
}

.erechnung-dash-header-actions .erechnung-lang-menu,
.erechnung-public-header-nav .erechnung-lang-menu {
  background: #0f1f4d;
  border-color: rgba(255, 255, 255, 0.15);
}

.erechnung-lang-menu a {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: #334155;
  text-decoration: none;
}

.erechnung-dash-header-actions .erechnung-lang-menu a,
.erechnung-public-header-nav .erechnung-lang-menu a {
  color: #cbd5e1;
}

.erechnung-lang-menu a:hover,
.erechnung-lang-menu a.active {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 500;
}

.erechnung-dash-header-actions .erechnung-lang-menu a:hover,
.erechnung-dash-header-actions .erechnung-lang-menu a.active,
.erechnung-public-header-nav .erechnung-lang-menu a:hover,
.erechnung-public-header-nav .erechnung-lang-menu a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

@media (max-width: 767px) {
  .erechnung-dash-header-inner {
    padding: 1rem;
    flex-wrap: nowrap;
  }

  .erechnung-public-header-inner {
    padding: 1rem;
  }

  .erechnung-dash-brand {
    font-size: 1.125rem;
    max-width: 38vw;
  }

  .erechnung-dash-btn {
    min-width: auto;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
  }

  .erechnung-public-header-brand {
    font-size: 1.25rem;
    max-width: 40vw;
  }

  .erechnung-public-header-btn {
    padding: 0 0.75rem;
    font-size: 0.8125rem;
  }

  .erechnung-dash-main {
    padding: 1rem;
  }

  .erechnung-editor-tabs-row {
    flex-direction: column;
    align-items: stretch;
    overflow-x: visible;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
  }

  .erechnung-editor-tabs {
    width: 100%;
    display: flex;
    flex-shrink: 1;
  }

  .erechnung-editor-tab {
    flex: 1 1 0;
    text-align: center;
    padding: 0.625rem 0.5rem;
    min-height: 2.75rem;
  }

  .erechnung-editor-toolbar-actions {
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
    justify-content: stretch;
    flex-shrink: 1;
  }

  .erechnung-export-dropdown {
    flex: 1 1 100%;
    width: 100%;
  }

  .erechnung-export-trigger {
    width: 100%;
    justify-content: center;
    min-height: 2.75rem;
  }

  .erechnung-editor-progress {
    width: 100%;
    flex-shrink: 1;
  }

  .erechnung-editor-status-card {
    width: 100%;
  }

  .erechnung-doc-type-badge {
    width: 100%;
    justify-content: center;
  }

  .erechnung-editor-preview-panel,
  .erechnung-preview-scroll {
    max-width: 100%;
    min-width: 0;
  }

  .erechnung-preview-scroll {
    padding: 0.5rem;
    overflow-x: auto;
    justify-content: flex-start;
  }

  .erechnung-preview-scroll .erechnung-a4-preview {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: auto;
    padding: 12px;
    font-size: 8pt;
    box-sizing: border-box;
  }

  .erechnung-preview-scroll .erechnung-doc-preview {
    width: 640px;
    max-width: none;
    min-width: 640px;
    min-height: auto;
    padding: 1.5rem 1.75rem;
    font-size: 11px;
    box-sizing: border-box;
  }

  .erechnung-doc-title {
    font-size: clamp(1.25rem, 7vw, 2.5rem);
  }

  .erechnung-doc-top {
    flex-direction: column;
    align-items: flex-start;
    min-height: 0;
  }

  .erechnung-doc-address-row {
    grid-template-columns: 1fr;
  }

  .erechnung-doc-table-head,
  .erechnung-doc-table-row {
    grid-template-columns: 20px 1fr 36px 32px 48px 28px 44px;
    gap: 0.2rem;
    padding: 0.25rem 0.3rem;
    font-size: 9px;
  }

  .erechnung-ios-grid-4,
  .erechnung-ios-grid-3 {
    grid-template-columns: 1fr;
  }

  .erechnung-site-footer-inner {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .erechnung-editor-toast {
    left: 1rem;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
    text-align: center;
  }
}

.erechnung-dash-nav a {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
}

.erechnung-dash-nav a:hover {
  background: #f1f5f9;
}

.erechnung-dash-nav a.active {
  background: #0f172a;
  color: #fff;
}

.erechnung-dash-nav a.active .erechnung-dash-nav-icon {
  color: #fff;
}

.erechnung-dash-nav-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  color: #64748b;
}

.erechnung-dash-nav-outer::before,
.erechnung-dash-nav-outer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.erechnung-dash-nav-outer::before {
  left: 0;
  background: linear-gradient(to right, rgba(255, 255, 255, 0.98), transparent);
}

.erechnung-dash-nav-outer::after {
  right: 0;
  background: linear-gradient(to left, rgba(255, 255, 255, 0.98), transparent);
}

.erechnung-dash-nav-outer:has(.can-scroll-left)::before {
  opacity: 1;
}

.erechnung-dash-nav-outer:has(.can-scroll-right)::after {
  opacity: 1;
}

.erechnung-dash-nav-inner {
  scroll-snap-type: x proximity;
}

.erechnung-dash-nav-inner a {
  scroll-snap-align: start;
}

.erechnung-auth-topbar .erechnung-lang {
  z-index: 30;
}

.erechnung-dash-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  min-width: 0;
}

.erechnung-dash-main > * {
  max-width: 100%;
}

.erechnung-dash-main table {
  width: 100%;
  table-layout: auto;
}

.erechnung-dash-main img {
  max-width: 100%;
  height: auto;
}

.erechnung-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.erechnung-form-field {
  margin-bottom: 1rem;
}

.erechnung-form-field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}

.erechnung-form-field input,
.erechnung-form-field select {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.erechnung-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: none;
  border-radius: 0.75rem;
  background: #7c3aed;
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}

.erechnung-btn-primary:hover {
  background: #8b5cf6;
}

.erechnung-hero-strip {
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.erechnung-hero-strip-inner {
  background: radial-gradient(circle at top, #132d72 0%, #0f1f4d 38%, #0b132e 100%);
  color: #fff;
  padding: 2.5rem 2rem;
}

.erechnung-tier-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  align-items: stretch;
}

.erechnung-tier-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.erechnung-tier-card ul {
  flex: 1;
  margin-bottom: 0;
}

.erechnung-tier-card-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.erechnung-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  min-height: 2.5rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.erechnung-btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
}

@media (min-width: 768px) {
  .erechnung-tier-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1280px) {
  .erechnung-tier-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Cookie consent banner (Next.js parity) */
.erechnung-cookie-banner,
.erechnung-cookie-banner * {
  box-sizing: border-box;
}

.erechnung-cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  z-index: 10000;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #0f172a;
  line-height: 1.5;
  pointer-events: none;
}

.erechnung-cookie-banner-inner {
  pointer-events: auto;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
}

.erechnung-cookie-banner-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: #0f172a;
}

.erechnung-cookie-banner-text {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  font-weight: 400;
  color: #475569;
  line-height: 1.5;
}

.erechnung-cookie-banner-actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.erechnung-cookie-btn {
  font-family: inherit;
  line-height: 1.25;
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  appearance: none;
}

.erechnung-cookie-btn--outline {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1e293b;
}

.erechnung-cookie-btn--outline:hover {
  background: #f8fafc;
}

.erechnung-cookie-btn--primary {
  background: #0f172a;
  color: #fff;
  font-weight: 600;
}

.erechnung-cookie-btn--primary:hover {
  background: #1e293b;
}

.erechnung-cookie-banner-manage {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  color: #475569;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.erechnung-cookie-banner-manage:hover {
  color: #0f172a;
}

@media (max-width: 640px) {
  .erechnung-cookie-banner-manage {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

body.erechnung-cookie-banner-open {
  padding-bottom: 7rem;
}

/* Invoice editor shell (Next.js parity) */
.erechnung-editor-shell {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  width: 100%;
}

.erechnung-demo-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) max(3rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  width: 100%;
  min-width: 0;
  flex: 1;
}

.erechnung-demo-hero {
  margin-bottom: 1.25rem;
}

.erechnung-demo-hero-title {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.3;
}

.erechnung-demo-hero-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.erechnung-demo-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.erechnung-demo-cta .erechnung-btn-primary,
.erechnung-demo-cta .erechnung-btn-secondary {
  width: auto;
  min-height: 2.75rem;
  padding: 0 1rem;
}

.erechnung-editor-chrome {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .erechnung-editor-chrome {
    flex-direction: row;
    align-items: stretch;
  }
}

.erechnung-doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  width: fit-content;
}

.erechnung-doc-type-badge .erechnung-ios-section-icon {
  width: 1.75rem;
  height: 1.75rem;
}

.erechnung-doc-type-badge .erechnung-ios-section-icon--document svg {
  width: 1rem;
  height: 1rem;
}

.erechnung-doc-type-toggle {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: #f1f5f9;
  width: fit-content;
}

.erechnung-doc-type-btn {
  position: relative;
  border: none;
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}

.erechnung-doc-type-btn.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.erechnung-editor-status-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  min-width: 0;
}

.erechnung-editor-status-card.is-valid {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.erechnung-editor-status-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #64748b;
}

.erechnung-editor-status-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.erechnung-editor-status-card.is-valid .erechnung-editor-status-icon {
  background: #7c3aed;
  color: #fff;
}

.erechnung-editor-status-text {
  min-width: 0;
}

.erechnung-editor-status-text strong {
  display: block;
  font-size: 0.875rem;
  color: #0f172a;
}

.erechnung-editor-status-text span {
  font-size: 0.75rem;
}

.erechnung-editor-tabs-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.75rem;
  background: #f1f5f9;
}

.erechnung-editor-tabs {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: 0.75rem;
  background: #e2e8f0;
}

.erechnung-editor-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}

.erechnung-editor-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.erechnung-editor-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}

.erechnung-editor-action-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.erechnung-editor-action-btn--validate {
  background: #dbeafe;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.erechnung-export-dropdown {
  position: relative;
}

.erechnung-export-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  border-radius: 0.75rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.erechnung-export-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  bottom: auto;
  width: 18rem;
  max-width: calc(100vw - 2rem);
  padding: 0.5rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.12);
  z-index: 80;
}

.erechnung-export-menu-title {
  margin: 0.25rem 0.5rem 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
}

.erechnung-export-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  border: none;
  background: transparent;
  border-radius: 0.65rem;
  padding: 0.55rem 0.5rem;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.erechnung-export-option:hover {
  background: #f8fafc;
}

.erechnung-export-option.is-locked {
  opacity: 0.75;
}

.erechnung-export-option strong {
  display: block;
  font-size: 0.8125rem;
  color: #0f172a;
}

.erechnung-export-option small {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.6875rem;
  color: #64748b;
  line-height: 1.35;
}

.erechnung-export-option-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.erechnung-export-option-icon--pdf {
  background: #ede9fe;
  color: #6d28d9;
}

.erechnung-export-option-icon--xml {
  background: #dbeafe;
  color: #2563eb;
}

.erechnung-export-option-icon--zugferd {
  background: #d1fae5;
  color: #047857;
}

.erechnung-export-recaptcha {
  margin: 0.35rem 0.5rem 0;
  padding: 0.35rem 0.25rem 0;
  border-top: 1px solid #e2e8f0;
}

.erechnung-export-recaptcha .mb-3 {
  margin-bottom: 0 !important;
}

.erechnung-export-menu-hint {
  margin: 0.35rem 0.5rem 0.25rem;
  font-size: 0.6875rem;
  color: #94a3b8;
  line-height: 1.35;
}

.erechnung-export-menu-locked {
  margin: 0 0.5rem 0.35rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.5rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 0.6875rem;
  color: #92400e;
  line-height: 1.4;
}

.erechnung-export-dropdown.is-exports-locked .erechnung-export-option {
  opacity: 0.65;
}

.erechnung-btn-finalize--pulse {
  animation: erechnung-finalize-pulse 1s ease-in-out 3;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35);
}

@keyframes erechnung-finalize-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.erechnung-editor-preview-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.erechnung-editor-preview-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-editor-preview-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
}

.erechnung-editor-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.erechnung-editor-preview-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.erechnung-editor-preview-btn--primary {
  background: #7c3aed;
  color: #fff;
}

.erechnung-editor-preview-btn--primary:hover {
  background: #8b5cf6;
}

.erechnung-editor-preview-btn--ghost {
  background: #fff;
  color: #334155;
  border: 1px solid #e2e8f0;
}

.erechnung-editor-preview-btn--ghost:hover {
  background: #f8fafc;
}

.erechnung-pdf-design-gate {
  max-width: 42rem;
  padding: 1.5rem;
}

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

.erechnung-flash--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.erechnung-editor-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-editor-progress-track {
  flex: 1;
  height: 0.35rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.erechnung-editor-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.erechnung-editor-pdf-hint {
  width: 100%;
  margin: 0;
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.erechnung-editor-preview-panel {
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 1rem;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.erechnung-ios-section {
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.erechnung-ios-section-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  flex-wrap: wrap;
  row-gap: 0.75rem;
}

@media (min-width: 640px) {
  .erechnung-ios-section-head {
    flex-wrap: nowrap;
  }
}

.erechnung-ios-section-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

.erechnung-ios-section-icon svg {
  width: 1rem;
  height: 1rem;
}

.erechnung-ios-section-icon--document svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #c4b5fd;
}

.erechnung-ios-section-icon--seller,
.erechnung-ios-section-icon--buyer {
  background: #7f22fe;
}

.erechnung-ios-section-icon--seller svg,
.erechnung-ios-section-icon--buyer svg {
  color: #fff;
}

.erechnung-ios-section-icon--positions svg {
  color: #475569;
}

.erechnung-ios-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  flex: 1;
}

.erechnung-ios-section-action {
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.erechnung-ios-section-body {
  padding: 1rem;
}

.erechnung-ios-grid-4 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.erechnung-ios-grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .erechnung-ios-grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  .erechnung-ios-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .erechnung-ios-grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  .erechnung-ios-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.erechnung-ios-field {
  min-width: 0;
}

.erechnung-ios-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  margin-bottom: 0.375rem;
}

.erechnung-ios-required {
  color: #f87171;
}

.erechnung-ios-input,
.erechnung-ios-value {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  font-size: 1rem;
  color: #0f172a;
  background: rgba(248, 250, 252, 0.8);
  box-sizing: border-box;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.erechnung-ios-input::placeholder {
  color: #94a3b8;
}

.erechnung-ios-input:hover:not(:disabled):not(:focus) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.erechnung-ios-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #fff;
}

.erechnung-ios-input-wrap {
  position: relative;
}

.erechnung-ios-input--suffix {
  padding-right: 3rem;
}

.erechnung-ios-input-suffix {
  position: absolute;
  right: 0.25rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  z-index: 2;
}

.erechnung-ios-input-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.erechnung-ios-input-action:hover {
  background: #f1f5f9;
  color: #2563eb;
}

.erechnung-ios-input-action:disabled {
  opacity: 0.5;
  cursor: wait;
}

.erechnung-ios-input--flash {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  background: #fff;
}

.erechnung-ios-value {
  background: #fff;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

textarea.erechnung-ios-input {
  min-height: 4.5rem;
  resize: vertical;
}

.erechnung-ios-add-line {
  margin-top: 0.75rem;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
}

.erechnung-editor-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.625rem;
  margin-top: 1.25rem;
  padding: 1rem 0 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.erechnung-editor-save-btn,
.erechnung-editor-finalize-btn,
.erechnung-editor-cancel-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.erechnung-editor-save-btn {
  background: #fff;
  border-color: #e2e8f0;
  color: #1e293b;
}

.erechnung-editor-save-btn:hover {
  background: #f8fafc;
}

.erechnung-editor-finalize-btn {
  background: #7c3aed;
  color: #fff;
}

.erechnung-editor-finalize-btn:hover {
  background: #6d28d9;
}

.erechnung-editor-cancel-btn {
  background: transparent;
  border-color: transparent;
  color: #64748b;
  font-weight: 500;
}

.erechnung-editor-cancel-btn:hover {
  color: #334155;
  background: #f1f5f9;
}

.erechnung-btn-finalize {
  background: #7c3aed !important;
}

.erechnung-btn-finalize:hover {
  background: #6d28d9 !important;
}

.erechnung-btn-finalize--pulse {
  animation: erechnung-finalize-pulse 1.2s ease-in-out 2;
  box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.45);
}

@keyframes erechnung-finalize-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(124, 58, 237, 0); }
}

.erechnung-editor-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  max-width: min(calc(100vw - 2rem), 22rem);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  color: #fff;
  background: #1e293b;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(0.75rem);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.erechnung-editor-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.erechnung-editor-toast--success {
  background: var(--erechnung-success);
}

.erechnung-editor-toast--error {
  background: #dc2626;
}

.erechnung-editor-toast--info {
  background: #334155;
}

.erechnung-editor-toast--warning {
  background: #d97706;
}

.erechnung-editor-delete-form {
  margin-top: 1rem;
}

.erechnung-editor-upgrade-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid #ddd6fe;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
}

.erechnung-editor-upgrade-banner-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: #7c3aed;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.erechnung-editor-upgrade-banner-text {
  flex: 1;
  min-width: 12rem;
}

.erechnung-editor-upgrade-banner-text strong {
  display: block;
  font-size: 0.9375rem;
  color: #4c1d95;
}

.erechnung-editor-upgrade-banner-text p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #5b21b6;
}

.erechnung-editor-upgrade-banner-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.25rem;
  padding: 0 1rem;
  border-radius: 0.75rem;
  background: #7c3aed;
  color: #fff !important;
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.erechnung-editor-upgrade-banner-cta:hover {
  background: #6d28d9;
}

.erechnung-flash {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid transparent;
}

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

.erechnung-flash--info {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #334155;
}

.erechnung-flash--error {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.erechnung-flash--warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.erechnung-ios-section-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
}

.erechnung-ios-section-action--catalog {
  background: #fef3c7;
  border-color: #fde68a;
  color: #b45309;
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  font-weight: 500;
}

.erechnung-ios-section-action--customer {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #5b21b6;
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  font-weight: 500;
}

.erechnung-ios-section-action--customer:hover {
  background: #ddd6fe;
  border-color: #c4b5fd;
}

.erechnung-ios-section-action--add {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  color: #fff;
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  font-weight: 500;
}

/* Position cards (Next.js parity) */
.erechnung-positions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.erechnung-position-card {
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: rgba(248, 250, 252, 0.6);
  transition: border-color 0.15s, background 0.15s;
}

.erechnung-position-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.erechnung-position-card.is-complete {
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: 0 1px 2px rgba(22, 163, 74, 0.08);
}

.erechnung-position-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.erechnung-typ-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.erechnung-typ-pill {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.erechnung-typ-pill--blue { background: #eff6ff; color: #2563eb; }
.erechnung-typ-pill--blue.is-active { background: #3b82f6; color: #fff; box-shadow: 0 1px 2px rgba(59, 130, 246, 0.35); }
.erechnung-typ-pill--amber { background: #fffbeb; color: #d97706; }
.erechnung-typ-pill--amber.is-active { background: #f59e0b; color: #fff; box-shadow: 0 1px 2px rgba(245, 158, 11, 0.35); }
.erechnung-typ-pill--purple { background: #faf5ff; color: #7c3aed; }
.erechnung-typ-pill--purple.is-active { background: #8b5cf6; color: #fff; box-shadow: 0 1px 2px rgba(139, 92, 246, 0.35); }
.erechnung-typ-pill--slate { background: #f1f5f9; color: #475569; }
.erechnung-typ-pill--slate.is-active { background: #64748b; color: #fff; box-shadow: 0 1px 2px rgba(100, 116, 139, 0.35); }

.erechnung-position-remove {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #94a3b8;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.erechnung-position-remove:hover {
  color: #ef4444;
  background: #fef2f2;
}

.erechnung-position-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .erechnung-position-fields {
    grid-template-columns: 1fr 1fr;
  }

  .erechnung-position-field--desc {
    grid-column: 1 / -1;
  }

  .erechnung-position-amount {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .erechnung-position-fields {
    grid-template-columns: 2fr 0.7fr 0.7fr 1fr 0.7fr auto;
    align-items: center;
  }

  .erechnung-position-field--desc {
    grid-column: auto;
  }

  .erechnung-position-amount {
    grid-column: auto;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    width: auto;
  }
}

.erechnung-position-field {
  position: relative;
  min-width: 0;
}

.erechnung-position-field--price,
.erechnung-position-field--vat {
  position: relative;
}

.erechnung-position-suffix {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #94a3b8;
  pointer-events: none;
}

.erechnung-position-field--price .erechnung-ios-input,
.erechnung-position-field--vat .erechnung-ios-input {
  padding-right: 1.75rem;
}

.erechnung-position-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  font-size: 0.8125rem;
  min-width: 5.5rem;
}

.erechnung-position-amount strong {
  font-size: 0.9375rem;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.erechnung-position-readonly-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .erechnung-position-readonly-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .erechnung-position-readonly-grid {
    grid-template-columns: 2fr 0.6fr 0.6fr 1fr 0.6fr auto;
    align-items: center;
  }
}

.erechnung-position-ro-desc {
  min-height: 2.75rem;
}

.erechnung-position-ro-num,
.erechnung-position-ro-unit {
  text-align: center;
}

.erechnung-position-ro-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.text-center {
  text-align: center;
}

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

/* Legacy table (unused) */
.erechnung-positions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.erechnung-positions-table th,
.erechnung-positions-table td {
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

.erechnung-invoice-totals {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  display: grid;
  gap: 0.35rem;
  max-width: 280px;
  margin-left: auto;
  font-size: 0.875rem;
}

.erechnung-invoice-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.erechnung-totals-gross {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #cbd5e1;
  font-size: 1rem;
}

.erechnung-picker-modal {
  border: none;
  border-radius: 1rem;
  padding: 0;
  margin: auto;
  max-width: min(calc(100vw - 2rem), 28rem);
  width: 100%;
  max-height: min(90vh, 32rem);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.erechnung-picker-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: min(90vh, 32rem);
  background: #fff;
}

.erechnung-picker-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.erechnung-picker-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
}

.erechnung-picker-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-picker-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
}

.erechnung-picker-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.erechnung-picker-search {
  display: block;
  width: calc(100% - 2rem);
  margin: 0.75rem 1rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-family: inherit;
}

.erechnung-picker-search:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.25);
}

.erechnung-picker-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 16rem;
  overflow-y: auto;
  padding: 0 0.75rem;
}

.erechnung-picker-list .erechnung-picker-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
  width: 100%;
  margin: 0;
  padding: 1.5rem 0.75rem;
  box-sizing: border-box;
  text-align: center;
}

.erechnung-picker-modal-foot {
  padding: 0.75rem 1rem 1rem;
  border-top: 1px solid #f1f5f9;
}

.erechnung-picker-modal-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: #7c3aed;
  text-decoration: none;
}

.erechnung-picker-modal-link:hover {
  color: #6d28d9;
  text-decoration: underline;
}

.erechnung-picker-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  cursor: pointer;
}

.erechnung-picker-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.erechnung-picker-item-title {
  font-weight: 500;
  color: #0f172a;
}

.erechnung-picker-item-meta {
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-editor-form input:disabled,
.erechnung-editor-form select:disabled,
.erechnung-editor-form textarea:disabled {
  background: #f8fafc;
  color: #475569;
}

/* Editor tabs + progress */
.erechnung-editor-tabs {
  display: flex;
  gap: 0.25rem;
  background: #f1f5f9;
  padding: 0.25rem;
  border-radius: 0.75rem;
}

.erechnung-editor-tab {
  border: none;
  background: transparent;
  padding: 0.45rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  cursor: pointer;
}

.erechnung-editor-tab.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.erechnung-editor-progress {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.erechnung-editor-progress-track {
  width: 5rem;
  height: 0.35rem;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.erechnung-editor-progress-fill {
  height: 100%;
  background: #0f172a;
  border-radius: 999px;
  transition: width 0.2s ease;
}

.erechnung-preview-panel {
  padding: 1rem;
  overflow-x: auto;
  overflow-y: visible;
}

.erechnung-preview-scroll {
  overflow-x: auto;
  padding: 1rem 0;
  display: flex;
  justify-content: center;
  background: #e2e8f0;
  border-radius: 0.75rem;
  min-height: 320px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

/* A4 preview (screen) */
.erechnung-a4-preview {
  width: 210mm;
  min-height: 297mm;
  padding: 20mm;
  box-sizing: border-box;
  background: #fff;
  color: #111;
  font-size: 10pt;
  line-height: 1.35;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
  flex-shrink: 0;
  position: relative;
}

.erechnung-a4-design-badge {
  position: absolute;
  top: 8mm;
  right: 8mm;
  font-size: 7pt;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.2rem 0.45rem;
  border-radius: 0.25rem;
}

.erechnung-editor-export-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.erechnung-editor-toast {
  position: fixed;
  bottom: 5rem;
  right: 1rem;
  z-index: 90;
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  background: #0f172a;
  color: #fff;
  font-size: 0.875rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.erechnung-editor-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.erechnung-a4-return-line {
  font-size: 8pt;
  color: #9ca3af;
  text-decoration: underline;
  margin: 0 0 0.5rem;
}

.erechnung-a4-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-height: 35mm;
  margin-bottom: 6mm;
}

.erechnung-a4-address {
  width: 85mm;
  font-size: 10pt;
}

.erechnung-a4-meta {
  width: 70mm;
  text-align: right;
}

.erechnung-a4-meta table {
  margin-left: auto;
  font-size: 9pt;
}

.erechnung-a4-meta td:first-child {
  color: #6b7280;
  padding-right: 0.75rem;
}

.erechnung-a4-title {
  font-size: 22pt;
  font-weight: 800;
  margin: 0 0 0.75rem;
  line-height: 1;
}

.erechnung-a4-bold {
  font-weight: 600;
}

.erechnung-a4-intro {
  margin: 8mm 0 6mm;
  font-size: 10pt;
  white-space: pre-wrap;
}

.erechnung-a4-subject {
  font-size: 11pt;
  font-weight: 600;
  margin: 6mm 0;
}

.erechnung-a4-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  margin-bottom: 8mm;
}

.erechnung-a4-lines th {
  border-bottom: 2px solid #111;
  text-align: left;
  padding: 0.35rem 0.25rem;
}

.erechnung-a4-lines td {
  border-bottom: 1px solid #e5e7eb;
  padding: 0.35rem 0.25rem;
  vertical-align: top;
}

.erechnung-a4-lines th:nth-child(n+3),
.erechnung-a4-lines td:nth-child(n+3) {
  text-align: right;
}

.erechnung-a4-totals-wrap {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8mm;
}

.erechnung-a4-totals {
  width: 65mm;
  font-size: 9pt;
}

.erechnung-a4-totals td:last-child {
  text-align: right;
}

.erechnung-a4-total-row {
  border-top: 2px solid #111;
}

.erechnung-a4-total-row td {
  padding-top: 0.35rem;
  font-size: 11pt;
}

.erechnung-a4-section35a {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.75rem;
  font-size: 8pt;
  margin-bottom: 8mm;
}

.erechnung-a4-section35a span {
  margin-right: 1.5rem;
}

.erechnung-a4-closing {
  font-size: 9pt;
  margin-bottom: 12mm;
}

.erechnung-a4-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  border-top: 1px solid #d1d5db;
  padding-top: 1rem;
  font-size: 8pt;
  color: #6b7280;
}

.erechnung-a4-branding {
  text-align: center;
  font-size: 8pt;
  color: #9ca3af;
  margin-top: 2rem;
}

/* Pro / ZUGFeRD document preview (Next InvoiceDocumentPreview, ~640px) */
.erechnung-doc-preview {
  width: 640px;
  max-width: 100%;
  min-height: 905px;
  margin: 0 auto;
  padding: 1.5rem 1.75rem;
  box-sizing: border-box;
  background: #fff;
  color: #0f172a;
  font-size: 11px;
  line-height: 1.35;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
  position: relative;
  overflow: visible;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.erechnung-doc-accent-bar--full { height: 8px; border-radius: 4px; width: 100%; }
.erechnung-doc-accent-bar--line { height: 4px; border-radius: 2px; width: 100%; }

.erechnung-doc-header-area {
  position: relative;
  margin-top: 1.25rem;
  min-height: 72px;
  overflow: visible;
}

.erechnung-doc-sender-label { font-size: 10px; color: #64748b; max-width: 250px; }
.erechnung-doc-logo-slot {
  position: absolute;
  top: 0;
  display: flex;
  align-items: center;
  overflow: visible;
  box-sizing: border-box;
}
.erechnung-doc-logo-slot--left { left: 0; justify-content: flex-start; }
.erechnung-doc-logo-slot--center { left: 0; right: 0; margin-left: auto; margin-right: auto; justify-content: center; }
.erechnung-doc-logo-slot--right { right: 0; justify-content: flex-end; }
.erechnung-doc-logo-img { display: block; object-fit: contain; max-width: 100%; height: auto; }
.erechnung-doc-logo-text { font-weight: 800; line-height: 1; }

.erechnung-doc-title {
  margin: 0.5rem 0 0;
  text-align: center;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #334155;
  line-height: 1.1;
}

.erechnung-doc-divider { height: 1px; background: #e2e8f0; margin: 1rem 0 0.5rem; }
.erechnung-doc-return-line { font-size: 9px; color: #94a3b8; margin: 0.5rem 0; }

.erechnung-doc-address-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
  font-size: 11px;
  color: #334155;
}

.erechnung-doc-meta { text-align: right; font-size: 10px; color: #475569; }
.erechnung-doc-meta > div { margin-bottom: 0.15rem; }
.erechnung-doc-bold { font-weight: 600; }
.erechnung-doc-muted { color: #64748b; font-size: 10px; }

.erechnung-doc-table-head,
.erechnung-doc-table-row {
  display: grid;
  grid-template-columns: 32px 1.4fr 56px 48px 88px 40px 72px;
  gap: 0.35rem;
  align-items: center;
  padding: 0.35rem 0.5rem;
  font-size: 12px;
}

.erechnung-doc-table-head { margin-top: 1rem; font-weight: 600; color: #475569; }
.erechnung-doc-table-head--framed,
.erechnung-doc-table-row--framed { border: 1px solid #e2e8f0; }
.erechnung-doc-table-head--zebra { color: #fff; }
.erechnung-doc-table-row--zebra.is-alt { background: rgba(226, 232, 240, 0.72); }
.erechnung-doc-col-desc { min-width: 0; word-break: break-word; }
.erechnung-doc-col-total { text-align: right; font-variant-numeric: tabular-nums; }

.erechnung-doc-totals {
  margin: 1rem 0 0 auto;
  width: 280px;
  min-width: 280px;
  max-width: 100%;
  font-size: 13px;
  color: #334155;
}

.erechnung-doc-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.erechnung-doc-totals-row span {
  white-space: nowrap;
}

.erechnung-doc-totals-row span:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.erechnung-doc-totals-row span:last-child {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.erechnung-doc-totals-row--gross {
  border-bottom: none;
  font-size: 16px;
  font-weight: 600;
  padding-top: 0.35rem;
}

.erechnung-doc-payment {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
  overflow: hidden;
}

.erechnung-doc-qr-placeholder {
  float: right;
  width: 72px;
  height: 72px;
  margin: 0 0 0.5rem 0.5rem;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 8px;
  color: #64748b;
  background: #f8fafc;
}

.erechnung-doc-payment-body strong { display: block; margin-bottom: 0.35rem; color: #334155; }

.erechnung-doc-footer {
  margin-top: auto;
  flex-shrink: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 4px;
  text-align: center;
  font-size: 10px;
  line-height: 1.45;
}

.erechnung-doc-branding {
  flex-shrink: 0;
  text-align: center;
  font-size: 9px;
  color: #94a3b8;
  margin: 0.75rem 0 0;
}

.erechnung-doc-footer--colored {
  background: var(--erechnung-doc-footer-accent, #3498db);
  color: #fff;
}

.erechnung-doc-footer--line {
  color: #64748b;
  background: transparent;
  border-top: 2px solid #e2e8f0;
  border-radius: 0;
  padding-top: 0.75rem;
}

.erechnung-doc-footer--text {
  color: #64748b;
  background: transparent;
  border-top: none;
  border-radius: 0;
  padding-top: 0.5rem;
}

.erechnung-field-highlight {
  outline: 2px solid #f59e0b;
  outline-offset: 2px;
}

/* Validation modal */
.erechnung-validation-modal {
  border: none;
  border-radius: 1rem;
  padding: 0;
  max-width: 42rem;
  width: calc(100% - 2rem);
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
}

.erechnung-validation-modal::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.erechnung-validation-modal-inner {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
}

.erechnung-validation-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.erechnung-validation-status {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
}

.erechnung-validation-status--error {
  background: #fef2f2;
}

.erechnung-validation-status--warn {
  background: #fffbeb;
}

.erechnung-validation-status--ok {
  background: #ecfdf5;
}

.erechnung-validation-results {
  overflow-y: auto;
  max-height: 50vh;
  padding: 0.5rem 0;
}

.erechnung-validation-section {
  border-bottom: 1px solid #f1f5f9;
}

.erechnung-validation-section-title {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1.25rem;
  border: none;
  background: transparent;
  font-weight: 600;
  cursor: pointer;
}

.erechnung-validation-item {
  margin: 0 1.25rem 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.erechnung-validation-item--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.erechnung-validation-item--warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

.erechnung-validation-item--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.erechnung-validation-modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media print {
  body * {
    visibility: hidden;
  }

  #editor-panel-preview,
  #editor-panel-preview * {
    visibility: visible;
  }

  #editor-panel-preview {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    border: none;
    box-shadow: none;
  }

  .erechnung-preview-scroll {
    background: #fff;
    padding: 0;
  }

  .erechnung-a4-preview {
    box-shadow: none;
    margin: 0 auto;
  }
}

.erechnung-muted {
  color: #64748b;
  font-size: 0.875rem;
}

.erechnung-site-footer {
  flex-shrink: 0;
  width: 100%;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  margin-top: auto;
}

.erechnung-site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: #475569;
}

.erechnung-site-footer-copy {
  margin: 0;
}

.erechnung-site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}

.erechnung-site-footer-links a {
  color: #475569;
  text-decoration: none;
  transition: color 0.15s ease;
}

.erechnung-site-footer-links a:hover {
  color: #0f172a;
}

.erechnung-legal-page {
  min-height: 100vh;
  background: #f9fafb;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Demo / public editor — prevent inner overflow without overriding shell max-width */
.erechnung-demo-page .erechnung-demo-main,
.erechnung-demo-page .erechnung-editor-shell {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.erechnung-demo-page #editor-panel-input,
.erechnung-demo-page #editor-panel-preview,
.erechnung-demo-page #invoice-editor-form,
.erechnung-demo-page .erechnung-editor-form,
.erechnung-demo-page .erechnung-ios-section,
.erechnung-demo-page .erechnung-ios-section-body,
.erechnung-demo-page .erechnung-editor-chrome,
.erechnung-demo-page .erechnung-editor-tabs-row,
.erechnung-demo-page .erechnung-editor-preview-panel {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.erechnung-legal-page .erechnung-legal-card,
.erechnung-legal-page .erechnung-legal-card h1,
.erechnung-legal-page .erechnung-legal-card h2,
.erechnung-legal-page .erechnung-legal-card p,
.erechnung-legal-page .erechnung-legal-card li,
.erechnung-legal-page .erechnung-legal-card a {
  font-family: inherit;
}

.erechnung-legal-main {
  flex: 1;
  padding: 3rem 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.erechnung-legal-card {
  max-width: 42rem;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  padding: 2rem;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.erechnung-legal-card h1 {
  margin: 0 0 1.5rem;
  font-size: 1.5rem;
}

.erechnung-legal-card h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.125rem;
}

.erechnung-legal-card p {
  color: #374151;
  line-height: 1.6;
  font-size: 0.9375rem;
}

/* Articles listing (card grid) + article detail (legal card) */
.erechnung-blog-page .erechnung-legal-main {
  max-width: 72rem;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.erechnung-blog-page .erechnung-blog-article.erechnung-legal-card {
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
}

.erechnung-back-btn-wrap {
  margin-top: 2rem;
}

.erechnung-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  color: #0f172a;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

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

.erechnung-articles-hero {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto 2.5rem;
}

.erechnung-articles-hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
}

.erechnung-articles-hero p {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #64748b;
}

.erechnung-articles-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); */
  gap: 1.75rem;
  width: 100%;
  /* max-width: 56rem; */
  max-width: 70rem;
  margin: 0 auto;
  box-sizing: border-box;
}

.erechnung-article-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
  max-width: 36rem;
  justify-self: center;
  background: #fff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.04);
  border: 1px solid #eef2f7;
}

.erechnung-article-card-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: #0f172a;
  text-decoration: none;
}

.erechnung-article-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.erechnung-article-card:hover .erechnung-article-card-media img {
  transform: scale(1.03);
}

.erechnung-article-card-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.72) 0%, rgba(15, 23, 42, 0.15) 55%, transparent 100%);
  pointer-events: none;
}

.erechnung-article-card-title {
  position: absolute;
  left: 1.25rem;
  right: 1.25rem;
  bottom: 1.1rem;
  z-index: 1;
  margin: 0;
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.erechnung-article-card-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
  padding: 1.25rem 1.35rem 1.35rem;
}

.erechnung-article-card-body p {
  margin: 0;
  flex: 1;
  color: #475569;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.erechnung-article-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: auto;
  color: #0f172a;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
}

.erechnung-article-card-cta:hover {
  color: #2563eb;
}

.erechnung-blog-meta {
  display: block;
  font-size: 0.8125rem;
  color: #64748b;
  margin: 0 0 0.35rem;
}

.erechnung-blog-empty,
.erechnung-blog-muted {
  color: #94a3b8 !important;
  font-size: 0.875rem;
  text-align: center;
}

.erechnung-blog-hero-image {
  margin: 0 0 1.5rem;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f1f5f9;
}

.erechnung-blog-hero-image img {
  width: 100%;
  display: block;
  max-height: 22rem;
  object-fit: cover;
}

.erechnung-blog-body {
  margin-top: 0.5rem;
  min-width: 0;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.erechnung-blog-body img,
.erechnung-blog-body table,
.erechnung-blog-body pre,
.erechnung-blog-body iframe,
.erechnung-blog-body video {
  max-width: 100%;
  height: auto;
}

.erechnung-blog-body table {
  display: block;
  overflow-x: auto;
}

.erechnung-blog-body pre {
  overflow-x: auto;
  white-space: pre-wrap;
}

.erechnung-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.erechnung-blog-tags a,
.erechnung-blog-tags span {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  color: #334155;
  background: #f1f5f9;
  border-radius: 0.375rem;
  text-decoration: none;
}

.erechnung-blog-tags a:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.erechnung-blog-tags--article {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
}

.erechnung-blog-pagination {
  margin-top: 2rem;
}

.erechnung-blog-pagination nav,
.erechnung-blog-pagination .pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
  justify-content: center;
}

@media (max-width: 900px) {
    .erechnung-articles-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: none;
    }
}

@media (max-width: 640px) {
  .erechnung-legal-main {
    padding: 1.5rem 1rem;
  }

  .erechnung-legal-card {
    padding: 1.25rem 1rem;
  }

  .erechnung-articles-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .erechnung-article-card {
    max-width: none;
  }
}

.erechnung-lang-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 160px;
  padding: 0.25rem 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.1);
  list-style: none;
  margin: 0;
  z-index: 60;
}

.erechnung-lang.open .erechnung-lang-menu {
  display: block;
}

.erechnung-lang-menu a,
.erechnung-lang-menu button {
  display: block;
  text-align: left;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  color: #334155;
  background: none;
  border: none;
  text-decoration: none;
  cursor: pointer;
}

.erechnung-lang-menu a:hover,
.erechnung-lang-menu button:hover,
.erechnung-lang-menu a.active {
  background: #f8fafc;
  color: #0f172a;
}

.erechnung-lang {
  position: relative;
}

.erechnung-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  font-family: inherit;
  line-height: 1.25;
  transition: background 0.15s ease, color 0.15s ease;
}

.erechnung-lang-globe {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

@media (min-width: 1024px) {
  .erechnung-lang-globe {
    width: 1.25rem;
    height: 1.25rem;
  }
}

.erechnung-lang-label {
  display: none;
}

@media (min-width: 640px) {
  .erechnung-lang-label {
    display: inline;
  }
}

.erechnung-lang-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.erechnung-lang.open .erechnung-lang-chevron {
  transform: rotate(180deg);
}

.erechnung-lang-trigger-dark {
  background: transparent;
  color: #fff;
}

.erechnung-lang-trigger-dark:hover {
  background: rgba(255, 255, 255, 0.1);
}

.erechnung-public-header .erechnung-lang-menu {
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
}

.erechnung-public-header .erechnung-lang-menu a {
  color: #334155;
}

.erechnung-public-header .erechnung-lang-menu a:hover,
.erechnung-public-header .erechnung-lang-menu a.active {
  background: #f8fafc;
  color: #0f172a;
}

.erechnung-lang-trigger-light {
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
}

.erechnung-lang-trigger-light:hover {
  background: #f8fafc;
}

.erechnung-progress {
  height: 0.75rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-top: 0.5rem;
}

.erechnung-progress > span {
  display: block;
  height: 100%;
  border-radius: 9999px;
  background: #7c3aed;
}

/* PDF design page — split form + live preview (dashboard style) */
.erechnung-pdf-design-page {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.erechnung-pdf-design-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.erechnung-pdf-design-grid {
  display: grid;
  grid-template-columns: minmax(300px, 400px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .erechnung-pdf-design-grid {
    grid-template-columns: 1fr;
  }
}

.erechnung-pdf-design-form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.erechnung-pdf-design-section {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.erechnung-pdf-design-section-title {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-pdf-design-accent-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.erechnung-pdf-design-swatch {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.erechnung-pdf-design-swatch.is-active {
  border-color: #0f172a;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0f172a;
}

.erechnung-pdf-design-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0;
  background: linear-gradient(transparent, #f8fafc 24%);
  padding: 0.75rem 0 0.25rem;
}

.erechnung-pdf-design-actions .erechnung-pdf-design-btn {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 2.5rem;
  max-width: none;
}

.erechnung-pdf-design-preview-col {
  min-width: 0;
}

.erechnung-pdf-design-preview-host {
  background: #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
  min-height: 380px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.erechnung-pdf-design-preview-scale {
  transform-origin: top center;
  width: max-content;
  margin: 0 auto;
}

.erechnung-pdf-design-preview-host .erechnung-a4-preview {
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.12);
}

/* Flash messages */
.erechnung-flash {
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
}

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

.erechnung-flash--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

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

/* Documents list */
.erechnung-documents-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .erechnung-documents-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.erechnung-documents-create-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.erechnung-documents-create-btn {
  width: auto;
  min-height: 2.75rem;
  padding: 0 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.erechnung-documents-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.erechnung-documents-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
}

.erechnung-documents-filter-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 10rem;
}

.erechnung-documents-filter-label {
  font-size: 0.75rem;
}

.erechnung-documents-card {
  padding: 0;
  overflow: hidden;
}

.erechnung-documents-table-wrap {
  overflow-x: auto;
}

.erechnung-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.erechnung-badge--success {
  background: #dcfce7;
  color: #166534;
}

.erechnung-badge--muted {
  background: #f1f5f9;
  color: #475569;
}

/* Articles list (Next.js parity) */
.erechnung-articles-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.erechnung-articles-card {
  padding: 0;
  overflow: hidden;
}

.erechnung-articles-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

@media (min-width: 640px) {
  .erechnung-articles-card-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.erechnung-articles-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-articles-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-articles-new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  flex-shrink: 0;
}

.erechnung-articles-table-wrap {
  overflow-x: auto;
}

.erechnung-data-table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.erechnung-data-table thead tr {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  text-align: left;
  color: #475569;
}

.erechnung-data-table th,
.erechnung-data-table td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}

.erechnung-data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
}

.erechnung-data-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.8);
}

.erechnung-data-table--right {
  text-align: right;
}

.erechnung-data-table--actions {
  width: 7.5rem;
}

.erechnung-data-table--strong {
  font-weight: 500;
  color: #0f172a;
}

.erechnung-data-table--muted {
  color: #475569;
}

.erechnung-data-table--truncate {
  max-width: 12.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erechnung-data-table--nums {
  font-variant-numeric: tabular-nums;
}

.erechnung-data-table--empty {
  padding: 2rem 1rem !important;
  text-align: center;
  color: #64748b;
}

.erechnung-row-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}

.erechnung-inline-form {
  display: inline;
  margin: 0;
}

.erechnung-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 0.5rem;
  background: transparent;
  color: #475569;
  cursor: pointer;
  text-decoration: none;
}

.erechnung-icon-btn:hover {
  background: #e2e8f0;
}

.erechnung-icon-btn--danger {
  color: #dc2626;
}

.erechnung-icon-btn--danger:hover {
  background: #fef2f2;
}

.erechnung-articles-pagination {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f1f5f9;
}

/* Article form typ pills */
.erechnung-typ-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.erechnung-typ-pill {
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.erechnung-typ-pill--blue {
  background: #dbeafe;
  color: #2563eb;
}

.erechnung-typ-pill--blue.is-active {
  background: #3b82f6;
  color: #fff;
  border-bottom-color: #bfbfbf;
}

.erechnung-typ-pill--amber {
  background: #fef3c7;
  color: #d97706;
}

.erechnung-typ-pill--amber.is-active {
  background: #f59e0b;
  color: #fff;
  border-bottom-color: #bfbfbf;
}

.erechnung-typ-pill--purple {
  background: #f3e8ff;
  color: #9333ea;
}

.erechnung-typ-pill--purple.is-active {
  background: #a855f7;
  color: #fff;
  border-bottom-color: #bfbfbf;
}

.erechnung-typ-pill--slate {
  background: #f1f5f9;
  color: #475569;
}

.erechnung-typ-pill--slate.is-active {
  background: #64748b;
  color: #fff;
  border-bottom-color: #bfbfbf;
}

.erechnung-article-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .erechnung-article-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.erechnung-article-form-grid--full {
  grid-column: 1 / -1;
}

/* Settings (Next.js parity) */
.erechnung-settings-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 48rem;
}

.erechnung-settings-header-card {
  padding: 1.25rem 1.5rem;
}

.erechnung-settings-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.erechnung-settings-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-settings-section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.erechnung-settings-form .erechnung-btn-primary,
.erechnung-settings-form .erechnung-dash-btn {
  margin-top: 1rem;
}

.erechnung-settings-grid {
  display: grid;
  gap: 1rem;
}

.erechnung-settings-grid--2 {
  grid-template-columns: 1fr;
}

.erechnung-settings-grid--3 {
  grid-template-columns: 1fr;
}

.erechnung-settings-grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (min-width: 640px) {
  .erechnung-settings-grid--2 {
    grid-template-columns: 1fr 1fr;
  }

  .erechnung-settings-grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.erechnung-settings-plan-box {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #fff;
  padding: 1rem;
}

.erechnung-settings-plan-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 500;
}

.erechnung-settings-plan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.erechnung-settings-plan-name {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-settings-plan-expiry {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
}

.erechnung-settings-plan-link {
  flex-shrink: 0;
}

.erechnung-settings-plan-features {
  margin: 0 0 1rem;
  padding-left: 1.125rem;
  color: #475569;
  font-size: 0.875rem;
  line-height: 1.6;
}

.erechnung-settings-plan-usage {
  display: grid;
  gap: 0.5rem;
  padding: 0.875rem 0;
  border-top: 1px solid #f1f5f9;
  border-bottom: 1px solid #f1f5f9;
}

.erechnung-settings-plan-usage-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  color: #334155;
}

.erechnung-settings-plan-hint {
  margin: 0.75rem 0 0;
  font-size: 0.75rem;
}

.erechnung-settings-dev-link {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
}

/* Article create/edit (Next.js parity) */
.erechnung-article-editor-header {
  margin-bottom: 0.25rem;
}

.erechnung-article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem -0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
}

.erechnung-article-back-link:hover {
  background: #f1f5f9;
}

.erechnung-article-editor-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.erechnung-article-editor-card {
  max-width: 48rem;
  padding: 1.5rem;
}

.erechnung-article-editor-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.erechnung-article-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.5rem;
}

.erechnung-article-cancel-btn {
  background: #fff !important;
  color: #334155 !important;
}

.erechnung-article-delete-form {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e2e8f0;
}

.erechnung-article-delete-btn {
  color: #b91c1c !important;
  border-color: #fecaca !important;
}

.erechnung-required {
  color: #f87171;
}

/* Form controls (Next.js Input / textarea parity) */
.erechnung-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.erechnung-form-field > label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
}

.erechnung-control,
.erechnung-form-field input:not([type='hidden']):not([type='checkbox']):not([type='radio']),
.erechnung-form-field select,
.erechnung-form-field textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.9375rem;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.erechnung-form-field textarea.erechnung-control--textarea,
.erechnung-control--textarea {
  min-height: 5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  resize: vertical;
}

.erechnung-form-field textarea.erechnung-control--notes,
.erechnung-control--notes {
  min-height: 5rem;
  max-height: 8rem;
  resize: none;
}

.erechnung-control:focus,
.erechnung-form-field input:focus,
.erechnung-form-field select:focus,
.erechnung-form-field textarea:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.erechnung-form-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.erechnung-editor-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .erechnung-editor-form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.erechnung-editor-form-grid--full {
  grid-column: 1 / -1;
}

.erechnung-search-bar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

@media (min-width: 640px) {
  .erechnung-search-bar {
    flex-direction: row;
    align-items: stretch;
  }
}

.erechnung-search-input-wrap {
  position: relative;
  flex: 1;
}

.erechnung-search-input-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: #94a3b8;
  pointer-events: none;
}

.erechnung-search-input-wrap input {
  padding-left: 2.25rem;
}

.erechnung-customers-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.erechnung-customers-card {
  padding: 0;
  overflow: hidden;
}

.erechnung-customers-card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.erechnung-customers-table-wrap {
  margin: 1.25rem 1.5rem 1.25rem;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}

.erechnung-customers-table-wrap .erechnung-data-table {
  min-width: 640px;
}

.erechnung-customer-cell-company {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.erechnung-customer-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: #fce7f3;
  color: #db2777;
  display: flex;
  align-items: center;
  justify-content: center;
}

.erechnung-customer-name {
  font-weight: 500;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erechnung-customer-sub {
  font-size: 0.75rem;
  color: #94a3b8;
}

.erechnung-customer-location,
.erechnung-customer-email-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #475569;
}

.erechnung-customers-empty {
  margin: 1.25rem 1.5rem 1.5rem;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: #475569;
  border: 1px dashed #e2e8f0;
  border-radius: 0.75rem;
  background: rgba(248, 250, 252, 0.8);
}

.erechnung-customers-pagination {
  padding: 0 1.5rem 1.25rem;
}

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

.erechnung-editor-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.25rem -0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #475569;
  text-decoration: none;
}

.erechnung-editor-back-link:hover {
  background: #f1f5f9;
}

.erechnung-editor-page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.erechnung-editor-page-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: #64748b;
}

.erechnung-editor-card {
  max-width: 48rem;
  padding: 1.5rem;
}

.erechnung-vat-input-wrap {
  position: relative;
}

.erechnung-vat-input-wrap input {
  padding-right: 2rem;
}

.erechnung-vat-suffix {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.75rem;
  color: #94a3b8;
  pointer-events: none;
}

@media (max-width: 767px) {
  .erechnung-data-table--hide-sm {
    display: none;
  }
}

/* Subscription page — Next.js /dashboard/subscription parity */
.erechnung-subscription-page {
  width: 100vw;
  max-width: 100vw;
  margin: -1.5rem calc(50% - 50vw) 0;
  min-height: calc(100vh - 7rem);
  background: radial-gradient(circle at top, #0d1b4f 0%, #0b1537 44%, #090f25 100%);
  color: #fff;
}

.erechnung-subscription-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 3rem;
}

@media (min-width: 640px) {
  .erechnung-subscription-main {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.erechnung-subscription-title {
  margin: 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  font-size: clamp(1.875rem, 4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.erechnung-subscription-intro {
  margin: 1rem 0 0;
  max-width: 48rem;
  color: #cbd5e1;
  line-height: 1.65;
}

.erechnung-subscription-hint {
  margin: 0.75rem 0 0;
  max-width: 48rem;
  font-size: 0.875rem;
  color: #94a3b8;
}

.erechnung-subscription-terms {
  margin: 1.25rem 0 0;
  max-width: 48rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  line-height: 1.65;
  color: rgba(148, 163, 184, 0.95);
}

.erechnung-subscription-notice {
  margin-top: 1rem;
  max-width: 48rem;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid transparent;
  font-size: 0.875rem;
  line-height: 1.5;
}

.erechnung-subscription-notice--success {
  border-color: rgba(110, 231, 183, 0.5);
  background: rgba(16, 185, 129, 0.1);
  color: #d1fae5;
}

.erechnung-subscription-notice--error {
  border-color: rgba(252, 165, 165, 0.5);
  background: rgba(239, 68, 68, 0.1);
  color: #fecaca;
}

.erechnung-subscription-notice--info {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.erechnung-subscription-grid {
  margin-top: 2.5rem;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .erechnung-subscription-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .erechnung-subscription-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.erechnung-subscription-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  padding: 1.5rem;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.erechnung-subscription-card.is-current {
  border-color: rgba(167, 139, 250, 0.8);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

.erechnung-subscription-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #ddd6fe;
}

.erechnung-subscription-card-price {
  margin-top: 0.5rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.erechnung-subscription-card-amount {
  font-size: 1.875rem;
  font-weight: 700;
  color: #fff;
}

.erechnung-subscription-card-period {
  font-size: 0.875rem;
  color: #94a3b8;
}

.erechnung-subscription-features {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  list-style: disc;
  font-size: 0.875rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.erechnung-subscription-features li + li {
  margin-top: 0.375rem;
}

.erechnung-subscription-card-action {
  margin-top: auto;
  padding-top: 1.25rem;
}

.erechnung-subscription-current {
  font-size: 0.875rem;
  font-weight: 600;
  color: #6ee7b7;
}

.erechnung-subscription-buy-btn {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border: none;
  border-radius: 0.75rem;
  background: #7c3aed;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.erechnung-subscription-buy-btn:hover:not(:disabled) {
  background: #8b5cf6;
}

.erechnung-subscription-buy-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.erechnung-subscription-free-note,
.erechnung-subscription-unavailable {
  margin: 0;
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.45;
  color: #94a3b8;
}

/* Dashboard home — tier comparison grid */
.erechnung-tier-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

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

@media (min-width: 1024px) {
  .erechnung-tier-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.erechnung-tier-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.erechnung-tier-card-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.erechnung-hero-strip {
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: radial-gradient(circle at top, #132d72 0%, #0f1f4d 38%, #0b132e 100%);
  color: #fff;
}

.erechnung-hero-strip-inner {
  padding: 1.5rem 2rem;
}

.erechnung-progress {
  margin-top: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.erechnung-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

/* Global toast stack — parity with Next.js AppToast */
.erechnung-toast-stack {
  position: fixed;
  bottom: 5rem;
  right: 0.75rem;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(calc(100vw - 1.5rem), 360px);
  pointer-events: none;
}

@media (min-width: 640px) {
  .erechnung-toast-stack {
    right: 1rem;
  }
}

@media (min-width: 1024px) {
  .erechnung-toast-stack {
    bottom: 1rem;
  }
}

.erechnung-toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 240px;
  max-width: min(calc(100vw - 1.5rem), 360px);
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 10px 15px -3px rgba(15, 23, 42, 0.15), 0 4px 6px -4px rgba(15, 23, 42, 0.1);
  opacity: 0;
  transform: translateY(1rem) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}

.erechnung-toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.erechnung-toast--success {
  background: var(--erechnung-success);
}

.erechnung-toast--error {
  background: #dc2626;
}

.erechnung-toast--warning {
  background: #d97706;
}

.erechnung-toast--info {
  background: #1e293b;
}

.erechnung-toast-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.erechnung-toast-message {
  flex: 1 1 auto;
  min-width: 0;
}

.erechnung-toast-close {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-left: 0.125rem;
  padding: 0.25rem;
  border: none;
  border-radius: 0.375rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}

.erechnung-toast-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Dashboard — recent documents card */
.erechnung-recent-docs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.erechnung-recent-docs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.erechnung-recent-docs-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #0f172a;
}

.erechnung-recent-docs-hint {
  font-size: 0.75rem;
  color: #64748b;
}

.erechnung-recent-docs-card {
  padding: 0;
  overflow: hidden;
}

.erechnung-recent-docs-table-wrap {
  overflow-x: auto;
}

.erechnung-recent-docs-table {
  width: 100%;
  min-width: 640px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
}

.erechnung-recent-docs-table thead tr {
  text-align: left;
}

.erechnung-recent-docs-table th {
  padding: 0.875rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.erechnung-recent-docs-table th:first-child {
  padding-left: 1rem;
}

.erechnung-recent-docs-table th:last-child {
  padding-right: 1rem;
}

.erechnung-recent-docs-table td {
  padding: 0.875rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

.erechnung-recent-docs-table td:first-child {
  padding-left: 1rem;
}

.erechnung-recent-docs-table td:last-child {
  padding-right: 1rem;
}

.erechnung-recent-docs-table tbody tr:last-child td {
  border-bottom: none;
}

.erechnung-recent-docs-table--strong {
  font-weight: 600;
  color: #0f172a;
}

.erechnung-recent-docs-table--truncate {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erechnung-recent-docs-table--actions {
  text-align: right;
  white-space: nowrap;
}

.erechnung-recent-docs-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  color: #334155;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.erechnung-recent-docs-edit:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
}

.erechnung-recent-docs-footer {
  display: flex;
  justify-content: flex-end;
}

.erechnung-recent-docs-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
  transition: color 0.15s ease, gap 0.15s ease;
}

.erechnung-recent-docs-view-all:hover {
  color: #6d28d9;
  gap: 0.5rem;
}

.erechnung-recent-docs-view-all svg {
  flex-shrink: 0;
}

